diff options
Diffstat (limited to 'sfx2')
21 files changed, 55 insertions, 203 deletions
diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx index dc254db718d0..a924a24efba2 100644 --- a/sfx2/source/sidebar/CommandInfoProvider.cxx +++ b/sfx2/source/sidebar/CommandInfoProvider.cxx @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "CommandInfoProvider.hxx" +#include "sfx2/sidebar/CommandInfoProvider.hxx" #include <comphelper/processfactory.hxx> #include <svtools/acceleratorexecute.hxx> diff --git a/sfx2/source/sidebar/CommandInfoProvider.hxx b/sfx2/source/sidebar/CommandInfoProvider.hxx deleted file mode 100644 index 8278111858d2..000000000000 --- a/sfx2/source/sidebar/CommandInfoProvider.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 SIDEBAR_COMMAND_INFO_PROVIDER_HXX -#define SIDEBAR_COMMAND_INFO_PROVIDER_HXX - -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> - - -namespace css = ::com::sun::star; -namespace cssu = ::com::sun::star::uno; - -namespace sfx2 { namespace sidebar { - -/** Provide information about UNO commands like tooltip text with - keyboard accelerator. -*/ -class CommandInfoProvider -{ -public: - /** Return the singleton instance. - - It caches some objects for the last XFrame object given to - GetLabelForCommand. These objects are release and created new - when that method is called with a different XFrame from the - last call. - - Lifetime control should work but could be more elegant. - */ - static CommandInfoProvider& Instance (void); - - /** Return a label for the given command. - @param rsCommandName - The command name is expected to start with .uno: - @param rxFrame - The frame is used to identify the module and document. - @return - The returned label contains the keyboard accelerator, if - one is defined. - */ - ::rtl::OUString GetLabelForCommand ( - const ::rtl::OUString& rsCommandName, - const cssu::Reference<css::frame::XFrame>& rxFrame); - - /** Do not call. Should be part of a local and hidden interface. - */ - void SetFrame (const cssu::Reference<css::frame::XFrame>& rxFrame); - - private: - cssu::Reference<css::lang::XMultiServiceFactory> mxServiceFactory; - cssu::Reference<css::frame::XFrame> mxCachedDataFrame; - cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration; - cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration; - cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration; - ::rtl::OUString msCachedModuleIdentifier; - cssu::Reference<css::lang::XComponent> mxFrameListener; - - CommandInfoProvider (void); - ~CommandInfoProvider (void); - - cssu::Reference<css::ui::XAcceleratorConfiguration> GetDocumentAcceleratorConfiguration (void); - cssu::Reference<css::ui::XAcceleratorConfiguration> GetModuleAcceleratorConfiguration (void); - cssu::Reference<css::ui::XAcceleratorConfiguration> GetGlobalAcceleratorConfiguration(void); - ::rtl::OUString GetModuleIdentifier (void); - ::rtl::OUString GetCommandShortcut (const ::rtl::OUString& rCommandName); - cssu::Sequence<css::beans::PropertyValue> GetCommandProperties ( - const ::rtl::OUString& rsCommandName); - ::rtl::OUString GetCommandLabel (const ::rtl::OUString& rsCommandName); - rtl::OUString RetrieveShortcutsFromConfiguration( - const cssu::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration, - const rtl::OUString& rsCommandName); -}; - -} } // end of namespace sfx2/framework - -#endif diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index 979dd8a3547b..521a2953cea1 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -22,7 +22,7 @@ #include "sfx2/imagemgr.hxx" #include "sfx2/bindings.hxx" #include <unotools/cmdoptions.hxx> -#include "CommandInfoProvider.hxx" +#include "sfx2/sidebar/CommandInfoProvider.hxx" #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> diff --git a/sfx2/source/sidebar/CustomImageRadioButton.cxx b/sfx2/source/sidebar/CustomImageRadioButton.cxx index adc0eed9cc97..1d50101f8bbc 100644 --- a/sfx2/source/sidebar/CustomImageRadioButton.cxx +++ b/sfx2/source/sidebar/CustomImageRadioButton.cxx @@ -19,7 +19,7 @@ #include "DrawHelper.hxx" #include "Paint.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index a1f32ebed59b..91929f8a1fa0 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -24,7 +24,7 @@ #include "Paint.hxx" #include "Panel.hxx" #include "ToolBoxBackground.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Theme.hxx" #include <vcl/dockwin.hxx> diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index 008da73ba1ea..0370ef85dadd 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -22,7 +22,7 @@ #include <vcl/image.hxx> #ifdef DEBUG -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #endif diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index b5c2ec552333..f213a8c58504 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -18,7 +18,7 @@ #include "FocusManager.hxx" #include "Panel.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "TitleBar.hxx" #include <vcl/button.hxx> #include <vcl/toolbox.hxx> diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx index 5b28220b8637..0a5180e918b8 100644 --- a/sfx2/source/sidebar/MenuButton.cxx +++ b/sfx2/source/sidebar/MenuButton.cxx @@ -20,7 +20,7 @@ #include "DrawHelper.hxx" #include "Paint.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Theme.hxx" using namespace ::com::sun::star; diff --git a/sfx2/source/sidebar/Paint.cxx b/sfx2/source/sidebar/Paint.cxx index 20f9bb938113..3f02fb8399b9 100644 --- a/sfx2/source/sidebar/Paint.cxx +++ b/sfx2/source/sidebar/Paint.cxx @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include "Paint.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include <com/sun/star/awt/Gradient.hpp> diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 19b0588265e0..b5bfcf2bc481 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -23,7 +23,7 @@ #include "Paint.hxx" #ifdef DEBUG -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "Deck.hxx" #endif diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index 28f819bf3954..0175741d0daf 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -27,7 +27,7 @@ #include <vcl/image.hxx> #ifdef DEBUG -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #endif diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 26d6e4d8f0ef..683856257d5f 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -17,7 +17,7 @@ */ #include "ResourceManager.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include <unotools/confignode.hxx> #include <comphelper/componentcontext.hxx> diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 7a6ef5e20192..6f4c95e56ddc 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -24,9 +24,9 @@ #include "TabBar.hxx" #include "sfx2/sidebar/Theme.hxx" #include "sfx2/sidebar/SidebarChildWindow.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "SidebarDockingWindow.hxx" #include "Context.hxx" -#include "Tools.hxx" #include "sfxresid.hxx" #include "sfx2/sfxsids.hrc" @@ -138,8 +138,8 @@ SidebarController::SidebarController ( // Get the dispatch object as preparation to listen for changes of // the read-only state. - const util::URL aURL (GetURL(gsReadOnlyCommandName)); - mxReadOnlyModeDispatch = GetDispatch(aURL); + const util::URL aURL (Tools::GetURL(gsReadOnlyCommandName)); + mxReadOnlyModeDispatch = Tools::GetDispatch(mxFrame, aURL); if (mxReadOnlyModeDispatch.is()) mxReadOnlyModeDispatch->addStatusListener(this, aURL); @@ -168,7 +168,7 @@ void SAL_CALL SidebarController::disposing (void) static_cast<css::ui::XContextChangeEventListener*>(this)); if (mxReadOnlyModeDispatch.is()) - mxReadOnlyModeDispatch->removeStatusListener(this, GetURL(gsReadOnlyCommandName)); + mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName)); if (mpSplitWindow != NULL) { mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler)); @@ -803,8 +803,8 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co { try { - const util::URL aURL (GetURL(rsMenuCommand)); - Reference<frame::XDispatch> xDispatch (GetDispatch(aURL)); + const util::URL aURL (Tools::GetURL(rsMenuCommand)); + Reference<frame::XDispatch> xDispatch (Tools::GetDispatch(mxFrame, aURL)); if (xDispatch.is()) xDispatch->dispatch(aURL, Sequence<beans::PropertyValue>()); } @@ -818,33 +818,6 @@ void SidebarController::ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) co -util::URL SidebarController::GetURL (const ::rtl::OUString& rsCommand) const -{ - util::URL aURL; - aURL.Complete = rsCommand; - - const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); - const Reference<util::XURLTransformer> xParser ( - aComponentContext.createComponent("com.sun.star.util.URLTransformer"), - UNO_QUERY_THROW); - xParser->parseStrict(aURL); - - return aURL; -} - - - - -Reference<frame::XDispatch> SidebarController::GetDispatch (const util::URL& rURL) const -{ - Reference<frame::XDispatchProvider> xProvider (mxFrame, UNO_QUERY_THROW); - Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(rURL, OUString(), 0)); - return xDispatch; -} - - - - ::boost::shared_ptr<PopupMenu> SidebarController::CreatePopupMenu ( const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx index 0aa088306ca5..ec93b062c0b8 100644 --- a/sfx2/source/sidebar/SidebarController.hxx +++ b/sfx2/source/sidebar/SidebarController.hxx @@ -177,8 +177,6 @@ private: const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; void ShowDetailMenu (const ::rtl::OUString& rsMenuCommand) const; - css::util::URL GetURL (const ::rtl::OUString& rsCommand) const; - cssu::Reference<css::frame::XDispatch> GetDispatch (const css::util::URL& rURL) const; ::boost::shared_ptr<PopupMenu> CreatePopupMenu ( const ::std::vector<TabBar::DeckMenuData>& rDeckSelectionData, const ::std::vector<TabBar::DeckMenuData>& rDeckShowData) const; diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 6a404dfec2c6..6992afb453e3 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -18,7 +18,7 @@ #include "SidebarToolBox.hxx" #include "ToolBoxBackground.hxx" #include "sfx2/sidebar/Theme.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include <vcl/gradient.hxx> diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index feebb14ec223..bde7039436ae 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -22,7 +22,7 @@ #include "DeckDescriptor.hxx" #include "Paint.hxx" #include "sfx2/sidebar/Theme.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "FocusManager.hxx" #include <vcl/gradient.hxx> diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx index 8bc0fd9fdb74..a7a1eec4e1ed 100644 --- a/sfx2/source/sidebar/TabItem.cxx +++ b/sfx2/source/sidebar/TabItem.cxx @@ -20,7 +20,7 @@ #include "DrawHelper.hxx" #include "Paint.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Theme.hxx" diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx index 81d951731f74..a23421575859 100644 --- a/sfx2/source/sidebar/Theme.cxx +++ b/sfx2/source/sidebar/Theme.cxx @@ -18,7 +18,7 @@ #include "sfx2/sidebar/Theme.hxx" #include "Paint.hxx" #include "SidebarResource.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include <tools/svborder.hxx> #include <tools/rc.hxx> diff --git a/sfx2/source/sidebar/ToolBoxBackground.cxx b/sfx2/source/sidebar/ToolBoxBackground.cxx index 1336c03478ed..42aebbe773d8 100644 --- a/sfx2/source/sidebar/ToolBoxBackground.cxx +++ b/sfx2/source/sidebar/ToolBoxBackground.cxx @@ -18,7 +18,7 @@ #include "ToolBoxBackground.hxx" #include "Paint.hxx" #include "DrawHelper.hxx" -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Theme.hxx" #include <vcl/toolbox.hxx> diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index 27956cd6670d..881545864ae9 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -16,7 +16,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "Tools.hxx" +#include "sfx2/sidebar/Tools.hxx" #include "sfx2/sidebar/Theme.hxx" @@ -26,7 +26,9 @@ #include <comphelper/namedvaluecollection.hxx> #include <vcl/gradient.hxx> +#include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> #include <cstring> @@ -147,4 +149,34 @@ SvBorder Tools::RectangleToSvBorder (const Rectangle aBox) aBox.Bottom()); } + + + +util::URL Tools::GetURL (const ::rtl::OUString& rsCommand) +{ + util::URL aURL; + aURL.Complete = rsCommand; + + const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); + const Reference<util::XURLTransformer> xParser ( + aComponentContext.createComponent("com.sun.star.util.URLTransformer"), + UNO_QUERY_THROW); + xParser->parseStrict(aURL); + + return aURL; +} + + + + +Reference<frame::XDispatch> Tools::GetDispatch ( + const cssu::Reference<css::frame::XFrame>& rxFrame, + const util::URL& rURL) +{ + Reference<frame::XDispatchProvider> xProvider (rxFrame, UNO_QUERY_THROW); + Reference<frame::XDispatch> xDispatch (xProvider->queryDispatch(rURL, ::rtl::OUString(), 0)); + return xDispatch; +} + + } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/Tools.hxx b/sfx2/source/sidebar/Tools.hxx deleted file mode 100644 index 70bc7f995d0c..000000000000 --- a/sfx2/source/sidebar/Tools.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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_TOOLS_HXX -#define SFX_SIDEBAR_TOOLS_HXX - -#include <vcl/image.hxx> -#include <vcl/gradient.hxx> -#include <tools/svborder.hxx> - -#include <com/sun/star/awt/Gradient.hpp> -#include <com/sun/star/frame/XFrame.hpp> - - -#define A2S(s) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))) -#define S2A(s) rtl::OUStringToOString(s, RTL_TEXTENCODING_ASCII_US).getStr() - -namespace css = ::com::sun::star; -namespace cssu = ::com::sun::star::uno; - - -namespace sfx2 { namespace sidebar { - -class Tools -{ -public: - static Image GetImage ( - const ::rtl::OUString& rsImageURL, - const ::rtl::OUString& rsHighContrastImageURL, - const cssu::Reference<css::frame::XFrame>& rxFrame); - - static Image GetImage ( - const ::rtl::OUString& rsURL, - const cssu::Reference<css::frame::XFrame>& rxFrame); - - static css::awt::Gradient VclToAwtGradient (const Gradient aGradient); - static Gradient AwtToVclGradient (const css::awt::Gradient aGradient); - - static SvBorder RectangleToSvBorder (const Rectangle aBox); -}; - - -} } // end of namespace sfx2::sidebar - -#endif |