summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2011-01-28 12:51:43 +0100
committerVladimir Glazunov <vg@openoffice.org>2011-01-28 12:51:43 +0100
commit85aac3918f30ee015c1de8a5a0d908f2c5165f94 (patch)
tree53e7081609c5e919ae970a2abd9d21056ffa59a0 /toolkit
parentdbab1b3af4d3b1f7d58e461db3a0bbbe7ba893b0 (diff)
parentb1f053597833fd2937ab8b1a1a4942e6d5479485 (diff)
CWS-TOOLING: integrate CWS tabcontrol
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/Library_tk.mk4
-rw-r--r--toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx90
-rw-r--r--toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx82
-rw-r--r--toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx261
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx206
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx1
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx6
-rw-r--r--toolkit/inc/toolkit/controls/tabpagecontainer.hxx147
-rw-r--r--toolkit/inc/toolkit/controls/tabpagemodel.hxx147
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx1
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx8
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx7
-rw-r--r--toolkit/inc/toolkit/helper/tkresmgr.hxx1
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx233
-rw-r--r--toolkit/source/awt/vclxtabpagemodel.cxx150
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx28
-rw-r--r--toolkit/source/awt/vclxwindows.cxx55
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx1811
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx1739
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx301
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx404
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx1
-rw-r--r--toolkit/source/controls/unocontrols.cxx1
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx6
-rw-r--r--toolkit/source/helper/registerservices.cxx29
-rw-r--r--toolkit/source/helper/servicenames.cxx5
-rw-r--r--toolkit/source/helper/tkresmgr.cxx35
-rw-r--r--toolkit/util/tk.component12
28 files changed, 3852 insertions, 1919 deletions
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index ab51c1e282bb..63fb5e0d03dd 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -82,6 +82,7 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/awt/vclxsystemdependentwindow \
toolkit/source/awt/vclxtabcontrol \
toolkit/source/awt/vclxtabpage \
+ toolkit/source/awt/vclxtabpagecontainer \
toolkit/source/awt/vclxtoolkit \
toolkit/source/awt/vclxtopwindow \
toolkit/source/awt/vclxwindow \
@@ -90,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/awt/xsimpleanimation \
toolkit/source/awt/xthrobber \
toolkit/source/controls/accessiblecontrolcontext \
+ toolkit/source/controls/controlmodelcontainerbase \
toolkit/source/controls/dialogcontrol \
toolkit/source/controls/eventcontainer \
toolkit/source/controls/formattedcontrol \
@@ -100,6 +102,8 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/controls/grid/gridcontrol \
toolkit/source/controls/roadmapcontrol \
toolkit/source/controls/roadmapentry \
+ toolkit/source/controls/tabpagecontainer \
+ toolkit/source/controls/tabpagemodel \
toolkit/source/controls/stdtabcontroller \
toolkit/source/controls/stdtabcontrollermodel \
toolkit/source/controls/tkscrollbar \
diff --git a/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
new file mode 100644
index 000000000000..d4fe2a727b43
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
@@ -0,0 +1,90 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TOOLKIT_AWT_VCLXTABPAGECONTAINER_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGECONTAINER_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include "toolkit/awt/vclxwindow.hxx"
+//#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper2 < VCLXContainer
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ , ::com::sun::star::container::XContainerListener
+ > VCLXTabPageContainer_Base;
+class VCLXTabPageContainer : public VCLXTabPageContainer_Base
+{
+public:
+ VCLXTabPageContainer();
+ ~VCLXTabPageContainer();
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+private:
+ sal_Int16 m_nActiveTabPageId;
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > > m_aTabPages;
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
new file mode 100644
index 000000000000..670ed25c0f2d
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
@@ -0,0 +1,82 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include "toolkit/awt/vclxwindow.hxx"
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include "forward.hxx"
+#include <cppuhelper/implbase1.hxx>
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel,
+ ::com::sun::star::awt::tab::XTabPageModel
+ > VCLXTabPageModel_Base;
+class VCLXTabPageModel : public VCLXTabPageModel_Base
+{
+public:
+ VCLXTabPageModel();
+ VCLXTabPageModel( const VCLXTabPageModel& rModel ) : VCLXTabPageModel_Base( rModel ) {;}
+ ~VCLXTabPageModel();
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+ UnoControlModel* Clone() const { return new VCLXTabPageModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+protected:
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
new file mode 100644
index 000000000000..d50fecd8a344
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_CONTROL_MODEL_CONTAINERBASE_HXX
+#define TOOLKIT_CONTROL_MODEL_CONTAINERBASE_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <cppuhelper/implbase8.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+// ----------------------------------------------------
+// class ControlModelContainerBase
+// ----------------------------------------------------
+typedef UnoControlModel ControlModel_Base;
+typedef ::cppu::AggImplInheritanceHelper8 < ControlModel_Base
+ , ::com::sun::star::lang::XMultiServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XNameContainer
+ , ::com::sun::star::awt::XTabControllerModel
+ , ::com::sun::star::util::XChangesNotifier
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::awt::tab::XTabPageModel
+ , ::com::sun::star::lang::XInitialization
+ > ControlModelContainer_IBase;
+
+class ControlModelContainerBase : public ControlModelContainer_IBase
+{
+public:
+ // would like to make this typedef private, too, but the Forte 7 compiler does have
+ // problems with this .....
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
+ UnoControlModelHolder;
+private:
+ typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
+
+ // for grouping control models (XTabControllerModel::getGroupXXX)
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >
+ ModelGroup;
+ typedef ::std::vector< ModelGroup > AllGroups;
+
+ friend struct CloneControlModel;
+ friend struct FindControlModel;
+ friend struct CompareControlModel;
+
+protected:
+ ContainerListenerMultiplexer maContainerListeners;
+ ::cppu::OInterfaceContainerHelper maChangeListeners;
+ UnoControlModelHolderList maModels;
+
+ AllGroups maGroups;
+ sal_Bool mbGroupsUpToDate;
+
+ bool m_bEnabled;
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sImageURL;
+ ::rtl::OUString m_sTooltip;
+ sal_Int16 m_nTabPageId;
+
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
+
+public:
+ ControlModelContainerBase();
+ ControlModelContainerBase( const ControlModelContainerBase& rModel );
+ ~ControlModelContainerBase();
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAcces
+ ::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::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);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XMultiServiceFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTabControllerModel
+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGroupCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED(ControlModelContainerBase, ControlModel_Base, "toolkit.ControlModelContainerBase" )
+
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+
+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 );
+
+ void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
+
+ void implUpdateGroupStructure();
+};
+
+class ResourceListener :public ::com::sun::star::util::XModifyListener,
+ public ::cppu::OWeakObject,
+ public ::cppu::BaseMutex
+{
+ public:
+ ResourceListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener );
+ virtual ~ResourceListener();
+
+ void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >& rResource );
+ void stopListening();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xResource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+ bool m_bListening;
+};
+
+typedef ::cppu::AggImplInheritanceHelper2 < UnoControlContainer
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XChangesListener
+ > ContainerControl_IBase;
+
+class ControlContainerBase : public ContainerControl_IBase
+{
+protected:
+ bool mbSizeModified;
+ bool mbPosModified;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
+
+ 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 );
+ void ImplUpdateResourceResolver();
+ void ImplStartListingForResourceEvents();
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
+public:
+ ControlContainerBase();
+ ~ControlContainerBase();
+
+ DECLIMPL_SERVICEINFO_DERIVED( ControlContainerBase, UnoControlBase, "toolkit.ControlContainerBase" )
+
+ 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);
+
+ // 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 );
+};
+#endif
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
index f6a0f768bc10..a68760715035 100644
--- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -28,221 +28,55 @@
#ifndef TOOLKIT_DIALOG_CONTROL_HXX
#define TOOLKIT_DIALOG_CONTROL_HXX
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/util/XChangesNotifier.hpp>
-#include <com/sun/star/util/XChangesListener.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/awt/XDialog2.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
-#include <cppuhelper/implbase6.hxx>
-#include <cppuhelper/implbase5.hxx>
-#include <toolkit/helper/listenermultiplexer.hxx>
-#include <toolkit/controls/unocontrolmodel.hxx>
#include "toolkit/helper/servicenames.hxx"
#include "toolkit/helper/macros.hxx"
#include <toolkit/controls/unocontrolcontainer.hxx>
-#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/basemutex.hxx>
#include <list>
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
-typedef UnoControlModel UnoControlDialogModel_Base;
-typedef ::cppu::ImplHelper6 < ::com::sun::star::lang::XMultiServiceFactory
- , ::com::sun::star::container::XContainer
- , ::com::sun::star::container::XNameContainer
- , ::com::sun::star::awt::XTabControllerModel
- , ::com::sun::star::util::XChangesNotifier
- , ::com::sun::star::beans::XPropertyChangeListener
- > UnoControlDialogModel_IBase;
-class UnoControlDialogModel : public UnoControlDialogModel_IBase
- , public UnoControlDialogModel_Base
+class UnoControlDialogModel : public ControlModelContainerBase
{
-public:
- // would like to make this typedef private, too, but the Forte 7 compiler does have
- // problems with this .....
- typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
- UnoControlModelHolder;
-private:
- typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
-
- // for grouping control models (XTabControllerModel::getGroupXXX)
- typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >
- ModelGroup;
- typedef ::std::vector< ModelGroup > AllGroups;
-
- friend struct CloneControlModel;
- friend struct FindControlModel;
- friend struct CompareControlModel;
-
-private:
- ContainerListenerMultiplexer maContainerListeners;
- ::cppu::OInterfaceContainerHelper maChangeListeners;
- UnoControlModelHolderList maModels;
-
- AllGroups maGroups;
- sal_Bool mbGroupsUpToDate;
-
protected:
::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
-
- UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
-
public:
UnoControlDialogModel();
UnoControlDialogModel( const UnoControlDialogModel& rModel );
~UnoControlDialogModel();
- UnoControlModel* Clone() const;
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlModel::queryInterface(rType); }
- ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
- void SAL_CALL release() throw() { OWeakAggObject::release(); }
-
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XContainer
- void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::container::XElementAcces
- ::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);
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
- sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
- void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::beans::XMultiPropertySet
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::lang::XMultiServiceFactory
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::io::XPersistObject
::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
- // XComponent
- void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XTabControllerModel
- virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getGroupCount( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw (::com::sun::star::uno::RuntimeException);
-
- // XChangesNotifier
- virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XPropertyChangeListener
- virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- using cppu::OPropertySetHelper::disposing;
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
-
// XServiceInfo
- DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
-
-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 );
-
- void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
-
- void implUpdateGroupStructure();
-};
-
-// ----------------------------------------------------
-// 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
-{
- public:
- ResourceListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener );
- virtual ~ResourceListener();
-
- void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >& rResource );
- void stopListening();
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel )
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire() throw ();
- virtual void SAL_CALL release() throw ();
-
- // XModifyListener
- virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xResource;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
- bool m_bListening;
};
-class UnoDialogControl :public UnoControlContainer
- ,public UnoDialogControl_IBase
+class UnoDialogControl :public ControlContainerBase,
+ public ::com::sun::star::awt::XTopWindow,
+ public ::com::sun::star::awt::XDialog,
+ public ::com::sun::star::awt::XWindowListener
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
TopWindowListenerMultiplexer maTopWindowListeners;
bool mbWindowListener;
- bool mbSizeModified;
- bool mbPosModified;
-
-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); }
@@ -267,15 +101,6 @@ public:
virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
- // ::com::sun::star::container::XContainerListener
- void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
-
- // ::com::sun::star::awt::XDialog2
- virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) throw (::com::sun::star::uno::RuntimeException);
-
// ::com::sun::star::awt::XDialog
void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
@@ -288,10 +113,6 @@ public:
// ::com::sun::star::awt::XControl
sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
-
- // XChangesListener
- virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
// XModifyListener
virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
@@ -300,13 +121,10 @@ public:
DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
protected:
- virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ // 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 );
-
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
protected:
- virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
- virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
};
-
#endif // TOOLKIT_DIALOG_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
index 05b3016e690a..558d145f3d14 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
@@ -186,6 +186,7 @@ FORWARD_DECLARE_INTERFACE( script, XNameContainer )
{
public:
OGeometryControlModel();
+ OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
private:
OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
index d6491877c7ad..3b784251b65e 100644
--- a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
@@ -37,6 +37,12 @@ OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel()
{
}
+template <class CONTROLMODEL>
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext)
+ :OGeometryControlModel_Base(new CONTROLMODEL(i_xCompContext))
+{
+}
+
//--------------------------------------------------------------------
template <class CONTROLMODEL>
OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance)
diff --git a/toolkit/inc/toolkit/controls/tabpagecontainer.hxx b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
new file mode 100644
index 000000000000..6861f4bc01bb
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_TABPAGE_CONTAINER_HXX
+#define TOOLKIT_TABPAGE_CONTAINER_HXX
+
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+using namespace ::com::sun::star::uno;
+//using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+// ------------------------------------------------------------------
+// class ::com::sun::star::awt::tab::UnoControlTabPageContainerModel
+// ------------------------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::tab::XTabPageContainerModel
+ > UnoControlTabPageContainerModel_Base;
+class UnoControlTabPageContainerModel : public UnoControlTabPageContainerModel_Base
+{
+private:
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > > m_aTabPageVector;
+ ContainerListenerMultiplexer maContainerListeners;
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+public:
+ UnoControlTabPageContainerModel();
+ UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlTabPageContainerModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, szServiceName_UnoControlTabPageContainerModel )
+ // XIndexContainer
+ virtual 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);
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XIndexReplace
+ virtual 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);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::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);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ //{
+ //return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
+ //}
+
+ virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+};
+// ===================================================================
+// = UnoControlTabPageContainer
+// ===================================================================
+typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ > UnoControlTabPageContainer_Base;
+class UnoControlTabPageContainer : public UnoControlTabPageContainer_Base
+{
+public:
+ UnoControlTabPageContainer();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, szServiceName_UnoControlTabPageContainer )
+
+// using UnoControl::getPeer;
+protected:
+ virtual void updateFromModel();
+private:
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ sal_Int16 m_nActiveTabPageId;
+};
+
+#endif // _TOOLKIT_TABPAGE_CONTAINER_HXX
diff --git a/toolkit/inc/toolkit/controls/tabpagemodel.hxx b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
new file mode 100644
index 000000000000..76edc2e68026
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_TABPAGE_MODEL_HXX
+#define TOOLKIT_TABPAGE_MODEL_HXX
+
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/macros.hxx"
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <list>
+#include <cppuhelper/implbase2.hxx>
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+//typedef ::cppu::ImplHelper2< ::com::sun::star::awt::tab::XTabPageModel,
+// ::com::sun::star::lang::XInitialization
+// > TabPageAccess_BASE;
+//
+//class TabPageModel : public TabPageAccess_BASE
+//{
+//
+//private:
+// bool m_bEnabled;
+// ::rtl::OUString m_sTitle;
+// ::rtl::OUString m_sImageURL;
+// ::rtl::OUString m_sTooltip;
+// sal_Int16 m_nTabPageId;
+//
+//public:
+// TabPageModel();
+// explicit TabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCompContext);
+// ~TabPageModel();
+//
+// // XInitialization
+// virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+// throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+//
+// ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+// void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+// void SAL_CALL release() throw() { OWeakAggObject::release(); }
+//
+// // ::com::sun::star::lang::XTypeProvider
+// //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+// //::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+//
+// // ::com::sun::star::awt::tab::XTabPageModel
+// virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+// virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+//};
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+
+class UnoControlTabPageModel : public ControlModelContainerBase
+ //public TabPageModel
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xCompContext;
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+public:
+ UnoControlTabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageModel, ControlModelContainerBase, szServiceName_UnoControlTabPageModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoTabPageControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPage
+ , ::com::sun::star::awt::XWindowListener
+ > UnoControlTabPage_Base;
+class UnoControlTabPage : public UnoControlTabPage_Base
+{
+private:
+ bool m_bWindowListener;
+public:
+
+ UnoControlTabPage();
+ ~UnoControlTabPage();
+ ::rtl::OUString GetComponentServiceName();
+
+ 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);
+ 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);
+
+ // ::com::sun::star::awt::XWindowListener
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ 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::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlTabPage, szServiceName_UnoControlTabPage)
+};
+
+#endif // TOOLKIT_TABPAGE_MODEL_HXX
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
index 01ff047ee3de..5e34c23279a1 100644
--- a/toolkit/inc/toolkit/controls/unocontrols.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -1501,5 +1501,6 @@ public:
};
+
#endif // _TOOLKIT_HELPER_UNOCONTROLS_HXX_
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index b4151fe0f35e..408dd4cbe385 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -55,6 +55,7 @@
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/macros.hxx>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
// ----------------------------------------------------
// class ListenerMultiplexerBase
// ----------------------------------------------------
@@ -251,5 +252,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun:
void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
DECL_LISTENERMULTIPLEXER_END
+// ----------------------------------------------------
+// class TabPageListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+ void SAL_CALL tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
index 2d1df79b733b..f24fa815331a 100644
--- a/toolkit/inc/toolkit/helper/servicenames.hxx
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -104,5 +104,12 @@ extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceNa
extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[];
extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[], szServiceName2_UnoControlTabPageModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[];
+
+// ExtUnoWrapper:
+extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_
diff --git a/toolkit/inc/toolkit/helper/tkresmgr.hxx b/toolkit/inc/toolkit/helper/tkresmgr.hxx
index d7a1c42ea13c..ea62cd3db361 100644
--- a/toolkit/inc/toolkit/helper/tkresmgr.hxx
+++ b/toolkit/inc/toolkit/helper/tkresmgr.hxx
@@ -70,6 +70,7 @@ public:
// loads the image with the specified resource id
static Image loadImage( sal_uInt16 nResId );
+ static Image getImageFromURL( const ::rtl::OUString& i_rImageURL );
};
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
new file mode 100644
index 000000000000..ead570f80b88
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagecontainer.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+// ----------------------------------------------------
+// class VCLXTabPageContainer
+// ----------------------------------------------------
+void VCLXTabPageContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXTabPageContainer::VCLXTabPageContainer() :
+ m_aTabPageListeners( *this )
+{
+}
+
+VCLXTabPageContainer::~VCLXTabPageContainer()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabControl = (TabControl*)GetWindow();
+ if ( pTabControl )
+ {
+ TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( pTabControl->GetCurPageId( ) ) );
+ if ( pTabPage )
+ {
+ ::Point aPos( nX, nY );
+ ::Size aSize = pTabPage->GetSizePixel();
+
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ aPos = pDev->PixelToLogic( aPos );
+ aSize = pDev->PixelToLogic( aSize );
+
+ pTabPage->Draw( pDev, aPos, aSize, 0 );
+ }
+ }
+
+ VCLXWindow::draw( nX, nY );
+/*
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+*/
+}
+
+::com::sun::star::awt::DeviceInfo VCLXTabPageContainer::getInfo() throw(RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+void SAL_CALL VCLXTabPageContainer::setProperty(const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TabControl* pTabPage = (TabControl*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+}
+::sal_Int16 SAL_CALL VCLXTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetCurPageId( ) : 0;
+}
+void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ if ( pTabCtrl )
+ pTabCtrl->SelectTabPage(_activetabpageid);
+}
+::sal_Int32 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (getActiveTabPageID() == tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (tabPageIndex >= 0 && tabPageIndex < static_cast<sal_Int16>(m_aTabPages.size())) ? m_aTabPages[tabPageIndex] : NULL;
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage;
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aIter = m_aTabPages.begin();
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aEnd = m_aTabPages.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ Reference< awt::XControl > xControl(*aIter,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ if ( tabPageID == xP->getTabPageID() )
+ {
+ xTabPage = *aIter;
+ break;
+ }
+ }
+ return xTabPage;
+}
+void SAL_CALL VCLXTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+}
+void SAL_CALL VCLXTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( pTabControl )
+ {
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ {
+// allocateArea( maAllocation );
+ ULONG page = (ULONG)_rVclWindowEvent.GetData();
+ awt::tab::TabPageActivatedEvent aEvent(NULL,page);
+ m_aTabPageListeners.tabPageActivated(aEvent);
+ break;
+ }
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+ }
+}
+void SAL_CALL VCLXTabPageContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ sal_Int16 nPageID = xP->getTabPageID();
+
+ Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ TabPage* pPage = (TabPage*)pWindow;
+ pTabCtrl->InsertPage(nPageID,pPage->GetText());
+
+ pPage->Hide();
+ pTabCtrl->SetTabPage(nPageID,pPage);
+ pTabCtrl->SetHelpText(nPageID,xP->getTooltip());
+ pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL()));
+ pTabCtrl->SelectTabPage(nPageID);
+ m_aTabPages.push_back(xTabPage);
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ pTabCtrl->RemovePage(xP->getTabPageID());
+ m_aTabPages.erase(::std::remove(m_aTabPages.begin(),m_aTabPages.end(),xTabPage));
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementReplaced( const ::com::sun::star::container::ContainerEvent& /*Event*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
diff --git a/toolkit/source/awt/vclxtabpagemodel.cxx b/toolkit/source/awt/vclxtabpagemodel.cxx
new file mode 100644
index 000000000000..c7145992bd7f
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagemodel.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagemodel.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+
+VCLXTabPageModel::VCLXTabPageModel()
+{
+}
+
+VCLXTabPageModel::~VCLXTabPageModel()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+
+void SAL_CALL VCLXTabPageModel::setProperty(
+ const ::rtl::OUString& /*PropertyName*/,
+ const ::com::sun::star::uno::Any& /*Value*/ )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ /*TabPage* pTabPage = (TabPage*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }*/
+}
+//XTabPageModel
+::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return false;
+}
+void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->EnablePage(0, true);
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // return pTabControl->GetPageText(0);
+ //else
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->SetPageText(0, _title);
+
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ //return m_sTooltip;
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)_tooltip;
+}
+::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 1af422bf7f00..0e992156dbe4 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -68,6 +68,8 @@
#include <toolkit/awt/vclxsystemdependentwindow.hxx>
#include <toolkit/awt/vclxregion.hxx>
#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxtabpagecontainer.hxx>
+#include <toolkit/awt/vclxtabpagemodel.hxx>
#include <toolkit/awt/xsimpleanimation.hxx>
#include <toolkit/awt/xthrobber.hxx>
@@ -329,7 +331,9 @@ static ComponentInfo __FAR_DATA aComponentInfos [] =
{ "tristatebox", WINDOW_TRISTATEBOX },
{ "warningbox", WINDOW_WARNINGBOX },
{ "window", WINDOW_WINDOW },
- { "workwindow", WINDOW_WORKWINDOW }
+ { "workwindow", WINDOW_WORKWINDOW },
+ { "tabpagecontainer", WINDOW_CONTROL },
+ { "tabpagemodel", WINDOW_TABPAGE }
};
extern "C"
@@ -863,13 +867,25 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_TABCONTROL:
pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
break;
case WINDOW_TABDIALOG:
pNewWindow = new TabDialog( pParent, nWinBits );
break;
case WINDOW_TABPAGE:
- pNewWindow = new TabPage( pParent, nWinBits );
- *ppNewComp = new VCLXTabPage;
+ /*
+ if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagemodel") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
+ else
+ */
+ {
+ pNewWindow = new TabPage( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPage;
+ }
break;
case WINDOW_TIMEBOX:
pNewWindow = new TimeBox( pParent, nWinBits );
@@ -998,6 +1014,12 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
pNewWindow = new FixedImage( pParent, nWinBits );
*ppNewComp = new ::toolkit::XThrobber;
}
+ else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagecontainer") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
break;
default: DBG_ERRORFILE( "UNO3!" );
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 6c6b9dc4b2c8..69c0071ce0ec 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -37,6 +37,7 @@
#include <toolkit/helper/imagealign.hxx>
#include <toolkit/helper/accessibilityclient.hxx>
#include <toolkit/helper/fixedhyperbase.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/awt/VisualEffect.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -62,6 +63,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
#include <tools/diagnose_ex.h>
#include <boost/bind.hpp>
@@ -2068,34 +2070,32 @@ void VCLXListBox::ImplCallItemListeners()
maItemListeners.itemStateChanged( aEvent );
}
}
-
namespace
{
- Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
- {
- if ( !i_rImageURL.getLength() )
- return Image();
+ Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
+ {
+ if ( !i_rImageURL.getLength() )
+ return Image();
try
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- ::comphelper::NamedValueCollection aMediaProperties;
- aMediaProperties.put( "URL", i_rImageURL );
- Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
return Image( xGraphic );
- }
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return Image();
- }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+ }
}
-
void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -2107,7 +2107,7 @@ void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) thr
"VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
pListBox->InsertEntry(
i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
- i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
i_rEvent.ItemPosition );
}
@@ -2137,7 +2137,7 @@ void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) thr
// VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
- const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
pListBox->RemoveEntry( i_rEvent.ItemPosition );
pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
@@ -2554,6 +2554,15 @@ throw(::com::sun::star::uno::RuntimeException)
}
}
break;
+ case BASEPROPERTY_TITLE:
+ {
+ ::rtl::OUString sTitle;
+ if ( Value >>= sTitle )
+ {
+ pTabPage->SetText(sTitle);
+ }
+ }
+ break;
default:
{
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
new file mode 100644
index 000000000000..58ca81f74541
--- /dev/null
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -0,0 +1,1811 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include "toolkit/controls/formattedcontrol.hxx"
+#include "toolkit/controls/roadmapcontrol.hxx"
+#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
+#include "toolkit/controls/tkscrollbar.hxx"
+#endif
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <tools/list.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <comphelper/types.hxx>
+
+#include <comphelper/componentcontext.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+
+#include "tree/treecontrol.hxx"
+#include "grid/gridcontrol.hxx"
+#include <toolkit/controls/tabpagecontainer.hxx>
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace toolkit;
+
+#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
+
+//HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+struct LanguageDependentProp
+{
+ const char* pPropName;
+ sal_Int32 nPropNameLength;
+};
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
+ {
+ static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ s_aLanguageDependentProperties.realloc( 2 );
+ s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
+ s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ // note: properties must be sorted
+ }
+ }
+ return s_aLanguageDependentProperties;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// functor for disposing a control model
+struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
+{
+ void operator()( Reference< XControlModel >& _rxModel )
+ {
+ try
+ {
+ ::comphelper::disposeComponent( _rxModel );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
+ }
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for searching control model by name
+struct FindControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ const ::rtl::OUString& m_rName;
+
+public:
+ FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
+
+ bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.second == m_rName ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for cloning a control model, and insertion into a target list
+struct CloneControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, void >
+{
+private:
+ ControlModelContainerBase::UnoControlModelHolderList& m_rTargetList;
+
+public:
+ CloneControlModel( ControlModelContainerBase::UnoControlModelHolderList& _rTargetList )
+ :m_rTargetList( _rTargetList )
+ {
+ }
+
+ void operator()( const ControlModelContainerBase::UnoControlModelHolder& _rSource )
+ {
+ // clone the source object
+ Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
+ Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
+ // add to target list
+ m_rTargetList.push_back( ControlModelContainerBase::UnoControlModelHolder( xClone, _rSource.second ) );
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for comparing a XControlModel with a given reference
+struct CompareControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ Reference< XControlModel > m_xReference;
+public:
+ CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
+
+ bool operator()( const ControlModelContainerBase::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+static void lcl_throwIllegalArgumentException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw IllegalArgumentException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwNoSuchElementException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwElementExistException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw ElementExistException();
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getTabIndexPropertyName( )
+{
+ static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
+ return s_sTabIndexProperty;
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getStepPropertyName( )
+{
+ static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
+ return s_sStepProperty;
+}
+
+// ----------------------------------------------------
+// class ControlModelContainerBase
+// ----------------------------------------------------
+ControlModelContainerBase::ControlModelContainerBase()
+ :maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::ControlModelContainerBase( const ControlModelContainerBase& rModel )
+ : ControlModelContainer_IBase( rModel )
+ , maContainerListeners( *this )
+ , maChangeListeners ( GetMutex() )
+ , mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::~ControlModelContainerBase()
+{
+ maModels.clear();
+ mbGroupsUpToDate = sal_False;
+}
+
+Any ControlModelContainerBase::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& ControlModelContainerBase::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+void SAL_CALL ControlModelContainerBase::dispose( ) throw(RuntimeException)
+{
+ // ====================================================================
+ // tell our listeners
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
+
+ maContainerListeners.disposeAndClear( aDisposeEvent );
+ maChangeListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ // ====================================================================
+ // call the base class
+ UnoControlModel::dispose();
+
+ // ====================================================================
+ // dispose our child models
+ // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
+ ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aChildModels.begin(), // target location
+ ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
+ );
+
+ // now dispose
+ ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
+ aChildModels.clear();
+
+ mbGroupsUpToDate = sal_False;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > ControlModelContainerBase::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+UnoControlModel* ControlModelContainerBase::Clone() const
+{
+ // clone the container itself
+ ControlModelContainerBase* pClone = new ControlModelContainerBase( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+ControlModelContainerBase::UnoControlModelHolderList::iterator ControlModelContainerBase::ImplFindElement( const ::rtl::OUString& rName )
+{
+ return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
+}
+
+// ::XMultiServiceFactory
+Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ OGeometryControlModel_Base* pNewModel = NULL;
+
+ if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoTreeModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoGridModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >;
+
+ if ( !pNewModel )
+ {
+ Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
+ if ( xORB.is() )
+ {
+ Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
+ Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
+ Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
+ Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
+ if ( xAgg.is() )
+ {
+ if ( xSI->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" ) ) )
+ {
+ // release 3 of the 4 references we have to the object
+ xAgg.clear();
+ xSI.clear();
+ xObject.clear();
+
+ pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
+ }
+ }
+ }
+ }
+
+ Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
+ return xNewModel;
+}
+
+Reference< XInterface > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
+{
+ return createInstance( ServiceSpecifier );
+}
+
+Sequence< ::rtl::OUString > ControlModelContainerBase::getAvailableServiceNames() throw(RuntimeException)
+{
+ static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
+ if ( !pNamesSeq )
+ {
+ pNamesSeq = new Sequence< ::rtl::OUString >( 23 );
+ ::rtl::OUString* pNames = pNamesSeq->getArray();
+ pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
+ pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
+ pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
+ pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
+ pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
+ pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
+ pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
+ pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
+ pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
+ pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
+ pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
+ pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
+ pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
+ pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
+ pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
+ pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
+ pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
+ pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
+ 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( szServiceName_UnoControlTabPageContainerModel );
+
+ }
+ return *pNamesSeq;
+}
+
+// XContainer
+void ControlModelContainerBase::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void ControlModelContainerBase::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// XElementAcces
+Type ControlModelContainerBase::getElementType() throw(RuntimeException)
+{
+ Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
+ return aType;
+}
+
+sal_Bool ControlModelContainerBase::hasElements() throw(RuntimeException)
+{
+ return !maModels.empty();
+}
+
+// XNameContainer, XNameReplace, XNameAccess
+void ControlModelContainerBase::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xNewModel;
+ aElement >>= xNewModel;
+ if ( !xNewModel.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ // stop listening at the old model
+ stopControlListening( aElementPos->first );
+ Reference< XControlModel > xReplaced( aElementPos->first );
+ // remember the new model, and start listening
+ aElementPos->first = xNewModel;
+ startControlListening( xNewModel );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element = aElement;
+ aEvent.ReplacedElement <<= xReplaced;
+ aEvent.Accessor <<= aName;
+
+ // notify the container listener
+ maContainerListeners.elementReplaced( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+Any ControlModelContainerBase::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ return makeAny( aElementPos->first );
+}
+
+Sequence< ::rtl::OUString > ControlModelContainerBase::getElementNames() throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aNames.getArray(), // target range
+ ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
+ );
+
+ return aNames;
+}
+
+sal_Bool ControlModelContainerBase::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+{
+ return maModels.end() != ImplFindElement( aName );
+}
+
+void ControlModelContainerBase::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xM;
+ aElement >>= xM;
+
+ if ( xM.is() )
+ {
+ Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
+
+ ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
+ if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ) && ImplHasProperty(BASEPROPERTY_DIALOGSOURCEURL) )
+ {
+ Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
+
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
+
+ aUrl <<= absoluteUrl;
+
+ xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
+ }
+ }
+ }
+
+
+
+ if ( !aName.getLength() || !xM.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() != aElementPos )
+ lcl_throwElementExistException();
+
+ maModels.push_back( UnoControlModelHolder( xM, aName ) );
+ mbGroupsUpToDate = sal_False;
+ startControlListening( xM );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementInserted( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+void ControlModelContainerBase::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElementPos->first;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementRemoved( aEvent );
+
+ stopControlListening( aElementPos->first );
+ Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
+ maModels.erase( aElementPos );
+ mbGroupsUpToDate = sal_False;
+
+ if ( xPS.is() )
+ try
+ {
+ xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
+ }
+ catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL ControlModelContainerBase::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setGroupControl( sal_Bool ) throw (RuntimeException)
+{
+ DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // set the tab indexes according to the order of models in the sequence
+ const Reference< XControlModel >* pControls = _rControls.getConstArray( );
+ const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
+
+ sal_Int16 nTabIndex = 1;
+
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ // look up the control in our own structure. This is to prevent invalid arguments
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( *pControls )
+ );
+ if ( maModels.end() != aPos )
+ {
+ // okay, this is an existent model
+ // now set the TabIndex property (if applicable)
+ Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xProps.is() )
+ xPSI = xProps->getPropertySetInfo();
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
+ }
+ mbGroupsUpToDate = sal_False;
+ }
+}
+
+
+typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
+
+// ----------------------------------------------------------------------------
+Sequence< Reference< XControlModel > > SAL_CALL ControlModelContainerBase::getControlModels( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ MapIndexToModel aSortedModels;
+ // will be the sorted container of all models which have a tab index property
+ ::std::vector< Reference< XControlModel > > aUnindexedModels;
+ // will be the container of all models which do not have a tab index property
+
+ UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
+ for ( ; aLoop != maModels.end(); ++aLoop )
+ {
+ Reference< XControlModel > xModel( aLoop->first );
+
+ // see if the model has a TabIndex property
+ Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xControlProps.is() )
+ xPSI = xControlProps->getPropertySetInfo( );
+ DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
+
+ // has it?
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ { // yes
+ sal_Int32 nTabIndex = -1;
+ xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
+
+ aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
+ }
+ else if ( xModel.is() )
+ // no, it hasn't, but we have to include it, anyway
+ aUnindexedModels.push_back( xModel );
+ }
+
+ // okay, here we have a container of all our models, sorted by tab index,
+ // plus a container of "unindexed" models
+ // -> merge them
+ Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
+ ::std::transform(
+ aSortedModels.begin(), aSortedModels.end(),
+ ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
+ ::std::select2nd< MapIndexToModel::value_type >( )
+ );
+
+ return aReturn;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
+{
+ // not supported. We have only implicit grouping:
+ // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
+ // implementation details) that VCL does grouping according to the order of controls automatically
+ // At least VCL does this for all we're interested in: Radio buttons.
+ DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
+}
+
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArguments) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else
+ m_nTabPageId = -1;
+}
+::sal_Int16 SAL_CALL ControlModelContainerBase::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nTabPageId;
+}
+::sal_Bool SAL_CALL ControlModelContainerBase::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_bEnabled;
+}
+void SAL_CALL ControlModelContainerBase::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_bEnabled = _enabled;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ ::rtl::OUString sTitle;
+ xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)) >>= sTitle;
+ return sTitle;
+ //return m_sTitle;
+}
+void SAL_CALL ControlModelContainerBase::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),makeAny(_title));
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sImageURL;
+}
+void SAL_CALL ControlModelContainerBase::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sTooltip;
+}
+void SAL_CALL ControlModelContainerBase::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sTooltip = _tooltip;
+}
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ enum GroupingMachineState
+ {
+ eLookingForGroup,
+ eExpandingGroup
+ };
+
+ // ........................................................................
+ static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
+ {
+ sal_Int32 nStep = 0;
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
+ xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
+ }
+ return nStep;
+ }
+}
+
+// ----------------------------------------------------------------------------
+sal_Int32 SAL_CALL ControlModelContainerBase::getGroupCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ return maGroups.size();
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
+ {
+ DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
+ _rGroup.realloc( 0 );
+ _rName = ::rtl::OUString();
+ }
+ else
+ {
+ AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
+ _rGroup.realloc( aGroupPos->size() );
+ // copy the models
+ ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
+ // give the group a name
+ _rName = ::rtl::OUString::valueOf( _nGroup );
+ }
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ ::rtl::OUString sDummyName;
+ getGroup( _rName.toInt32( ), _rGroup, sDummyName );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.addInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.removeInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
+{
+ // multiplex to our change listeners:
+ // the changes event
+ ChangesEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
+ aEvent.Changes.realloc( 1 ); // exactly one change
+ aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
+
+
+ Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
+ const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
+ const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
+ for ( ; pListener != pListenerEnd; ++pListener )
+ {
+ if ( pListener->is() )
+ static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::implUpdateGroupStructure()
+{
+ if ( mbGroupsUpToDate )
+ // nothing to do
+ return;
+
+ // conditions for a group:
+ // * all elements of the group are radio buttons
+ // * all elements of the group are on the same dialog page
+ // * in the overall control order (determined by the tab index), all elements are subsequent
+
+ maGroups.clear();
+
+ Sequence< Reference< XControlModel > > aControlModels = getControlModels();
+ const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
+ const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
+
+ // in extreme we have as much groups as controls
+ maGroups.reserve( aControlModels.getLength() );
+
+ GroupingMachineState eState = eLookingForGroup; // the current state of our machine
+ Reference< XServiceInfo > xModelSI; // for checking for a radion button
+ AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
+ sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
+ sal_Bool bIsRadioButton; // is it a radio button?
+
+#if OSL_DEBUG_LEVEL > 1
+ ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
+#endif
+
+ for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
+ {
+ // we'll need this in every state
+ xModelSI = xModelSI.query( *pControlModels );
+ bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
+
+ switch ( eState )
+ {
+ case eLookingForGroup:
+ {
+ if ( !bIsRadioButton )
+ // this is no radio button -> still looking for the beginning of a group
+ continue;
+ // the current model is a radio button
+ // -> we found the beginning of a new group
+ // create the place for this group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ // get the step which all controls of this group now have to belong to
+ nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
+ // new state: looking for further members
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+
+ case eExpandingGroup:
+ {
+ if ( !bIsRadioButton )
+ { // no radio button -> the group is done
+ aCurrentGroup = maGroups.end();
+ eState = eLookingForGroup;
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+ continue;
+ }
+
+ // it is a radio button - is it on the proper page?
+ const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
+ if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
+ || ( 0 == nThisModelStep ) // the current button appears on all pages
+ )
+ {
+ // -> it belongs to the same group
+ aCurrentGroup->push_back( *pControlModels );
+ // state still is eExpandingGroup - we're looking for further elements
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ continue;
+ }
+
+ // it's a radio button, but on a different page
+ // -> we open a new group for it
+
+ // close the old group
+ aCurrentGroup = maGroups.end();
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+
+ // open a new group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ nCurrentGroupStep = nThisModelStep;
+
+ // state is the same: we still are looking for further elements of the current group
+ eState = eExpandingGroup;
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+ }
+ }
+
+ mbGroupsUpToDate = sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
+ "UnoControlDialogModel::propertyChange: not listening for this property!" );
+
+ // the accessor for the changed element
+ ::rtl::OUString sAccessor;
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
+ );
+ OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
+ if ( maModels.end() != aPos )
+ sAccessor = aPos->second;
+
+ // our groups are not up-to-date
+ mbGroupsUpToDate = sal_False;
+
+ // notify
+ implNotifyTabModelChange( sAccessor );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::startControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::stopControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ============================================================================
+// = class ResourceListener
+// ============================================================================
+
+ResourceListener::ResourceListener(
+ const Reference< util::XModifyListener >& rListener ) :
+ OWeakObject(),
+ m_xListener( rListener ),
+ m_bListening( false )
+{
+}
+
+ResourceListener::~ResourceListener()
+{
+}
+
+// XInterface
+Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
+throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface(
+ rType ,
+ static_cast< XModifyListener* >( this ),
+ static_cast< XEventListener* >( this ));
+
+ if ( a.hasValue() )
+ return a;
+
+ return OWeakObject::queryInterface( rType );
+}
+
+void SAL_CALL ResourceListener::acquire() throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL ResourceListener::release() throw ()
+{
+ OWeakObject::release();
+}
+
+void ResourceListener::startListening(
+ const Reference< resource::XStringResourceResolver >& rResource )
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
+
+ {
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ bool bListening( m_bListening );
+ bool bResourceSet( m_xResource.is() );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( bListening && bResourceSet )
+ stopListening();
+
+ // --- SAFE ---
+ aGuard.reset();
+ m_xResource = rResource;
+ aGuard.clear();
+ // --- SAFE ---
+ }
+
+ Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->addModifyListener( xThis );
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ m_bListening = true;
+ // --- SAFE ---
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+void ResourceListener::stopListening()
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ if ( m_bListening && m_xResource.is() )
+ xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XModifyListener
+void SAL_CALL ResourceListener::modified(
+ const lang::EventObject& aEvent )
+throw ( RuntimeException )
+{
+ Reference< util::XModifyListener > xListener;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ xListener = m_xListener;
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->modified( aEvent );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XEventListener
+void SAL_CALL ResourceListener::disposing(
+ const EventObject& Source )
+throw ( RuntimeException )
+{
+ Reference< lang::XEventListener > xListener;
+ Reference< resource::XStringResourceResolver > xResource;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
+ Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( Source.Source == xIfacRes )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xResource = m_xResource;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->disposing( Source );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+ else if ( Source.Source == xIfacList )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ xResource = m_xResource;
+ m_xResource.clear();
+ m_xListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ // Remove ourself as listener from resource resolver
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+}
+
+//===============================================================
+// ----------------------------------------------------
+// class DialogContainerControl
+// ----------------------------------------------------
+ControlContainerBase::ControlContainerBase() :
+ mbSizeModified(false),
+ mbPosModified(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+}
+
+ControlContainerBase::~ControlContainerBase()
+{
+}
+
+void ControlContainerBase::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+}
+
+void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ ::rtl::OUString aDefCtrl;
+ xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
+ 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@openoffice.org
+
+ ImplSetPosSize( xCtrl );
+ }
+}
+
+void ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxModel )
+{
+ Sequence< Reference< XControl > > aControls = getControls();
+ Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+ if ( xCtrl.is() )
+ removeControl( xCtrl );
+}
+
+void ControlContainerBase::ImplSetPosSize( Reference< XControl >& rxCtrl )
+{
+ 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;
+ MapMode aMode( MAP_APPFONT );
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
+ {
+ ::Size aTmp( nX, nY );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ nX = aTmp.Width();
+ nY = aTmp.Height();
+ aTmp = ::Size( nWidth, nHeight );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ 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 ControlContainerBase::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ // Notify our listener helper about dispose
+ // --- SAFE ---
+ ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XEventListener > xListener( mxListener, UNO_QUERY );
+ mxListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ xListener->disposing( aEvt );
+ UnoControlContainer::dispose();
+}
+
+void SAL_CALL ControlContainerBase::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ UnoControlContainer::disposing( Source );
+}
+
+sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // destroy the old tab controller, if existent
+ if ( mxTabController.is() )
+ {
+ 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@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() )
+ {
+ 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 ControlContainerBase::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControl::setDesignMode( bOn );
+
+ 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 );
+
+ // #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 ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+}
+
+void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+// XPropertiesChangeListener
+void ControlContainerBase::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ if( !isDesignMode() && !mbCreatingCompatiblePeer )
+ {
+ ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
+ ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
+ ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( ( rEvt.PropertyName == s1 ) ||
+ ( rEvt.PropertyName == s2 ) ||
+ ( rEvt.PropertyName == s3 ) ||
+ ( rEvt.PropertyName == s4 ) )
+ {
+ if ( bOwnModel )
+ {
+ if ( !mbPosModified && !mbSizeModified )
+ {
+ // Don't set new pos/size if we get new values from window listener
+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
+ ImplSetPosSize( xThis );
+ }
+ }
+ else
+ {
+ Sequence<Reference<XControl> > aControlSequence(getControls());
+ Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
+ ImplSetPosSize( aControlRef );
+ }
+ break;
+ }
+ }
+ }
+
+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+}
+
+void ControlContainerBase::addingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::addingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Sequence< ::rtl::OUString > aNames( 4 );
+ ::rtl::OUString* pNames = aNames.getArray();
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
+
+ xProps->addPropertiesChangeListener( aNames, this );
+ }
+ }
+}
+
+void ControlContainerBase::removingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::removingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->removePropertiesChangeListener( this );
+ }
+
+}
+
+void SAL_CALL ControlContainerBase::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // 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();
+}
+void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+
+ Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
+
+ Sequence< rtl::OUString > aPropNames(1);
+ aPropNames[0] = aPropName;
+
+ const Sequence< Reference< awt::XControl > > aSeq = xContainer->getControls();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ Reference< XControl > xControl( aSeq[i] );
+ Reference< XPropertySet > xPropertySet;
+
+ if ( xControl.is() )
+ xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
+
+ if ( !xPropertySet.is() )
+ continue;
+
+ try
+ {
+ Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
+ Any aOldValue = xPropertySet->getPropertyValue( aPropName );
+ if ( ( aOldValue >>= xCurrStringResourceResolver )
+ && ( xStringResourceResolver == xCurrStringResourceResolver )
+ )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
+ }
+ else
+ xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
+ }
+ /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
+ catch ( const Exception& )
+ {
+ }
+
+ uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
+ if ( xNestedContainer.is() )
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
+
+ }
+
+}
+void ControlContainerBase::ImplStartListingForResourceEvents()
+{
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
+
+ // Add our helper as listener to retrieve notifications about changes
+ Reference< util::XModifyListener > rListener( mxListener );
+ ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
+
+ // resource listener will stop listening if resolver reference is empty
+ if ( pResourceListener )
+ pResourceListener->startListening( xStringResourceResolver );
+ ImplUpdateResourceResolver();
+}
+
+void ControlContainerBase::ImplUpdateResourceResolver()
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ if ( !xStringResourceResolver.is() )
+ return;
+
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
+
+ // propagate resource resolver changes to language dependent props of the dialog
+ Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
+ if ( xPropertySet.is() )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
+ }
+}
+
+
+uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
+{
+ uno::Reference< graphic::XGraphic > xGraphic;
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ uno::Sequence< beans::PropertyValue > aMediaProperties(1);
+ aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMediaProperties[0].Value <<= _rURL;
+ xGraphic = xProvider->queryGraphic( aMediaProperties );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xGraphic;
+}
+//// ----------------------------------------------------
+//// Helper Method to convert relative url to physical location
+//// ----------------------------------------------------
+
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+{
+
+ ::rtl::OUString baseLocation;
+ ::rtl::OUString url;
+
+ rbase >>= baseLocation;
+ rUrl >>= url;
+
+ ::rtl::OUString absoluteURL( url );
+ if ( url.getLength() > 0 )
+ {
+ INetURLObject urlObj(baseLocation);
+ urlObj.removeSegment();
+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+
+ 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;
+}
+
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index ecb4d7765723..7a7f7444645b 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -35,17 +35,7 @@
#include <toolkit/controls/dialogcontrol.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
-#include <toolkit/controls/geometrycontrolmodel.hxx>
-#include <toolkit/controls/unocontrols.hxx>
-#include "toolkit/controls/formattedcontrol.hxx"
-#include "toolkit/controls/roadmapcontrol.hxx"
-#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
-#include "toolkit/controls/tkscrollbar.hxx"
-#endif
#include <toolkit/controls/stdtabcontroller.hxx>
-#include <toolkit/controls/tksimpleanimation.hxx>
-#include <toolkit/controls/tkthrobber.hxx>
-
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/WindowAttribute.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
@@ -54,20 +44,14 @@
#include <cppuhelper/typeprovider.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
-#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
-#include <comphelper/types.hxx>
-#include <comphelper/componentcontext.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/graph.hxx>
#include <vcl/image.hxx>
-
-#include "tree/treecontrol.hxx"
-#include "grid/gridcontrol.hxx"
-
#include <map>
#include <algorithm>
#include <functional>
@@ -81,180 +65,18 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
-using namespace toolkit;
-#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
#define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ))
#define PROPERTY_IMAGEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ))
#define PROPERTY_GRAPHIC ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ))
-
-//HELPER
+//
+////HELPER
::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-// ----------------------------------------------------------------------------
-namespace
-{
- static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
- {
- static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- s_aLanguageDependentProperties.realloc( 2 );
- s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
- s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
- // note: properties must be sorted
- }
- }
- return s_aLanguageDependentProperties;
- }
-
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
- if ( !_rURL.getLength() )
- return xGraphic;
-
- try
- {
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
- }
-
-}
-
-// ----------------------------------------------------------------------------
-// functor for disposing a control model
-struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
-{
- void operator()( Reference< XControlModel >& _rxModel )
- {
- try
- {
- ::comphelper::disposeComponent( _rxModel );
- }
- catch( const Exception& )
- {
- DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
- }
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for searching control model by name
-struct FindControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
-{
-private:
- const ::rtl::OUString& m_rName;
-
-public:
- FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
-
- bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.second == m_rName ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for cloning a control model, and insertion into a target list
-struct CloneControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, void >
-{
-private:
- UnoControlDialogModel::UnoControlModelHolderList& m_rTargetList;
-
-public:
- CloneControlModel( UnoControlDialogModel::UnoControlModelHolderList& _rTargetList )
- :m_rTargetList( _rTargetList )
- {
- }
-
- void operator()( const UnoControlDialogModel::UnoControlModelHolder& _rSource )
- {
- // clone the source object
- Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
- Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
- // add to target list
- m_rTargetList.push_back( UnoControlDialogModel::UnoControlModelHolder( xClone, _rSource.second ) );
- }
-};
-
-// ----------------------------------------------------------------------------
-// functor for comparing a XControlModel with a given reference
-struct CompareControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
-{
-private:
- Reference< XControlModel > m_xReference;
-public:
- CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
-
- bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
- {
- return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
- }
-};
-
-// ----------------------------------------------------------------------------
-static void lcl_throwIllegalArgumentException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw IllegalArgumentException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwNoSuchElementException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw NoSuchElementException();
-}
-
-// ----------------------------------------------------------------------------
-static void lcl_throwElementExistException( )
-{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
- throw ElementExistException();
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getTabIndexPropertyName( )
-{
- static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
- return s_sTabIndexProperty;
-}
-
-// ----------------------------------------------------------------------------
-static const ::rtl::OUString& getStepPropertyName( )
-{
- static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
- return s_sStepProperty;
-}
-
// ----------------------------------------------------
// class UnoControlDialogModel
// ----------------------------------------------------
UnoControlDialogModel::UnoControlDialogModel()
- :maContainerListeners( *this )
- ,maChangeListeners ( GetMutex() )
- ,mbGroupsUpToDate( sal_False )
{
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
// ImplRegisterProperty( BASEPROPERTY_BORDER );
@@ -279,35 +101,14 @@ UnoControlDialogModel::UnoControlDialogModel()
}
UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
- : UnoControlDialogModel_IBase( rModel )
- , UnoControlDialogModel_Base( rModel )
- , maContainerListeners( *this )
- , maChangeListeners ( GetMutex() )
- , mbGroupsUpToDate( sal_False )
+ : ControlModelContainerBase( rModel )
{
}
UnoControlDialogModel::~UnoControlDialogModel()
{
- maModels.clear();
- mbGroupsUpToDate = sal_False;
}
-Any UnoControlDialogModel::queryAggregation( const Type & rType ) throw(RuntimeException)
-{
- Any aRet( UnoControlDialogModel_IBase::queryInterface( rType ) );
- return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
-}
-
-// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
-Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
-{
- return ::comphelper::concatSequences(
- UnoControlDialogModel_IBase::getTypes(),
- UnoControlDialogModel_Base::getTypes()
- );
-}
::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
{
@@ -341,42 +142,6 @@ Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return *pHelper;
}
-void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException)
-{
- // ====================================================================
- // tell our listeners
- {
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- EventObject aDisposeEvent;
- aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
-
- maContainerListeners.disposeAndClear( aDisposeEvent );
- maChangeListeners.disposeAndClear( aDisposeEvent );
- }
-
- // ====================================================================
- // call the base class
- UnoControlModel::dispose();
-
- // ====================================================================
- // dispose our child models
- // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
- ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aChildModels.begin(), // target location
- ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
- );
-
- // now dispose
- ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
- aChildModels.clear();
-
- mbGroupsUpToDate = sal_False;
-}
-
// XMultiPropertySet
Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
{
@@ -384,961 +149,20 @@ Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) thro
return xInfo;
}
-UnoControlModel* UnoControlDialogModel::Clone() const
-{
- // clone the container itself
- UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
-
- // clone all children
- ::std::for_each(
- maModels.begin(), maModels.end(),
- CloneControlModel( pClone->maModels )
- );
-
- return pClone;
-}
-
-UnoControlDialogModel::UnoControlModelHolderList::iterator UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName )
-{
- return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
-}
-
-// ::XMultiServiceFactory
-Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- OGeometryControlModel_Base* pNewModel = NULL;
-
- if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlEditModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoTreeModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoGridModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >;
- else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 )
- pNewModel = new OGeometryControlModel< UnoThrobberControlModel >;
-
- if ( !pNewModel )
- {
- Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
- if ( xORB.is() )
- {
- Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
- Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
- Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
- Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
- if ( xAgg.is() )
- {
- if ( xSI->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" ) ) )
- {
- // release 3 of the 4 references we have to the object
- xAgg.clear();
- xSI.clear();
- xObject.clear();
-
- pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
- }
- }
- }
- }
-
- Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
- return xNewModel;
-}
-
-Reference< XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
-{
- return createInstance( ServiceSpecifier );
-}
-
-Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(RuntimeException)
-{
- static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
- if ( !pNamesSeq )
- {
- pNamesSeq = new Sequence< ::rtl::OUString >( 24 );
- ::rtl::OUString* pNames = pNamesSeq->getArray();
- pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
- pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
- pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
- pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
- pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
- pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
- pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
- pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
- pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
- pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
- pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
- pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
- pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
- pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
- pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
- pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
- pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
- pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
- 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 );
- }
- return *pNamesSeq;
-}
-
-// XContainer
-void UnoControlDialogModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.addInterface( l );
-}
-
-void UnoControlDialogModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
-{
- maContainerListeners.removeInterface( l );
-}
-
-// XElementAcces
-Type UnoControlDialogModel::getElementType() throw(RuntimeException)
-{
- Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
- return aType;
-}
-
-sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
-{
- return !maModels.empty();
-}
-
-// XNameContainer, XNameReplace, XNameAccess
-void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xNewModel;
- aElement >>= xNewModel;
- if ( !xNewModel.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- // stop listening at the old model
- stopControlListening( aElementPos->first );
- Reference< XControlModel > xReplaced( aElementPos->first );
- // remember the new model, and start listening
- aElementPos->first = xNewModel;
- startControlListening( xNewModel );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element = aElement;
- aEvent.ReplacedElement <<= xReplaced;
- aEvent.Accessor <<= aName;
-
- // notify the container listener
- maContainerListeners.elementReplaced( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-Any UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- return makeAny( aElementPos->first );
-}
-
-Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aNames( maModels.size() );
-
- ::std::transform(
- maModels.begin(), maModels.end(), // source range
- aNames.getArray(), // target range
- ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
- );
-
- return aNames;
-}
-
-sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
-{
- return maModels.end() != ImplFindElement( aName );
-}
-
-void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xM;
- aElement >>= xM;
-
- if ( xM.is() )
- {
- Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
- if ( xProps.is() )
- {
-
- Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
-
- ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
- if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
- {
- Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
-
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
-
- aUrl <<= absoluteUrl;
-
- xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
- }
- }
- }
-
-
-
- if ( !aName.getLength() || !xM.is() )
- lcl_throwIllegalArgumentException();
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() != aElementPos )
- lcl_throwElementExistException();
-
- maModels.push_back( UnoControlModelHolder( xM, aName ) );
- mbGroupsUpToDate = sal_False;
- startControlListening( xM );
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElement;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementInserted( aEvent );
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
- if ( maModels.end() == aElementPos )
- lcl_throwNoSuchElementException();
-
- ContainerEvent aEvent;
- aEvent.Source = *this;
- aEvent.Element <<= aElementPos->first;
- aEvent.Accessor <<= aName;
- maContainerListeners.elementRemoved( aEvent );
-
- stopControlListening( aElementPos->first );
- Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
- maModels.erase( aElementPos );
- mbGroupsUpToDate = sal_False;
-
- if ( xPS.is() )
- try
- {
- xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
- }
- catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
-
- // our "tab controller model" has potentially changed -> notify this
- implNotifyTabModelChange( aName );
-}
-
-// ----------------------------------------------------------------------------
-sal_Bool SAL_CALL UnoControlDialogModel::getGroupControl( ) throw (RuntimeException)
-{
- return sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setGroupControl( sal_Bool ) throw (RuntimeException)
-{
- DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- // set the tab indexes according to the order of models in the sequence
- const Reference< XControlModel >* pControls = _rControls.getConstArray( );
- const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
-
- sal_Int16 nTabIndex = 1;
-
- for ( ; pControls != pControlsEnd; ++pControls )
- {
- // look up the control in our own structure. This is to prevent invalid arguments
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( *pControls )
- );
- if ( maModels.end() != aPos )
- {
- // okay, this is an existent model
- // now set the TabIndex property (if applicable)
- Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xProps.is() )
- xPSI = xProps->getPropertySetInfo();
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
- }
- mbGroupsUpToDate = sal_False;
- }
-}
-
-
-typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
-
-// ----------------------------------------------------------------------------
-Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getControlModels( ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- MapIndexToModel aSortedModels;
- // will be the sorted container of all models which have a tab index property
- ::std::vector< Reference< XControlModel > > aUnindexedModels;
- // will be the container of all models which do not have a tab index property
-
- UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
- for ( ; aLoop != maModels.end(); ++aLoop )
- {
- Reference< XControlModel > xModel( aLoop->first );
-
- // see if the model has a TabIndex property
- Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xControlProps.is() )
- xPSI = xControlProps->getPropertySetInfo( );
- DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
-
- // has it?
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- { // yes
- sal_Int32 nTabIndex = -1;
- xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
-
- aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
- }
- else if ( xModel.is() )
- // no, it hasn't, but we have to include it, anyway
- aUnindexedModels.push_back( xModel );
- }
-
- // okay, here we have a container of all our models, sorted by tab index,
- // plus a container of "unindexed" models
- // -> merge them
- Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
- ::std::transform(
- aSortedModels.begin(), aSortedModels.end(),
- ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
- ::std::select2nd< MapIndexToModel::value_type >( )
- );
-
- return aReturn;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
-{
- // not supported. We have only implicit grouping:
- // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
- // implementation details) that VCL does grouping according to the order of controls automatically
- // At least VCL does this for all we're interested in: Radio buttons.
- DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
-}
-
-// ----------------------------------------------------------------------------
-namespace
-{
- enum GroupingMachineState
- {
- eLookingForGroup,
- eExpandingGroup
- };
-
- // ........................................................................
- static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
- {
- sal_Int32 nStep = 0;
- try
- {
- Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
- xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
- }
- catch( const Exception& )
- {
- DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
- }
- return nStep;
- }
-}
-
-// ----------------------------------------------------------------------------
-sal_Int32 SAL_CALL UnoControlDialogModel::getGroupCount( ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- implUpdateGroupStructure();
-
- return maGroups.size();
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- implUpdateGroupStructure();
-
- if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
- {
- DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
- _rGroup.realloc( 0 );
- _rName = ::rtl::OUString();
- }
- else
- {
- AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
- _rGroup.realloc( aGroupPos->size() );
- // copy the models
- ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
- // give the group a name
- _rName = ::rtl::OUString::valueOf( _nGroup );
- }
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- ::rtl::OUString sDummyName;
- getGroup( _rName.toInt32( ), _rGroup, sDummyName );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.addInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
-{
- maChangeListeners.removeInterface( _rxListener );
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
-{
- // multiplex to our change listeners:
- // the changes event
- ChangesEvent aEvent;
- aEvent.Source = *this;
- aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
- aEvent.Changes.realloc( 1 ); // exactly one change
- aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
-
-
- Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
- const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
- const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
- for ( ; pListener != pListenerEnd; ++pListener )
- {
- if ( pListener->is() )
- static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
- }
-}
-
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::implUpdateGroupStructure()
-{
- if ( mbGroupsUpToDate )
- // nothing to do
- return;
-
- // conditions for a group:
- // * all elements of the group are radio buttons
- // * all elements of the group are on the same dialog page
- // * in the overall control order (determined by the tab index), all elements are subsequent
-
- maGroups.clear();
-
- Sequence< Reference< XControlModel > > aControlModels = getControlModels();
- const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
- const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
-
- // in extreme we have as much groups as controls
- maGroups.reserve( aControlModels.getLength() );
-
- GroupingMachineState eState = eLookingForGroup; // the current state of our machine
- Reference< XServiceInfo > xModelSI; // for checking for a radion button
- AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
- sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
- sal_Bool bIsRadioButton; // is it a radio button?
-
-#if OSL_DEBUG_LEVEL > 1
- ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
-#endif
-
- for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
- {
- // we'll need this in every state
- xModelSI = xModelSI.query( *pControlModels );
- bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
-
- switch ( eState )
- {
- case eLookingForGroup:
- {
- if ( !bIsRadioButton )
- // this is no radio button -> still looking for the beginning of a group
- continue;
- // the current model is a radio button
- // -> we found the beginning of a new group
- // create the place for this group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- // get the step which all controls of this group now have to belong to
- nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
- // new state: looking for further members
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
-
- case eExpandingGroup:
- {
- if ( !bIsRadioButton )
- { // no radio button -> the group is done
- aCurrentGroup = maGroups.end();
- eState = eLookingForGroup;
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
- continue;
- }
-
- // it is a radio button - is it on the proper page?
- const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
- if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
- || ( 0 == nThisModelStep ) // the current button appears on all pages
- )
- {
- // -> it belongs to the same group
- aCurrentGroup->push_back( *pControlModels );
- // state still is eExpandingGroup - we're looking for further elements
- eState = eExpandingGroup;
-
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- continue;
- }
-
- // it's a radio button, but on a different page
- // -> we open a new group for it
-
- // close the old group
- aCurrentGroup = maGroups.end();
-#if OSL_DEBUG_LEVEL > 1
- aCurrentGroupLabels.clear();
-#endif
-
- // open a new group
- size_t nGroups = maGroups.size();
- maGroups.resize( nGroups + 1 );
- aCurrentGroup = maGroups.begin() + nGroups;
- // and add the (only, til now) member
- aCurrentGroup->push_back( *pControlModels );
-
- nCurrentGroupStep = nThisModelStep;
-
- // state is the same: we still are looking for further elements of the current group
- eState = eExpandingGroup;
-#if OSL_DEBUG_LEVEL > 1
- Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
- ::rtl::OUString sLabel;
- if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
- xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
- aCurrentGroupLabels.push_back( sLabel );
-#endif
- }
- break;
- }
- }
-
- mbGroupsUpToDate = sal_True;
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
- "UnoControlDialogModel::propertyChange: not listening for this property!" );
-
- // the accessor for the changed element
- ::rtl::OUString sAccessor;
- UnoControlModelHolderList::const_iterator aPos =
- ::std::find_if(
- maModels.begin(), maModels.end(),
- CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
- );
- OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
- if ( maModels.end() != aPos )
- sAccessor = aPos->second;
-
- // our groups are not up-to-date
- mbGroupsUpToDate = sal_False;
-
- // notify
- implNotifyTabModelChange( sAccessor );
-}
-
-// ----------------------------------------------------------------------------
-void SAL_CALL UnoControlDialogModel::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
-{
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::startControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ----------------------------------------------------------------------------
-void UnoControlDialogModel::stopControlListening( const Reference< XControlModel >& _rxChildModel )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
- Reference< XPropertySetInfo > xPSI;
- if ( xModelProps.is() )
- xPSI = xModelProps->getPropertySetInfo();
-
- if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
- xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
-}
-
-// ============================================================================
-// = class ResourceListener
-// ============================================================================
-
-ResourceListener::ResourceListener(
- const Reference< util::XModifyListener >& rListener ) :
- OWeakObject(),
- m_xListener( rListener ),
- m_bListening( false )
-{
-}
-
-ResourceListener::~ResourceListener()
-{
-}
-
-// XInterface
-Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
-throw ( RuntimeException )
-{
- Any a = ::cppu::queryInterface(
- rType ,
- static_cast< XModifyListener* >( this ),
- static_cast< XEventListener* >( this ));
-
- if ( a.hasValue() )
- return a;
-
- return OWeakObject::queryInterface( rType );
-}
-
-void SAL_CALL ResourceListener::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-void SAL_CALL ResourceListener::release() throw ()
-{
- OWeakObject::release();
-}
-
-void ResourceListener::startListening(
- const Reference< resource::XStringResourceResolver >& rResource )
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
-
- {
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- bool bListening( m_bListening );
- bool bResourceSet( m_xResource.is() );
- aGuard.clear();
- // --- SAFE ---
-
- if ( bListening && bResourceSet )
- stopListening();
-
- // --- SAFE ---
- aGuard.reset();
- m_xResource = rResource;
- aGuard.clear();
- // --- SAFE ---
- }
-
- Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->addModifyListener( xThis );
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- m_bListening = true;
- // --- SAFE ---
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-void ResourceListener::stopListening()
-{
- Reference< util::XModifyBroadcaster > xModifyBroadcaster;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- if ( m_bListening && m_xResource.is() )
- xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-// XModifyListener
-void SAL_CALL ResourceListener::modified(
- const lang::EventObject& aEvent )
-throw ( RuntimeException )
-{
- Reference< util::XModifyListener > xListener;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- xListener = m_xListener;
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->modified( aEvent );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
-}
-
-// XEventListener
-void SAL_CALL ResourceListener::disposing(
- const EventObject& Source )
-throw ( RuntimeException )
-{
- Reference< lang::XEventListener > xListener;
- Reference< resource::XStringResourceResolver > xResource;
-
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
- Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
- aGuard.clear();
- // --- SAFE ---
-
- if ( Source.Source == xIfacRes )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xResource = m_xResource;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- {
- try
- {
- xListener->disposing( Source );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
- }
- else if ( Source.Source == xIfacList )
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
- xResource = m_xResource;
- m_xResource.clear();
- m_xListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- // Remove ourself as listener from resource resolver
- Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
- Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- {
- try
- {
- xModifyBroadcaster->removeModifyListener( xThis );
- }
- catch ( RuntimeException& )
- {
- throw;
- }
- catch ( Exception& )
- {
- }
- }
- }
-}
-
// ============================================================================
// = class UnoDialogControl
// ============================================================================
UnoDialogControl::UnoDialogControl() :
maTopWindowListeners( *this ),
- mbWindowListener(false),
- mbSizeModified(false),
- mbPosModified(false)
+ mbWindowListener(false)
{
maComponentInfos.nWidth = 300;
maComponentInfos.nHeight = 450;
- mxListener = new ResourceListener( Reference< util::XModifyListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
+ }
+
+UnoDialogControl::~UnoDialogControl()
+{
}
::rtl::OUString UnoDialogControl::GetComponentServiceName()
@@ -1355,120 +179,20 @@ UnoDialogControl::UnoDialogControl() :
// XInterface
Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
{
- Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
- return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
-}
-
-// XTypeProvider
-IMPL_IMPLEMENTATION_ID( UnoDialogControl )
-Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
-{
- return ::comphelper::concatSequences(
- UnoDialogControl_IBase::getTypes(),
- UnoControlContainer::getTypes()
- );
-}
-
-void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
-{
- Reference< XPropertySet > xP( rxModel, UNO_QUERY );
-
- ::rtl::OUString aDefCtrl;
- xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
-
- // Add our own resource resolver to a newly created control
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
-
- Any aAny;
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
-
- aAny <<= xStringResourceResolver;
- xP->setPropertyValue( aPropName, aAny );
-
- Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
-
- 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@openoffice.org
-
- ImplSetPosSize( xCtrl );
- }
-}
-
-void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
-{
- Sequence< Reference< XControl > > aControls = getControls();
- Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
- if ( xCtrl.is() )
- removeControl( xCtrl );
-}
-
-void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
-{
- 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 );
-}
+ 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 : ControlContainerBase::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 ),
+ ControlContainerBase::getTypes()
+IMPL_XTYPEPROVIDER_END
void UnoDialogControl::dispose() throw(RuntimeException)
{
@@ -1477,139 +201,25 @@ void UnoDialogControl::dispose() throw(RuntimeException)
EventObject aEvt;
aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
maTopWindowListeners.disposeAndClear( aEvt );
-
- // Notify our listener helper about dispose
- // --- SAFE ---
- ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
- Reference< XEventListener > xListener( mxListener, UNO_QUERY );
- mxListener.clear();
- aGuard.clear();
- // --- SAFE ---
-
- if ( xListener.is() )
- xListener->disposing( aEvt );
-
- UnoControlContainer::dispose();
+ ControlContainerBase::dispose();
}
void SAL_CALL UnoDialogControl::disposing(
const EventObject& Source )
throw(RuntimeException)
{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
-
- if ( Source.Source == xIfac )
- {
- Any aAny;
-
- // Reset resource resolver reference
- ImplSetPropertyValue( aPropName, aAny, sal_True );
- ImplUpdateResourceResolver();
- }
- else
- {
- UnoControlContainer::disposing( Source );
- }
+ ControlContainerBase::disposing( Source );
}
sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
{
+ // #Can we move all the Resource stuff to the ControlContainerBase ?
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- // destroy the old tab controller, if existent
- if ( mxTabController.is() )
- {
- 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@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() )
- {
- 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 );
- }
+ sal_Bool bRet = ControlContainerBase::setModel( rxModel );
ImplStartListingForResourceEvents();
-
return bRet;
}
-void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- UnoControl::setDesignMode( bOn );
-
- 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 );
-
- // #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)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -1657,48 +267,11 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
ImplGetPropertyValue( PROPERTY_IMAGEURL ));
- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
+ xGraphic = ControlContainerBase::Impl_getGraphicFromURL_nothrow( absoluteUrl );
ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
}
}
-void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- ::rtl::OUString aName;
-
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
-void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- Event.Element >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-}
-
-void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
-
- Reference< XControlModel > xModel;
- Event.ReplacedElement >>= xModel;
- if ( xModel.is() )
- ImplRemoveControl( xModel );
-
- ::rtl::OUString aName;
- Event.Accessor >>= aName;
- Event.Element >>= xModel;
- ImplInsertControl( xModel, aName );
-}
-
void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
{
maTopWindowListeners.addInterface( rxListener );
@@ -1752,13 +325,11 @@ void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) thro
xTW->setMenuBar( mxMenuBar );
}
}
-
static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
{
::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
return aTmp;
}
-
// ::com::sun::star::awt::XWindowListener
void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
throw (::com::sun::star::uno::RuntimeException)
@@ -1837,166 +408,6 @@ throw (::com::sun::star::uno::RuntimeException)
(void)e;
}
-// XPropertiesChangeListener
-void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
-{
- if( !isDesignMode() && !mbCreatingCompatiblePeer )
- {
- ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
- ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
- ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
- ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( ( rEvt.PropertyName == s1 ) ||
- ( rEvt.PropertyName == s2 ) ||
- ( rEvt.PropertyName == s3 ) ||
- ( rEvt.PropertyName == s4 ) )
- {
- if ( bOwnModel )
- {
- if ( !mbPosModified && !mbSizeModified )
- {
- // Don't set new pos/size if we get new values from window listener
- Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
- ImplSetPosSize( xThis );
- }
- }
- else
- {
- Sequence<Reference<XControl> > aControlSequence(getControls());
- Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
- ImplSetPosSize( aControlRef );
- }
- break;
- }
- else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
- {
- ImplStartListingForResourceEvents();
- }
- }
- }
-
- sal_Int32 nLen = rEvents.getLength();
- for( sal_Int32 i = 0; i < nLen; i++ )
- {
- const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
- Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
- sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
- if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
- {
- ::rtl::OUString aImageURL;
- Reference< graphic::XGraphic > xGraphic;
- if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
- ( aImageURL.getLength() > 0 ))
- {
- ::rtl::OUString absoluteUrl =
- getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
- ImplGetPropertyValue( PROPERTY_IMAGEURL ));
-
- xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
- }
-
- ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
- break;
- }
- }
-
- UnoControlContainer::ImplModelPropertiesChanged( rEvents );
-}
-
-void UnoDialogControl::ImplStartListingForResourceEvents()
-{
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
-
- // Add our helper as listener to retrieve notifications about changes
- Reference< util::XModifyListener > rListener( mxListener );
- ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
-
- // resource listener will stop listening if resolver reference is empty
- if ( pResourceListener )
- pResourceListener->startListening( xStringResourceResolver );
- ImplUpdateResourceResolver();
-}
-
-void UnoDialogControl::ImplUpdateResourceResolver()
-{
- rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
-
- ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
- if ( !xStringResourceResolver.is() )
- return;
-
- Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
-
- Sequence< rtl::OUString > aPropNames(1);
- aPropNames[0] = aPropName;
-
- const Sequence< Reference< awt::XControl > > aSeq = getControls();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
- {
- Reference< XControl > xControl( aSeq[i] );
- Reference< XPropertySet > xPropertySet;
-
- if ( xControl.is() )
- xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
-
- if ( !xPropertySet.is() )
- continue;
-
- try
- {
- Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
- Any aOldValue = xPropertySet->getPropertyValue( aPropName );
- if ( ( aOldValue >>= xCurrStringResourceResolver )
- && ( xStringResourceResolver == xCurrStringResourceResolver )
- )
- {
- Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
- Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
- xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
- }
- else
- xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
- }
- /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
- catch ( const Exception& )
- {
- }
- }
-
- // 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 );
- }
-}
-
-void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->endDialog( i_result );
-}
-
-void SAL_CALL UnoDialogControl::setHelpId( const rtl::OUString& i_id ) throw (RuntimeException)
-{
- Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY );
- if ( xPeerDialog.is() )
- xPeerDialog->setHelpId( i_id );
-}
-
void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
@@ -2042,53 +453,6 @@ void UnoDialogControl::endExecute() throw(RuntimeException)
}
}
-void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- UnoControlContainer::addingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- {
- Sequence< ::rtl::OUString > aNames( 4 );
- ::rtl::OUString* pNames = aNames.getArray();
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
- *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
- *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
- }
-}
-
-void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- UnoControlContainer::removingControl( _rxControl );
-
- if ( _rxControl.is() )
- {
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- xProps->removePropertiesChangeListener( this );
- }
-
-}
-
-void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
-{
- vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- // 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*/ )
@@ -2097,35 +461,30 @@ throw (RuntimeException)
ImplUpdateResourceResolver();
}
-// ----------------------------------------------------
-// Helper Method to convert relative url to physical location
-// ----------------------------------------------------
-
-::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
{
- ::rtl::OUString baseLocation;
- ::rtl::OUString url;
-
- rbase >>= baseLocation;
- rUrl >>= url;
-
- ::rtl::OUString absoluteURL( url );
- if ( url.getLength() > 0 )
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
{
- INetURLObject urlObj(baseLocation);
- urlObj.removeSegment();
- baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
-
- const INetURLObject protocolCheck( url );
- const INetProtocol protocol = protocolCheck.GetProtocol();
- if ( protocol == INET_PROT_NOT_VALID )
+ 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 testAbsoluteURL;
- if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
- absoluteURL = testAbsoluteURL;
+ ::rtl::OUString aImageURL;
+ Reference< graphic::XGraphic > xGraphic;
+ if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) &&
+ ( aImageURL.getLength() > 0 ))
+ {
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
+ uno::makeAny(aImageURL));
+
+ xGraphic = Impl_getGraphicFromURL_nothrow( absoluteUrl );
+ }
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), sal_True );
+ break;
}
}
-
- return absoluteURL;
+ ControlContainerBase::ImplModelPropertiesChanged(rEvents);
}
-
diff --git a/toolkit/source/controls/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
new file mode 100644
index 000000000000..b7e381ae27c7
--- /dev/null
+++ b/toolkit/source/controls/tabpagecontainer.cxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/controls/tabpagecontainer.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <tools/diagnose_ex.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+#define WRONG_TYPE_EXCEPTION "Type must be ::com::sun::star::awt::tab::XTabPageModel!"
+// ----------------------------------------------------
+// class UnoControlTabPageContainerModel
+// ----------------------------------------------------
+UnoControlTabPageContainerModel::UnoControlTabPageContainerModel() : maContainerListeners( *this )
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+}
+
+::rtl::OUString UnoControlTabPageContainerModel::getServiceName() throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
+}
+
+uno::Any UnoControlTabPageContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch(nPropId)
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainer ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny((sal_Int16) 0); // No Border
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageContainerModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContainerModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ uno::Reference < ::awt::tab::XTabPageModel > xTabPageModel;
+ if(aElement >>= xTabPageModel)
+ {
+ if ( sal_Int32( m_aTabPageVector.size()) ==nIndex )
+ m_aTabPageVector.push_back( xTabPageModel );
+ else if ( sal_Int32( m_aTabPageVector.size()) > nIndex )
+ {
+ std::vector< uno::Reference< ::awt::tab::XTabPageModel > >::iterator aIter = m_aTabPageVector.begin();
+ aIter += nIndex;
+ m_aTabPageVector.insert( aIter, xTabPageModel );
+ }
+ else
+ throw IndexOutOfBoundsException( ::rtl::OUString(), (OWeakObject *)this );
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= ::rtl::OUString::valueOf(nIndex);
+ maContainerListeners.elementInserted( aEvent );
+ }
+ else
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
+ (OWeakObject *)this, 2 );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageContainerModel::removeByIndex( ::sal_Int32 /*Index*/ ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// XIndexReplace
+void SAL_CALL UnoControlTabPageContainerModel::replaceByIndex( ::sal_Int32 /*Index*/, const uno::Any& /*Element*/ ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+// XIndexAccess
+::sal_Int32 SAL_CALL UnoControlTabPageContainerModel::getCount( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return sal_Int32( m_aTabPageVector.size());
+}
+// -----------------------------------------------------------------------------
+uno::Any SAL_CALL UnoControlTabPageContainerModel::getByIndex( ::sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( nIndex < 0 || nIndex > sal_Int32(m_aTabPageVector.size()) )
+ throw lang::IndexOutOfBoundsException();
+ return uno::makeAny(m_aTabPageVector[nIndex]);
+}
+// -----------------------------------------------------------------------------
+// XElementAccess
+uno::Type SAL_CALL UnoControlTabPageContainerModel::getElementType( ) throw (uno::RuntimeException)
+{
+ return ::getCppuType(static_cast< Reference< com::sun::star::awt::XControlModel>* >(NULL));
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL UnoControlTabPageContainerModel::hasElements( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return !m_aTabPageVector.empty();
+}
+// XContainer
+void UnoControlTabPageContainerModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void UnoControlTabPageContainerModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// ----------------------------------------------------
+// class UnoControlTabPageContainer
+// ----------------------------------------------------
+UnoControlTabPageContainer::UnoControlTabPageContainer():
+ m_aTabPageListeners( *this )
+{
+}
+
+OUString UnoControlTabPageContainer::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "TabPageContainer" );
+}
+
+void SAL_CALL UnoControlTabPageContainer::dispose( ) throw(RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aTabPageListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoControlTabPageContainer::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ if ( m_aTabPageListeners.getLength() )
+ xTPContainer->addTabPageListener(&m_aTabPageListeners);
+}
+
+// -------------------------------------------------------------------
+// XTabPageContainer
+
+::sal_Int16 SAL_CALL UnoControlTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getActiveTabPageID();
+}
+void SAL_CALL UnoControlTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ xTPContainer->setActiveTabPageID(_activetabpageid);
+}
+::sal_Int32 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageCount();
+}
+::sal_Bool SAL_CALL UnoControlTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->isTabPageActive(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPage(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageByID(tabPageID);
+}
+void SAL_CALL UnoControlTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void UnoControlTabPageContainer::updateFromModel()
+{
+ UnoControlTabPageContainer_Base::updateFromModel();
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xContainerListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ Sequence< Reference< XControl > > aControls = getControls();
+ const Reference< XControl >* pCtrls = aControls.getConstArray();
+ const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+ for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ {
+ aEvent.Element <<= *pCtrls;
+ xContainerListener->elementInserted( aEvent );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::addControl( const ::rtl::OUString& Name, const Reference< ::com::sun::star::awt::XControl >& Control ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ControlContainerBase::addControl(Name,Control);
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ aEvent.Element <<= Control;
+ xContainerListener->elementInserted( aEvent );
+}
+
+Reference< XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new UnoControlTabPageContainer );
+}
+
+Reference< XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageContainerModel>() );
+}
diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx
new file mode 100644
index 000000000000..4afd46724cab
--- /dev/null
+++ b/toolkit/source/controls/tabpagemodel.cxx
@@ -0,0 +1,404 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/controls/tabpagemodel.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/UnoControlDialogModelProvider.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <tools/list.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+
+////HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+
+//TabPageModel::TabPageModel()
+//{
+//}
+//TabPageModel::TabPageModel( uno::Reference< uno::XComponentContext > const & xCompContext)
+//{
+// (void) xCompContext;
+//}
+//
+//TabPageModel::~TabPageModel()
+//{
+//}
+//
+//////----- XInitialization -------------------------------------------------------------------
+//void SAL_CALL TabPageModel::initialize (const Sequence<Any>& rArguments)
+//{
+// sal_Int16 nPageId;
+// if ( rArguments.getLength() == 1 )
+// {
+// if ( !( rArguments[ 0 ] >>= nPageId ))
+// throw lang::IllegalArgumentException();
+// m_nTabPageId = nPageId;
+// }
+// else
+// m_nTabPageId = -1;
+//}
+//::sal_Int16 SAL_CALL TabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_nTabPageId;
+//}
+//::sal_Bool SAL_CALL TabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_bEnabled;
+//}
+//void SAL_CALL TabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_bEnabled = _enabled;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTitle;
+//}
+//void SAL_CALL TabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTitle = _title;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sImageURL;
+//}
+//void SAL_CALL TabPageModel::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sImageURL = _imageurl;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTooltip;
+//}
+//void SAL_CALL TabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTooltip = _tooltip;
+//}
+
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+UnoControlTabPageModel::UnoControlTabPageModel(Reference< XComponentContext >const & i_xCompContext) : m_xCompContext(i_xCompContext)
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_TITLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+}
+
+::rtl::OUString UnoControlTabPageModel::getServiceName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageModel );
+}
+
+Any UnoControlTabPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPage );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlTabPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else if ( rArguments.getLength() == 2 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ ::rtl::OUString sURL;
+ if ( !( rArguments[ 1 ] >>= sURL ))
+ throw lang::IllegalArgumentException();
+ Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create(m_xCompContext,sURL);
+ if ( xDialogModel.is() )
+ {
+ Sequence< ::rtl::OUString> aNames = xDialogModel->getElementNames();
+ const ::rtl::OUString* pIter = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aNames.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ try
+ {
+ Any aElement(xDialogModel->getByName(*pIter));
+ xDialogModel->removeByName(*pIter);
+ insertByName(*pIter,aElement);
+ }
+ catch(const Exception& ex)
+ {
+ (void)ex;
+ }
+ }
+ Reference<XPropertySet> xDialogProp(xDialogModel,UNO_QUERY);
+ if ( xDialogProp.is() )
+ {
+ static const ::rtl::OUString s_sResourceResolver(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"));
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(s_sResourceResolver,xDialogProp->getPropertyValue(s_sResourceResolver));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL)));
+ }
+ }
+ }
+ else
+ m_nTabPageId = -1;
+}
+//===== Service ===============================================================
+Reference< XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance( const Reference< XMultiServiceFactory >& xServiceFactory)
+{
+ Reference < ::com::sun::star::beans::XPropertySet > xPropertySet (xServiceFactory, UNO_QUERY);
+ Any any = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii("DefaultContext"));
+ Reference < XComponentContext > xCompCtx;
+ any >>= xCompCtx;
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlTabPageModel>(xCompCtx) );
+ //return Reference < XInterface > ( (::cppu::OWeakObject* ) new UnoControlTabPageModel(xCompCtx));
+}
+
+::rtl::OUString UnoControlTabPageModel_getImplementationName (void) throw(RuntimeException)
+{
+ return rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel");
+}
+
+Sequence<rtl::OUString> SAL_CALL UnoControlTabPageModel_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+//=============================================================================
+// = class UnoControlTabPage
+// ============================================================================
+
+UnoControlTabPage::UnoControlTabPage() :
+ m_bWindowListener(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+UnoControlTabPage::~UnoControlTabPage()
+{
+}
+
+::rtl::OUString UnoControlTabPage::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "TabPageModel" );
+}
+
+void UnoControlTabPage::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ ControlContainerBase::dispose();
+}
+
+void SAL_CALL UnoControlTabPage::disposing( const EventObject& Source )throw(RuntimeException)
+{
+ ControlContainerBase::disposing( Source );
+}
+
+void UnoControlTabPage::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ImplUpdateResourceResolver();
+
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ Reference < tab::XTabPage > xTabPage( getPeer(), UNO_QUERY );
+ if ( xTabPage.is() )
+ {
+ if ( !m_bWindowListener )
+ {
+ Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+ addWindowListener( xWL );
+ m_bWindowListener = true;
+ }
+ }
+}
+
+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
+{
+ ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
+ return aTmp;
+}
+// ::com::sun::star::awt::XWindowListener
+void SAL_CALL UnoControlTabPage::windowResized( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ 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 );
+
+ 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;
+ }
+
+ 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();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbSizeModified = false;
+ }
+}
+
+void SAL_CALL UnoControlTabPage::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ 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 );
+
+ // 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();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbPosModified = false;
+ }
+}
+
+void SAL_CALL UnoControlTabPage::windowShown( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
+
+void SAL_CALL UnoControlTabPage::windowHidden( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index c3149a8cc869..3afe3a90f1ee 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -808,6 +808,7 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
+ OSL_ENSURE(xC.is(),"Peer isn't valid. Please check!");
xC->enableDialogControl( sal_True );
ImplActivateTabControllers();
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index d3838a7421a4..fdf57b70928d 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -4356,3 +4356,4 @@ sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException)
{
return sal_True;
}
+
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index 9b8df60521ae..ed2fe978b169 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -211,3 +211,9 @@ IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::s
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent )
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
index 477032538af8..7fcc95ae8576 100644
--- a/toolkit/source/helper/registerservices.cxx
+++ b/toolkit/source/helper/registerservices.cxx
@@ -52,7 +52,11 @@
#include <toolkit/controls/tksimpleanimation.hxx>
#include <toolkit/controls/tkthrobber.hxx>
#include <toolkit/controls/dialogcontrol.hxx>
+#include <toolkit/controls/tabpagemodel.hxx>
+#include <toolkit/controls/tabpagecontainer.hxx>
#include "toolkit/dllapi.h"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
namespace toolkit
{
@@ -195,6 +199,10 @@ IMPL_CREATEINSTANCE( UnoSimpleAnimationControl )
IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
IMPL_CREATEINSTANCE( UnoThrobberControl )
IMPL_CREATEINSTANCE( UnoThrobberControlModel )
+IMPL_CREATEINSTANCE( UnoControlTabPage )
+//IMPL_CREATEINSTANCE( UnoControlTabPageModel )
+//IMPL_CREATEINSTANCE( UnoControlTabPageContainer )
+//IMPL_CREATEINSTANCE( UnoControlTabPageContainerModel )
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
@@ -204,6 +212,11 @@ extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageContainerModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+//extern sal_Bool SAL_CALL UnoControlTabPageModel_component_writeInfo(void * serviceManager, void * registryKey);
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlTabPageModel_CreateInstance (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
@@ -290,17 +303,19 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen
CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
- CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
- CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
- CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
- CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
- CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL );
+ CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL )
+ CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL )
+ CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL )
+ CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL )
+ CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
+ CHECKANDCREATEFACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, NULL )
if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
-
-
if( pRet == 0 )
pRet = comp_Layout_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
}
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
index f57f52f13e57..01672e5867e4 100644
--- a/toolkit/source/helper/servicenames.cxx
+++ b/toolkit/source/helper/servicenames.cxx
@@ -102,3 +102,8 @@ const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.g
const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[] = "com.sun.star.awt.tab.UnoControlTabPage";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer";
+
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
index 4e1e4153daf1..d0336c27bdf5 100644
--- a/toolkit/source/helper/tkresmgr.cxx
+++ b/toolkit/source/helper/tkresmgr.cxx
@@ -29,14 +29,21 @@
#include "precompiled_toolkit.hxx"
#include <toolkit/helper/tkresmgr.hxx>
#include <tools/simplerm.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
#ifndef _TOOLS_RESMGR_HXX_
#include <tools/resmgr.hxx>
#endif
-
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
-
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+using namespace ::com::sun::star;
// -----------------------------------------------------------------------------
// TkResMgr
// -----------------------------------------------------------------------------
@@ -98,3 +105,27 @@ Image TkResMgr::loadImage( sal_uInt16 nResId )
}
// -----------------------------------------------------------------------------
+Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL )
+{
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+}
+
diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component
index e782283c39eb..f5e7c54eab5e 100644
--- a/toolkit/util/tk.component
+++ b/toolkit/util/tk.component
@@ -35,6 +35,18 @@
<service name="com.sun.star.awt.Layout"/>
<service name="com.sun.star.comp.awt.Layout"/>
</implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPage">
+ <service name="com.sun.star.awt.tab.UnoControlTabPage"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainerModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainerModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainer">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainer"/>
+ </implementation>
<implementation name="stardiv.Toolkit.DefaultGridColumnModel">
<service name="com.sun.star.awt.grid.DefaultGridColumnModel"/>
</implementation>