[Libreoffice-commits] .: 5 commits - toolkit/inc toolkit/source vcl/inc vcl/source

Noel Power noelp at kemper.freedesktop.org
Fri Nov 5 09:47:23 PDT 2010


 toolkit/inc/toolkit/awt/vclxwindows.hxx              |   90 +
 toolkit/inc/toolkit/controls/dialogcontrol.hxx       |  205 +++
 toolkit/inc/toolkit/controls/unocontrolcontainer.hxx |   18 
 toolkit/inc/toolkit/controls/unocontrols.hxx         |   56 
 toolkit/inc/toolkit/helper/listenermultiplexer.hxx   |   12 
 toolkit/inc/toolkit/helper/macros.hxx                |   51 
 toolkit/inc/toolkit/helper/property.hxx              |    2 
 toolkit/inc/toolkit/helper/servicenames.hxx          |    6 
 toolkit/source/awt/vclxtabcontrol.cxx                |    2 
 toolkit/source/awt/vclxtabcontrol.hxx                |    3 
 toolkit/source/awt/vclxtabpage.cxx                   |    3 
 toolkit/source/awt/vclxtoolkit.cxx                   |   58 
 toolkit/source/awt/vclxwindows.cxx                   |  412 ++++++
 toolkit/source/controls/dialogcontrol.cxx            | 1135 ++++++++++++++++++-
 toolkit/source/controls/unocontrolcontainer.cxx      |    4 
 toolkit/source/controls/unocontrols.cxx              |   78 -
 toolkit/source/helper/listenermultiplexer.cxx        |   15 
 toolkit/source/helper/property.cxx                   |    5 
 toolkit/source/helper/registerservices.cxx           |   13 
 toolkit/source/helper/servicenames.cxx               |    4 
 toolkit/source/helper/unowrapper.cxx                 |    2 
 vcl/inc/vcl/tabctrl.hxx                              |    1 
 vcl/source/control/group.cxx                         |    1 
 vcl/source/control/tabctrl.cxx                       |   34 
 24 files changed, 2039 insertions(+), 171 deletions(-)

New commits:
commit 9925cb109248657aec7703d11c36bae40f0dbc68
Merge: bab91e8... 0dae633...
Author: Noel Power <noel.power at novell.com>
Date:   Fri Nov 5 11:45:44 2010 +0000

    Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/libs-gui

commit bab91e8cc05f494755af96445625b5f3d4b9e681
Author: Noel Power <noel.power at novell.com>
Date:   Fri Nov 5 11:32:11 2010 +0000

    fixup embedded graphic url handling

diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 9a1a212..fe29c89 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -1873,13 +1873,13 @@ 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 ));
-
+        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)
@@ -2111,16 +2111,19 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang
         if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
         {
             ::rtl::OUString aImageURL;
+            ::rtl::OUString absoluteUrl( aImageURL );
+            // Ignore GraphicObject urls
             if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
                 ( aImageURL.getLength() > 0 ))
             {
-                aImageURL =
-                    getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+                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;
         }
     }
commit a65e159724078a07ac901ce7b2bbfae78fddbebe
Author: Noel Power <noel.power at novell.com>
Date:   Wed Nov 3 23:10:43 2010 +0000

    separation of new container controls and existing Dialog control & model

diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index 735e632..a833036 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -78,6 +78,7 @@ public:
     typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
                                                         UnoControlModelHolder;
 protected:
+    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);
     typedef ::std::list< UnoControlModelHolder >		UnoControlModelHolderList;
 
     // for grouping control models (XTabControllerModel::getGroupXXX)
@@ -89,7 +90,6 @@ protected:
     friend struct FindControlModel;
     friend struct CompareControlModel;
 
-protected:
     ContainerListenerMultiplexer		maContainerListeners;
     ::cppu::OInterfaceContainerHelper	maChangeListeners;
     UnoControlModelHolderList			maModels;
@@ -99,15 +99,15 @@ protected:
 
     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
     bool mbAdjustingGraphic;
-protected:
-    virtual ::com::sun::star::uno::Any			ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+
+    ::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( bool bRegProps = true );
+                        // bRegProps = false => subclass will register its own props
+                        UnoControlDialogModel(  bool bRegProps = true );
                         UnoControlDialogModel( const UnoControlDialogModel& rModel );
                         ~UnoControlDialogModel();
 
@@ -130,6 +130,13 @@ 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);
@@ -179,11 +186,12 @@ 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,
@@ -194,6 +202,17 @@ 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
@@ -222,78 +241,29 @@ class ResourceListener  :public ::com::sun::star::util::XModifyListener,
         bool                                                                                    m_bListening;
 };
 
-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
+class UnoDialogControl	:public UnoControlContainer
+                        ,public UnoDialogControl_IBase
 {
 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;
-    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
-    ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
+    bool                                                                        mbSizeModified;
+    bool                                                                        mbPosModified;
 
 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); }
@@ -318,6 +288,11 @@ 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);
@@ -334,6 +309,10 @@ 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);
@@ -344,7 +323,61 @@ 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:
+    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 );
+};
+
+
+typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
+                             ::com::sun::star::util::XChangesListener >
+                             UnoParentControl_IBase;
+
+class UnoParentControl : public UnoControlContainer, public UnoParentControl_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:
+    UnoParentControl();
+    ~UnoParentControl();
+
+    DECLIMPL_SERVICEINFO_DERIVED( UnoParentControl, UnoControlBase, "com.sun.star.awt.UnoParentControl" )
+    ::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 UnoMultiPageModel : public UnoControlDialogModel
@@ -371,7 +404,7 @@ protected:
 
 };
 
-class UnoMultiPageControl :  public UnoDialogContainerControl
+class UnoMultiPageControl :  public UnoParentControl
                             ,public ::com::sun::star::awt::XSimpleTabController
                             ,public ::com::sun::star::awt::XTabListener
 {
@@ -383,8 +416,8 @@ public:
     ::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); }
+    DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoParentControl, szServiceName_UnoMultiPageControl )
+    ::com::sun::star::uno::Any	SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoParentControl::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(); }
@@ -444,8 +477,7 @@ protected:
 
 };
 
