summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx1
-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
-rw-r--r--sd/qa/unit/data/odp/closed-shapes.odpbin12596 -> 16370 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx31
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx3
11 files changed, 73 insertions, 6 deletions
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index eff203a4643d..cc55b24e8ceb 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -49,6 +49,7 @@ enum class ShapeProperty
LineColor,
LineTransparency,
LineDash, ///< Explicit line dash or name of a line dash stored in a global container.
+ LineCap,
LineJoint,
LineStart, ///< Explicit line start marker or name of a line marker stored in a global container.
LineStartWidth,
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
diff --git a/sd/qa/unit/data/odp/closed-shapes.odp b/sd/qa/unit/data/odp/closed-shapes.odp
index 23460c7dbae5..d422c74a02a9 100644
--- a/sd/qa/unit/data/odp/closed-shapes.odp
+++ b/sd/qa/unit/data/odp/closed-shapes.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 031156c786b5..9cef83c85ac2 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -152,7 +152,7 @@ public:
void testTdf111863();
void testTdf111518();
void testTdf100387();
- void testClosingShapes();
+ void testClosingShapesAndLineCaps();
void testRotateFlip();
void testTdf106867();
void testTdf112280();
@@ -246,7 +246,7 @@ public:
CPPUNIT_TEST(testTdf111863);
CPPUNIT_TEST(testTdf111518);
CPPUNIT_TEST(testTdf100387);
- CPPUNIT_TEST(testClosingShapes);
+ CPPUNIT_TEST(testClosingShapesAndLineCaps);
CPPUNIT_TEST(testRotateFlip);
CPPUNIT_TEST(testTdf106867);
CPPUNIT_TEST(testTdf112280);
@@ -1135,15 +1135,40 @@ void SdOOXMLExportTest2::testTdf100387()
"/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:set/p:cBhvr/p:tgtEl/p:spTgt/p:txEl/p:pRg", "end", "2");
}
-void SdOOXMLExportTest2::testClosingShapes()
+// tdf#126746 Add support for Line Caps import and export
+void SdOOXMLExportTest2::testClosingShapesAndLineCaps()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/closed-shapes.odp"), ODP);
utl::TempFile tempFile;
xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
xDocShRef->DoClose();
xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:moveTo/a:pt", 1);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", 1);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt", 1);
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 1);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln", "cap", "rnd");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:ln/a:miter", 1);
+
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln", "cap", "rnd");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:ln/a:miter", 1);
+
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln", "cap", "rnd");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:ln/a:miter", 1);
+
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln", "cap", "sq");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[4]/p:spPr/a:ln/a:round", 1);
+
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
+ assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln/a:bevel", 1);
+
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:custGeom/a:pathLst/a:path/a:close", 0);
+ assertXPathNoAttribute(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[5]/p:spPr/a:ln", "cap"); // by default it is "flat" cap style
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[6]/p:spPr/a:ln/a:round", 1);
}
void SdOOXMLExportTest2::testRotateFlip()
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index e738ec7eaaf1..b2b8512267f7 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1584,18 +1584,21 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
</a:schemeClr>\
</a:solidFill>\
<a:prstDash val=\"solid\"/>\
+ <a:miter/>\
</a:ln>\
<a:ln w=\"25400\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
<a:solidFill>\
<a:schemeClr val=\"phClr\"/>\
</a:solidFill>\
<a:prstDash val=\"solid\"/>\
+ <a:miter/>\
</a:ln>\
<a:ln w=\"38100\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
<a:solidFill>\
<a:schemeClr val=\"phClr\"/>\
</a:solidFill>\
<a:prstDash val=\"solid\"/>\
+ <a:miter/>\
</a:ln>\
</a:lnStyleLst>\
<a:effectStyleLst>\