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

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