summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx90
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx255
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx18
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx48
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx12
-rw-r--r--toolkit/inc/toolkit/helper/macros.hxx51
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx2
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx6
-rw-r--r--toolkit/source/awt/vclxtabcontrol.cxx2
-rw-r--r--toolkit/source/awt/vclxtabcontrol.hxx3
-rw-r--r--toolkit/source/awt/vclxtabpage.cxx3
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx22
-rw-r--r--toolkit/source/awt/vclxwindows.cxx412
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx1338
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx4
-rw-r--r--toolkit/source/controls/unocontrols.cxx78
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx15
-rw-r--r--toolkit/source/helper/property.cxx5
-rw-r--r--toolkit/source/helper/registerservices.cxx13
-rw-r--r--toolkit/source/helper/servicenames.cxx4
-rw-r--r--toolkit/source/helper/unowrapper.cxx2
-rw-r--r--vcl/inc/vcl/tabctrl.hxx1
-rw-r--r--vcl/source/control/group.cxx1
-rw-r--r--vcl/source/control/tabctrl.cxx34
24 files changed, 1999 insertions, 420 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 66950befa6e2..a487c9080ec0 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -82,6 +82,8 @@
#include <com/sun/star/awt/XComboBox.hpp>
#include <com/sun/star/awt/XCheckBox.hpp>
#include <com/sun/star/awt/XItemListListener.hpp>
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/awt/XSimpleTabController.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -92,6 +94,7 @@
#include <vcl/pointr.hxx>
#include <vcl/image.hxx>
+#include <vcl/tabctrl.hxx>
#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event
class Button;
@@ -372,6 +375,40 @@ public:
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
};
+// ----------------------------------------------------
+// class VCLXFrame
+// ----------------------------------------------------
+class VCLXFrame : public VCLXContainer
+{
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+public:
+ VCLXFrame();
+ ~VCLXFrame();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
// ----------------------------------------------------
@@ -449,6 +486,59 @@ public:
// ::com::sun::star::awt::XVclWindowPeer
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ TabPage* getTabPage() const throw ( ::com::sun::star::uno::RuntimeException);
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+class VCLXMultiPage : public ::com::sun::star::awt::XSimpleTabController, public VCLXContainer
+{
+ TabListenerMultiplexer maTabListeners;
+ sal_Int32 mTabId;
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+public:
+ VCLXMultiPage();
+ ~VCLXMultiPage();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+ // XSimpleTabController
+ virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ // C++
+ TabControl* getTabControl() const throw ( ::com::sun::star::uno::RuntimeException);
+ USHORT insertTab( TabPage*, rtl::OUString& sTitle );
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
};
// ----------------------------------------------------
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index 04b8c9b9f9c6..db9f9ee41fe7 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -35,12 +35,16 @@
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/util/XChangesNotifier.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/awt/XTabListener.hpp>
+#include <com/sun/star/awt/XSimpleTabController.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/awt/XDialog2.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <cppuhelper/implbase6.hxx>
#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include "toolkit/helper/servicenames.hxx"
@@ -68,11 +72,12 @@ class UnoControlDialogModel : public UnoControlDialogModel_IBase
, public UnoControlDialogModel_Base
{
public:
+ enum ChildOperation { Insert = 0, Remove };
// would like to make this typedef private, too, but the Forte 7 compiler does have
// problems with this .....
typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
UnoControlModelHolder;
-private:
+protected:
typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
// for grouping control models (XTabControllerModel::getGroupXXX)
@@ -84,7 +89,7 @@ private:
friend struct FindControlModel;
friend struct CompareControlModel;
-private:
+protected:
ContainerListenerMultiplexer maContainerListeners;
::cppu::OInterfaceContainerHelper maChangeListeners;
UnoControlModelHolderList maModels;
@@ -95,13 +100,14 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
bool mbAdjustingGraphic;
protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
+ void updateUserFormChildren( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) ;
public:
- UnoControlDialogModel();
+ UnoControlDialogModel( bool bRegProps = true );
UnoControlDialogModel( const UnoControlDialogModel& rModel );
~UnoControlDialogModel();
@@ -124,13 +130,6 @@ public:
::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::container::XIndexContainer, XIndexReplace, XIndexAcces
- // void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
- // sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) = 0;
- // ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
- // void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
- // void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
-
// ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
@@ -180,12 +179,11 @@ public:
protected:
void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
- // ::cppu::OPropertySetHelper
- void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
-
void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
void implUpdateGroupStructure();
+ // ::cppu::OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
private:
void AddRadioButtonToGroup (
const ::com::sun::star::uno::Reference< XControlModel >& rControlModel,
@@ -196,17 +194,6 @@ private:
::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
};
-// ----------------------------------------------------
-// class UnoDialogControl
-// ----------------------------------------------------
-typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
- , ::com::sun::star::awt::XTopWindow
- , ::com::sun::star::awt::XDialog2
- , ::com::sun::star::util::XChangesListener
- , ::com::sun::star::util::XModifyListener
- , ::com::sun::star::awt::XWindowListener
- > UnoDialogControl_IBase;
-
class ResourceListener :public ::com::sun::star::util::XModifyListener,
public ::cppu::OWeakObject,
public ::cppu::BaseMutex
@@ -235,29 +222,78 @@ class ResourceListener :public ::com::sun::star::util::XModifyListener,
bool m_bListening;
};
-class UnoDialogControl :public UnoControlContainer
- ,public UnoDialogControl_IBase
+typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
+ ::com::sun::star::util::XChangesListener >
+ UnoDialogContainerControl_IBase;
+
+class UnoDialogContainerControl : public UnoControlContainer, public UnoDialogContainerControl_IBase
+{
+protected:
+ bool mbSizeModified;
+ bool mbPosModified;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
+ void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
+ void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
+
+public:
+ UnoDialogContainerControl();
+ ~UnoDialogContainerControl();
+
+ DECLIMPL_SERVICEINFO_DERIVED( UnoDialogContainerControl, UnoControlBase, "com.sun.star.awt.UnoDialogContainerControl" )
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainerListener
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+};
+
+
+
+class UnoDialogControl :public UnoDialogContainerControl
+ ,public ::com::sun::star::awt::XTopWindow, public ::com::sun::star::awt::XDialog2, public ::com::sun::star::awt::XWindowListener
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
TopWindowListenerMultiplexer maTopWindowListeners;
bool mbWindowListener;
- bool mbSizeModified;
- bool mbPosModified;
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
protected:
void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
- void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
- void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
void ImplUpdateResourceResolver();
void ImplStartListingForResourceEvents();
public:
- UnoDialogControl();
+ UnoDialogControl();
+ ~UnoDialogControl();
::rtl::OUString GetComponentServiceName();
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
@@ -282,11 +318,6 @@ public:
virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::container::XContainerListener
- void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::awt::XDialog2
virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException);
@@ -303,10 +334,6 @@ public:
// ::com::sun::star::awt::XControl
sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
-
- // XChangesListener
- virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
@@ -317,12 +344,150 @@ public:
protected:
virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
+protected:
+};
+
+class UnoMultiPageModel : public UnoControlDialogModel
+{
+public:
+ UnoMultiPageModel();
+ ~UnoMultiPageModel();
+ UnoMultiPageModel( const UnoMultiPageModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlDialogModel, szServiceName_UnoMultiPageModel )
+
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
+ // XNamedContainer
+ void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // Override the method of parent Class
+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
protected:
- virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
- virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+};
+
+class UnoMultiPageControl : public UnoDialogContainerControl
+ ,public ::com::sun::star::awt::XSimpleTabController
+ ,public ::com::sun::star::awt::XTabListener
+{
+ TabListenerMultiplexer maTabListeners;
+ void bindPage( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+public:
+ UnoMultiPageControl();
+ ~UnoMultiPageControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoDialogContainerControl, szServiceName_UnoMultiPageControl )
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoDialogContainerControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ // com::sun::star::awt::XSimpleTabController
+ virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ // XTabListener
+ virtual void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void impl_createControlPeerIfNecessary(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
+ );
+
+};
+
+
+class UnoPageModel : public UnoControlDialogModel
+{
+public:
+ UnoPageModel();
+ ~UnoPageModel();
+ UnoPageModel( const UnoPageModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel, UnoControlDialogModel, szServiceName_UnoPageModel )
+
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // Override the method of parent Class
+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
+protected:
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+};
+
+
+class UnoPageControl : public UnoDialogContainerControl
+{
+public:
+ UnoPageControl();
+ ~UnoPageControl();
+ ::rtl::OUString GetComponentServiceName();
+
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
+};
+
+class UnoFrameModel : public UnoControlDialogModel
+{
+public:
+ UnoFrameModel();
+ ~UnoFrameModel();
+ UnoFrameModel( const UnoFrameModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel, UnoControlDialogModel, szServiceName_UnoFrameModel )
+
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw( ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
};
+class UnoFrameControl : public UnoDialogContainerControl
+{
+protected:
+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
+public:
+ UnoFrameControl();
+ ~UnoFrameControl();
+ ::rtl::OUString GetComponentServiceName();
+
+// ::com::sun::star::lang::XServiceInfo
+DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
+};
#endif // TOOLKIT_DIALOG_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
index a566fef2716e..d2b225d23411 100644
--- a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -120,6 +120,15 @@ protected:
virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ /** ensures that the given control has a peer, if necessary and possible
+ @param _rxControl
+ an ->XControl which has just been inserted into the container. Must not be <NULL/>.
+ @precond
+ our mutex is locked
+ */
+ virtual void impl_createControlPeerIfNecessary(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
+ );
private:
/** adds the control to the container, does necessary notifications, and the like
@param _rxControl
@@ -150,15 +159,6 @@ private:
const ::rtl::OUString* _pNameAccessor
);
- /** ensures that the given control has a peer, if necessary and possible
- @param _rxControl
- an ->XControl which has just been inserted into the container. Must not be <NULL/>.
- @precond
- our mutex is locked
- */
- void impl_createControlPeerIfNecessary(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
- );
};
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index 21b634155585..531467f359be 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -72,6 +72,16 @@
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
+class ImageHelper
+{
+public:
+ // The routine will always attempt to return a valid XGraphic for the passed _rURL
+ // additionallly xOutGraphicObject will container the associated XGraphicObject ( if url
+ // is valid for that )
+ // and is set appropriately ( e.g. NULL if non GraphicObject scheme ) or valid object
+ // if the rURL points to a valid object
+ static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicAndGraphicObjectFromURL_nothrow( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject >& xOutGraphicObject, const ::rtl::OUString& _rURL );
+};
// ----------------------------------------------------
// class UnoControlEditModel
@@ -637,44 +647,6 @@ public:
};
-class UnoMultiPageModel : public UnoControlModel
-{
-protected:
- ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
- ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
-public:
- UnoMultiPageModel();
- UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;}
-
- UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); }
-
- // ::com::sun::star::io::XPersistObject
- ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::beans::XMultiPropertySet
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel )
-
-};
-// ----------------------------------------------------
-// class UnoGroupBoxControl
-// ----------------------------------------------------
-class UnoMultiPageControl : public UnoControlBase
-{
-public:
- UnoMultiPageControl();
- ::rtl::OUString GetComponentServiceName();
-
- sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::lang::XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl )
-
-};
-
// ----------------------------------------------------
// class UnoFixedTextControl
// ----------------------------------------------------
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index 38d7300382cd..ac38197bc5f1 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -42,6 +42,7 @@
#include <com/sun/star/awt/XTextListener.hpp>
#include <com/sun/star/awt/XActionListener.hpp>
#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XTabListener.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/awt/XSpinListener.hpp>
#include <com/sun/star/awt/XAdjustmentListener.hpp>
@@ -184,6 +185,17 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer, ::com::sun::star
DECL_LISTENERMULTIPLEXER_END
// ----------------------------------------------------
+// class TabListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener )
+ void SAL_CALL inserted( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removed( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL changed( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deactivated( ::sal_Int32 ID ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
// class ContainerListenerMultiplexer
// ----------------------------------------------------
DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx
index 9fac9cb14582..243ab8e4563d 100644
--- a/toolkit/inc/toolkit/helper/macros.hxx
+++ b/toolkit/inc/toolkit/helper/macros.hxx
@@ -190,6 +190,57 @@ void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::
#define DISPLAY_EXCEPTION( ClassName, MethodName, e )
#endif
+#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( ClassName, InterfaceName, MethodName, ParamType1, ParamType2 ) \
+{ \
+ ParamType1 aMulti( evt ); \
+ ParamType2 aMulti2( evt2 ); \
+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
+ while( aIt.hasMoreElements() ) \
+ { \
+ ::com::sun::star::uno::Reference< InterfaceName > xListener( \
+ static_cast< InterfaceName* >( aIt.next() ) ); \
+ try \
+ { \
+ xListener->MethodName( aMulti, aMulti2 ); \
+ } \
+ catch( ::com::sun::star::lang::DisposedException e ) \
+ { \
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
+ if ( e.Context == xListener || !e.Context.is() ) \
+ aIt.remove(); \
+ } \
+ catch( ::com::sun::star::uno::RuntimeException e ) \
+ { \
+ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
+ } \
+ } \
+}
+
+#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( ClassName, InterfaceName, MethodName, ParamType1 ) \
+{ \
+ ParamType1 aMulti( evt ); \
+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
+ while( aIt.hasMoreElements() ) \
+ { \
+ ::com::sun::star::uno::Reference< InterfaceName > xListener( \
+ static_cast< InterfaceName* >( aIt.next() ) ); \
+ try \
+ { \
+ xListener->MethodName( aMulti ); \
+ } \
+ catch( ::com::sun::star::lang::DisposedException e ) \
+ { \
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
+ if ( e.Context == xListener || !e.Context.is() ) \
+ aIt.remove(); \
+ } \
+ catch( ::com::sun::star::uno::RuntimeException e ) \
+ { \
+ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
+ } \
+ } \
+}
+
#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \
{ \
EventType aMulti( evt ); \
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index 611384b89d22..9b077cab2709 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -205,6 +205,8 @@ namespace rtl {
#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
#define BASEPROPERTY_GROUPNAME 154 // ::rtl::OUString
+#define BASEPROPERTY_MULTIPAGEVALUE 155 // sal_Int32
+#define BASEPROPERTY_USERFORMCONTAINEES 156 // css::container::XNameContainer
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 9b13eb07c21d..1ec5298cf303 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -38,9 +38,13 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup
extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[];
extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[];
-extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoPageControl[], szServiceName2_UnoPageControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoPageModel[], szServiceName2_UnoPageModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoFrameControl[], szServiceName2_UnoFrameControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoFrameModel[], szServiceName2_UnoFrameModel[];
extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlDialog[], szServiceName2_UnoControlDialog[];
diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx
index 4b6300befad8..1874e654cbcd 100644
--- a/toolkit/source/awt/vclxtabcontrol.cxx
+++ b/toolkit/source/awt/vclxtabcontrol.cxx
@@ -26,7 +26,7 @@
*
************************************************************************/
-#include "vclxtabcontrol.hxx"
+#include <vclxtabcontrol.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <sal/macros.h>
diff --git a/toolkit/source/awt/vclxtabcontrol.hxx b/toolkit/source/awt/vclxtabcontrol.hxx
index dfe1b0975346..e5d391b0c783 100644
--- a/toolkit/source/awt/vclxtabcontrol.hxx
+++ b/toolkit/source/awt/vclxtabcontrol.hxx
@@ -123,6 +123,8 @@ public:
ChildProps( VCLXTabControl::ChildData *pData );
};
+ inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException);
+
protected:
ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
ChildProps *createChildProps( Box_Base::ChildData* pData );
@@ -133,7 +135,6 @@ protected:
std::list< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabListener > > mxTabListeners;
- inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException);
private:
VCLXTabControl( const VCLXTabControl& ); // never implemented
diff --git a/toolkit/source/awt/vclxtabpage.cxx b/toolkit/source/awt/vclxtabpage.cxx
index 42d4d683cee6..c50e40ec331e 100644
--- a/toolkit/source/awt/vclxtabpage.cxx
+++ b/toolkit/source/awt/vclxtabpage.cxx
@@ -26,7 +26,8 @@
*
************************************************************************/
-#include "vclxtabpage.hxx"
+#include <vclxtabpage.hxx>
+
#include "forward.hxx"
#include <com/sun/star/awt/PosSize.hpp>
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 3a80494bb979..308e7f14736f 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -116,6 +116,7 @@
#include <tools/debug.hxx>
#include <comphelper/processfactory.hxx>
+#include "awt/vclxtabcontrol.hxx"
namespace css = ::com::sun::star;
@@ -283,6 +284,7 @@ static ComponentInfo __FAR_DATA aComponentInfos [] =
{ "floatingwindow", WINDOW_FLOATINGWINDOW },
{ "framewindow", VCLWINDOW_FRAMEWINDOW },
{ "groupbox", WINDOW_GROUPBOX },
+ { "frame", WINDOW_GROUPBOX },
{ "helpbutton", WINDOW_HELPBUTTON },
{ "imagebutton", WINDOW_IMAGEBUTTON },
{ "imageradiobutton", WINDOW_IMAGERADIOBUTTON },
@@ -623,7 +625,14 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
Window* pNewWindow = NULL;
sal_uInt16 nType = ImplGetComponentType( aServiceName );
-
+ bool bFrameControl = false;
+ if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("frame") ) )
+ bFrameControl = true;
+ if ( aServiceName == String( RTL_CONSTASCII_USTRINGPARAM("tabcontrolnotabs") ) )
+ {
+ nWinBits |= WB_NOBORDER;
+ nType = ImplGetComponentType( String( RTL_CONSTASCII_USTRINGPARAM("tabcontrol") ) );
+ }
if ( !pParent )
{
// Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
@@ -720,7 +729,17 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
pNewWindow = new FloatingWindow( pParent, nWinBits );
break;
case WINDOW_GROUPBOX:
+ {
pNewWindow = new GroupBox( pParent, nWinBits );
+ if ( bFrameControl )
+ {
+ GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
+ *ppNewComp = new VCLXFrame;
+ // Frame control needs to recieve
+ // Mouse events
+ pGroupBox->SetMouseTransparent( FALSE );
+ }
+ }
break;
case WINDOW_HELPBUTTON:
pNewWindow = new HelpButton( pParent, nWinBits );
@@ -860,6 +879,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_TABCONTROL:
pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXMultiPage;
break;
case WINDOW_TABDIALOG:
pNewWindow = new TabDialog( pParent, nWinBits );
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 52a97a7a435d..fe2ba597d299 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2290,6 +2290,7 @@ void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
VCLXDialog::VCLXDialog()
{
+ OSL_TRACE("XDialog created");
}
VCLXDialog::~VCLXDialog()
@@ -2498,6 +2499,292 @@ throw(::com::sun::star::uno::RuntimeException)
}
}
+
+// ----------------------------------------------------
+// class VCLXTabPage
+// ----------------------------------------------------
+VCLXMultiPage::VCLXMultiPage() : maTabListeners( *this ), mTabId( 1 )
+{
+ OSL_TRACE("VCLXMultiPage::VCLXMultiPage()" );
+}
+
+void VCLXMultiPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_MULTIPAGEVALUE,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEALIGN,
+ BASEPROPERTY_IMAGEPOSITION,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_FOCUSONCLICK,
+ 0);
+ VCLXContainer::ImplGetPropertyIds( rIds );
+}
+
+VCLXMultiPage::~VCLXMultiPage()
+{
+}
+void SAL_CALL VCLXMultiPage::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maTabListeners.disposeAndClear( aObj );
+ VCLXContainer::dispose();
+}
+::com::sun::star::uno::Any SAL_CALL VCLXMultiPage::queryInterface(const ::com::sun::star::uno::Type & rType )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType, static_cast< awt::XSimpleTabController*>( this ) );
+
+ return ( aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ) );
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXMultiPage )
+ VCLXContainer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XView
+void SAL_CALL VCLXMultiPage::draw( sal_Int32 nX, sal_Int32 nY )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+// ::com::sun::star::awt::XDevice,
+::com::sun::star::awt::DeviceInfo SAL_CALL VCLXMultiPage::getInfo()
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+uno::Any SAL_CALL VCLXMultiPage::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ OSL_TRACE(" **** VCLXMultiPage::getProperty( %s )",
+ rtl::OUStringToOString( PropertyName,
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+ ::com::sun::star::uno::Any aProp;
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+
+ case BASEPROPERTY_MULTIPAGEVALUE:
+ {
+ aProp <<= getActiveTabID();
+ }
+ break;
+ default:
+ aProp <<= VCLXContainer::getProperty( PropertyName );
+ }
+ return aProp;
+}
+
+void SAL_CALL VCLXMultiPage::setProperty(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Any& Value )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ OSL_TRACE(" **** VCLXMultiPage::setProperty( %s )", rtl::OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ TabControl* pTabControl = (TabControl*)GetWindow();
+ if ( pTabControl )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_MULTIPAGEVALUE:
+ {
+ OSL_TRACE("***MULTIPAGE VALUE");
+ sal_Int32 nId(0);
+ Value >>= nId;
+ // when the multipage is created we attempt to set the activepage
+ // but no pages created
+ if ( nId && nId <= getWindows().getLength() )
+ activateTab( nId );
+ }
+ case BASEPROPERTY_GRAPHIC:
+ {
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
+ {
+ Image aImage( xGraphic );
+
+ Wallpaper aWallpaper( aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WALLPAPER_SCALE );
+ pTabControl->SetBackground( aWallpaper );
+ }
+ else if ( bVoid || !xGraphic.is() )
+ {
+ Color aColor = pTabControl->GetControlBackground().GetColor();
+ if ( aColor == COL_AUTO )
+ aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
+
+ Wallpaper aWallpaper( aColor );
+ pTabControl->SetBackground( aWallpaper );
+ }
+ }
+ break;
+
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+TabControl *VCLXMultiPage::getTabControl() const throw (uno::RuntimeException)
+{
+ TabControl *pTabControl = dynamic_cast< TabControl* >( GetWindow() );
+ if ( pTabControl )
+ return pTabControl;
+ throw uno::RuntimeException();
+}
+sal_Int32 SAL_CALL VCLXMultiPage::insertTab() throw (uno::RuntimeException)
+{
+ TabControl *pTabControl = getTabControl();
+ TabPage* pTab = new TabPage( pTabControl );
+ rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) );
+ return static_cast< sal_Int32 >( insertTab( pTab, title ) );
+}
+
+USHORT VCLXMultiPage::insertTab( TabPage* pPage, rtl::OUString& sTitle )
+{
+ TabControl *pTabControl = getTabControl();
+ USHORT id = sal::static_int_cast< USHORT >( mTabId++ );
+ pTabControl->InsertPage( id, sTitle.getStr(), TAB_APPEND );
+ pTabControl->SetTabPage( id, pPage );
+ return id;
+}
+
+void SAL_CALL VCLXMultiPage::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw lang::IndexOutOfBoundsException();
+ pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) );
+}
+
+void SAL_CALL VCLXMultiPage::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ OSL_TRACE("Attempting to activate tab %d, active tab is %d, numtabs is %d", ID, getActiveTabID(), getWindows().getLength() );
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw lang::IndexOutOfBoundsException();
+ pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) );
+}
+
+sal_Int32 SAL_CALL VCLXMultiPage::getActiveTabID() throw (uno::RuntimeException)
+{
+ return getTabControl()->GetCurPageId( );
+}
+
+void SAL_CALL VCLXMultiPage::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maTabListeners.addInterface( xListener );
+}
+
+void SAL_CALL VCLXMultiPage::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maTabListeners.addInterface( xListener );
+}
+
+void SAL_CALL VCLXMultiPage::setTabProps( sal_Int32 ID, const uno::Sequence< beans::NamedValue >& Properties ) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw lang::IndexOutOfBoundsException();
+
+ for ( int i = 0; i < Properties.getLength(); i++ )
+ {
+ const rtl::OUString &name = Properties[i].Name;
+ const uno::Any &value = Properties[i].Value;
+
+ if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) )
+ {
+ rtl::OUString title = value.get<rtl::OUString>();
+ pTabControl->SetPageText( sal::static_int_cast< USHORT >( ID ), title.getStr() );
+ }
+ }
+}
+
+uno::Sequence< beans::NamedValue > SAL_CALL VCLXMultiPage::getTabProps( sal_Int32 ID )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw lang::IndexOutOfBoundsException();
+
+#define ADD_PROP( seq, i, name, val ) { \
+ beans::NamedValue value; \
+ value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
+ value.Value = uno::makeAny( val ); \
+ seq[i] = value; \
+ }
+
+ uno::Sequence< beans::NamedValue > props( 2 );
+ ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) );
+ ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) );
+#undef ADD_PROP
+ return props;
+}
+void VCLXMultiPage::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_DEACTIVATE:
+ {
+ ULONG nPageID = (ULONG)( rVclWindowEvent.GetData() );
+ maTabListeners.deactivated( nPageID );
+ break;
+
+ }
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ {
+ ULONG nPageID = (ULONG)( rVclWindowEvent.GetData() );
+ maTabListeners.activated( nPageID );
+ break;
+ }
+ default:
+ VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ };
+}
+
// ----------------------------------------------------
// class VCLXTabPage
// ----------------------------------------------------
@@ -2505,6 +2792,27 @@ VCLXTabPage::VCLXTabPage()
{
}
+void VCLXTabPage::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEALIGN,
+ BASEPROPERTY_IMAGEPOSITION,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_FOCUSONCLICK,
+ 0);
+ VCLXContainer::ImplGetPropertyIds( rIds );
+}
+
VCLXTabPage::~VCLXTabPage()
{
}
@@ -2594,9 +2902,18 @@ throw(::com::sun::star::uno::RuntimeException)
}
}
+TabPage *VCLXTabPage::getTabPage() const throw (uno::RuntimeException)
+{
+ TabPage *pTabPage = dynamic_cast< TabPage* >( GetWindow() );
+ if ( pTabPage )
+ return pTabPage;
+ throw uno::RuntimeException();
+}
+
// ----------------------------------------------------
// class VCLXFixedHyperlink
// ----------------------------------------------------
+
VCLXFixedHyperlink::VCLXFixedHyperlink() :
maActionListeners( *this )
@@ -6268,4 +6585,99 @@ VCLXToolBox::~VCLXToolBox()
return getAccessibleFactory().createAccessibleContext( this );
}
+// ----------------------------------------------------
+// class VCLXFrame
+// ----------------------------------------------------
+VCLXFrame::VCLXFrame()
+{
+}
+
+void VCLXFrame::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_LABEL,
+ 0);
+ VCLXContainer::ImplGetPropertyIds( rIds );
+}
+
+VCLXFrame::~VCLXFrame()
+{
+}
+
+::com::sun::star::uno::Any SAL_CALL VCLXFrame::queryInterface(const ::com::sun::star::uno::Type & rType )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXContainer::queryInterface( rType );
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFrame )
+ VCLXContainer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XView
+void SAL_CALL VCLXFrame::draw( sal_Int32 nX, sal_Int32 nY )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+// ::com::sun::star::awt::XDevice,
+::com::sun::star::awt::DeviceInfo SAL_CALL VCLXFrame::getInfo()
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+void SAL_CALL VCLXFrame::setProperty(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Any& Value )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+ (void)bVoid;
+#endif
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
+ }
+ }
+}
+
+void VCLXFrame::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index b80222108594..9481d2ae37ed 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -68,10 +68,16 @@
#include "grid/gridcontrol.hxx"
#include <map>
+#include <hash_map>
#include <algorithm>
#include <functional>
#include "tools/urlobj.hxx"
#include "osl/file.hxx"
+#include <com/sun/star/awt/XSimpleTabController.hpp>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/button.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -236,14 +242,92 @@ static const ::rtl::OUString& getStepPropertyName( )
return s_sStepProperty;
}
+// we probably will need both a hash of control models and hash of controls
+// => use some template magic
+
+typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
+
+template< typename T >
+class SimpleNamedThingContainer : public SimpleNameContainer_BASE
+{
+ typedef std::hash_map< rtl::OUString, Reference< T >, ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > NamedThingsHash;
+ NamedThingsHash things;
+ ::osl::Mutex m_aMutex;
+public:
+ // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName( aName ) )
+ throw NoSuchElementException();
+ Reference< T > xElement;
+ if ( ! ( aElement >>= xElement ) )
+ throw IllegalArgumentException();
+ things[ aName ] = xElement;
+ }
+ virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName( aName ) )
+ throw NoSuchElementException();
+ return uno::makeAny( things[ aName ] );
+ }
+ virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Sequence< ::rtl::OUString > aResult( things.size() );
+ typename NamedThingsHash::iterator it = things.begin();
+ typename NamedThingsHash::iterator it_end = things.end();
+ rtl::OUString* pName = aResult.getArray();
+ for (; it != it_end; ++it, ++pName )
+ *pName = it->first;
+ return aResult;
+ }
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ( things.find( aName ) != things.end() );
+ }
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( hasByName( aName ) )
+ throw ElementExistException();
+ Reference< T > xElement;
+ if ( ! ( aElement >>= xElement ) )
+ throw IllegalArgumentException();
+ things[ aName ] = xElement;
+ }
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !hasByName( aName ) )
+ throw NoSuchElementException();
+ things.erase( things.find( aName ) );
+ }
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException)
+ {
+ return T::static_type( NULL );
+ }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ( things.size() > 0 );
+ }
+};
+
+
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
-UnoControlDialogModel::UnoControlDialogModel()
+UnoControlDialogModel::UnoControlDialogModel( bool regProps )
:maContainerListeners( *this )
,maChangeListeners ( GetMutex() )
,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
{
+ if ( regProps )
+ {
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
@@ -264,6 +348,9 @@ UnoControlDialogModel::UnoControlDialogModel()
aBool <<= (sal_Bool) sal_True;
ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
+ uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
+ }
}
UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
@@ -304,7 +391,7 @@ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
- UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+ UnoControlDialogModel_Base::setFastPropertyValue_NoBroadcast( nHandle, rValue );
try
{
switch ( nHandle )
@@ -315,12 +402,12 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) );
mbAdjustingGraphic = false;
}
break;
- case BASEPROPERTY_GRAPHIC:
+ case BASEPROPERTY_GRAPHIC:
if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
{
mbAdjustingGraphic = true;
@@ -328,14 +415,15 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32
mbAdjustingGraphic = false;
}
break;
- }
+ }
}
catch( const ::com::sun::star::uno::Exception& )
{
- OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
+ OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting ImageURL properties!" );
}
}
+
Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
Any aAny;
@@ -478,6 +566,10 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt
pNewModel = new OGeometryControlModel< UnoTreeModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoGridModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoMultiPageModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoMultiPageModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoFrameModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoFrameModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
@@ -521,7 +613,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
if ( !pNamesSeq )
{
- pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
+ pNamesSeq = new Sequence< ::rtl::OUString >( 25 );
::rtl::OUString* pNames = pNamesSeq->getArray();
pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
@@ -544,9 +636,11 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
+
pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
+ pNames[24] = ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
}
return *pNamesSeq;
}
@@ -569,6 +663,55 @@ Type UnoControlDialogModel::getElementType() throw(RuntimeException)
return aType;
}
+void UnoControlDialogModel::updateUserFormChildren( const Reference< XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ if ( Operation < Insert || Operation > Remove )
+ throw IllegalArgumentException();
+
+ if ( xAllChildren.is() )
+ {
+ if ( Operation == Remove )
+ {
+ Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY );
+ xAllChildren->removeByName( aName );
+
+ Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY );
+ if ( xChildContainer.is() )
+ {
+ Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
+ // container control is being removed from this container, reset the
+ // global list of containees
+ if ( xProps.is() )
+ xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );
+ Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
+ for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
+ updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, Reference< XControlModel > () );
+ }
+ }
+ else if ( Operation == Insert )
+ {
+ xAllChildren->insertByName( aName, uno::makeAny( xTarget ) );
+ Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY );
+ if ( xChildContainer.is() )
+ {
+ // container control is being added from this container, reset the
+ // global list of containees to point to the correct global list
+ Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
+ if ( xProps.is() )
+ xProps->setPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );
+ Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
+ for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
+ {
+ Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY );
+ updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget );
+ }
+ }
+ }
+ }
+ else
+ throw IllegalArgumentException();
+}
+
sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
{
return !maModels.empty();
@@ -588,6 +731,20 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
if ( maModels.end() == aElementPos )
lcl_throwNoSuchElementException();
+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
+ // With container controls you could have constructed an existing hierachy and are now
+ // add this to an existing container, in this case a name nested in the containment
+ // hierachy of the added control could contain a name clash, if we have access to the
+ // list of global names then recursively check for previously existing names ( we need
+ // to do this obviously before the 'this' objects container is updated
+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
+ if ( xAllChildren.is() )
+ {
+ // remove old control ( and children ) from global list of containees
+ updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
+ // Add new control ( and containees if they exist )
+ updateUserFormChildren( xAllChildren, aName, Insert, xNewModel );
+ }
// stop listening at the old model
stopControlListening( aElementPos->first );
Reference< XControlModel > xReplaced( aElementPos->first );
@@ -595,6 +752,7 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
aElementPos->first = xNewModel;
startControlListening( xNewModel );
+
ContainerEvent aEvent;
aEvent.Source = *this;
aEvent.Element = aElement;
@@ -651,11 +809,17 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
- if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
+ if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
{
Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
- ::rtl::OUString absoluteUrl =
+ ::rtl::OUString absoluteUrl;
+ aUrl >>= absoluteUrl;
+ if ( absoluteUrl.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
+ // Now we inherit from this class, no all containers have
+ // DialogSourceURL
+ else if ( getPropertySetInfo()->hasPropertyByName( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ) )
getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
aUrl <<= absoluteUrl;
@@ -671,10 +835,25 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
lcl_throwIllegalArgumentException();
UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+
if ( maModels.end() != aElementPos )
lcl_throwElementExistException();
+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
+ // With container controls you could have constructed an existing hierachy and are now
+ // add this to an existing container, in this case a name nested in the containment
+ // hierachy of the added control could contain a name clash, if we have access to the
+ // list of global names then we need to recursively check for previously existing
+ // names ( we need to do this obviously before the 'this' objects container is updated
+ // remove old control ( and children ) from global list of containees
+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
+
+ if ( xAllChildren.is() )
+ updateUserFormChildren( xAllChildren, aName, Insert, xM );
+
maModels.push_back( UnoControlModelHolder( xM, aName ) );
+
+
mbGroupsUpToDate = sal_False;
startControlListening( xM );
@@ -696,6 +875,15 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
if ( maModels.end() == aElementPos )
lcl_throwNoSuchElementException();
+ // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
+ // With container controls you could have constructed an existing hierachy and are now
+ // removing this control from an existing container, in this case all nested names in
+ // the containment hierachy of the control to be removed need to be removed from the global
+ // names cache ( we need to do this obviously before the 'this' objects container is updated )
+ Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
+ if ( xAllChildren.is() )
+ updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
+
ContainerEvent aEvent;
aEvent.Source = *this;
aEvent.Element <<= aElementPos->first;
@@ -705,6 +893,7 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
stopControlListening( aElementPos->first );
Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
maModels.erase( aElementPos );
+
mbGroupsUpToDate = sal_False;
if ( xPS.is() )
@@ -1363,67 +1552,624 @@ throw ( RuntimeException )
}
}
-// ============================================================================
-// = class UnoDialogControl
-// ============================================================================
+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
+{
+ ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
+ return aTmp;
+}
-UnoDialogControl::UnoDialogControl() :
- maTopWindowListeners( *this ),
- mbWindowListener(false),
- mbSizeModified(false),
- mbPosModified(false)
+// ----------------------------------------------------
+// class MultiPageControl
+// ----------------------------------------------------
+UnoMultiPageControl::UnoMultiPageControl() : maTabListeners( *this )
{
- maComponentInfos.nWidth = 300;
- maComponentInfos.nHeight = 450;
- mxListener = new ResourceListener( Reference< util::XModifyListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
}
-::rtl::OUString UnoDialogControl::GetComponentServiceName()
+UnoMultiPageControl::~UnoMultiPageControl()
+{
+}
+// XTabListener
+
+void SAL_CALL UnoMultiPageControl::inserted( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
+{
+}
+void SAL_CALL UnoMultiPageControl::removed( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
+{
+}
+void SAL_CALL UnoMultiPageControl::changed( ::sal_Int32 /*ID*/, const Sequence< NamedValue >& /*Properties*/ ) throw (RuntimeException)
+{
+}
+void SAL_CALL UnoMultiPageControl::activated( ::sal_Int32 ID ) throw (RuntimeException)
+{
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_False );
+
+}
+void SAL_CALL UnoMultiPageControl::deactivated( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
+{
+}
+void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException)
+{
+}
+
+void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maTabListeners.disposeAndClear( aEvt );
+ UnoDialogContainerControl::dispose();
+}
+
+// com::sun::star::awt::XSimpleTabController
+::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ return xMultiPage->insertTab();
+}
+
+void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ xMultiPage->removeTab( ID );
+}
+
+void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ xMultiPage->setTabProps( ID, Properties );
+}
+
+Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ return xMultiPage->getTabProps( ID );
+}
+
+void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ xMultiPage->activateTab( ID );
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), sal_True );
+
+}
+
+::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException)
+{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( !xMultiPage.is() )
+ throw RuntimeException();
+ return xMultiPage->getActiveTabID();
+}
+
+void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
+{
+ maTabListeners.addInterface( Listener );
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
+ xMultiPage->addTabListener( &maTabListeners );
+}
+
+void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
{
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+ if ( xMultiPage.is() && maTabListeners.getLength() == 1 )
+ xMultiPage->removeTabListener( &maTabListeners );
+ maTabListeners.removeInterface( Listener );
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
+ getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
+ UnoDialogContainerControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// uno::XInterface
+uno::Any UnoMultiPageControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XTabListener*, this ), SAL_STATIC_CAST( awt::XSimpleTabController*, this ) );
+ return (aRet.hasValue() ? aRet : UnoDialogContainerControl::queryAggregation( rType ));
+}
+
+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
+{
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( bDecoration )
- return ::rtl::OUString::createFromAscii( "Dialog" );
- else
- return ::rtl::OUString::createFromAscii( "TabPage" );
+ return ::rtl::OUString::createFromAscii( "tabcontrol" );
+ // Hopefully we can tweak the tabcontrol to display without tabs
+ return ::rtl::OUString::createFromAscii( "tabcontrolnotabs" );
+}
+
+void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
+{
+ uno::Reference< awt::XWindowPeer > xPage( _rxControl->getPeer() );
+ uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xProps( _rxControl->getModel(), uno::UNO_QUERY );
+
+ VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
+ TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
+ if ( xTabCntrl.is() && pPage )
+ {
+ VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
+ if ( pXTab )
+ {
+ rtl::OUString sTitle;
+ xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
+ pXTab->insertTab( pPage, sTitle);
+ }
+ }
+
+}
+
+void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
+ sal_uInt32 nCtrls = aCtrls.getLength();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ bindPage( aCtrls[ n ] );
+ sal_Int32 nActiveTab(0);
+ Reference< XPropertySet > xMultiProps( getModel(), UNO_QUERY );
+ xMultiProps->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ) ) >>= nActiveTab;
+
+ uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
+ if ( xTabCntrl.is() )
+ {
+ xTabCntrl->addTabListener( this );
+ if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
+ {
+ xTabCntrl->activateTab( nActiveTab );
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), sal_True );
+ }
+ }
+}
+
+void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
+{
+ OSL_PRECOND( _rxControl.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
+
+ // if the container already has a peer, then also create a peer for the control
+ uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
+
+ if( xMyPeer.is() )
+ {
+ _rxControl->createPeer( NULL, xMyPeer );
+ bindPage( _rxControl );
+ ImplActivateTabControllers();
+ }
+
+}
+
+// ------------- UnoMultiPageModel -----------------
+
+UnoMultiPageModel::UnoMultiPageModel() : UnoControlDialogModel( false )
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
+ //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
+ ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
+
+ Any aBool;
+ aBool <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_DECORATION, aBool );
+ // MultiPage Control has the tab stop property. And the default value is True.
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
+}
+
+UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
+ : UnoControlDialogModel( rModel )
+{
+}
+
+UnoMultiPageModel::~UnoMultiPageModel()
+{
+}
+
+UnoControlModel*
+UnoMultiPageModel::Clone() const
+{
+ // clone the container itself
+ UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
+}
+
+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
+ return aAny;
+ }
+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void UnoMultiPageModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ Reference< XServiceInfo > xInfo;
+ aElement >>= xInfo;
+
+ if ( !xInfo.is() )
+ throw IllegalArgumentException();
+
+ // Only a Page model can be inserted into the multipage
+ if ( !xInfo->supportsService( rtl::OUString::createFromAscii( szServiceName_UnoPageModel ) ) )
+ throw IllegalArgumentException();
+
+ return UnoControlDialogModel::insertByName( aName, aElement );
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------
+// class UnoPageControl
+// ----------------------------------------------------
+UnoPageControl::UnoPageControl()
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+
+UnoPageControl::~UnoPageControl()
+{
+}
+
+::rtl::OUString UnoPageControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "tabpage" );
+}
+
+
+// ------------- UnoPageModel -----------------
+
+UnoPageModel::UnoPageModel() : UnoControlDialogModel( false )
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_TITLE );
+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
+// ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
+
+ Any aBool;
+ aBool <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
+ //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
+}
+
+UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
+ : UnoControlDialogModel( rModel )
+{
+}
+
+UnoPageModel::~UnoPageModel()
+{
+}
+
+UnoControlModel*
+UnoPageModel::Clone() const
+{
+ // clone the container itself
+ UnoPageModel* pClone = new UnoPageModel( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+::rtl::OUString UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoPageModel );
+}
+
+uno::Any UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoPageControl );
+ return aAny;
+ }
+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoPageModel::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_False;
+}
+
+// Frame control
+
+// ----------------------------------------------------
+// class UnoFrameControl
+// ----------------------------------------------------
+UnoFrameControl::UnoFrameControl()
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+
+UnoFrameControl::~UnoFrameControl()
+{
+}
+
+::rtl::OUString UnoFrameControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "frame" );
+}
+
+void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
+{
+ bool bOwnCtrl = false;
+ rtl::OUString sTitle;
+ if ( rxCtrl.get() == Reference<XControl>( this ).get() )
+ bOwnCtrl = true;
+ Reference< XPropertySet > xProps( getModel(), UNO_QUERY );
+ //xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
+ xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ) ) >>= sTitle;
+
+ UnoDialogContainerControl::ImplSetPosSize( rxCtrl );
+ Reference < XWindow > xW( rxCtrl, UNO_QUERY );
+ if ( !bOwnCtrl && xW.is() && sTitle.getLength() )
+ {
+ awt::Rectangle aSizePos = xW->getPosSize();
+
+ sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
+ // Retrieve the values set by the base class
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
+ {
+ if ( !bOwnCtrl && sTitle.getLength() )
+ {
+ // Adjust Y based on height of Title
+ ::Rectangle aRect = pOutDev->GetTextRect( aRect, sTitle );
+ nY = nY + ( aRect.GetHeight() / 2 );
+ }
+ }
+ else
+ {
+ Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
+ Reference< XDevice > xD( xPeer, UNO_QUERY );
+
+ SimpleFontMetric aFM;
+ FontDescriptor aFD;
+ Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
+ aVal >>= aFD;
+ if ( aFD.StyleName.getLength() )
+ {
+ Reference< XFont > xFont = xD->getFont( aFD );
+ aFM = xFont->getFontMetric();
+ }
+ else
+ {
+ Reference< XGraphics > xG = xD->createGraphics();
+ aFM = xG->getFontMetric();
+ }
+
+ sal_Int16 nH = aFM.Ascent + aFM.Descent;
+ if ( !bOwnCtrl && sTitle.getLength() )
+ // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
+ nY = nY + ( nH / 8); // how do I test this
+ }
+ xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
+ }
+}
+
+// ------------- UnoFrameModel -----------------
+
+UnoFrameModel::UnoFrameModel() : UnoControlDialogModel( false )
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
+}
+
+UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
+ : UnoControlDialogModel( rModel )
+{
+}
+
+UnoFrameModel::~UnoFrameModel()
+{
+}
+
+UnoControlModel*
+UnoFrameModel::Clone() const
+{
+ // clone the container itself
+ UnoFrameModel* pClone = new UnoFrameModel( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+::rtl::OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
+}
+
+uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
+ return aAny;
+ }
+ return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+//===============================================================
+// ----------------------------------------------------
+// class DialogContainerControl
+// ----------------------------------------------------
+UnoDialogContainerControl::UnoDialogContainerControl() :
+ mbSizeModified(false),
+ mbPosModified(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+
+UnoDialogContainerControl::~UnoDialogContainerControl()
+{
}
// XInterface
-Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+Any UnoDialogContainerControl::queryAggregation( const Type & rType ) throw(RuntimeException)
{
- Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
+ Any aRet( UnoDialogContainerControl_IBase::queryInterface( rType ) );
return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
}
// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoDialogControl )
-Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
+IMPL_IMPLEMENTATION_ID( UnoDialogContainerControl )
+Sequence< Type >
+UnoDialogContainerControl::getTypes() throw(RuntimeException)
{
return ::comphelper::concatSequences(
- UnoDialogControl_IBase::getTypes(),
+ UnoDialogContainerControl_IBase::getTypes(),
UnoControlContainer::getTypes()
);
}
-void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+void UnoDialogContainerControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+}
+
+void UnoDialogContainerControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
{
Reference< XPropertySet > xP( rxModel, UNO_QUERY );
::rtl::OUString aDefCtrl;
xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
-
- // Add our own resource resolver to a newly created control
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-
- Any aAny;
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-
- aAny <<= xStringResourceResolver;
- xP->setPropertyValue( aPropName, aAny );
-
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
@@ -1440,7 +2186,7 @@ void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, c
}
}
-void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
+void UnoDialogContainerControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
{
Sequence< Reference< XControl > > aControls = getControls();
Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
@@ -1448,7 +2194,7 @@ void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
removeControl( xCtrl );
}
-void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
+void UnoDialogContainerControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
{
Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
@@ -1457,18 +2203,16 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
-
- // Currentley we are simply using MAP_APPFONT
+ MapMode aMode( MAP_APPFONT );
OutputDevice*pOutDev = Application::GetDefaultDevice();
- DBG_ASSERT( pOutDev, "Missing Default Device!" );
if ( pOutDev )
{
::Size aTmp( nX, nY );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
nX = aTmp.Width();
nY = aTmp.Height();
aTmp = ::Size( nWidth, nHeight );
- aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
nWidth = aTmp.Width();
nHeight = aTmp.Height();
}
@@ -1508,55 +2252,21 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
-void UnoDialogControl::dispose() throw(RuntimeException)
+void UnoDialogContainerControl::dispose() throw(RuntimeException)
{
- SolarMutexGuard aSolarGuard;
-
- EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
- maTopWindowListeners.disposeAndClear( aEvt );
-
- // Notify our listener helper about dispose
- // --- SAFE ---
- ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
- Reference< XEventListener > xListener( mxListener, UNO_QUERY );
- mxListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- xListener->disposing( aEvt );
-
UnoControlContainer::dispose();
}
-void SAL_CALL UnoDialogControl::disposing(
+void SAL_CALL UnoDialogContainerControl::disposing(
const EventObject& Source )
throw(RuntimeException)
{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
-
- if ( Source.Source == xIfac )
- {
- Any aAny;
-
- // Reset resource resolver reference
- ImplSetPropertyValue( aPropName, aAny, sal_True );
- ImplUpdateResourceResolver();
- }
- else
- {
- UnoControlContainer::disposing( Source );
- }
+ UnoControlContainer::disposing( Source );
}
-sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+sal_Bool UnoDialogContainerControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
{
- SolarMutexGuard aSolarGuard;
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
// destroy the old tab controller, if existent
if ( mxTabController.is() )
@@ -1623,14 +2333,13 @@ sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel )
mxTabController->setModel( xTabbing );
addTabController( mxTabController );
}
- ImplStartListingForResourceEvents();
+// ImplStartListingForResourceEvents();
return bRet;
}
-
-void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+void UnoDialogContainerControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
{
- SolarMutexGuard aSolarGuard;
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
UnoControl::setDesignMode( bOn );
@@ -1648,6 +2357,253 @@ void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
mxTabController->activateTabOrder();
}
+void UnoDialogContainerControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void UnoDialogContainerControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+}
+
+void UnoDialogContainerControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+// XPropertiesChangeListener
+void UnoDialogContainerControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ if( !isDesignMode() && !mbCreatingCompatiblePeer )
+ {
+ ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
+ ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
+ ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( ( rEvt.PropertyName == s1 ) ||
+ ( rEvt.PropertyName == s2 ) ||
+ ( rEvt.PropertyName == s3 ) ||
+ ( rEvt.PropertyName == s4 ) )
+ {
+ if ( bOwnModel )
+ {
+ if ( !mbPosModified && !mbSizeModified )
+ {
+ // Don't set new pos/size if we get new values from window listener
+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
+ ImplSetPosSize( xThis );
+ }
+ }
+ else
+ {
+ Sequence<Reference<XControl> > aControlSequence(getControls());
+ Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
+ ImplSetPosSize( aControlRef );
+ }
+ break;
+ }
+ }
+ }
+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+}
+
+void UnoDialogContainerControl::addingControl( const Reference< XControl >& _rxControl )
+{
+ SolarMutexGuard aSolarGuard;
+ UnoControlContainer::addingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Sequence< ::rtl::OUString > aNames( 4 );
+ ::rtl::OUString* pNames = aNames.getArray();
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
+
+ xProps->addPropertiesChangeListener( aNames, this );
+ }
+ }
+}
+
+void UnoDialogContainerControl::removingControl( const Reference< XControl >& _rxControl )
+{
+ SolarMutexGuard aSolarGuard;
+ UnoControlContainer::removingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->removePropertiesChangeListener( this );
+ }
+
+}
+
+void SAL_CALL UnoDialogContainerControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+ // a tab controller model may have changed
+
+ // #109067# in design mode don't notify the tab controller
+ // about tab index changes
+ if ( mxTabController.is() && !mbDesignMode )
+ mxTabController->activateTabOrder();
+}
+
+// ============================================================================
+// = class UnoDialogControl
+// ============================================================================
+
+UnoDialogControl::UnoDialogControl() :
+ maTopWindowListeners( *this ),
+ mbWindowListener(false)
+{
+ maComponentInfos.nWidth = 300;
+ maComponentInfos.nHeight = 450;
+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+}
+
+UnoDialogControl::~UnoDialogControl()
+{
+}
+
+::rtl::OUString UnoDialogControl::GetComponentServiceName()
+{
+
+ sal_Bool bDecoration( sal_True );
+ ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+ if ( bDecoration )
+ return ::rtl::OUString::createFromAscii( "Dialog" );
+ else
+ return ::rtl::OUString::createFromAscii( "TabPage" );
+}
+
+// XInterface
+Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) );
+ return (aRet.hasValue() ? aRet : UnoDialogContainerControl::queryAggregation( rType ));
+}
+//lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoDialogControl)
+ getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ),
+ UnoDialogContainerControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ // maybe this should be in the UnoDialogContainerControl, lets see
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ // Add our own resource resolver to a newly created control
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+
+ Any aAny;
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+
+ aAny <<= xStringResourceResolver;
+ xP->setPropertyValue( aPropName, aAny );
+
+ UnoDialogContainerControl::ImplInsertControl( rxModel, rName );
+
+}
+
+void UnoDialogControl::dispose() throw(RuntimeException)
+{
+ SolarMutexGuard aSolarGuard;
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ maTopWindowListeners.disposeAndClear( aEvt );
+ // Notify our listener helper about dispose
+ // --- SAFE ---
+ ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XEventListener > xListener( mxListener, UNO_QUERY );
+ mxListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ xListener->disposing( aEvt );
+ UnoDialogContainerControl::dispose();
+}
+
+void SAL_CALL UnoDialogControl::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ // #FIXME see what can be moved to UnoDialogControlContainer
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
+
+ if ( Source.Source == xIfac )
+ {
+ Any aAny;
+
+ // Reset resource resolver reference
+ ImplSetPropertyValue( aPropName, aAny, sal_True );
+ ImplUpdateResourceResolver();
+ }
+ else
+ {
+ UnoDialogContainerControl::disposing( Source );
+ }
+}
+
+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ // #Can we move all the Resource stuff to the UnoDialogContainerControl ?
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ sal_Bool bRet = UnoDialogContainerControl::setModel( rxModel );
+ ImplStartListingForResourceEvents();
+ return bRet;
+}
+
void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
{
SolarMutexGuard aSolarGuard;
@@ -1690,52 +2646,20 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
( aImageURL.getLength() > 0 ))
{
- aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+ ::rtl::OUString absoluteUrl = aImageURL;
+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+ {
+ absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
+ }
+ // not understanding the code above, but it surely setting the URL is just as
+ // effective ( and prevents ambiguity with embedded images )
+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
}
if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
}
-void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
-
- Reference< XControlModel > xModel;
- ::rtl::OUString aName;
-
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
-void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
-
- Reference< XControlModel > xModel;
- Event.Element >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-}
-
-void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
-
- Reference< XControlModel > xModel;
- Event.ReplacedElement >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
{
maTopWindowListeners.addInterface( rxListener );
@@ -1790,12 +2714,6 @@ void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) thro
}
}
-static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
-{
- ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
- return aTmp;
-}
-
// ::com::sun::star::awt::XWindowListener
void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException)
@@ -1877,76 +2795,42 @@ throw (::com::sun::star::uno::RuntimeException)
// XPropertiesChangeListener
void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
- if( !isDesignMode() && !mbCreatingCompatiblePeer )
- {
- ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
- ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
- ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
- ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( ( rEvt.PropertyName == s1 ) ||
- ( rEvt.PropertyName == s2 ) ||
- ( rEvt.PropertyName == s3 ) ||
- ( rEvt.PropertyName == s4 ) )
- {
- if ( bOwnModel )
- {
- if ( !mbPosModified && !mbSizeModified )
- {
- // Don't set new pos/size if we get new values from window listener
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- ImplSetPosSize( xThis );
- }
- }
- else
- {
- Sequence<Reference<XControl> > aControlSequence(getControls());
- Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
- ImplSetPosSize( aControlRef );
- }
- break;
- }
- else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
- {
- ImplStartListingForResourceEvents();
- }
- }
- }
-
sal_Int32 nLen = rEvents.getLength();
for( sal_Int32 i = 0; i < nLen; i++ )
{
const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
+ if( !isDesignMode() && !mbCreatingCompatiblePeer && bOwnModel )
+ {
+ if ( rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ) )
+ ImplStartListingForResourceEvents();
+ }
+
+ else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
{
::rtl::OUString aImageURL;
+ Reference< graphic::XGraphic > xGraphic;
+ // Ignore GraphicObject urls
if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
( aImageURL.getLength() > 0 ))
{
- aImageURL =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
+ ::rtl::OUString absoluteUrl = aImageURL;
+ if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+ {
+ absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+ ImplGetPropertyValue( PROPERTY_IMAGEURL ));
+ }
+ ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( absoluteUrl ), sal_True );
}
-
- ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
- break;
}
}
-
- UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+ UnoDialogContainerControl::ImplModelPropertiesChanged( rEvents );
}
void UnoDialogControl::ImplStartListingForResourceEvents()
{
+ // #FIXME can we move this to base class
Reference< resource::XStringResourceResolver > xStringResourceResolver;
ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
@@ -1961,21 +2845,16 @@ void UnoDialogControl::ImplStartListingForResourceEvents()
ImplUpdateResourceResolver();
}
-void UnoDialogControl::ImplUpdateResourceResolver()
+void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
{
rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- if ( !xStringResourceResolver.is() )
- return;
Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
Sequence< rtl::OUString > aPropNames(1);
aPropNames[0] = aPropName;
- const Sequence< Reference< awt::XControl > > aSeq = getControls();
+ const Sequence< Reference< awt::XControl > > aSeq = xContainer->getControls();
for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
{
Reference< XControl > xControl( aSeq[i] );
@@ -2006,8 +2885,26 @@ void UnoDialogControl::ImplUpdateResourceResolver()
catch ( const Exception& )
{
}
+
+ uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
+ if ( xNestedContainer.is() )
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
+
}
+}
+
+void UnoDialogControl::ImplUpdateResourceResolver()
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ if ( !xStringResourceResolver.is() )
+ return;
+
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
+
// propagate resource resolver changes to language dependent props of the dialog
Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
if ( xPropertySet.is() )
@@ -2077,53 +2974,6 @@ void UnoDialogControl::endExecute() throw(RuntimeException)
}
}
-void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
-{
- SolarMutexGuard aSolarGuard;
- UnoControlContainer::addingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- {
- Sequence< ::rtl::OUString > aNames( 4 );
- ::rtl::OUString* pNames = aNames.getArray();
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
- }
-}
-
-void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
-{
- SolarMutexGuard aSolarGuard;
- UnoControlContainer::removingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- xProps->removePropertiesChangeListener( this );
- }
-
-}
-
-void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- // a tab controller model may have changed
-
- // #109067# in design mode don't notify the tab controller
- // about tab index changes
- if ( mxTabController.is() && !mbDesignMode )
- mxTabController->activateTabOrder();
-}
-
// XModifyListener
void SAL_CALL UnoDialogControl::modified(
const lang::EventObject& /*rEvent*/ )
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 7aa2e63fd9cc..d4755d37df50 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -809,8 +809,8 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
-
- xC->enableDialogControl( sal_True );
+ if ( xC.is() )
+ xC->enableDialogControl( sal_True );
ImplActivateTabControllers();
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index b72ae69e44c6..b2d56a6c47f7 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -537,7 +537,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
- uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL )
+ uno::Reference< graphic::XGraphic > ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& xOutGraphicObj, const ::rtl::OUString& _rURL )
{
uno::Reference< graphic::XGraphic > xGraphic;
@@ -547,10 +547,10 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
// get the DefaultContext
::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
+ xOutGraphicObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
}
else // linked
- rxGrfObj = NULL; // release the GraphicObject
+ xOutGraphicObj = NULL; // release the GraphicObject
if ( !_rURL.getLength() )
return xGraphic;
@@ -575,6 +575,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return xGraphic;
}
+
void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
@@ -591,7 +592,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n
mbAdjustingGraphic = true;
::rtl::OUString sImageURL;
OSL_VERIFY( rValue >>= sImageURL );
- setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) );
mbAdjustingGraphic = false;
}
break;
@@ -1729,75 +1730,6 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
return sal_True;
}
-// MultiPage
-
-UnoMultiPageModel::UnoMultiPageModel()
-{
- ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
- ImplRegisterProperty( BASEPROPERTY_ENABLED );
- ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
- ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
- ImplRegisterProperty( BASEPROPERTY_HELPURL );
- ImplRegisterProperty( BASEPROPERTY_LABEL );
- ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
- ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
-}
-
-::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
-}
-
-uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
-{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
- {
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
- //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
- return aAny;
- }
- return UnoControlModel::ImplGetDefaultValue( nPropId );
-}
-
-::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
-{
- static UnoPropertyArrayHelper* pHelper = NULL;
- if ( !pHelper )
- {
- uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
- pHelper = new UnoPropertyArrayHelper( aIDs );
- }
- return *pHelper;
-}
-
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
-{
- static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// ----------------------------------------------------
-// class MultiPageControl
-// ----------------------------------------------------
-UnoMultiPageControl::UnoMultiPageControl()
-{
- maComponentInfos.nWidth = 100;
- maComponentInfos.nHeight = 100;
-}
-
-::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
-{
- return ::rtl::OUString::createFromAscii( "multipage" );
-}
-
-sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException)
-{
- return sal_True;
-}
-
// =====================================================================================================================
// = UnoControlListBoxModel_Data
// =====================================================================================================================
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index 1e75709f188f..f8011846aa3c 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -154,6 +154,21 @@ IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star:
IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
// ----------------------------------------------------
+// class TabListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener )
+void TabListenerMultiplexer::inserted( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, inserted, ::sal_Int32 )
+void TabListenerMultiplexer::removed( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, removed, ::sal_Int32 )
+void TabListenerMultiplexer::changed( sal_Int32 evt, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& evt2 ) throw(::com::sun::star::uno::RuntimeException)
+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, changed, ::sal_Int32, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > )
+void TabListenerMultiplexer::activated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, activated, ::sal_Int32 )
+void TabListenerMultiplexer::deactivated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException)
+IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, deactivated, ::sal_Int32 )
+
+// ----------------------------------------------------
// class ContainerListenerMultiplexer
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 9e49ed6bd316..f3479bfde424 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -56,6 +56,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
#include <comphelper/types.hxx>
#include <functional>
#include <algorithm>
@@ -289,7 +290,9 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
+ DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "MultiPageValue", MULTIPAGEVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "AllDialogChildren", USERFORMCONTAINEES, Reference< ::com::sun::star::container::XNameContainer >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
};
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 95d91c2d96ab..7fbe410df046 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -167,6 +167,8 @@ IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
IMPL_CREATEINSTANCE( UnoSpinButtonModel )
IMPL_CREATEINSTANCE( UnoMultiPageModel )
+IMPL_CREATEINSTANCE( UnoPageModel )
+IMPL_CREATEINSTANCE( UnoFrameModel )
IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
IMPL_CREATEINSTANCE( UnoDateFieldControl )
@@ -187,6 +189,8 @@ IMPL_CREATEINSTANCE( UnoProgressBarControl )
IMPL_CREATEINSTANCE( UnoScrollBarControl )
IMPL_CREATEINSTANCE( UnoSpinButtonControl )
IMPL_CREATEINSTANCE( UnoMultiPageControl )
+IMPL_CREATEINSTANCE( UnoPageControl )
+IMPL_CREATEINSTANCE( UnoFrameControl )
IMPL_CREATEINSTANCE( UnoFixedLineControl )
IMPL_CREATEINSTANCE( VCLXMenuBar )
IMPL_CREATEINSTANCE( VCLXPointer )
@@ -281,6 +285,10 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager,
registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel );
registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl );
+ registerServices( xRegistryKey, "UnoPageModel", szServiceName_UnoPageModel );
+ registerServices( xRegistryKey, "UnoPageControl", szServiceName_UnoPageControl );
+ registerServices( xRegistryKey, "UnoFrameModel", szServiceName_UnoFrameModel );
+ registerServices( xRegistryKey, "UnoFrameControl", szServiceName_UnoFrameControl );
registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
@@ -317,7 +325,6 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
-
CHECKANDCREATEFACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
CHECKANDCREATEFACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
CHECKANDCREATEFACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
@@ -373,6 +380,10 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL )
CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL )
+ CHECKANDCREATEFACTORY( UnoPageModel, szServiceName_UnoPageModel, NULL )
+ CHECKANDCREATEFACTORY( UnoPageControl, szServiceName_UnoPageControl, NULL )
+ CHECKANDCREATEFACTORY( UnoFrameModel, szServiceName_UnoFrameModel, NULL )
+ CHECKANDCREATEFACTORY( UnoFrameControl, szServiceName_UnoFrameControl, NULL )
CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index 1a310d1d12df..19083a3ce4c1 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -93,6 +93,10 @@ const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.a
const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage";
const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel";
+const sal_Char __FAR_DATA szServiceName_UnoPageControl[] = "com.sun.star.awt.UnoControlPage";
+const sal_Char __FAR_DATA szServiceName_UnoPageModel[] = "com.sun.star.awt.UnoPageModel";
+const sal_Char __FAR_DATA szServiceName_UnoFrameControl[] = "com.sun.star.awt.UnoControlFrame";
+const sal_Char __FAR_DATA szServiceName_UnoFrameModel[] = "com.sun.star.awt.UnoFrameModel";
const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index cee3427f3866..8e37dc74e889 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -39,6 +39,7 @@
#include <toolkit/awt/vclxcontainer.hxx>
#include <toolkit/awt/vclxtopwindow.hxx>
#include <toolkit/awt/vclxgraphics.hxx>
+#include <awt/vclxtabcontrol.hxx>
#include "toolkit/dllapi.h"
#include <vcl/svapp.hxx>
@@ -108,6 +109,7 @@ using namespace ::com::sun::star;
case WINDOW_TABPAGE: return new VCLXContainer;
case WINDOW_TOOLBOX: return new VCLXToolBox;
+ case WINDOW_TABCONTROL: return new VCLXMultiPage;
// case WINDOW_FIXEDLINE:
// case WINDOW_FIXEDBITMAP:
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 25925a89b1d7..5463246ec8a0 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -103,6 +103,7 @@ private:
protected:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
+ SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
virtual void FillLayoutData() const;
diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx
index 73d303b871ea..5b062d6ea8ef 100644
--- a/vcl/source/control/group.cxx
+++ b/vcl/source/control/group.cxx
@@ -135,6 +135,7 @@ GroupBox::GroupBox( Window* pParent, const ResId& rResId ) :
void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
const Point& rPos, const Size& rSize, bool bLayout )
{
+ OSL_TRACE("GroupBox::ImplDraw Y %d, X %d", rPos.Y(), rPos.X() );
long nTop;
long nTextOff;
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 8cc7bb221a09..b1774513c761 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -174,6 +174,18 @@ const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) c
// -----------------------------------------------------------------------
+WinBits TabControl::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
void TabControl::ImplInitSettings( BOOL bFont,
BOOL bForeground, BOOL bBackground )
{
@@ -230,6 +242,7 @@ TabControl::TabControl( Window* pParent, WinBits nStyle ) :
Control( WINDOW_TABCONTROL )
{
ImplInit( pParent, nStyle );
+ OSL_TRACE("*** TABCONTROL no notabs? %s", ( GetStyle() & WB_NOBORDER ) ? "true" : "false" );
}
// -----------------------------------------------------------------------
@@ -695,7 +708,13 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
if ( pPage )
{
- pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ if ( ( GetStyle() & WB_NOBORDER ) )
+ {
+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
+ pPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
+ }
+ else
+ pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
// activate page here so the conbtrols can be switched
// also set the help id of the parent window to that of the tab page
@@ -755,6 +774,12 @@ BOOL TabControl::ImplPosCurTabPage()
ImplTabItem* pItem = ImplGetItem( GetCurPageId() );
if ( pItem && pItem->mpTabPage )
{
+ if ( ( GetStyle() & WB_NOBORDER ) )
+ {
+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
+ pItem->mpTabPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
+ return TRUE;
+ }
Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
return TRUE;
@@ -1163,7 +1188,8 @@ void TabControl::KeyInput( const KeyEvent& rKEvt )
void TabControl::Paint( const Rectangle& rRect )
{
- ImplPaint( rRect, false );
+ if ( !( GetStyle() & WB_NOBORDER ) )
+ ImplPaint( rRect, false );
}
// -----------------------------------------------------------------------
@@ -1600,6 +1626,10 @@ void TabControl::StateChanged( StateChangedType nType )
ImplInitSettings( FALSE, FALSE, TRUE );
Invalidate();
}
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ }
}
// -----------------------------------------------------------------------