Kaydet (Commit) e826950e authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: still use SvxBrushItem for page style background

Commit 6e61ecd0 (Merge back branch
alg_writerframes to trunk, 2014-03-19) changed the sw UNO API, so that
in case SvxBrushItem / RES_BACKGROUND was to be get/set, it mapped that
to svx's fill style.

This has two problems: 1) it does not work (see the failing unit test)
and also page style editing UI sets SvxBrushItem, so even if the UI is
used to (actually successfully) set the page background, it won't be
saved to ODF.

So, do this background <-> fill style mapping only for frames for now.

Change-Id: I734880a40c891ae9e341cbddf8f88b0462361aac
üst 0015c980
...@@ -59,7 +59,6 @@ public class CheckChangeColor { ...@@ -59,7 +59,6 @@ public class CheckChangeColor {
// create a PropertySet to set the properties for the new Pagestyle // create a PropertySet to set the properties for the new Pagestyle
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") ); XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
/* FIXME port to FillAttributes
assertEquals( assertEquals(
"BackColor", new Any(Type.LONG, 0xFFFFFFFF), "BackColor", new Any(Type.LONG, 0xFFFFFFFF),
Any.complete(xPropertySet.getPropertyValue("BackColor"))); Any.complete(xPropertySet.getPropertyValue("BackColor")));
...@@ -77,7 +76,7 @@ public class CheckChangeColor { ...@@ -77,7 +76,7 @@ public class CheckChangeColor {
Any.complete(xPropertySet.getPropertyValue("BackColor"))); Any.complete(xPropertySet.getPropertyValue("BackColor")));
assertEquals( assertEquals(
"IsLandscape", new Any(Type.BOOLEAN, true), "IsLandscape", new Any(Type.BOOLEAN, true),
Any.complete(xPropertySet.getPropertyValue("IsLandscape")));*/ Any.complete(xPropertySet.getPropertyValue("IsLandscape")));
} }
@Before public void setUpDocument() throws com.sun.star.uno.Exception { @Before public void setUpDocument() throws com.sun.star.uno.Exception {
......
...@@ -1096,15 +1096,12 @@ DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf") ...@@ -1096,15 +1096,12 @@ DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf")
getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8)); getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
} }
#if 0
// FIXME port to FillAttributes
DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf") DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
{ {
// The problem was that \background was ignored. // The problem was that \background was ignored.
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
} }
#endif
DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf") DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
{ {
......
...@@ -1745,19 +1745,22 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -1745,19 +1745,22 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
} }
case RES_BACKGROUND: case RES_BACKGROUND:
{ {
//UUUU if (SFX_STYLE_FAMILY_FRAME == eFamily)
SfxItemSet& rStyleSet = rBase.GetItemSet(); {
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet)); //UUUU
SvxBrushItem aChangedBrushItem(aOriginalBrushItem); SfxItemSet& rStyleSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId); aChangedBrushItem.PutValue(aValue, nMemberId);
if(!(aChangedBrushItem == aOriginalBrushItem)) if(!(aChangedBrushItem == aOriginalBrushItem))
{ {
setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
} }
bDone = true; bDone = true;
}
break; break;
} }
case OWN_ATTR_FILLBMP_MODE: case OWN_ATTR_FILLBMP_MODE:
...@@ -2499,16 +2502,19 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ...@@ -2499,16 +2502,19 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
} }
case RES_BACKGROUND: case RES_BACKGROUND:
{ {
//UUUU if (SFX_STYLE_FAMILY_FRAME == eFamily)
const SfxItemSet& rSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
{ {
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); //UUUU
} const SfxItemSet& rSet = rBase.GetItemSet();
const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
bDone = true; if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
{
OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
}
bDone = true;
}
break; break;
} }
case OWN_ATTR_FILLBMP_MODE: case OWN_ATTR_FILLBMP_MODE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment