summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/ww8/docxexport.cxx16
-rw-r--r--sw/source/filter/ww8/docxexport.hxx3
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx24
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx16
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx2
5 files changed, 42 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 2c04e3f82062..6382af4196c2 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1306,22 +1306,6 @@ bool DocxExport::isMirroredMargin()
return bMirroredMargins;
}
-boost::optional<SvxBrushItem> DocxExport::getBackground()
-{
- boost::optional<SvxBrushItem> oRet;
- const SwFrameFormat &rFormat = m_pDoc->GetPageDesc(0).GetMaster();
- SvxBrushItem aBrush(RES_BACKGROUND);
- SfxItemState eState = rFormat.GetBackgroundState(aBrush);
-
- if (SfxItemState::SET == eState)
- {
- // The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX
- if (aBrush.GetColor().GetColor() != COL_AUTO)
- oRet.reset(aBrush);
- }
- return oRet;
-}
-
void DocxExport::WriteMainText()
{
// setup the namespaces
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 124b62614179..42eaecab2c94 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -241,9 +241,6 @@ private:
/// Write word/embeddings/Worksheet[n].xlsx
void WriteEmbeddings();
- /// Get background color of the document, if there is one.
- boost::optional<SvxBrushItem> getBackground();
-
/// return true if Page Layout is set as Mirrored
bool isMirroredMargin();
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 29e4ae0436ad..4fed09fa55cd 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -386,6 +386,30 @@ void RtfExport::WriteMainText()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
+ if (boost::optional<SvxBrushItem> oBrush = getBackground())
+ {
+ Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_VIEWBKSP).WriteChar('1');
+ Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BACKGROUND);
+ Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP);
+ Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST);
+
+ std::vector< std::pair<OString, OString> > aProperties;
+ aProperties.push_back(std::make_pair<OString, OString>("shapeType", "1"));
+ aProperties.push_back(std::make_pair<OString, OString>("fillColor", OString::number(msfilter::util::BGRToRGB(oBrush->GetColor().GetColor()))));
+ for (size_t i = 0; i < aProperties.size(); ++i)
+ {
+ Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SP "{");
+ Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_SN " ");
+ Strm().WriteCharPtr(aProperties[i].first.getStr());
+ Strm().WriteCharPtr("}{" OOO_STRING_SVTOOLS_RTF_SV " ");
+ Strm().WriteCharPtr(aProperties[i].second.getStr());
+ Strm().WriteCharPtr("}}");
+ }
+ Strm().WriteChar('}'); // shpinst
+ Strm().WriteChar('}'); // shp
+ Strm().WriteChar('}'); // background
+ }
+
SwTableNode* pTableNode = m_pCurPam->GetNode().FindTableNode();
if (m_pWriter && m_pWriter->bWriteOnlyFirstTable
&& pTableNode != nullptr)
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 6503a6886ae0..92a2b41f9f8f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1520,6 +1520,22 @@ void WW8Export::AppendBookmark( const OUString& rName, bool bSkip )
m_pBkmks->Append( nSttCP, rName );
}
+boost::optional<SvxBrushItem> MSWordExportBase::getBackground()
+{
+ boost::optional<SvxBrushItem> oRet;
+ const SwFrameFormat &rFormat = m_pDoc->GetPageDesc(0).GetMaster();
+ SvxBrushItem aBrush(RES_BACKGROUND);
+ SfxItemState eState = rFormat.GetBackgroundState(aBrush);
+
+ if (SfxItemState::SET == eState)
+ {
+ // The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX
+ if (aBrush.GetColor().GetColor() != COL_AUTO)
+ oRet.reset(aBrush);
+ }
+ return oRet;
+}
+
// #i120928 collect all the graphics of bullets applied to paragraphs
int MSWordExportBase::CollectGrfsOfBullets()
{
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index e2ef06c19573..e10075b3c345 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -865,6 +865,8 @@ protected:
void SetCurPam(sal_uLong nStt, sal_uLong nEnd);
+ /// Get background color of the document, if there is one.
+ boost::optional<SvxBrushItem> getBackground();
/// Populates m_vecBulletPic with all the bullet graphics used by numberings.
int CollectGrfsOfBullets();
/// Write the numbering picture bullets.