[Libreoffice-commits] core.git: chart2/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Jul 27 17:52:57 PDT 2015


 chart2/source/controller/sidebar/ChartAreaPanel.cxx |   36 ++++++++++++++------
 1 file changed, 26 insertions(+), 10 deletions(-)

New commits:
commit 2d8f1faa97a3dfd38c540e0cd0b73a2e9d621d53
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 28 02:50:59 2015 +0200

    fix the last transparency gradient issues in the chart area panel
    
    So apparently I was looking up the gradient in the wrong table.
    
    Change-Id: I26de6f9bb5f9baf65a7856682a327da611da3ae7

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 640404a..233371a 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -90,6 +90,8 @@ DrawModelWrapper* getDrawModelWrapper(css::uno::Reference<css::frame::XModel> xM
 XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
         const OUString& rName)
 {
+
+
     try
     {
         ViewElementListProvider aProvider = getViewElementListProvider(xModel);
@@ -113,6 +115,28 @@ XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
     return XGradient();
 }
 
+XFillFloatTransparenceItem getXTransparencyGradientForName(css::uno::Reference<css::frame::XModel> xModel,
+        const OUString& rName)
+{
+    css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xModel, css::uno::UNO_QUERY);
+    css::uno::Reference<css::container::XNameAccess> xNameAccess(
+            xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"), css::uno::UNO_QUERY);
+    if (!xNameAccess.is())
+        return XFillFloatTransparenceItem();
+
+    if (!xNameAccess->hasByName(rName))
+        return XFillFloatTransparenceItem();
+
+    css::uno::Any aAny = xNameAccess->getByName(rName);
+
+    XFillFloatTransparenceItem aItem;
+    aItem.SetName(rName);
+    aItem.PutValue(aAny, MID_FILLGRADIENT);
+    aItem.SetEnabled(true);
+
+    return aItem;
+}
+
 XHatch getXHatchFromName(css::uno::Reference<css::frame::XModel> xModel,
         OUString& rName)
 {
@@ -393,16 +417,8 @@ void ChartAreaPanel::updateData()
 
     OUString aFillFloatTransparenceName;
     xPropSet->getPropertyValue("FillTransparenceGradientName") >>= aFillFloatTransparenceName;
-    XFillFloatTransparenceItem aFillFloatTransparenceItem;
-    if (!aFillFloatTransparenceName.isEmpty())
-        aFillFloatTransparenceItem.SetEnabled(true);
-
-    aFillFloatTransparenceItem.SetName(aFillFloatTransparenceName);
-    XFillFloatTransparenceItem* pCorrectFloatTransparenceItem = aFillFloatTransparenceItem.checkForUniqueItem(&pModelWrapper->getSdrModel());
-    XFillFloatTransparenceItem* pFillFloatTransparenceItem = pCorrectFloatTransparenceItem ? pCorrectFloatTransparenceItem : &aFillFloatTransparenceItem;
-    pFillFloatTransparenceItem->SetGradientValue(getXGradientForName(mxModel, pFillFloatTransparenceItem->GetName()));
-    updateFillFloatTransparence(false, true, pFillFloatTransparenceItem);
-    delete pCorrectFloatTransparenceItem;
+    XFillFloatTransparenceItem aFillFloatTransparenceItem = getXTransparencyGradientForName(mxModel, aFillFloatTransparenceName);
+    updateFillFloatTransparence(false, true, &aFillFloatTransparenceItem);
 }
 
 void ChartAreaPanel::modelInvalid()


More information about the Libreoffice-commits mailing list