summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2016-06-12 20:03:01 +0800
committerMark Hung <marklh9@gmail.com>2016-08-11 12:37:22 +0000
commit2b4f9d0b2b0006fc7bebb9e696a32eabd1aeb993 (patch)
treefb523219ec177c003caef31ffb5e71df922daa2f /sd
parentc878bfc8c90372217bfa41818825f4e047b794d8 (diff)
Convert handles of built-in shapes in Impress when exporting to PPTX.
For those shapes exported as OOXML preset shapes, their AdjustmentValues property was exported as the list of adjustment values ( avLst ) in the exported PPTX file. This works for shapes imported from PPTX, whose AdjustmentValues is exactly the same as avLst of the original PPTX file. For built-in shapes in Impress, avLst and AdjustmentValues would not be the same because the path and the equation created by LibreOffice and OOXML are not the same. This patch convert position of handles to adjustment values according to the shape type case by case. It also adds default values if the built-in shape in Impress has fewer handles then the exported preset shape because Powerpoint seems to be very strict about the number of values in avLst, and deemed the file as corrupted if any of defined adjustment values is missing. Round-rectangular-callouts, rectangular-callout, and round-callouts are added to the blacklist so that they are exported as preset shapes. Change-Id: Icd1284790607e927b6a9a614ac463a96cadedd81 Reviewed-on: https://gerrit.libreoffice.org/26479 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sd')
-rwxr-xr-xsd/qa/unit/data/odp/preset-shapes-export.odpbin0 -> 21208 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx81
2 files changed, 81 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/preset-shapes-export.odp b/sd/qa/unit/data/odp/preset-shapes-export.odp
new file mode 100755
index 000000000000..30668535be70
--- /dev/null
+++ b/sd/qa/unit/data/odp/preset-shapes-export.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 78050171a8fd..fdf5d0453460 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -90,6 +90,7 @@ public:
void testMathObjectPPT2010();
void testTdf80224();
void testExportTransitionsPPTX();
+ void testPresetShapesExport();
void testTdf92527();
void testDatetimeFieldNumberFormat();
void testDatetimeFieldNumberFormatPPTX();
@@ -113,6 +114,7 @@ public:
CPPUNIT_TEST(testMathObjectPPT2010);
CPPUNIT_TEST(testTdf80224);
CPPUNIT_TEST(testExportTransitionsPPTX);
+ CPPUNIT_TEST(testPresetShapesExport);
CPPUNIT_TEST(testTdf92527);
CPPUNIT_TEST(testDatetimeFieldNumberFormat);
CPPUNIT_TEST(testDatetimeFieldNumberFormatPPTX);
@@ -438,6 +440,85 @@ void SdOOXMLExportTest2::testExportTransitionsPPTX()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testPresetShapesExport()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/preset-shapes-export.odp"), ODP);
+ const sal_Char *sShapeTypeAndValues[] =
+ {
+ "wedgeEllipseCallout",
+ "adj1","val 45310",
+ "adj2","val 97194",
+ "wedgeRoundRectCallout",
+ "adj1","val 46694",
+ "adj2","val 129726",
+ "adj3","val 16667",
+ "wedgeRectCallout",
+ "adj1","val 40037",
+ "adj2","val 111694",
+ "smileyFace",
+ "adj","val -9282",
+ "can",
+ "adj","val 50000",
+ "frame",
+ "adj1","val 10490",
+ "donut",
+ "adj","val 9601",
+ "noSmoking",
+ "adj","val 16118",
+ "bevel",
+ "adj","val 42587",
+ "foldedCorner",
+ "adj","val 10750",
+ "verticalScroll",
+ "adj","val 25000",
+ "horizontalScroll",
+ "adj","val 25000",
+ "cube",
+ "adj","val 85129",
+ "bracketPair",
+ "adj","val 50000",
+ "sun",
+ "adj","val 12500",
+ "bracePair",
+ "adj","val 25000",
+ "cloudCallout",
+ "adj1","val 77611",
+ "adj2","val -47819",
+ "borderCallout1",
+ "adj1","val 18750",
+ "adj2","val -8333",
+ "adj3","val 170013",
+ "adj4","val 143972",
+ "borderCallout2",
+ "adj1","val 18750",
+ "adj2","val -8333",
+ "adj3","val 113768",
+ "adj4","val -81930",
+ "adj5","val -22375",
+ "adj6","val -134550",
+ };
+
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile );
+
+ xmlDocPtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml");
+ const OString sPattern( "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]" );
+ const OString sT( "_T_" );
+ const OString sN( "_N_" );
+ const OString sPropertyName("name");
+ const OString sPropertyFmla("fmla");
+
+ size_t i = 0;
+ while(i < SAL_N_ELEMENTS( sShapeTypeAndValues )) {
+ OString sType = OString( sShapeTypeAndValues[ i++ ] );
+ for ( size_t j = 1 ; i < SAL_N_ELEMENTS( sShapeTypeAndValues ) && OString(sShapeTypeAndValues[i]).startsWith("adj") ; ++j ) {
+ OString sXPath= sPattern.replaceFirst( sT, sType).replaceFirst( sN, OString::number(j) );
+ assertXPath(pXmlDocCT, sXPath, sPropertyName , OUString::createFromAscii(sShapeTypeAndValues[ i++ ]) );
+ assertXPath(pXmlDocCT, sXPath, sPropertyFmla , OUString::createFromAscii(sShapeTypeAndValues[ i++ ]) );
+ }
+ }
+}
+
void SdOOXMLExportTest2::testTdf92527()
{
// We draw a diamond in an empty document. A newly created diamond shape does not have