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

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 7 02:15:03 PST 2014


 oox/source/drawingml/drawingmltypes.cxx     |    5 ++++-
 sw/qa/extras/ooxmlexport/data/dkvert.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |    9 +++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 312e3c38befc8164b18842e62e0f91820f4d94bc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 7 10:56:49 2014 +0100

    drawingML export: fix handling of dkVert pattern fill preset
    
    We convert the dkVert preset to a certain hatch configuration (style,
    distance, angle), but when we exported it back, then we didn't recognize
    it, and wrote ltVert instead.
    
    Change-Id: I021885496843f5ea5453af3473453bbec50d928f

diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx
index 48faa54..b3c646e 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -317,7 +317,10 @@ const char* GetHatchPattern( const drawing::Hatch& rHatch )
         {
             case drawing::HatchStyle_SINGLE:
             {
-                if( rHatch.Distance < 75 )
+                // dkVert is imported as Distance = 25, ltVert as Distance = 50, export them accordingly.
+                if( rHatch.Distance < 50 )
+                    sPattern = "dkVert";
+                else if( rHatch.Distance < 75 )
                     sPattern = "ltVert";
                 else
                     sPattern = "vert";
diff --git a/sw/qa/extras/ooxmlexport/data/dkvert.docx b/sw/qa/extras/ooxmlexport/data/dkvert.docx
new file mode 100644
index 0000000..bc1ee78
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dkvert.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index ed9f630..8842cdd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -902,6 +902,15 @@ DECLARE_OOXMLEXPORT_TEST(testAnchorIdForWP14AndW14, "AnchorId.docx")
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx")
+{
+    // <a:pattFill prst="dkVert"> was exported as ltVert.
+    uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
+    // This was 50.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<drawing::Hatch>(xShape, "FillHatch").Distance);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list