[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Wed Aug 20 06:07:06 PDT 2014
sw/inc/format.hxx | 6 +++-
sw/source/core/attr/format.cxx | 40 +++++++++++++++++++++++++-------
sw/source/core/docnode/ndtbl1.cxx | 12 ++++-----
sw/source/core/frmedt/fetab.cxx | 2 -
sw/source/core/layout/atrfrm.cxx | 17 ++++++++-----
sw/source/core/layout/pagedesc.cxx | 2 -
sw/source/core/layout/paintfrm.cxx | 6 ++--
sw/source/core/layout/tabfrm.cxx | 3 +-
sw/source/core/layout/wsfrm.cxx | 9 ++++---
sw/source/core/unocore/unotbl.cxx | 2 -
sw/source/filter/html/css1atr.cxx | 10 ++++----
sw/source/filter/html/htmlcss1.cxx | 4 +--
sw/source/filter/html/htmlflywriter.cxx | 6 ++--
sw/source/filter/html/htmlgrin.cxx | 2 -
sw/source/filter/html/htmltabw.cxx | 14 +++++------
sw/source/filter/html/swcss1.hxx | 2 -
sw/source/filter/ww8/docxexport.cxx | 21 ++++++++--------
sw/source/filter/ww8/docxexport.hxx | 2 -
sw/source/filter/ww8/wrtw8esh.cxx | 4 +--
sw/source/ui/dialog/uiregionsw.cxx | 5 ++--
sw/source/uibase/docvw/romenu.cxx | 21 ++++++++--------
sw/source/uibase/docvw/romenu.hxx | 6 ++--
22 files changed, 116 insertions(+), 80 deletions(-)
New commits:
commit 9acd707d738b99072cb3d7323e94ef96c1d64be5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Aug 20 13:56:35 2014 +0100
fix crashing on exit in static SvxBrushItem dtor
site of second ctor
Change-Id: Ic319bd36f207a0f1939482a7b4c729b519bb5ce1
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 8c3e69e..9a52566 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -98,6 +98,8 @@ public:
//UUUUinline
SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true,
const SfxPoolItem **ppItem = 0 ) const;
+ SfxItemState GetBackgroundState(SvxBrushItem &rItem,
+ bool bSrchInParent = true) const;
virtual bool SetFmtAttr( const SfxPoolItem& rAttr );
virtual bool SetFmtAttr( const SfxItemSet& rSet );
virtual bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 59ea2f3..180b19e 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -409,13 +409,12 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const
return aSet.Get( nWhich, bInParents );
}
-
SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem ) const
{
if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
{
//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)");
+ 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)");
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();
// check if the new fill attributes are used
@@ -424,6 +423,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S
// if yes, fill the local SvxBrushItem using the new fill attributes
// as good as possible to have an instance for the pointer to point
// to and return as state that it is set
+
static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent);
@@ -444,6 +444,33 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S
return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
}
+SfxItemState SwFmt::GetBackgroundState(SvxBrushItem &rItem, bool bSrchInParent) const
+{
+ if (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
+ {
+ //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+ const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();
+
+ // check if the new fill attributes are used
+ if(aFill.get() && aFill->isUsed())
+ {
+ // if yes, fill the local SvxBrushItem using the new fill attributes
+ // as good as possible to have an instance for the pointer to point
+ // to and return as state that it is set
+ rItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent);
+ return SFX_ITEM_SET;
+ }
+
+ // if not return SFX_ITEM_DEFAULT to signal that the item is not set
+ return SFX_ITEM_DEFAULT;
+ }
+
+ const SfxPoolItem* pItem = 0;
+ SfxItemState eRet = aSet.GetItemState(RES_BACKGROUND, bSrchInParent, &pItem);
+ if (pItem)
+ rItem = *(const SvxBrushItem*)pItem;
+ return eRet;
+}
bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
{
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 7f8ef58..065368d 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -821,7 +821,7 @@ void DocxExport::WriteSettings()
}
// Display Background Shape
- if (boost::optional<const SvxBrushItem*> oBrush = getBackground())
+ if (boost::optional<SvxBrushItem> oBrush = getBackground())
{
// Turn on the 'displayBackgroundShape'
pFS->singleElementNS( XML_w, XML_displayBackgroundShape, FSEND );
@@ -1280,19 +1280,18 @@ bool DocxExport::isMirroredMargin()
return bMirroredMargins;
}
-boost::optional<const SvxBrushItem*> DocxExport::getBackground()
+boost::optional<SvxBrushItem> DocxExport::getBackground()
{
- boost::optional<const SvxBrushItem*> oRet;
+ boost::optional<SvxBrushItem> oRet;
const SwFrmFmt &rFmt = pDoc->GetPageDesc(0).GetMaster();
- const SfxPoolItem* pItem = 0;
- SfxItemState eState = rFmt.GetItemState(RES_BACKGROUND, true, &pItem);
+ SvxBrushItem aBrush(RES_BACKGROUND);
+ SfxItemState eState = rFmt.GetBackgroundState(aBrush);
- if (SFX_ITEM_SET == eState && pItem)
+ if (SFX_ITEM_SET == eState)
{
// 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;
- if (pBrush->GetColor().GetColor() != COL_AUTO)
- oRet.reset(pBrush);
+ if (aBrush.GetColor().GetColor() != COL_AUTO)
+ oRet.reset(aBrush);
}
return oRet;
}
@@ -1303,9 +1302,9 @@ void DocxExport::WriteMainText()
m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces( m_pDocumentFS ));
// Write background page color
- if (boost::optional<const SvxBrushItem*> oBrush = getBackground())
+ if (boost::optional<SvxBrushItem> oBrush = getBackground())
{
- Color backgroundColor = (*oBrush)->GetColor();
+ Color backgroundColor = oBrush->GetColor();
OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor);
m_pDocumentFS->singleElementNS( XML_w, XML_background, FSNS( XML_w, XML_color ), aBackgroundColorStr, FSEND );
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 3cda882..3c4e708 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -252,7 +252,7 @@ private:
void WriteEmbeddings();
/// Get background color of the document, if there is one.
- boost::optional<const SvxBrushItem*> getBackground();
+ boost::optional<SvxBrushItem> getBackground();
/// return true if Page Layout is set as Mirrored
bool isMirroredMargin();
commit df4bd415c0ceb8e69f8bbeeca554a1c55eb978b7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Aug 20 12:03:21 2014 +0100
fix crashing on exit in static SvxBrushItem dtor
site of first ctor
Change-Id: I3316e91bc54439b74df30fdf02ff264a39489c29
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 191a755..8c3e69e 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -244,8 +244,8 @@ public:
inline const SvxBoxItem &GetBox( bool = true ) const;
inline const SvxFmtKeepItem &GetKeep( bool = true ) const;
- //UUUU Get SvxBrushItem for Background fill (partially for backwards compatibility)
- const SvxBrushItem& GetBackground( bool = true ) const;
+ //UUUU Create SvxBrushItem for Background fill (partially for backwards compatibility)
+ SvxBrushItem makeBackgroundBrushItem( bool = true ) const;
inline const SvxShadowItem &GetShadow( bool = true ) const;
inline const SwFmtPageDesc &GetPageDesc( bool = true ) const;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 3469ed2..59ea2f3 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -395,7 +395,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const
if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()))
{
//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)");
+ 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)");
static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
// fill the local static SvxBrushItem from the current ItemSet so that
@@ -789,21 +789,18 @@ void SwFmt::SetGrabBagItem(const uno::Any& rVal)
}
//UUUU
-const SvxBrushItem& SwFmt::GetBackground(bool bInP) const
+SvxBrushItem SwFmt::makeBackgroundBrushItem(bool bInP) const
{
//UUUU FlyFrame PageStyle
if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())
{
//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)");
- static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
// fill the local static SvxBrushItem from the current ItemSet so that
// the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
// as good as possible to create a fallback representation and return that
- aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP);
-
- return aSvxBrushItem;
+ return getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP);
}
return aSet.GetBackground(bInP);
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index e6c94a0..dee8291 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -495,11 +495,11 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) c
if( !aRowArr.empty() )
{
- rToFill = aRowArr[0]->GetFrmFmt()->GetBackground();
+ rToFill = aRowArr[0]->GetFrmFmt()->makeBackgroundBrushItem();
bRet = true;
for ( sal_uInt16 i = 1; i < aRowArr.size(); ++i )
- if ( rToFill != aRowArr[i]->GetFrmFmt()->GetBackground() )
+ if ( rToFill != aRowArr[i]->GetFrmFmt()->makeBackgroundBrushItem() )
{
bRet = false;
break;
@@ -1190,14 +1190,14 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const
{
case RES_BACKGROUND:
{
- const SvxBrushItem &rBack =
- aBoxes[i]->GetFrmFmt()->GetBackground();
+ SvxBrushItem aBack =
+ aBoxes[i]->GetFrmFmt()->makeBackgroundBrushItem();
if( !bOneFound )
{
- (SvxBrushItem&)rToFill = rBack;
+ (SvxBrushItem&)rToFill = aBack;
bOneFound = true;
}
- else if( rToFill != rBack )
+ else if( rToFill != aBack )
bRet = false;
}
break;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index e767b19..faea082 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -849,7 +849,7 @@ void SwFEShell::GetTabBackground( SvxBrushItem &rToFill ) const
{
SwFrm *pFrm = GetCurrFrm();
if( pFrm && pFrm->IsInTab() )
- rToFill = pFrm->ImplFindTabFrm()->GetFmt()->GetBackground();
+ rToFill = pFrm->ImplFindTabFrm()->GetFmt()->makeBackgroundBrushItem();
}
bool SwFEShell::HasWholeTabSelection() const
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index b362180c..328d4f1 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2986,8 +2986,9 @@ bool SwFlyFrmFmt::IsBackgroundTransparent() const
// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
// and there is no background graphic, it "inherites" the background
// from its anchor.
- if ( (GetBackground().GetColor().GetTransparency() != 0) &&
- (GetBackground().GetColor() != COL_TRANSPARENT)
+ SvxBrushItem aBackground(makeBackgroundBrushItem());
+ if ( (aBackground.GetColor().GetTransparency() != 0) &&
+ (aBackground.GetColor() != COL_TRANSPARENT)
)
{
return true;
@@ -2995,7 +2996,7 @@ bool SwFlyFrmFmt::IsBackgroundTransparent() const
else
{
const GraphicObject *pTmpGrf =
- static_cast<const GraphicObject*>(GetBackground().GetGraphicObject());
+ static_cast<const GraphicObject*>(aBackground.GetGraphicObject());
if ( (pTmpGrf) &&
(pTmpGrf->GetAttr().GetTransparency() != 0)
)
@@ -3024,10 +3025,14 @@ bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
{
return !getSdrAllFillAttributesHelper()->isUsed();
}
- else if ( (GetBackground().GetColor() == COL_TRANSPARENT) &&
- !(GetBackground().GetGraphicObject()) )
+ else
{
- return true;
+ SvxBrushItem aBackground(makeBackgroundBrushItem());
+ if ( (aBackground.GetColor() == COL_TRANSPARENT) &&
+ !(aBackground.GetGraphicObject()) )
+ {
+ return true;
+ }
}
return false;
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 9f0a359..d041840 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -117,7 +117,7 @@ void SwPageDesc::Mirror()
aSet.Put( aMaster.GetPaperBin() );
aSet.Put( aMaster.GetULSpace() );
aSet.Put( aMaster.GetBox() );
- aSet.Put( aMaster.GetBackground() );
+ aSet.Put( aMaster.makeBackgroundBrushItem() );
aSet.Put( aMaster.GetShadow() );
aSet.Put( aMaster.GetCol() );
aSet.Put( aMaster.GetFrmDir() ); // #112217#
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ffbaaab..971b97f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4143,13 +4143,13 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
}
else
{
- const SvxBrushItem &rBack = GetFmt()->GetBackground();
+ SvxBrushItem aBack = GetFmt()->makeBackgroundBrushItem();
// OD 07.08.2002 #99657# #GetTransChg#
// to determine, if background has to be painted, by checking, if
// background color is not COL_TRANSPARENT ("no fill"/"auto fill")
// or a background graphic exists.
- bPaintCompleteBack = !(rBack.GetColor() == COL_TRANSPARENT) ||
- rBack.GetGraphicPos() != GPOS_NONE;
+ bPaintCompleteBack = !(aBack.GetColor() == COL_TRANSPARENT) ||
+ aBack.GetGraphicPos() != GPOS_NONE;
}
}
// paint of margin needed.
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 52370a4..a8bfd77 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2972,7 +2972,8 @@ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo )
InvalidatePage( pPage );
SetComplete();
- const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
+ SvxBrushItem aBack = GetFmt()->makeBackgroundBrushItem();
+ const SvxGraphicPosition ePos = aBack.GetGraphicPos();
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
}
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 8b2a905..47d6967 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1377,7 +1377,8 @@ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
GetNext()->_InvalidatePos();
//Trigger a repaint if necessary.
- const SvxGraphicPosition ePos = pUp->GetFmt()->GetBackground().GetGraphicPos();
+ SvxBrushItem aBack(pUp->GetFmt()->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack.GetGraphicPos();
if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
pViewShell->InvalidateWindows( pUp->Frm() );
@@ -2347,7 +2348,8 @@ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, bool bTst, bool bInfo )
if( IsCellFrm() )
InvaPercentLowers( nReal );
- const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
+ SvxBrushItem aBack(GetFmt()->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack.GetGraphicPos();
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
}
@@ -2503,7 +2505,8 @@ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, bool bTst, bool bInfo )
const SwFrmFmt* pFmt = GetFmt();
if (pFmt)
{
- const SvxGraphicPosition ePos = pFmt->GetBackground().GetGraphicPos();
+ SvxBrushItem aBack(pFmt->makeBackgroundBrushItem());
+ const SvxGraphicPosition ePos = aBack.GetGraphicPos();
if ( GPOS_NONE == ePos || GPOS_TILED == ePos )
bCompletePaint = false;
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4a5ffd0..b5a3fcf 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2028,7 +2028,7 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
if(pBackColor||pBackTrans||pGrURL||pGrFilter||pGrLoc)
{
- SvxBrushItem aBrush ( rFrmFmt.GetBackground() );
+ SvxBrushItem aBrush(rFrmFmt.makeBackgroundBrushItem());
if(pBackColor)
aBrush.PutValue(*pBackColor, MID_BACK_COLOR);
if(pBackTrans)
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 636e228..4fbe398 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2178,7 +2178,7 @@ static bool OutCSS1_FrmFmtBrush( SwHTMLWriter& rWrt,
void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
{
// If the frame itself has a background, then export.
- if( OutCSS1_FrmFmtBrush( *this, rFrmFmt.GetBackground() ) )
+ if( OutCSS1_FrmFmtBrush( *this, rFrmFmt.makeBackgroundBrushItem() ) )
return;
// If the frame is not linked to a page, we use the background of the anchor.
@@ -2206,7 +2206,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
// If the box has a background, we take it.
if( OutCSS1_FrmFmtBrush( *this,
- pBox->GetFrmFmt()->GetBackground() ) )
+ pBox->GetFrmFmt()->makeBackgroundBrushItem() ) )
return;
// Otherwise we use that of the lines
@@ -2214,7 +2214,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
while( pLine )
{
if( OutCSS1_FrmFmtBrush( *this,
- pLine->GetFrmFmt()->GetBackground() ) )
+ pLine->GetFrmFmt()->makeBackgroundBrushItem() ) )
return;
pBox = pLine->GetUpper();
pLine = pBox ? pBox->GetUpper() : 0;
@@ -2222,7 +2222,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
// If there was none either, we use the background of the table.
if( OutCSS1_FrmFmtBrush( *this,
- pTableNd->GetTable().GetFrmFmt()->GetBackground() ) )
+ pTableNd->GetTable().GetFrmFmt()->makeBackgroundBrushItem() ) )
return;
}
@@ -2241,7 +2241,7 @@ void SwHTMLWriter::OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt )
// the value of the Config.
OSL_ENSURE( pCurrPageDesc, "no page template found" );
if( !OutCSS1_FrmFmtBrush( *this,
- pCurrPageDesc->GetMaster().GetBackground() ) )
+ pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) )
{
Color aColor( COL_WHITE );
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 0ea2a03..7a1c0fe 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -561,10 +561,10 @@ void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc,
}
// /Feature: PrintExt
-const SvxBrushItem& SwCSS1Parser::GetPageDescBackground() const
+SvxBrushItem SwCSS1Parser::makePageDescBackground() const
{
return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false )
- ->GetMaster().GetBackground();
+ ->GetMaster().makeBackgroundBrushItem();
}
sal_uInt16 SwCSS1Parser::GetScriptFromClass( OUString& rClass,
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index e4b5165..5568aec 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -258,11 +258,11 @@ sal_uInt16 SwHTMLWriter::GuessFrmType( const SwFrmFmt& rFrmFmt,
}
if( bEmpty )
{
- const SvxBrushItem& rBrush = rFrmFmt.GetBackground();
+ SvxBrushItem aBrush = rFrmFmt.makeBackgroundBrushItem();
/// background is not empty, if it has a background graphic
/// or its background color is not "no fill"/"auto fill".
- if( GPOS_NONE != rBrush.GetGraphicPos() ||
- rBrush.GetColor() != COL_TRANSPARENT )
+ if( GPOS_NONE != aBrush.GetGraphicPos() ||
+ aBrush.GetColor() != COL_TRANSPARENT )
bEmpty = false;
}
if( bEmpty )
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index d59ca93..e4f76c4 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -925,7 +925,7 @@ void SwHTMLParser::InsertBodyOptions()
// Die Item fuer die Seitenvorlage vorbereiten (Hintergrund, Umrandung)
// Beim BrushItem muessen schon gesetzte werte erhalten bleiben!
- SvxBrushItem aBrushItem( pCSS1Parser->GetPageDescBackground() );
+ SvxBrushItem aBrushItem( pCSS1Parser->makePageDescBackground() );
bool bSetBrush = false;
if( bBGColor && !pCSS1Parser->IsBodyBGColorSet() )
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 1d3ce77..c7357e1 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -140,13 +140,13 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
bool bRet = false;
if( rBox.GetSttNd() )
{
- const SvxBrushItem& rBrushItem =
- rBox.GetFrmFmt()->GetBackground();
+ SvxBrushItem aBrushItem =
+ rBox.GetFrmFmt()->makeBackgroundBrushItem();
/// The table box has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
- bRet = rBrushItem.GetColor() != COL_TRANSPARENT ||
- !rBrushItem.GetGraphicLink().isEmpty() || rBrushItem.GetGraphic();
+ bRet = aBrushItem.GetColor() != COL_TRANSPARENT ||
+ !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic();
}
else
{
@@ -171,11 +171,11 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
OSL_ENSURE( bTop || bBottom || bLeft || bRight,
"HasTabBackground: darf nicht aufgerufen werden" );
- const SvxBrushItem& rBrushItem = rLine.GetFrmFmt()->GetBackground();
+ SvxBrushItem aBrushItem = rLine.GetFrmFmt()->makeBackgroundBrushItem();
/// The table line has a background, if its background color is not "no fill"/
/// "auto fill" or it has a background graphic.
- bool bRet = rBrushItem.GetColor() != COL_TRANSPARENT ||
- !rBrushItem.GetGraphicLink().isEmpty() || rBrushItem.GetGraphic();
+ bool bRet = aBrushItem.GetColor() != COL_TRANSPARENT ||
+ !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic();
if( !bRet )
{
diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx
index 54fc5cc..5789844 100644
--- a/sw/source/filter/html/swcss1.hxx
+++ b/sw/source/filter/html/swcss1.hxx
@@ -153,7 +153,7 @@ public:
void SetBodyLinkSet() { bBodyLinkSet = true; }
void SetBodyVLinkSet() { bBodyVLinkSet = true; }
- const SvxBrushItem& GetPageDescBackground() const;
+ SvxBrushItem makePageDescBackground() const;
inline void SetTHTagStyles();
inline void SetTDTagStyles();
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 18f0591..dd9effc 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2043,8 +2043,8 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
if (bIsInHeader)
{
- const SvxBrushItem& rBrush(rFmt.GetBackground());
- WriteBrushAttr(rBrush, rPropOpt);
+ SvxBrushItem aBrush(rFmt.makeBackgroundBrushItem());
+ WriteBrushAttr(aBrush, rPropOpt);
}
else
{
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 6e0a027..31b53da 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -193,7 +193,7 @@ SectRepr::SectRepr( sal_uInt16 nPos, SwSection& rSect )
if( pFmt )
{
m_Col = pFmt->GetCol();
- m_Brush = pFmt->GetBackground();
+ m_Brush = pFmt->makeBackgroundBrushItem();
m_FtnNtAtEnd = pFmt->GetFtnAtTxtEnd();
m_EndNtAtEnd = pFmt->GetEndAtTxtEnd();
m_Balance.SetValue(pFmt->GetBalancedColumns().GetValue());
@@ -764,7 +764,8 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl)
if( pFmt->GetCol() != pRepr->GetCol() )
pSet->Put( pRepr->GetCol() );
- if( pFmt->GetBackground(false) != pRepr->GetBackground() )
+ SvxBrushItem aBrush(pFmt->makeBackgroundBrushItem(false));
+ if( aBrush != pRepr->GetBackground() )
pSet->Put( pRepr->GetBackground() );
if( pFmt->GetFtnAtTxtEnd(false) != pRepr->GetFtnNtAtEnd() )
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 37e6c32e..33f1e17 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -83,6 +83,7 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
PopupMenu( SW_RES(MN_READONLY_POPUP) ),
rView ( rV ),
+ aBrushItem(RES_BACKGROUND),
rDocPos( rDPos ),
pImageMap( 0 ),
pTargetURL( 0 )
@@ -149,14 +150,14 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
SfxViewFrame * pVFrame = rV.GetViewFrame();
SfxDispatcher &rDis = *pVFrame->GetDispatcher();
const SwPageDesc &rDesc = rSh.GetPageDesc( rSh.GetCurPageDesc() );
- pItem = &rDesc.GetMaster().GetBackground();
+ aBrushItem = rDesc.GetMaster().makeBackgroundBrushItem();
bool bEnableBackGallery = false,
bEnableBack = false;
- if ( GPOS_NONE != pItem->GetGraphicPos() )
+ if ( GPOS_NONE != aBrushItem.GetGraphicPos() )
{
bEnableBack = true;
- if ( !pItem->GetGraphicLink().isEmpty() )
+ if ( !aBrushItem.GetGraphicLink().isEmpty() )
{
if ( aThemeList.empty() )
GalleryExplorer::FillThemeList( aThemeList );
@@ -248,7 +249,7 @@ void SwReadOnlyPopup::Execute( Window* pWin, sal_uInt16 nId )
{
nId -= MN_READONLY_BACKGROUNDTOGALLERY+3;
nSaveId = MN_READONLY_SAVEBACKGROUND;
- sTmp = pItem->GetGraphicLink();
+ sTmp = aBrushItem.GetGraphicLink();
}
else
{
@@ -349,15 +350,15 @@ OUString SwReadOnlyPopup::SaveGraphic( sal_uInt16 nId )
// fish out the graphic's name
if ( MN_READONLY_SAVEBACKGROUND == nId )
{
- if ( !pItem->GetGraphicLink().isEmpty() )
- sGrfName = pItem->GetGraphicLink();
- ((SvxBrushItem*)pItem)->SetDoneLink( Link() );
- const Graphic *pGrf = pItem->GetGraphic();
+ if ( !aBrushItem.GetGraphicLink().isEmpty() )
+ sGrfName = aBrushItem.GetGraphicLink();
+ aBrushItem.SetDoneLink( Link() );
+ const Graphic *pGrf = aBrushItem.GetGraphic();
if ( pGrf )
{
aGraphic = *pGrf;
- if ( !pItem->GetGraphicLink().isEmpty() )
- sGrfName = pItem->GetGraphicLink();
+ if ( !aBrushItem.GetGraphicLink().isEmpty() )
+ sGrfName = aBrushItem.GetGraphicLink();
}
else
return OUString();
diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx
index 7bf0bd2..87aa221 100644
--- a/sw/source/uibase/docvw/romenu.hxx
+++ b/sw/source/uibase/docvw/romenu.hxx
@@ -19,20 +19,20 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_DOCVW_ROMENU_HXX
#define INCLUDED_SW_SOURCE_UIBASE_DOCVW_ROMENU_HXX
+#include <editeng/brushitem.hxx>
#include <vcl/graph.hxx>
#include <vcl/menu.hxx>
#include <svl/stritem.hxx>
class SwView;
class SfxDispatcher;
-class SvxBrushItem;
class ImageMap;
class INetImage;
class SwReadOnlyPopup : public PopupMenu
{
- SwView &rView;
- const SvxBrushItem *pItem;
+ SwView &rView;
+ SvxBrushItem aBrushItem;
const Point &rDocPos;
Graphic aGraphic;
OUString sURL,
More information about the Libreoffice-commits
mailing list