summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-09-29 10:11:02 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-09-29 14:15:20 +0100
commitd3de12fcfc85feb36eda3b0495807ef11d8fe772 (patch)
treed1e966530c2e306d608becd3462b156931a483c4
parentbf7ddfdeb7a81c112c5c9c25c4819bc576e87859 (diff)
Resolves: fdo#81277 missing table cell background color in doc/html import
a regression from one of the DrawingLayer FillAttributes changes of... commit 7d9bb549d498d6beed2c4050c402d09643febdfa Author: Armin Le Grand <alg@apache.org> Date: Mon Jun 2 15:00:50 2014 +0000 Related: #i124638# Second step of DrawingLayer FillAttributes... for Writer objects, now added support for Paragraph and PageStyle (including Header and Footer) for direct attributes and style attributes commit 4a0b5e569d070c286daefb0fdfe45c0dd15d241c Author: Armin Le Grand <alg@apache.org> Date: Thu Apr 17 16:44:58 2014 +0000 i#124638 support for DrawingLayre FillStyle for GraphicFrames and ... ... EmbeddedObjectFrames in Writer commit 6e61ecd09679a66060f932835622821d39e92f01 Author: Armin Le Grand <alg@apache.org> Date: Wed Mar 19 16:17:02 2014 +0000 Merge back branch alg_writerframes to trunk all of which set all RES_FLYFRMFMT and RES_FRMFMT SwFmts to use the new fill attributes, but a) didn't change the aTableBoxSetRange for SwTableBoxFmt to include the XFILL attributes, so importing cell bgs from .doc got dropped b) didn't make any effort in the uno api for XCells to do the same sort of mapping that was done for XFrames its unclear to me if SwDrawFrmFmt is actually adapted or not, I've assumed that it is here Change-Id: I8d71def2aef6163099a16591f9e53ba2b430bd06
-rw-r--r--sw/inc/format.hxx1
-rw-r--r--sw/inc/frmfmt.hxx1
-rw-r--r--sw/inc/swtblfmt.hxx6
-rw-r--r--sw/qa/extras/ww8export/data/cell-bg-color.odtbin0 -> 10180 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx8
-rw-r--r--sw/source/core/attr/format.cxx20
-rw-r--r--sw/source/core/inc/frame.hxx1
-rw-r--r--sw/source/core/layout/atrfrm.cxx15
-rw-r--r--sw/source/core/layout/findfrm.cxx12
-rw-r--r--sw/source/core/layout/frmtool.cxx18
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/table/swtable.cxx15
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx16
13 files changed, 82 insertions, 33 deletions
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 9a52566a5769..1b6056981966 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -334,6 +334,7 @@ public:
//UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
+ virtual bool IsAdaptedToNewFillProperties() const;
};
inline void SwFmt::SetName( const sal_Char* pNewName,
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 0a2a2caa35ed..715f92a481ca 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -138,6 +138,7 @@ public:
//UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const SAL_OVERRIDE;
+ virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
};
// The FlyFrame-Format
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index 914e8c6c7838..142959e3cdf8 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -41,6 +41,8 @@ public:
TYPEINFO_OVERRIDE(); // Already in base class Content.
DECL_FIXEDMEMPOOL_NEWDEL(SwTableFmt)
+
+ virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
};
class SwTableLineFmt : public SwFrmFmt
@@ -61,6 +63,8 @@ public:
TYPEINFO_OVERRIDE(); // Already in base class Content.
DECL_FIXEDMEMPOOL_NEWDEL(SwTableLineFmt)
+
+ virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
};
class SW_DLLPUBLIC SwTableBoxFmt : public SwFrmFmt
@@ -84,6 +88,8 @@ public:
TYPEINFO_OVERRIDE(); // Already in base class Content.
DECL_FIXEDMEMPOOL_NEWDEL(SwTableBoxFmt)
+
+ virtual bool IsAdaptedToNewFillProperties() const SAL_OVERRIDE;
};
#endif
diff --git a/sw/qa/extras/ww8export/data/cell-bg-color.odt b/sw/qa/extras/ww8export/data/cell-bg-color.odt
new file mode 100644
index 000000000000..3565f40c210e
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/cell-bg-color.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 60f583b70bbe..87da930ca81a 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -372,6 +372,14 @@ DECLARE_WW8EXPORT_TEST(testRedlineExport3, "redline-export-3.odt")
CPPUNIT_ASSERT_EQUAL(false, hasProperty(getRun(getParagraph(2), 2), "RedlineType"));
}
+DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 6a34f60756d7..6d36e800beb8 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -27,6 +27,7 @@
#include <hints.hxx>
#include <paratr.hxx>
#include <swcache.hxx>
+#include <swtblfmt.hxx>
#include <svl/grabbagitem.hxx>
#include <com/sun/star/beans/PropertyValues.hpp>
@@ -390,9 +391,14 @@ bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
return true;
}
+bool SwFmt::IsAdaptedToNewFillProperties() const
+{
+ return false;
+}
+
const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const
{
- if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
+ if (RES_BACKGROUND == nWhich && IsAdaptedToNewFillProperties())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes or makeBackgroundBrushItem (simple fallback is in place and used)");
@@ -411,7 +417,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const
SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem ) const
{
- if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
+ if (RES_BACKGROUND == nWhich && IsAdaptedToNewFillProperties())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes or SwFmt::GetBackgroundStat (simple fallback is in place and used)");
@@ -446,7 +452,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S
SfxItemState SwFmt::GetBackgroundState(SvxBrushItem &rItem, bool bSrchInParent) const
{
- if (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
+ if (IsAdaptedToNewFillProperties())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();
@@ -483,7 +489,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
bool bRet = false;
//UUUU
- if(RES_BACKGROUND == rAttr.Which() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
+ if (RES_BACKGROUND == rAttr.Which() && IsAdaptedToNewFillProperties())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
@@ -584,8 +590,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet);
}
- //UUUU FlyFrame PageStyle
- if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
+ if (IsAdaptedToNewFillProperties())
{
const SfxPoolItem* pSource = 0;
@@ -818,8 +823,7 @@ void SwFmt::SetGrabBagItem(const uno::Any& rVal)
//UUUU
SvxBrushItem SwFmt::makeBackgroundBrushItem(bool bInP) const
{
- //UUUU FlyFrame PageStyle
- if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
+ if (IsAdaptedToNewFillProperties())
{
//UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 2f0a19c53b5b..48105d909cc7 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -895,6 +895,7 @@ public:
//UUUU
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
+ bool IsAdaptedToNewFillProperties() const;
public:
// if writer is NULL, dumps the layout structure as XML in layout.xml
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index d36d22ac1cce..1b11a2874195 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2423,6 +2423,11 @@ SwFrmFmt::SwFrmFmt(
{
}
+bool SwFrmFmt::IsAdaptedToNewFillProperties() const
+{
+ return true;
+}
+
void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
SwFmtHeader *pH = 0;
@@ -2438,7 +2443,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
RES_FOOTER, false, (const SfxPoolItem**)&pF );
//UUUU reset fill information
- if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
+ if (maFillAttributes.get() && IsAdaptedToNewFillProperties())
{
SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet());
bool bReset(false);
@@ -2457,7 +2462,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
else if(RES_FMT_CHG == nWhich)
{
//UUUU reset fill information on format change (e.g. style changed)
- if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
+ if (maFillAttributes.get() && IsAdaptedToNewFillProperties())
{
maFillAttributes.reset();
}
@@ -2978,7 +2983,7 @@ OUString SwFlyFrmFmt::GetObjDescription() const
bool SwFlyFrmFmt::IsBackgroundTransparent() const
{
//UUUU
- if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper())
+ if (IsAdaptedToNewFillProperties() && getSdrAllFillAttributesHelper())
{
return getSdrAllFillAttributesHelper()->isTransparent();
}
@@ -3021,7 +3026,7 @@ bool SwFlyFrmFmt::IsBackgroundTransparent() const
bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
{
//UUUU
- if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper())
+ if (IsAdaptedToNewFillProperties() && getSdrAllFillAttributesHelper())
{
return !getSdrAllFillAttributesHelper()->isUsed();
}
@@ -3252,7 +3257,7 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint,
//UUUU
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrmFmt::getSdrAllFillAttributesHelper() const
{
- if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
+ if (IsAdaptedToNewFillProperties())
{
// create FillAttributes on demand
if(!maFillAttributes.get())
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index b6c9b0018eed..9f30f8240a59 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -570,6 +570,18 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrm::getSdrAllFillAttri
}
}
+bool SwFrm::IsAdaptedToNewFillProperties() const
+{
+ if (IsCntntFrm())
+ {
+ return true;
+ }
+ else
+ {
+ return static_cast< const SwLayoutFrm* >(this)->GetFmt()->IsAdaptedToNewFillProperties();
+ }
+}
+
/*
* SwFrm::_FindNext(), _FindPrev(), InvalidateNextPos()
* _FindNextCnt() visits tables and sections and only returns SwCntntFrms.
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index a4efd89c7459..ceacf4a17121 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -207,17 +207,21 @@ SwFrmNotify::~SwFrmNotify()
if ( bPrtWidth || bPrtHeight )
{
//UUUU
- drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pFrm->getSdrAllFillAttributesHelper());
-
- if(aFillAttributes.get() && aFillAttributes->isUsed())
+ bool bUseNewFillProperties(false);
+ if (pFrm->IsAdaptedToNewFillProperties())
{
- //UUUU use SetCompletePaint if needed
- if(aFillAttributes->needCompleteRepaint())
+ drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pFrm->getSdrAllFillAttributesHelper());
+ if(aFillAttributes.get() && aFillAttributes->isUsed())
{
- pFrm->SetCompletePaint();
+ bUseNewFillProperties = true;
+ //UUUU use SetCompletePaint if needed
+ if(aFillAttributes->needCompleteRepaint())
+ {
+ pFrm->SetCompletePaint();
+ }
}
}
- else
+ if (!bUseNewFillProperties)
{
const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos();
if(GPOS_NONE != ePos && GPOS_TILED != ePos)
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a1a0d8d11b86..b3a538a6ee68 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4129,7 +4129,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(GetFmt());
- if(pSwFrmFmt && (RES_FLYFRMFMT == pSwFrmFmt->Which() || RES_FRMFMT == pSwFrmFmt->Which()))
+ if (pSwFrmFmt && pSwFrmFmt->IsAdaptedToNewFillProperties())
{
//UUUU check for transparency
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrmFmt->getSdrAllFillAttributesHelper());
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index d45402cbe1c2..e6c597b99074 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2353,6 +2353,21 @@ void SwTableBoxFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
SwFrmFmt::Modify( pOld, pNew );
}
+bool SwTableBoxFmt::IsAdaptedToNewFillProperties() const
+{
+ return false;
+}
+
+bool SwTableFmt::IsAdaptedToNewFillProperties() const
+{
+ return false;
+}
+
+bool SwTableLineFmt::IsAdaptedToNewFillProperties() const
+{
+ return false;
+}
+
bool SwTableBox::HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex,
bool& rIsEmptyTxtNd ) const
{
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 678c65f0fb20..0f999251dad6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -850,21 +850,13 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
if (SfxItemState::SET != aSet.GetItemState(RES_SURROUND))
aSet.Put(SwFmtSurround(SURROUND_NONE));
- const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rFrmFmt.GetAttrSet().GetItem(XATTR_FILLSTYLE)));
- if (pXFillStyleItem)
+ // Construct an SvxBrushItem, as expected by the exporters.
+ if (rFrmFmt.IsAdaptedToNewFillProperties())
{
- switch (pXFillStyleItem->GetValue())
+ const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rFrmFmt.GetAttrSet().GetItem(XATTR_FILLSTYLE)));
+ if (pXFillStyleItem)
{
- case drawing::FillStyle_NONE:
- break;
- case drawing::FillStyle_SOLID:
- {
- // Construct an SvxBrushItem, as expected by the exporters.
aSet.Put(getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet(), RES_BACKGROUND));
- break;
- }
- default:
- break;
}
}