[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 2 commits - include/oox oox/source sd/qa sd/sdi

Zolnai Tamás tamas.zolnai at collabora.com
Sat May 31 05:07:31 PDT 2014


 include/oox/drawingml/textbodyproperties.hxx |    6 ++++--
 oox/source/drawingml/textbodyproperties.cxx  |    6 ++++--
 oox/source/drawingml/transform2dcontext.cxx  |   21 +++++++++++++++++++--
 sd/qa/unit/data/pptx/bnc870237.pptx          |binary
 sd/qa/unit/import-tests.cxx                  |   22 ++++++++++++++++++++++
 sd/sdi/drviewsh.sdi                          |    5 +++++
 sd/sdi/outlnvsh.sdi                          |    5 +++++
 7 files changed, 59 insertions(+), 6 deletions(-)

New commits:
commit 545eb73fbfb4dde67ffd7988a450aef47f5b3375
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri May 30 13:56:10 2014 +0200

    fdo#76953: cannot start show at selected slide
    
    It was worked only in slide sorter view properly.
    It seems it leads undefined behaviour when a menu item
    is in the menubar.xml but has no definition in *.sdi file.
    I experienced that on windows menu item was disabled
    on linux it was enabled.
    
    Change-Id: Iba4dd1cbac60a3b3350604d64d60d10d050a4e2b
    (cherry picked from commit e20876b37d203642b5aa81a2d6c93979600376ed)

diff --git a/sd/sdi/drviewsh.sdi b/sd/sdi/drviewsh.sdi
index 5f58cb8..f56f7a8 100644
--- a/sd/sdi/drviewsh.sdi
+++ b/sd/sdi/drviewsh.sdi
@@ -65,6 +65,11 @@ interface ImpressEditView : DrawView
         ExecMethod = FuSupport ;
         StateMethod = GetMenuState ;
     ]
+    SID_PRESENTATION_CURRENT_SLIDE // ole : no, status : ?
+    [
+        ExecMethod = FuSupport ;
+        StateMethod = GetMenuState ;
+    ]
     SID_PRESENTATION_END // ole : no, status : ?
     [
         ExecMethod = FuSupport ;
diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi
index 7216934..b1f671a 100644
--- a/sd/sdi/outlnvsh.sdi
+++ b/sd/sdi/outlnvsh.sdi
@@ -212,6 +212,11 @@ interface OutlineView
         ExecMethod = FuTemporary ;
         StateMethod = GetMenuState ;
     ]
+    SID_PRESENTATION_CURRENT_SLIDE // ole : no, status : ?
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetMenuState ;
+    ]
     SID_EDIT_OUTLINER // ole : no, status : ?
     [
         ExecMethod = FuPermanent ;
commit fb19d682260134f14667f9647dd35e14d70316f2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri May 30 13:45:36 2014 +0200

    bnc#870237: wrong text position in grouped list
    
    In grouped list text area does not cover the whole
    shape but just a part of it at the top.
    To get the same visual effect modify text distance
    attribute.
    
    (cherry picked from commit 53c376d35b7223d53e8c9403390afe53d1f69089)
    
    Conflicts:
    	sd/qa/unit/import-tests.cxx
    
    Change-Id: I32f30d0afbc1975f940c4562ec65f46596e97060

diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx
index af68f20..04195e9 100644
--- a/include/oox/drawingml/textbodyproperties.hxx
+++ b/include/oox/drawingml/textbodyproperties.hxx
@@ -37,8 +37,10 @@ struct TextBodyProperties
     bool                                            mbAnchorCtr;
     OptValue< sal_Int32 >                           moVert;
     boost::optional< sal_Int32 >                    moInsets[4];
-    boost::optional< sal_Int32 >                    moTextOffX;
-    boost::optional< sal_Int32 >                    moTextOffY;
+    boost::optional< sal_Int32 >                    moTextOffUpper;
+    boost::optional< sal_Int32 >                    moTextOffLeft;
+    boost::optional< sal_Int32 >                    moTextOffLower;
+    boost::optional< sal_Int32 >                    moTextOffRight;
     ::com::sun::star::drawing::TextVerticalAdjust   meVA;
 
     explicit            TextBodyProperties();
diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx
index 9e53897..3861ebe 100644
--- a/oox/source/drawingml/textbodyproperties.cxx
+++ b/oox/source/drawingml/textbodyproperties.cxx
@@ -80,8 +80,10 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
         // Hack for n#760986
         // TODO: Preferred method would be to have a textbox on top
         // of the shape and the place it according to the (off,ext)
-        if( nOff == 0 && moTextOffX && mbAnchorCtr ) nVal = *moTextOffX;
-        if( nOff == 1 && moTextOffY && mbAnchorCtr ) nVal = *moTextOffY;
+        if( nOff == 0 && moTextOffLeft && mbAnchorCtr ) nVal = *moTextOffLeft;
+        if( nOff == 1 && moTextOffUpper ) nVal = *moTextOffLeft;
+        if( nOff == 2 && moTextOffRight && mbAnchorCtr ) nVal = *moTextOffRight;
+        if( nOff == 3 && moTextOffLower ) nVal = *moTextOffLower;
         if( nVal < 0 ) nVal = 0;
 
         if( moInsets[i] )
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index d3a7c4b..92166c4 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -62,12 +62,29 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
                     OUString sXValue = rAttribs.getString( XML_x ).get();
                     OUString sYValue = rAttribs.getString( XML_y ).get();
                     if( !sXValue.isEmpty() )
-                        mrShape.getTextBody()->getTextProperties().moTextOffX = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
+                        mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
                     if( !sYValue.isEmpty() )
-                        mrShape.getTextBody()->getTextProperties().moTextOffY = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
+                        mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
                 }
                 break;
             case A_TOKEN( ext ):
+                {
+                    const OUString sXValue = rAttribs.getString( XML_cx ).get();
+                    const OUString sYValue = rAttribs.getString( XML_cy ).get();
+                    if( !sXValue.isEmpty() )
+                    {
+                        mrShape.getTextBody()->getTextProperties().moTextOffRight = GetCoordinate(mrShape.getSize().Width - sXValue.toInt32());
+                        if( mrShape.getTextBody()->getTextProperties().moTextOffLeft )
+                           *mrShape.getTextBody()->getTextProperties().moTextOffRight -=  *mrShape.getTextBody()->getTextProperties().moTextOffLeft;
+                    }
+                    if( !sYValue.isEmpty() )
+                    {
+                        mrShape.getTextBody()->getTextProperties().moTextOffLower = GetCoordinate(mrShape.getSize().Height - sYValue.toInt32());
+                        if( mrShape.getTextBody()->getTextProperties().moTextOffUpper )
+                           *mrShape.getTextBody()->getTextProperties().moTextOffLower -=  *mrShape.getTextBody()->getTextProperties().moTextOffUpper;
+
+                    }
+                }
                 break;
         }
         return 0;
diff --git a/sd/qa/unit/data/pptx/bnc870237.pptx b/sd/qa/unit/data/pptx/bnc870237.pptx
new file mode 100644
index 0000000..245ef51
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc870237.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 7fddb39..8e81c7d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -54,6 +54,7 @@ public:
     void testFdo71075();
     void testN828390();
     void testFdo71961();
+    void testBnc870237();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -65,6 +66,7 @@ public:
     CPPUNIT_TEST(testFdo71075);
     CPPUNIT_TEST(testN828390);
     CPPUNIT_TEST(testFdo71961);
+    CPPUNIT_TEST(testBnc870237);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -400,6 +402,26 @@ void SdFiltersTest::testFdo71961()
     CPPUNIT_ASSERT_EQUAL( true, (static_cast<const SdrTextWordWrapItem&>(pTxtObj->GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue());
 }
 
+void SdFiltersTest::testBnc870237()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870237.pptx"));
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage (1);
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+    // Simulate a:ext inside dsp:txXfrm with changing the lower distance
+    const SdrObjGroup* pObj = dynamic_cast<SdrObjGroup*>( pPage->GetObj( 1 ) );
+    CPPUNIT_ASSERT_MESSAGE( "no object", pObj != NULL);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextUpperDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_UPPERDIST))).GetValue());
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(9919), (static_cast< const SdrTextLowerDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LOWERDIST))).GetValue());
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextRightDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_RIGHTDIST))).GetValue());
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0), (static_cast< const SdrTextLeftDistItem& >(pObj->GetMergedItem(SDRATTR_TEXT_LEFTDIST))).GetValue());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list