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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 5 07:04:54 UTC 2019


 oox/source/vml/vmlshape.cxx                       |   29 +++-------------------
 sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx         |   11 ++++++++
 writerfilter/source/dmapper/DomainMapper.cxx      |    3 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 ---------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    1 
 6 files changed, 17 insertions(+), 40 deletions(-)

New commits:
commit bffe6a496fb1c69499770d96fefd7a3609712676
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 4 21:37:14 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 5 09:04:03 2019 +0200

    sw btlr writing mode: handle import from VML
    
    Instead of the character-level rotation added in commit
    8738ded7bb1bb6262fe1038e310b5110407f4cfa (fdo#69636 VML import: handle
    mso-layout-flow-alt shape prop for sw frames, 2013-09-26) which does not
    work for multiple paragraphs.
    
    Change-Id: Ibe9a85d7f880846edfd1f4594c03b0617d83a965
    Reviewed-on: https://gerrit.libreoffice.org/75104
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a7529493e401..eca5399bf72c 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -728,33 +728,14 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
             PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, makeAny( sal_Int32( getTextBox()->borderDistanceBottom )));
         }
 
-        if (getTextBox()->maLayoutFlow == "vertical" && maTypeModel.maLayoutFlowAlt.isEmpty())
+        if (getTextBox()->maLayoutFlow == "vertical")
         {
-            PropertySet(xShape).setAnyProperty(PROP_WritingMode,
-                                               uno::makeAny(text::WritingMode2::TB_RL));
-        }
-
-        if (!maTypeModel.maLayoutFlowAlt.isEmpty())
-        {
-            // Can't handle this property here, as the frame is not attached yet: pass it to writerfilter.
-            uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
-            uno::Sequence<beans::PropertyValue> aGrabBag;
-            xPropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
-            beans::PropertyValue aPair;
-            aPair.Name = "mso-layout-flow-alt";
-            aPair.Value <<= maTypeModel.maLayoutFlowAlt;
-            if (aGrabBag.hasElements())
-            {
-                sal_Int32 nLength = aGrabBag.getLength();
-                aGrabBag.realloc(nLength + 1);
-                aGrabBag[nLength] = aPair;
-            }
-            else
+            sal_Int16 nWritingMode = text::WritingMode2::TB_RL;
+            if (maTypeModel.maLayoutFlowAlt == "bottom-to-top")
             {
-                aGrabBag.realloc(1);
-                aGrabBag[0] = aPair;
+                nWritingMode = text::WritingMode2::BT_LR;
             }
-            xPropertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(aGrabBag));
+            PropertySet(xShape).setAnyProperty(PROP_WritingMode, uno::makeAny(nWritingMode));
         }
     }
     else
diff --git a/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx
new file mode 100644
index 000000000000..a93703c75526
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/btlr-frame-vml.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index b447c3f7273f..65750d5952f9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -233,6 +233,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
 // and as result only one page should be generated.
 DECLARE_OOXMLIMPORT_TEST(testTdf113182, "tdf113182.docx") { CPPUNIT_ASSERT_EQUAL(1, getPages()); }
 
+DECLARE_OOXMLIMPORT_TEST(testBtlrFrameVml, "btlr-frame-vml.docx")
+{
+    uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xTextFrame.is());
+
+    auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode");
+    // Without the accompanying fix in place, this test would have failed with 'Expected: 5; Actual:
+    // 4', i.e. writing direction was inherited from page, instead of explicit btlr.
+    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nActual);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf124398, "tdf124398.docx")
 {
     uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 54e4a7bdd7a1..1b24e0624dc8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3052,9 +3052,6 @@ void DomainMapper::PopListProperties()
 void DomainMapper::lcl_startCharacterGroup()
 {
     m_pImpl->PushProperties(CONTEXT_CHARACTER);
-    if (m_pImpl->m_bFrameBtLr)
-        // No support for this in core, work around by char rotation, as we do so for table cells already.
-        m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION, uno::makeAny(sal_Int16(900)));
     if (m_pImpl->isSdtEndDeferred())
     {
         // Fields have an empty character group before the real one, so don't
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 21d6e65d1af3..28b4fb20183d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -250,7 +250,6 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIgnoreNextPara(false),
         m_bCheckFirstFootnoteTab(false),
         m_bIgnoreNextTab(false),
-        m_bFrameBtLr(false),
         m_bIsSplitPara(false),
         m_vTextFramesForChaining(),
         m_bParaHadField(false),
@@ -2354,15 +2353,9 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
                 uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
                 uno::Sequence<beans::PropertyValue> aGrabBag;
                 xShapePropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
-                bool checkBtLrStatus = false;
 
                 for (const auto& rProp : aGrabBag)
                 {
-                    if (rProp.Name == "mso-layout-flow-alt")
-                    {
-                        m_bFrameBtLr = rProp.Value.get<OUString>() == "bottom-to-top";
-                        checkBtLrStatus = true;
-                    }
                     if (rProp.Name == "VML-Z-ORDER")
                     {
                         GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper();
@@ -2373,10 +2366,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
                         xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::makeAny( zOrder >= 0 ) );
                         checkZOrderStatus = true;
                     }
-                    if(checkBtLrStatus && checkZOrderStatus)
-                        break;
-
-                    if ( rProp.Name == "TxbxHasLink" )
+                    else if ( rProp.Name == "TxbxHasLink" )
                     {
                         //Chaining of textboxes will happen in ~DomainMapper_Impl
                         //i.e when all the textboxes are read and all its attributes
@@ -2534,7 +2524,6 @@ void DomainMapper_Impl::PopShapeContext()
 
         m_aAnchoredStack.pop();
     }
-    m_bFrameBtLr = false;
 }
 
 bool DomainMapper_Impl::IsSdtEndBefore()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 793631530d66..09b35a360008 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -953,7 +953,6 @@ public:
     /// If the next tab should be ignored, used for footnotes.
     bool m_bCheckFirstFootnoteTab;
     bool m_bIgnoreNextTab;
-    bool m_bFrameBtLr; ///< Bottom to top, left to right text frame direction is requested for the current text frame.
     /// Pending floating tables: they may be converted to text frames at the section end.
     std::vector<FloatingTableInfo> m_aPendingFloatingTables;
 


More information about the Libreoffice-commits mailing list