-
-class UnoPageControl :  public UnoDialogContainerControl
+class UnoPageControl :  public UnoParentControl
 {
 public:
     UnoPageControl();
@@ -454,7 +486,7 @@ public:
 
 
     // ::com::sun::star::lang::XServiceInfo
-    DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
+    DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, UnoParentControl, szServiceName_UnoPageControl )
 };
 
 class UnoFrameModel : public UnoControlDialogModel
@@ -476,7 +508,7 @@ protected:
     ::cppu::IPropertyArrayHelper&		SAL_CALL getInfoHelper();
 };
 
-class UnoFrameControl :  public UnoDialogContainerControl
+class UnoFrameControl :  public UnoParentControl
 {
 protected:
     virtual void		ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
@@ -486,7 +518,7 @@ public:
     ::rtl::OUString		GetComponentServiceName();
 
 // ::com::sun::star::lang::XServiceInfo
-DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoDialogContainerControl, szServiceName_UnoPageControl )
+DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, UnoParentControl, szServiceName_UnoPageControl )
 };
 
 #endif // TOOLKIT_DIALOG_CONTROL_HXX
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 7672c2d..9a1a212 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -326,8 +326,9 @@ UnoControlDialogModel::UnoControlDialogModel( bool regProps )
     ,maChangeListeners ( GetMutex() )
     ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
 {
-    if ( regProps )
-    {
+    if ( !regProps ) // Register properties elsewhere ( probably in class derived from this )
+        return;
+
     ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
 //	ImplRegisterProperty( BASEPROPERTY_BORDER );
     ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
@@ -348,9 +349,9 @@ UnoControlDialogModel::UnoControlDialogModel( bool regProps )
     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 ) );
-    }
+    // #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
+    uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
+    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
 }
 
 UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
@@ -391,7 +392,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)
 {
-    UnoControlDialogModel_Base::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+    UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
     try
     {
         switch ( nHandle )
@@ -407,7 +408,7 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32
             }
             break;
 
-       case BASEPROPERTY_GRAPHIC:
+        case BASEPROPERTY_GRAPHIC:
             if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
             {
                 mbAdjustingGraphic = true;
@@ -415,15 +416,14 @@ 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 ImageURL properties!" );
+        OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" );
     }
 }
 
-
 Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
 {
     Any aAny;
@@ -613,7 +613,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th
     static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
     if ( !pNamesSeq )
     {
-        pNamesSeq = new Sequence< ::rtl::OUString >( 25 );
+        pNamesSeq = new Sequence< ::rtl::OUString >( 26 );
         ::rtl::OUString* pNames = pNamesSeq->getArray();
         pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
         pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
@@ -636,11 +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 );
+        pNames[25] = ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
     }
     return *pNamesSeq;
 }
@@ -730,7 +730,6 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
     UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
     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
@@ -752,7 +751,6 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
     aElementPos->first = xNewModel;
     startControlListening( xNewModel );
 
-
     ContainerEvent aEvent;
     aEvent.Source = *this;
     aEvent.Element = aElement;
@@ -809,7 +807,7 @@ 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 );
 
@@ -835,7 +833,6 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
         lcl_throwIllegalArgumentException();
 
     UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
-
     if ( maModels.end() != aElementPos )
         lcl_throwElementExistException();
 
@@ -850,10 +847,8 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
 
     if ( xAllChildren.is() )
         updateUserFormChildren( xAllChildren, aName, Insert, xM );
-
     maModels.push_back( UnoControlModelHolder( xM, aName ) );
 
-
     mbGroupsUpToDate = sal_False;
     startControlListening( xM );
 
@@ -893,7 +888,6 @@ 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() )
@@ -1552,620 +1546,855 @@ throw ( RuntimeException )
     }
 }
 
-static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
-{
-    ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
-    return aTmp;
-}
+// ============================================================================
+// = class UnoDialogControl
+// ============================================================================
 
-//	----------------------------------------------------
-//	class MultiPageControl
-//	----------------------------------------------------
-UnoMultiPageControl::UnoMultiPageControl() : maTabListeners( *this )
+UnoDialogControl::UnoDialogControl() :
+    maTopWindowListeners( *this ),
+    mbWindowListener(false),
+    mbSizeModified(false),
+    mbPosModified(false)
 {
-    maComponentInfos.nWidth = 280;
-    maComponentInfos.nHeight = 400;
+    maComponentInfos.nWidth = 300;
+    maComponentInfos.nHeight = 450;
+    mxListener = new ResourceListener( Reference< util::XModifyListener >(
+                        static_cast< OWeakObject* >( this ), UNO_QUERY ));
 }
 
-UnoMultiPageControl::~UnoMultiPageControl()
+::rtl::OUString UnoDialogControl::GetComponentServiceName()
 {
-}
-// 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)
-{
+    sal_Bool bDecoration( sal_True );
+    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+    if ( bDecoration )
+        return ::rtl::OUString::createFromAscii( "Dialog" );
+    else
+        return ::rtl::OUString::createFromAscii( "TabPage" );
 }
-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)
+// XInterface
+Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
 {
+    Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
+    return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
 }
 
-void SAL_CALL UnoMultiPageControl::dispose() throw (RuntimeException)
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoDialogControl )
+Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
 {
-    lang::EventObject aEvt;
-    aEvt.Source = (::cppu::OWeakObject*)this;
-    maTabListeners.disposeAndClear( aEvt );
-    UnoDialogContainerControl::dispose();
+    return ::comphelper::concatSequences(
+        UnoDialogControl_IBase::getTypes(),
+        UnoControlContainer::getTypes()
+    );
 }
 
-// com::sun::star::awt::XSimpleTabController
-::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
+void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
 {
-    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-    if ( !xMultiPage.is() )
-        throw RuntimeException();
-    return xMultiPage->insertTab();
-}
+    Reference< XPropertySet > xP( rxModel, UNO_QUERY );
 
-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 );
-}
+    ::rtl::OUString aDefCtrl;
+    xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
 
