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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 19 07:09:57 UTC 2019


 sw/source/filter/ww8/docxattributeoutput.cxx |    4 -
 sw/source/filter/ww8/docxsdrexport.cxx       |   67 ---------------------------
 sw/source/filter/ww8/docxsdrexport.hxx       |    2 
 3 files changed, 2 insertions(+), 71 deletions(-)

New commits:
commit ab0df471915c5d54e8a3e8556de12afdfa541b3c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 18 21:27:51 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 19 09:09:17 2019 +0200

    sw btlr writing mode: remove not needed checkFrameBtlr() in the DOCX export
    
    Now that the DOCX import doesn't create this and instead uses the proper
    writing mode (neither VML nor drawingmL).
    
    Change-Id: I560c710866de8fb2f90d681e8cfc2d82afb1a327
    Reviewed-on: https://gerrit.libreoffice.org/75930
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1410fe3308cb..d53d51d5d51f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7055,8 +7055,8 @@ void DocxAttributeOutput::CharIdctHint( const SfxPoolItem& )
 
 void DocxAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate)
 {
-    // Not rotated or we the rotation already handled?
-    if ( !rRotate.GetValue() || m_rExport.SdrExporter().getFrameBtLr())
+    // Not rotated?
+    if ( !rRotate.GetValue())
         return;
 
     AddToAttrList( m_pEastAsianLayoutAttrList, FSNS( XML_w, XML_vert ), "true" );
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 725ceaaa7cd9..8b6fa63342c2 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -138,7 +138,6 @@ private:
     rtl::Reference<sax_fastparser::FastAttributeList> m_pFlyAttrList;
     rtl::Reference<sax_fastparser::FastAttributeList> m_pTextboxAttrList;
     OStringBuffer m_aTextFrameStyle;
-    bool m_bFrameBtLr;
     bool m_bDrawingOpen;
     bool m_bParagraphSdtOpen;
     bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph.
@@ -161,7 +160,6 @@ public:
         , m_pFlyFrameSize(nullptr)
         , m_bTextFrameSyntax(false)
         , m_bDMLTextFrameSyntax(false)
-        , m_bFrameBtLr(false)
         , m_bDrawingOpen(false)
         , m_bParagraphSdtOpen(false)
         , m_bParagraphHasDrawing(false)
@@ -177,8 +175,6 @@ public:
 
     void textFrameShadow(const SwFrameFormat& rFrameFormat);
     static bool isSupportedDMLShape(const uno::Reference<drawing::XShape>& xShape);
-    /// Undo the text direction mangling done by the frame btLr handler in writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup()
-    bool checkFrameBtlr(SwNode* pStartNode, bool bDML);
 
     void setSerializer(const sax_fastparser::FSHelperPtr& pSerializer)
     {
@@ -222,10 +218,6 @@ public:
 
     OStringBuffer& getTextFrameStyle() { return m_aTextFrameStyle; }
 
-    void setFrameBtLr(bool bFrameBtLr) { m_bFrameBtLr = bFrameBtLr; }
-
-    bool getFrameBtLr() { return m_bFrameBtLr; }
-
     void setDrawingOpen(bool bDrawingOpen) { m_bDrawingOpen = bDrawingOpen; }
 
     bool getDrawingOpen() { return m_bDrawingOpen; }
@@ -319,8 +311,6 @@ rtl::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getTextboxAttr
 
 OStringBuffer& DocxSdrExport::getTextFrameStyle() { return m_pImpl->getTextFrameStyle(); }
 
-bool DocxSdrExport::getFrameBtLr() { return m_pImpl->getFrameBtLr(); }
-
 bool DocxSdrExport::IsDrawingOpen() { return m_pImpl->getDrawingOpen(); }
 
 void DocxSdrExport::setParagraphSdtOpen(bool bParagraphSdtOpen)
@@ -1128,7 +1118,6 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
     m_pImpl->setFlyFrameGraphic(true);
     m_pImpl->getExport().WriteText();
     m_pImpl->setFlyFrameGraphic(false);
-    m_pImpl->setFrameBtLr(false);
 }
 
 void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
@@ -1379,8 +1368,6 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
         if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
             m_pImpl->getBodyPrAttrList()->add(XML_vert, "vert");
 
-        m_pImpl->setFrameBtLr(
-            m_pImpl->checkFrameBtlr(m_pImpl->getExport().m_pDoc->GetNodes()[nStt], /*bDML=*/true));
         m_pImpl->setFlyFrameGraphic(true);
         m_pImpl->getExport().WriteText();
         if (m_pImpl->getParagraphSdtOpen())
@@ -1389,7 +1376,6 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
             m_pImpl->setParagraphSdtOpen(false);
         }
         m_pImpl->setFlyFrameGraphic(false);
