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

Zolnai Tamás tamas.zolnai at collabora.com
Tue Feb 18 17:33:31 CET 2014


 dev/null                                                        |binary
 l10ntools/inc/lngmerge.hxx                                      |    4 -
 l10ntools/source/lngex.cxx                                      |    2 
 l10ntools/source/lngmerge.cxx                                   |    6 --
 oox/source/drawingml/shape.cxx                                  |   13 +++-
 oox/source/drawingml/shapegroupcontext.cxx                      |    2 
 oox/source/shape/WpgContext.cxx                                 |    4 -
 sw/qa/extras/ooxmlexport/data/dml-groupshape-childposition.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                        |   30 ++++++++--
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                        |   23 -------
 10 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit 8e285728e634b8a2dafcfe87cd1fa7810791df5e
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue Feb 18 14:33:55 2014 +0100

    ooxml unit tests: merge two tests
    
    Change-Id: Ie37ec829ddeeaeb8882c1a566cc80419edcfa170

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a588ce0..fd304c0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -110,8 +110,7 @@ protected:
             "math-mso2k7.docx",
             "ImageCrop.docx",
             "test_GIF_ImageCrop.docx",
-            "test_PNG_ImageCrop.docx",
-            "dml-shape-fillbitmapcrop.docx"
+            "test_PNG_ImageCrop.docx"
         };
         std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
 
@@ -2991,10 +2990,10 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d
 
     // 1st shape has some cropping
     text::GraphicCrop aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 454 ), aGraphicCropStruct.Left );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 367 ), aGraphicCropStruct.Right );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( -454 ), aGraphicCropStruct.Top );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( -367 ), aGraphicCropStruct.Bottom );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? 454 : 455 ), aGraphicCropStruct.Left );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? 367 : 368 ), aGraphicCropStruct.Right );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? -454 : -455 ), aGraphicCropStruct.Top );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(m_bExported ? -367 : -368 ), aGraphicCropStruct.Bottom );
 
     // 2nd shape has no cropping
     aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
diff --git a/sw/qa/extras/ooxmlimport/data/dml-shape-fillbitmapcrop.docx b/sw/qa/extras/ooxmlimport/data/dml-shape-fillbitmapcrop.docx
deleted file mode 100644
index 6c401ba..0000000
Binary files a/sw/qa/extras/ooxmlimport/data/dml-shape-fillbitmapcrop.docx and /dev/null differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 7d9e4f5..f264f0c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1817,29 +1817,6 @@ DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeParaAdjust, "dml-groupshape-paraadjust
     CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT), getProperty<sal_Int16>(getRun(getParagraphOfText(7, xText), 1), "ParaAdjust"));
 }
 