-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 );
-}
+    // Add our own resource resolver to a newly created control
+    Reference< resource::XStringResourceResolver > xStringResourceResolver;
+    rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
 
-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 );
-}
+    Any aAny;
+    ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
 
-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 );
+    aAny <<= xStringResourceResolver;
+    xP->setPropertyValue( aPropName, aAny );
+
+    Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+    Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
+
+    DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
+    if ( xCtrl.is() )
+    {
+        xCtrl->setModel( rxModel );
+        addControl( rName, xCtrl );
+            // will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
+            // (which we formerly did herein)
+            // 08.01.2001 - 96008 - fs at openoffice.org
 
+        ImplSetPosSize( xCtrl );
+    }
 }
 
-::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() throw (RuntimeException)
+void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
 {
-    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-    if ( !xMultiPage.is() )
-        throw RuntimeException();
-    return xMultiPage->getActiveTabID();
+    Sequence< Reference< XControl > > aControls = getControls();
+    Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+    if ( xCtrl.is() )
+        removeControl( xCtrl );
 }
 
-void SAL_CALL UnoMultiPageControl::addTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
+void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
 {
-    maTabListeners.addInterface( Listener );
-    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-    if ( xMultiPage.is()  && maTabListeners.getLength() == 1 )
-        xMultiPage->addTabListener( &maTabListeners );
+    Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
+
+    sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
+    xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
+    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
+    OutputDevice*pOutDev = Application::GetDefaultDevice();
+    DBG_ASSERT( pOutDev, "Missing Default Device!" );
+    if ( pOutDev )
+    {
+        ::Size aTmp( nX, nY );
+        aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+        nX = aTmp.Width();
+        nY = aTmp.Height();
+        aTmp = ::Size( nWidth, nHeight );
+        aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+        nWidth = aTmp.Width();
+        nHeight = aTmp.Height();
+    }
+    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;
+        sal_Int16 nW = nH/2;	// calculate avarage width?!
+
+        nX *= nW;
+        nX /= 4;
+        nWidth *= nW;
+        nWidth /= 4;
+        nY *= nH;
+        nY /= 8;
+        nHeight *= nH;
+        nHeight /= 8;
+    }
+    Reference < XWindow > xW( rxCtrl, UNO_QUERY );
+    xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
 }
 
-void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
+void UnoDialogControl::dispose() throw(RuntimeException)
 {
-    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
-    if ( xMultiPage.is()  && maTabListeners.getLength() == 1 )
-        xMultiPage->removeTabListener( &maTabListeners );
-    maTabListeners.removeInterface( Listener );
-}
+    SolarMutexGuard aSolarGuard;
 
+    EventObject aEvt;
+    aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+    maTopWindowListeners.disposeAndClear( aEvt );
 
-// lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
-    getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
-    getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
-    UnoDialogContainerControl::getTypes()
-IMPL_XTYPEPROVIDER_END
+    // Notify our listener helper about dispose
+    // --- SAFE ---
+    ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
+    Reference< XEventListener > xListener( mxListener, UNO_QUERY );
+    mxListener.clear();
+    aGuard.clear();
+    // --- SAFE ---
 
-// 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 ));
+    if ( xListener.is() )
+        xListener->disposing( aEvt );
+
+    UnoControlContainer::dispose();
 }
 
-::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
+void SAL_CALL UnoDialogControl::disposing(
+    const EventObject& Source )
+throw(RuntimeException)
 {
-    sal_Bool bDecoration( sal_True );
-    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
-    if ( bDecoration )
-        return ::rtl::OUString::createFromAscii( "tabcontrol" );
-    // Hopefully we can tweak the tabcontrol to display without tabs
-    return ::rtl::OUString::createFromAscii( "tabcontrolnotabs" );
+    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 );
+    }
 }
 
-void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
 {
-    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 );
+    SolarMutexGuard aSolarGuard;
 
-   VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
-   TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
-    if ( xTabCntrl.is() && pPage )
+    // destroy the old tab controller, if existent
+    if ( mxTabController.is() )
     {
-        VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
-        if ( pXTab )
+        mxTabController->setModel( NULL );					// just to be sure, should not be necessary
+        removeTabController( mxTabController );
+        ::comphelper::disposeComponent( mxTabController );	// just to be sure, should not be necessary
+        mxTabController.clear();
+    }
+
+    if ( getModel().is() )
+    {
+        Sequence< Reference< XControl > > aControls = getControls();
+        const Reference< XControl >* pCtrls = aControls.getConstArray();
+        const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+        for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+            removeControl( *pCtrls );
+                // will implicitly call removingControl, which will remove the PropertyChangeListener
+                // (which we formerly did herein)
+                // 08.01.2001 - 96008 - fs at openoffice.org
+
+        Reference< XContainer > xC( getModel(), UNO_QUERY );
+        if ( xC.is() )
+            xC->removeContainerListener( this );
+
+        Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+        if ( xChangeNotifier.is() )
+            xChangeNotifier->removeChangesListener( this );
+    }
+
+    sal_Bool bRet = UnoControl::setModel( rxModel );
+
+    if ( getModel().is() )
+    {
+        Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
+        if ( xNA.is() )
         {
-            rtl::OUString sTitle;
-            xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
-            pXTab->insertTab( pPage, sTitle);
+            Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
+            const ::rtl::OUString* pNames = aNames.getConstArray();
+            sal_uInt32 nCtrls = aNames.getLength();
+
+            Reference< XControlModel > xCtrlModel;
+            for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
+            {
+                xNA->getByName( *pNames ) >>= xCtrlModel;
+                ImplInsertControl( xCtrlModel, *pNames );
+            }
         }
+
+        Reference< XContainer > xC( getModel(), UNO_QUERY );
+        if ( xC.is() )
+            xC->addContainerListener( this );
+
+        Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+        if ( xChangeNotifier.is() )
+            xChangeNotifier->addChangesListener( this );
+    }
+
+    Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
+    if ( xTabbing.is() )
+    {
+        mxTabController = new StdTabController;
+        mxTabController->setModel( xTabbing );
+        addTabController( mxTabController );
     }
