DOCX: don't export auto color as page background

That auto here would mean black, potentially rendering the whole
document unreadable.

Change-Id: Ie17a6a9b00c9ab24204291d09175a3fba69cd4ea
This commit is contained in:
Miklos Vajna
2013-06-12 15:13:32 +02:00
parent 348c7ca4b7
commit 837ccd73e2
3 changed files with 13 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ public:
void testI120928();
void testFdo64826();
void testPageBackground();
void testPageGraphicBackground();
void testFdo65265();
void testFdo65655();
@@ -123,6 +124,7 @@ void Test::run()
{"i120928.docx", &Test::testI120928},
{"fdo64826.docx", &Test::testFdo64826},
{"page-background.docx", &Test::testPageBackground},
{"page-graphic-background.odt", &Test::testPageGraphicBackground},
{"fdo65265.docx", &Test::testFdo65265},
{"fdo65655.docx", &Test::testFdo65655},
};
@@ -692,6 +694,15 @@ void Test::testPageBackground()
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
}
void Test::testPageGraphicBackground()
{
// No idea how the graphic background should be exported (seems there is no
// way to do a non-tiling export to OOXML), but at least the background
// color shouldn't be black.
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xPageStyle, "BackColor"));
}
void Test::testFdo65265()
{
// Redline (tracked changes) of text formatting were not exported

View File

@@ -746,7 +746,8 @@ boost::optional<const SvxBrushItem*> DocxExport::getBackground()
{
// The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX
const SvxBrushItem* pBrush = (const SvxBrushItem*)pItem;
oRet.reset(pBrush);
if (pBrush->GetColor().GetColor() != COL_AUTO)
oRet.reset(pBrush);
}
return oRet;
}