[Libreoffice-commits] core.git: filter/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 15 06:07:02 PST 2014


 filter/source/msfilter/util.cxx               |  116 +++++++++++++-------------
 sw/qa/extras/ooxmlexport/data/mso-spt180.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx      |   15 +++
 3 files changed, 73 insertions(+), 58 deletions(-)

New commits:
commit 6e216adedd1a131808b874784c36141607264eac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jan 15 13:02:52 2014 +0100

    filter: audit customshape type -> drawingML preset shape table
    
    It turns out that this table contained entries which are not valid
    drawingML preset shape names.
    
    Invalid entries are now either have a valid name instead (based on the
    oox/source/export/preset-definitions-to-shape-types.pl mapping, which
    already tries to map VML shape ID's to drawingML preset strings), or in
    case I found no mapping there, the entry is now simply commented out.
    
    It's still better to fall back to export a shape as a rectangle than
    corrupting the whole document.
    
    Change-Id: Ic2d8926e5819f3312aaca55d50a1492332e52a9d

diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index efe8cd1..72e15dd 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -720,14 +720,14 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "mso-spt21", "plaque" },
     { "can", "can" },
     { "ring", "donut" },
-    { "mso-spt24", "textSimple" },
-    { "mso-spt25", "textOctagon" },
-    { "mso-spt26", "textHexagon" },
-    { "mso-spt27", "textCurve" },
-    { "mso-spt28", "textWave" },
-    { "mso-spt29", "textRing" },
-    { "mso-spt30", "textOnCurve" },
-    { "mso-spt31", "textOnRing" },
+    { "mso-spt24", "textPlain" },
+    { "mso-spt25", "textStop" },
+    { "mso-spt26", "textTriangle" },
+    { "mso-spt27", "textCanDown" },
+    { "mso-spt28", "textWave1" },
+    { "mso-spt29", "textArchUpPour" },
+    { "mso-spt30", "textCanDown" },
+    { "mso-spt31", "textArchUp" },
     { "mso-spt32", "straightConnector1" },
     { "mso-spt33", "bentConnector2" },
     { "mso-spt34", "bentConnector3" },
@@ -746,7 +746,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "line-callout-1", "borderCallout1" },
     { "line-callout-2", "borderCallout2" },
     { "line-callout-3", "borderCallout3" },
-    { "mso-spt49", "accentBorderCallout90" },
+    { "mso-spt49", "borderCallout3" },
     { "mso-spt50", "accentBorderCallout1" },
     { "mso-spt51", "accentBorderCallout2" },
     { "mso-spt52", "accentBorderCallout3" },
@@ -755,9 +755,9 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "chevron", "chevron" },
     { "pentagon", "pentagon" },
     { "forbidden", "noSmoking" },
-    { "star8", "seal8" },
-    { "mso-spt59", "seal16" },
-    { "mso-spt60", "seal32" },
+    { "star8", "star8" },
+    { "mso-spt59", "star16" },
+    { "mso-spt60", "star32" },
     { "rectangular-callout", "wedgeRectCallout" },
     { "round-rectangular-callout", "wedgeRoundRectCallout" },
     { "round-callout", "wedgeEllipseCallout" },
@@ -788,7 +788,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "mso-spt89", "leftUpArrow" },
     { "mso-spt90", "bentUpArrow" },
     { "mso-spt91", "bentArrow" },
-    { "star24", "seal24" },
+    { "star24", "star24" },
     { "striped-right-arrow", "stripedRightArrow" },
     { "notched-right-arrow", "notchedRightArrow" },
     { "block-arc", "blockArc" },
@@ -832,57 +832,57 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "flowchart-direct-access-storage", "flowChartMagneticDrum" },
     { "flowchart-display", "flowChartDisplay" },
     { "flowchart-delay", "flowChartDelay" },