+    ImplStartListingForResourceEvents();
 
+    return bRet;
 }
 
-void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
+void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
+    ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
 
-    UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+    UnoControl::setDesignMode( bOn );
 
-    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;
+    Sequence< Reference< XControl > > xCtrls = getControls();
+    sal_Int32 nControls = xCtrls.getLength();
+    Reference< XControl >* pControls = xCtrls.getArray();
+    for ( sal_Int32 n = 0; n < nControls; n++ )
+        pControls[n]->setDesignMode( bOn );
 
-    uno::Reference< awt::XSimpleTabController > xTabCntrl( getPeer(), uno::UNO_QUERY );
-    if ( xTabCntrl.is() )
+    // #109067# in design mode the tab controller is not notified about
+    // tab index changes, therefore the tab order must be activated
+    // when switching from design mode to live mode
+    if ( mxTabController.is() && !bOn )
+        mxTabController->activateTabOrder();
+}
+
+void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
+{
+    SolarMutexGuard aSolarGuard;
+
+    UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+    Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
+    if ( xTW.is() )
     {
-        xTabCntrl->addTabListener( this );
-        if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
+        xTW->setMenuBar( mxMenuBar );
+
+        if ( !mbWindowListener )
         {
-            xTabCntrl->activateTab( nActiveTab );
-            ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( nActiveTab ), sal_True );
+            Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+            addWindowListener( xWL );
+            mbWindowListener = true;
         }
+
+        if ( maTopWindowListeners.getLength() )
+            xTW->addTopWindowListener( &maTopWindowListeners );
     }
 }
 
-void    UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl)
+void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
 {
-    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() )
+    sal_Bool bDecoration( sal_True );
+    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+    if ( !bDecoration )
     {
-        _rxControl->createPeer( NULL, xMyPeer );
-        bindPage( _rxControl );
-        ImplActivateTabControllers();
+        // Now we have to manipulate the WindowDescriptor
+        rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
     }
 
-}
+    // We have to set the graphic property before the peer
+    // will be created. Otherwise the properties will be copied
+    // into the peer via propertiesChangeEvents. As the order of
+    // can lead to overwrites we have to set the graphic property
+    // before the propertiesChangeEvents are sent!
+    ::rtl::OUString aImageURL;
+    if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
+        ( aImageURL.getLength() > 0 ))
+    {
+        aImageURL =
+            getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+                                 ImplGetPropertyValue( PROPERTY_IMAGEURL ));
 
-// ------------- UnoMultiPageModel -----------------
+    }
+    if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+        ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
+}
 
-UnoMultiPageModel::UnoMultiPageModel() : UnoControlDialogModel( false )
+void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
 {
-    ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-    ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-    ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
-    ImplRegisterProperty( BASEPROPERTY_ENABLED );
+    SolarMutexGuard aSolarGuard;
 
-    ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-    ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-    ImplRegisterProperty( BASEPROPERTY_HELPURL );
-    ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
-    //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
-    ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
-    ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
+    Reference< XControlModel > xModel;
+    ::rtl::OUString aName;
 
-    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 );
+    Event.Accessor >>= aName;
+    Event.Element >>= xModel;
+    ImplInsertControl( xModel, aName );
 }
 
-UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel& rModel )
-    : UnoControlDialogModel( rModel )
+void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
 {
-}
+    SolarMutexGuard aSolarGuard;
 
-UnoMultiPageModel::~UnoMultiPageModel()
-{
+    Reference< XControlModel > xModel;
+    Event.Element >>= xModel;
+    if ( xModel.is() )
+        ImplRemoveControl( xModel );
 }
 
-UnoControlModel*
-UnoMultiPageModel::Clone() const
+void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
 {
-    // clone the container itself
-    UnoMultiPageModel* pClone = new UnoMultiPageModel( *this );
+    SolarMutexGuard aSolarGuard;
 
-    // clone all children
-    ::std::for_each(
-        maModels.begin(), maModels.end(),
-        CloneControlModel( pClone->maModels )
-    );
+    Reference< XControlModel > xModel;
+    Event.ReplacedElement >>= xModel;
+    if ( xModel.is() )
+        ImplRemoveControl( xModel );
 
-    return pClone;
+    ::rtl::OUString aName;
+    Event.Accessor >>= aName;
+    Event.Element >>= xModel;
+    ImplInsertControl( xModel, aName );
 }
 
-::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
 {
-    return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel );
+    maTopWindowListeners.addInterface( rxListener );
+    if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
+    {
+        Reference < XTopWindow >  xTW( getPeer(), UNO_QUERY );
+        xTW->addTopWindowListener( &maTopWindowListeners );
+    }
 }
 
-uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+void UnoDialogControl::removeTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
 {
-    if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+    if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
     {
-        uno::Any aAny;
-        aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl );
-        return aAny;
+        Reference < XTopWindow >  xTW( getPeer(), UNO_QUERY );
+        xTW->removeTopWindowListener( &maTopWindowListeners );
     }
-    return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
+    maTopWindowListeners.removeInterface( rxListener );
 }
 
-::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper()
+void UnoDialogControl::toFront(  ) throw (RuntimeException)
 {
-    static UnoPropertyArrayHelper* pHelper = NULL;
-    if ( !pHelper )
+    SolarMutexGuard aSolarGuard;
+    if ( getPeer().is() )
     {
-        uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
-        pHelper = new UnoPropertyArrayHelper( aIDs );
+        Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+        if( xTW.is() )
+            xTW->toFront();
     }
-    return *pHelper;
 }
 
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
+void UnoDialogControl::toBack(  ) throw (RuntimeException)
 {
-    static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-    return xInfo;
+    SolarMutexGuard aSolarGuard;
+    if ( getPeer().is() )
+    {
+        Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+        if( xTW.is() )
+            xTW->toBack();
+    }
 }
 
-void UnoMultiPageModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (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 );
+    SolarMutexGuard aSolarGuard;
+    mxMenuBar = rxMenuBar;
+    if ( getPeer().is() )
+    {
+        Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+        if( xTW.is() )
+            xTW->setMenuBar( mxMenuBar );
+    }
 }
 
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoMultiPageModel::getGroupControl(  ) throw (RuntimeException)
+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
 {
-    return sal_True;
+    ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
+    return aTmp;
 }
 
