summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-31 11:51:24 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-31 12:16:49 +0200
commite826950e9d7736a6e3f9042755ba1b528f58a505 (patch)
tree782a6d3c085305f9cad6772cd0ca829a8db93c59 /sw
parent0015c9807f85fd8095e5f8e922b08f98ba5a9d6c (diff)
sw: still use SvxBrushItem for page style background
Commit 6e61ecd09679a66060f932835622821d39e92f01 (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
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/complex/checkColor/CheckChangeColor.java3
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx3
-rw-r--r--sw/source/core/unocore/unostyle.cxx42
3 files changed, 25 insertions, 23 deletions
diff --git a/sw/qa/complex/checkColor/CheckChangeColor.java b/sw/qa/complex/checkColor/CheckChangeColor.java
index 017ecc384fa6..9324e35fa8fd 100644
--- a/sw/qa/complex/checkColor/CheckChangeColor.java
+++ b/sw/qa/complex/checkColor/CheckChangeColor.java
@@ -59,7 +59,6 @@ public class CheckChangeColor {
// create a PropertySet to set the properties for the new Pagestyle
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
- /* FIXME port to FillAttributes
assertEquals(
"BackColor", new Any(Type.LONG, 0xFFFFFFFF),
Any.complete(xPropertySet.getPropertyValue("BackColor")));
@@ -77,7 +76,7 @@ public class CheckChangeColor {
Any.complete(xPropertySet.getPropertyValue("BackColor")));
assertEquals(
"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 {
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bd8828f3acb8..cb19476e9d64 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1096,15 +1096,12 @@ DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf")
getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
}
-#if 0
-// FIXME port to FillAttributes
DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
{
// The problem was that \background was ignored.
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
}
-#endif
DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
{
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 462541657c63..982b612066b9 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1745,19 +1745,22 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case RES_BACKGROUND:
{
- //UUUU
- SfxItemSet& rStyleSet = rBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
- SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
+ if (SFX_STYLE_FAMILY_FRAME == eFamily)
+ {
+ //UUUU
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet));
+ SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
- aChangedBrushItem.PutValue(aValue, nMemberId);
+ aChangedBrushItem.PutValue(aValue, nMemberId);
- if(!(aChangedBrushItem == aOriginalBrushItem))
- {
- setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
- }
+ if(!(aChangedBrushItem == aOriginalBrushItem))
+ {
+ setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
+ }
- bDone = true;
+ bDone = true;
+ }
break;
}
case OWN_ATTR_FILLBMP_MODE:
@@ -2499,16 +2502,19 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
}
case RES_BACKGROUND:
{
- //UUUU
- const SfxItemSet& rSet = rBase.GetItemSet();
- const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet));
-
- if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
+ if (SFX_STYLE_FAMILY_FRAME == eFamily)
{
- 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;
}
case OWN_ATTR_FILLBMP_MODE: