diff options
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 38 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 5 |
2 files changed, 41 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 42e488e8663d..917ddb5a7896 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -70,6 +70,8 @@ #include <editeng/editobj.hxx> #include <svx/svdmodel.hxx> #include <svx/svdobj.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflgrit.hxx> #include <sfx2/sfxbasemodel.hxx> #include <anchoredobject.hxx> @@ -315,6 +317,12 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_pSerializer->startElementNS( XML_w, XML_pict, FSEND ); m_pSerializer->startElementNS( XML_v, XML_rect, xFlyAttrList ); lcl_TextFrameShadow(m_pSerializer, rFrmFmt); + if (m_pFlyFillAttrList) + { + XFastAttributeListRef xFlyFillAttrList(m_pFlyFillAttrList); + m_pFlyFillAttrList = NULL; + m_pSerializer->singleElementNS(XML_v, XML_fill, xFlyFillAttrList); + } m_pSerializer->startElementNS( XML_v, XML_textbox, FSEND ); m_pSerializer->startElementNS( XML_w, XML_txbxContent, FSEND ); m_rExport.WriteText( ); @@ -4547,12 +4555,37 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) } } -void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& /*rFillStyle*/ ) +void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& rFillStyle ) { + m_oFillStyle.reset(rFillStyle.GetValue()); } -void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& /*rFillGradient*/ ) +void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGradient ) { + if (*m_oFillStyle == XFILL_GRADIENT) + { + m_pFlyFillAttrList = m_pSerializer->createAttrList(); + m_pFlyFillAttrList->add(XML_type, "gradient"); + + const XGradient& rGradient = rFillGradient.GetGradientValue(); + OString sStartColor = impl_ConvertColor(rGradient.GetStartColor()); + m_pFlyFillAttrList->add(XML_color2, "#" + sStartColor); + OString sEndColor = impl_ConvertColor(rGradient.GetEndColor()); + m_pFlyAttrList->add(XML_fillcolor, "#" + sEndColor); + + switch (rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR: break; + case XGRAD_AXIAL: + m_pFlyFillAttrList->add(XML_focus, "50%"); + break; + case XGRAD_RADIAL: break; + case XGRAD_ELLIPTICAL: break; + case XGRAD_SQUARE: break; + case XGRAD_RECT: break; + } + } + m_oFillStyle.reset(); } void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) @@ -4743,6 +4776,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri m_pParagraphSpacingAttrList( NULL ), m_pHyperlinkAttrList( NULL ), m_pFlyAttrList( NULL ), + m_pFlyFillAttrList( NULL ), m_pFootnotesList( new ::docx::FootnotesList() ), m_pEndnotesList( new ::docx::FootnotesList() ), m_footnoteEndnoteRefTag( 0 ), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 6508d0b62747..ff35351d9987 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -28,11 +28,13 @@ #include <sax/fshelper.hxx> #include <sax/fastattribs.hxx> #include <vcl/vclenum.hxx> +#include <svx/xenum.hxx> #include <fldbas.hxx> #include <vector> #include <boost/scoped_ptr.hpp> +#include <boost/optional.hpp> #include <oox/export/vmlexport.hxx> class SwGrfNode; @@ -558,6 +560,7 @@ private: ::sax_fastparser::FastAttributeList *m_pParagraphSpacingAttrList; ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList; ::sax_fastparser::FastAttributeList *m_pFlyAttrList; + ::sax_fastparser::FastAttributeList *m_pFlyFillAttrList; ::docx::FootnotesList *m_pFootnotesList; ::docx::FootnotesList *m_pEndnotesList; @@ -630,6 +633,8 @@ private: // Remember first cell (used for for default borders/margins) of each table std::vector<ww8::WW8TableNodeInfoInner::Pointer_t> tableFirstCells; + boost::optional<XFillStyle> m_oFillStyle; + public: DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML ); |