chart2/Library_chartcontroller.mk | 2 chart2/UIConfig_chart2.mk | 1 chart2/source/controller/chartcontroller.component | 4 chart2/source/controller/main/ChartController.cxx | 50 chart2/source/controller/main/ChartController.hxx | 8 chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 151 ++ chart2/source/controller/sidebar/Chart2PanelFactory.hxx | 71 + chart2/source/controller/sidebar/ChartElementsPanel.cxx | 150 ++ chart2/source/controller/sidebar/ChartElementsPanel.hxx | 99 + chart2/uiconfig/ui/sidebarelements.ui | 525 ++++++++++ framework/source/uifactory/uielementfactorymanager.cxx | 6 include/sfx2/sidebar/EnumContext.hxx | 2 include/sfx2/sidebar/ResourceManager.hxx | 10 include/sfx2/sidebar/SidebarController.hxx | 9 include/sfx2/sidebar/Tools.hxx | 2 include/sfx2/sidebar/UnoSidebar.hxx | 4 offapi/com/sun/star/ui/XSidebarProvider.idl | 6 officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu | 14 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu | 136 ++ officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 2 sc/source/ui/view/tabvwsh4.cxx | 258 ++-- sfx2/source/sidebar/Context.cxx | 9 sfx2/source/sidebar/ControllerFactory.cxx | 2 sfx2/source/sidebar/EnumContext.cxx | 2 sfx2/source/sidebar/ResourceManager.cxx | 20 sfx2/source/sidebar/SidebarController.cxx | 114 +- sfx2/source/sidebar/Tools.cxx | 6 sfx2/source/sidebar/UnoDecks.cxx | 4 sfx2/source/sidebar/UnoPanels.cxx | 4 sfx2/source/sidebar/UnoSidebar.cxx | 6 30 files changed, 1474 insertions(+), 203 deletions(-)
New commits: commit 5a0017f890b84fdc90db2bb95cb157fdf9eb9923 Author: Markus Mohrhard <[email protected]> Date: Sun Jul 12 18:54:33 2015 +0200 avoid crash in unit test due to global objects The lifecycle of the XFrame and the XController are both correct but getCurrentController has already been reset when the SidebarController::dispose is called. This avoids then calling the XController destructor during exit when taking a SolarMutex is a problem. Change-Id: I54470f091e506fb397e2424d2d3c4ac051cae924 diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index c67447f..403a40b 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -221,16 +221,11 @@ void SAL_CALL SidebarController::disposing() aDeck.disposeAndClear(); } - SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame->getController())); - if (iEntry != maSidebarControllerContainer.end()) - maSidebarControllerContainer.erase(iEntry); + uno::Reference<css::frame::XController> xController = mxFrame->getController(); + if (!xController.is()) + xController = mxCurrentController; - css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( - css::ui::ContextChangeEventMultiplexer::get( - ::comphelper::getProcessComponentContext())); - if (xMultiplexer.is()) - xMultiplexer->removeAllContextChangeEventListeners( - static_cast<css::ui::XContextChangeEventListener*>(this)); + unregisterSidebarForFrame(this, xController); if (mxReadOnlyModeDispatch.is()) mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName)); commit 5d5667062c228f83db0c2a7c5967619f012c809b Author: Markus Mohrhard <[email protected]> Date: Fri Jul 10 02:25:58 2015 +0200 add ChartElements panel Change-Id: I935a0d637a9ea3a1716d6e839e65c4e565a2c840 diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index be73e1e..884404e 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -189,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/main/UndoCommandDispatch \ chart2/source/controller/main/UndoGuard \ chart2/source/controller/sidebar/Chart2PanelFactory \ + chart2/source/controller/sidebar/ChartElementsPanel \ )) # Runtime dependency for unit-tests diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index d59c29e..ab8ce34 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -42,6 +42,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\ chart2/uiconfig/ui/insertgriddlg \ chart2/uiconfig/ui/inserttitledlg \ chart2/uiconfig/ui/paradialog \ + chart2/uiconfig/ui/sidebarelements \ chart2/uiconfig/ui/smoothlinesdlg \ chart2/uiconfig/ui/steppedlinesdlg \ chart2/uiconfig/ui/titlerotationtabpage \ diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx index 13df31f..3d89b61 100644 --- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx @@ -29,6 +29,8 @@ #include <comphelper/namedvaluecollection.hxx> #include <cppuhelper/supportsservice.hxx> +#include "ChartElementsPanel.hxx" + using namespace css; using namespace css::uno; using ::rtl::OUString; @@ -78,9 +80,9 @@ Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( sal_Int32 nMinimumSize = -1; VclPtr<vcl::Window> pPanel; + if (rsResourceURL.endsWith("/ElementsPanel")) + pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings ); /* - 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")) diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx new file mode 100644 index 0000000..6775659 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -0,0 +1,150 @@ +/* -*- 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 <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include "ChartElementsPanel.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/imagemgr.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> + +using namespace css; +using namespace css::uno; +using ::sfx2::sidebar::Theme; + +namespace chart { namespace sidebar { + +ChartElementsPanel::ChartElementsPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + get(mpCBTitle, "checkbutton_title"); + get(mpCBSubtitle, "checkbutton_subtitle"); + get(mpCBXAxis, "checkbutton_x_axis"); + get(mpCBXAxisTitle, "checkbutton_x_axis_title"); + get(mpCBYAxis, "checkbutton_y_axis"); + get(mpCBYAxisTitle, "checkbutton_y_axis_title"); + get(mpCBZAxis, "checkbutton_z_axis"); + get(mpCBZAxisTitle, "checkbutton_z_axis_title"); + get(mpCB2ndXAxis, "checkbutton_2nd_x_axis"); + get(mpCB2ndXAxisTitle, "checkbutton_2nd_x_axis_title"); + get(mpCB2ndYAxis, "checkbutton_2nd_y_axis"); + get(mpCB2ndYAxisTitle, "checkbutton_2nd_y_axis_title"); + get(mpCBLegend, "checkbutton_legend"); + get(mpCBGridVertical, "checkbutton_gridline_vertical"); + get(mpCBGridHorizontal, "checkbutton_gridline_horizontal"); + get(mpCBShowLabel, "checkbutton_label"); + get(mpCBTrendline, "checkbutton_trendline"); + + Initialize(); +} + +ChartElementsPanel::~ChartElementsPanel() +{ + disposeOnce(); +} + +void ChartElementsPanel::dispose() +{ + mpCBTitle.clear(); + mpCBSubtitle.clear(); + mpCBXAxis.clear(); + mpCBXAxisTitle.clear(); + mpCBYAxis.clear(); + mpCBYAxisTitle.clear(); + mpCBZAxis.clear(); + mpCBZAxisTitle.clear(); + mpCB2ndXAxis.clear(); + mpCB2ndXAxisTitle.clear(); + mpCB2ndYAxis.clear(); + mpCB2ndYAxisTitle.clear(); + mpCBLegend.clear(); + mpCBGridVertical.clear(); + mpCBGridHorizontal.clear(); + mpCBShowLabel.clear(); + mpCBTrendline.clear(); + + PanelLayout::dispose(); +} + +void ChartElementsPanel::Initialize() +{ +} + +VclPtr<vcl::Window> ChartElementsPanel::Create ( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException("no XFrame given to ChartElementsPanel::Create", NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException("no SfxBindings given to ChartElementsPanel::Create", NULL, 2); + + return VclPtr<ChartElementsPanel>::Create( + pParent, rxFrame, pBindings); +} + +void ChartElementsPanel::DataChanged( + const DataChangedEvent& ) +{ +} + +void ChartElementsPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext& rContext) +{ + if(maContext == rContext) + { + // Nothing to do. + return; + } + + maContext = rContext; +} + +void ChartElementsPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState /*eState*/, + const SfxPoolItem* /*pState*/, + const bool ) +{ + switch(nSID) + { + default: + ; + } +} + +}} // end of namespace ::chart::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx new file mode 100644 index 0000000..f07ab66 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -0,0 +1,99 @@ +/* -*- 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_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTELEMENTSPANEL_HXX + +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <svx/sidebar/PanelLayout.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class ListBox; +class NumericField; + +namespace chart { namespace sidebar { + +class ChartElementsPanel : public PanelLayout, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static VclPtr<vcl::Window> Create( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent) SAL_OVERRIDE; + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext& rContext) SAL_OVERRIDE; + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState, + const bool bIsEnabled) SAL_OVERRIDE; + + SfxBindings* GetBindings() { return mpBindings;} + + // constructor/destuctor + ChartElementsPanel( + vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~ChartElementsPanel(); + virtual void dispose() SAL_OVERRIDE; +private: + //ui controls + VclPtr<ListBox> mpLbCategory; + VclPtr<ToolBox> mpTBCategory; + VclPtr<NumericField> mpEdDecimals; + VclPtr<NumericField> mpEdLeadZeroes; + VclPtr<CheckBox> mpCBTitle; + VclPtr<CheckBox> mpCBSubtitle; + VclPtr<CheckBox> mpCBXAxis; + VclPtr<CheckBox> mpCBXAxisTitle; + VclPtr<CheckBox> mpCBYAxis; + VclPtr<CheckBox> mpCBYAxisTitle; + VclPtr<CheckBox> mpCBZAxis; + VclPtr<CheckBox> mpCBZAxisTitle; + VclPtr<CheckBox> mpCB2ndXAxis; + VclPtr<CheckBox> mpCB2ndXAxisTitle; + VclPtr<CheckBox> mpCB2ndYAxis; + VclPtr<CheckBox> mpCB2ndYAxisTitle; + VclPtr<CheckBox> mpCBLegend; + VclPtr<CheckBox> mpCBGridVertical; + VclPtr<CheckBox> mpCBGridHorizontal; + VclPtr<CheckBox> mpCBShowLabel; + VclPtr<CheckBox> mpCBTrendline; + + css::uno::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + void Initialize(); +}; + +} } // end of namespace ::chart::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui new file mode 100644 index 0000000..0f92814 --- /dev/null +++ b/chart2/uiconfig/ui/sidebarelements.ui @@ -0,0 +1,525 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <object class="GtkGrid" id="ChartElementsPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_homogeneous">True</property> + <property name="column_homogeneous">True</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label_title"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Title</property> + <property name="justify">right</property> + <property name="ellipsize">end</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_title"> + <property name="label" translatable="yes">Title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_subtitle"> + <property name="label" translatable="yes">Subtitle</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_axes"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Axes</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_x_axis"> + <property name="label" translatable="yes">X-Axis</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbuttonx_axis_title"> + <property name="label" translatable="yes">X-axis title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_y_axis"> + <property name="label" translatable="yes">Y-Axis</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbuttony_y_axis_title"> + <property name="label" translatable="yes">Y-axis title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_z_axis"> + <property name="label" translatable="yes">Z-Axis</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="yalign">0.47999998927116394</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_z_axis_title"> + <property name="label" translatable="yes">Z-axis title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">6</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_2nd_x_axis"> + <property name="label" translatable="yes">2nd X-Axis</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_2nd_x_axis_title"> + <property name="label" translatable="yes">2nd X-axis title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">7</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_2nd_y_axis"> + <property name="label" translatable="yes">2nd Y-Axis</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="yalign">0.54000002145767212</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_2nd_y_axis_title"> + <property name="label" translatable="yes">2nd Y-axis title</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_legend"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Legend</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">9</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_legend"> + <property name="label" translatable="yes">Show</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">bottom left</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">10</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_grid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Gridlines +</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">11</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_gridline_vertical"> + <property name="label" translatable="yes">Vertical</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">major</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">12</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_gridline_horizontal"> + <property name="label" translatable="yes">Horizontal</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="yalign">0.56000000238418579</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">major</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">13</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_data"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Data</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">14</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_label"> + <property name="label" translatable="yes">Show label</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">above</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">15</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkCheckButton" id="checkbutton_trendline"> + <property name="label" translatable="yes">Trendline</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">linear</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">16</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> commit b33b2afe6a8b4224450da7c686beb81dbf5cd24a Author: Markus Mohrhard <[email protected]> Date: Thu Jul 9 20:39:06 2015 +0200 big step towards real chart sidebar Change-Id: I9b7d1f963746f7689b02099fbae77c9c943bad58 diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index f77ef70..be73e1e 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 396656d..045d61f 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 0000000..13df31f --- /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 0000000..c96813c --- /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 15c0a04..c26b96e 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 e20b1b0..a6ce71c 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 d5b90e0..1e6234a 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 3a7ce01..9baf30b 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 93a1b89..bce5bbc 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 027c886..c67447f 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); - } } commit 5a72bbd483ddf6c7cc949a8708d1697654cc9ce2 Author: Markus Mohrhard <[email protected]> Date: Thu Jul 9 20:37:31 2015 +0200 allow also to use non-frame modules for sidebar One more step away from using the frame as key and moving to the controller. Change-Id: I438b7eea2161d49a6f2cbf649bf01b8a2e233ebd diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index d2b6645..39483ee 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -427,6 +427,7 @@ Reference< XUIElement > SAL_CALL UIElementFactoryManager::createUIElement( throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) { Reference< XFrame > xFrame; + OUString aModuleId; { // SAFE osl::MutexGuard g(rBHelper.rMutex); @@ -443,6 +444,8 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l { if ( Args[i].Name == "Frame") Args[i].Value >>= xFrame; + if (Args[i].Name == "Module") + Args[i].Value >>= aModuleId; } } // SAFE @@ -451,8 +454,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l // Determine the module identifier try { - OUString aModuleId; - if ( xFrame.is() && xManager.is() ) + if ( aModuleId.isEmpty() && xFrame.is() && xManager.is() ) aModuleId = xManager->identify( Reference<XInterface>( xFrame, UNO_QUERY ) ); Reference< XUIElementFactory > xUIElementFactory = getFactory( ResourceURL, aModuleId ); diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index a2b0060..027c886 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -807,6 +807,16 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas()); aCreationArguments.put("Canvas", makeAny(xCanvas)); } + + if (mxCurrentController.is()) + { + OUString aModule = Tools::GetModuleName(mxCurrentController); + if (!aModule.isEmpty()) + { + aCreationArguments.put("Module", makeAny(aModule)); + } + } + aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication)); aCreationArguments.put("ContextName", makeAny(rContext.msContext)); commit d976efde8c6398ceb234a3b50541ceba21959aa7 Author: Markus Mohrhard <[email protected]> Date: Thu Jul 9 16:21:39 2015 +0200 use correct controller for sidebar As we now allow non-frame controllers we need to use them as well in this place. Change-Id: I0d86cdf73f8c044816def0aaafb874e75985aae5 diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index bdc1dc4..063a156 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -173,6 +173,7 @@ private: css::uno::Reference<css::frame::XFrame> mxFrame; Context maCurrentContext; Context maRequestedContext; + css::uno::Reference<css::frame::XController> mxCurrentController; /// Use a combination of SwitchFlag_* as value. sal_Int32 mnRequestedForceFlags; ::rtl::OUString msCurrentDeckId; diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index d73a0d9..a2b0060 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -266,6 +266,7 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex rEvent.ContextName); if (maRequestedContext != maCurrentContext) { + mxCurrentController = css::uno::Reference<css::frame::XController>(rEvent.Source, css::uno::UNO_QUERY); maAsynchronousDeckSwitch.CancelRequest(); maContextChangeUpdate.RequestCall(); // TODO: this call is redundant but mandatory for unit test to update context on document loading @@ -436,11 +437,13 @@ void SidebarController::UpdateConfigurations() // Find the set of decks that could be displayed for the new context. ResourceManager::DeckContextDescriptorContainer aDecks; + css::uno::Reference<css::frame::XController> xController = mxCurrentController.is() ? mxCurrentController : mxFrame->getController(); + mpResourceManager->GetMatchingDecks ( aDecks, maCurrentContext, mbIsDocumentReadOnly, - mxFrame->getController()); + xController); // Notify the tab bar about the updated set of decks. mpTabBar->SetDecks(aDecks); @@ -575,11 +578,13 @@ void SidebarController::SwitchToDeck ( // Determine the panels to display in the deck. ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors; + css::uno::Reference<css::frame::XController> xController = mxCurrentController.is() ? mxCurrentController : mxFrame->getController(); + mpResourceManager->GetMatchingPanels( aPanelContextDescriptors, rContext, rDeckDescriptor.msId, - mxFrame->getController()); + xController); if (aPanelContextDescriptors.empty()) { commit 24c174d7d190580a338b2352ea79e216be50f787 Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 22:15:38 2015 +0200 no need for handling unused arguments like that Change-Id: I04fa1b854e41a4cbeea0586bc583c58298d96306 diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index b5865c4..d73a0d9 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -273,19 +273,15 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex } } -void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject) +void SAL_CALL SidebarController::disposing (const css::lang::EventObject& ) throw(css::uno::RuntimeException, std::exception) { - (void)rEventObject; - dispose(); } -void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& rEvent) +void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& ) throw(css::uno::RuntimeException, std::exception) { - (void)rEvent; - maPropertyChangeForwarder.RequestCall(); } commit bde2fde07a00c89a27c13cd7f5e6fe666ea73030 Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 21:10:23 2015 +0200 fix indentation Change-Id: I90426772f59db1bdc695bb9a411eaaee19655ce7 diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 61492ce..b5865c4 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -205,21 +205,21 @@ void SAL_CALL SidebarController::disposing() // clear decks ResourceManager::DeckContextDescriptorContainer aDecks; - mpResourceManager->GetMatchingDecks ( + mpResourceManager->GetMatchingDecks ( aDecks, GetCurrentContext(), IsDocumentReadOnly(), mxFrame->getController()); - for (ResourceManager::DeckContextDescriptorContainer::const_iterator + for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(aDecks.begin()), iEnd(aDecks.end()); iDeck!=iEnd; ++iDeck) - { - const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId); - VclPtr<Deck> aDeck = deckDesc->mpDeck; - if (aDeck) - aDeck.disposeAndClear(); - } + { + const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId); + VclPtr<Deck> aDeck = deckDesc->mpDeck; + if (aDeck) + aDeck.disposeAndClear(); + } SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame->getController())); if (iEntry != maSidebarControllerContainer.end()) commit efd13b27a4d5108645307b54d150c7d3fec87dcc Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 20:45:37 2015 +0200 finally manage to register chart2 in the ChartController We need to do some jumps through pink hoops to connect the chart controller with the host sidebar. Would we use the chart window as parent for our sidebar the sidebar would be directlz beside the chart and not at the border of the host window. Change-Id: Ica44ae370518882ef367999f57251b1256907016 diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 4156c9d..3175eea 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XController2.hpp> #include <com/sun/star/util/XCloneable.hpp> #include <com/sun/star/embed/XEmbeddedClient.hpp> #include <com/sun/star/util/XModeChangeBroadcaster.hpp> @@ -58,6 +59,7 @@ #include <com/sun/star/frame/LayoutManagerEvents.hpp> #include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <com/sun/star/document/XUndoAction.hpp> +#include <com/sun/star/ui/XSidebar.hpp> #include <svx/sidebar/SelectionChangeHandler.hxx> #include <vcl/msgbox.hxx> @@ -66,6 +68,8 @@ #include <vcl/svapp.hxx> #include <osl/mutex.hxx> +#include <sfx2/sidebar/SidebarController.hxx> + #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> @@ -346,6 +350,21 @@ uno::Sequence< OUString > ChartController::getSupportedServiceNames_Static() return aSNS; } +namespace { + +uno::Reference<ui::XSidebar> getSidebarFromModel(uno::Reference<frame::XModel> xModel) +{ + uno::Reference<container::XChild> xChild(xModel, uno::UNO_QUERY); + uno::Reference<frame::XModel> xParent (xChild->getParent(), uno::UNO_QUERY_THROW); + uno::Reference<frame::XController2> xController(xParent->getCurrentController(), uno::UNO_QUERY); + uno::Reference<ui::XSidebarProvider> xSidebarProvider (xController->getSidebar(), uno::UNO_QUERY); + uno::Reference<ui::XSidebar> xSidebar(xSidebarProvider->getSidebar(), uno::UNO_QUERY); + + return xSidebar; +} + +} + // XController void SAL_CALL ChartController::attachFrame( @@ -359,6 +378,10 @@ void SAL_CALL ChartController::attachFrame( mpSelectionChangeHandler->Connect(); + uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel()); + sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get()); + sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this); + if(m_xFrame.is()) //what happens, if we do have a Frame already?? { //@todo? throw exception? @@ -725,6 +748,14 @@ void SAL_CALL ChartController::dispose() throw(uno::RuntimeException, std::exception) { mpSelectionChangeHandler->Disconnect(); + + if (getModel().is()) + { + uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel()); + sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get()); + sfx2::sidebar::SidebarController::unregisterSidebarForFrame(pSidebar, this); + } + try { //This object should release all resources and references in the diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 6d88767..bdc1dc4 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -69,7 +69,7 @@ class SidebarDockingWindow; class TabBar; class TabBarConfiguration; -class SidebarController +class SFX2_DLLPUBLIC SidebarController : private ::boost::noncopyable, private ::cppu::BaseMutex, public SidebarControllerInterfaceBase commit 7cad6b12c801a21b2401958c60625a50320fb5c7 Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 20:35:21 2015 +0200 [API CHANGE] add way to get XSidebar from XSidebarProvider Change-Id: I9fcf1cffa70eac6fec228ca4a9d4d32783295f21 diff --git a/include/sfx2/sidebar/UnoSidebar.hxx b/include/sfx2/sidebar/UnoSidebar.hxx index 6c154c0..9cbb4e1 100644 --- a/include/sfx2/sidebar/UnoSidebar.hxx +++ b/include/sfx2/sidebar/UnoSidebar.hxx @@ -14,6 +14,7 @@ #include <sfx2/dllapi.h> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/ui/XSidebarProvider.hpp> +#include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/awt/XWindow2.hpp> @@ -56,6 +57,9 @@ public: virtual css::uno::Reference<css::ui::XDecks> SAL_CALL getDecks() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual css::uno::Reference<css::ui::XSidebar> SAL_CALL getSidebar() + throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + }; #endif diff --git a/offapi/com/sun/star/ui/XSidebarProvider.idl b/offapi/com/sun/star/ui/XSidebarProvider.idl index 370925e..5786550 100644 --- a/offapi/com/sun/star/ui/XSidebarProvider.idl +++ b/offapi/com/sun/star/ui/XSidebarProvider.idl @@ -14,6 +14,7 @@ #include <com/sun/star/frame/XFrame.idl> #include <com/sun/star/awt/XWindow2.idl> +#include <com/sun/star/ui/XSidebar.idl> #include <com/sun/star/ui/XDecks.idl> @@ -52,6 +53,11 @@ interface XSidebarProvider: com::sun::star::uno::XInterface </ul> */ void showDecks([in] boolean bVisible); + + /** + * Returns the sidebar object + */ + com::sun::star::ui::XSidebar getSidebar(); } ; } ; } ; } ; } ; diff --git a/sfx2/source/sidebar/UnoSidebar.cxx b/sfx2/source/sidebar/UnoSidebar.cxx index 28de260..cfaebbf 100644 --- a/sfx2/source/sidebar/UnoSidebar.cxx +++ b/sfx2/source/sidebar/UnoSidebar.cxx @@ -98,5 +98,11 @@ uno::Reference<ui::XDecks> SAL_CALL SfxUnoSidebar::getDecks() return decks; } +uno::Reference<ui::XSidebar> SAL_CALL SfxUnoSidebar::getSidebar() + throw (uno::RuntimeException, std::exception) +{ + return getSidebarController(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 498e03c2a32ec0250fa2e7cb07f7fc3425212e58 Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 00:46:59 2015 +0200 fix crash Change-Id: Ic1bc31b68c4a2aafb1e40ebff84fbf052df7041f diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index d3882aa..00d297b 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -544,7 +544,7 @@ private: ChartDrawMode m_eDrawMode; - boost::scoped_ptr<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; private: //private methods commit be6c884feb389ec6931e1853aa421d5bccd69f12 Author: Markus Mohrhard <[email protected]> Date: Wed Jul 8 00:46:26 2015 +0200 add methods to add random controllers to sidebar Change-Id: Ia3e80cc63491f1edd49eaf86cc8c25d67e4a8b28 diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 78a0478..6d88767 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -89,6 +89,10 @@ public: static SidebarController* GetSidebarControllerForFrame ( const css::uno::Reference<css::frame::XFrame>& rxFrame); + static void registerSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xFrame); + + static void unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xFrame); + // ui::XContextChangeEventListener virtual void SAL_CALL notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index d98a5b5..61492ce 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -124,15 +124,7 @@ SidebarController::SidebarController ( // Decks and panel collections for this sidebar mpResourceManager = std::unique_ptr<ResourceManager>(new ResourceManager()); - // Listen for context change events. - css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( - css::ui::ContextChangeEventMultiplexer::get( - ::comphelper::getProcessComponentContext())); - if (xMultiplexer.is()) - xMultiplexer->addContextChangeEventListener( - static_cast<css::ui::XContextChangeEventListener*>(this), - mxFrame->getController()); - + registerSidebarForFrame(this, mxFrame->getController()); // Listen for window events. mpParentWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler)); @@ -149,12 +141,6 @@ SidebarController::SidebarController ( mxReadOnlyModeDispatch->addStatusListener(this, aURL); SwitchToDeck(gsDefaultDeckId); - - WeakReference<SidebarController> xWeakController (this); - maSidebarControllerContainer.insert( - SidebarControllerContainer::value_type( - rxFrame->getController(), - xWeakController)); } SidebarController::~SidebarController() @@ -175,6 +161,39 @@ SidebarController* SidebarController::GetSidebarControllerForFrame ( return dynamic_cast<SidebarController*>(xController.get()); } +void SidebarController::registerSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController) +{ + // Listen for context change events. + css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->addContextChangeEventListener( + static_cast<css::ui::XContextChangeEventListener*>(pController), + xController); + + WeakReference<SidebarController> xWeakController (pController); + maSidebarControllerContainer.insert( + SidebarControllerContainer::value_type( + xController, + xWeakController)); +} + +void SidebarController::unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController) +{ + SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(xController)); + if (iEntry != maSidebarControllerContainer.end()) + maSidebarControllerContainer.erase(iEntry); + + css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( + css::ui::ContextChangeEventMultiplexer::get( + ::comphelper::getProcessComponentContext())); + if (xMultiplexer.is()) + xMultiplexer->removeContextChangeEventListener( + static_cast<css::ui::XContextChangeEventListener*>(pController), + xController); +} + void SAL_CALL SidebarController::disposing() { mpCloseIndicator.disposeAndClear(); commit 4e6a1615d1a4c81c490cfb479d5e30f4e98adc47 Author: Markus Mohrhard <[email protected]> Date: Tue Jul 7 18:46:43 2015 +0200 use XController instead of XFrame where it makes sense Change-Id: I22990c861c0dd9d9dab3fbdbc35fdb2b51e82005 diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 5768db0..568b7f8 100644 --- a/include/sfx2/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -23,7 +23,7 @@ #include "PanelDescriptor.hxx" #include <sfx2/sidebar/Context.hxx> #include <unotools/confignode.hxx> -#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XController.hpp> #include <set> #include <boost/shared_ptr.hpp> #include <svtools/miscopt.hxx> @@ -89,13 +89,13 @@ public: DeckContextDescriptorContainer& rDeckDescriptors, const Context& rContext, const bool bIsDocumentReadOnly, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + const css::uno::Reference<css::frame::XController>& rxController); const PanelContextDescriptorContainer& GetMatchingPanels( PanelContextDescriptorContainer& rPanelDescriptors, const Context& rContext, const OUString& rsDeckId, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + const css::uno::Reference<css::frame::XController>& rxController); /** Remember the expansions state per panel and context. This is not persistent past application end. @@ -121,13 +121,13 @@ private: static void ReadContextList(const utl::OConfigurationNode& rNode, ContextList& rContextList, const OUString& rsDefaultMenuCommand); - void ReadLegacyAddons(const css::uno::Reference<css::frame::XFrame>& rxFrame); + void ReadLegacyAddons(const css::uno::Reference<css::frame::XController>& rxController); static utl::OConfigurationTreeRoot GetLegacyAddonRootNode(const OUString& rsModuleName); static void GetToolPanelNodeNames(std::vector<OUString>& rMatchingNames, const utl::OConfigurationTreeRoot& aRoot); static bool IsDeckEnabled(const OUString& rsDeckId, const Context& rContext, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + const css::uno::Reference<css::frame::XController>& rxController); }; } } // end of namespace sfx2::sidebar diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 29c7d43..78a0478 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -158,7 +158,7 @@ public: private: typedef ::std::map< - const css::uno::Reference<css::frame::XFrame>, + const css::uno::Reference<css::frame::XController>, css::uno::WeakReference<SidebarController> > SidebarControllerContainer; static SidebarControllerContainer maSidebarControllerContainer; diff --git a/include/sfx2/sidebar/Tools.hxx b/include/sfx2/sidebar/Tools.hxx index 3aff9ea..c6b7909 100644 --- a/include/sfx2/sidebar/Tools.hxx +++ b/include/sfx2/sidebar/Tools.hxx @@ -54,7 +54,7 @@ public: const css::util::URL& rURL); static ::rtl::OUString GetModuleName ( - const css::uno::Reference<css::frame::XFrame>& rxFrame); + const css::uno::Reference<css::frame::XController>& rxFrame); }; diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index c635751..ff457c2 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -143,7 +143,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController( { Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); Reference<frame::XUIControllerFactory> xFactory = frame::theToolbarControllerFactory::get( xContext ); - OUString sModuleName (Tools::GetModuleName(rxFrame)); + OUString sModuleName (Tools::GetModuleName(rxFrame->getController())); if (xFactory.is() && xFactory->hasController(rsCommandName, sModuleName)) { diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 21a6f8b..93a1b89 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -179,9 +179,9 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch DeckContextDescriptorContainer& rDecks, const Context& rContext, const bool bIsDocumentReadOnly, - const Reference<frame::XFrame>& rxFrame) + const Reference<frame::XController>& rxController) { - ReadLegacyAddons(rxFrame); + ReadLegacyAddons(rxController); std::multimap<sal_Int32,DeckContextDescriptor> aOrderedIds; DeckContainer::const_iterator iDeck; @@ -196,7 +196,7 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch aDeckContextDescriptor.msId = rDeckDescriptor.msId; aDeckContextDescriptor.mbIsEnabled = ! bIsDocumentReadOnly - || IsDeckEnabled(rDeckDescriptor.msId, rContext, rxFrame); + || IsDeckEnabled(rDeckDescriptor.msId, rContext, rxController); aOrderedIds.insert(::std::multimap<sal_Int32,DeckContextDescriptor>::value_type( rDeckDescriptor.mnOrderIndex, aDeckContextDescriptor)); @@ -215,9 +215,9 @@ const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatc PanelContextDescriptorContainer& rPanelIds, const Context& rContext, const OUString& rsDeckId, - const Reference<frame::XFrame>& rxFrame) + const Reference<frame::XController>& rxController) { - ReadLegacyAddons(rxFrame); + ReadLegacyAddons(rxController); std::multimap<sal_Int32, PanelContextDescriptor> aOrderedIds; PanelContainer::const_iterator iPanel; @@ -485,10 +485,10 @@ void ResourceManager::ReadContextList ( } } -void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame) +void ResourceManager::ReadLegacyAddons (const Reference<frame::XController>& rxController) { // Get module name for given frame. - OUString sModuleName (Tools::GetModuleName(rxFrame)); + OUString sModuleName (Tools::GetModuleName(rxController)); if (sModuleName.getLength() == 0) return; if (maProcessedApplications.find(sModuleName) != maProcessedApplications.end()) @@ -625,14 +625,14 @@ void ResourceManager::GetToolPanelNodeNames ( bool ResourceManager::IsDeckEnabled ( const OUString& rsDeckId, const Context& rContext, - const Reference<frame::XFrame>& rxFrame) + const Reference<frame::XController>& rxController) { // Check if any panel that matches the current context can be // displayed. ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors; ResourceManager::Instance().GetMatchingPanels(aPanelContextDescriptors, - rContext, rsDeckId, rxFrame); + rContext, rsDeckId, rxController); ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel; for (iPanel = aPanelContextDescriptors.begin(); iPanel != aPanelContextDescriptors.end(); ++iPanel) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 867aa20..d98a5b5 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -153,7 +153,7 @@ SidebarController::SidebarController ( WeakReference<SidebarController> xWeakController (this); maSidebarControllerContainer.insert( SidebarControllerContainer::value_type( - rxFrame, + rxFrame->getController(), xWeakController)); } @@ -164,7 +164,7 @@ SidebarController::~SidebarController() SidebarController* SidebarController::GetSidebarControllerForFrame ( const css::uno::Reference<css::frame::XFrame>& rxFrame) { - SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(rxFrame)); + SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(rxFrame->getController())); if (iEntry == maSidebarControllerContainer.end()) return NULL; @@ -190,7 +190,7 @@ void SAL_CALL SidebarController::disposing() aDecks, GetCurrentContext(), IsDocumentReadOnly(), - mxFrame); + mxFrame->getController()); for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(aDecks.begin()), iEnd(aDecks.end()); @@ -202,7 +202,7 @@ void SAL_CALL SidebarController::disposing() aDeck.disposeAndClear(); } - SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame)); + SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame->getController())); if (iEntry != maSidebarControllerContainer.end()) maSidebarControllerContainer.erase(iEntry); @@ -425,7 +425,7 @@ void SidebarController::UpdateConfigurations() aDecks, maCurrentContext, mbIsDocumentReadOnly, - mxFrame); + mxFrame->getController()); // Notify the tab bar about the updated set of decks. mpTabBar->SetDecks(aDecks); @@ -564,7 +564,7 @@ void SidebarController::SwitchToDeck ( aPanelContextDescriptors, rContext, rDeckDescriptor.msId, - mxFrame); + mxFrame->getController()); if (aPanelContextDescriptors.empty()) { @@ -1219,7 +1219,7 @@ ResourceManager::DeckContextDescriptorContainer SidebarController::GetMatchingDe mpResourceManager->GetMatchingDecks (aDecks, GetCurrentContext(), IsDocumentReadOnly(), - mxFrame); + mxFrame->getController()); return aDecks; } @@ -1230,7 +1230,7 @@ ResourceManager::PanelContextDescriptorContainer SidebarController::GetMatchingP mpResourceManager->GetMatchingPanels(aPanels, GetCurrentContext(), rDeckId, - mxFrame); + mxFrame->getController()); return aPanels; } diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index fa9b256..0e62e6d 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -146,16 +146,16 @@ Reference<frame::XDispatch> Tools::GetDispatch ( } ::rtl::OUString Tools::GetModuleName ( - const css::uno::Reference<css::frame::XFrame>& rxFrame) + const css::uno::Reference<css::frame::XController>& rxController) { - if ( ! rxFrame.is() || ! rxFrame->getController().is()) + if (!rxController.is()) return ::rtl::OUString(); try { const Reference<XComponentContext> xComponentContext (::comphelper::getProcessComponentContext()); const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xComponentContext ); - return xModuleManager->identify(rxFrame); + return xModuleManager->identify(rxController); } catch (const Exception&) { diff --git a/sfx2/source/sidebar/UnoDecks.cxx b/sfx2/source/sidebar/UnoDecks.cxx index 30882ea..42965da 100644 --- a/sfx2/source/sidebar/UnoDecks.cxx +++ b/sfx2/source/sidebar/UnoDecks.cxx @@ -68,7 +68,7 @@ uno::Sequence< OUString > SAL_CALL SfxUnoDecks::getElementNames() aDecks, pSidebarController->GetCurrentContext(), pSidebarController->IsDocumentReadOnly(), - xFrame); + xFrame->getController()); deckList.realloc(aDecks.size()); @@ -104,7 +104,7 @@ sal_Bool SAL_CALL SfxUnoDecks::hasByName( const OUString& aName ) aDecks, pSidebarController->GetCurrentContext(), pSidebarController->IsDocumentReadOnly(), - xFrame); + xFrame->getController()); for (ResourceManager::DeckContextDescriptorContainer::const_iterator iDeck(aDecks.begin()), iEnd(aDecks.end()); diff --git a/sfx2/source/sidebar/UnoPanels.cxx b/sfx2/source/sidebar/UnoPanels.cxx index 8075667..0e712d9 100644 --- a/sfx2/source/sidebar/UnoPanels.cxx +++ b/sfx2/source/sidebar/UnoPanels.cxx @@ -81,7 +81,7 @@ uno::Sequence< OUString > SAL_CALL SfxUnoPanels::getElementNames() pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels, pSidebarController->GetCurrentContext(), mDeckId, - xFrame); + xFrame->getController()); panelList.realloc(aPanels.size()); @@ -114,7 +114,7 @@ sal_Bool SAL_CALL SfxUnoPanels::hasByName( const OUString& aName ) pSidebarController->GetResourceManager()->GetMatchingPanels(aPanels, pSidebarController->GetCurrentContext(), mDeckId, - xFrame); + xFrame->getController()); for (ResourceManager::PanelContextDescriptorContainer::const_iterator iPanel(aPanels.begin()), iEnd(aPanels.end()); commit 04716cb9acfde7e247c01d79afde694f8e4f9f7f Author: Markus Mohrhard <[email protected]> Date: Mon Jul 6 17:19:40 2015 +0200 add SidebarChangeHandler to chart2 I still need to wire the correct frame to the correct sidebar for it to work. Change-Id: I0fecc2be674d6b024bc39e707930a4c30f67cb81 diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index b53ebf6..4156c9d 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -59,6 +59,7 @@ #include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <com/sun/star/document/XUndoAction.hpp> +#include <svx/sidebar/SelectionChangeHandler.hxx> #include <vcl/msgbox.hxx> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -68,6 +69,8 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <boost/bind.hpp> + // this is needed to properly destroy the unique_ptr to the AcceleratorExecute // object in the DTOR #include <svtools/acceleratorexecute.hxx> @@ -107,7 +110,10 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const & m_bConnectingToView(false), m_xUndoManager( 0 ), m_aDispatchContainer( m_xCC, this ), - m_eDrawMode( CHARTDRAW_SELECT ) + m_eDrawMode( CHARTDRAW_SELECT ), + mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + boost::bind(&ChartController::GetContextName, this), this, + sfx2::sidebar::EnumContext::Context_Cell)) { m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) ); } @@ -286,6 +292,11 @@ bool ChartController::TheModelRef::is() const return (m_pTheModel != 0); } +OUString ChartController::GetContextName() +{ + return OUString("Chart"); +} + // private methods bool ChartController::impl_isDisposedOrSuspended() const @@ -346,6 +357,8 @@ void SAL_CALL ChartController::attachFrame( if( impl_isDisposedOrSuspended() ) //@todo? allow attaching the frame while suspended? return; //behave passive if already disposed or suspended + mpSelectionChangeHandler->Connect(); + if(m_xFrame.is()) //what happens, if we do have a Frame already?? { //@todo? throw exception? @@ -386,6 +399,7 @@ void SAL_CALL ChartController::attachFrame( m_apDropTargetHelper.reset(); } { + SAL_DEBUG("attached frame"); // calls to VCL SolarMutexGuard aSolarGuard; m_pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0); @@ -710,6 +724,7 @@ void ChartController::impl_deleteDrawViewController() void SAL_CALL ChartController::dispose() throw(uno::RuntimeException, std::exception) { + mpSelectionChangeHandler->Disconnect(); try { //This object should release all resources and references in the @@ -771,6 +786,7 @@ void SAL_CALL ChartController::dispose() m_xLayoutManagerEventBroadcaster.set( 0 ); } + SAL_DEBUG("disposing"); m_xFrame.clear(); m_xUndoManager.clear(); @@ -889,6 +905,7 @@ void SAL_CALL ChartController::notifyClosing( try { xFrameCloseable->close( sal_False /* DeliverOwnership */ ); + SAL_DEBUG("notifyClosing"); m_xFrame.clear(); } catch( const util::CloseVetoException & ) diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 0c75371..d3882aa 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -62,6 +62,10 @@ namespace svt class AcceleratorExecute; } +namespace svx { namespace sidebar { + class SelectionChangeHandler; +}} + class DropTargetHelper; namespace com { namespace sun { namespace star { @@ -149,6 +153,8 @@ public: ::com::sun::star::uno::XComponentContext > const & xContext); virtual ~ChartController(); + OUString GetContextName(); + // ::com::sun::star::lang::XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; @@ -538,6 +544,8 @@ private: ChartDrawMode m_eDrawMode; + boost::scoped_ptr<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + private: //private methods diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx index 3fd2670..b77c977 100644 --- a/include/sfx2/sidebar/EnumContext.hxx +++ b/include/sfx2/sidebar/EnumContext.hxx @@ -40,6 +40,7 @@ public: Application_WriterForm, Application_WriterReport, Application_Calc, + Application_Chart, Application_Draw, Application_Impress, @@ -65,6 +66,7 @@ public: Context_3DObject, Context_Annotation, Context_Auditing, + Context_Axis, Context_Cell, Context_Chart, Context_Draw, diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx index 4f9b75b..f7db2ed 100644 --- a/sfx2/source/sidebar/EnumContext.cxx +++ b/sfx2/source/sidebar/EnumContext.cxx @@ -122,6 +122,7 @@ void EnumContext::ProvideApplicationContainers() AddEntry(OUString("com.sun.star.sdb.FormDesign"), EnumContext::Application_WriterForm); AddEntry(OUString("com.sun.star.sdb.TextReportDesign"), EnumContext::Application_WriterReport); AddEntry(OUString("com.sun.star.sheet.SpreadsheetDocument"), EnumContext::Application_Calc); + AddEntry(OUString("com.sun.star.chart2.ChartDocument"), EnumContext::Application_Chart); AddEntry(OUString("com.sun.star.drawing.DrawingDocument"), EnumContext::Application_Draw); AddEntry(OUString("com.sun.star.presentation.PresentationDocument"), EnumContext::Application_Impress); @@ -174,6 +175,7 @@ void EnumContext::ProvideContextContainers() AddContext(3DObject); AddContext(Annotation); AddContext(Auditing); + AddContext(Axis); AddContext(Cell); AddContext(Chart); AddContext(Chart); commit 11304a75043647139f6189c2317fe709edae83dc Author: Markus Mohrhard <[email protected]> Date: Wed Jul 1 08:37:55 2015 +0200 fix indentation Change-Id: Iaa8f5ad10041833431029c6edbab35fb5bb96ed5 diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 7351d0a..cb57e3b 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -804,157 +804,157 @@ void ScTabViewShell::SetCurSubShell(ObjectSelectionType eOST, bool bForce) switch(eOST) { case OST_Cell: - { - AddSubShell(*pCellShell); - if(bPgBrk) AddSubShell(*pPageBreakShell); - bCellBrush = true; - } - break; + { + AddSubShell(*pCellShell); + if(bPgBrk) AddSubShell(*pPageBreakShell); + bCellBrush = true; + } + break; case OST_Editing: - { - AddSubShell(*pCellShell); - if(bPgBrk) AddSubShell(*pPageBreakShell); + { + AddSubShell(*pCellShell); + if(bPgBrk) AddSubShell(*pPageBreakShell); - if(pEditShell) - { - AddSubShell(*pEditShell); - } - } - break; + if(pEditShell) + { + AddSubShell(*pEditShell); + } + } + break; case OST_DrawText: - { - if ( !pDrawTextShell ) - { - pDocSh->MakeDrawLayer(); - pDrawTextShell = new ScDrawTextObjectBar( &GetViewData() ); - } - AddSubShell(*pDrawTextShell); - } - break; + { + if ( !pDrawTextShell ) + { + pDocSh->MakeDrawLayer(); + pDrawTextShell = new ScDrawTextObjectBar( &GetViewData() ); + } + AddSubShell(*pDrawTextShell); + } + break; case OST_Drawing: - { - if (svx::checkForSelectedCustomShapes( ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
