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

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Jul 27 15:59:47 PDT 2015


 chart2/source/controller/sidebar/ChartAreaPanel.cxx |   44 ++++++++++++++----
 chart2/source/model/main/DataPointProperties.cxx    |   47 ++++++++++++++++++++
 chart2/source/tools/FillProperties.cxx              |   31 -------------
 3 files changed, 82 insertions(+), 40 deletions(-)

New commits:
commit 88f5d4ce866f6d574a34d706d2d71dc71aaa66e8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 28 00:56:04 2015 +0200

    use common fill property names in chart2
    
    Change-Id: I9445344efc70d872fdb9c9a8cc49838210861a7b

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index f002a31..640404a 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -255,7 +255,7 @@ void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
     if (!xPropSet.is())
         return;
 
-    xPropSet->setPropertyValue("Transparency", css::uno::makeAny(rItem.GetValue()));
+    xPropSet->setPropertyValue("FillTransparence", css::uno::makeAny(rItem.GetValue()));
 }
 
 void ChartAreaPanel::setFillFloatTransparence(
@@ -268,7 +268,7 @@ void ChartAreaPanel::setFillFloatTransparence(
 
     if (!rItem.IsEnabled())
     {
-        xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(OUString()));
+        xPropSet->setPropertyValue("FillTransparenceGradientName", css::uno::makeAny(OUString()));
         return;
     }
 
@@ -276,7 +276,7 @@ void ChartAreaPanel::setFillFloatTransparence(
     css::uno::Any aGradientVal;
     rItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
     OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
-    xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(aNewName));
+    xPropSet->setPropertyValue("FillTransparenceGradientName", css::uno::makeAny(aNewName));
 }
 
 void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
@@ -298,7 +298,7 @@ void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
 
     if (pStyleItem)
         xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
-    xPropSet->setPropertyValue("Color", css::uno::makeAny(rColorItem.GetValue()));
+    xPropSet->setPropertyValue("FillColor", css::uno::makeAny(rColorItem.GetValue()));
 }
 
 void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
@@ -311,7 +311,7 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
 
     if (pStyleItem)
         xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
-    xPropSet->setPropertyValue("GradientName", css::uno::makeAny(rGradientItem.GetValue()));
+    xPropSet->setPropertyValue("FillGradientName", css::uno::makeAny(rGradientItem.GetValue()));
 }
 
 void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
@@ -324,7 +324,7 @@ void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
 
     if (pStyleItem)
         xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
-    xPropSet->setPropertyValue("HatchName", css::uno::makeAny(rHatchItem.GetValue()));
+    xPropSet->setPropertyValue("FillHatchName", css::uno::makeAny(rHatchItem.GetValue()));
 }
 
 void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
@@ -355,18 +355,18 @@ void ChartAreaPanel::updateData()
     updateFillStyle(false, true, &aFillStyleItem);
 
     sal_uInt16 nFillTransparence = 0;
-    xPropSet->getPropertyValue("Transparency") >>= nFillTransparence;
+    xPropSet->getPropertyValue("FillTransparence") >>= nFillTransparence;
     SfxUInt16Item aTransparenceItem(0, nFillTransparence);
     updateFillTransparence(false, true, &aTransparenceItem);
 
     OUString aGradientName;
-    xPropSet->getPropertyValue("GradientName") >>= aGradientName;
+    xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
     XGradient xGradient = getXGradientForName(mxModel, aGradientName);
     XFillGradientItem aGradientItem(aGradientName, xGradient);
     updateFillGradient(false, true, &aGradientItem);
 
     OUString aHatchName;
-    xPropSet->getPropertyValue("HatchName") >>= aHatchName;
+    xPropSet->getPropertyValue("FillHatchName") >>= aHatchName;
     XHatch xHatch = getXHatchFromName(mxModel, aHatchName);
     XFillHatchItem aHatchItem(aHatchName, xHatch);
     updateFillHatch(false, true, &aHatchItem);
@@ -392,7 +392,7 @@ void ChartAreaPanel::updateData()
     delete pBitmapItem;
 
     OUString aFillFloatTransparenceName;
