[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/source

Michael Stahl mstahl at redhat.com
Wed Sep 27 09:56:46 UTC 2017


 sw/source/ui/frmdlg/frmpage.cxx |   17 ++++++++++-------
 sw/source/uibase/app/docst.cxx  |    1 +
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 2f1ef1d7e3caa806e5f5abddb3ac3761538b935b
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
    (cherry picked from commit 17fe1e19e01f8b23bcd23cc7c1789e8f7064d06e)
    Reviewed-on: https://gerrit.libreoffice.org/42819
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index eab95eee09fc..8239a71c6419 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1749,13 +1749,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 = (RndStdIds)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 = (RndStdIds)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 ee02b382a861..9d61b36877b0 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1219,6 +1219,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