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

Miklos Vajna vmiklos at collabora.co.uk
Wed Dec 31 07:45:05 PST 2014


 sw/source/filter/ww8/docxattributeoutput.cxx |   31 +--------------------------
 sw/source/filter/ww8/docxsdrexport.cxx       |   24 ++++++++++++++++++++
 sw/source/filter/ww8/docxsdrexport.hxx       |    2 +
 3 files changed, 28 insertions(+), 29 deletions(-)

New commits:
commit ebd41daacdb11d1b96a50d7230249c85408ae5b5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Dec 31 16:30:45 2014 +0100

    Add DocxSdrExport::writeBoxItemLine()
    
    On one hand, this reduces code duplication. OTOH, the
    DocxAttributeOutput::FlyFrameGraphic() version was a stub, so this
    improves DOCX export of image frames as well.
    
    Change-Id: I7cd5e5feb8f1e63d074f82263c3d71088c0be30f

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 87c193b..f44794a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4232,21 +4232,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
     const SvxBorderLine* pTop = rBoxItem.GetLine(BOX_LINE_TOP);
     const SvxBorderLine* pBottom = rBoxItem.GetLine(BOX_LINE_BOTTOM);
     if (pLeft || pRight || pTop || pBottom)
-    {
-        m_pSerializer->startElementNS( XML_a, XML_ln,
-                                       XML_w, "9525",
-                                       FSEND );
-        m_pSerializer->singleElementNS( XML_a, XML_noFill,
-                                        FSEND );
-        m_pSerializer->singleElementNS( XML_a, XML_miter,
-                                        XML_lim, "800000",
-                                        FSEND );
-        m_pSerializer->singleElementNS( XML_a, XML_headEnd,
-                                        FSEND );
-        m_pSerializer->singleElementNS( XML_a, XML_tailEnd,
-                                        FSEND );
-        m_pSerializer->endElementNS( XML_a, XML_ln );
-    }
+        m_rExport.SdrExporter().writeBoxItemLine(rBoxItem);
 
     m_rExport.SdrExporter().writeDMLEffectLst(*pFrmFmt);
 
@@ -7720,20 +7706,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
                             XML_dashstyle, "dash" );
                 }
                 else
-                {
-                    OString sWidth(OString::number(TwipsToEMU(fConverted)));
-                    m_pSerializer->startElementNS(XML_a, XML_ln,
-                            XML_w, sWidth.getStr(),
-                            FSEND);
-                    m_pSerializer->startElementNS(XML_a, XML_solidFill, FSEND);
-                    m_pSerializer->singleElementNS(XML_a, XML_srgbClr,
-                            XML_val, sColor,
-                            FSEND);
-                    m_pSerializer->endElementNS(XML_a, XML_solidFill);
-                    if( drawing::LineStyle_DASH == pTop->GetBorderLineStyle() ) // Line Style is Dash type
-                        m_pSerializer->singleElementNS(XML_a, XML_prstDash, XML_val, "dash", FSEND);
-                    m_pSerializer->endElementNS(XML_a, XML_ln);
-                }
+                    m_rExport.SdrExporter().writeBoxItemLine(rBox);
             }
         }
 
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index c796fc5..8a17fd1 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
 #include <com/sun/star/xml/sax/XSAXSerializable.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
@@ -1311,6 +1312,29 @@ void DocxSdrExport::writeOnlyTextOfFrame(sw::Frame* pParentFrame)
     m_pImpl->m_bFrameBtLr = false;
 }
 
+void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBoxItem)
+{
+    sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
+    const editeng::SvxBorderLine* pTop = rBoxItem.GetTop();
+    double fConverted(editeng::ConvertBorderWidthToWord(pTop->GetBorderLineStyle(), pTop->GetWidth()));
+    OString sWidth(OString::number(TwipsToEMU(fConverted)));
+    pFS->startElementNS(XML_a, XML_ln,
+                        XML_w, sWidth.getStr(),
+                        FSEND);
+
+    pFS->startElementNS(XML_a, XML_solidFill, FSEND);
+    OString sColor(msfilter::util::ConvertColor(pTop->GetColor()));
+    pFS->singleElementNS(XML_a, XML_srgbClr,
+                         XML_val, sColor,
+                         FSEND);
+    pFS->endElementNS(XML_a, XML_solidFill);
+
+    if (drawing::LineStyle_DASH == pTop->GetBorderLineStyle()) // Line Style is Dash type
+        pFS->singleElementNS(XML_a, XML_prstDash, XML_val, "dash", FSEND);
+
+    pFS->endElementNS(XML_a, XML_ln);
+}
+
 void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bool bTextBoxOnly)
 {
     bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 31ca965..fb25d38 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -104,6 +104,8 @@ public:
     bool isTextBox(const SwFrmFmt& rFrmFmt);
     /// Writes text from Textbox for <w:framePr>
     void writeOnlyTextOfFrame(sw::Frame* pParentFrame);
+    /// Writes the drawingML <a:ln> markup of a box item.
+    void writeBoxItemLine(const SvxBoxItem& rBoxItem);
 };
 
 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXSDREXPORT_HXX


More information about the Libreoffice-commits mailing list