-//	----------------------------------------------------
-//	class UnoPageControl
-//	----------------------------------------------------
-UnoPageControl::UnoPageControl()
+// ::com::sun::star::awt::XWindowListener
+void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
 {
-    maComponentInfos.nWidth = 280;
-    maComponentInfos.nHeight = 400;
-}
+    OutputDevice*pOutDev = Application::GetDefaultDevice();
+    DBG_ASSERT( pOutDev, "Missing Default Device!" );
+    if ( pOutDev && !mbSizeModified )
+    {
+        // Currentley we are simply using MAP_APPFONT
+        ::Size aAppFontSize( e.Width, e.Height );
 
-UnoPageControl::~UnoPageControl()
-{
-}
+        Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
+        Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
+        OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
+        if ( xDialogDevice.is() )
+        {
+            DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
+            aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
+            aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
+        }
 
-::rtl::OUString UnoPageControl::GetComponentServiceName()
-{
-    return ::rtl::OUString::createFromAscii( "tabpage" );
-}
+        aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
 
+        // Remember that changes have been done by listener. No need to
+        // update the position because of property change event.
+        mbSizeModified = true;
+        Sequence< rtl::OUString > aProps( 2 );
+        Sequence< Any > aValues( 2 );
+        // Properties in a sequence must be sorted!
+        aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
+        aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width"  ));
+        aValues[0] <<= aAppFontSize.Height();
+        aValues[1] <<= aAppFontSize.Width();
 
-// ------------- UnoPageModel -----------------
+        ImplSetPropertyValues( aProps, aValues, true );
+        mbSizeModified = false;
+    }
+}
 
-UnoPageModel::UnoPageModel() : UnoControlDialogModel( false )
+void SAL_CALL UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
 {
-    ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
-    ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
-    ImplRegisterProperty( BASEPROPERTY_ENABLED );
-    ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+    OutputDevice*pOutDev = Application::GetDefaultDevice();
+    DBG_ASSERT( pOutDev, "Missing Default Device!" );
+    if ( pOutDev && !mbPosModified )
+    {
+        // Currentley we are simply using MAP_APPFONT
+        Any    aAny;
+        ::Size aTmp( e.X, e.Y );
+        aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
 
-    ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
-    ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
-    ImplRegisterProperty( BASEPROPERTY_HELPURL );
-    ImplRegisterProperty( BASEPROPERTY_TITLE );
-    ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
-    ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
-//    ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
+        // Remember that changes have been done by listener. No need to
+        // update the position because of property change event.
+        mbPosModified = true;
+        Sequence< rtl::OUString > aProps( 2 );
+        Sequence< Any > aValues( 2 );
+        aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX"  ));
+        aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
+        aValues[0] <<= aTmp.Width();
+        aValues[1] <<= aTmp.Height();
 
-    Any aBool;
-    aBool <<= (sal_Bool) sal_True;
-    ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
-    ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-    //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
+        ImplSetPropertyValues( aProps, aValues, true );
+        mbPosModified = false;
+    }
 }
 
-UnoPageModel::UnoPageModel( const UnoPageModel& rModel )
-    : UnoControlDialogModel( rModel )
+void SAL_CALL UnoDialogControl::windowShown( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
 {
+    (void)e;
 }
 
-UnoPageModel::~UnoPageModel()
+void SAL_CALL UnoDialogControl::windowHidden( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
 {
+    (void)e;
 }
 
-UnoControlModel*
-UnoPageModel::Clone() const
+// XPropertiesChangeListener
+void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
 {
-    // clone the container itself
-    UnoPageModel* pClone = new UnoPageModel( *this );
+    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" ) );
 
-    // clone all children
-    ::std::for_each(
-        maModels.begin(), maModels.end(),
-        CloneControlModel( pClone->maModels )
-    );
+        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();
+            }
+        }
+    }
 
-    return pClone;
-}
+    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 ))
+        {
+            ::rtl::OUString aImageURL;
+            if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
+                ( aImageURL.getLength() > 0 ))
+            {
+                aImageURL =
+                    getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+                                         ImplGetPropertyValue( PROPERTY_IMAGEURL ));
 
-::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;
+            ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True );
+            break;
+        }
     }
-    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;
+    UnoControlContainer::ImplModelPropertiesChanged( rEvents );
 }
 
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoPageModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
+void UnoDialogControl::ImplStartListingForResourceEvents()
 {
-    static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-    return xInfo;
-}
+    Reference< resource::XStringResourceResolver > xStringResourceResolver;
 
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoPageModel::getGroupControl(  ) throw (RuntimeException)
-{
-    return sal_False;
-}
+    ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
 
-// Frame control
+    // Add our helper as listener to retrieve notifications about changes
+    Reference< util::XModifyListener > rListener( mxListener );
+    ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
 
-//	----------------------------------------------------
-//	class UnoFrameControl
-//	----------------------------------------------------
-UnoFrameControl::UnoFrameControl()
-{
-    maComponentInfos.nWidth = 280;
-    maComponentInfos.nHeight = 400;
+    // resource listener will stop listening if resolver reference is empty
+    if ( pResourceListener )
+        pResourceListener->startListening( xStringResourceResolver );
+    ImplUpdateResourceResolver();
 }
 
-UnoFrameControl::~UnoFrameControl()
+void UnoDialogControl::ImplUpdateResourceResolver()
 {
-}
+    rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+    Reference< resource::XStringResourceResolver > xStringResourceResolver;
 
-::rtl::OUString UnoFrameControl::GetComponentServiceName()
-{
-    return ::rtl::OUString::createFromAscii( "frame" );
-}
+    ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+    if ( !xStringResourceResolver.is() )
+        return;
 
-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;
+    Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
 
-    UnoDialogContainerControl::ImplSetPosSize( rxCtrl );
-    Reference < XWindow > xW( rxCtrl, UNO_QUERY );
-    if ( !bOwnCtrl && xW.is() && sTitle.getLength() )
+    Sequence< rtl::OUString > aPropNames(1);
+    aPropNames[0] = aPropName;
+
+    const Sequence< Reference< awt::XControl > > aSeq = getControls();
+    for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
     {
-        awt::Rectangle aSizePos = xW->getPosSize();
+        Reference< XControl > xControl( aSeq[i] );
+        Reference< XPropertySet > xPropertySet;
 
-        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 ( xControl.is() )
+            xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
+
+        if ( !xPropertySet.is() )
+            continue;
+
+        try
         {
-            if ( !bOwnCtrl && sTitle.getLength() )
+            Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
+            Any aOldValue = xPropertySet->getPropertyValue( aPropName );
+            if  (   ( aOldValue >>= xCurrStringResourceResolver )
+                &&  ( xStringResourceResolver == xCurrStringResourceResolver )
+                )
             {
-                // Adjust Y based on height of Title
-                ::Rectangle aRect = pOutDev->GetTextRect( aRect, sTitle );
-                nY = nY + ( aRect.GetHeight() / 2 );
+                Reference< XMultiPropertySet >	xMultiPropSet( xPropertySet, UNO_QUERY );
+                Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+                xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
             }
+            else
+                xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
         }
-        else
+        /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
+        catch ( const Exception& )
         {
-            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 -----------------
+    // propagate resource resolver changes to language dependent props of the dialog
+    Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
+    if ( xPropertySet.is() )
+    {
+        Reference< XMultiPropertySet >	xMultiPropSet( xPropertySet, UNO_QUERY );
+        Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+        xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
+    }
+}
 
-UnoFrameModel::UnoFrameModel() : UnoControlDialogModel( false )
+void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
 {
-    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 );
+    Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+    if ( xPeerDialog.is() )
+        xPeerDialog->endDialog( i_result );
 }
 
-UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
-    : UnoControlDialogModel( rModel )
+void SAL_CALL UnoDialogControl::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException)
 {
+    Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
+    if ( xPeerDialog.is() )
+        xPeerDialog->setHelpId( i_id );
 }
 
-UnoFrameModel::~UnoFrameModel()
+void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
 {
+    SolarMutexGuard aSolarGuard;
+    Any aAny;
+    aAny <<= Title;
+    ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
 }
 
-UnoControlModel*
-UnoFrameModel::Clone() const
+::rtl::OUString UnoDialogControl::getTitle() throw(RuntimeException)
 {
-    // clone the container itself
-    UnoFrameModel* pClone = new UnoFrameModel( *this );
-
-    // clone all children
-    ::std::for_each(
-        maModels.begin(), maModels.end(),
-        CloneControlModel( pClone->maModels )
-    );
+    SolarMutexGuard aSolarGuard;
+    return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
+}
 
-    return pClone;
+sal_Int16 UnoDialogControl::execute() throw(RuntimeException)
+{
+    SolarMutexGuard aSolarGuard;
+    sal_Int16 nDone = -1;
+    if ( getPeer().is() )
+    {
+        Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
+        if( xDlg.is() )
+        {
+            GetComponentInfos().bVisible = sal_True;
+            nDone = xDlg->execute();
+            GetComponentInfos().bVisible = sal_False;
+        }
+    }
+    return nDone;
 }
 
-::rtl::OUString UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+void UnoDialogControl::endExecute() throw(RuntimeException)
 {
-    return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel );
+    SolarMutexGuard aSolarGuard;
+    if ( getPeer().is() )
+    {
+        Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
+        if( xDlg.is() )
+        {
+            xDlg->endExecute();
+            GetComponentInfos().bVisible = sal_False;
+        }
+    }
 }
 
-uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
 {
-    if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+    SolarMutexGuard aSolarGuard;
+    UnoControlContainer::addingControl( _rxControl );
+
+    if ( _rxControl.is() )
     {
-        uno::Any aAny;
-        aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
-        return aAny;
+        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 );
+        }
     }
-    return UnoControlDialogModel::ImplGetDefaultValue( nPropId );
 }
 
-::cppu::IPropertyArrayHelper& UnoFrameModel::getInfoHelper()
+void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
 {
-    static UnoPropertyArrayHelper* pHelper = NULL;
-    if ( !pHelper )
+    SolarMutexGuard aSolarGuard;
+    UnoControlContainer::removingControl( _rxControl );
+
+    if ( _rxControl.is() )
     {
-        uno::Sequence<sal_Int32>	aIDs = ImplGetPropertyIds();
-        pHelper = new UnoPropertyArrayHelper( aIDs );
+        Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+        if ( xProps.is() )
+            xProps->removePropertiesChangeListener( this );
     }
-    return *pHelper;
+
 }
 
-// beans::XMultiPropertySet
-uno::Reference< beans::XPropertySetInfo > UnoFrameModel::getPropertySetInfo(  ) throw(uno::RuntimeException)
+void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
 {
-    static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
-    return xInfo;
+    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*/ )
+throw (RuntimeException)
+{
+    ImplUpdateResourceResolver();
+}
 
-//===============================================================
 //	----------------------------------------------------
-//	class DialogContainerControl
+//	Helper Method to convert relative url to physical location
 //	----------------------------------------------------
-UnoDialogContainerControl::UnoDialogContainerControl() :
+
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+{
+
+        ::rtl::OUString ret;
+
+    ::rtl::OUString baseLocation;
+    ::rtl::OUString url;
+
+    rbase  >>= baseLocation;
+    rUrl  >>= url;
+
+    ::rtl::OUString absoluteURL( url );
+    if ( url.getLength() > 0 )
+    {
+        // Don't adjust GraphicObject url(s)
+        if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+        {
+            INetURLObject urlObj(baseLocation);
+            urlObj.removeSegment();
+            baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+            ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
+        }
+        else
+            ret = url;
+
+        const INetURLObject protocolCheck( url );
+        const INetProtocol protocol = protocolCheck.GetProtocol();
+        if ( protocol == INET_PROT_NOT_VALID )
+        {
+            ::rtl::OUString testAbsoluteURL;
+            if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
+                absoluteURL = testAbsoluteURL;
+        }
+    }
+
+    return absoluteURL;
+}
+
+UnoParentControl::UnoParentControl() :
     mbSizeModified(false),
     mbPosModified(false)
 {
     maComponentInfos.nWidth = 280;
     maComponentInfos.nHeight = 400;
+    // #TODO Do we need the ResourceListener foo ?
 }
 
