kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0001-default-to-as-character-caption-contents.patch

f325b2
From 91739f2ca569b30383fe2f1cef8816fa8bf0554a Mon Sep 17 00:00:00 2001
f325b2
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f325b2
Date: Thu, 10 Sep 2015 11:07:55 +0100
f325b2
Subject: [PATCH] default to as-character caption contents
f325b2
f325b2
this FindFlyFrm variant returns the Selected FlyFrm
f325b2
f325b2
the other one actively searches for the FlyFrm that
f325b2
matches the XEmbeddedObject argument
f325b2
f325b2
Change-Id: I2f9271c01337b4a32d7b644f82d16d85c2dc5b51
f325b2
(cherry picked from commit d9729bc06d676a36120f3da252d1a4fa39d103d8)
f325b2
f325b2
GetCurrFlyFrm just forwards to GetSelectedFlyFrm
f325b2
f325b2
Change-Id: Ia0b83a3aad71a72ae2135c5d7f6ddb6d9644b10b
f325b2
(cherry picked from commit 8df51f799bb830db52c7be2d04b575b0443b76ec)
f325b2
f325b2
bundle duplicate pattern into a GetCurrFlyFrm method
f325b2
f325b2
Change-Id: Ib12b825ef9cc6e2b57e9320d435e3863d319cf0f
f325b2
(cherry picked from commit 7473aacc73f8572e20f6f2a3a1d10001c5cc477d)
f325b2
f325b2
GetSelectedFlyFrm+GetCurrFlyFrm -> GetSelectedOrCurrFlyFrm
f325b2
f325b2
Change-Id: I4348c4cf54dcd5504c52cf8ab550572257eef50b
f325b2
(cherry picked from commit a5aab0cce45309afae81b3ec0be8ace1ca0ca17d)
f325b2
f325b2
GetCurFrameFormat->GetSelectedFrameFormat
f325b2
f325b2
Change-Id: I2f1eb4567b6e073991d95dbcecdc79b24010f2c1
f325b2
(cherry picked from commit 4e6194fe8357efc5afa8d094e209ea94335b5923)
f325b2
f325b2
split out useful code as standalone makeItemSetFromFormatAnchor
f325b2
f325b2
Change-Id: I385549b4841dfc715aa984bcc257d78c9f1c3ed4
f325b2
(cherry picked from commit d961c9273104f552a8207e63c33e33f1e265565d)
f325b2
f325b2
Related: tdf#93676 default to as-char inside captions
f325b2
f325b2
This will (hopefull) improve round-tripping to doc[x] for new documents because
f325b2
word can only have as-char elements inside frames so we get a like-for-like
f325b2
conversion if the defaults are used.
f325b2
f325b2
Change-Id: I3913b9b624dd5ba57ed07140bced8e3dca289cf5
f325b2
(cherry picked from commit 93ab0ff24cb71c36c9e7958046e96d7472b5af90)
f325b2
---
f325b2
 sw/inc/fesh.hxx                              |  14 +++-
f325b2
 sw/source/core/access/accframebase.cxx       |   2 +-
f325b2
 sw/source/core/access/accmap.cxx             |   2 +-
f325b2
 sw/source/core/access/accselectionhelper.cxx |  10 +--
f325b2
 sw/source/core/frmedt/fecopy.cxx             |   8 +-
f325b2
 sw/source/core/frmedt/fefly1.cxx             | 118 ++++++++++++---------------
f325b2
 sw/source/core/frmedt/feflyole.cxx           |   2 +-
f325b2
 sw/source/core/frmedt/feshview.cxx           |   6 +-
f325b2
 sw/source/core/frmedt/fews.cxx               |  60 +++++++++++---
f325b2
 sw/source/core/inc/UndoInsert.hxx            |   1 +
f325b2
 sw/source/core/undo/unins.cxx                |  16 +++-
f325b2
 sw/source/uibase/app/docst.cxx               |   8 +-
f325b2
 sw/source/uibase/ribbar/drawbase.cxx         |   2 +-
f325b2
 sw/source/uibase/shells/basesh.cxx           |  18 ++--
f325b2
 sw/source/uibase/shells/frmsh.cxx            |   8 +-
f325b2
 sw/source/uibase/shells/grfsh.cxx            |   2 +-
f325b2
 sw/source/uibase/wrtsh/wrtsh1.cxx            |   2 +-
f325b2
 17 files changed, 159 insertions(+), 120 deletions(-)
f325b2
f325b2
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
f325b2
index b3bbfcd..efc9b3d 100644
f325b2
--- a/sw/inc/fesh.hxx
f325b2
+++ b/sw/inc/fesh.hxx
f325b2
@@ -187,7 +187,6 @@ private:
f325b2
     std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom;
f325b2
     bool m_bCheckForOLEInCaption;
f325b2
 
f325b2
-    SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm() const;
f325b2
     SAL_DLLPRIVATE SwFlyFrm *FindFlyFrm( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&  ) const;
f325b2
 
f325b2
     /// Terminate actions for all shells and call ChangeLink.
f325b2
@@ -362,6 +361,7 @@ public:
f325b2
     bool IsFrmSelected() const;
f325b2
     bool GetFlyFrmAttr( SfxItemSet &rSet ) const;
f325b2
     bool SetFlyFrmAttr( SfxItemSet &rSet );
f325b2
+    SfxItemSet makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) const;
f325b2
     bool ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet = 0 );
f325b2
     const SwFrameFormat *NewFlyFrm( const SfxItemSet &rSet, bool bAnchValid = false,
f325b2
                          SwFrameFormat *pParent = 0 );
