summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-02-26 22:35:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-02-29 16:12:34 +0000
commitb423f5cd8578924623d5349e4d48a35ed60050ec (patch)
tree9fe7e799469eee7650500d99bdd0b6fdaac6495c
parentbf0cd650b571a10fdd1050911fd70ff1b4fe3db7 (diff)
xmloff: tdf#97808: allow empty draw:marker-start/marker-end/stroke-dash
Apparently these are allowed to be empty, which means "nothing". (regression from db1d278dcc308c73eb5edebc20481c96e7f479d8) (cherry picked from commit af57a81d0c28944b424649f024c28f444a1ab2d9) Reviewed-on: https://gerrit.libreoffice.org/22723 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit a33a394bf3b44f56641ee8fd3bc5e29f1776c777) fix clang build Reviewed-on: https://gerrit.libreoffice.org/22745 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 0e8e2899cf1b21aecc7bc0cbf7c9e4b775739f44) Change-Id: I13f7998e0986b26c34929afd40b1b4f0fc9efdff Reviewed-on: https://gerrit.libreoffice.org/22770 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/qa/unit/data/tdf97808.fodp30
-rw-r--r--sd/qa/unit/import-tests.cxx42
-rw-r--r--sd/qa/unit/sdmodeltestbase.hxx3
-rw-r--r--xmloff/source/draw/XMLShapeStyleContext.cxx6
4 files changed, 80 insertions, 1 deletions
diff --git a/sd/qa/unit/data/tdf97808.fodp b/sd/qa/unit/data/tdf97808.fodp
new file mode 100644
index 000000000000..ac2d3e2d8c13
--- /dev/null
+++ b/sd/qa/unit/data/tdf97808.fodp
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.presentation">
+ <office:styles>
+
+ <draw:marker draw:name="Arrow" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/>
+ <draw:stroke-dash draw:name="Dashed_20__28_var_29__20_2" draw:display-name="Dashed (var) 2" draw:style="rect" draw:dots1="1" draw:dots1-length="0.02cm" draw:dots2="1" draw:dots2-length="0.02cm" draw:distance="0.02cm"/>
+ <style:style style:name="objectwithoutfill" style:family="graphic">
+ <style:graphic-properties draw:stroke-dash="Dashed_20__28_var_29__20_2" svg:stroke-color="#000000" draw:marker-end="Arrow" draw:marker-end-width="0.6cm" draw:fill="solid" draw:fill-color="#008000"/>
+ </style:style>
+
+ </office:styles>
+ <office:automatic-styles>
+
+ <style:style style:name="gr12" style:family="graphic" style:parent-style-name="objectwithoutfill">
+ <style:graphic-properties svg:stroke-color="#999999" draw:marker-end="" draw:marker-end-width="0.3cm" draw:fill="solid" draw:textarea-vertical-align="middle"/>
+ </style:style>
+
+ </office:automatic-styles>
+ <office:body>
+ <office:presentation>
+
+ <draw:page>
+ <draw:line draw:style-name="gr12" svg:x1="7.152cm" svg:y1="17.473cm" svg:x2="6.89cm" svg:y2="15.718cm">
+ <text:p/>
+ </draw:line>
+ </draw:page>
+
+ </office:presentation>
+ </office:body>
+</office:document>
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 42a986622dc4..4ae4e4ecc8c2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/table/XTableRows.hpp>
#include <stlpool.hxx>
@@ -73,6 +74,7 @@ public:
void testN778859();
void testMasterPageStyleParent();
void testGradientAngle();
+ void testTdf97808();
void testFdo64512();
void testFdo71075();
void testN828390_2();
@@ -114,6 +116,7 @@ public:
CPPUNIT_TEST(testN778859);
CPPUNIT_TEST(testMasterPageStyleParent);
CPPUNIT_TEST(testGradientAngle);
+ CPPUNIT_TEST(testTdf97808);
CPPUNIT_TEST(testFdo64512);
CPPUNIT_TEST(testFdo71075);
CPPUNIT_TEST(testN828390_2);
@@ -552,6 +555,45 @@ void SdImportTest::testFdo77027()
xDocShRef->DoClose();
}
+namespace com { namespace sun { namespace star { namespace uno {
+
+template<class T>
+std::ostream& operator<<(std::ostream& rStrm, const uno::Reference<T>& xRef)
+{
+ rStrm << xRef.get();
+ return rStrm;
+}
+
+} } } }
+
+void SdImportTest::testTdf97808()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/tdf97808.fodp"), FODP);
+
+ uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(
+ xDocShRef->GetModel(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("graphics"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("objectwithoutfill"), uno::UNO_QUERY);
+ OUString lineend;
+ CPPUNIT_ASSERT(xStyle->getPropertyValue("LineEndName") >>= lineend);
+ CPPUNIT_ASSERT_EQUAL(OUString("Arrow"), lineend);
+
+ // the draw:marker-end="" did not override the style
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(
+ xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xLine(
+ xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+ //uno::Reference<style::XStyle> xParent;
+ uno::Reference<beans::XPropertySet> xParent;
+ CPPUNIT_ASSERT(xLine->getPropertyValue("Style") >>= xParent);
+ CPPUNIT_ASSERT_EQUAL(xStyle, xParent);
+ CPPUNIT_ASSERT(xLine->getPropertyValue("LineEndName") >>= lineend);
+ CPPUNIT_ASSERT_EQUAL(OUString(), lineend);
+}
+
void SdImportTest::testFdo64512()
{
sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo64512.odp"), ODP);
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 4c465470c4ef..136ebc0933f4 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -49,6 +49,7 @@ struct FileFormat
#define HTML_FORMAT_TYPE ( SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
#define PDF_FORMAT_TYPE ( SfxFilterFlags::STARONEFILTER | SfxFilterFlags::ALIEN | SfxFilterFlags::IMPORT | SfxFilterFlags::PREFERED )
#define FODG_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
+#define FODP_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
/** List of file formats we support in Impress unit tests.
@@ -66,6 +67,7 @@ FileFormat aFileFormats[] =
{ "html", "graphic_HTML", "graphic_HTML", "", HTML_FORMAT_TYPE },
{ "pdf", "draw_pdf_import", "pdf_Portable_Document_Format", "", PDF_FORMAT_TYPE },
{ "fodg", "OpenDocument Drawing Flat XML", "Flat XML ODF Drawing", "", FODG_FORMAT_TYPE },
+ { "fodp", "OpenDocument Presentation Flat XML", "Flat XML ODF Presentation", "", FODP_FORMAT_TYPE },
{ nullptr, nullptr, nullptr, nullptr, SfxFilterFlags::NONE }
};
@@ -75,6 +77,7 @@ FileFormat aFileFormats[] =
#define HTML 3
#define PDF 4
#define FODG 5
+#define FODP 6
/// Base class for filter tests loading or roundtriping a document, and asserting the document model.
class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx
index 2a80b436737a..60ca797daf4b 100644
--- a/xmloff/source/draw/XMLShapeStyleContext.cxx
+++ b/xmloff/source/draw/XMLShapeStyleContext.cxx
@@ -241,7 +241,11 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet
// of type styleName = NCName which is non-empty.
// tdf#89802: for Writer frames there would be no exception here but
// it will fail later on attach() and take out the entire frame
- if (sStyleName.isEmpty())
+ if (sStyleName.isEmpty() &&
+ ( CTF_FILLGRADIENTNAME == aContextIDs[i].nContextID
+ || CTF_FILLTRANSNAME == aContextIDs[i].nContextID
+ || CTF_FILLHATCHNAME == aContextIDs[i].nContextID
+ || CTF_FILLBITMAPNAME == aContextIDs[i].nContextID))
{
Sequence<OUString> const seq{ sStyleName };
GetImport().SetError(