diff options
author | npower Developer <npower@openoffice.org> | 2009-11-18 11:25:15 +0000 |
---|---|---|
committer | npower Developer <npower@openoffice.org> | 2009-11-18 11:25:15 +0000 |
commit | e6438d8b7b8d56929793a1328f7026fd0355bb98 (patch) | |
tree | b6cb687b6f17df01793d124f2cdfe546484e7988 /framework/inc | |
parent | b4083630cb439a9f54340db6840e8bc6cfcc42c8 (diff) |
menuincustomtoolbar: #i105626#: implement menu for custom toolbar ( and some item style override capability )
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/uielement/generictoolbarcontroller.hxx | 27 | ||||
-rw-r--r-- | framework/inc/uielement/toolbarmanager.hxx | 7 | ||||
-rw-r--r-- | framework/inc/xml/menuconfiguration.hxx | 1 | ||||
-rw-r--r-- | framework/inc/xml/menudocumenthandler.hxx | 5 | ||||
-rw-r--r-- | framework/inc/xml/toolboxconfigurationdefines.hxx | 3 | ||||
-rw-r--r-- | framework/inc/xml/toolboxdocumenthandler.hxx | 6 |
6 files changed, 45 insertions, 4 deletions
diff --git a/framework/inc/uielement/generictoolbarcontroller.hxx b/framework/inc/uielement/generictoolbarcontroller.hxx index f1f014fb7707..109e4f9bf69b 100644 --- a/framework/inc/uielement/generictoolbarcontroller.hxx +++ b/framework/inc/uielement/generictoolbarcontroller.hxx @@ -37,6 +37,9 @@ #include <svtools/toolboxcontroller.hxx> #include <vcl/toolbox.hxx> +#include <memory> + +class PopupMenu; namespace framework { @@ -64,7 +67,7 @@ class GenericToolbarController : public svt::ToolboxController DECL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo* ); - private: + protected: ToolBox* m_pToolbar; sal_uInt16 m_nID; sal_Bool m_bEnumCommand : 1, @@ -72,6 +75,28 @@ class GenericToolbarController : public svt::ToolboxController rtl::OUString m_aEnumCommand; }; +class MenuToolbarController : public GenericToolbarController +{ + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xMenuDesc; + PopupMenu* pMenu; + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuManager; + rtl::OUString m_aModuleIdentifier; + public: + MenuToolbarController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, + ToolBox* pToolBar, + USHORT nID, + const rtl::OUString& aCommand, + const rtl::OUString& aModuleIdentifier, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xMenuDesc ); + + ~MenuToolbarController(); + // XToolbarController + virtual void SAL_CALL click() 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); + +}; + } #endif // __FRAMEWORK_UIELEMENT_GENERICTOOLBARCONTROLLER_HXX_ diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 553da978b8ce..5a835c1f1cf5 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -50,10 +50,12 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> #include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/frame/XSubToolbarController.hpp> #include <com/sun/star/frame/XToolbarController.hpp> @@ -200,6 +202,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XSubToolbarController > > SubToolBarControllerVector; typedef BaseHash< SubToolBarControllerVector > SubToolBarToSubToolBarControllerMap; + typedef ::std::hash_map< sal_uInt16, ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > > MenuDescriptionMap; sal_Bool m_bDisposed : 1, m_bIsHiContrast : 1, m_bSmallSymbols : 1, @@ -225,10 +228,14 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xImageOrientationListener; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xUICfgMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocUICfgMgr; + CommandToInfoMap m_aCommandMap; SubToolBarToSubToolBarControllerMap m_aSubToolBarControllerMap; Timer m_aAsyncUpdateControllersTimer; sal_Int16 m_nSymbolsStyle; + MenuDescriptionMap m_aMenuMap; }; } diff --git a/framework/inc/xml/menuconfiguration.hxx b/framework/inc/xml/menuconfiguration.hxx index 954fc2ae5e3e..1ce511618112 100644 --- a/framework/inc/xml/menuconfiguration.hxx +++ b/framework/inc/xml/menuconfiguration.hxx @@ -85,6 +85,7 @@ class MenuConfiguration ::rtl::OUString aTargetFrame; ::rtl::OUString aImageId; ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider; + sal_Int16 nStyle; }; MenuConfiguration( diff --git a/framework/inc/xml/menudocumenthandler.hxx b/framework/inc/xml/menudocumenthandler.hxx index a85a4c200086..cd73d4b8df66 100644 --- a/framework/inc/xml/menudocumenthandler.hxx +++ b/framework/inc/xml/menudocumenthandler.hxx @@ -109,13 +109,14 @@ class ReadMenuDocumentHandlerBase : public ThreadHelpBase, // Struct for right ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> m_xReader; void initPropertyCommon( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &rProps, const rtl::OUString &rCommandURL, const rtl::OUString &rHelpId, - const rtl::OUString &rLabel); + const rtl::OUString &rLabel, sal_Int16 nItemStyleBits ); private: rtl::OUString m_aType; rtl::OUString m_aLabel; rtl::OUString m_aContainer; rtl::OUString m_aHelpURL; rtl::OUString m_aCommandURL; + rtl::OUString m_aStyle; ::com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aItemProp; }; @@ -306,7 +307,7 @@ class OWriteMenuDocumentHandler virtual void WriteMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rSubMenuContainer ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); - virtual void WriteMenuItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL ); + virtual void WriteMenuItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, sal_Int16 nStyle = 0 ); virtual void WriteMenuSeparator(); com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xMenuBarContainer; diff --git a/framework/inc/xml/toolboxconfigurationdefines.hxx b/framework/inc/xml/toolboxconfigurationdefines.hxx index be8292ada8de..c3cd030f6213 100644 --- a/framework/inc/xml/toolboxconfigurationdefines.hxx +++ b/framework/inc/xml/toolboxconfigurationdefines.hxx @@ -29,6 +29,7 @@ #define ATTRIBUTE_WIDTH "width" #define ATTRIBUTE_USER "userdefined" #define ATTRIBUTE_HELPID "helpid" +#define ATTRIBUTE_TOOLTIP "tooltip" #define ATTRIBUTE_ITEMSTYLE "style" #define ATTRIBUTE_ID "id" @@ -78,6 +79,8 @@ #define ATTRIBUTE_ITEMSTYLE_AUTOSIZE "autosize" #define ATTRIBUTE_ITEMSTYLE_DROPDOWN "dropdown" #define ATTRIBUTE_ITEMSTYLE_REPEAT "repeat" +#define ATTRIBUTE_ITEMSTYLE_TEXT "text" #define ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY "dropdownonly" +#define ATTRIBUTE_ITEMSTYLE_IMAGE "image" #endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATIONDEFINES_HXX_ diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index ccf64e6d0033..ae5231ed8b24 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -77,6 +77,7 @@ class OReadToolBoxDocumentHandler : private ThreadHelpBase, // Struct for right TB_ATTRIBUTE_HELPID, TB_ATTRIBUTE_STYLE, TB_ATTRIBUTE_UINAME, + TB_ATTRIBUTE_TOOLTIP, TB_XML_ENTRY_COUNT }; @@ -159,10 +160,13 @@ class OReadToolBoxDocumentHandler : private ThreadHelpBase, // Struct for right sal_Int32 m_nHashCode_Style_DropDown; sal_Int32 m_nHashCode_Style_Repeat; sal_Int32 m_nHashCode_Style_DropDownOnly; + sal_Int32 m_nHashCode_Style_Text; + sal_Int32 m_nHashCode_Style_Image; rtl::OUString m_aType; rtl::OUString m_aLabel; rtl::OUString m_aStyle; rtl::OUString m_aHelpURL; + rtl::OUString m_aTooltip; rtl::OUString m_aIsVisible; rtl::OUString m_aCommandURL; }; @@ -181,7 +185,7 @@ class OWriteToolBoxDocumentHandler : private ThreadHelpBase // Struct for right ::com::sun::star::uno::RuntimeException ); protected: - virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, + virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, const rtl::OUString& aTooltip, sal_Int16 nStyle, sal_Int16 nWidth, sal_Bool bVisible ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); |