f325b2
@@ -373,9 +373,17 @@ public:
f325b2
      - add output parameter <bVertL2R> */
f325b2
     bool IsFrmVertical(const bool bEnvironment, bool& bRightToLeft, bool& bVertL2R) const;
f325b2
 
f325b2
-    SwFrameFormat* GetCurFrameFormat() const; ///< If frame then frame style, else 0.
f325b2
+    SwFrameFormat* GetSelectedFrameFormat() const; ///< If frame then frame style, else 0.
f325b2
     void SetFrameFormat( SwFrameFormat *pFormat, bool bKeepOrient = false, Point* pDocPos = 0 ); ///< If frame then set frame style.
f325b2
-    const SwFlyFrm *GetCurrFlyFrm() const { return FindFlyFrm(); }
f325b2
+
f325b2
+    // Get selected fly
f325b2
+    SwFlyFrm* GetSelectedFlyFrm() const;
f325b2
+
f325b2
+    // Get current fly in which the cursor is positioned
f325b2
+    SwFlyFrm* GetCurrFlyFrm(const bool bCalcFrm = true) const;
f325b2
+
f325b2
+    // Get selected fly, but if none Get current fly in which the cursor is positioned
f325b2
+    SwFlyFrm* GetSelectedOrCurrFlyFrm(const bool bCalcFrm = true) const;
f325b2
 
f325b2
     /// Find/delete fly containing the cursor.
f325b2
     SwFrameFormat* WizzardGetFly();
f325b2
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
f325b2
index bfffd2d..bfe07b4 100644
f325b2
--- a/sw/source/core/access/accframebase.cxx
f325b2
+++ b/sw/source/core/access/accframebase.cxx
f325b2
@@ -53,7 +53,7 @@ bool SwAccessibleFrameBase::IsSelected()
f325b2
     if( pVSh->ISA( SwFEShell ) )
f325b2
     {
f325b2
         const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
f325b2
-        const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm();
f325b2
+        const SwFrm *pFlyFrm = pFESh->GetSelectedFlyFrm();
f325b2
         if( pFlyFrm == GetFrm() )
f325b2
             bRet = true;
f325b2
     }
f325b2
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
f325b2
index 7e47ad3..18d9ce5 100644
f325b2
--- a/sw/source/core/access/accmap.cxx
f325b2
+++ b/sw/source/core/access/accmap.cxx
f325b2
@@ -2598,7 +2598,7 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrm *pFrm )
f325b2
         else if( pVSh->ISA( SwFEShell ) )
