[Libreoffice-commits] core.git: oox/source sc/qa
Bartosz Kosiorek
gang65 at poczta.onet.pl
Wed Feb 7 13:49:51 UTC 2018
oox/source/export/preset-definitions-to-shape-types.pl | 3 +-
sc/qa/unit/subsequent_export-test.cxx | 21 ++++++++++++-----
2 files changed, 18 insertions(+), 6 deletions(-)
New commits:
commit ea7274259a211170ee9f5a8714a2f9acd8bed6d8
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date: Fri Jan 12 17:12:18 2018 +0100
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 at libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
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
More information about the Libreoffice-commits
mailing list