-    { "fontwork-plain-text", "textPlainText" },
-    { "fontwork-stop", "textStop" },
-    { "fontwork-triangle-up", "textTriangle" },
-    { "fontwork-triangle-down", "textTriangleInverted" },
-    { "fontwork-chevron-up", "textChevron" },
-    { "fontwork-chevron-down", "textChevronInverted" },
-    { "mso-spt142", "textRingInside" },
-    { "mso-spt143", "textRingOutside" },
-    { "fontwork-arch-up-curve", "textArchUpCurve" },
-    { "fontwork-arch-down-curve", "textArchDownCurve" },
-    { "fontwork-circle-curve", "textCircleCurve" },
-    { "fontwork-open-circle-curve", "textButtonCurve" },
-    { "fontwork-arch-up-pour", "textArchUpPour" },
-    { "fontwork-arch-down-pour", "textArchDownPour" },
-    { "fontwork-circle-pour", "textCirclePour" },
-    { "fontwork-open-circle-pour", "textButtonPour" },
-    { "fontwork-curve-up", "textCurveUp" },
-    { "fontwork-curve-down", "textCurveDown" },
-    { "fontwork-fade-up-and-right", "textCascadeUp" },
-    { "fontwork-fade-up-and-left", "textCascadeDown" },
-    { "fontwork-wave", "textWave1" },
-    { "mso-spt157", "textWave2" },
-    { "mso-spt158", "textWave3" },
-    { "mso-spt159", "textWave4" },
-    { "fontwork-inflate", "textInflate" },
-    { "mso-spt161", "textDeflate" },
-    { "mso-spt162", "textInflateBottom" },
-    { "mso-spt163", "textDeflateBottom" },
-    { "mso-spt164", "textInflateTop" },
-    { "mso-spt165", "textDeflateTop" },
-    { "mso-spt166", "textDeflateInflate" },
-    { "mso-spt167", "textDeflateInflateDeflate" },
-    { "fontwork-fade-right", "textFadeRight" },
-    { "fontwork-fade-left", "textFadeLeft" },
-    { "fontwork-fade-up", "textFadeUp" },
-    { "fontwork-fade-down", "textFadeDown" },
-    { "fontwork-slant-up", "textSlantUp" },
-    { "fontwork-slant-down", "textSlantDown" },
-    { "mso-spt174", "textCanUp" },
-    { "mso-spt175", "textCanDown" },
+    // { "fontwork-plain-text", "textPlainText" },
+    // { "fontwork-stop", "textStop" },
+    // { "fontwork-triangle-up", "textTriangle" },
+    // { "fontwork-triangle-down", "textTriangleInverted" },
+    // { "fontwork-chevron-up", "textChevron" },
+    // { "fontwork-chevron-down", "textChevronInverted" },
+    // { "mso-spt142", "textRingInside" },
+    // { "mso-spt143", "textRingOutside" },
+    // { "fontwork-arch-up-curve", "textArchUpCurve" },
+    // { "fontwork-arch-down-curve", "textArchDownCurve" },
+    // { "fontwork-circle-curve", "textCircleCurve" },
+    // { "fontwork-open-circle-curve", "textButtonCurve" },
+    // { "fontwork-arch-up-pour", "textArchUpPour" },
+    // { "fontwork-arch-down-pour", "textArchDownPour" },
+    // { "fontwork-circle-pour", "textCirclePour" },
+    // { "fontwork-open-circle-pour", "textButtonPour" },
+    // { "fontwork-curve-up", "textCurveUp" },
+    // { "fontwork-curve-down", "textCurveDown" },
+    // { "fontwork-fade-up-and-right", "textCascadeUp" },
+    // { "fontwork-fade-up-and-left", "textCascadeDown" },
+    // { "fontwork-wave", "textWave1" },
+    // { "mso-spt157", "textWave2" },
+    // { "mso-spt158", "textWave3" },
+    // { "mso-spt159", "textWave4" },
+    // { "fontwork-inflate", "textInflate" },
+    // { "mso-spt161", "textDeflate" },
+    // { "mso-spt162", "textInflateBottom" },
+    // { "mso-spt163", "textDeflateBottom" },
+    // { "mso-spt164", "textInflateTop" },
+    // { "mso-spt165", "textDeflateTop" },
+    // { "mso-spt166", "textDeflateInflate" },
+    // { "mso-spt167", "textDeflateInflateDeflate" },
+    // { "fontwork-fade-right", "textFadeRight" },
+    // { "fontwork-fade-left", "textFadeLeft" },
+    // { "fontwork-fade-up", "textFadeUp" },
+    // { "fontwork-fade-down", "textFadeDown" },
+    // { "fontwork-slant-up", "textSlantUp" },
+    // { "fontwork-slant-down", "textSlantDown" },
+    // { "mso-spt174", "textCanUp" },
+    // { "mso-spt175", "textCanDown" },
     { "flowchart-alternate-process", "flowChartAlternateProcess" },
     { "flowchart-off-page-connector", "flowChartOffpageConnector" },
-    { "mso-spt178", "callout90" },
-    { "mso-spt179", "accentCallout90" },
-    { "mso-spt180", "borderCallout90" },
+    { "mso-spt178", "callout1" },
+    { "mso-spt179", "accentCallout1" },
+    { "mso-spt180", "borderCallout1" },
     { "mso-spt182", "leftRightUpArrow" },
     { "sun", "sun" },
     { "moon", "moon" },
     { "bracket-pair", "bracketPair" },
     { "brace-pair", "bracePair" },
-    { "star4", "seal4" },
+    { "star4", "star4" },
     { "mso-spt188", "doubleWave" },
     { "mso-spt189", "actionButtonBlank" },
     { "mso-spt190", "actionButtonHome" },
@@ -896,7 +896,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
     { "mso-spt198", "actionButtonDocument" },
     { "mso-spt199", "actionButtonSound" },
     { "mso-spt200", "actionButtonMovie" },
-    { "mso-spt201", "hostControl" },
+    // { "mso-spt201", "hostControl" },
     { "mso-spt202", "rect" },
     { "ooxml-actionButtonSound", "actionButtonSound" },
     { "ooxml-borderCallout1", "borderCallout1" },
diff --git a/sw/qa/extras/ooxmlexport/data/mso-spt180.docx b/sw/qa/extras/ooxmlexport/data/mso-spt180.docx
new file mode 100644
index 0000000..bf3a801
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/mso-spt180.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f9ef75e..f093b5d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2454,6 +2454,21 @@ DECLARE_OOXMLEXPORT_TEST(testTrackChangesParagraphProperties, "testTrackChangesP
     assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx")
+{
+    if (!m_bExported)
+        return;
+
+    uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
+    uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xGroup->getByIndex(0), "CustomShapeGeometry");
+    OUString aType;
+    for (int i = 0; i < aProps.getLength(); ++i)
+        if (aProps[i].Name == "Type")
+            aType = aProps[i].Value.get<OUString>();
+    // This was exported as borderCallout90, which is an invalid drawingML preset shape string.
+    CPPUNIT_ASSERT_EQUAL(OUString("ooxml-borderCallout1"), aType);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list