summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2018-01-12 17:12:18 +0100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2018-02-07 14:49:28 +0100
commitea7274259a211170ee9f5a8714a2f9acd8bed6d8 (patch)
treed0aebf3e014b6538c9d7fc070c24f7ee09191aae
parent37413f569ad557cc08ea625ce18a6570eb00f075 (diff)
tdf#114842 Fix comment shape export for Calc
When we have shape definition for commend, eg.: <v:shape id="_x0000_s1026" type="#_x0000_t202" the "type" must be specified previously, eg: <v:shapetype id="shapetype_202" coordsize="21600,21600" o:spt="202" path="m,l,21600l21600,21600l21600,xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype Unfortunately here is the problem, "id" of "v:shapetype" is "shapetype_202". It means that type used by shape type="#_x0000_t202" is not exisiting. To fix that issue I have changed "v:shapetype" id to be exactly the same as it is used: <v:shapetype id="_x005F_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600l21600,21600l21600,xe"> <v:stroke joinstyle="miter"/> <v:path gradientshapeok="t" o:connecttype="rect"/> </v:shapetype> After that fix, comments are displayed correctly. I also added unit test, to make sure that shape is using already defined "shapetype". Change-Id: I8faf1befe7573aa33ee8a294eb192e5e255f37a1 Reviewed-on: https://gerrit.libreoffice.org/47821 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rw-r--r--oox/source/export/preset-definitions-to-shape-types.pl3
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx21
2 files changed, 18 insertions, 6 deletions
diff --git a/oox/source/export/preset-definitions-to-shape-types.pl b/oox/source/export/preset-definitions-to-shape-types.pl
index b41dd58953e8..e36e97a808a9 100644
--- a/oox/source/export/preset-definitions-to-shape-types.pl
+++ b/oox/source/export/preset-definitions-to-shape-types.pl
@@ -1187,8 +1187,9 @@ parse( $file );
close( $file );
if ( !defined( $result_shapes{'textBox'} ) ) {
+ # tdf#114842 shapetype id of the textbox, must be the same as defined
$result_shapes{'textBox'} =
- "<v:shapetype id=\"shapetype___ID__\" coordsize=\"21600,21600\" " .
+ "<v:shapetype id=\"_x005F_x0000_t__ID__\" coordsize=\"21600,21600\" " .
"o:spt=\"__ID__\" path=\"m,l,21600l21600,21600l21600,xe\">\n" .
"<v:stroke joinstyle=\"miter\"/>\n" .
"<v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n" .
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index aaf82ae88c88..6865897d0318 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -564,14 +564,25 @@ void ScExportTest::testCommentExportXLSX()
CPPUNIT_ASSERT(xShell.is());
std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
- CPPUNIT_ASSERT(pSheet);
+ const xmlDocPtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
+ CPPUNIT_ASSERT(pComments);
+
+ assertXPath(pComments, "/x:comments/x:authors/x:author[1]", "BAKO");
+ assertXPath(pComments, "/x:comments/x:authors/x:author", 1);
+
+ assertXPath(pComments, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
- assertXPath(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
- assertXPath(pSheet, "/x:comments/x:authors/x:author", 1);
+ const xmlDocPtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
+ CPPUNIT_ASSERT(pVmlDrawing);
- assertXPath(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
+ //assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600");
+ assertXPath(pVmlDrawing, "/xml/v:shapetype", "spt", "202");
+ assertXPath(pVmlDrawing, "/xml/v:shapetype/v:stroke", "joinstyle", "miter");
+ const OUString sShapeTypeId = "#" + getXPath(pVmlDrawing, "/xml/v:shapetype", "id");
+ assertXPath(pVmlDrawing, "/xml/v:shape", "type", sShapeTypeId);
+ assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "color", "black");
+ assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t");
}
#if HAVE_MORE_FONTS