diff options
author | Christian Lippka <cl@openoffice.org> | 2010-03-21 20:01:33 +0100 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2010-03-21 20:01:33 +0100 |
commit | b3ca4b3cbdce79eb3b387da6e84126c7a9f20eaa (patch) | |
tree | e57f602bd044ddd18100f27cefa7ec954f583de8 | |
parent | d8ba1a522388f4b14e3d9ce9d934f4166fe0ae4d (diff) |
Adding PopupMenuController to allow PopupMenuControllerBase dervivates to be used in toolbars
60 files changed, 1781 insertions, 3366 deletions
diff --git a/framework/inc/helper/popupmenucontrollerbase.hxx b/framework/inc/helper/popupmenucontrollerbase.hxx deleted file mode 100644 index e723b36aec3b..000000000000 --- a/framework/inc/helper/popupmenucontrollerbase.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/************************************************************************* - * - * 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 __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_ -#define __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_ - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ - -#include <threadhelp/threadhelpbase.hxx> -#include <macros/generic.hxx> -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <macros/xserviceinfo.hxx> -#include <stdtypes.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XStatusListener.hpp> -#include <com/sun/star/frame/XPopupMenuController.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> -#include <com/sun/star/uri/XUriReference.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <toolkit/awt/vclxmenu.hxx> -#include <cppuhelper/weak.hxx> -#include <rtl/ustring.hxx> - -namespace framework -{ - class PopupMenuControllerBase : public com::sun::star::lang::XTypeProvider , - public com::sun::star::lang::XServiceInfo , - public ::com::sun::star::frame::XPopupMenuController , - public com::sun::star::lang::XInitialization , - public com::sun::star::frame::XStatusListener , - public com::sun::star::awt::XMenuListener , - public com::sun::star::frame::XDispatchProvider , - public com::sun::star::frame::XDispatch , - public com::sun::star::lang::XComponent , - protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::OBroadcastHelper , - public ::cppu::OWeakObject - { - public: - PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~PopupMenuControllerBase(); - - // XInterface, XTypeProvider, XServiceInfo - FWK_DECLARE_XINTERFACE - FWK_DECLARE_XTYPEPROVIDER - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0; - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0; - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0; - - // XPopupMenuController - virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XStatusListener - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0; - - // XMenuListener - virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - - // XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException ); - - // XDispatch - virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) 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 ); - - // XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - - protected: - virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); - virtual void impl_setPopupMenu(); - virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); - ::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL ); - - - bool m_bInitialized; - bool m_bDisposed; - rtl::OUString m_aCommandURL; - rtl::OUString m_aBaseURL; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener - }; -} - -#endif // __FRAMEWORK_HELPER_POPUPMENUCONTROLLERBASE_HXX_ diff --git a/framework/inc/threadhelp/fairrwlock.hxx b/framework/inc/threadhelp/fairrwlock.hxx index af9617a9ba47..0f984c8d03f9 100644 --- a/framework/inc/threadhelp/fairrwlock.hxx +++ b/framework/inc/threadhelp/fairrwlock.hxx @@ -40,7 +40,6 @@ // interface includes //_________________________________________________________________________________________________________________ #include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/inc/uielement/controlmenucontroller.hxx b/framework/inc/uielement/controlmenucontroller.hxx index a1be2ee47b3b..6e0c9deb03c0 100644 --- a/framework/inc/uielement/controlmenucontroller.hxx +++ b/framework/inc/uielement/controlmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -52,6 +52,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -59,8 +60,10 @@ class PopupMenu; namespace framework { - class ControlMenuController : public PopupMenuControllerBase + class ControlMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~ControlMenuController(); diff --git a/framework/inc/uielement/fontmenucontroller.hxx b/framework/inc/uielement/fontmenucontroller.hxx index f14680a49030..79905658839b 100644 --- a/framework/inc/uielement/fontmenucontroller.hxx +++ b/framework/inc/uielement/fontmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -50,14 +50,17 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> namespace framework { - class FontMenuController : public PopupMenuControllerBase + class FontMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: FontMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~FontMenuController(); diff --git a/framework/inc/uielement/fontsizemenucontroller.hxx b/framework/inc/uielement/fontsizemenucontroller.hxx index d0afe40154fe..4e5623084908 100644 --- a/framework/inc/uielement/fontsizemenucontroller.hxx +++ b/framework/inc/uielement/fontsizemenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -51,14 +51,17 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> namespace framework { - class FontSizeMenuController : public PopupMenuControllerBase + class FontSizeMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: FontSizeMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~FontSizeMenuController(); diff --git a/framework/inc/uielement/headermenucontroller.hxx b/framework/inc/uielement/headermenucontroller.hxx index 8ec012e80319..0deeb878156d 100644 --- a/framework/inc/uielement/headermenucontroller.hxx +++ b/framework/inc/uielement/headermenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -52,14 +52,17 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> namespace framework { - class HeaderMenuController : public PopupMenuControllerBase + class HeaderMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter = sal_False ); virtual ~HeaderMenuController(); diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx index 36035040bcad..a73a8f13b92e 100644 --- a/framework/inc/uielement/langselectionmenucontroller.hxx +++ b/framework/inc/uielement/langselectionmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -51,6 +51,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -59,8 +60,10 @@ namespace framework { - class LanguageSelectionMenuController : public PopupMenuControllerBase + class LanguageSelectionMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~LanguageSelectionMenuController(); diff --git a/framework/inc/uielement/macrosmenucontroller.hxx b/framework/inc/uielement/macrosmenucontroller.hxx index 6070a44d3564..1e8b9024eaca 100644 --- a/framework/inc/uielement/macrosmenucontroller.hxx +++ b/framework/inc/uielement/macrosmenucontroller.hxx @@ -28,7 +28,7 @@ #ifndef __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ #define __FRAMEWORK_UIELEMENT_MACROSMENUCONTROLLER_HXX_ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> @@ -40,6 +40,7 @@ #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <vcl/menu.hxx> @@ -47,8 +48,10 @@ namespace framework { - class MacrosMenuController : public PopupMenuControllerBase + class MacrosMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + struct ExecuteInfo { ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index e937623b44b9..5e14b70f0044 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -53,6 +53,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -71,8 +72,10 @@ namespace framework ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; }; - class NewMenuController : public PopupMenuControllerBase + class NewMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: NewMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~NewMenuController(); diff --git a/framework/inc/uielement/objectmenucontroller.hxx b/framework/inc/uielement/objectmenucontroller.hxx index 94c1d849e197..7a03dfd1458e 100644 --- a/framework/inc/uielement/objectmenucontroller.hxx +++ b/framework/inc/uielement/objectmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -51,14 +51,17 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> namespace framework { - class ObjectMenuController : public PopupMenuControllerBase + class ObjectMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~ObjectMenuController(); diff --git a/framework/inc/uielement/popupmenucontroller.hxx b/framework/inc/uielement/popupmenucontroller.hxx new file mode 100644 index 000000000000..ef44a4703ca2 --- /dev/null +++ b/framework/inc/uielement/popupmenucontroller.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ +#define __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +#include "svtools/toolboxcontroller.hxx" +#include "boost/scoped_ptr.hpp" + +#include <macros/xserviceinfo.hxx> + +class Window; + +namespace framework +{ +class PopupMenuControllerImpl; + +class PopupMenuController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo +{ +public: + PopupMenuController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + ~PopupMenuController(); + + // 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 (); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + bool CreatePopupMenuController() throw (::com::sun::star::uno::Exception); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XPopupMenuController > mxPopupMenuController; + ::com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu; +}; + +} // namespace framework + +#endif // __FRAMEWORK_POPUPMENUCONTROLLER_HXX_ diff --git a/framework/inc/uielement/recentfilesmenucontroller.hxx b/framework/inc/uielement/recentfilesmenucontroller.hxx index 40c3a55737c1..26a8e38dd49c 100644 --- a/framework/inc/uielement/recentfilesmenucontroller.hxx +++ b/framework/inc/uielement/recentfilesmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -52,6 +52,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -65,8 +66,10 @@ namespace framework ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; }; - class RecentFilesMenuController : public PopupMenuControllerBase + class RecentFilesMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~RecentFilesMenuController(); diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx index dcb0b57182df..35f517d33e80 100644 --- a/framework/inc/uielement/toolbarsmenucontroller.hxx +++ b/framework/inc/uielement/toolbarsmenucontroller.hxx @@ -32,7 +32,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <helper/popupmenucontrollerbase.hxx> +#include <macros/xserviceinfo.hxx> #include <stdtypes.h> //_________________________________________________________________________________________________________________ @@ -54,6 +54,7 @@ //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <svtools/popupmenucontrollerbase.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -63,8 +64,10 @@ namespace framework { - class ToolbarsMenuController : public PopupMenuControllerBase + class ToolbarsMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + public: ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); virtual ~ToolbarsMenuController(); diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk index 556a9829d27c..ed54c381160c 100644 --- a/framework/source/helper/makefile.mk +++ b/framework/source/helper/makefile.mk @@ -53,7 +53,6 @@ SLOFILES= $(SLO)$/ocomponentaccess.obj \ $(SLO)$/networkdomain.obj \ $(SLO)$/acceleratorinfo.obj \ $(SLO)$/uielementwrapperbase.obj \ - $(SLO)$/popupmenucontrollerbase.obj \ $(SLO)$/dockingareadefaultacceptor.obj \ $(SLO)$/uiconfigelementwrapperbase.obj \ $(SLO)$/shareablemutex.obj \ diff --git a/framework/source/helper/popupmenucontrollerbase.cxx b/framework/source/helper/popupmenucontrollerbase.cxx deleted file mode 100644 index cc5d388de9a8..000000000000 --- a/framework/source/helper/popupmenucontrollerbase.cxx +++ /dev/null @@ -1,429 +0,0 @@ -/************************************************************************* - * - * 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_framework.hxx" -#include <helper/popupmenucontrollerbase.hxx> - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <threadhelp/resetableguard.hxx> -#include "services.h" - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/awt/XDevice.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/awt/MenuItemStyle.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/lang/DisposedException.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ - -#ifndef _VCL_MENU_HXX_ -#include <vcl/menu.hxx> -#endif -#include <vcl/svapp.hxx> -#include <rtl/ustrbuf.hxx> -#include <rtl/logfile.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::frame; -using namespace com::sun::star::beans; -using namespace com::sun::star::util; - -namespace framework -{ - -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** -DEFINE_XINTERFACE_11 ( PopupMenuControllerBase , - OWeakObject , - DIRECT_INTERFACE( css::lang::XTypeProvider ), - DIRECT_INTERFACE( css::lang::XServiceInfo ), - DIRECT_INTERFACE( ::com::sun::star::frame::XPopupMenuController ), - DIRECT_INTERFACE( css::lang::XInitialization ), - DIRECT_INTERFACE( css::frame::XStatusListener ), - DIRECT_INTERFACE( css::awt::XMenuListener ), - DIRECT_INTERFACE( css::frame::XDispatchProvider ), - DIRECT_INTERFACE( css::frame::XDispatch ), - DIRECT_INTERFACE( css::lang::XComponent ), - DERIVED_INTERFACE( css::lang::XEventListener, css::frame::XStatusListener ), - DERIVED_INTERFACE( css::lang::XEventListener, css::awt::XMenuListener ) - ) - -DEFINE_XTYPEPROVIDER_10 ( PopupMenuControllerBase , - css::lang::XTypeProvider , - css::lang::XServiceInfo , - ::com::sun::star::frame::XPopupMenuController , - css::lang::XInitialization , - css::frame::XStatusListener , - css::awt::XMenuListener , - css::lang::XEventListener , - css::frame::XDispatchProvider , - css::frame::XDispatch , - css::lang::XComponent - ) - -PopupMenuControllerBase::PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - ThreadHelpBase(), - ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ), - m_bInitialized( false ), - m_bDisposed( false ), - m_xServiceManager( xServiceManager ), - m_aListenerContainer( m_aLock.getShareableOslMutex() ) -{ - if ( m_xServiceManager.is() ) - m_xURLTransformer.set( m_xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY ); -} - -PopupMenuControllerBase::~PopupMenuControllerBase() -{ -} - -// protected function -void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ) -{ - VCLXPopupMenu* pPopupMenu = 0; - if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 ) - { - pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); - if ( pPopupMenu ) - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - pVCLPopupMenu->Clear(); - } - } -} - -void SAL_CALL PopupMenuControllerBase::dispose() -throw (::com::sun::star::uno::RuntimeException) -{ - css::uno::Reference< css::lang::XComponent > xThis( static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY ); - - // Send message to all listener and forget their references. - css::lang::EventObject aEvent( xThis ); - m_aListenerContainer.disposeAndClear( aEvent ); - - // Reset our members and set disposed flag - ResetableGuard aLock( m_aLock ); - m_xFrame.clear(); - m_xDispatch.clear(); - m_xPopupMenu.clear(); - m_xServiceManager.clear(); - m_bDisposed = true; -} - -void SAL_CALL PopupMenuControllerBase::addEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::lang::XEventListener >*)NULL ), xListener ); -} - -void SAL_CALL PopupMenuControllerBase::removeEventListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::lang::XEventListener >*)NULL ), xListener ); -} - -// XEventListener -void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - m_xFrame.clear(); - m_xDispatch.clear(); - m_xPopupMenu.clear(); -} - -// XMenuListener -void SAL_CALL PopupMenuControllerBase::highlight( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL) -{ - Sequence<PropertyValue> aArgs; - OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch"); - if ( _xDispatch.is() ) - _xDispatch->dispatch( aURL, aArgs ); -} - -void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) -{ - Reference< css::awt::XPopupMenu > xPopupMenu; - Reference< XDispatch > xDispatch; - Reference< XMultiServiceFactory > xServiceManager; - - if ( m_bDisposed ) - throw DisposedException(); - - ResetableGuard aLock( m_aLock ); - xPopupMenu = m_xPopupMenu; - xDispatch = m_xDispatch; - xServiceManager = m_xServiceManager; - aLock.unlock(); - - if ( xPopupMenu.is() ) - { - VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu ); - if ( pPopupMenu ) - { - css::util::URL aTargetURL; - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - aTargetURL.Complete = pVCLPopupMenu->GetItemCommand( rEvent.MenuId ); - } - - m_xURLTransformer->parseStrict( aTargetURL ); - impl_select(xDispatch,aTargetURL); - } - } -} - -void SAL_CALL PopupMenuControllerBase::activate( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void SAL_CALL PopupMenuControllerBase::deactivate( const css::awt::MenuEvent& ) throw (RuntimeException) -{ -} - -void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( m_bDisposed ) - throw DisposedException(); - - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); - Reference< XDispatch > xDispatch( m_xDispatch ); - com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = m_aCommandURL; - m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); - - // Add/remove status listener to get a status update once - if ( xDispatch.is() ) - { - xDispatch->addStatusListener( xStatusListener, aTargetURL ); - xDispatch->removeStatusListener( xStatusListener, aTargetURL ); - } -} - -// XDispatchProvider -Reference< XDispatch > SAL_CALL -PopupMenuControllerBase::queryDispatch( - const URL& /*aURL*/, - const rtl::OUString& /*sTarget*/, - sal_Int32 /*nFlags*/ ) -throw( RuntimeException ) -{ - // must be implemented by subclass - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - - return Reference< XDispatch >(); -} - -Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException ) -{ - // Create return list - which must have same size then the given descriptor - // It's not allowed to pack it! - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - aLock.unlock(); - - sal_Int32 nCount = lDescriptor.getLength(); - css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); - - // Step over all descriptors and try to get any dispatcher for it. - for( sal_Int32 i=0; i<nCount; ++i ) - { - lDispatcher[i] = queryDispatch( lDescriptor[i].FeatureURL , - lDescriptor[i].FrameName , - lDescriptor[i].SearchFlags ); - } - - return lDispatcher; -} - -// XDispatch -void SAL_CALL -PopupMenuControllerBase::dispatch( - const URL& /*aURL*/, - const Sequence< PropertyValue >& /*seqProperties*/ ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - // must be implemented by subclass - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); -} - -void SAL_CALL -PopupMenuControllerBase::addStatusListener( - const Reference< XStatusListener >& xControl, - const URL& aURL ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - if ( m_bDisposed ) - throw DisposedException(); - aLock.unlock(); - - bool bStatusUpdate( false ); - m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::frame::XStatusListener >*)NULL ), xControl ); - - aLock.lock(); - if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) - bStatusUpdate = true; - aLock.unlock(); - - if ( bStatusUpdate ) - { - // Dummy update for popup menu controllers - FeatureStateEvent aEvent; - aEvent.FeatureURL = aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.State = Any(); - xControl->statusChanged( aEvent ); - } -} - -void SAL_CALL PopupMenuControllerBase::removeStatusListener( - const Reference< XStatusListener >& xControl, - const URL& /*aURL*/ ) -throw( ::com::sun::star::uno::RuntimeException ) -{ - m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::frame::XStatusListener >*)NULL ), xControl ); -} - -::rtl::OUString PopupMenuControllerBase::determineBaseURL( const ::rtl::OUString& aURL ) -{ - // Just use the main part of the URL for popup menu controllers - sal_Int32 nQueryPart( 0 ); - sal_Int32 nSchemePart( 0 ); - rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" )); - - nSchemePart = aURL.indexOf( ':' ); - if (( nSchemePart > 0 ) && - ( aURL.getLength() > ( nSchemePart+1 ))) - { - nQueryPart = aURL.indexOf( '?', nSchemePart ); - if ( nQueryPart > 0 ) - aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart ); - else if ( nQueryPart == -1 ) - aMainURL += aURL.copy( nSchemePart+1 ); - } - - return aMainURL; -} - -// XInitialization -void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - sal_Bool bInitalized( m_bInitialized ); - if ( !bInitalized ) - { - PropertyValue aPropValue; - rtl::OUString aCommandURL; - Reference< XFrame > xFrame; - - for ( int i = 0; i < aArguments.getLength(); i++ ) - { - if ( aArguments[i] >>= aPropValue ) - { - if ( aPropValue.Name.equalsAscii( "Frame" )) - aPropValue.Value >>= xFrame; - else if ( aPropValue.Name.equalsAscii( "CommandURL" )) - aPropValue.Value >>= aCommandURL; - } - } - - if ( xFrame.is() && aCommandURL.getLength() ) - { - m_xFrame = xFrame; - m_aCommandURL = aCommandURL; - m_aBaseURL = determineBaseURL( aCommandURL ); - m_bInitialized = true; - } - } -} -// XPopupMenuController -void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( m_bDisposed ) - throw DisposedException(); - - if ( m_xFrame.is() && !m_xPopupMenu.is() ) - { - // Create popup menu on demand - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - - m_xPopupMenu = xPopupMenu; - m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY )); - - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - - com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = m_aCommandURL; - m_xURLTransformer->parseStrict( aTargetURL ); - m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); - - impl_setPopupMenu(); - - updatePopupMenu(); - } -} -void PopupMenuControllerBase::impl_setPopupMenu() -{ -} -} diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx index 1ddda0eb0f4d..5660e5a310e3 100644 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/helper/uiconfigelementwrapperbase.cxx @@ -45,7 +45,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index dc5682c7d398..7382380ef525 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -78,6 +78,7 @@ #include <uielement/macrosmenucontroller.hxx> #include <uielement/newmenucontroller.hxx> #include <uielement/toolbarsmenucontroller.hxx> +#include <uielement/popupmenucontroller.hxx> COMPONENTGETIMPLEMENTATIONENVIRONMENT @@ -103,6 +104,7 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::MediaTypeDetectionHelper COMPONENTINFO( ::framework::DispatchRecorderSupplier ) COMPONENTINFO( ::framework::Oxt_Handler ) COMPONENTINFO( ::framework::License ) + COMPONENTINFO( ::framework::PopupMenuController ) ) COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper ) @@ -126,5 +128,6 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::MediaTypeDetectionHelper IFFACTORY( ::framework::FooterMenuController ) else IFFACTORY( ::framework::HeaderMenuController ) else IFFACTORY( ::framework::LanguageSelectionMenuController ) else - IFFACTORY( ::framework::Oxt_Handler ) + IFFACTORY( ::framework::Oxt_Handler ) else + IFFACTORY( ::framework::PopupMenuController ) ) diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 3921625cc76f..058005ffdc40 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 0672ac69d351..49501194a014 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -61,6 +61,7 @@ #include <vcl/image.hxx> #include <svtools/menuoptions.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> // Copied from svx // Function-Id's @@ -213,7 +214,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ControlMenuController DEFINE_INIT_SERVICE ( ControlMenuController, {} ) ControlMenuController::ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_pResPopupMenu( 0 ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); @@ -272,7 +273,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -286,7 +287,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run // XStatusListener void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); USHORT nMenuId = 0; for (sal_uInt32 i=0; i < sizeof(aCommands)/sizeof(aCommands[0]); ++i) @@ -351,7 +352,7 @@ void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispat void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { @@ -404,10 +405,9 @@ void ControlMenuController::impl_setPopupMenu() void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( m_xFrame.is() && m_xPopupMenu.is() ) { @@ -435,8 +435,8 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star:: // XInitialization void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); - PopupMenuControllerBase::initialize(aArguments); + osl::ResettableMutexGuard aLock( m_aMutex ); + svt::PopupMenuControllerBase::initialize(aArguments); m_aBaseURL = ::rtl::OUString(); } diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 43b50eb2a49a..0800103c743e 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 3ad4b11fd1e9..387213d7c3eb 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 7110ea5aa519..c2625a951efb 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -59,6 +59,7 @@ #include <vcl/mnemonic.hxx> #endif #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -91,7 +92,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( FontMenuController DEFINE_INIT_SERVICE ( FontMenuController, {} ) FontMenuController::FontMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) { } @@ -145,7 +146,7 @@ void SAL_CALL FontMenuController::disposing( const EventObject& ) throw ( Runtim { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xFontListDispatch.clear(); @@ -164,12 +165,12 @@ void SAL_CALL FontMenuController::statusChanged( const FeatureStateEvent& Event if ( Event.State >>= aFontDescriptor ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontFamilyName = aFontDescriptor.Name; } else if ( Event.State >>= aFontNameSeq ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) fillPopupMenu( aFontNameSeq, m_xPopupMenu ); } @@ -192,7 +193,7 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { @@ -241,14 +242,14 @@ void FontMenuController::impl_setPopupMenu() void SAL_CALL FontMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< XDispatch > xDispatch( m_xFontListDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontNameList" )); m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 8dbd608a28e0..58cf3a3b02be 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -64,6 +64,7 @@ #include <svtools/ctrltool.hxx> #endif #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -90,7 +91,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( FontSizeMenuController DEFINE_INIT_SERVICE ( FontSizeMenuController, {} ) FontSizeMenuController::FontSizeMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_pHeightArray( 0 ), m_bRebuildMenu( sal_True ) { @@ -280,7 +281,7 @@ void SAL_CALL FontSizeMenuController::disposing( const EventObject& ) throw ( Ru { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xCurrentFontDispatch.clear(); @@ -297,7 +298,7 @@ void SAL_CALL FontSizeMenuController::statusChanged( const FeatureStateEvent& Ev if ( Event.State >>= aFontDescriptor ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontDescriptor = aFontDescriptor; if ( m_xPopupMenu.is() ) @@ -306,7 +307,7 @@ void SAL_CALL FontSizeMenuController::statusChanged( const FeatureStateEvent& Ev } else if ( Event.State >>= aFontHeight ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_aFontHeight = aFontHeight; if ( m_xPopupMenu.is() ) @@ -341,16 +342,15 @@ void FontSizeMenuController::impl_setPopupMenu() void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< XDispatch > xDispatch( m_xCurrentFontDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )); m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { @@ -358,6 +358,6 @@ void SAL_CALL FontSizeMenuController::updatePopupMenu() throw ( ::com::sun::star xDispatch->removeStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); } - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); } } diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 50b2ed65e2d2..c0d7b48a401b 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -50,7 +50,6 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -65,6 +64,7 @@ #include <rtl/ustrbuf.hxx> //#include <tools/solar.hrc> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -97,7 +97,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( HeaderMenuController DEFINE_INIT_SERVICE ( HeaderMenuController, {} ) HeaderMenuController::HeaderMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool _bFooter ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) ,m_bFooter(_bFooter) { } @@ -221,7 +221,7 @@ void SAL_CALL HeaderMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -238,7 +238,7 @@ void SAL_CALL HeaderMenuController::statusChanged( const FeatureStateEvent& Even if ( Event.State >>= xModel ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xModel = xModel; if ( m_xPopupMenu.is() ) fillPopupMenu( xModel, m_xPopupMenu ); @@ -258,18 +258,17 @@ void HeaderMenuController::impl_select(const Reference< XDispatch >& _xDispatch, void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ResettableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< com::sun::star::frame::XModel > xModel( m_xModel ); - aLock.unlock(); + aLock.clear(); if ( !xModel.is() ) - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); - aLock.lock(); + aLock.reset(); if ( m_xPopupMenu.is() && m_xModel.is() ) fillPopupMenu( m_xModel, m_xPopupMenu ); } diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index d9af2fb4f9f9..5126ffdd253a 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XControlNotificationListener.hpp> #include "com/sun/star/util/XMacroExpander.hpp" #include "com/sun/star/uno/XComponentContext.hpp" diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index 9c8e68e24734..f9ead6c585c2 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -76,6 +76,7 @@ #include <dispatch/uieventloghelper.hxx> #include "helper/mischelper.hxx" +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -101,7 +102,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LanguageSelectionMenuController DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} ) LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_bShowMenu( sal_True ) ,m_aLangGuessHelper(xServiceManager) { @@ -116,7 +117,7 @@ void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) t { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xLanguageDispatch.clear(); @@ -132,7 +133,7 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( m_bDisposed ) + if (rBHelper.bDisposed || rBHelper.bInDispose) return; m_bShowMenu = sal_True; @@ -380,15 +381,15 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) { - PopupMenuControllerBase::updatePopupMenu(); + svt::PopupMenuControllerBase::updatePopupMenu(); // Force status update to get information about the current languages - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< XDispatch > xDispatch( m_xLanguageDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = m_aLangStatusCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); if ( xDispatch.is() ) { @@ -415,12 +416,12 @@ void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com:: // XInitialization void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize(aArguments); + svt::PopupMenuControllerBase::initialize(aArguments); if ( m_bInitialized ) { diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index f0f5d52a47d6..2905d0c0bd05 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -48,6 +48,7 @@ #include <rtl/ustrbuf.hxx> #include <dispatch/uieventloghelper.hxx> #include "helper/mischelper.hxx" +#include <vos/mutex.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -70,7 +71,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( MacrosMenuController DEFINE_INIT_SERVICE ( MacrosMenuController, {} ) MacrosMenuController::MacrosMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_xServiceManager( xServiceManager) { } @@ -109,7 +110,7 @@ void SAL_CALL MacrosMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); OSL_TRACE("disposing"); m_xFrame.clear(); m_xDispatch.clear(); @@ -126,7 +127,7 @@ void SAL_CALL MacrosMenuController::disposing( const EventObject& ) throw ( Runt // XStatusListener void SAL_CALL MacrosMenuController::statusChanged( const FeatureStateEvent& ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) { fillPopupMenu( m_xPopupMenu ); diff --git a/framework/source/uielement/makefile.mk b/framework/source/uielement/makefile.mk index da4ab3d34c74..b74adb1e176f 100644 --- a/framework/source/uielement/makefile.mk +++ b/framework/source/uielement/makefile.mk @@ -79,6 +79,7 @@ SLOFILES= \ $(SLO)$/toolbarmerger.obj \ $(SLO)$/toolbarsmenucontroller.obj \ $(SLO)$/toolbarwrapper.obj \ + $(SLO)$/popupmenucontroller.obj \ $(SLO)$/uicommanddescription.obj \ # --- Targets ------------------------------------------------------ diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 3ac78726d799..786795ff1d14 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -67,6 +67,7 @@ #include <svtools/acceleratorexecute.hxx> #include <unotools/moduleoptions.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -326,7 +327,7 @@ void NewMenuController::retrieveShortcutsFromConfiguration( } NewMenuController::NewMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_bShowImages( sal_True ), m_bHiContrast( sal_False ), m_bNewMenu( sal_False ), @@ -399,7 +400,7 @@ void SAL_CALL NewMenuController::disposing( const EventObject& ) throw ( Runtime { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -423,12 +424,12 @@ void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) thr Reference< XMultiServiceFactory > xServiceManager; Reference< XURLTransformer > xURLTransformer; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; xURLTransformer = m_xURLTransformer; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList( 1 ); @@ -548,12 +549,12 @@ void NewMenuController::impl_setPopupMenu() // XInitialization void SAL_CALL NewMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize( aArguments ); + svt::PopupMenuControllerBase::initialize( aArguments ); if ( m_bInitialized ) { diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index f4d6aea0d82b..80dccb76db05 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -59,6 +59,7 @@ #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -83,7 +84,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ObjectMenuController DEFINE_INIT_SERVICE ( ObjectMenuController, {} ) ObjectMenuController::ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ) + svt::PopupMenuControllerBase( xServiceManager ) { } @@ -128,7 +129,7 @@ void SAL_CALL ObjectMenuController::disposing( const EventObject& ) throw ( Runt { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xObjectUpdateDispatch.clear(); @@ -145,7 +146,7 @@ void SAL_CALL ObjectMenuController::statusChanged( const FeatureStateEvent& Even Sequence < com::sun::star::embed::VerbDescriptor > aVerbCommandSeq; if ( Event.State >>= aVerbCommandSeq ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); if ( m_xPopupMenu.is() ) fillPopupMenu( aVerbCommandSeq, m_xPopupMenu ); } diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx new file mode 100644 index 000000000000..867a395f6916 --- /dev/null +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * 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_framework.hxx" + +#include <com/sun/star/awt/XPopupMenu.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> + +#include <toolkit/helper/vclunohelper.hxx> +//#include <toolkit/unohlp.hxx> + +#include <rtl/ref.hxx> + +#include <vcl/toolbox.hxx> +#include <vcl/menu.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> + +#include "uielement/popupmenucontroller.hxx" +#include "services.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::frame; +using namespace ::com::sun::star::beans; + +// -------------------------------------------------------------------- + + +namespace framework +{ + +DEFINE_XSERVICEINFO_MULTISERVICE ( PopupMenuController , + OWeakObject , + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) ) , + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.framework.PopupMenuController" ) ) + ) + +DEFINE_INIT_SERVICE ( PopupMenuController, {} ) + +class PopupMenuControllerImpl +{ +}; + +//======================================================================== +// class PopupMenuController +//======================================================================== + +PopupMenuController::PopupMenuController( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::ToolboxController( rServiceManager, Reference< frame::XFrame >(), OUString() ) +{ +} + +// -------------------------------------------------------------------- + +PopupMenuController::~PopupMenuController() +{ +} + +// -------------------------------------------------------------------- +// XInterface +// -------------------------------------------------------------------- + +Any SAL_CALL PopupMenuController::queryInterface( const Type& aType ) throw (RuntimeException) +{ + Any a( ToolboxController::queryInterface( aType ) ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this )); +} + +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::acquire() throw () +{ + ToolboxController::acquire(); +} + +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::release() throw () +{ + ToolboxController::release(); +} + +// -------------------------------------------------------------------- +// XComponent +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::dispose() throw (RuntimeException) +{ + if( mxPopupMenuController.is() ) + { + Reference< XComponent > xComponent( mxPopupMenuController, UNO_QUERY ); + if( xComponent.is() ) + xComponent->dispose(); + mxPopupMenuController.clear(); + } + + mxPopupMenu.clear(); + + svt::ToolboxController::dispose(); +} + +// -------------------------------------------------------------------- +// XStatusListener +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException ) +{ + svt::ToolboxController::statusChanged(rEvent); + enable( rEvent.IsEnabled ); +} + +// -------------------------------------------------------------------- +// XToolbarController +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::execute( sal_Int16 KeyModifier ) throw (RuntimeException) +{ + svt::ToolboxController::execute( KeyModifier ); +} + +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::click() throw (RuntimeException) +{ + svt::ToolboxController::click(); +} + +// -------------------------------------------------------------------- + +void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException) +{ + svt::ToolboxController::doubleClick(); +} + +// -------------------------------------------------------------------- + +bool PopupMenuController::CreatePopupMenuController() throw (Exception) +{ + Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW ); + + Sequence< Any > aSeq( 2 ); + PropertyValue aPropValue; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + aPropValue.Value <<= getModuleName(); + aSeq[0] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropValue.Value <<= m_xFrame; + aSeq[1] <<= aPropValue; + + Reference< XPropertySet > xProps( getServiceManager(), UNO_QUERY_THROW ); + Reference< XComponentContext > xComponentContext( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); + + Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY ); + if ( xPopupMenuController.is() ) + { + mxPopupMenuController = xPopupMenuController; + return true; + } + return false; +} + +Reference< awt::XWindow > SAL_CALL PopupMenuController::createPopupWindow() throw (RuntimeException) +{ + ::vos::OGuard aSolarLock(Application::GetSolarMutex()); + + Reference< awt::XWindow > xRet; + + try + { + ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + if( !pToolBox ) + return xRet; + + // get selected button + USHORT nItemId = pToolBox->GetDownItemId(); + if( !nItemId ) + return xRet; + + ::Rectangle aRect( pToolBox->GetItemRect( nItemId ) ); + + if( !mxPopupMenuController.is() && !CreatePopupMenuController() ) + return xRet; + + if( !mxPopupMenu.is() ) + { + mxPopupMenu = Reference< awt::XPopupMenu >( getServiceManager()->createInstance( DECLARE_ASCII( "stardiv.Toolkit.VCLXPopupMenu" ) ), UNO_QUERY_THROW ); + mxPopupMenuController->setPopupMenu( mxPopupMenu ); + } + else + { + mxPopupMenuController->updatePopupMenu(); + + } + pToolBox->SetItemDown( nItemId, TRUE ); + Reference< awt::XWindowPeer > xPeer( getParent(), UNO_QUERY_THROW ); + mxPopupMenu->execute( xPeer, VCLUnoHelper::ConvertToAWTRect( aRect ), 0 ); + pToolBox->SetItemDown( nItemId, FALSE ); + } + catch( Exception& ) + { + } + + return xRet; +} + +// -------------------------------------------------------------------- + +Reference< awt::XWindow > SAL_CALL PopupMenuController::createItemWindow( const Reference< awt::XWindow >& Parent ) throw (RuntimeException) +{ + return Reference< awt::XWindow >(); +} + +// -------------------------------------------------------------------- + +} + diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx index 2cd0ed891db6..a20f107ea22e 100644 --- a/framework/source/uielement/progressbarwrapper.cxx +++ b/framework/source/uielement/progressbarwrapper.cxx @@ -43,6 +43,7 @@ // interface includes //_________________________________________________________________________________________________________________ #include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index cec95485dacd..64f05ed642cb 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -47,7 +47,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/util/XStringWidth.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ @@ -64,6 +63,7 @@ #include <osl/file.hxx> //#include <tools/solar.hrc> #include <dispatch/uieventloghelper.hxx> +#include <vos/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -105,7 +105,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( RecentFilesMenuController DEFINE_INIT_SERVICE ( RecentFilesMenuController, {} ) RecentFilesMenuController::RecentFilesMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_bDisabled( sal_False ) { } @@ -245,11 +245,11 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) Reference< XDispatchProvider > xDispatchProvider; Reference< XMultiServiceFactory > xServiceManager; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList; @@ -312,7 +312,7 @@ void SAL_CALL RecentFilesMenuController::disposing( const EventObject& ) throw ( { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); @@ -325,7 +325,7 @@ void SAL_CALL RecentFilesMenuController::disposing( const EventObject& ) throw ( // XStatusListener void SAL_CALL RecentFilesMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_bDisabled = !Event.IsEnabled; } @@ -336,11 +336,11 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve Reference< XDispatchProvider > xDispatchProvider; Reference< XMultiServiceFactory > xServiceManager; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; - aLock.unlock(); + aLock.clear(); css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList; @@ -355,7 +355,7 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); impl_setPopupMenu(); } @@ -368,17 +368,16 @@ void RecentFilesMenuController::impl_setPopupMenu() void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeException) { - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); Reference< XDispatch > xDispatch( m_xDispatch ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = m_aCommandURL; m_xURLTransformer->parseStrict( aTargetURL ); - aLock.unlock(); + aLock.clear(); // Add/remove status listener to get a status update once if ( xDispatch.is() ) @@ -395,10 +394,9 @@ Reference< XDispatch > SAL_CALL RecentFilesMenuController::queryDispatch( sal_Int32 /*nFlags*/ ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) return Reference< XDispatch >( static_cast< OWeakObject* >( this ), UNO_QUERY ); @@ -412,10 +410,9 @@ void SAL_CALL RecentFilesMenuController::dispatch( const Sequence< PropertyValue >& /*seqProperties*/ ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) { @@ -448,12 +445,11 @@ void SAL_CALL RecentFilesMenuController::addStatusListener( const URL& aURL ) throw( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); - PopupMenuControllerBase::addStatusListener( xControl, aURL ); + svt::PopupMenuControllerBase::addStatusListener( xControl, aURL ); } void SAL_CALL RecentFilesMenuController::removeStatusListener( @@ -461,7 +457,7 @@ void SAL_CALL RecentFilesMenuController::removeStatusListener( const URL& aURL ) throw( RuntimeException ) { - PopupMenuControllerBase::removeStatusListener( xControl, aURL ); + svt::PopupMenuControllerBase::removeStatusListener( xControl, aURL ); } IMPL_STATIC_LINK_NOINSTANCE( RecentFilesMenuController, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentFile ) diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index 43ad09ffc1ee..dad2775dc453 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -49,7 +49,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> #include <com/sun/star/frame/status/Visibility.hpp> diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index cb9cbb2896f7..0bbdbc339a34 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Command.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx index a5e4263385fa..cf39edec2a7c 100644 --- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx @@ -46,7 +46,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XControlNotificationListener.hpp> #include "com/sun/star/util/XMacroExpander.hpp" #include "com/sun/star/uno/XComponentContext.hpp" diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index d89b81c0f9b6..5da7db82c363 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -75,6 +75,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <comphelper/sequence.hxx> #include <com/sun/star/frame/status/Visibility.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes @@ -1028,6 +1029,10 @@ void ToolBarManager::CreateControllers() aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + aPropValue.Value <<= m_aModuleIdentifier; + aPropertyVector.push_back( makeAny( aPropValue )); + if ( nWidth > 0 ) { aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 02402205bd1c..d0ddeccfab20 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -58,7 +58,6 @@ #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -167,7 +166,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ToolbarsMenuController DEFINE_INIT_SERVICE ( ToolbarsMenuController, {} ) ToolbarsMenuController::ToolbarsMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : - PopupMenuControllerBase( xServiceManager ), + svt::PopupMenuControllerBase( xServiceManager ), m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" )), m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )), m_bModuleIdentified( sal_False ), @@ -563,7 +562,7 @@ void SAL_CALL ToolbarsMenuController::disposing( const EventObject& ) throw ( Ru { Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xDocCfgMgr.clear(); @@ -584,9 +583,9 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev sal_Bool bSetCheckmark = sal_False; sal_Bool bCheckmark = sal_False; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu ); - aLock.unlock(); + aLock.clear(); if ( xPopupMenu.is() ) { @@ -633,13 +632,13 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent Reference< XFrame > xFrame; Reference< XNameAccess > xPersistentWindowState; - ResetableGuard aLock( m_aLock ); + osl::ClearableMutexGuard aLock( m_aMutex ); xPopupMenu = m_xPopupMenu; xServiceManager = m_xServiceManager; xURLTransformer = m_xURLTransformer; xFrame = m_xFrame; xPersistentWindowState = m_xPersistentWindowState; - aLock.unlock(); + aLock.clear(); if ( xPopupMenu.is() ) { @@ -792,7 +791,7 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); Reference< XURLTransformer > xURLTransformer( m_xURLTransformer ); { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); fillPopupMenu( m_xPopupMenu ); aCmdVector = m_aCommandVector; } @@ -829,10 +828,9 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr // XPopupMenuController void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); - if ( m_bDisposed ) - throw DisposedException(); + throwIfDisposed(); if ( m_xFrame.is() && !m_xPopupMenu.is() ) { @@ -848,11 +846,11 @@ void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::X // XInitialization void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ResetableGuard aLock( m_aLock ); + osl::MutexGuard aLock( m_aMutex ); sal_Bool bInitalized( m_bInitialized ); if ( !bInitalized ) { - PopupMenuControllerBase::initialize(aArguments); + svt::PopupMenuControllerBase::initialize(aArguments); if ( m_bInitialized ) { diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 0e73b5616aa7..5a4fb7cddde4 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index ed7e2e131550..29c1947b1149 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -56,7 +56,6 @@ LIB1OBJFILES= \ $(SLO)$/rootitemcontainer.obj \ $(SLO)$/constitemcontainer.obj \ $(SLO)$/jobconst.obj \ - $(SLO)$/popupmenucontrollerbase.obj \ $(SLO)$/mischelper.obj \ $(SLO)$/propertysethelper.obj @@ -196,7 +195,8 @@ SHL3OBJS= $(SLO)$/mediatypedetectionhelper.obj\ $(SLO)$/dispatchrecorder.obj \ $(SLO)$/dispatchrecordersupplier.obj\ $(SLO)$/dispatchhelper.obj \ - $(SLO)$/popupmenudispatcher.obj \ + $(SLO)$/popupmenudispatcher.obj \ + $(SLO)$/popupmenucontroller.obj SHL3STDLIBS= \ $(FWILIB) \ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index b031a480eea4..7273c07310a2 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -183,6 +183,17 @@ <value>com.sum.star.comp.framework.LanguageSelectionMenuController</value> </prop> </node> + <node oor:name="ExtrusionDepthController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExtrusionDepthFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.ExtrusionDepthController</value> + </prop> + </node> </node> <node oor:name="ToolBar"> <node oor:name="c1" oor:op="replace"> @@ -238,7 +249,73 @@ </prop> <prop oor:name="Controller"> <value>com.sun.star.comp.sd.InsertSlideController</value> - </prop> + </prop> + </node> + <node oor:name="ExtrusionDepthController" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExtrusionDepthFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.framework.PopupMenuController</value> + </prop> + </node> + <node oor:name="ExtrusionDirectionFloater" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExtrusionDirectionFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.ExtrusionDirectionController</value> + </prop> + </node> + <node oor:name="ExtrusionLightingFloater" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExtrusionLightingFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.ExtrusionLightingController</value> + </prop> + </node> + <node oor:name="ExtrusionSurfaceFloater" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ExtrusionSurfaceFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.ExtrusionSurfaceController</value> + </prop> + </node> + <node oor:name="FontworkAlignmentFloater" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:FontworkAlignmentFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.FontworkAlignmentController</value> + </prop> + </node> + <node oor:name="FontworkCharacterSpacingFloater" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:FontworkCharacterSpacingFloater</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.svx.FontworkCharacterSpacingController</value> + </prop> </node> <node oor:name="c3" oor:op="replace"> <prop oor:name="Command"> diff --git a/svx/inc/extrusioncontrols.hxx b/svx/inc/extrusioncontrols.hxx deleted file mode 100644 index 7b85820a5f22..000000000000 --- a/svx/inc/extrusioncontrols.hxx +++ /dev/null @@ -1,355 +0,0 @@ -/************************************************************************* - * - * 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 _SVX_EXTRUSION_CONTROLS_HXX -#define _SVX_EXTRUSION_CONTROLS_HXX - -#include "svx/svxdllapi.h" - -#include <svtools/valueset.hxx> -#include <svl/lstner.hxx> -#include <svtools/svtreebx.hxx> -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif -#include <vcl/dialog.hxx> -#include <vcl/field.hxx> -#include <com/sun/star/frame/XFrame.hpp> - -#include "svx/toolbarmenu.hxx" - -class SfxBindings; -class SfxStatusForwarder; - -//======================================================================== - -namespace svx -{ -class ToolboxButtonColorUpdater; - -class ExtrusionDirectionWindow : public ToolbarMenu -{ -private: - ValueSet* mpDirectionSet; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - SfxStatusForwarder* mpDirectionForewarder; - SfxStatusForwarder* mpProjectionForewarder; - - Image maImgDirection[9]; - Image maImgDirectionH[9]; - - Image maImgPerspective; - Image maImgPerspectiveH; - Image maImgParallel; - Image maImgParallelH; - - const rtl::OUString msExtrusionDirection; - const rtl::OUString msExtrusionProjection; - - DECL_LINK( SelectHdl, void * ); - void FillValueSet(); - - void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); - void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDirectionWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDirectionWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDirectionControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDirectionControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDirectionControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthWindow : public ToolbarMenu -{ -private: - Image maImgDepth0; - Image maImgDepth1; - Image maImgDepth2; - Image maImgDepth3; - Image maImgDepth4; - Image maImgDepthInfinity; - - Image maImgDepth0h; - Image maImgDepth1h; - Image maImgDepth2h; - Image maImgDepth3h; - Image maImgDepth4h; - Image maImgDepthInfinityh; - - SfxStatusForwarder* mpDepthForewarder; - SfxStatusForwarder* mpMetricForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - FieldUnit meUnit; - double mfDepth; - bool mbEnabled; - - const rtl::OUString msExtrusionDepth; - const rtl::OUString msMetricUnit; - - DECL_LINK( SelectHdl, void * ); - - void implFillStrings( FieldUnit eUnit ); - void implSetDepth( double fDepth, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionDepthWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionDepthWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionDepthControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionDepthControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionDepthControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionLightingWindow : public ToolbarMenu -{ -private: - ValueSet* mpLightingSet; - - Image maImgLightingOff[9]; - Image maImgLightingOn[9]; - Image maImgLightingPreview[9]; - - Image maImgLightingOffh[9]; - Image maImgLightingOnh[9]; - Image maImgLightingPreviewh[9]; - - Image maImgBright; - Image maImgNormal; - Image maImgDim; - Image maImgBrighth; - Image maImgNormalh; - Image maImgDimh; - - SfxStatusForwarder* mpLightingDirectionForewarder; - SfxStatusForwarder* mpLightingIntensityForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - int mnLevel; - bool mbLevelEnabled; - int mnDirection; - bool mbDirectionEnabled; - - const rtl::OUString msExtrusionLightingDirection; - const rtl::OUString msExtrusionLightingIntensity; - - void implSetIntensity( int nLevel, bool bEnabled ); - void implSetDirection( int nDirection, bool bEnabled ); - void implInit(); - - DECL_LINK( SelectHdl, void * ); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionLightingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionLightingWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionLightingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionLightingControl( USHORT nSlotid, USHORT nId, ToolBox& rTbx ); - ~ExtrusionLightingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionSurfaceWindow : public ToolbarMenu -{ -private: - Image maImgSurface1; - Image maImgSurface2; - Image maImgSurface3; - Image maImgSurface4; - Image maImgSurface1h; - Image maImgSurface2h; - Image maImgSurface3h; - Image maImgSurface4h; - - SfxStatusForwarder* mpSurfaceForewarder; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msExtrusionSurface; - - DECL_LINK( SelectHdl, void * ); - - void implSetSurface( int nSurface, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - ExtrusionSurfaceWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~ExtrusionSurfaceWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionSurfaceControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionSurfaceControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionSurfaceControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl -{ -private: - ToolboxButtonColorUpdater* mpBtnUpdater; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~ExtrusionColorControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//======================================================================== - -class ExtrusionDepthDialog : public ModalDialog -{ - FixedText maFLDepth; - MetricField maMtrDepth; - OKButton maOKButton; - CancelButton maCancelButton; - HelpButton maHelpButton; - - FieldUnit meDefaultUnit; - -public: - ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); - ~ExtrusionDepthDialog(); - - double getDepth() const; -}; - -} -#endif - diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx new file mode 100644 index 000000000000..600e646e8cb6 --- /dev/null +++ b/svx/inc/extrusiondepthdialog.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * 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 _SVX_EXTRUSIONDEPTHDIALOG_HXX +#define _SVX_EXTRUSIONDEPTHDIALOG_HXX + +#include "svx/svxdllapi.h" + +#include <vcl/fixed.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> + +namespace svx { + +class ExtrusionDepthDialog : public ModalDialog +{ + FixedText maFLDepth; + MetricField maMtrDepth; + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + + FieldUnit meDefaultUnit; + +public: + ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit ); + ~ExtrusionDepthDialog(); + + double getDepth() const; +}; + +} + +#endif // _SVX_EXTRUSIONDEPTHDIALOG_HXX + diff --git a/svx/inc/fontworkgallery.hxx b/svx/inc/fontworkgallery.hxx index 31650479636f..40ac3cef966a 100644 --- a/svx/inc/fontworkgallery.hxx +++ b/svx/inc/fontworkgallery.hxx @@ -29,16 +29,17 @@ #ifndef _SVX_FONTWORK_GALLERY_DIALOG_HXX #define _SVX_FONTWORK_GALLERY_DIALOG_HXX -#ifndef _FIXED_HXX //autogen +#include "svx/svxdllapi.h" + #include <vcl/fixed.hxx> -#endif -#include <svtools/valueset.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/dialog.hxx> -#include "svx/svxdllapi.h" -#include "svx/toolbarmenu.hxx" +#include <vcl/field.hxx> + +#include <svtools/valueset.hxx> + +#include <sfx2/tbxctrl.hxx> + #include <vector> class FmFormModel; @@ -56,113 +57,6 @@ class SfxStatusForwarder; namespace svx { -class FontWorkAlignmentWindow : public ToolbarMenu -{ -private: - Image maImgAlgin1; - Image maImgAlgin2; - Image maImgAlgin3; - Image maImgAlgin4; - Image maImgAlgin5; - Image maImgAlgin1h; - Image maImgAlgin2h; - Image maImgAlgin3h; - Image maImgAlgin4h; - Image maImgAlgin5h; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msFontworkAlignment; - - DECL_LINK( SelectHdl, void * ); - - void implSetAlignment( int nAlignmentMode, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkAlignmentWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkAlignmentWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkAlignmentControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkAlignmentControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkAlignmentControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - -class FontWorkCharacterSpacingWindow : public ToolbarMenu -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - - const rtl::OUString msFontworkCharacterSpacing; - const rtl::OUString msFontworkKernCharacterPairs; - - DECL_LINK( SelectHdl, void * ); - - void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); - void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); - void implInit(); - -protected: - /** This function is called when the window gets the focus. It grabs - the focus to the line ends value set so that it can be controlled with - the keyboard. - */ - virtual void GetFocus (void); - -public: - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - FontWorkCharacterSpacingWindow( USHORT nId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ); - ~FontWorkCharacterSpacingWindow(); - - void StartSelection(); - - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -class SVX_DLLPUBLIC FontWorkCharacterSpacingControl : public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - FontWorkCharacterSpacingControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); - ~FontWorkCharacterSpacingControl(); - - virtual void StateChanged( USHORT nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); -}; - -//------------------------------------------------------------------------ - class SVX_DLLPUBLIC FontWorkShapeTypeControl : public SfxToolBoxControl { using SfxToolBoxControl::Select; diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index d193652b57fc..10e0bf3fbed4 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -379,6 +379,19 @@ #define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286) #define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287) +#define RID_SVXIMG_EXTRUSION_DEPTH_0 (RID_SVX_START + 288) +#define RID_SVXIMG_EXTRUSION_DEPTH_1 (RID_SVX_START + 289) +#define RID_SVXIMG_EXTRUSION_DEPTH_2 (RID_SVX_START + 290) +#define RID_SVXIMG_EXTRUSION_DEPTH_3 (RID_SVX_START + 291) +#define RID_SVXIMG_EXTRUSION_DEPTH_4 (RID_SVX_START + 292) +#define RID_SVXIMG_EXTRUSION_DEPTH_0_H (RID_SVX_START + 293) +#define RID_SVXIMG_EXTRUSION_DEPTH_1_H (RID_SVX_START + 294) +#define RID_SVXIMG_EXTRUSION_DEPTH_2_H (RID_SVX_START + 295) +#define RID_SVXIMG_EXTRUSION_DEPTH_3_H (RID_SVX_START + 296) +#define RID_SVXIMG_EXTRUSION_DEPTH_4_H (RID_SVX_START + 297) +#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY (RID_SVX_START + 298) +#define RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H (RID_SVX_START + 299) + // !!! please update RID_SVX_FIRSTFREE !!! see line 46 // Strings ------------------------------------------------------------------ @@ -612,6 +625,9 @@ #define RID_SVXSTR_SEABLUE (RID_SVX_START + 546) #define RID_SVXSTR_COLOR_SUN (RID_SVX_START + 547) +#define RID_SVXSTR_EXTRUSION_CUSTOM (RID_SVX_START + 548) +#define RID_SVXSTR_EXTRUSION_INFINITY (RID_SVX_START + 549) + // JP: string resource ids for table-autoformat-names, used in SW/SC // !!! Urgent: the order of Ids is persistent. New Ids have to append !!! #define RID_SVXSTR_TBLAFMT_BEGIN (RID_SVX_START + 560) diff --git a/svx/inc/svx/extrusioncolorcontrol.hxx b/svx/inc/svx/extrusioncolorcontrol.hxx new file mode 100644 index 000000000000..ff4a53e65a41 --- /dev/null +++ b/svx/inc/svx/extrusioncolorcontrol.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 _SVX_EXTRUSIONCOLORCONTROL_HXX +#define _SVX_EXTRUSIONCOLORCONTROL_HXX + +#include <sfx2/tbxctrl.hxx> +#include "svx/svxdllapi.h" +#include "svx/tbxcolorupdate.hxx" + +namespace svx { + +class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl +{ +private: + ToolboxButtonColorUpdater* mpBtnUpdater; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + ExtrusionColorControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ); + ~ExtrusionColorControl(); + + virtual void StateChanged( USHORT nSID, SfxItemState eState, + const SfxPoolItem* pState ); + virtual SfxPopupWindowType GetPopupWindowType() const; + virtual SfxPopupWindow* CreatePopupWindow(); +}; + +} + +#endif // _SVX_EXTRUSIONCOLORCONTROL_HXX + diff --git a/svx/inc/svx/toolbarmenu.hxx b/svx/inc/svx/toolbarmenu.hxx deleted file mode 100644 index a0f5aa55c6d0..000000000000 --- a/svx/inc/svx/toolbarmenu.hxx +++ /dev/null @@ -1,170 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: colrctrl.hxx,v $ - * $Revision: 1.3.76.1 $ - * - * 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 _SVX_TOOLBARMENU_HXX_ -#define _SVX_TOOLBARMENU_HXX_ - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XFrame.hpp> - -#include <vector> - -#include <rtl/ref.hxx> - -#include <vcl/ctrl.hxx> -#include <vcl/menu.hxx> -#include <vcl/dockwin.hxx> - -#include <svtools/framestatuslistener.hxx> - -#include <sfx2/tbxctrl.hxx> - - -#include "svx/svxdllapi.h" - -class ToolbarMenuEntry; - -typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; - -class SVX_DLLPUBLIC ToolbarMenu : public DockingWindow -{ - friend class ToolbarMenuStatusListener; -public: - ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - WinBits nBits ); - - ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - const ResId& rResId ); - - ~ToolbarMenu(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - - void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); - void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); -// void appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits = 0 ); - void appendSeparator(); - - void checkEntry( int nEntryId, bool bCheck = true ); - bool isEntryChecked( int nEntryId ) const; - - void enableEntry( int nEntryId, bool bEnable = true ); - bool isEntryEnabled( int nEntryId ) const; - - void setEntryText( int nEntryId, const String& rStr ); - const String& getEntryText( int nEntryId ) const; - - void setEntryImage( int nEntryId, const Image& rImage ); - const Image& getEntryImage( int nEntryId ) const; - - const Size& getMenuSize() const { return maSize; } - - void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; } - const Link& GetHighlightHdl() const { return maHighlightHdl; } - - void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } - const Link& GetSelectHdl() const { return maSelectHdl; } - - int getSelectedEntryId() const; - int getHighlightedEntryId() const; - -protected: - // todo: move to new base class that will replace SfxPopupWindo - void AddStatusListener( const rtl::OUString& rCommandURL ); - void RemoveStatusListener( const rtl::OUString& rCommandURL ); - void UpdateStatus( const rtl::OUString& rCommandURL ); - - bool IsInPopupMode(); - void EndPopupMode(); - - // XStatusListener (subclasses must override this one to get the status updates - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const { return mxFrame; } -private: - void initStatusListener(); - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; - rtl::Reference< svt::FrameStatusListener > mxStatusListener; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; - - ToolbarMenuEntryVector maEntryVector; - - int mnCheckPos; - int mnImagePos; - int mnTextPos; - - int mnHighlightedEntry; - int mnSelectedEntry; - - Size maSize; - - Link maHighlightHdl; - Link maSelectHdl; - - void implInit(); - - void initWindow(); - - Size implCalcSize(); - - void appendEntry( ToolbarMenuEntry* pEntry ); - - void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); -// void implDrawBorder(); - - void implHighlightEntry( int nHighlightEntry, bool bHighlight ); - void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); - - void implChangeHighlightEntry( int nEntry ); - void implSelectEntry( int nSelectedEntry ); - - ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); - ToolbarMenuEntry* implGetEntry( int nEntry ) const; - ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; -}; - -#endif diff --git a/svx/prj/build.lst b/svx/prj/build.lst index 5b99711edaa2..dd56a2c59e83 100644 --- a/svx/prj/build.lst +++ b/svx/prj/build.lst @@ -30,8 +30,9 @@ sx svx\source\unodraw nmake - all sx_undrw sx_inc NULL sx svx\source\unogallery nmake - all sx_ungal sx_inc NULL sx svx\source\gallery2 nmake - all sx_gall sx_inc NULL sx svx\source\xml nmake - all sx_xml sx_inc NULL +sx svx\source\core nmake - all sx_core sx_inc NULL sx svx\source\accessibility nmake - all sx_accessibility sx_inc NULL sx svx\source\customshapes nmake - all sx_customshapes sx_inc NULL sx svx\source\toolbars nmake - all sx_toolbars sx_inc NULL -sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL +sx svx\util nmake - all sx_util sx_3deng sx_dlg sx_draw sx_attribute sx_properties sx_contact sx_event sx_animation sx_primitive2d sx_primitive3d sx_overlay sx_fmcmp sx_form sx_gall sx_items sx_mnuc sx_sdi sx_stbc sx_tbxc sx_undrw sx_ungal sx_xml sx_core sx_xout sx_accessibility sx_intro sx_customshapes sx_toolbars sx_table sx_smarttags NULL sx svx\source\gengal nmake - all sx_gengal sx_util NULL diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 537193f3190b..9d9c9fbbf6c7 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -69,7 +69,6 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\editstat.hxx %_DEST%\inc%_EXT%\svx\editstat.hxx ..\inc\editund2.hxx %_DEST%\inc%_EXT%\svx\editund2.hxx ..\inc\eerdll.hxx %_DEST%\inc%_EXT%\svx\editdll.hxx -..\inc\extrusioncontrols.hxx %_DEST%\inc%_EXT%\svx\extrusioncontrols.hxx ..\inc\flstitem.hxx %_DEST%\inc%_EXT%\svx\flstitem.hxx ..\inc\fmgridif.hxx %_DEST%\inc%_EXT%\svx\fmgridif.hxx ..\inc\fmobjfac.hxx %_DEST%\inc%_EXT%\svx\fmobjfac.hxx @@ -484,7 +483,7 @@ mkdir: %_DEST%\inc%_EXT%\svx ..\inc\svx\viewlayoutitem.hxx %_DEST%\inc%_EXT%\svx\viewlayoutitem.hxx ..\inc\svx\zoomslideritem.hxx %_DEST%\inc%_EXT%\svx\zoomslideritem.hxx ..\inc\svx\zoomsliderctrl.hxx %_DEST%\inc%_EXT%\svx\zoomsliderctrl.hxx - +..\inc\svx\extrusioncolorcontrol.hxx %_DEST%\inc%_EXT%\svx\extrusioncolorcontrol.hxx ..\inc\svx\itemtype.hxx %_DEST%\inc%_EXT%\svx\itemtype.hxx ..\inc\svx\outliner.hxx %_DEST%\inc%_EXT%\svx\outliner.hxx @@ -686,7 +685,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx -..\inc\svx\toolbarmenu.hxx %_DEST%\inc%_EXT%\svx\toolbarmenu.hxx ..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* diff --git a/svx/source/core/coreservices.cxx b/svx/source/core/coreservices.cxx new file mode 100644 index 000000000000..1f1d69781756 --- /dev/null +++ b/svx/source/core/coreservices.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +/** this file contains the uno service registrations for all services in the svxcore lib */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include "sal/types.h" +#include "osl/diagnose.h" +#include "cppuhelper/factory.hxx" +#include "uno/lbnames.h" + +using rtl::OUString; + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::registry; + +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDepthController_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionDirectionControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionDirectionControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionLightingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionLightingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL ExtrusionSurfaceControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkAlignmentControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkAlignmentControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ); + +extern OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName(); +extern Reference< XInterface > SAL_CALL FontWorkCharacterSpacingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException ); +extern Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ); +} + +extern "C" +{ + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +static void writeInfo ( + XRegistryKey * pRegistryKey, + const OUString& rImplementationName, + const Sequence< OUString >& rServices) +{ + Reference< XRegistryKey > xNewKey( + pRegistryKey->createKey( + OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); + + for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) + xNewKey->createKey( rServices.getConstArray()[i]); +} + +SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( + void * , void * pRegistryKey) +{ + if( pRegistryKey ) + { + try + { + XRegistryKey *pKey = reinterpret_cast< XRegistryKey * >( pRegistryKey ); + + writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionDirectionControl_getImplementationName(),::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionLightingControl_getImplementationName(),::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::ExtrusionSurfaceControl_getImplementationName(),::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkAlignmentControl_getImplementationName(),::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + writeInfo( pKey, ::svx::FontWorkCharacterSpacingControl_getImplementationName(),::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } + catch (InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return sal_True; +} + +SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( + const sal_Char * pImplName, void * pServiceManager, void * ) +{ + void * pRet = 0; + if( pServiceManager ) + { + Reference< XSingleServiceFactory > xFactory; + + if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionDirectionControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDirectionControl_getImplementationName(), + ::svx::ExtrusionDirectionControl_createInstance, + ::svx::ExtrusionDirectionControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionLightingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionLightingControl_getImplementationName(), + ::svx::ExtrusionLightingControl_createInstance, + ::svx::ExtrusionLightingControl_getSupportedServiceNames() ); + } + else if( ::svx::ExtrusionSurfaceControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionSurfaceControl_getImplementationName(), + ::svx::ExtrusionSurfaceControl_createInstance, + ::svx::ExtrusionSurfaceControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkAlignmentControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkAlignmentControl_getImplementationName(), + ::svx::FontWorkAlignmentControl_createInstance, + ::svx::FontWorkAlignmentControl_getSupportedServiceNames() ); + } + else if( ::svx::FontWorkCharacterSpacingControl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + ::svx::FontWorkCharacterSpacingControl_getImplementationName(), + ::svx::FontWorkCharacterSpacingControl_createInstance, + ::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() ); + } if( xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} + +} diff --git a/svx/source/core/makefile.mk b/svx/source/core/makefile.mk new file mode 100644 index 000000000000..da874894bae6 --- /dev/null +++ b/svx/source/core/makefile.mk @@ -0,0 +1,47 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svx +TARGET=core +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES = \ + $(SLO)$/coreservices.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index 7be1d857b028..2fdc95bb28fb 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -32,9 +32,14 @@ #include <string> // HACK: prevent conflict between STLPORT and Workshop headers -#ifndef _TOOLBOX_HXX //autogen +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/awt/MenuItemStyle.hpp> +#include <com/sun/star/awt/XPopupMenuExtended.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> + +#include <vos/mutex.hxx> + #include <vcl/toolbox.hxx> -#endif #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -42,30 +47,35 @@ #include <vcl/settings.hxx> #include <svl/intitem.hxx> #include <editeng/colritem.hxx> -#include "chrtitem.hxx" #include <tools/urlobj.hxx> #include <svx/dialogs.hrc> -#include "helpid.hrc" - #include <svx/svdtrans.hxx> +#include <svx/sdasitm.hxx> #include <svx/dialmgr.hxx> +#include "svx/extrusioncolorcontrol.hxx" + +//#include "chrtitem.hxx" +#include "helpid.hrc" #include "extrusioncontrols.hxx" #include "extrusioncontrols.hrc" -#include <svx/sdasitm.hxx> -#include "svx/toolbarmenu.hxx" #include "colorwindow.hxx" - -#include <svx/tbxcolorupdate.hxx> +#include "extrusiondepthdialog.hxx" //////////// -using namespace svx; +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +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::util; +using namespace ::com::sun::star::graphic; -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); +namespace svx +{ /************************************************************************* |* @@ -75,9 +85,9 @@ SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDirectionControl, SfxBoolItem ); static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 }; -ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) -, mxFrame( rFrame ) +, mrController( rController ) , maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ) , maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) ) , maImgParallel( SVX_RES( IMG_PARALLEL ) ) @@ -85,12 +95,7 @@ ExtrusionDirectionWindow::ExtrusionDirectionWindow( USHORT /*nId*/, const ::com: , msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) ) , msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) ) { - implInit(); -} - -void ExtrusionDirectionWindow::implInit() -{ - SetHelpId( HID_POPUP_EXTRUSION_DIRECTION ); + SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); USHORT i; for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) @@ -99,13 +104,8 @@ void ExtrusionDirectionWindow::implInit() maImgDirectionH[i] = Image( SVX_RES( IMG_DIRECTION_H + i ) ); } -// mpDirectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_DIRECTION, *this ); -// mpProjectionForewarder = new SfxStatusForwarder( SID_EXTRUSION_PROJECTION, *this ); - -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DIRECTION ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); - mpDirectionSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); + mpDirectionSet = createEmptyValueSetControl(); mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION ); mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) ); @@ -122,15 +122,11 @@ void ExtrusionDirectionWindow::implInit() mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) ); - /*mpMenu->*/appendEntry( 2, mpDirectionSet ); - /*mpMenu->appendSeparator()*/; - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); + appendEntry( 2, mpDirectionSet ); + appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective ); + appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel ); - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); - - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -146,26 +142,18 @@ void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt ) { bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - USHORT i; - for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) + for( USHORT i = DIRECTION_NW; i <= DIRECTION_SE; i++ ) { mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] ); } - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); + setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective ); + setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel ); } } // ----------------------------------------------------------------------- -ExtrusionDirectionWindow::~ExtrusionDirectionWindow() -{ - //delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled ) { if( mpDirectionSet ) @@ -186,23 +174,17 @@ void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled mpDirectionSet->SetNoSelection(); } } -// if( mpMenu ) - { - /*mpMenu->*/enableEntry( 2, bEnabled ); - } + enableEntry( 2, bEnabled ); } // ----------------------------------------------------------------------- void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled ) { -// if( mpMenu ) - { - /*mpMenu->*/checkEntry( 0, (nProjection == 0) && bEnabled ); - /*mpMenu->*/checkEntry( 1, (nProjection == 1 ) && bEnabled ); - /*mpMenu->*/enableEntry( 0, bEnabled ); - /*mpMenu->*/enableEntry( 1, bEnabled ); - } + checkEntry( 0, (nProjection == 0) && bEnabled ); + checkEntry( 1, (nProjection == 1 ) && bEnabled ); + enableEntry( 0, bEnabled ); + enableEntry( 1, bEnabled ); } // ----------------------------------------------------------------------- @@ -244,48 +226,24 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - if( pControl == mpDirectionSet ) { - sal_Int32 nSkew = gSkewList[mpDirectionSet->GetSelectItemId()-1]; - - SfxInt32Item aItem( SID_EXTRUSION_DIRECTION, nSkew ); - rtl::OUString aCommand( msExtrusionDirection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1]; -// pDisp->Execute( SID_EXTRUSION_DIRECTION, SFX_CALLMODE_RECORD, &aItem, 0L , 0L ); + mrController.dispatchCommand( msExtrusionDirection, aArgs ); } else { - int nProjection = /*mpMenu->*/getSelectedEntryId(); + int nProjection = getSelectedEntryId(); if( (nProjection >= 0) && (nProjection < 2 ) ) { - SfxInt32Item aItem( SID_EXTRUSION_PROJECTION, nProjection ); - rtl::OUString aCommand( msExtrusionProjection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msExtrusionProjection.copy(5); + aArgs[0].Value <<= (sal_Int32)nProjection; + + mrController.dispatchCommand( msExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); } } @@ -293,78 +251,61 @@ IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +/************************************************************************* +|* +|* SvxLineEndToolBoxControl +|* +\************************************************************************/ -void ExtrusionDirectionWindow::FillValueSet() +ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::StartSelection() +::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent ) { - mpDirectionSet->StartSelection(); + return new ExtrusionDirectionWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -void ExtrusionDirectionWindow::GetFocus (void) -{ - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - if( mpDirectionSet ) - mpDirectionSet->GrabFocus(); -} - -/************************************************************************* -|* -|* SvxLineEndToolBoxControl -|* -\************************************************************************/ - -ExtrusionDirectionControl::ExtrusionDirectionControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionDirectionControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionDirectionControl::~ExtrusionDirectionControl() +Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionDirectionControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionDirectionControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionDirectionControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionDirectionWindow* pWin = new ExtrusionDirectionWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); -// pWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_ALLOWTEAROFF ); - pWin->StartSelection(); - // SetPopupWindow( pWin ); -// return pWin; - return 0; + return ExtrusionDirectionControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionDirectionControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionDirectionControl_getSupportedServiceNames(); } // #################################################################### @@ -396,127 +337,151 @@ double ExtrusionDepthDialog::getDepth() const // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionDepthControl, SfxBoolItem ); - -ExtrusionDepthWindow::ExtrusionDepthWindow( USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH )), - maImgDepth0( SVX_RES( IMG_DEPTH_0 ) ), - maImgDepth1( SVX_RES( IMG_DEPTH_1 ) ), - maImgDepth2( SVX_RES( IMG_DEPTH_2 ) ), - maImgDepth3( SVX_RES( IMG_DEPTH_3 ) ), - maImgDepth4( SVX_RES( IMG_DEPTH_4 ) ), - maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) ), - maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) ), - maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) ), - maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) ), - maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) ), - maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) ), - maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) ), - mxFrame( rFrame ), - mfDepth( -1.0 ), - mbEnabled( false ), - msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ), - msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) +double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; +double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; + +ExtrusionDepthController::ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) +: svt::PopupMenuControllerBase( xServiceManager ) +, mfDepth( -1.0 ) +, msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) ) +, msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) ) { - implInit(); + for( int i = 0; i < 5; i++ ) + { + maImgDepth[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0 + i ) ); + maImgDepth_hc[i] = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_0_H + i ) ); + } + + maImgDepthInfinity = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY ) ); + maImgDepthInfinityh = Image( SVX_RES( RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H ) ); } -void ExtrusionDepthWindow::implInit() +// XPopupMenuController +void SAL_CALL ExtrusionDepthController::updatePopupMenu() throw (RuntimeException) { - SetHelpId( HID_POPUP_EXTRUSION_DEPTH ); + const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); + bool bShowImages( rSettings.GetUseImagesInMenus() ); + bool bHiContrast( rSettings.GetHighContrastMode() ); -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_DEPTH ); + updateCommand( msExtrusionDepth ); + updateCommand( msMetricUnit ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) ); + Reference< awt::XPopupMenuExtended > xPopupMenu( m_xPopupMenu, UNO_QUERY ); + if( xPopupMenu.is() ) + { + // clear existing entries + if( m_xPopupMenu->getItemCount() ) + m_xPopupMenu->removeItem( 0, m_xPopupMenu->getItemCount() ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); + USHORT nResource = IsMetric( meUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; - String aEmpty; - /*mpMenu->*/appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 ); - /*mpMenu->*/appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 ); - /*mpMenu->*/appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 ); - /*mpMenu->*/appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 ); - /*mpMenu->*/appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 ); - /*mpMenu->*/appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - /*mpMenu->*/appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) ); + Reference< XGraphic > xGraphic; - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); -// mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + for( int i = 0; i < 5; i++ ) + { + OUString aStr( String( SVX_RES( nResource + i ) ) ); + m_xPopupMenu->insertItem( i+1, aStr, awt::MenuItemStyle::CHECKABLE, i+1 ); + if( bShowImages ) + { + if( bHiContrast ) + xGraphic = maImgDepth_hc[i].GetXGraphic(); + else + xGraphic = maImgDepth[i].GetXGraphic(); + } + xPopupMenu->setItemImage( i+1, xGraphic, sal_False ); -// mpMenu->Show(); + xPopupMenu->checkItem( i+1, (mfDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i])) ? TRUE : FALSE ); + } - FreeResource(); + if( bShowImages ) + { + if( bHiContrast ) + xGraphic = maImgDepthInfinityh.GetXGraphic(); + else + xGraphic = maImgDepthInfinity.GetXGraphic(); + } + m_xPopupMenu->insertItem( 6, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_INFINITY ) ) ), awt::MenuItemStyle::CHECKABLE, 6 ); + xPopupMenu->setItemImage( 6, xGraphic, sal_False ); + xPopupMenu->checkItem( 6, (mfDepth >= 338666) ? TRUE : FALSE ); - AddStatusListener( msExtrusionDepth ); - AddStatusListener( msMetricUnit ); + m_xPopupMenu->insertItem( 7, OUString( String( SVX_RES( RID_SVXSTR_EXTRUSION_CUSTOM ) ) ), awt::MenuItemStyle::CHECKABLE, 7 ); + } } // ----------------------------------------------------------------------- -ExtrusionDepthWindow::~ExtrusionDepthWindow() +ExtrusionDepthController::~ExtrusionDepthController() { -// delete mpMenu; } // ----------------------------------------------------------------------- +// XEventListener +// ----------------------------------------------------------------------- -double aDepthListInch[] = { 0, 1270,2540,5080,10160 }; -double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 }; - -void ExtrusionDepthWindow::implSetDepth( double fDepth, bool bEnabled ) +void SAL_CALL ExtrusionDepthController::disposing( const EventObject& ) throw ( RuntimeException ) { - mbEnabled = bEnabled; - mfDepth = fDepth; -// if( mpMenu ) - { - int i; - for( i = 0; i < 7; i++ ) - { - if( i == 5 ) - { - /*mpMenu->*/checkEntry( i, (fDepth >= 338666) && bEnabled ); - } - else if( i != 6 ) - { - /*mpMenu->*/checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) && bEnabled ) ); - } - /*mpMenu->*/enableEntry( i, bEnabled ); - } - } + Reference< awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); + + osl::MutexGuard aLock( m_aMutex ); + m_xFrame.clear(); + m_xDispatch.clear(); + m_xServiceManager.clear(); + + if ( m_xPopupMenu.is() ) + m_xPopupMenu->removeMenuListener( Reference< awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); + m_xPopupMenu.clear(); } // ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit ) +OUString SAL_CALL ExtrusionDepthController_getImplementationName() { - meUnit = eUnit; - USHORT nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH; + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" )); +} - for( int i = 0; i < 5; i++ ) - { - String aStr( SVX_RES( nResource + i ) ); - /*mpMenu->*/setEntryText( i, aStr ); - }; +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException ) +{ + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" )); + return aSNS; +} + +// -------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) +{ + return *new ExtrusionDepthController( rSMgr ); +} + +// -------------------------------------------------------------------- + +OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getImplementationName(); +} + +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException) +{ + return ExtrusionDepthController_getSupportedServiceNames(); } // ----------------------------------------------------------------------- +// XStatusListener +// ----------------------------------------------------------------------- -void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +void SAL_CALL ExtrusionDepthController::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) { if( Event.FeatureURL.Main.equals( msExtrusionDepth ) ) { - if( !Event.IsEnabled ) - { - implSetDepth( 0, false ); - } - else + if( Event.IsEnabled ) { - double fValue = 0.0; - if( Event.State >>= fValue ) - implSetDepth( fValue, true ); + Event.State >>= mfDepth; } } else if( Event.FeatureURL.Main.equals( msMetricUnit ) ) @@ -525,199 +490,91 @@ void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame { sal_Int32 nValue = 0; if( Event.State >>= nValue ) - { - implFillStrings( static_cast<FieldUnit>(nValue) ); - if( mfDepth >= 0.0 ) - implSetDepth( mfDepth, mbEnabled ); - } + meUnit = (FieldUnit)nValue; } } } // ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 ); - /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 ); - /*mpMenu->*/setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 ); - /*mpMenu->*/setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 ); - /*mpMenu->*/setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity ); - } -} - - +// XMenuListener // ----------------------------------------------------------------------- -IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG ) +void SAL_CALL ExtrusionDepthController::select( const awt::MenuEvent& rEvent ) throw (RuntimeException) { -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - int nSelected = /*mpMenu->*/getSelectedEntryId(); - if( nSelected != -1 ) + if( rEvent.MenuId ) { - if( nSelected == 6 ) + if( rEvent.MenuId == 7 ) { - if ( IsInPopupMode() ) - EndPopupMode(); + const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); - SvxDoubleItem aDepthItem( mfDepth, SID_EXTRUSION_DEPTH ); - SfxUInt16Item aMetricItem( - SID_ATTR_METRIC, sal::static_int_cast< UINT16 >( meUnit ) ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" )); - - Any a; Sequence< PropertyValue > aArgs( 2 ); aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" )); - aDepthItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Value <<= mfDepth; aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" )); - aMetricItem.QueryValue( a ); - aArgs[1].Value = a; + aArgs[1].Value <<= (sal_Int32)meUnit; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + dispatchCommand( aCommand, aArgs ); } else { double fDepth; - if( nSelected == 5 ) + if( rEvent.MenuId == 6 ) { fDepth = 338666.6; } else { - fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected]; + fDepth = IsMetric( meUnit ) ? aDepthListMM[rEvent.MenuId-1] : aDepthListInch[rEvent.MenuId-1]; } - SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH ); - rtl::OUString aCommand( msExtrusionDepth ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - implSetDepth( fDepth, true ); - - if ( IsInPopupMode() ) - EndPopupMode(); + aArgs[0].Name = msExtrusionDepth.copy(5); + aArgs[0].Value <<= fDepth; + + dispatchCommand( msExtrusionDepth, aArgs ); } } - return 0; } // ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::StartSelection() -{ -} - +// XInitialization // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionDepthWindow::GetFocus (void) +void SAL_CALL ExtrusionDepthController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - //if( mpMenu ) - /*mpMenu->*/GrabFocus(); -} - -// ======================================================================== - -ExtrusionDepthControl::ExtrusionDepthControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); -} - -// ----------------------------------------------------------------------- - -ExtrusionDepthControl::~ExtrusionDepthControl() -{ -} - -// ----------------------------------------------------------------------- - -SfxPopupWindowType ExtrusionDepthControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} + osl::MutexGuard aLock( m_aMutex ); -// ----------------------------------------------------------------------- - -SfxPopupWindow* ExtrusionDepthControl::CreatePopupWindow() -{ - ExtrusionDepthWindow* pWin = new ExtrusionDepthWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + sal_Bool bInitalized( m_bInitialized ); + if ( !bInitalized ) + { + svt::PopupMenuControllerBase::initialize( aArguments ); + m_aBaseURL = ::rtl::OUString(); + } } - // ----------------------------------------------------------------------- -void ExtrusionDepthControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) -{ - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); -} // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionLightingControl, SfxBoolItem ); - // ------------------------------------------------------------------------- -ExtrusionLightingWindow::ExtrusionLightingWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ) ), - maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ), - maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ), - maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ), - maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ), - maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ), - maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ), - mxFrame( rFrame ), - mnLevel( 0 ), - mbLevelEnabled( false ), - mnDirection( FROM_FRONT ), - mbDirectionEnabled( false ), - msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )), - msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) -{ - implInit(); -} - -// ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::implInit() +ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING )) +, mrController( rController ) +, maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) ) +, maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) ) +, maImgDim( SVX_RES( IMG_LIGHTING_DIM ) ) +, maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) ) +, maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) ) +, maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) ) +, mnLevel( 0 ) +, mbLevelEnabled( false ) +, mnDirection( FROM_FRONT ) +, mbDirectionEnabled( false ) +, msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" )) +, msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" )) { - SetHelpId( HID_POPUP_EXTRUSION_LIGHTING ); - USHORT i; for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ ) { @@ -732,11 +589,10 @@ void ExtrusionLightingWindow::implInit() maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) ); } -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); + SetHelpId( HID_MENU_EXTRUSION_LIGHTING ); + SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); - mpLightingSet = new ValueSet( /*mpMenu->*/this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + mpLightingSet = createEmptyValueSetControl(); mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING ); mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) ); @@ -758,16 +614,12 @@ void ExtrusionLightingWindow::implInit() } mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) ); - /*mpMenu->*/appendEntry( 3, mpLightingSet ); - /*mpMenu->appendSeparator();*/ - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 3, mpLightingSet ); + appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright ); + appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal ); + appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim ); - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -777,13 +629,6 @@ void ExtrusionLightingWindow::implInit() // ----------------------------------------------------------------------- -ExtrusionLightingWindow::~ExtrusionLightingWindow() -{ - //delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) { mnLevel = nLevel; @@ -791,8 +636,8 @@ void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled ) int i = 0; for( i = 0; i < 3; i++ ) { - /*mpMenu->*/checkEntry( i, (i == nLevel) && bEnabled ); - /*mpMenu->*/enableEntry( i, bEnabled ); + checkEntry( i, (i == nLevel) && bEnabled ); + enableEntry( i, bEnabled ); } } @@ -828,7 +673,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) } } - /*mpMenu->*/enableEntry( 3, bEnabled ); + enableEntry( 3, bEnabled ); } // ----------------------------------------------------------------------- @@ -874,9 +719,9 @@ void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt ) bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); implSetDirection( mnDirection, mbDirectionEnabled ); - /*mpMenu->*/setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); - /*mpMenu->*/setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); - /*mpMenu->*/setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); + setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright ); + setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal ); + setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim ); } } @@ -887,29 +732,18 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - if( pControl == /*mpMenu->*/this ) + if( pControl == this ) { - int nLevel = /*mpMenu->*/getSelectedEntryId(); + int nLevel = getSelectedEntryId(); if( nLevel >= 0 ) { if( nLevel != 3 ) { - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_INTENSITY, nLevel ); - rtl::OUString aCommand( msExtrusionLightingIntensity ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingIntensity.copy(5); + aArgs[0].Value <<= (sal_Int32)nLevel; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs ); implSetIntensity( nLevel, true ); } @@ -923,20 +757,11 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) { nDirection--; - SfxInt32Item aItem( SID_EXTRUSION_LIGHTING_DIRECTION, nDirection ); - rtl::OUString aCommand( msExtrusionLightingDirection ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionLightingDirection.copy(5); + aArgs[0].Value <<= (sal_Int32)nDirection; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionLightingDirection, aArgs ); implSetDirection( nDirection, true ); } @@ -946,110 +771,85 @@ IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionLightingWindow::StartSelection() +ExtrusionLightingControl::ExtrusionLightingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) ) { } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionLightingWindow::GetFocus (void) +::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. -// if( mpMenu ) - /*mpMenu->*/GrabFocus(); -} - -// ======================================================================== - -ExtrusionLightingControl::ExtrusionLightingControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); } // ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -ExtrusionLightingControl::~ExtrusionLightingControl() +OUString SAL_CALL ExtrusionLightingControl_getImplementationName() { + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionLightingControl::GetPopupWindowType() const +Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionLightingControl::CreatePopupWindow() +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - ExtrusionLightingWindow* pWin = new ExtrusionLightingWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return *new ExtrusionLightingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionLightingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +OUString SAL_CALL ExtrusionLightingControl::getImplementationName( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionLightingControl_getImplementationName(); } -// #################################################################### +// -------------------------------------------------------------------- -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionSurfaceControl, SfxBoolItem ); - -ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )), - maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ), - maImgSurface2( SVX_RES( IMG_MATTE ) ), - maImgSurface3( SVX_RES( IMG_PLASTIC ) ), - maImgSurface4( SVX_RES( IMG_METAL ) ), - maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ), - maImgSurface2h( SVX_RES( IMG_MATTE_H ) ), - maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ), - maImgSurface4h( SVX_RES( IMG_METAL_H ) ), - mxFrame( rFrame ), - msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) +Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames( ) throw (RuntimeException) { - implInit(); + return ExtrusionLightingControl_getSupportedServiceNames(); } -// ----------------------------------------------------------------------- +// #################################################################### -void ExtrusionSurfaceWindow::implInit() +ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE )) +, mrController( rController ) +, maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) ) +, maImgSurface2( SVX_RES( IMG_MATTE ) ) +, maImgSurface3( SVX_RES( IMG_PLASTIC ) ) +, maImgSurface4( SVX_RES( IMG_METAL ) ) +, maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) ) +, maImgSurface2h( SVX_RES( IMG_MATTE_H ) ) +, maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) ) +, maImgSurface4h( SVX_RES( IMG_METAL_H ) ) +, msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" )) { - SetHelpId( HID_POPUP_EXTRUSION_SURFACE ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); -// mpMenu = new ToolbarMenu( this, WB_CLIPCHILDREN ); - /*mpMenu->*/SetHelpId( HID_MENU_EXTRUSION_SURFACE ); - /*mpMenu->*/SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); + SetHelpId( HID_MENU_EXTRUSION_SURFACE ); + SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) ); - SetOutputSizePixel( /*mpMenu->*/getMenuSize() ); - //mpMenu->SetOutputSizePixel( GetOutputSizePixel() ); + appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); + appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); + appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); + appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - //mpMenu->Show(); + SetOutputSizePixel( getMenuSize() ); FreeResource(); @@ -1058,13 +858,6 @@ void ExtrusionSurfaceWindow::implInit() // ----------------------------------------------------------------------- -ExtrusionSurfaceWindow::~ExtrusionSurfaceWindow() -{ -// delete mpMenu; -} - -// ----------------------------------------------------------------------- - void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) { // if( mpMenu ) @@ -1072,8 +865,8 @@ void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled ) int i; for( i = 0; i < 4; i++ ) { - /*mpMenu->*/checkEntry( i, (i == nSurface) && bEnabled ); - /*mpMenu->*/enableEntry( i, bEnabled ); + checkEntry( i, (i == nSurface) && bEnabled ); + enableEntry( i, bEnabled ); } } } @@ -1099,47 +892,19 @@ void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::fra // ----------------------------------------------------------------------- -void ExtrusionSurfaceWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - /*mpMenu->*/appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 ); - /*mpMenu->*/appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 ); - /*mpMenu->*/appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 ); - /*mpMenu->*/appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 ); - } -} - -// ----------------------------------------------------------------------- - IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) { if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - - sal_Int32 nSurface = /*mpMenu->*/getSelectedEntryId(); + sal_Int32 nSurface = getSelectedEntryId(); if( nSurface >= 0 ) { - SfxInt32Item aItem( SID_EXTRUSION_SURFACE, nSurface ); - rtl::OUString aCommand( msExtrusionSurface ); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msExtrusionSurface.copy(5); + aArgs[0].Value <<= (sal_Int32)nSurface; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msExtrusionSurface, aArgs ); implSetSurface( nSurface, true ); } @@ -1147,65 +912,57 @@ IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void ExtrusionSurfaceWindow::StartSelection() +ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) ) ) { } // ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- - -void ExtrusionSurfaceWindow::GetFocus (void) +::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - //if( mpMenu ) - /*mpMenu->*/GrabFocus(); + return new ExtrusionLightingWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -ExtrusionSurfaceControl::ExtrusionSurfaceControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -ExtrusionSurfaceControl::~ExtrusionSurfaceControl() +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType ExtrusionSurfaceControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new ExtrusionSurfaceControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* ExtrusionSurfaceControl::CreatePopupWindow() +OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName( ) throw (RuntimeException) { - ExtrusionSurfaceWindow* pWin = new ExtrusionSurfaceWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return ExtrusionSurfaceControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -void ExtrusionSurfaceControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) +Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( ) throw (RuntimeException) { - USHORT nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); + return ExtrusionSurfaceControl_getSupportedServiceNames(); } //======================================================================== @@ -1271,3 +1028,5 @@ void ExtrusionColorControl::StateChanged( USHORT nSID, SfxItemState eState, cons rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } + +} diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx new file mode 100644 index 000000000000..958ccc014afc --- /dev/null +++ b/svx/source/tbxctrls/extrusioncontrols.hxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * 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 _SVX_EXTRUSION_CONTROLS_HXX +#define _SVX_EXTRUSION_CONTROLS_HXX + +#include "svx/svxdllapi.h" + +#include <svtools/valueset.hxx> +#include <svtools/svtreebx.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/field.hxx> +#include <vcl/fixed.hxx> + +#include <svtools/toolbarmenu.hxx> +#include <svtools/popupwindowcontroller.hxx> +#include <svtools/popupmenucontrollerbase.hxx> + +class SfxBindings; +class SfxStatusForwarder; + +//======================================================================== + +namespace svx +{ +class ToolboxButtonColorUpdater; + +class ExtrusionDirectionWindow : public svtools::ToolbarMenu +{ +public: + ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + ValueSet* mpDirectionSet; + + Image maImgDirection[9]; + Image maImgDirectionH[9]; + + Image maImgPerspective; + Image maImgPerspectiveH; + Image maImgParallel; + Image maImgParallelH; + + const rtl::OUString msExtrusionDirection; + const rtl::OUString msExtrusionProjection; + + DECL_LINK( SelectHdl, void * ); + void FillValueSet(); + + void implSetDirection( sal_Int32 nSkew, bool bEnabled = true ); + void implSetProjection( sal_Int32 nProjection, bool bEnabled = true ); + +}; + +//======================================================================== + +class ExtrusionDirectionControl : public svt::PopupWindowController +{ +public: + ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +class ExtrusionDepthController : public svt::PopupMenuControllerBase +{ + using svt::PopupMenuControllerBase::disposing; +private: + Image maImgDepth[5]; + Image maImgDepthInfinity; + + Image maImgDepth_hc[5]; + Image maImgDepthInfinityh; + + FieldUnit meUnit; + double mfDepth; + + const rtl::OUString msExtrusionDepth; + const rtl::OUString msMetricUnit; + +public: + ExtrusionDepthController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~ExtrusionDepthController(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XMenuListener + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) 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 ); + + // XPopupMenuController + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); +}; + +//======================================================================== + +class ExtrusionLightingWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + ValueSet* mpLightingSet; + + Image maImgLightingOff[9]; + Image maImgLightingOn[9]; + Image maImgLightingPreview[9]; + + Image maImgLightingOffh[9]; + Image maImgLightingOnh[9]; + Image maImgLightingPreviewh[9]; + + Image maImgBright; + Image maImgNormal; + Image maImgDim; + Image maImgBrighth; + Image maImgNormalh; + Image maImgDimh; + + int mnLevel; + bool mbLevelEnabled; + int mnDirection; + bool mbDirectionEnabled; + + const rtl::OUString msExtrusionLightingDirection; + const rtl::OUString msExtrusionLightingIntensity; + + void implSetIntensity( int nLevel, bool bEnabled ); + void implSetDirection( int nDirection, bool bEnabled ); + + DECL_LINK( SelectHdl, void * ); +public: + ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); +}; + +//======================================================================== + +class ExtrusionLightingControl : public svt::PopupWindowController +{ +public: + ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +class ExtrusionSurfaceWindow : public svtools::ToolbarMenu +{ +private: + svt::ToolboxController& mrController; + + Image maImgSurface1; + Image maImgSurface2; + Image maImgSurface3; + Image maImgSurface4; + Image maImgSurface1h; + Image maImgSurface2h; + Image maImgSurface3h; + Image maImgSurface4h; + + const rtl::OUString msExtrusionSurface; + + DECL_LINK( SelectHdl, void * ); + + void implSetSurface( int nSurface, bool bEnabled ); + +public: + ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +class ExtrusionSurfaceControl : public svt::PopupWindowController +{ +public: + ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); +}; + +//======================================================================== + +} +#endif + diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src index 5a819a223d81..11f40e6f2976 100644 --- a/svx/source/tbxctrls/extrusioncontrols.src +++ b/svx/source/tbxctrls/extrusioncontrols.src @@ -200,93 +200,81 @@ DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION }; }; -DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH +String RID_SVXSTR_EXTRUSION_CUSTOM { - Border = FALSE ; - Hide = TRUE ; - SVLook = TRUE ; - Sizeable = FALSE ; - Moveable = TRUE ; - Closeable = TRUE ; - Zoomable = TRUE ; - - Text [ en-US ] = "Extrusion Depth" ; + Text [ en-US ] = "~Custom..."; +}; - String STR_CUSTOM - { - Text [ en-US ] = "~Custom..."; - }; +String RID_SVXSTR_EXTRUSION_INFINITY +{ + Text [ en-US ] = "~Infinity"; +}; - String STR_INFINITY - { - Text [ en-US ] = "~Infinity"; - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_0 +{ + ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_0_H +{ + ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_0 - { - ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_0_H - { - ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_1 +{ + ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_1_H +{ + ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_1 - { - ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_1_H - { - ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_2 +{ + ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_2 - { - ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_2_H - { - ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_2_H +{ + ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_3 - { - ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_3_H - { - ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_3 +{ + ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_3_H +{ + ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_4 - { - ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_4_H - { - ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_4 +{ + ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_4_H +{ + ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; }; + MASKCOLOR +}; - Image IMG_DEPTH_INFINITY - { - ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; - MASKCOLOR - }; - Image IMG_DEPTH_INFINITY_H - { - ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; - MASKCOLOR - }; +Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY +{ + ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; }; + MASKCOLOR +}; +Image RID_SVXIMG_EXTRUSION_DEPTH_INFINITY_H +{ + ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; }; + MASKCOLOR }; DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 915f0743c8fd..1fbf10868661 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -27,40 +27,53 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" + #include <com/sun/star/text/WritingMode.hpp> -#include <sfx2/app.hxx> + +#include <vcl/toolbox.hxx> + #include <svl/itempool.hxx> -#include <svx/fmmodel.hxx> + +#include <svtools/toolbarmenu.hxx> +#include <svtools/popupwindowcontroller.hxx> +#include <svtools/popupmenucontrollerbase.hxx> + +#include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> -#include <dlgutil.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/frmdiritem.hxx> + +#include <svx/fmmodel.hxx> #include <svx/svxids.hrc> #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> -#include "gallery.hxx" #include <svx/svdpage.hxx> #include <svx/svdobj.hxx> #include <svx/svdview.hxx> #include <svx/svdoutl.hxx> -#include <editeng/eeitem.hxx> -#include <editeng/frmdiritem.hxx> -#include "svx/toolbarmenu.hxx" + +#include "gallery.hxx" +#include <dlgutil.hxx> #include "fontworkgallery.hxx" #include "fontworkgallery.hrc" #include <algorithm> -#ifndef _TOOLBOX_HXX //autogen -#include <vcl/toolbox.hxx> -#endif -#ifndef _SVX_HELPID_HRC #include "helpid.hrc" -#endif -using namespace svx; + +using ::rtl::OUString; +using ::svtools::ToolbarMenu; + +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::frame; + +namespace svx +{ const int nColCount = 4; const int nLineCount = 4; @@ -291,7 +304,7 @@ IMPL_LINK( FontWorkGalleryDialog, DoubleClickFavoriteHdl, void*, EMPTYARG ) return( 0L ); } -// ----------------------------------------------------------------------- +//------------------------------------------------------------------------ SFX_IMPL_TOOLBOX_CONTROL( FontWorkShapeTypeControl, SfxStringItem ); FontWorkShapeTypeControl::FontWorkShapeTypeControl( USHORT nSlotId, USHORT nId, ToolBox &rTbx ) @@ -332,35 +345,50 @@ void FontWorkShapeTypeControl::Select( BOOL ) // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( FontWorkAlignmentControl, SfxBoolItem ); - -FontWorkAlignmentWindow::FontWorkAlignmentWindow( - USHORT /*nId*/, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow ) : - - ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )), - maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ), - maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ), - maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ), - maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ), - maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ), - maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ), - maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ), - maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ), - maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ), - maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ), - mxFrame( rFrame ), - msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) -{ - SetHelpId( HID_WIN_FONTWORK_ALIGN ); - implInit(); -} - -void FontWorkAlignmentWindow::implInit() +class FontWorkAlignmentWindow : public ToolbarMenu +{ +public: + FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + +private: + svt::ToolboxController& mrController; + + Image maImgAlgin1; + Image maImgAlgin2; + Image maImgAlgin3; + Image maImgAlgin4; + Image maImgAlgin5; + Image maImgAlgin1h; + Image maImgAlgin2h; + Image maImgAlgin3h; + Image maImgAlgin4h; + Image maImgAlgin5h; + + const rtl::OUString msFontworkAlignment; + + DECL_LINK( SelectHdl, void * ); + + void implSetAlignment( int nAlignmentMode, bool bEnabled ); +}; + +FontWorkAlignmentWindow::FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) +: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT )) +, mrController( rController ) +, maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) ) +, maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) ) +, maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) ) +, maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) ) +, maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) ) +, maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) ) +, maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) ) +, maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) ) +, maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) ) +, maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) ) +, msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) { - SetHelpId( HID_POPUP_FONTWORK_ALIGN ); - bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); SetHelpId( HID_POPUP_FONTWORK_ALIGN ); @@ -381,12 +409,6 @@ void FontWorkAlignmentWindow::implInit() // ----------------------------------------------------------------------- -FontWorkAlignmentWindow::~FontWorkAlignmentWindow() -{ -} - -// ----------------------------------------------------------------------- - void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) { int i; @@ -399,7 +421,7 @@ void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled ) // ----------------------------------------------------------------------- -void SAL_CALL FontWorkAlignmentWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +void SAL_CALL FontWorkAlignmentWindow::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException ) { if( Event.FeatureURL.Main.equals( msFontworkAlignment ) ) { @@ -441,25 +463,14 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) if ( IsInPopupMode() ) EndPopupMode(); -// SfxDispatcher* pDisp = GetBindings().GetDispatcher(); - sal_Int32 nAlignment = getSelectedEntryId(); if( nAlignment >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_ALIGNMENT, nAlignment ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkAlignment.copy(5); + aArgs[0].Value <<= (sal_Int32)nAlignment; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkAlignment, aArgs ); implSetAlignment( nAlignment, true ); } @@ -467,56 +478,74 @@ IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void FontWorkAlignmentWindow::StartSelection() +class FontWorkAlignmentControl : public svt::PopupWindowController +{ +public: + FontWorkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); +}; + + +FontWorkAlignmentControl::FontWorkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) ) { } // ----------------------------------------------------------------------- -void FontWorkAlignmentWindow::GetFocus (void) +::Window* FontWorkAlignmentControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - GrabFocus(); + return new FontWorkAlignmentWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkAlignmentControl::FontWorkAlignmentControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL FontWorkAlignmentControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkAlignmentController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -FontWorkAlignmentControl::~FontWorkAlignmentControl() +Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkAlignmentControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL FontWorkAlignmentControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new FontWorkAlignmentControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkAlignmentControl::CreatePopupWindow() +OUString SAL_CALL FontWorkAlignmentControl::getImplementationName( ) throw (RuntimeException) { - FontWorkAlignmentWindow* pWin = new FontWorkAlignmentWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return FontWorkAlignmentControl_getImplementationName(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL FontWorkAlignmentControl::getSupportedServiceNames( ) throw (RuntimeException) +{ + return FontWorkAlignmentControl_getSupportedServiceNames(); +} -void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ ) +/** todo ? +void FontWorkAlignmentControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) { USHORT nId = GetId(); ToolBox& rTbx = GetToolBox(); @@ -525,25 +554,35 @@ void FontWorkAlignmentControl::StateChanged( USHORT /*nSID*/, SfxItemState eStat rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } +*/ + // #################################################################### -SFX_IMPL_TOOLBOX_CONTROL( FontWorkCharacterSpacingControl, SfxBoolItem ); +class FontWorkCharacterSpacingWindow : public ToolbarMenu +{ +public: + FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ); + + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); +private: + svt::ToolboxController& mrController; + + const rtl::OUString msFontworkCharacterSpacing; + const rtl::OUString msFontworkKernCharacterPairs; + + DECL_LINK( SelectHdl, void * ); -FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( USHORT /*nId*/, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow ) + void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ); + void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled ); + +}; + +FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow ) : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING )) -, mxFrame( rFrame ) +, mrController( rController ) , msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) ) , msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) ) { - implInit(); -} - -void FontWorkCharacterSpacingWindow::implInit() -{ - SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); - -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - SetHelpId( HID_POPUP_FONTWORK_CHARSPACE ); SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) ); @@ -566,12 +605,6 @@ void FontWorkCharacterSpacingWindow::implInit() // ----------------------------------------------------------------------- -FontWorkCharacterSpacingWindow::~FontWorkCharacterSpacingWindow() -{ -} - -// ----------------------------------------------------------------------- - void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled ) { sal_Int32 i; @@ -638,27 +671,6 @@ void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::s // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - ToolbarMenu::DataChanged( rDCEvt ); - - if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { -// bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - - appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_CHECKABLE ); - appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_CHECKABLE ); - appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_CHECKABLE ); - appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_CHECKABLE ); - appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_CHECKABLE ); - appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_CHECKABLE ); - appendSeparator(); - appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE ); - } -} - -// ----------------------------------------------------------------------- - IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) { if ( IsInPopupMode() ) @@ -677,53 +689,31 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) } if ( nSelection == 5 ) // custom spacing { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )); - - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkCharacterSpacing" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<= (sal_Int32)nCharacterSpacing; + + mrController.dispatchCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )), aArgs ); } else if ( nSelection == 6 ) // KernCharacterPairs { - sal_Bool bOnOff = sal_True; - SfxBoolItem aItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bOnOff ); rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" )); - Any a; Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontworkKernCharacterPairs" )); - aItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); - - implSetKernCharacterPairs( bOnOff, true ); + aArgs[0].Name = msFontworkKernCharacterPairs.copy(5); + aArgs[0].Value <<= (sal_Bool) sal_True; + + mrController.dispatchCommand( msFontworkKernCharacterPairs, aArgs ); + + implSetKernCharacterPairs( sal_True, true ); } else if( nSelection >= 0 ) { - SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ); - rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" )); - - Any a; - INetURLObject aObj( aCommand ); Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aItem.QueryValue( a ); - aArgs[0].Value = a; + aArgs[0].Name = msFontworkCharacterSpacing.copy(5); + aArgs[0].Value <<=( sal_Int32)nCharacterSpacing; - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( - mxFrame->getController(), UNO_QUERY ), - aCommand, - aArgs ); + mrController.dispatchCommand( msFontworkCharacterSpacing, aArgs ); implSetCharacterSpacing( nCharacterSpacing, true ); } @@ -731,55 +721,74 @@ IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG ) return 0; } -// ----------------------------------------------------------------------- +// ======================================================================== -void FontWorkCharacterSpacingWindow::StartSelection() +class FontWorkCharacterSpacingControl : public svt::PopupWindowController +{ +public: + FontWorkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + virtual ::Window* createPopupWindow( ::Window* pParent ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); +}; + + +FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager ) +: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingFloater" ) ) ) { } // ----------------------------------------------------------------------- -void FontWorkCharacterSpacingWindow::GetFocus (void) +::Window* FontWorkCharacterSpacingControl::createPopupWindow( ::Window* pParent ) { - ToolbarMenu::GetFocus(); - // Grab the focus to the line ends value set so that it can be controlled - // with the keyboard. - GrabFocus(); + return new FontWorkCharacterSpacingWindow( *this, m_xFrame, pParent ); } -// ======================================================================== +// ----------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------- -FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( - USHORT nSlotId, USHORT nId, ToolBox &rTbx ) -: SfxToolBoxControl( nSlotId, nId, rTbx ) +OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName() { - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkCharacterSpacingController" )); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -FontWorkCharacterSpacingControl::~FontWorkCharacterSpacingControl() +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException ) { + Sequence< OUString > aSNS( 1 ); + aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" )); + return aSNS; } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindowType FontWorkCharacterSpacingControl::GetPopupWindowType() const +Reference< XInterface > SAL_CALL SAL_CALL FontWorkCharacterSpacingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException ) { - return SFX_POPUPWINDOW_ONCLICK; + return *new FontWorkCharacterSpacingControl( rSMgr ); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------- -SfxPopupWindow* FontWorkCharacterSpacingControl::CreatePopupWindow() +OUString SAL_CALL FontWorkCharacterSpacingControl::getImplementationName( ) throw (RuntimeException) { - FontWorkCharacterSpacingWindow* pWin = new FontWorkCharacterSpacingWindow( GetId(), m_xFrame, &GetToolBox() ); - StartPopupMode( pWin ); - return 0; + return FontWorkCharacterSpacingControl_getImplementationName(); } +// -------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl::getSupportedServiceNames( ) throw (RuntimeException) +{ + return FontWorkCharacterSpacingControl_getSupportedServiceNames(); +} // ----------------------------------------------------------------------- +/** todo ? void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, const SfxPoolItem* ) { USHORT nId = GetId(); @@ -788,6 +797,7 @@ void FontWorkCharacterSpacingControl::StateChanged( USHORT, SfxItemState eState, rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK ); } +*/ // ----------------------------------------------------------------------- @@ -811,3 +821,5 @@ sal_Int32 FontworkCharacterSpacingDialog::getScale() const { return (sal_Int32)maMtrScale.GetValue(); } + +} diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk index 47da008e87a3..9b08caa587aa 100644 --- a/svx/source/tbxctrls/makefile.mk +++ b/svx/source/tbxctrls/makefile.mk @@ -44,7 +44,6 @@ LIB1OBJFILES= \ $(SLO)$/fontworkgallery.obj\ $(SLO)$/extrusioncontrols.obj \ $(SLO)$/tbcontrl.obj \ - $(SLO)$/toolbarmenu.obj \ $(SLO)$/tbxcolorupdate.obj LIB2TARGET= $(SLB)$/$(TARGET).lib diff --git a/svx/source/tbxctrls/toolbarmenu.cxx b/svx/source/tbxctrls/toolbarmenu.cxx deleted file mode 100644 index e121aa3a88ef..000000000000 --- a/svx/source/tbxctrls/toolbarmenu.cxx +++ /dev/null @@ -1,1194 +0,0 @@ -/************************************************************************* - * - * 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_svx.hxx" - -#include <comphelper/processfactory.hxx> - -#include <vcl/dockwin.hxx> -#include <vcl/menu.hxx> -#include <vcl/decoview.hxx> -#include <vcl/image.hxx> -#include <vcl/taskpanelist.hxx> - -#include <svtools/valueset.hxx> - -#include "svx/toolbarmenu.hxx" - -const int EXTRAITEMHEIGHT = 0; // 4; -const int SEPARATOR_HEIGHT = 4; -const int TITLE_ID = -1; -const int BORDER_X = 0; -const int BORDER_Y = 0; - -static Window* GetTopMostParentSystemWindow( Window* pWindow ) -{ - OSL_ASSERT( pWindow ); - if ( pWindow ) - { - // ->manually search topmost system window - // required because their might be another system window between this and the top window - pWindow = pWindow->GetParent(); - SystemWindow* pTopMostSysWin = NULL; - while ( pWindow ) - { - if ( pWindow->IsSystemWindow() ) - pTopMostSysWin = (SystemWindow*)pWindow; - pWindow = pWindow->GetParent(); - } - pWindow = pTopMostSysWin; - OSL_ASSERT( pWindow ); - return pWindow; - } - - return NULL; -} - -class ToolbarMenuEntry -{ -public: - int mnEntryId; - MenuItemBits mnBits; - Size maSize; - - bool mbHasText; - bool mbHasImage; - bool mbHasControl; - bool mbChecked; - bool mbEnabled; - - String maText; - Image maImage; - Control* mpControl; - -public: - ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ); - ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ); - ~ToolbarMenuEntry(); - - void init( int nEntryId, MenuItemBits nBits ); -}; - -void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits ) -{ - mnEntryId = nEntryId; - mnBits = nBits; - - mbHasText = false; - mbHasImage = false; - mbHasControl = false; - mbChecked = false; - mbEnabled = true; - - mpControl = NULL; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - maImage = rImage; - mbHasImage = true; -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::ToolbarMenuEntry( int nEntryId, const String& rText, Control* pControl, MenuItemBits nBits ) -{ - init( nEntryId, nBits ); - - maText = rText; - mbHasText = true; - - if( pControl ) - { - mpControl = pControl; - mpControl->Show(); - } -} - -ToolbarMenuEntry::~ToolbarMenuEntry() -{ - delete mpControl; -} - -ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - WinBits nBits ) -: DockingWindow(pParentWindow, nBits) -, mxFrame( rFrame ) -{ - implInit(); -} - -ToolbarMenu::ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, - Window* pParentWindow, - const ResId& rResId ) -: DockingWindow(pParentWindow, rResId) -, mxFrame( rFrame ) -{ - implInit(); -} - -void ToolbarMenu::implInit() -{ -// SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_NOBORDER | WB_SYSTEMWINDOW ); - -// EnableChildTransparentMode(); - - Window* pWindow = GetTopMostParentSystemWindow( this ); - if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); - - mxServiceManager = ::comphelper::getProcessServiceFactory(); - - mnCheckPos = 0; - mnImagePos = 0; - mnTextPos = 0; - - mnHighlightedEntry = -1; - mnSelectedEntry = -1; - initWindow(); -} - -ToolbarMenu::~ToolbarMenu() -{ - Window* pWindow = GetTopMostParentSystemWindow( this ); - if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); - - if ( mxStatusListener.is() ) - { - mxStatusListener->dispose(); - mxStatusListener.clear(); - } - - // delete all menu entries - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - delete maEntryVector[nEntry]; - } -} - -int ToolbarMenu::getSelectedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnSelectedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -int ToolbarMenu::getHighlightedEntryId() const -{ - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - return pEntry ? pEntry->mnEntryId : -1; -} - -void ToolbarMenu::checkEntry( int nEntryId, bool bChecked ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbChecked != bChecked ) - { - pEntry->mbChecked = bChecked; - Invalidate(); - } -} - -bool ToolbarMenu::isEntryChecked( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbChecked; -} - -void ToolbarMenu::enableEntry( int nEntryId, bool bEnable ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->mbEnabled != bEnable ) - { - pEntry->mbEnabled = bEnable; - if( pEntry->mpControl ) - { - pEntry->mpControl->Enable( bEnable ); - - // hack for the valueset to make it paint itself anew - pEntry->mpControl->Resize(); - } - Invalidate(); - } -} - -bool ToolbarMenu::isEntryEnabled( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - return pEntry && pEntry->mbEnabled; -} - -void ToolbarMenu::setEntryText( int nEntryId, const String& rStr ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maText != rStr ) - { - pEntry->maText = rStr; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const String& ToolbarMenu::getEntryText( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maText; - else - { - static String aEmptyStr; - return aEmptyStr; - } -} - -void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage ) -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry && pEntry->maImage != rImage ) - { - pEntry->maImage = rImage; - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); - } -} - -const Image& ToolbarMenu::getEntryImage( int nEntryId ) const -{ - ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); - if( pEntry ) - return pEntry->maImage; - else - { - static Image aEmptyImage; - return aEmptyImage; - } -} - -void ToolbarMenu::initWindow() -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); - - SetPointFont( rStyleSettings.GetMenuFont() ); - SetBackground( Wallpaper( GetControlBackground() ) ); - SetTextColor( rStyleSettings.GetMenuTextColor() ); - SetTextFillColor(); - SetLineColor(); - - maSize = implCalcSize(); -} - -Size ToolbarMenu::implCalcSize() -{ - const long nFontHeight = GetTextHeight(); - long nExtra = nFontHeight/4; - - Size aSz; - Size aMaxImgSz; - long nMaxTextWidth = 0; - long nMinMenuItemHeight = nFontHeight; - sal_Bool bCheckable = sal_False; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - if ( rSettings.GetUseImagesInMenus() ) - { - nMinMenuItemHeight = 16; - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry && pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( aImgSz.Height() > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height(); - if ( aImgSz.Height() > nMinMenuItemHeight ) - nMinMenuItemHeight = aImgSz.Height(); - break; - } - } - } - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - pEntry->maSize.Height() = 0; - pEntry->maSize.Width() = 0; - - - if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) - bCheckable = sal_True; - - // Image: - if( pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( (aImgSz.Width() + 4) > aMaxImgSz.Width() ) - aMaxImgSz.Width() = aImgSz.Width() + 4; - if ( (aImgSz.Height() + 4) > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height() + 4; - if ( (aImgSz.Height() + 4) > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aImgSz.Height() + 4; - } - } - } - - int gfxExtra = Max( nExtra, 7L ); - - if ( aMaxImgSz.Width() ) - mnTextPos += gfxExtra; - if ( bCheckable ) - mnTextPos += 16; - - mnCheckPos = nExtra; - mnImagePos = nExtra; - mnTextPos = mnImagePos + aMaxImgSz.Width(); - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - // Text: - if( pEntry->mbHasText ) - { - long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mnTextPos; - nMaxTextWidth = Max( nTextWidth, nMaxTextWidth ); - - pEntry->maSize.Height() = Max( Max( GetTextHeight(), pEntry->maSize.Height() ), nMinMenuItemHeight ); - } - // Control: - else if( pEntry->mpControl ) - { - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - - nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); - pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ) + 1; - } - aSz.Height() += pEntry->maSize.Height(); - } - else - { - aSz.Height() += SEPARATOR_HEIGHT; - } - } - - aSz.Width() = nMaxTextWidth + (BORDER_X<<1); - aSz.Height() += BORDER_Y<<1; - - // positionate controls - int nY = BORDER_Y; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - - if( pEntry ) - { - if( pEntry->mpControl ) - { - Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY); - if( pEntry->mbHasText ) - aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; - - pEntry->mpControl->SetPosPixel( aControlPos ); - } - - nY += pEntry->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - - return aSz; -} - -void ToolbarMenu::GetFocus() -{ - OSL_TRACE("ToolbarMenu::GetFocus()"); - - if( mnHighlightedEntry == -1 ) - { - implChangeHighlightEntry( 0 ); - } - DockingWindow::GetFocus(); -} - -void ToolbarMenu::LoseFocus() -{ - OSL_TRACE("ToolbarMenu::LoseFocus()"); - if( mnHighlightedEntry != -1 ) - { - implChangeHighlightEntry( -1 ); - } - DockingWindow::LoseFocus(); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rImage, rStr, nItemBits ) ); -} - -void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, pControl, nItemBits ) ); -} -/* -void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, Control* pControl, MenuItemBits nItemBits ) -{ - appendEntry( new ToolbarMenuEntry( nEntryId, rStr, pControl, nItemBits ) ); -} -*/ -void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry ) -{ - maEntryVector.push_back( pEntry ); - maSize = implCalcSize(); - if( IsVisible() ) - Invalidate(); -} - -void ToolbarMenu::appendSeparator() -{ - appendEntry( 0 ); -} - -void ToolbarMenu::Resize() -{ - DockingWindow::Resize(); -} - -ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const -{ - if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) ) - return NULL; - - return maEntryVector[nEntry]; -} - -ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const -{ - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p && p->mnEntryId == nEntryId ) - { - return p; - } - } - - return NULL; -} - -static void implDeselectControl( Control* pControl ) -{ - ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); - if( pValueSet ) - { - pValueSet->SetNoSelection(); - pValueSet->Invalidate(); - } -} - -void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) -{ - Size aSz = GetOutputSizePixel(); - long nY = BORDER_Y; - long nX = BORDER_X; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* p = maEntryVector[nEntry]; - if( p ) - { - if(nEntry == nHighlightEntry) - { - if( (p->mpControl == NULL) || (p->mbHasText) ) - { - Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - SetLineColor(); - DrawRect( aRect ); - - if( bHighlight ) - { - aRect.nLeft += 1; - aRect.nTop += 1; - aRect.nBottom -= 1; - aRect.nRight -= 1; - DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); - } - } - else if( p->mpControl != NULL ) - { - implDeselectControl( p->mpControl ); - } - - implPaint( p, bHighlight ); - - maHighlightHdl.Call( this ); - break; - } - - nY += p->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; - } - } -} - -void ToolbarMenu::implSelectEntry( int nSelectedEntry ) -{ - mnSelectedEntry = nSelectedEntry; - - ToolbarMenuEntry* pEntry = NULL; - if( nSelectedEntry != -1 ) - pEntry = maEntryVector[ nSelectedEntry ]; - - if( pEntry ) - maSelectHdl.Call( this ); -} - -void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt ) -{ - implHighlightEntry( rMEvt, true ); - - implSelectEntry( mnHighlightedEntry ); -} - -void ToolbarMenu::MouseButtonUp( const MouseEvent& ) -{ -} - -void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) -{ - if ( !IsVisible() ) - return; - - implHighlightEntry( rMEvt, false ); -} - -void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) -{ - long nY = 0; - long nMouseY = rMEvt.GetPosPixel().Y(); - Size aOutSz = GetOutputSizePixel(); - if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) - { - bool bHighlighted = FALSE; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry ) - { - long nOldY = nY; - nY += pEntry->maSize.Height(); - - if( pEntry->mnEntryId != TITLE_ID ) - { - if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) - { - if( bMBDown ) - { - if( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - else - { - if ( nEntry != mnHighlightedEntry ) - { - implChangeHighlightEntry( nEntry ); - } - } - bHighlighted = true; - } - } - } - else - { - nY += SEPARATOR_HEIGHT; - } - } - if ( !bHighlighted ) - implChangeHighlightEntry( -1 ); - } - else - { - implChangeHighlightEntry( -1 ); - } -} - -void ToolbarMenu::implChangeHighlightEntry( int nEntry ) -{ - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, false ); - } - - mnHighlightedEntry = nEntry; -// Invalidate(); - - if( mnHighlightedEntry != -1 ) - { - implHighlightEntry( mnHighlightedEntry, true ); - } -} - -static bool implCheckSubControlCursorMove( Control* pControl, bool bUp ) -{ - ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); - if( pValueSet ) - { - USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() ); - if( nItemPos != VALUESET_ITEM_NOTFOUND ) - { - const USHORT nColCount = pValueSet->GetColCount(); - const USHORT nLine = nItemPos / nColCount; - - if( bUp ) - { - return nLine > 0; - } - else - { - const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount; - return (nLine+1) < nLineCount; - } - } - } - - return false; -} - -ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) -{ - int n = mnHighlightedEntry; - if( n == -1 ) - { - if( bUp ) - n = 0; - else - n = maEntryVector.size()-1; - } - else if( !bHomeEnd ) - { - // if we have a currently selected entry and - // cursor keys are used than check if this entry - // has a control that can use those cursor keys - ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData && pData->mpControl && !pData->mbHasText ) - { - if( implCheckSubControlCursorMove( pData->mpControl, bUp ) ) - return pData; - } - } - - int nLoop = n; - - if( bHomeEnd ) - { - // absolute positioning - if( bUp ) - { - n = maEntryVector.size(); - nLoop = n-1; - } - else - { - n = -1; - nLoop = n+1; - } - } - - do - { - if( bUp ) - { - if ( n ) - n--; - else - if( mnHighlightedEntry == -1 ) - n = maEntryVector.size()-1; - else - break; - } - else - { - if( n < ((int)maEntryVector.size()-1) ) - n++; - else - if( mnHighlightedEntry == -1 ) - n = 0; - else - break; - } - - ToolbarMenuEntry* pData = maEntryVector[n]; - if( pData && (pData->mnEntryId != TITLE_ID) ) - { - implChangeHighlightEntry( n ); - return pData; - } - } while ( n != nLoop ); - - return 0; -} - -void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) -{ - OSL_TRACE("ToolbarMenu::KeyInput()"); - Control* pForwardControl = 0; - USHORT nCode = rKEvent.GetKeyCode().GetCode(); - switch ( nCode ) - { - case KEY_UP: - case KEY_DOWN: - { - int nOldEntry = mnHighlightedEntry; - ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false ); - if( p && p->mpControl && !p->mbHasText ) - { - OSL_TRACE("ToolbarMenu::KeyInput() - grab focus to control"); -// p->mpControl->GrabFocus(); - if( nOldEntry != mnHighlightedEntry ) - { - KeyCode aKeyCode( (nCode == KEY_UP) ? KEY_END : KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - p->mpControl->Invalidate(); - p->mpControl->Update(); - } - else if( !p->mpControl->HasFocus() ) - { - // in case we are in a system floating window, GrabFocus does not work :-/ - pForwardControl = p->mpControl; - } - } - } - break; - case KEY_END: - case KEY_HOME: - { - ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); - if( p && p->mpControl && !p->mbHasText ) - { -// p->mpControl->GrabFocus(); - KeyCode aKeyCode( KEY_HOME ); - KeyEvent aKeyEvent( 0, aKeyCode ); - p->mpControl->KeyInput( aKeyEvent ); - p->mpControl->Invalidate(); - p->mpControl->Update(); - } - } - break; - case KEY_F6: - case KEY_ESCAPE: - { - // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document -// if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) -// break; - - implSelectEntry( -1 ); - } - break; - - case KEY_RETURN: - { - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) ) - { - if( pEntry->mpControl ) - { - pForwardControl = pEntry->mpControl; - } - else - { - implSelectEntry( mnHighlightedEntry ); - } - } - } - break; - default: - { - ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); - if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText ) - { -// pEntry->mpControl->GrabFocus(); - pForwardControl = pEntry->mpControl; - } - } - - } - if( pForwardControl ) - pForwardControl->KeyInput( rKEvent ); - -} - -void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) -{ - const long nFontHeight = GetTextHeight(); - const long nExtra = nFontHeight/4; - - DecorationView aDecoView( this ); - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - - const Size aOutSz( GetOutputSizePixel() ); - - Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; - - const int nEntryCount = maEntryVector.size(); - int nEntry; - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - Point aPos( aTopLeft ); - - USHORT nTextStyle = 0; - USHORT nSymbolStyle = 0; - USHORT nImageStyle = 0; - if( pEntry && !pEntry->mbEnabled ) - { - nTextStyle |= TEXT_DRAW_DISABLE; - nSymbolStyle |= SYMBOL_DRAW_DISABLE; - nImageStyle |= IMAGE_DRAW_DISABLE; - } - - // Separator - if( pEntry == NULL ) - { - if( pThisOnly == NULL ) - { - aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); - - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - aTmpPos.Y()++; - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - SetLineColor(); - } - - aTopLeft.Y() += SEPARATOR_HEIGHT; - } - else - { - if( !pThisOnly || ( pEntry == pThisOnly ) ) - { - const bool bTitle = pEntry->mnEntryId == TITLE_ID; - - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuHighlightTextColor() ); - else - SetTextColor( rSettings.GetMenuTextColor() ); - - Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); - if( bTitle ) - { - // fill the background - SetFillColor(rSettings.GetDialogColor()); - SetLineColor(); - DrawRect(aRect); - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aRect.TopLeft(), aRect.TopRight() ); - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); - } - else if( pEntry->mpControl ) - { - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); - } - - long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); - - // Image - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); - } - // Text: - if( pEntry->mbHasText ) - { - aTmpPos.X() = aPos.X() + (bTitle ? 4 : mnTextPos); - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nTextOffsetY; - USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; - - DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); - } - - // CheckMark - if( pEntry->mbChecked ) - { - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - - Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aSelRect.nLeft -= 2; - aSelRect.nTop -= 2; - aSelRect.nRight += 2; - aSelRect.nBottom += 2; - DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); - } - else - { - Rectangle aSelRect; - SymbolType eSymbol; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += pEntry->maSize.Height() / 2; - if ( pEntry->mnBits & MIB_RADIOCHECK ) - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_RADIOCHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); - } - else - { - aTmpPos.X() = aPos.X() + mnCheckPos; - eSymbol = SYMBOL_CHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); - } - aDecoView.DrawSymbol( aSelRect, eSymbol, GetTextColor(), nSymbolStyle ); - } - } - } - - aTopLeft.Y() += pEntry->maSize.Height(); - } - } -} - -void ToolbarMenu::Paint( const Rectangle& ) -{ - implPaint(); - - if( mnHighlightedEntry != -1 ) - implHighlightEntry( mnHighlightedEntry, true ); -} - -void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) -{ - DockingWindow::RequestHelp( rHEvt ); -} - -void ToolbarMenu::StateChanged( StateChangedType nType ) -{ - DockingWindow::StateChanged( nType ); - - if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) -{ - DockingWindow::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || - (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || - ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) - { - initWindow(); - Invalidate(); - } -} - -void ToolbarMenu::Command( const CommandEvent& rCEvt ) -{ - if ( rCEvt.GetCommand() == COMMAND_WHEEL ) - { - const CommandWheelData* pData = rCEvt.GetWheelData(); - if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) - { - implCursorUpDown( pData->GetDelta() > 0L, false ); - } - } -} - -// todo: move to new base class that will replace SfxPopupWindo -void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL ) -{ - initStatusListener(); - mxStatusListener->addStatusListener( rCommandURL ); -} - -// -------------------------------------------------------------------- - -void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL ) -{ - mxStatusListener->removeStatusListener( rCommandURL ); -} -// -------------------------------------------------------------------- - - -void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL ) -{ - mxStatusListener->updateStatus( rCommandURL ); -} - -// -------------------------------------------------------------------- - -// XStatusListener (subclasses must override this one to get the status updates -void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException ) -{ -} - -// -------------------------------------------------------------------- - -class ToolbarMenuStatusListener : public svt::FrameStatusListener -{ -public: - ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, - ToolbarMenu& rToolbarMenu ); - - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - ToolbarMenu* mpMenu; -}; - -ToolbarMenuStatusListener::ToolbarMenuStatusListener( - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, - ToolbarMenu& rToolbarMenu ) -: svt::FrameStatusListener( xServiceManager, xFrame ) -, mpMenu( &rToolbarMenu ) -{ -} - -void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - mpMenu = 0; - svt::FrameStatusListener::dispose(); -} - -void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) -{ - if( mpMenu ) - mpMenu->statusChanged( Event ); -} - -void ToolbarMenu::initStatusListener() -{ - if( !mxStatusListener.is() ) - mxStatusListener.set( new ToolbarMenuStatusListener( mxServiceManager, mxFrame, *this ) ); -} - -bool ToolbarMenu::IsInPopupMode() -{ - return GetDockingManager()->IsInPopupMode(this); -} - -void ToolbarMenu::EndPopupMode() -{ - GetDockingManager()->EndPopupMode(this); -} - - diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index daf1f23d4442..3005289268b9 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -53,7 +53,8 @@ #include "chrtitem.hxx" #include <svx/extrusionbar.hxx> -#include "extrusioncontrols.hxx" +#include "extrusiondepthdialog.hxx" + using namespace ::svx; using namespace ::rtl; diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 5dd4814c6ab5..8b4351cc8df0 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -233,9 +233,7 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con // export this service // -#ifndef SVX_LIGHT #include "UnoGraphicExporter.hxx" -#endif #include "unogalthemeprovider.hxx" #include <com/sun/star/registry/XRegistryKey.hpp> #include "sal/types.h" @@ -244,6 +242,15 @@ uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( con #include "uno/lbnames.h" #include <svx/sdr/primitive2d/primitiveFactory2d.hxx> +/* +namespace svx +{ +extern OUString SAL_CALL ExtrusionDepthController_getImplementationName(); +extern uno::Reference< uno::XInterface > SAL_CALL ExtrusionDepthController_createInstance(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::RuntimeException ); +extern uno::Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( uno::RuntimeException ); +} +*/ + extern "C" { @@ -279,9 +286,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, SvxUnoColorTable::getImplementationName_Static(), SvxUnoColorTable::getSupportedServiceNames_Static() ); writeInfo( pKey, EnhancedCustomShapeEngine_getImplementationName(), EnhancedCustomShapeEngine_getSupportedServiceNames() ); writeInfo( pKey, svx::RecoveryUI::st_getImplementationName(), svx::RecoveryUI::st_getSupportedServiceNames() ); -#ifndef SVX_LIGHT writeInfo( pKey, svx::GraphicExporter_getImplementationName(), svx::GraphicExporter_getSupportedServiceNames() ); -#endif writeInfo( pKey, svx::FontHeightToolBoxControl::getImplementationName_Static(), svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); writeInfo( pKey, ::unogallery::GalleryThemeProvider_getImplementationName(),::unogallery::GalleryThemeProvider_getSupportedServiceNames() ); @@ -292,6 +297,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( writeInfo( pKey, ::svx::SvXMLGraphicImportHelper_getImplementationName(),::svx::SvXMLGraphicImportHelper_getSupportedServiceNames() ); writeInfo( pKey, ::svx::SvXMLGraphicExportHelper_getImplementationName(),::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); +// writeInfo( pKey, ::svx::ExtrusionDepthController_getImplementationName(),::svx::ExtrusionDepthController_getSupportedServiceNames() ); } catch (registry::InvalidRegistryException &) { @@ -338,7 +344,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::RecoveryUI::st_createInstance, svx::RecoveryUI::st_getSupportedServiceNames() ); } -#ifndef SVX_LIGHT else if( svx::GraphicExporter_getImplementationName().equalsAscii( pImplName ) ) { xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -346,7 +351,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( svx::GraphicExporter_createInstance, svx::GraphicExporter_getSupportedServiceNames() ); } -#endif else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) ) { xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), @@ -385,7 +389,16 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( ::svx::SvXMLGraphicExportHelper_createInstance, ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() ); } - +/* + else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), + ::svx::ExtrusionDepthController_getImplementationName(), + ::svx::ExtrusionDepthController_createInstance, + ::svx::ExtrusionDepthController_getSupportedServiceNames() ); + } +*/ if( xFactory.is()) { xFactory->acquire(); diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index 0006fa2ff5fe..050decc8d4f5 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -45,6 +45,10 @@ SHL1TARGET= svxcore$(DLLPOSTFIX) SHL1IMPLIB= isvxcore SHL1USE_EXPORTS=name +SHL1OBJS= \ + $(SLO)$/coreservices.obj + + SHL1LIBS= \ $(SLB)$/animation.lib \ $(SLB)$/attribute.lib \ |