diff options
author | Andre Fischer <af@apache.org> | 2013-05-14 15:21:57 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:35 +0100 |
commit | a9626f143a1466591764b03baa2d15905487b692 (patch) | |
tree | 410958c92408356de4f510b022518be4a5e187d8 /include | |
parent | 6e6f8cb2b7f2173eafb988f78e9704ed1bbc4b0a (diff) |
Resolves: #i122302# Use tool bar controls for color controls...
in text property panel
(cherry picked from commit 3b252796e1126b5ec1216082f55b8d12017eaeb1)
Conflicts:
sfx2/Package_inc.mk
sfx2/inc/sfx2/sidebar/ControlFactory.hxx
sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
sfx2/inc/sfx2/sidebar/EnumContext.hxx
sfx2/source/sidebar/SidebarToolBox.cxx
svx/source/sidebar/insert/InsertPropertyPanel.cxx
svx/source/sidebar/insert/InsertPropertyPanel.hxx
svx/source/sidebar/text/TextPropertyPanel.cxx
Change-Id: Ifa1947c9e9bfdc3635dbb5b0c7a79f8ead613a90
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/sidebar/ControlFactory.hxx | 19 | ||||
-rw-r--r-- | include/sfx2/sidebar/ControllerFactory.hxx | 47 | ||||
-rw-r--r-- | include/sfx2/sidebar/EnumContext.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarToolBox.hxx | 101 |
4 files changed, 167 insertions, 3 deletions
diff --git a/include/sfx2/sidebar/ControlFactory.hxx b/include/sfx2/sidebar/ControlFactory.hxx index 594c36c5fd91..3b286e927975 100644 --- a/include/sfx2/sidebar/ControlFactory.hxx +++ b/include/sfx2/sidebar/ControlFactory.hxx @@ -19,21 +19,34 @@ #define SFX_SIDEBAR_CONTROL_FACTORY_HXX #include <sfx2/dllapi.h> +#include <sfx2/sidebar/SidebarToolBox.hxx> #include <vcl/button.hxx> - +#include <com/sun/star/frame/XFrame.hpp> class ToolBox; namespace sfx2 { namespace sidebar { class ToolBoxBackground; - class SFX2_DLLPUBLIC ControlFactory { public: static CheckBox* CreateMenuButton (Window* pParentWindow); static ImageRadioButton* CreateTabItem (Window* pParentWindow); - static ToolBox* CreateToolBox (Window* pParentWindow, const ResId& rResId); + + /** Create a tool box that does *not* handle its items. + */ + static SidebarToolBox* CreateToolBox ( + Window* pParentWindow, + const ResId& rResId); + + /** Create a tool box that *does* handle its items. + */ + static SidebarToolBox* CreateToolBox ( + Window* pParentWindow, + const ResId& rResId, + const ::com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rxFrame); + static Window* CreateToolBoxBackground (Window* pParentWindow); static ImageRadioButton* CreateCustomImageRadionButton( Window* pParentWindow, diff --git a/include/sfx2/sidebar/ControllerFactory.hxx b/include/sfx2/sidebar/ControllerFactory.hxx new file mode 100644 index 000000000000..030b050adfb9 --- /dev/null +++ b/include/sfx2/sidebar/ControllerFactory.hxx @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_CONTROLLER_FACTORY_HXX +#define SFX_SIDEBAR_CONTROLLER_FACTORY_HXX + +#include "sfx2/dllapi.h" +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +class ToolBox; + +namespace sfx2 { namespace sidebar { + +/** Convenience class for easy creation of toolbox controllers. +*/ +class SFX2_DLLPUBLIC ControllerFactory +{ +public: + static cssu::Reference<css::frame::XToolbarController> CreateToolBoxController( + ToolBox* pToolBox, + const sal_uInt16 nItemId, + const ::rtl::OUString& rsCommandName, + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx index b11f3bfa7d28..f45ecd9b27d8 100644 --- a/include/sfx2/sidebar/EnumContext.hxx +++ b/include/sfx2/sidebar/EnumContext.hxx @@ -125,6 +125,9 @@ public: sal_Int32 GetCombinedContext_DI(void) const; const ::rtl::OUString& GetApplicationName (void) const; + Application GetApplication (void) const; + Application GetApplication_DI (void) const; + const ::rtl::OUString& GetContextName (void) const; bool operator == (const EnumContext aOther); diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx new file mode 100644 index 000000000000..37717ad1b3b4 --- /dev/null +++ b/include/sfx2/sidebar/SidebarToolBox.hxx @@ -0,0 +1,101 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SFX_SIDEBAR_TOOLBOX_HXX +#define SFX_SIDEBAR_TOOLBOX_HXX + +#include "sfx2/dllapi.h" +#include "vcl/toolbox.hxx" +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/util/URL.hpp> +#include <map> + +namespace css = ::com::sun::star; +namespace cssu = ::com::sun::star::uno; + +namespace sfx2 { namespace sidebar { + +/** The sidebar tool box has two responsibilities: + 1. Coordinated location, size, and other states with its parent + background window. + 2. Create and handle tool bar controller for its items. +*/ +class SFX2_DLLPUBLIC SidebarToolBox + : public ToolBox +{ +public: + /** Create a new tool box. + When a valid XFrame is given then the tool box will handle its + buttons and drop-downs. Otherwise the caller has to do that. + */ + SidebarToolBox ( + Window* pParentWindow, + const ResId& rResId, + const cssu::Reference<css::frame::XFrame>& rxFrame); + virtual ~SidebarToolBox (void); + + void SetBorderWindow (const Window* pBorderWindow); + virtual void Paint (const Rectangle& rRect); + + virtual Point GetPosPixel (void) const; + virtual void SetPosSizePixel ( + long nX, + long nY, + long nWidth, + long nHeight, + sal_uInt16 nFlags); + virtual long Notify (NotifyEvent& rEvent); + + cssu::Reference<css::frame::XToolbarController> GetControllerForItemId ( + const sal_uInt16 nItemId) const; + sal_uInt16 GetItemIdForSubToolbarName ( + const ::rtl::OUString& rsCOmmandName) const; + +private: + bool mbParentIsBorder; + Image maItemSeparator; + class ItemDescriptor + { + public: + cssu::Reference<css::frame::XToolbarController> mxController; + css::util::URL maURL; + rtl::OUString msCurrentCommand; + cssu::Reference<css::frame::XDispatch> mxDispatch; + }; + typedef ::std::map<sal_uInt16, ItemDescriptor> ControllerContainer; + ControllerContainer maControllers; + + DECL_LINK(DropDownClickHandler, ToolBox*); + DECL_LINK(ClickHandler, ToolBox*); + DECL_LINK(DoubleClickHandler, ToolBox*); + DECL_LINK(SelectHandler, ToolBox*); + DECL_LINK(Activate, ToolBox*); + DECL_LINK(Deactivate, ToolBox*); + + void CreateController ( + const sal_uInt16 nItemId, + const cssu::Reference<css::frame::XFrame>& rxFrame); + void UpdateIcons ( + const cssu::Reference<css::frame::XFrame>& rxFrame); +}; + + +} } // end of namespace sfx2::sidebar + +#endif |