-DECLARE_OOXMLIMPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.docx")
-{
-    // The same test can be found in ooxmlexport, but some rouding made on crop values so we can't test import and
-    // export with the same values.
-
-    // 1st shape has some cropping
-    text::GraphicCrop aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
-
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 455 ), aGraphicCropStruct.Left );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 368 ), aGraphicCropStruct.Right );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( -455 ), aGraphicCropStruct.Top );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( -368 ), aGraphicCropStruct.Bottom );
-
-    // 2nd shape has no cropping
-    aGraphicCropStruct = getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
-
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Left );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Right );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Top );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom );
-
-}
-
 DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.docx")
 {
     // At the start of the document, a picture which has a color specified with a color scheme, lost
commit c9b1fd63452325ee5cb6d003e9fc8315d1ca104e
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue Feb 18 17:28:05 2014 +0100

    drawingML import: fix position of cildren in shape groups
    
    Translate component of parent shapes' transformation
    have to be applied to children when there is no explicit
    child transformation.
    
    Note. Export also use this concept.
    
    Change-Id: I51bd3325fb53ee250402326ee361c8f07038ed07

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fb17f5d..b302010 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -348,10 +348,19 @@ void Shape::addChildren(
     aChildTransformation.scale(1/(maChSize.Width ? maChSize.Width : 1.0), 1/(maChSize.Height ? maChSize.Height : 1.0));
 
     // Child position and size is typically non-zero, but it's allowed to have
-    // it like that, and in that case Word ignores the parent transformation, it
-    // seems.
+    // it like that, and in that case Word ignores the parent transformation
+    // (excluding translate component).
     if (!mbWps || maChPosition.X || maChPosition.Y || maChSize.Width || maChSize.Height)
+    {
         aChildTransformation *= aTransformation;
+    }
+    else
+    {
+        basegfx::B2DVector aScale, aTranslate;
+        double fRotate, fShearX;
+        aTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+        aChildTransformation.translate(aTranslate.getX(), aTranslate.getY());
+    }
 
     SAL_INFO("oox.drawingml", OSL_THIS_FUNC << "parent matrix:\n"
              << aChildTransformation.get(0, 0) << " "
diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx
index 10e419f..d5eb503 100644
--- a/oox/source/drawingml/shapegroupcontext.cxx
+++ b/oox/source/drawingml/shapegroupcontext.cxx
@@ -45,6 +45,8 @@ ShapeGroupContext::ShapeGroupContext( ContextHandler2Helper& rParent, ShapePtr p
 , mpGroupShapePtr( pGroupShapePtr )
 , mpMasterShapePtr( pMasterShapePtr )
 {
+    if( pMasterShapePtr )
+        mpGroupShapePtr->setWps(pMasterShapePtr->getWps());
 }
 
 ShapeGroupContext::~ShapeGroupContext()
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index 6e31612..254d72f 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -60,9 +60,7 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken
         break;
     case XML_grpSp:
     {
-        oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
-        pShape->setWps(true);
-        return new oox::drawingml::ShapeGroupContext(*this, mpShape, pShape);
+        return new oox::drawingml::ShapeGroupContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape")));
     }
     break;
     default:
diff --git a/sw/qa/extras/ooxmlexport/data/dml-groupshape-childposition.docx b/sw/qa/extras/ooxmlexport/data/dml-groupshape-childposition.docx
new file mode 100644
index 0000000..a5c6bf9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-groupshape-childposition.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 60e0f4f..a588ce0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3300,6 +3300,25 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.doc
     CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childposition.docx")
+{
+    // Problem was parent transformation was ingnored fully, but translate component
+    // which specify the position must be also applied for children of the group.
+
+    uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShape> xChildGroup(xGroup->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -2119 : -2121), xChildGroup->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 11338 : 11335), xChildGroup->getPosition().Y);
+
+    xGroup.set(xChildGroup, uno::UNO_QUERY);
+    xChildGroup.set(xGroup->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -1856 : -1858), xChildGroup->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 11338 : 11335), xChildGroup->getPosition().Y);
+
+    xChildGroup.set(xGroup->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? -2119 : -2121), xChildGroup->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(m_bExported ? 14028 : 14025), xChildGroup->getPosition().Y);
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 94af3bc2a4d729339486989fba67b17127e87329
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue Feb 18 00:29:47 2014 +0100

    ulfex: remove unneeded bULF, it is always true
    
    Change-Id: I1401fddfdd42eba96253f4dd19cf60bba8de6802

diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx
index b566acc..278910c 100644
--- a/l10ntools/inc/lngmerge.hxx
+++ b/l10ntools/inc/lngmerge.hxx
@@ -46,7 +46,6 @@ private:
     sal_uInt16 nError;
     LngLineList *pLines;
     OString sSource;
-    bool bULF;
     std::vector<OString> aLanguages;
 
     bool isNextGroup(OString &sGroup_out, const OString &sLine_in);
@@ -55,8 +54,7 @@ private:
     void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout,
         const OString &rActFileName, const OString &rID);
 public:
-    LngParser(const OString &rLngFile,
-        bool bULFFormat);
+    LngParser(const OString &rLngFile);
     ~LngParser();
 
     bool CreatePO( const OString &rPOFile );
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 399c9cf..3754326 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -34,7 +34,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
         return 1;
     }
 
-    LngParser aParser( aArgs.m_sInputFile, true );
+    LngParser aParser( aArgs.m_sInputFile );
     if ( aArgs.m_bMergeMode )
         aParser.Merge(
             aArgs.m_sMergeSrc, aArgs.m_sOutputFile, aArgs.m_sLanguage );
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 0b14a2c..7171f65 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -47,12 +47,10 @@ static void lcl_RemoveUTF8ByteOrderMarker( OString &rString )
 //
 // class LngParser
 //
-LngParser::LngParser(const OString &rLngFile,
-    bool bULFFormat)
+LngParser::LngParser(const OString &rLngFile)
     : nError( LNG_OK )
     , pLines( NULL )
     , sSource( rLngFile )
-    , bULF( bULFFormat )
 {
     pLines = new LngLineList();
     std::ifstream aStream(sSource.getStr());
@@ -237,7 +235,7 @@ bool LngParser::Merge(
                         std::advance( it, nPos );
                         pLines->erase( it );
                     }
-                    if( bULF && pEntrys )
+                    if( pEntrys )
                     {
                         if( !sLang.isEmpty() )
                         {


More information about the Libreoffice-commits mailing list