diff options
Diffstat (limited to 'chart2/source/controller/sidebar/ChartLinePanel.cxx')
-rw-r--r-- | chart2/source/controller/sidebar/ChartLinePanel.cxx | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx index f50581a3e04f..46cec9695f4d 100644 --- a/chart2/source/controller/sidebar/ChartLinePanel.cxx +++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx @@ -10,9 +10,9 @@ #include "ChartLinePanel.hxx" #include <ChartController.hxx> +#include <ChartModel.hxx> #include <svx/xlnwtit.hxx> -#include <svx/xlinjoit.hxx> #include <svx/xlntrit.hxx> #include <svx/linectrl.hxx> @@ -21,7 +21,6 @@ #include <vcl/svapp.hxx> #include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <comphelper/lok.hxx> @@ -46,7 +45,7 @@ SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rTool return pToolBoxColorControl; } -OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) +OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel) { css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController()); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY); @@ -55,10 +54,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) css::uno::Any aAny = xSelectionSupplier->getSelection(); if (!aAny.hasValue()) - { - xSelectionSupplier->select(css::uno::makeAny(OUString("CID/Page="))); - aAny = xSelectionSupplier->getSelection(); - } + return OUString(); OUString aCID; aAny >>= aCID; @@ -67,7 +63,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) } css::uno::Reference<css::beans::XPropertySet> getPropSet( - const css::uno::Reference<css::frame::XModel>& xModel) + const rtl::Reference<::chart::ChartModel>& xModel) { OUString aCID = getCID(xModel); css::uno::Reference<css::beans::XPropertySet> xPropSet = @@ -124,7 +120,7 @@ ChartLinePanel::ChartLinePanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController): svx::sidebar::LinePropertyPanelBase(pParent, rxFrame), - mxModel(pController->getModel()), + mxModel(pController->getChartModel()), mxListener(new ChartSidebarModifyListener(this)), mxSelectionListener(new ChartSidebarSelectionListener(this)), mbUpdate(true), @@ -148,8 +144,7 @@ ChartLinePanel::~ChartLinePanel() void ChartLinePanel::Initialize() { - css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); - xBroadcaster->addModifyListener(mxListener); + mxModel->addModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); if (xSelectionSupplier.is()) @@ -200,12 +195,11 @@ void ChartLinePanel::selectionChanged(bool bCorrectType) updateData(); } -void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel) +void ChartLinePanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel) { if (mbModelValid) { - css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); - xBroadcaster->removeModifyListener(mxListener); + mxModel->removeModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier( mxModel->getCurrentController(), css::uno::UNO_QUERY); @@ -223,8 +217,7 @@ void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode maLineStyleWrapper.updateModel(mxModel); maLineColorWrapper.updateModel(mxModel); - css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW); - xBroadcasterNew->addModifyListener(mxListener); + mxModel->addModifyListener(mxListener); css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); if (xSelectionSupplier.is()) @@ -233,24 +226,9 @@ void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel) { - doUpdateModel(xModel); -} - -void ChartLinePanel::setLineJoint(const XLineJointItem* pItem) -{ - css::uno::Reference<css::beans::XPropertySet> xPropSet = - getPropSet(mxModel); - - if (!xPropSet.is()) - return; - - PreventUpdate aPreventUpdate(mbUpdate); - if (pItem) - xPropSet->setPropertyValue("LineJoint", css::uno::Any(pItem->GetValue())); -} - -void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/) -{ + ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get()); + assert(!xModel || pModel); + doUpdateModel(pModel); } void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem) @@ -285,7 +263,7 @@ void ChartLinePanel::updateLineWidth(bool bDisabled, bool bSetOrDefault, const S if (comphelper::LibreOfficeKit::isActive() && pViewShell) { pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (".uno:LineWidth=" + std::to_string(mnWidthCoreValue)).c_str()); + ".uno:LineWidth=" + OString::number(mnWidthCoreValue)); } } |