summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2019-08-10 12:11:38 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2019-08-15 22:43:51 +0200
commit606a88d2abf85aa6edcc1fa26dc50cab6de3241f (patch)
treed96ab0cd8b9f0e93f2a58ad7b2824262cd95a609 /oox
parent8e0918a04ee6797909264943eba23707b224c34c (diff)
tdf#126746 Add support for import/export line caps for .pptx format
With this commit I have added importing and exporting line caps, which could be (for pptx format: rnd Round Line Cap sq Square Line Cap flat Flat Line Cap Also exporting of these caps are added. Change-Id: I799485048a2a7ac8df89f004e177d507f86ce99d Reviewed-on: https://gerrit.libreoffice.org/77233 Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> Tested-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/lineproperties.hxx3
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx5
-rw-r--r--oox/source/drawingml/lineproperties.cxx24
-rw-r--r--oox/source/drawingml/shape.cxx1
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx2
-rw-r--r--oox/source/export/drawingml.cxx8
-rw-r--r--oox/source/token/properties.txt1
7 files changed, 41 insertions, 3 deletions
diff --git a/oox/inc/drawingml/lineproperties.hxx b/oox/inc/drawingml/lineproperties.hxx
index 512c1aba5fe6..b0d27a278373 100644
--- a/oox/inc/drawingml/lineproperties.hxx
+++ b/oox/inc/drawingml/lineproperties.hxx
@@ -23,6 +23,7 @@
#include <utility>
#include <vector>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <oox/dllapi.h>
@@ -74,6 +75,8 @@ struct OOX_DLLPUBLIC LineProperties
/** Calculates the line style attribute from the internal state of the object */
css::drawing::LineStyle getLineStyle() const;
+ /** Calculates the line cap attribute from the internal state of the object */
+ css::drawing::LineCap getLineCap() const;
/** Calculates the line joint attribute from the internal state of the object */
css::drawing::LineJoint getLineJoint() const;
/** Calculates the line width attribute from the internal state of the object */
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 9c64530a70ad..ed52ccf5c2b1 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -446,7 +446,7 @@ const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int
static const ShapePropertyIds spnCommonPropIds =
{
PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName,
- PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
+ PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName,
PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
@@ -456,7 +456,7 @@ static const ShapePropertyIds spnCommonPropIds =
static const ShapePropertyIds spnLinearPropIds =
{
PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName,
- PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
+ PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID,
@@ -477,6 +477,7 @@ static const ShapePropertyIds spnFilledPropIds =
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
+ PROP_INVALID,
PROP_FillStyle,
PROP_Color,
PROP_Transparency,
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 2b5de7a1f8c0..a7ea2396e65d 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -23,6 +23,7 @@
#include <osl/diagnose.h>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
@@ -126,6 +127,18 @@ DashStyle lclGetDashStyle( sal_Int32 nToken )
return DashStyle_ROUNDRELATIVE;
}
+LineCap lclGetLineCap( sal_Int32 nToken )
+{
+ OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
+ switch( nToken )
+ {
+ case XML_rnd: return LineCap_ROUND;
+ case XML_sq: return LineCap_SQUARE;
+ case XML_flat: return LineCap_BUTT;
+ }
+ return LineCap_BUTT;
+}
+
LineJoint lclGetLineJoint( sal_Int32 nToken )
{
OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
@@ -382,6 +395,9 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap,
if( rPropMap.setProperty( ShapeProperty::LineDash, aLineDash ) )
eLineStyle = drawing::LineStyle_DASH;
}
+ // line cap type
+ if( moLineCap.has() )
+ rPropMap.setProperty( ShapeProperty::LineCap, lclGetLineCap( moLineCap.get() ) );
// set final line style property
rPropMap.setProperty( ShapeProperty::LineStyle, eLineStyle );
@@ -418,6 +434,14 @@ drawing::LineStyle LineProperties::getLineStyle() const
drawing::LineStyle_SOLID;
}
+drawing::LineCap LineProperties::getLineCap() const
+{
+ if( moLineCap.has() )
+ return lclGetLineCap( moLineCap.get() );
+
+ return drawing::LineCap_BUTT;
+}
+
drawing::LineJoint LineProperties::getLineJoint() const
{
if( moLineJoint.has() )
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ae5afd443b94..960b63297902 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -974,6 +974,7 @@ Reference< XShape > const & Shape::createAndInsert(
{"Idx", uno::makeAny(pLineRef->mnThemedIdx)},
{"Color", uno::makeAny(nLinePhClr)},
{"LineStyle", uno::makeAny(aLineProperties.getLineStyle())},
+ {"LineCap", uno::makeAny(aLineProperties.getLineCap())},
{"LineJoint", uno::makeAny(aLineProperties.getLineJoint())},
{"LineWidth", uno::makeAny(aLineProperties.getLineWidth())},
{"Transformations", uno::makeAny(pLineRef->maPhClr.getTransformations())}
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index 5e34fff6cc73..c6168be243ab 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -41,7 +41,7 @@ namespace {
static const ShapePropertyIds spnDefaultShapeIds =
{
- PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint,
+ PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineCap, PROP_LineJoint,
PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter,
PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillTransparenceGradientName, PROP_FillGradient,
PROP_FillBitmap, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 718b76f552ac..021a1e0b1936 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -821,6 +821,14 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
{
nColorAlpha = MAX_PERCENT - (mAny.get<sal_Int16>() * PER_PERCENT);
}
+ if (GetProperty(rXPropSet, "LineCap"))
+ {
+ const LineCap aLineCap = mAny.get<drawing::LineCap>();
+ if (aLineCap == LineCap_ROUND)
+ cap = "rnd";
+ else if (aLineCap == LineCap_SQUARE)
+ cap = "sq";
+ }
break;
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 13734d05fadf..15db0c2b193e 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -289,6 +289,7 @@ LeftMargin
LeftPageFooterContent
LeftPageHeaderContent
LegacyFragment
+LineCap
LineColor
LineCount
LineDash