diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-31 16:30:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-31 16:44:39 +0100 |
commit | ebd41daacdb11d1b96a50d7230249c85408ae5b5 (patch) | |
tree | c2180f3597a034216d4b6568b00a09aff60cbb1b | |
parent | 219f2dc83f40afb7470bffc307371925e8fae018 (diff) |
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
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 31 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.hxx | 2 |
3 files changed, 28 insertions, 29 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 87c193b7ada4..f44794a12d81 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 c796fc575a65..8a17fd144b74 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 31ca9654265b..fb25d380ce69 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 |