summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-24 01:47:31 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-26 00:26:59 +0200
commitb5c0f852b51dd8b0e9b8bf65fbaa18bc61558107 (patch)
treecba91ee0cd9090ca1e206384b901e9c417f4c6ef /chart2
parente4daf8be5e9c84c378ec6477163647d1c9b7ef55 (diff)
update gradients in sidebar as well
Change-Id: I0dc737c133e905d75fab23457fb86c8d2b724ce8
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/inc/ChartController.hxx3
-rw-r--r--chart2/source/controller/main/ChartController.cxx6
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx34
3 files changed, 43 insertions, 0 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index fb84c457634a..9749b363e390 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -127,6 +127,7 @@ class ChartWindow;
class DrawModelWrapper;
class DrawViewWrapper;
class ReferenceSizeProvider;
+class ViewElementListProvider;
class ChartController : public ::cppu::WeakImplHelper12 <
::com::sun::star::frame::XController //comprehends XComponent (required interface)
@@ -433,6 +434,8 @@ public:
bool isShapeContext() const;
+ ViewElementListProvider getViewElementListProvider();
+
DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
public:
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 138fc65cdac5..66a7b296e25c 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -43,6 +43,7 @@
#include "DrawCommandDispatch.hxx"
#include "ShapeController.hxx"
#include "UndoActions.hxx"
+#include "ViewElementListProvider.hxx"
#include <comphelper/InlineContainer.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -1623,6 +1624,11 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
;
}
+ViewElementListProvider ChartController::getViewElementListProvider()
+{
+ return ViewElementListProvider(m_pDrawModelWrapper.get());
+}
+
} //namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 6dcadd19e9ec..9e1b5e83f2c6 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -10,6 +10,7 @@
#include "ChartAreaPanel.hxx"
#include "ChartController.hxx"
+#include "ViewElementListProvider.hxx"
#include <svx/xfltrit.hxx>
#include <svx/xflftrit.hxx>
@@ -42,6 +43,33 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
}
+XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rName)
+{
+ css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController();
+ if (!xController.is())
+ return XGradient();
+
+ ChartController* pController = dynamic_cast<ChartController*>(xController.get());
+ if (!pController)
+ return XGradient();
+
+ ViewElementListProvider aProvider = pController->getViewElementListProvider();
+ XGradientListRef aRef = aProvider.GetGradientList();
+ size_t n = aRef->Count();
+ for (size_t i = 0; i < n; ++i)
+ {
+ XGradientEntry* pGradient = aRef->GetGradient(i);
+ if (!pGradient)
+ continue;
+
+ if (pGradient->GetName() == rName)
+ return XGradient(pGradient->GetGradient());
+ }
+
+ return XGradient();
+}
+
class PreventUpdate
{
public:
@@ -215,6 +243,12 @@ void ChartAreaPanel::updateData()
xPropSet->getPropertyValue("Transparency") >>= nFillTransparence;
SfxUInt16Item aTransparenceItem(0, nFillTransparence);
updateFillTransparence(false, true, &aTransparenceItem);
+
+ OUString aGradientName;
+ xPropSet->getPropertyValue("GradientName") >>= aGradientName;
+ XGradient xGradient = getXGradientForName(mxModel, aGradientName);
+ XFillGradientItem aGradientItem(aGradientName, xGradient);
+ updateFillGradient(false, true, &aGradientItem);
}
void ChartAreaPanel::modelInvalid()