summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-29 11:44:14 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-01-29 15:21:00 +0100
commitac8aee92c797dd7353978f1e7aec7336b7cb726d (patch)
treed1982bb80e7ada217c9078df5dc8e1860f74914c /sw
parentxmloff: export Wrtier's RES_FILL_STYLE and RES_FILL_GRADIENT (diff)
downloadcore-ac8aee92c797dd7353978f1e7aec7336b7cb726d.tar.gz
core-ac8aee92c797dd7353978f1e7aec7336b7cb726d.zip
sw: import draw:fill-gradient-name for Writer textframes
Change-Id: I695cf16bc3b06823ae9e0546cb751e41eb201706
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unoframe.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d9031a40aded..2e02d0ba5470 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -236,11 +236,29 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
XFillGradientItem aFillGradient( static_cast <const :: XFillGradientItem & > ( rFromSet.Get ( RES_FILL_GRADIENT ) ) );
XFillGradientItem* pItem = &aFillGradient;
if (pFillGradient)
+ {
bRet &= ((SfxPoolItem*)pItem)->PutValue(*pFillGradient, MID_FILLGRADIENT);
+ // If gradient is set directly, we always generate an associated style name for it.
+ SdrModel* pModel = pDoc->GetDrawModel();
+ pItem = pItem->checkForUniqueItem( pModel );
+ }
if (pName)
+ {
bRet &= ((SfxPoolItem*)pItem)->PutValue(*pName, MID_NAME);
- SdrModel* pModel = pDoc->GetDrawModel();
- pItem = pItem->checkForUniqueItem( pModel );
+ // Look up the associated style name.
+ SfxItemPool& rPool = pDoc->GetDrawModel()->GetItemPool();
+ const sal_uInt32 nCount = rPool.GetItemCount2(XATTR_FILLGRADIENT);
+ const XFillGradientItem* pStyleItem;
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ pStyleItem = (XFillGradientItem*)rPool.GetItem2(XATTR_FILLGRADIENT, i);
+ if (pStyleItem && pStyleItem->GetName() == pItem->GetName())
+ {
+ pItem->SetGradientValue(pStyleItem->GetGradientValue());
+ break;
+ }
+ }
+ }
if (pItem)
{
rToSet.Put(*pItem);