-        m_pImpl->setFrameBtLr(false);
 
         pFS->endElementNS(XML_w, XML_txbxContent);
         pFS->endElementNS(XML_wps, XML_txbx);
@@ -1499,8 +1485,6 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
     }
     sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->getFlyAttrList().get());
     m_pImpl->getFlyAttrList().clear();
-    m_pImpl->setFrameBtLr(
-        m_pImpl->checkFrameBtlr(m_pImpl->getExport().m_pDoc->GetNodes()[nStt], /*bDML=*/false));
     sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->getTextboxAttrList().get());
     m_pImpl->getTextboxAttrList().clear();
     m_pImpl->setTextFrameSyntax(false);
@@ -1552,61 +1536,10 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
         pFS->endElementNS(XML_v, XML_rect);
         pFS->endElementNS(XML_w, XML_pict);
     }
-    m_pImpl->setFrameBtLr(false);
 
     m_pImpl->setDMLAndVMLDrawingOpen(bDMLAndVMLDrawingOpen);
 }
 
-bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
-{
-    // The intended usage is to pass either a valid VML or DML attribute list.
-    if (bDML)
-        assert(m_pBodyPrAttrList);
-    else
-        assert(m_pTextboxAttrList.is());
-
-    if (!pStartNode->IsTextNode())
-        return false;
-
-    SwTextNode* pTextNode = pStartNode->GetTextNode();
-
-    const SfxPoolItem* pItem = nullptr; // explicitly init to avoid warnings
-    bool bItemSet = false;
-    if (pTextNode->HasSwAttrSet())
-    {
-        const SwAttrSet& rAttrSet = pTextNode->GetSwAttrSet();
-        bItemSet = rAttrSet.GetItemState(RES_CHRATR_ROTATE, true, &pItem) == SfxItemState::SET;
-    }
-
-    if (!bItemSet)
-    {
-        if (!pTextNode->HasHints())
-            return false;
-
-        SwTextAttr* pTextAttr = pTextNode->GetTextAttrAt(0, RES_TXTATR_AUTOFMT);
-
-        if (!pTextAttr || pTextAttr->Which() != RES_TXTATR_AUTOFMT)
-            return false;
-
-        std::shared_ptr<SfxItemSet> pItemSet = pTextAttr->GetAutoFormat().GetStyleHandle();
-        bItemSet = pItemSet->GetItemState(RES_CHRATR_ROTATE, true, &pItem) == SfxItemState::SET;
-    }
-
-    if (bItemSet)
-    {
-        auto& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
-        if (rCharRotate.GetValue() == 900)
-        {
-            if (bDML)
-                m_pBodyPrAttrList->add(XML_vert, "vert270");
-            else
-                m_pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
-            return true;
-        }
-    }
-    return false;
-}
-
 bool DocxSdrExport::isTextBox(const SwFrameFormat& rFrameFormat)
 {
     return SwTextBoxHelper::isTextBox(&rFrameFormat, RES_FLYFRMFMT);
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 613978761706..2f7d57c2017d 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -67,8 +67,6 @@ public:
     /// Attributes of the next v:textbox element.
     rtl::Reference<sax_fastparser::FastAttributeList>& getTextboxAttrList();
     OStringBuffer& getTextFrameStyle();
-    /// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation.
-    bool getFrameBtLr();
 
     /// Set if paragraph sdt open in the current drawing.
     void setParagraphSdtOpen(bool bParagraphSdtOpen);


More information about the Libreoffice-commits mailing list