diff options
-rw-r--r-- | chart2/Library_chartcontroller.mk | 1 | ||||
-rw-r--r-- | chart2/source/controller/chartcontroller.component | 4 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 149 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/Chart2PanelFactory.hxx | 71 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu | 14 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 136 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/Context.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 1 |
10 files changed, 387 insertions, 2 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index f77ef70b9056..be73e1e4d842 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -188,6 +188,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/main/UndoActions \ chart2/source/controller/main/UndoCommandDispatch \ chart2/source/controller/main/UndoGuard \ + chart2/source/controller/sidebar/Chart2PanelFactory \ )) # Runtime dependency for unit-tests diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component index 396656db1e1b..045d61f244dc 100644 --- a/chart2/source/controller/chartcontroller.component +++ b/chart2/source/controller/chartcontroller.component @@ -51,4 +51,8 @@ constructor="com_sun_star_comp_chart2_WizardDialog_get_implementation"> <service name="com.sun.star.chart2.WizardDialog"/> </implementation> + <implementation name="org.libreoffice.comp.chart2.sidebar.ChartPanelFactory" + constructor="org_libreoffice_comp_chart2_sidebar_ChartPanelFactory"> + <service name="com.sun.star.ui.UIElementFactory"/> + </implementation> </component> diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx new file mode 100644 index 000000000000..13df31f0ed31 --- /dev/null +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#include "Chart2PanelFactory.hxx" + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <comphelper/namedvaluecollection.hxx> +#include <cppuhelper/supportsservice.hxx> + +using namespace css; +using namespace css::uno; +using ::rtl::OUString; + +namespace chart { namespace sidebar { + +ChartPanelFactory::ChartPanelFactory() + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + +ChartPanelFactory::~ChartPanelFactory() +{ +} + +Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException, std::exception) +{ + Reference<ui::XUIElement> xElement; + + try + { + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + "PanelFactory::createUIElement called without ParentWindow", + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + "PanelFactory::createUIElement called without Frame", + NULL); + if (pBindings == NULL) + throw RuntimeException( + "PanelFactory::createUIElement called without SfxBindings", + NULL); + + sal_Int32 nMinimumSize = -1; + VclPtr<vcl::Window> pPanel; + /* + if (rsResourceURL.endsWith("/AlignmentPropertyPanel")) + pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel")) + pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel")) + pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + else if (rsResourceURL.endsWith("/NavigatorPanel")) + { + pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, nullptr, pParentWindow, false); + nMinimumSize = 0; + } + else if (rsResourceURL.endsWith("/FunctionsPanel")) + { + pPanel = VclPtr<ScFunctionDockWin>::Create(pBindings, nullptr, pParentWindow, ScResId(FID_FUNCTION_BOX)); + nMinimumSize = 0; + } + */ + + if (pPanel) + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(nMinimumSize,-1,-1)); + } + catch (const uno::RuntimeException &) + { + throw; + } + catch (const uno::Exception& e) + { + throw lang::WrappedTargetRuntimeException( + OUString("ChartPanelFactory::createUIElement exception"), + 0, uno::makeAny(e)); + } + + return xElement; +} + +OUString ChartPanelFactory::getImplementationName() + throw (css::uno::RuntimeException, std::exception) +{ + return OUString("org.libreoffice.comp.chart2.sidebar.ChartPanelFactory"); +} + +sal_Bool ChartPanelFactory::supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) +{ + return cppu::supportsService(this, ServiceName); +} + +css::uno::Sequence<OUString> ChartPanelFactory::getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) +{ + css::uno::Sequence<OUString> aServiceNames(1); + aServiceNames[0] = "com.sun.star.ui.UIElementFactory"; + return aServiceNames; +} + +} } // end of namespace chart::sidebar + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL +org_libreoffice_comp_chart2_sidebar_ChartPanelFactory(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new chart::sidebar::ChartPanelFactory()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx new file mode 100644 index 000000000000..c96813ce6a3e --- /dev/null +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 INCLUDED_SC_INC_SCPANELFACTORY_HXX +#define INCLUDED_SC_INC_SCPANELFACTORY_HXX + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <boost/noncopyable.hpp> + + +namespace chart { namespace sidebar { + +namespace +{ + typedef ::cppu::WeakComponentImplHelper < + css::ui::XUIElementFactory, css::lang::XServiceInfo + > PanelFactoryInterfaceBase; +} + +class ChartPanelFactory + : private ::boost::noncopyable, + private ::cppu::BaseMutex, + public PanelFactoryInterfaceBase +{ +public: + ChartPanelFactory(); + virtual ~ChartPanelFactory(); + + // XUIElementFactory + virtual css::uno::Reference<css::ui::XUIElement> SAL_CALL createUIElement( + const ::rtl::OUString& rsResourceURL, + const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments) + throw( + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; + + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; +}; + +} } // end of namespace sc::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu index 15c0a04bc072..c26b96ec287b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu @@ -132,6 +132,20 @@ <value>org.apache.openoffice.comp.sw.sidebar.SwPanelFactory</value> </prop> </node> + <node oor:name="ChartPanelFactory" oor:op="replace"> + <prop oor:name="Type"> + <value>toolpanel</value> + </prop> + <prop oor:name="Name"> + <value>ChartPanelFactory</value> + </prop> + <prop oor:name="Module"> + <value></value> + </prop> + <prop oor:name="FactoryImplementation"> + <value>org.libreoffice.comp.chart2.sidebar.ChartPanelFactory</value> + </prop> + </node> </node> </node> </oor:component-data> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index e20b1b0cfe8a..a6ce71ccbb7c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -231,6 +231,26 @@ </prop> </node> + <node oor:name="ChartDeck" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Chart</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="IconURL" oor:type="xs:string"> + <value>private:graphicrepository/sfx2/res/symphony/sidebar-style-large.png</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>10</value> + </prop> + </node> + </node> <node oor:name="PanelList"> @@ -1118,6 +1138,122 @@ <value>true</value> </prop> </node> + + <node oor:name="ChartElementsPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Elements</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartElementsPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ChartPanelFactory/ElementsPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + + <node oor:name="ChartAreaPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Area</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartAreaPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ChartPanelFactory/AreaPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>2</value> + </prop> + </node> + + <node oor:name="ChartLinePanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Line</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartLinePanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ChartPanelFactory/LinePanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>3</value> + </prop> + </node> + + <node oor:name="ChartCharacterPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Character</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartCharacterPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ChartPanelFactory/CharacterPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>4</value> + </prop> + </node> + + <node oor:name="ChartAxisPanel" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Axis</value> + </prop> + <prop oor:name="Id" oor:type="xs:string"> + <value>ChartAxisPanel</value> + </prop> + <prop oor:name="DeckId" oor:type="xs:string"> + <value>ChartDeck</value> + </prop> + <prop oor:name="ContextList"> + <value oor:separator=";"> + Chart, any, visible ; + </value> + </prop> + <prop oor:name="ImplementationURL" oor:type="xs:string"> + <value>private:resource/toolpanel/ChartPanelFactory/AxisPanel</value> + </prop> + <prop oor:name="OrderIndex" oor:type="xs:int"> + <value>5</value> + </prop> + </node> + </node> </node> </oor:component-data> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs index d5b90e022ca3..1e6234a4ebda 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs @@ -86,12 +86,14 @@ com.sun.star.sheet.SpreadsheetDocument com.sun.star.presentation.PresentationDocument com.sun.star.drawing.DrawingDocument + com.sun.star.chart2.ChartDocument Recognized shortcuts: Writer Calc Impress Draw + Chart Shortcuts for multiple applications: DrawImpress diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx index 3a7ce010b24c..9baf30b07777 100644 --- a/sfx2/source/sidebar/Context.cxx +++ b/sfx2/source/sidebar/Context.cxx @@ -46,7 +46,14 @@ Context::Context ( sal_Int32 Context::EvaluateMatch ( const Context& rOther) const { - const bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName); + bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName); + + // special case for charts which use a whole own set of decks + if (msApplication == "com.sun.star.chart2.ChartDocument") + { + bApplicationNameIsAny = false; + } + if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny) { // Application name matches. diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 93a1b89c904c..bce5bbc7321a 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -416,6 +416,8 @@ void ResourceManager::ReadContextList ( aApplications.push_back(EnumContext::Application_Draw); else if (sApplicationName == "Impress") aApplications.push_back(EnumContext::Application_Impress); + else if (sApplicationName == "Chart") + aApplications.push_back(EnumContext::Application_Chart); else if (sApplicationName == "DrawImpress") { // A special case among the special names: it is diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 027c886089b4..c67447f0770a 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -548,7 +548,6 @@ void SidebarController::CreateDeck(const ::rtl::OUString& rDeckId) ::boost::bind(&SidebarController::RequestCloseDeck, this)); mpResourceManager->SetDeckToDescriptor(rDeckId, aDeck); - } } |