[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jun 20 09:04:14 PDT 2014


 sw/source/core/doc/textboxhelper.cxx |    2 +-
 sw/source/core/draw/dcontact.cxx     |   27 +++++++++++++++++++--------
 2 files changed, 20 insertions(+), 9 deletions(-)

New commits:
commit 34d4658584ae58b1022f84367a31c234c0e326a3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jun 20 17:48:33 2014 +0200

    SwDrawContact: recaclc textbox size on shape adjustment change as well
    
    Change-Id: I65abec66d56f2bf83e28c85589638cea5f3a7a0c

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 7e70b4e..70f3ef8 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -538,7 +538,7 @@ void SwTextBoxHelper::syncFlyFrmAttr(SwFrmFmt& rShape, SfxItemSet& rSet)
             break;
             default:
                 SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrmAttr: unhandled which-id: " << nWhich);
-            break;
+                break;
             }
 
             if (aIter.IsAtEnd())
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 1c400da..11ffaf8 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1152,6 +1152,19 @@ class NestedUserCallHdl
         }
 };
 
+/// Notify the format's textbox that it should reconsider its position / size.
+void lcl_textBoxSizeNotify(SwFrmFmt* pFmt)
+{
+    if (SwTextBoxHelper::findTextBox(pFmt))
+    {
+        // Just notify the textbox that the size has changed, the actual object size is not interesting.
+        SfxItemSet aResizeSet(pFmt->GetDoc()->GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE, 0);
+        SwFmtFrmSize aSize;
+        aResizeSet.Put(aSize);
+        SwTextBoxHelper::syncFlyFrmAttr(*pFmt, aResizeSet);
+    }
+}
+
 // !!!ATTENTION!!! The object may commit suicide!!!
 
 void SwDrawContact::_Changed( const SdrObject& rObj,
@@ -1385,15 +1398,13 @@ void SwDrawContact::_Changed( const SdrObject& rObj,
                         }
                     }
 
-                    if (SwTextBoxHelper::findTextBox(GetFmt()))
-                    {
-                        // Just notify the textbox that the size has changed, the actual object size is not interesting.
-                        SfxItemSet aResizeSet(GetFmt()->GetDoc()->GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE, 0);
-                        SwFmtFrmSize aSize;
-                        aResizeSet.Put(aSize);
-                        SwTextBoxHelper::syncFlyFrmAttr(*GetFmt(), aResizeSet);
-                    }
+                    lcl_textBoxSizeNotify(GetFmt());
                 }
+                else if (eType == SDRUSERCALL_RESIZE)
+                    // Even if the bounding box of the shape didn't change,
+                    // notify about the size change, as an adjustment change
+                    // may affect the size of the underlying textbox.
+                    lcl_textBoxSizeNotify(GetFmt());
             }
         }
         break;


More information about the Libreoffice-commits mailing list