Author: alg
Date: Wed Mar 26 12:48:17 2014
New Revision: 1581814

URL: http://svn.apache.org/r1581814
Log:
i124389 correct TextFrame layout for tables not when new text is set, but in 
UNdo/Redo directly for performance reasons

Modified:
    openoffice/trunk/main/svx/source/svdraw/svdotext.cxx
    openoffice/trunk/main/svx/source/svdraw/svdundo.cxx

Modified: openoffice/trunk/main/svx/source/svdraw/svdotext.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdotext.cxx?rev=1581814&r1=1581813&r2=1581814&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdotext.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdotext.cxx Wed Mar 26 12:48:17 
2014
@@ -63,7 +63,6 @@
 #include <drawinglayer/geometry/viewinformation2d.hxx>
 #include <vcl/virdev.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
-#include <svx/svdotable.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -1501,11 +1500,8 @@ void SdrTextObj::NbcSetOutlinerParaObjec
        }
 
        SetTextSizeDirty();
-
-    // #124389# also need to call NbcAdjustTextFrameWidthAndHeight when we are 
a table object (triggered from undo)
-    if((IsTextFrame() || 0 != dynamic_cast< sdr::table::SdrTableObj* >(this)) 
&& (IsAutoGrowHeight() || IsAutoGrowWidth()))
-    { 
-        // adapt text frame
+       if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth()))
+       { // Textrahmen anpassen!
                NbcAdjustTextFrameWidthAndHeight();
        }
        if (!IsTextFrame())

Modified: openoffice/trunk/main/svx/source/svdraw/svdundo.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdundo.cxx?rev=1581814&r1=1581813&r2=1581814&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdundo.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdundo.cxx Wed Mar 26 12:48:17 2014
@@ -46,6 +46,9 @@
 #include <svx/svdograf.hxx>
 #include <svx/sdr/contact/viewcontactofgraphic.hxx>
 
+// #124389#
+#include <svx/svdotable.hxx>
+
 
////////////////////////////////////////////////////////////////////////////////////////////////////
 
 // iterates over all views and unmarks this SdrObject if it is marked
@@ -1187,52 +1190,95 @@ void SdrUndoObjSetText::AfterSetText()
 
 void SdrUndoObjSetText::Undo()
 {
-       // #94278# Trigger PageChangeCall
-       ImpShowPageOfThisObject();
+    // only works with SdrTextObj
+    SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(pObj);
 
-       // alten Text sichern fuer Redo
-       if (!bNewTextAvailable)
-               AfterSetText();
+    if(!pTarget)
+    {
+        OSL_ENSURE(false, "SdrUndoObjSetText::Undo with SdrObject not based on 
SdrTextObj (!)");
+        return;
+    }
+
+    // #94278# Trigger PageChangeCall
+    ImpShowPageOfThisObject();
+
+    // alten Text sichern fuer Redo
+    if(!bNewTextAvailable)
+    {
+        AfterSetText();
+    }
+
+    // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist 
Eigentumsuebereignung
+    OutlinerParaObject* pText1 = pOldText;
+
+    if(pText1)
+    {
+        pText1 = new OutlinerParaObject(*pText1);
+    }
+
+    SdrText* pText = pTarget->getText(mnText);
+
+    if(pText)
+    {
+        pTarget->NbcSetOutlinerParaObjectForText(pText1, pText);
+    }
 
-       // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist 
Eigentumsuebereignung
-       OutlinerParaObject* pText1 = pOldText;
-       if(pText1)
-               pText1 = new OutlinerParaObject(*pText1);
-
-       SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
-       if( pText )
-               static_cast< SdrTextObj* >( pObj 
)->NbcSetOutlinerParaObjectForText( pText1, pText );
+    pTarget->SetEmptyPresObj(bEmptyPresObj);
+    pTarget->ActionChanged();
 
-       pObj->SetEmptyPresObj( bEmptyPresObj );
-       pObj->ActionChanged();
+    // #124389# if it's a table, als oneed to relayout TextFrame
+    if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget))
+    {
+        pTarget->NbcAdjustTextFrameWidthAndHeight();
+    }
 
     // #122410# SetOutlinerParaObject at SdrText does not trigger a
     // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
     // update their preview.
-       pObj->BroadcastObjectChange();
+    pTarget->BroadcastObjectChange();
 }
 
 void SdrUndoObjSetText::Redo()
 {
-       // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist 
Eigentumsuebereignung
-       OutlinerParaObject* pText1 = pNewText;
+    // only works with SdrTextObj
+    SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(pObj);
+
+    if(!pTarget)
+    {
+        OSL_ENSURE(false, "SdrUndoObjSetText::Redo with SdrObject not based on 
SdrTextObj (!)");
+        return;
+    }
+
+    // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist 
Eigentumsuebereignung
+    OutlinerParaObject* pText1 = pNewText;
+
+    if(pText1)
+    {
+        pText1 = new OutlinerParaObject(*pText1);
+    }
 
-       if(pText1)
-               pText1 = new OutlinerParaObject(*pText1);
+    SdrText* pText = pTarget->getText(mnText);
 
-       SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
-       if( pText )
-               static_cast< SdrTextObj* >( pObj 
)->NbcSetOutlinerParaObjectForText( pText1, pText );
+    if(pText)
+    {
+        pTarget->NbcSetOutlinerParaObjectForText(pText1, pText);
+    }
 
-       pObj->ActionChanged();
+    pTarget->ActionChanged();
+
+    // #124389# if it's a table, als oneed to relayout TextFrame
+    if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget))
+    {
+        pTarget->NbcAdjustTextFrameWidthAndHeight();
+    }
 
     // #122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger 
a
     // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
     // update their preview.
-       pObj->BroadcastObjectChange();
+    pTarget->BroadcastObjectChange();
 
-       // #94278# Trigger PageChangeCall
-       ImpShowPageOfThisObject();
+    // #94278# Trigger PageChangeCall
+    ImpShowPageOfThisObject();
 }
 
 XubString SdrUndoObjSetText::GetComment() const


Reply via email to