[Libreoffice-commits] .: 2 commits - oox/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 17 08:45:39 PST 2013


 oox/source/vml/vmlshape.cxx |   33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

New commits:
commit f4483d31f33aca78afbd719e58db5d8a097411dd
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jan 17 17:37:19 2013 +0100

    VML import of TextFrame border width
    
    Change-Id: I9c0cf277e17c02c2de564d48ba79e1c25ea23db5

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 0fa3a3d..e36d98e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <algorithm>
+#include <boost/optional.hpp>
 
 #include "oox/vml/vmlshape.hxx"
 
@@ -370,7 +371,10 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
             aPropMap.setProperty(PROP_BackColor, aPropMap[PROP_FillColor]);
             aPropMap.erase(PROP_FillColor);
         }
-        // And no LineColor property; individual borders can have colors
+        // And no LineColor property; individual borders can have colors and widths
+        boost::optional<sal_Int32> oLineWidth;
+        if (maTypeModel.maStrokeModel.moWeight.has())
+            oLineWidth.reset(ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maStrokeModel.moWeight.get(), 0, false, false));
         if (aPropMap.hasProperty(PROP_LineColor))
         {
             uno::Reference<beans::XPropertySet> xPropertySet(rxShape, uno::UNO_QUERY);
@@ -381,6 +385,8 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
             {
                 table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<table::BorderLine2>();
                 aBorderLine.Color = aPropMap[PROP_LineColor].get<sal_Int32>();
+                if (oLineWidth)
+                    aBorderLine.LineWidth = *oLineWidth;
                 aPropMap.setProperty(aBorders[i], uno::makeAny(aBorderLine));
             }
             aPropMap.erase(PROP_LineColor);
commit 88ebaff73533fdbbd7ecbf24a0e892f411c577a0
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jan 17 16:56:08 2013 +0100

    VML import of TextFrame border color
    
    Change-Id: I8c0cf9e3ac17b87cbfdd4e744632c5306e2abfc2

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 72c4ca1..0fa3a3d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
 #include <com/sun/star/text/SizeType.hpp>
@@ -360,12 +361,30 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con
     maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rGraphicHelper );
     maTypeModel.maFillModel.pushToPropMap( aPropMap, rGraphicHelper );
 
-    // TextFrames have BackColor, not FillColor
     uno::Reference<lang::XServiceInfo> xSInfo(rxShape, uno::UNO_QUERY_THROW);
-    if (xSInfo->supportsService("com.sun.star.text.TextFrame") && aPropMap.hasProperty(PROP_FillColor))
+    if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
     {
-        aPropMap.setProperty(PROP_BackColor, aPropMap[PROP_FillColor]);
-        aPropMap.erase(PROP_FillColor);
+        // TextFrames have BackColor, not FillColor
+        if (aPropMap.hasProperty(PROP_FillColor))
+        {
+            aPropMap.setProperty(PROP_BackColor, aPropMap[PROP_FillColor]);
+            aPropMap.erase(PROP_FillColor);
+        }
+        // And no LineColor property; individual borders can have colors
+        if (aPropMap.hasProperty(PROP_LineColor))
+        {
+            uno::Reference<beans::XPropertySet> xPropertySet(rxShape, uno::UNO_QUERY);
+            static sal_Int32 aBorders[] = {
+                PROP_TopBorder, PROP_LeftBorder, PROP_BottomBorder, PROP_RightBorder
+            };
+            for (unsigned int i = 0; i < SAL_N_ELEMENTS(aBorders); ++i)
+            {
+                table::BorderLine2 aBorderLine = xPropertySet->getPropertyValue(PropertyMap::getPropertyName(aBorders[i])).get<table::BorderLine2>();
+                aBorderLine.Color = aPropMap[PROP_LineColor].get<sal_Int32>();
+                aPropMap.setProperty(aBorders[i], uno::makeAny(aBorderLine));
+            }
+            aPropMap.erase(PROP_LineColor);
+        }
     }
 
     PropertySet( rxShape ).setProperties( aPropMap );


More information about the Libreoffice-commits mailing list