-UnoDialogContainerControl::~UnoDialogContainerControl()
+UnoParentControl::~UnoParentControl()
 {
 }
 
 // XInterface
-Any UnoDialogContainerControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+Any UnoParentControl::queryAggregation( const Type & rType ) throw(RuntimeException)
 {
-    Any aRet( UnoDialogContainerControl_IBase::queryInterface( rType ) );
+    Any aRet( UnoParentControl_IBase::queryInterface( rType ) );
     return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
 }
 
 // XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoDialogContainerControl )
+IMPL_IMPLEMENTATION_ID( UnoParentControl )
 Sequence< Type >
-UnoDialogContainerControl::getTypes() throw(RuntimeException)
+UnoParentControl::getTypes() throw(RuntimeException)
 {
     return ::comphelper::concatSequences(
-        UnoDialogContainerControl_IBase::getTypes(),
+        UnoParentControl_IBase::getTypes(),
         UnoControlContainer::getTypes()
     );
 }
 
-void UnoDialogContainerControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
+void UnoParentControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
     UnoControlContainer::createPeer( rxToolkit, rParentPeer );
 }
 
-void UnoDialogContainerControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+void UnoParentControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
 {
     Reference< XPropertySet > xP( rxModel, UNO_QUERY );
 
@@ -2187,7 +2416,7 @@ void UnoDialogContainerControl::ImplInsertControl( Reference< XControlModel >& r
     }
 }
 
-void UnoDialogContainerControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
+void UnoParentControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
 {
     Sequence< Reference< XControl > > aControls = getControls();
     Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
@@ -2195,7 +2424,7 @@ void UnoDialogContainerControl::ImplRemoveControl( Reference< XControlModel >& r
         removeControl( xCtrl );
 }
 
-void UnoDialogContainerControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
+void UnoParentControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
 {
     Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
 
@@ -2253,19 +2482,19 @@ void UnoDialogContainerControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
     xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
 }
 
-void UnoDialogContainerControl::dispose() throw(RuntimeException)
+void UnoParentControl::dispose() throw(RuntimeException)
 {
     UnoControlContainer::dispose();
 }
 
-void SAL_CALL UnoDialogContainerControl::disposing(
+void SAL_CALL UnoParentControl::disposing(
     const EventObject& Source )
 throw(RuntimeException)
 {
     UnoControlContainer::disposing( Source );
 }
 
-sal_Bool UnoDialogContainerControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+sal_Bool UnoParentControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
 
@@ -2338,7 +2567,7 @@ sal_Bool UnoDialogContainerControl::setModel( const Reference< XControlModel >&
 
     return bRet;
 }
-void UnoDialogContainerControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+void UnoParentControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
 
@@ -2357,7 +2586,7 @@ void UnoDialogContainerControl::setDesignMode( sal_Bool bOn ) throw(RuntimeExcep
         mxTabController->activateTabOrder();
 }
 
-void UnoDialogContainerControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+void UnoParentControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
     Reference< XControlModel > xModel;
@@ -2368,7 +2597,7 @@ void UnoDialogContainerControl::elementInserted( const ContainerEvent& Event ) t
     ImplInsertControl( xModel, aName );
 }
 
-void UnoDialogContainerControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+void UnoParentControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
 
@@ -2378,7 +2607,7 @@ void UnoDialogContainerControl::elementRemoved( const ContainerEvent& Event ) th
         ImplRemoveControl( xModel );
 }
 
-void UnoDialogContainerControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+void UnoParentControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
 
@@ -2394,7 +2623,7 @@ void UnoDialogContainerControl::elementReplaced( const ContainerEvent& Event ) t
 }
 
 // XPropertiesChangeListener
-void UnoDialogContainerControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+void UnoParentControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
 {
     if( !isDesignMode() && !mbCreatingCompatiblePeer )
     {
@@ -2436,7 +2665,7 @@ void UnoDialogContainerControl::ImplModelPropertiesChanged( const Sequence< Prop
     UnoControlContainer::ImplModelPropertiesChanged( rEvents );
 }
 
-void UnoDialogContainerControl::addingControl( const Reference< XControl >& _rxControl )
+void UnoParentControl::addingControl( const Reference< XControl >& _rxControl )
 {
     SolarMutexGuard aSolarGuard;
     UnoControlContainer::addingControl( _rxControl );
@@ -2458,7 +2687,7 @@ void UnoDialogContainerControl::addingControl( const Reference< XControl >& _rxC
     }
 }
 
-void UnoDialogContainerControl::removingControl( const Reference< XControl >& _rxControl )
+void UnoParentControl::removingControl( const Reference< XControl >& _rxControl )
 {
     SolarMutexGuard aSolarGuard;
     UnoControlContainer::removingControl( _rxControl );
@@ -2472,7 +2701,7 @@ void UnoDialogContainerControl::removingControl( const Reference< XControl >& _r
 
 }
 
-void SAL_CALL UnoDialogContainerControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
+void SAL_CALL UnoParentControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
 {
     SolarMutexGuard aSolarGuard;
     // a tab controller model may have changed
@@ -2483,544 +2712,570 @@ void SAL_CALL UnoDialogContainerControl::changesOccurred( const ChangesEvent& )
         mxTabController->activateTabOrder();
 }
 
-// ============================================================================
-// = class UnoDialogControl
-// ============================================================================
-
-UnoDialogControl::UnoDialogControl() :
-    maTopWindowListeners( *this ),
-    mbWindowListener(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;
 }
 
-UnoDialogControl::~UnoDialogControl()
+UnoMultiPageControl::~UnoMultiPageControl()
 {
 }
+// XTabListener
 
-::rtl::OUString UnoDialogControl::GetComponentServiceName()
+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 );
 
-    sal_Bool bDecoration( sal_True );
-    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
-    if ( bDecoration )
-        return ::rtl::OUString::createFromAscii( "Dialog" );
-    else
-        return ::rtl::OUString::createFromAscii( "TabPage" );
+}
+void SAL_CALL UnoMultiPageControl::deactivated( ::sal_Int32 /*ID*/ ) throw (RuntimeException)
+{
+}
+void SAL_CALL UnoMultiPageControl::disposing(const EventObject&) throw (RuntimeException)
+{
 }
 
-// XInterface
-Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+void SAL_CALL UnoMultiPageControl::dispose() 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
+    lang::EventObject aEvt;
+    aEvt.Source = (::cppu::OWeakObject*)this;
+    maTabListeners.disposeAndClear( aEvt );
+    UnoParentControl::dispose();
+}
 
