[Libreoffice-commits] core.git: 3 commits - sw/source
Michael Stahl
mstahl at redhat.com
Tue Sep 26 15:30:17 UTC 2017
sw/source/core/attr/format.cxx | 12 +++++-------
sw/source/core/layout/atrfrm.cxx | 6 ++++++
sw/source/ui/frmdlg/frmpage.cxx | 17 ++++++++++-------
sw/source/uibase/app/docst.cxx | 1 +
4 files changed, 22 insertions(+), 14 deletions(-)
New commits:
commit d1fbc5e6231b0aa9d3eeda6fe835f2100efa40d7
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Sep 26 17:06:17 2017 +0200
sw: convert that to assert, and remove a duplicate OSL_ENSURE
Change-Id: Id454ed0efbb90cfe3ece0bdedf51f385962ee357
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index e3b4639c1ee7..761dc5318b2a 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -214,8 +214,6 @@ SwFormat::~SwFormat()
// ones on DerivedFrom.
if( HasWriterListeners() )
{
- OSL_ENSURE( DerivedFrom(), "SwFormat::~SwFormat: Def dependents!" );
-
m_bFormatInDTOR = true;
SwFormat* pParentFormat = DerivedFrom();
@@ -356,11 +354,11 @@ bool SwFormat::SetDerivedFrom(SwFormat *pDerFrom)
if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
return false;
- OSL_ENSURE( Which()==pDerFrom->Which()
- || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
- || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
- || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
- "SetDerivedFrom: derive apples from oranges?");
+ assert( Which()==pDerFrom->Which()
+ || (Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
+ || (Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
+ || (Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT)
+ );
if ( IsInCache() )
{
commit eed046433a847d3005e52c38963fb883322a39e6
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Sep 26 17:00:25 2017 +0200
tdf#112574 sw: assert if a frame style contains a RES_ANCHOR
... in SwFrameFormat::Modify().
Change-Id: I3b7ea1493277d8d705bdf77c50fdff49872bac05
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 9dfe0f870a2f..1c806bb9527b 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2614,7 +2614,10 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
const SfxPoolItem* tmp = nullptr;
static_cast< const SwAttrSetChg* >(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, &tmp );
if( tmp )
+ {
+ assert(static_cast<SwAttrSetChg const*>(pNew)->GetTheChgdSet() == &m_aSet); // must not be style's set!
newAnchorPosition = static_cast< const SwFormatAnchor* >( tmp )->GetContentAnchor();
+ }
}
if( pNew && pNew->Which() == RES_ANCHOR )
newAnchorPosition = static_cast< const SwFormatAnchor* >( pNew )->GetContentAnchor();
@@ -2623,7 +2626,10 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
const SfxPoolItem* tmp = nullptr;
static_cast< const SwAttrSetChg* >(pOld)->GetChgSet()->GetItemState( RES_ANCHOR, false, &tmp );
if( tmp )
+ {
+ assert(static_cast<SwAttrSetChg const*>(pOld)->GetTheChgdSet() == &m_aSet); // must not be style's set!
oldAnchorPosition = static_cast< const SwFormatAnchor* >( tmp )->GetContentAnchor();
+ }
}
if( pOld && pOld->Which() == RES_ANCHOR )
oldAnchorPosition = static_cast< const SwFormatAnchor* >( pOld )->GetContentAnchor();
commit 17fe1e19e01f8b23bcd23cc7c1789e8f7064d06e
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Sep 26 16:56:31 2017 +0200
tdf#112574 sw: don't insert RES_ANCHOR into style item sets
Styles don't have anchors, only frames have anchors.
When using "New Style from Selection", clear the RES_ANCHOR from
the style item set.
Also, don't insert it in SwFramePage::DeactivatePage().
This was always broken and reportedly crashes since commit
e07feb9457f2ffb373ae69b73dda290140e4005f
Change-Id: I9320dbbcae980dfa0b00459b8cd808553d1a04f4
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 99854aaf6aac..edec1e0412ba 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1750,13 +1750,16 @@ DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * _pSet)
{
FillItemSet( _pSet );
- //FillItemSet doesn't set the anchor into the set when it matches
- //the original. But for the other pages we need the current anchor.
- SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
- : getFrameDlgParentShell();
- RndStdIds eAnchorId = GetAnchor();
- SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
- _pSet->Put( aAnc );
+ if (!m_bFormat) // tdf#112574 no anchor in styles
+ {
+ //FillItemSet doesn't set the anchor into the set when it matches
+ //the original. But for the other pages we need the current anchor.
+ SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
+ : getFrameDlgParentShell();
+ RndStdIds eAnchorId = GetAnchor();
+ SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
+ _pSet->Put( aAnc );
+ }
}
return DeactivateRC::LeavePage;
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index f8c424db280f..d6ef4503e661 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1237,6 +1237,7 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily
SfxItemSet aSet(GetPool(), aFrameFormatSetRange );
pCurrWrtShell->GetFlyFrameAttr( aSet );
+ aSet.ClearItem(RES_ANCHOR); // tdf#112574 no anchor in styles
SwFrameFormat* pFFormat = pCurrWrtShell->GetSelectedFrameFormat();
pFrame->SetDerivedFrom( pFFormat );
More information about the Libreoffice-commits
mailing list