-    xPropSet->getPropertyValue("TransparencyGradientName") >>= aFillFloatTransparenceName;
+    xPropSet->getPropertyValue("FillTransparenceGradientName") >>= aFillFloatTransparenceName;
     XFillFloatTransparenceItem aFillFloatTransparenceItem;
     if (!aFillFloatTransparenceName.isEmpty())
         aFillFloatTransparenceItem.SetEnabled(true);
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index ab1116f..064261d 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -59,12 +59,27 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
+        Property( "FillColor",
+                  PROP_DATAPOINT_COLOR,
+                  cppu::UnoType<sal_Int32>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEVOID         // "maybe auto"
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+    rOutProperties.push_back(
         Property( "Transparency",
                   PROP_DATAPOINT_TRANSPARENCY,
                   cppu::UnoType<sal_Int16>::get(),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
+    rOutProperties.push_back(
+        Property( "FillTransparence",
+                  PROP_DATAPOINT_TRANSPARENCY,
+                  cppu::UnoType<sal_Int16>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
     // Fill Properties
     rOutProperties.push_back(
         Property( "FillStyle",
@@ -82,6 +97,14 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
+        Property( "FillTransparenceGradientName",
+                  PROP_DATAPOINT_TRANSPARENCY_GRADIENT_NAME,
+                  cppu::UnoType<OUString>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT
+                  | beans::PropertyAttribute::MAYBEVOID ));
+
+    rOutProperties.push_back(
         Property( "GradientName",
                   PROP_DATAPOINT_GRADIENT_NAME,
                   cppu::UnoType<OUString>::get(),
@@ -90,6 +113,14 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
+        Property( "FillGradientName",
+                  PROP_DATAPOINT_GRADIENT_NAME,
+                  cppu::UnoType<OUString>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT
+                  | beans::PropertyAttribute::MAYBEVOID ));
+
+    rOutProperties.push_back(
         beans::Property( "GradientStepCount",
                   PROP_DATAPOINT_GRADIENT_STEPCOUNT,
                   cppu::UnoType<sal_Int16>::get(),
@@ -97,6 +128,13 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
+        beans::Property( "FillGradientStepCount",
+                  PROP_DATAPOINT_GRADIENT_STEPCOUNT,
+                  cppu::UnoType<sal_Int16>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEVOID ));
+
+    rOutProperties.push_back(
         Property( "HatchName",
                   PROP_DATAPOINT_HATCH_NAME,
                   cppu::UnoType<OUString>::get(),
@@ -105,12 +143,21 @@ void DataPointProperties::AddPropertiesToVector(
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
+        Property( "FillHatchName",
+                  PROP_DATAPOINT_HATCH_NAME,
+                  cppu::UnoType<OUString>::get(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT
+                  | beans::PropertyAttribute::MAYBEVOID ));
+
+    rOutProperties.push_back(
         Property( "FillBitmapName",
                   PROP_DATAPOINT_FILL_BITMAP_NAME,
                   cppu::UnoType<OUString>::get(),
                   beans::PropertyAttribute::BOUND
                   | beans::PropertyAttribute::MAYBEDEFAULT
                   | beans::PropertyAttribute::MAYBEVOID  ));
+
     rOutProperties.push_back(
         Property( "FillBackground",
                   PROP_DATAPOINT_FILL_BACKGROUND,
commit 6295e6543705a00e0ad9581a25436b3c28e5f7d5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 28 00:49:32 2015 +0200

    Revert "provide a few more common property names"
    
    This reverts commit 6301e1e8b983f099d1f93140a3fb54c635206ac6.

diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx
index 6533725..5316984 100644
--- a/chart2/source/tools/FillProperties.cxx
+++ b/chart2/source/tools/FillProperties.cxx
@@ -52,13 +52,6 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
-        Property( "Transparency",
-                  FillProperties::PROP_FILL_TRANSPARENCE,
-                  cppu::UnoType<sal_Int16>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEDEFAULT ));
-
-    rOutProperties.push_back(
         Property( "FillTransparence",
                   FillProperties::PROP_FILL_TRANSPARENCE,
                   cppu::UnoType<sal_Int16>::get(),
commit 5af433b0922ae30fd2b6cef63ea70dad6953ce2a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 28 00:49:16 2015 +0200

    Revert "provide some common fill property name aliases"
    
    This reverts commit 3d32e9f81b263884ec0a3b262e71ae78fcb892b7.

diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx
index 37b4a8f..6533725 100644
--- a/chart2/source/tools/FillProperties.cxx
+++ b/chart2/source/tools/FillProperties.cxx
@@ -44,14 +44,6 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
-        Property( "Color",
-                  FillProperties::PROP_FILL_COLOR,
-                  cppu::UnoType<sal_Int32>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID         // "maybe auto"
-                  | beans::PropertyAttribute::MAYBEDEFAULT ));
-
-    rOutProperties.push_back(
         Property( "FillColor",
                   FillProperties::PROP_FILL_COLOR,
                   cppu::UnoType<sal_Int32>::get(),
@@ -82,14 +74,6 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
                   | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
-        Property( "GradientName",
-                  FillProperties::PROP_FILL_GRADIENT_NAME,
-                  cppu::UnoType<OUString>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID
-                  | beans::PropertyAttribute::MAYBEDEFAULT ));
-
-    rOutProperties.push_back(
         Property( "FillGradientName",
                   FillProperties::PROP_FILL_GRADIENT_NAME,
                   cppu::UnoType<OUString>::get(),
@@ -105,14 +89,6 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s
                   | beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
-        Property( "HatchName",
-                  FillProperties::PROP_FILL_HATCH_NAME,
-                  cppu::UnoType<OUString>::get(),
-                  beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID
-                  | beans::PropertyAttribute::MAYBEDEFAULT ));
-
-    rOutProperties.push_back(
         Property( "FillHatchName",
                   FillProperties::PROP_FILL_HATCH_NAME,
                   cppu::UnoType<OUString>::get(),
commit 65c2570e86e0e58ebce447b6d24f11d1c29dfa99
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 28 00:46:19 2015 +0200

    handle fill float transparence in chart area panel
    
    Change-Id: Ibf72ba72ec193638f389167aab415b94a383f3d1

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index f19f690..f002a31 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -11,11 +11,13 @@
 
 #include "ChartController.hxx"
 #include "ViewElementListProvider.hxx"
+#include "PropertyHelper.hxx"
 
 #include "chartview/DrawModelWrapper.hxx"
 
 #include <svx/xfltrit.hxx>
 #include <svx/xflftrit.hxx>
+#include <svx/unomid.hxx>
 
 namespace chart { namespace sidebar {
 
@@ -264,7 +266,17 @@ void ChartAreaPanel::setFillFloatTransparence(
     if (!xPropSet.is())
         return;
 
-    xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(rItem.GetValue()));
+    if (!rItem.IsEnabled())
+    {
+        xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(OUString()));
+        return;
+    }
+
+    OUString aName = rItem.GetName();
+    css::uno::Any aGradientVal;
+    rItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
+    OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
+    xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(aNewName));
 }
 
 void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
@@ -364,9 +376,10 @@ void ChartAreaPanel::updateData()
     GraphicObject xBitmap = getXBitmapFromName(mxModel, aBitmapName);
     XFillBitmapItem aBitmapItem(aBitmapName, xBitmap);
     XFillBitmapItem* pBitmapItem = NULL;
+    DrawModelWrapper* pModelWrapper = NULL;
     try
     {
-        DrawModelWrapper* pModelWrapper = getDrawModelWrapper(mxModel);
+        pModelWrapper = getDrawModelWrapper(mxModel);
         if (pModelWrapper)
         {
             pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel());
@@ -377,6 +390,19 @@ void ChartAreaPanel::updateData()
     }
     updateFillBitmap(false, true, pBitmapItem ? pBitmapItem : &aBitmapItem);
     delete pBitmapItem;
+
+    OUString aFillFloatTransparenceName;
+    xPropSet->getPropertyValue("TransparencyGradientName") >>= 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;
 }
 
 void ChartAreaPanel::modelInvalid()


More information about the Libreoffice-commits mailing list