f325b2
         {
f325b2
             const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
f325b2
-            const SwFrm *pFlyFrm = pFESh->GetCurrFlyFrm();
f325b2
+            const SwFrm *pFlyFrm = pFESh->GetSelectedFlyFrm();
f325b2
             if( pFlyFrm )
f325b2
             {
f325b2
                 OSL_ENSURE( !pFrm || pFrm->FindFlyFrm() == pFlyFrm,
f325b2
diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx
f325b2
index cec0612..5269503 100644
f325b2
--- a/sw/source/core/access/accselectionhelper.cxx
f325b2
+++ b/sw/source/core/access/accselectionhelper.cxx
f325b2
@@ -156,12 +156,12 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
f325b2
 
f325b2
     // ... and compare to the currently selected frame
f325b2
     bool bRet = false;
f325b2
-    SwFEShell* pFEShell = GetFEShell();
f325b2
+    const SwFEShell* pFEShell = GetFEShell();
f325b2
     if( pFEShell )
f325b2
     {
f325b2
         if ( aChild.GetSwFrm() != 0 )
f325b2
         {
f325b2
-            bRet = (pFEShell->GetCurrFlyFrm() == aChild.GetSwFrm());
f325b2
+            bRet = (pFEShell->GetSelectedFlyFrm() == aChild.GetSwFrm());
f325b2
         }
f325b2
         else if ( aChild.GetDrawObject() )
f325b2
         {
f325b2
@@ -218,10 +218,10 @@ sal_Int32 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount(  )
f325b2
     sal_Int32 nCount = 0;
f325b2
     // Only one frame can be selected at a time, and we only frames
f325b2
     // for selectable children.
f325b2
-    SwFEShell* pFEShell = GetFEShell();
f325b2
+    const SwFEShell* pFEShell = GetFEShell();
f325b2
     if( pFEShell != 0 )
f325b2
     {
f325b2
-        const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
f325b2
+        const SwFlyFrm* pFlyFrm = pFEShell->GetSelectedFlyFrm();
f325b2
         if( pFlyFrm )
f325b2
         {
f325b2
             nCount = 1;
f325b2
@@ -290,7 +290,7 @@ Reference<XAccessible> SwAccessibleSelectionHelper::getSelectedAccessibleChild(
f325b2
         throwIndexOutOfBoundsException();
f325b2
 
f325b2
     SwAccessibleChild aChild;
f325b2
-    const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
f325b2
+    const SwFlyFrm *pFlyFrm = pFEShell->GetSelectedFlyFrm();
f325b2
     if( pFlyFrm )
f325b2
     {
f325b2
         if( 0 == nSelectedChildIndex )
f325b2
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
f325b2
index 987625d..ab55d84 100644
f325b2
--- a/sw/source/core/frmedt/fecopy.cxx
f325b2
+++ b/sw/source/core/frmedt/fecopy.cxx
f325b2
@@ -126,7 +126,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpText )
f325b2
     if( IsFrmSelected() )
f325b2
     {
f325b2
         // get the FlyFormat
f325b2
-        SwFlyFrm* pFly = FindFlyFrm();
f325b2
+        SwFlyFrm* pFly = GetSelectedFlyFrm();
f325b2
         SwFrameFormat* pFlyFormat = pFly->GetFormat();
f325b2
         SwFormatAnchor aAnchor( pFlyFormat->GetAnchor() );
f325b2
 
f325b2
@@ -467,7 +467,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt,
f325b2
 
f325b2
     if( IsFrmSelected() )
f325b2
     {
f325b2
-        SwFlyFrm* pFly = FindFlyFrm();
f325b2
+        SwFlyFrm* pFly = GetSelectedFlyFrm();
f325b2
         SwFrameFormat* pFlyFormat = pFly->GetFormat();
f325b2
         SwFormatAnchor aAnchor( pFlyFormat->GetAnchor() );
f325b2
         bRet = true;
f325b2
@@ -1264,10 +1264,10 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFormat, Graphic& rGrf )
f325b2
                     }
f325b2
                     else
f325b2
                     {
f325b2
-                        // fix(23806): not the origial size, but the current one.
f325b2
+                        // Not the original size, but the current one.
f325b2
                         // Otherwise it could happen that for vector graphics
f325b2
                         // many MB's of memory are allocated.
f325b2
-                        const Size aSz( FindFlyFrm()->Prt().SSize() );
f325b2
+                        const Size aSz( GetSelectedFlyFrm()->Prt().SSize() );
f325b2
                         ScopedVclPtrInstance< VirtualDevice > pVirtDev(*GetWin());
f325b2
 
f325b2
                         MapMode aTmp( MAP_TWIP );
f325b2
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
f325b2
index 2937f04..e35b98e 100644
f325b2
--- a/sw/source/core/frmedt/fefly1.cxx
f325b2
+++ b/sw/source/core/frmedt/fefly1.cxx
f325b2
@@ -236,7 +236,7 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, bool bNew )
f325b2
         OSL_ENSURE( rFrm.IsFlyFrm(), "SelectFlyFrm will einen Fly" );
f325b2
 
f325b2
        // nothing to be done if the Fly already was selected
f325b2
-        if ( FindFlyFrm() == &rFrm )
f325b2
+        if (GetSelectedFlyFrm() == &rFrm)
f325b2
             return;
f325b2
 
f325b2
         // assure the anchor is drawn
f325b2
@@ -254,8 +254,8 @@ void SwFEShell::SelectFlyFrm( SwFlyFrm& rFrm, bool bNew )
f325b2
     }
f325b2
 }
f325b2
 
f325b2
-// returns a Fly if one is selected
f325b2
-SwFlyFrm *SwFEShell::FindFlyFrm() const
f325b2
+// Get selected fly
f325b2
+SwFlyFrm* SwFEShell::GetSelectedFlyFrm() const
f325b2
 {
f325b2
     if ( Imp()->HasDrawView() )
f325b2
     {
f325b2
@@ -270,6 +270,22 @@ SwFlyFrm *SwFEShell::FindFlyFrm() const
f325b2
     return 0;
f325b2
 }
f325b2
 
f325b2
+// Get current fly in which the cursor is positioned
f325b2
+SwFlyFrm* SwFEShell::GetCurrFlyFrm(const bool bCalcFrm) const
f325b2
+{
f325b2
+    SwContentFrm *pContent = GetCurrFrm(bCalcFrm);
f325b2
+    return pContent ? pContent->FindFlyFrm() : 0;
f325b2
+}
f325b2
+
f325b2
+// Get selected fly, but if none Get current fly in which the cursor is positioned
f325b2
+SwFlyFrm* SwFEShell::GetSelectedOrCurrFlyFrm(const bool bCalcFrm) const
f325b2
+{
f325b2
+    SwFlyFrm *pFly = GetSelectedFlyFrm();
f325b2
+    if (pFly)
f325b2
+        return pFly;
f325b2
+    return GetCurrFlyFrm(bCalcFrm);
f325b2
+}
f325b2
+
f325b2
 // Returns non-null pointer, if the current Fly could be anchored to another one (so it is inside)
f325b2
 const SwFrameFormat* SwFEShell::IsFlyInFly()
f325b2
 {
f325b2
@@ -281,11 +297,8 @@ const SwFrameFormat* SwFEShell::IsFlyInFly()
f325b2
     const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
f325b2
     if ( !rMrkList.GetMarkCount() )
f325b2
     {
f325b2
-        SwContentFrm *pContent = GetCurrFrm( false );
f325b2
-        if( !pContent )
f325b2
-            return NULL;
f325b2
-        SwFlyFrm *pFly = pContent->FindFlyFrm();
f325b2
-        if ( !pFly )
f325b2
+        SwFlyFrm *pFly = GetCurrFlyFrm(false);
f325b2
+        if (!pFly)
f325b2
             return NULL;
f325b2
         return pFly->GetFormat();
f325b2
     }
f325b2
@@ -332,11 +345,8 @@ void SwFEShell::SetFlyPos( const Point& rAbsPos )
f325b2
     SET_CURR_SHELL( this );
f325b2
 
f325b2
     // Determine reference point in document coordinates
f325b2
-    SwContentFrm *pContent = GetCurrFrm( false );
f325b2
-    if( !pContent )
f325b2
-        return;
f325b2
-    SwFlyFrm *pFly = pContent->FindFlyFrm();
f325b2
-    if ( !pFly )
f325b2
+    SwFlyFrm *pFly = GetCurrFlyFrm(false);
f325b2
+    if (!pFly)
f325b2
         return;
f325b2
 
f325b2
     //SwSaveHdl aSaveX( Imp() );
f325b2
@@ -968,21 +978,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr, int n
f325b2
 // wrong place or which are ambiguous (multiple selections) will be removed.
f325b2
 bool SwFEShell::GetFlyFrmAttr( SfxItemSet &rSet ) const
f325b2
 {
f325b2
-    SwFlyFrm *pFly = FindFlyFrm();
f325b2
-    if ( !pFly )
f325b2
+    SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
f325b2
+    if (!pFly)
f325b2
     {
f325b2
-        SwFrm* pCurrFrm( GetCurrFrm() );
f325b2
-        if ( !pCurrFrm )
f325b2
-        {
f325b2
-            OSL_FAIL( "<SwFEShell::GetFlyFrmAttr(..)> - missing current frame. This is a serious defect, please inform OD." );
f325b2
-            return false;
f325b2
-        }
f325b2
-        pFly = GetCurrFrm()->FindFlyFrm();
f325b2
-        if ( !pFly )
f325b2
-        {
f325b2
-            OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." );
f325b2
-            return false;
f325b2
-        }
f325b2
+        OSL_ENSURE( false, "GetFlyFrmAttr, no Fly selected." );
f325b2
+        return false;
f325b2
     }
f325b2
 
f325b2
     SET_CURR_SHELL( (SwViewShell*)this );
f325b2
@@ -1026,13 +1026,8 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
f325b2
 
f325b2
     if( rSet.Count() )
f325b2
     {
f325b2
-        SwFlyFrm *pFly = FindFlyFrm();
f325b2
-        if( !pFly )
f325b2
-        {
f325b2
-            OSL_ENSURE( GetCurrFrm(), "Crsr in parking zone" );
f325b2
-            pFly = GetCurrFrm()->FindFlyFrm();
f325b2
-            OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
f325b2
-        }
f325b2
+        SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
f325b2
+        OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
f325b2
         if( pFly )
f325b2
         {
f325b2
             StartAllAction();
f325b2
@@ -1058,6 +1053,16 @@ bool SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
f325b2
     return bRet;
f325b2
 }
f325b2
 
f325b2
+SfxItemSet SwFEShell::makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) const
f325b2
+{
f325b2
+    // The set also includes VERT/HORI_ORIENT, because the align
f325b2
+    // shall be changed in FEShell::SetFlyFrmAttr/SetFlyFrmAnchor,
f325b2
+    // possibly as a result of the anchor change.
f325b2
+    SfxItemSet aSet(rPool, RES_VERT_ORIENT, RES_ANCHOR);
f325b2
+    aSet.Put(rAnchor);
f325b2
+    return aSet;
f325b2
+}
f325b2
+
f325b2
 bool SwFEShell::SetDrawingAttr( SfxItemSet& rSet )
f325b2
 {
f325b2
     bool bRet = false;
f325b2
@@ -1106,14 +1111,8 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet )
f325b2
     {
f325b2
         SET_CURR_SHELL( this );
f325b2
 
f325b2
-        SwFlyFrm *pFly = FindFlyFrm();
f325b2
-        if( !pFly )
f325b2
-        {
f325b2
-            OSL_ENSURE( GetCurrFrm(), "Crsr in parking zone" );
f325b2
-            pFly = GetCurrFrm()->FindFlyFrm();
f325b2
-            OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
f325b2
-        }
f325b2
-
f325b2
+        SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
f325b2
+        OSL_ENSURE( pFly, "SetFlyFrmAttr, no Fly selected." );
f325b2
         if( pFly )
f325b2
         {
f325b2
             StartAllAction();
f325b2
@@ -1143,10 +1142,10 @@ bool SwFEShell::ResetFlyFrmAttr( sal_uInt16 nWhich, const SfxItemSet* pSet )
f325b2
 }
f325b2
 
f325b2
 // Returns frame-format if frame, otherwise 0
f325b2
-SwFrameFormat* SwFEShell::GetCurFrameFormat() const
f325b2
+SwFrameFormat* SwFEShell::GetSelectedFrameFormat() const
f325b2
 {
f325b2
     SwFrameFormat* pRet = 0;
f325b2
-    SwLayoutFrm *pFly = FindFlyFrm();
f325b2
+    SwLayoutFrm *pFly = GetSelectedFlyFrm();
f325b2
     if( pFly && ( pRet = static_cast<SwFrameFormat*>(pFly->GetFormat()->DerivedFrom()) ) ==
f325b2
                                             GetDoc()->GetDfltFrameFormat() )
f325b2
         pRet = 0;
f325b2
@@ -1164,7 +1163,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
f325b2
             pFly = static_cast<const SwFlyFrameFormat*>(pFormat)->GetFrm();
f325b2
     }
f325b2
     else
f325b2
-        pFly = FindFlyFrm();
f325b2
+        pFly = GetSelectedFlyFrm();
f325b2
     OSL_ENSURE( pFly, "SetFrameFormat: no frame" );
f325b2
     if( pFly )
f325b2
     {
f325b2
@@ -1200,35 +1199,24 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
f325b2
 
f325b2
 const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const
f325b2
 {
f325b2
-    const SwFlyFrm* pFly = FindFlyFrm();
f325b2
-    if ( !pFly )
f325b2
-    {
f325b2
-        SwFrm* pCurrFrm = GetCurrFrm();
f325b2
-        pFly = pCurrFrm ? pCurrFrm->FindFlyFrm() : 0;
f325b2
-    }
f325b2
-    if( pFly )
f325b2
+    const SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm();
f325b2
+    if (pFly)
f325b2
         return pFly->GetFormat();
f325b2
     return 0;
f325b2
 }
f325b2
 
f325b2
 SwFrameFormat* SwFEShell::GetFlyFrameFormat()
f325b2
 {
f325b2
-    SwFlyFrm* pFly = FindFlyFrm();
f325b2
-    if ( !pFly )
f325b2
-    {
f325b2
-        SwFrm* pCurrFrm = GetCurrFrm();
f325b2
-        pFly = pCurrFrm ? pCurrFrm->FindFlyFrm() : 0;
f325b2
-    }
f325b2
-    if( pFly )
f325b2
+    SwFlyFrm* pFly = GetSelectedOrCurrFlyFrm();
f325b2
+    if (pFly)
f325b2
         return pFly->GetFormat();
f325b2
     return 0;
f325b2
 }
f325b2
 
f325b2
 SwRect SwFEShell::GetFlyRect() const
f325b2
 {
f325b2
-    SwContentFrm *pContent = GetCurrFrm( false );
f325b2
-    SwFlyFrm *pFly = pContent ? pContent->FindFlyFrm() : 0;
f325b2
-    if ( !pFly )
f325b2
+    SwFlyFrm *pFly = GetCurrFlyFrm(false);
f325b2
+    if (!pFly)
f325b2
     {
f325b2
         SwRect aRect;
f325b2
         return aRect;
f325b2
@@ -1416,7 +1404,7 @@ SwFrameFormat* SwFEShell::WizzardGetFly()
f325b2
 
f325b2
 void SwFEShell::SetFlyName( const OUString& rName )
f325b2
 {
f325b2
-    SwLayoutFrm *pFly = FindFlyFrm();
f325b2
+    SwLayoutFrm *pFly = GetSelectedFlyFrm();
f325b2
     if( pFly )
f325b2
         GetDoc()->SetFlyName( *static_cast<SwFlyFrameFormat*>(pFly->GetFormat()), rName );
f325b2
     else {
f325b2
@@ -1426,7 +1414,7 @@ void SwFEShell::SetFlyName( const OUString& rName )
f325b2
 
f325b2
 OUString SwFEShell::GetFlyName() const
f325b2
 {
f325b2
-    SwLayoutFrm *pFly = FindFlyFrm();
f325b2
+    SwLayoutFrm *pFly = GetSelectedFlyFrm();
f325b2
     if( pFly )
f325b2
         return pFly->GetFormat()->GetName();
f325b2
 
f325b2
@@ -1437,7 +1425,7 @@ OUString SwFEShell::GetFlyName() const
f325b2
 const uno::Reference < embed::XEmbeddedObject > SwFEShell::GetOleRef() const
f325b2
 {
f325b2
     uno::Reference < embed::XEmbeddedObject > xObj;
f325b2
-    SwFlyFrm * pFly = FindFlyFrm();
f325b2
+    SwFlyFrm * pFly = GetSelectedFlyFrm();
f325b2
     if (pFly && pFly->Lower() && pFly->Lower()->IsNoTextFrm())
f325b2
     {
f325b2
         SwOLENode *pNd = static_cast<SwNoTextFrm*>(pFly->Lower())->GetNode()->GetOLENode();
f325b2
diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx
f325b2
index cd9804a..4d17b2a 100644
f325b2
--- a/sw/source/core/frmedt/feflyole.cxx
f325b2
+++ b/sw/source/core/frmedt/feflyole.cxx
f325b2
@@ -43,7 +43,7 @@ using namespace com::sun::star;
f325b2
 
f325b2
 SwFlyFrm *SwFEShell::FindFlyFrm( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
f325b2
 {
f325b2
-    SwFlyFrm *pFly = FindFlyFrm();
f325b2
+    SwFlyFrm *pFly = GetSelectedFlyFrm();
f325b2
     if ( pFly && pFly->Lower() && pFly->Lower()->IsNoTextFrm() )
f325b2
     {
f325b2
         SwOLENode *pNd = static_cast<SwNoTextFrm*>(pFly->Lower())->GetNode()->GetOLENode();
f325b2
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
f325b2
index fe38a22..54d79fb 100644
f325b2
--- a/sw/source/core/frmedt/feshview.cxx
f325b2
+++ b/sw/source/core/frmedt/feshview.cxx
f325b2
@@ -1772,7 +1772,7 @@ bool SwFEShell::ImpEndCreate()
f325b2
         SwFlyFrm* pFlyFrm;
f325b2
         if( NewFlyFrm( aSet, true ) &&
f325b2
             ::GetHtmlMode( GetDoc()->GetDocShell() ) &&
f325b2
-            0 != ( pFlyFrm = FindFlyFrm() ))
f325b2
+            0 != ( pFlyFrm = GetSelectedFlyFrm() ))
f325b2
         {
f325b2
             SfxItemSet aHtmlSet( GetDoc()->GetAttrPool(), RES_VERT_ORIENT, RES_HORI_ORIENT );
f325b2
             // horizontal orientation:
f325b2
@@ -2083,7 +2083,7 @@ Point SwFEShell::GetAnchorObjDiff() const
f325b2
 
f325b2
     if ( IsFrmSelected() )
f325b2
     {
f325b2
-        SwFlyFrm *pFly = FindFlyFrm();
f325b2
+        SwFlyFrm *pFly = GetSelectedFlyFrm();
f325b2
         aRet -= pFly->GetAnchorFrm()->Frm().Pos();
f325b2
     }
f325b2
     else
f325b2
@@ -2631,7 +2631,7 @@ void SwFEShell::SetChainMarker()
f325b2
          bDelTo   = true;
f325b2
     if ( IsFrmSelected() )
f325b2
     {
f325b2
-        SwFlyFrm *pFly = FindFlyFrm();
f325b2
+        SwFlyFrm *pFly = GetSelectedFlyFrm();
f325b2
 
f325b2
         if ( pFly->GetPrevLink() )
f325b2
         {
f325b2
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
f325b2
index db791c8..a850f62 100644
f325b2
--- a/sw/source/core/frmedt/fews.cxx
f325b2
+++ b/sw/source/core/frmedt/fews.cxx
f325b2
@@ -48,6 +48,7 @@
f325b2
 #include <ndtxt.hxx>
f325b2
 #include <dflyobj.hxx>
f325b2
 #include <dcontact.hxx>
f325b2
+#include <UndoInsert.hxx>
f325b2
 
f325b2
 using namespace com::sun::star;
f325b2
 
f325b2
@@ -395,14 +396,18 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
f325b2
     if( LTYPE_DRAW==eType || pCnt )
f325b2
     {
f325b2
         StartAllAction();
f325b2
+        SwRewriter aRewriter(SwUndoInsertLabel::CreateRewriter(rText));
f325b2
+        StartUndo(UNDO_INSERTLABEL, &aRewriter);
f325b2
 
f325b2
         sal_uLong nIdx = 0;
f325b2
+        bool bInnerCntIsFly = false;
f325b2
         SwFlyFrameFormat* pFlyFormat = 0;
f325b2
         switch( eType )
f325b2
         {
f325b2
         case LTYPE_OBJECT:
f325b2
         case LTYPE_FLY:
f325b2
-            if( pCnt->IsInFly() )
f325b2
+            bInnerCntIsFly = pCnt->IsInFly();
f325b2
+            if (bInnerCntIsFly)
f325b2
             {
f325b2
                 // pass down index to the startnode for flys
f325b2
                 nIdx = pCnt->FindFlyFrm()->
f325b2
@@ -423,7 +428,6 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
f325b2
             {
f325b2
                 SwDrawView *pDView = Imp()->GetDrawView();
f325b2
                 const SdrMarkList& rMrkList = pDView->GetMarkedObjectList();
f325b2
-                StartUndo();
f325b2
 
f325b2
                 // copy marked drawing objects to
f325b2
                 // local list to perform the corresponding action for each object
f325b2
@@ -452,7 +456,6 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
f325b2
                     aDrawObjs.pop_back();
f325b2
                 }
f325b2
 
f325b2
-                EndUndo();
f325b2
             }
f325b2
             break;
f325b2
         default:
f325b2
@@ -460,14 +463,49 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
f325b2
         }
f325b2
 
f325b2
         if( nIdx )
f325b2
-            pFlyFormat = GetDoc()->InsertLabel( eType, rText, rSeparator, rNumberSeparator, bBefore, nId,
f325b2
-                                             nIdx, rCharacterStyle, bCpyBrd );
f325b2
+        {
f325b2
+            pFlyFormat = GetDoc()->InsertLabel(eType, rText, rSeparator,
f325b2
+                                               rNumberSeparator, bBefore, nId,
f325b2
+                                               nIdx, rCharacterStyle, bCpyBrd);
f325b2
+
f325b2
+            //if we succeeded in putting a caption on the content, and the
f325b2
+            //content was a frame/graphic, then set the contained element
f325b2
+            //to as-char anchoring because that's all msword is able to
f325b2
+            //do when inside a frame, and in writer for freshly captioned
f325b2
+            //elements it's largely irrelevent what the anchor of the contained
f325b2
+            //type is but making it as-char by default results in very
f325b2
+            //good roundtripping
f325b2
+            if (pFlyFormat && bInnerCntIsFly)
f325b2
+            {
f325b2
+                SwNodeIndex aAnchIdx(*pFlyFormat->GetContent().GetContentIdx(), 1);
f325b2
+                SwTextNode *pTxtNode = aAnchIdx.GetNode().GetTextNode();
f325b2
+
f325b2
+                SwFormatAnchor aAnc(FLY_AS_CHAR);
f325b2
+                sal_Int32 nInsertPos = bBefore ? pTxtNode->Len() : 0;
f325b2
+                SwPosition aPos(*pTxtNode, nInsertPos);
f325b2
+
f325b2
+                aAnc.SetAnchor(&aPos);
f325b2
+
f325b2
+                SfxItemSet aSet(makeItemSetFromFormatAnchor(GetDoc()->GetAttrPool(), aAnc));
f325b2
 
f325b2
-        SwFlyFrm* pFrm;
f325b2
-        const Point aPt( GetCrsrDocPos() );
f325b2
-        if( pFlyFormat && 0 != ( pFrm = pFlyFormat->GetFrm( &aPt )))
f325b2
-            SelectFlyFrm( *pFrm, true );
f325b2
+                SwFlyFrm *pFly = GetSelectedOrCurrFlyFrm();
f325b2
+                SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat();
f325b2
+                GetDoc()->SetFlyFrmAttr(*pInnerFlyFormat, aSet);
f325b2
 
f325b2
+                //put a hard-break after the graphic to keep it separated
f325b2
+                //from the caption text if the outer frame is resized
f325b2
+                SwIndex aIdx(pTxtNode, bBefore ? nInsertPos : 1);
f325b2
+                pTxtNode->InsertText(OUString("\n"), aIdx);
f325b2
+            }
f325b2
+        }
f325b2
+
f325b2
+        if (pFlyFormat)
f325b2
+        {
f325b2
+            const Point aPt(GetCrsrDocPos());
f325b2
+            if (SwFlyFrm* pFrm = pFlyFormat->GetFrm(&aPt))
f325b2
+                SelectFlyFrm(*pFrm, true);
f325b2
+        }
f325b2
+        EndUndo();
f325b2
         EndAllActionAndCall();
f325b2
     }
f325b2
 }
f325b2
@@ -649,7 +687,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
f325b2
     }
f325b2
     else
f325b2
     {
f325b2
-        pFly = FindFlyFrm();
f325b2
+        pFly = GetSelectedFlyFrm();
f325b2
         pFrm = pFly ? pFly->GetAnchorFrm() : GetCurrFrm();
f325b2
     }
f325b2
 
f325b2
@@ -1167,7 +1205,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
f325b2
 Size SwFEShell::GetGraphicDefaultSize() const
f325b2
 {
f325b2
     Size aRet;
f325b2
-    SwFlyFrm *pFly = FindFlyFrm();
f325b2
+    SwFlyFrm *pFly = GetSelectedFlyFrm();
f325b2
     if ( pFly )
f325b2
     {
f325b2
         // #i32951# - due to issue #i28701# no format of a
f325b2
diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx
f325b2
index 8ef9263..f99783a 100644
f325b2
--- a/sw/source/core/inc/UndoInsert.hxx
f325b2
+++ b/sw/source/core/inc/UndoInsert.hxx
f325b2
@@ -203,6 +203,7 @@ public:
f325b2
        @return the rewriter of this undo object
f325b2
      */
f325b2
     virtual SwRewriter GetRewriter() const SAL_OVERRIDE;
f325b2
+    static SwRewriter CreateRewriter(const OUString &rStr);
f325b2
 
f325b2
     void SetNodePos( sal_uLong nNd )
f325b2
         { if( LTYPE_OBJECT != eType ) NODE.nNode = nNd; }
f325b2
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
f325b2
index 58bdcf4..64541bd 100644
f325b2
--- a/sw/source/core/undo/unins.cxx
f325b2
+++ b/sw/source/core/undo/unins.cxx
f325b2
@@ -1014,14 +1014,22 @@ void SwUndoInsertLabel::RepeatImpl(::sw::RepeatContext & rContext)
f325b2
 // #111827#
f325b2
 SwRewriter SwUndoInsertLabel::GetRewriter() const
f325b2
 {
f325b2
+    return CreateRewriter(sText);
f325b2
+}
f325b2
+
f325b2
+SwRewriter SwUndoInsertLabel::CreateRewriter(const OUString &rStr)
f325b2
+{
f325b2
     SwRewriter aRewriter;
f325b2
 
f325b2
     OUString aTmpStr;
f325b2
 
f325b2
-    aTmpStr += SW_RES(STR_START_QUOTE);
f325b2
-    aTmpStr += ShortenString(sText, nUndoStringLength,
f325b2
-                             OUString(SW_RES(STR_LDOTS)));
f325b2
-    aTmpStr += SW_RES(STR_END_QUOTE);
f325b2
+    if (!rStr.isEmpty())
f325b2
+    {
f325b2
+        aTmpStr += SW_RES(STR_START_QUOTE);
f325b2
+        aTmpStr += ShortenString(rStr, nUndoStringLength,
f325b2
+                                 OUString(SW_RES(STR_LDOTS)));
f325b2
+        aTmpStr += SW_RES(STR_END_QUOTE);
f325b2
+    }
f325b2
 
f325b2
     aRewriter.AddRule(UndoArg1, aTmpStr);
f325b2
 
f325b2
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
f325b2
index 77e79af..381fe8b 100644
f325b2
--- a/sw/source/uibase/app/docst.cxx
f325b2
+++ b/sw/source/uibase/app/docst.cxx
f325b2
@@ -129,7 +129,7 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
f325b2
              // so that this family is being showed
f325b2
                 if(pShell->IsFrmSelected())
f325b2
                 {
f325b2
-                    SwFrameFormat* pFormat = pShell->GetCurFrameFormat();
f325b2
+                    SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
f325b2
                     if( pFormat )
f325b2
                         aName = pFormat->GetName();
f325b2
                 }
f325b2
@@ -195,7 +195,7 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
f325b2
                     rSet.DisableItem( nWhich );
f325b2
                 else
f325b2
                 {
f325b2
-                    SwFrameFormat* pFormat = pShell->GetCurFrameFormat();
f325b2
+                    SwFrameFormat* pFormat = pShell->GetSelectedFrameFormat();
f325b2
                     if(pFormat && pShell->IsFrmSelected())
f325b2
                     {
f325b2
                         aName = pFormat->GetName();
f325b2
@@ -429,7 +429,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
f325b2
                         break;
f325b2
                         case SFX_STYLE_FAMILY_FRAME:
f325b2
                         {
f325b2
-                            SwFrameFormat* pFrm = m_pWrtShell->GetCurFrameFormat();
f325b2
+                            SwFrameFormat* pFrm = m_pWrtShell->GetSelectedFrameFormat();
f325b2
                             if( pFrm )
f325b2
                                 aParam = pFrm->GetName();
f325b2
                         }
f325b2
@@ -1177,7 +1177,7 @@ sal_uInt16 SwDocShell::MakeByExample( const OUString &rName, sal_uInt16 nFamily,
f325b2
                 SfxItemSet aSet(GetPool(), aFrameFormatSetRange );
f325b2
                 pCurrWrtShell->GetFlyFrmAttr( aSet );
f325b2
 
f325b2
-                SwFrameFormat* pFFormat = pCurrWrtShell->GetCurFrameFormat();
f325b2
+                SwFrameFormat* pFFormat = pCurrWrtShell->GetSelectedFrameFormat();
f325b2
                 pFrm->SetDerivedFrom( pFFormat );
f325b2
 
f325b2
                 pFrm->SetFormatAttr( aSet );
f325b2
diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx
f325b2
index 0cbea13..55b6d44 100644
f325b2
--- a/sw/source/uibase/ribbar/drawbase.cxx
f325b2
+++ b/sw/source/uibase/ribbar/drawbase.cxx
f325b2
@@ -287,7 +287,7 @@ bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt)
f325b2
                     aCol.Init(m_pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth());
f325b2
                     aSet.Put(aCol);
f325b2
                     // Template AutoUpdate
f325b2
-                    SwFrameFormat* pFormat = m_pSh->GetCurFrameFormat();
f325b2
+                    SwFrameFormat* pFormat = m_pSh->GetSelectedFrameFormat();
f325b2
                     if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
                         m_pSh->AutoUpdateFrame(pFormat, aSet);
f325b2
                     else
f325b2
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
f325b2
index 0a9c64f..360d7c3 100644
f325b2
--- a/sw/source/uibase/shells/basesh.cxx
f325b2
+++ b/sw/source/uibase/shells/basesh.cxx
f325b2
@@ -1008,16 +1008,12 @@ void SwBaseShell::Execute(SfxRequest &rReq)
f325b2
                                             ? FLY_AS_CHAR
f325b2
                                             : FLY_AT_CHAR;
f325b2
             rSh.StartUndo();
f325b2
-            if( rSh.IsObjSelected() )
f325b2
-                rSh.ChgAnchor( eSet );
f325b2
-            else if( rSh.IsFrmSelected() )
f325b2
-            {
f325b2
-                // The set also includes VERT/HORI_ORIENT, because the align
f325b2
-                // shall be changed in FEShell::SetFlyFrmAttr/SetFlyFrmAnchor,
f325b2
-                // possibly as a result of the anchor change.
f325b2
-                SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR );
f325b2
-                SwFormatAnchor aAnc( eSet, rSh.GetPhyPageNum() );
f325b2
-                aSet.Put( aAnc );
f325b2
+            if (rSh.IsObjSelected())
f325b2
+                rSh.ChgAnchor(eSet);
f325b2
+            else if (rSh.IsFrmSelected())
f325b2
+            {
f325b2
+                SwFormatAnchor aAnc(eSet, rSh.GetPhyPageNum());
f325b2
+                SfxItemSet aSet(rSh.makeItemSetFromFormatAnchor(GetPool(), aAnc));
f325b2
                 rSh.SetFlyFrmAttr(aSet);
f325b2
             }
f325b2
             // if new anchor is 'as char' and it is a Math object and the usual
f325b2
@@ -2284,7 +2280,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
f325b2
         if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType))
f325b2
         {
f325b2
             // Template autoupdate
f325b2
-            SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+            SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
 
f325b2
             if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
             {
f325b2
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
f325b2
index 4868fdf..3a4e956 100644
f325b2
--- a/sw/source/uibase/shells/frmsh.cxx
f325b2
+++ b/sw/source/uibase/shells/frmsh.cxx
f325b2
@@ -176,7 +176,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
f325b2
                 aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
f325b2
                 aSet.Put(aCol);
f325b2
                 // Template AutoUpdate
f325b2
-                SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+                SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
                 if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
                 {
f325b2
                     rSh.AutoUpdateFrame(pFormat, aSet);
f325b2
@@ -498,7 +498,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
f325b2
                             rSh.SetObjTitle(static_cast<const SfxStringItem*>(pItem)->GetValue());
f325b2
                         }
f325b2
                         // Template AutoUpdate
f325b2
-                        SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+                        SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
                         if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
                         {
f325b2
                             rSh.AutoUpdateFrame(pFormat, *pOutSet);
f325b2
@@ -644,7 +644,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
f325b2
     }
f325b2
     if ( bUpdateMgr )
f325b2
     {
f325b2
-        SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+        SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
         if ( bCopyToFormat && pFormat && pFormat->IsAutoUpdateFormat() )
f325b2
         {
f325b2
             rSh.AutoUpdateFrame(pFormat, aMgr.GetAttrSet());
f325b2
@@ -1111,7 +1111,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
f325b2
     }
f325b2
     aFrameSet.Put( aBoxItem );
f325b2
     // Template AutoUpdate
f325b2
-    SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+    SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
     if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
     {
f325b2
         rSh.AutoUpdateFrame(pFormat, aFrameSet);
f325b2
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
f325b2
index 39e18fd..60e95f3 100644
f325b2
--- a/sw/source/uibase/shells/grfsh.cxx
f325b2
+++ b/sw/source/uibase/shells/grfsh.cxx
f325b2
@@ -381,7 +381,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
f325b2
                 }
f325b2
 
f325b2
                 // Templates AutoUpdate
f325b2
-                SwFrameFormat* pFormat = rSh.GetCurFrameFormat();
f325b2
+                SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
f325b2
                 if(pFormat && pFormat->IsAutoUpdateFormat())
f325b2
                 {
f325b2
                     pFormat->SetFormatAttr(*pSet);
f325b2
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
f325b2
index 37f0553..ead7e47 100644
f325b2
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
f325b2
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
f325b2
@@ -1709,7 +1709,7 @@ OUString SwWrtShell::GetSelDescr() const
f325b2
         break;
f325b2
     case nsSelectionType::SEL_FRM:
f325b2
         {
f325b2
-            const SwFrameFormat * pFrameFormat = GetCurFrameFormat();
f325b2
+            const SwFrameFormat * pFrameFormat = GetSelectedFrameFormat();
f325b2
 
f325b2
             if (pFrameFormat)
f325b2
                 aResult = pFrameFormat->GetDescription();
f325b2
-- 
f325b2
2.4.0
f325b2