-void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+// com::sun::star::awt::XSimpleTabController
+::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() throw (RuntimeException)
 {
-   // maybe this should be in the UnoDialogContainerControl, lets see
-    Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+    if ( !xMultiPage.is() )
+        throw RuntimeException();
+    return xMultiPage->insertTab();
+}
 
-    // Add our own resource resolver to a newly created control
-    Reference< resource::XStringResourceResolver > xStringResourceResolver;
-    rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+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 );
+}
 
-    Any aAny;
-    ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+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 );
+}
 
-    aAny <<= xStringResourceResolver;
-    xP->setPropertyValue( aPropName, aAny );
+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 );
+}
 
-    UnoDialogContainerControl::ImplInsertControl( rxModel, rName );
+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 );
 
 }
 
-void UnoDialogControl::dispose() throw(RuntimeException)
+::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() 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 ---
+    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+    if ( !xMultiPage.is() )
+        throw RuntimeException();
+    return xMultiPage->getActiveTabID();
+}
 
-    if ( xListener.is() )
-        xListener->disposing( aEvt );
-    UnoDialogContainerControl::dispose();
+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 UnoDialogControl::disposing(
-    const EventObject& Source )
-throw(RuntimeException)
+void SAL_CALL UnoMultiPageControl::removeTabListener( const Reference< XTabListener >& Listener ) throw (RuntimeException)
 {
-    // #FIXME see what can be moved to  UnoDialogControlContainer
-    rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-    Reference< resource::XStringResourceResolver > xStringResourceResolver;
+    Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
+    if ( xMultiPage.is()  && maTabListeners.getLength() == 1 )
+        xMultiPage->removeTabListener( &maTabListeners );
+    maTabListeners.removeInterface( Listener );
+}
 
-    ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-    Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
 
-    if ( Source.Source == xIfac )
-    {
-        Any aAny;
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoMultiPageControl )
+    getCppuType( ( uno::Reference< awt::XSimpleTabController>* ) NULL ),
+    getCppuType( ( uno::Reference< awt::XTabListener>* ) NULL ),
+    UnoParentControl::getTypes()
+IMPL_XTYPEPROVIDER_END
 
-        // Reset resource resolver reference
-        ImplSetPropertyValue( aPropName, aAny, sal_True );
-        ImplUpdateResourceResolver();
-    }
-    else
-    {
-        UnoDialogContainerControl::disposing( Source );
-    }
+// 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 : UnoParentControl::queryAggregation( rType ));
 }
 
-sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+::rtl::OUString UnoMultiPageControl::GetComponentServiceName()
 {
-        // #Can we move all the Resource stuff to the UnoDialogContainerControl ?
-    SolarMutexGuard aSolarGuard;
-        sal_Bool bRet = UnoDialogContainerControl::setModel( rxModel );
-    ImplStartListingForResourceEvents();
-    return bRet;
+    sal_Bool bDecoration( sal_True );
+    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+    if ( bDecoration )
+        return ::rtl::OUString::createFromAscii( "tabcontrol" );
+    // Hopefully we can tweak the tabcontrol to display without tabs
+    return ::rtl::OUString::createFromAscii( "tabcontrolnotabs" );
 }
 
-void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
+void UnoMultiPageControl::bindPage( const uno::Reference< awt::XControl >& _rxControl )
 {
-    SolarMutexGuard aSolarGuard;
-
-    UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+    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 );
 
-    Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
-    if ( xTW.is() )
+   VCLXTabPage* pXPage = dynamic_cast< VCLXTabPage* >( xPage.get() );
+   TabPage* pPage = pXPage ? pXPage->getTabPage() : NULL;
+    if ( xTabCntrl.is() && pPage )
     {
-        xTW->setMenuBar( mxMenuBar );
-
-        if ( !mbWindowListener )
+        VCLXMultiPage* pXTab = dynamic_cast< VCLXMultiPage* >( xTabCntrl.get() );
+        if ( pXTab )
         {
-            Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
-            addWindowListener( xWL );
-            mbWindowListener = true;
+            rtl::OUString sTitle;
+            xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
+            pXTab->insertTab( pPage, sTitle);
         }
-
-        if ( maTopWindowListeners.getLength() )
-            xTW->addTopWindowListener( &maTopWindowListeners );
     }
+
 }
 
-void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
+void UnoMultiPageControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer >  & rParentPeer ) throw(RuntimeException)
 {
-    sal_Bool bDecoration( sal_True );
-    ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
-    if ( !bDecoration )
-    {
-        // Now we have to manipulate the WindowDescriptor
-        rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
-    }
+    SolarMutexGuard aSolarGuard;
 
-    // We have to set the graphic property before the peer
-    // will be created. Otherwise the properties will be copied
-    // into the peer via propertiesChangeEvents. As the order of
-    // can lead to overwrites we have to set the graphic property
-    // before the propertiesChangeEvents are sent!
-    ::rtl::OUString aImageURL;
-    if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
-        ( aImageURL.getLength() > 0 ))
+    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() )
     {
-        ::rtl::OUString absoluteUrl = aImageURL;
-        if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+        xTabCntrl->addTabListener( this );
+        if ( nActiveTab && nCtrls ) // Ensure peer is initialise with correct activated tab
         {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list