[Libreoffice-commits] core.git: svx/source
Armin Le Grand
alg at apache.org
Fri Mar 28 06:07:41 PDT 2014
svx/source/svdraw/svdotext.cxx | 7 +----
svx/source/svdraw/svdundo.cxx | 55 ++++++++++++++++++++++++++++++++---------
2 files changed, 46 insertions(+), 16 deletions(-)
New commits:
commit 761ae519d8f36ece0a0cc070e66a1fdfbad27688
Author: Armin Le Grand <alg at apache.org>
Date: Wed Mar 26 12:48:17 2014 +0000
Resolves: #i124389# correct TextFrame layout for tables not...
when new text is set, but in Undo/Redo directly for performance reasons
(cherry picked from commit c55d29bd33ece4b96fd8bf6babcfa4c99dfc468d)
Conflicts:
svx/source/svdraw/svdotext.cxx
svx/source/svdraw/svdundo.cxx
Change-Id: Ie71d85357e2e8378b6df6de42f70188b861b0f76
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index b13c9ea..d3e0330 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -52,7 +52,6 @@
#include <svx/sdr/properties/textproperties.hxx>
#include <vcl/metaact.hxx>
#include <svx/sdr/contact/viewcontactoftextobj.hxx>
-#include <svx/svdotable.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -1442,10 +1441,8 @@ void SdrTextObj::NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObjec
}
SetTextSizeDirty();
- // #i124389# 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()))
+ { // adapt text frame!
NbcAdjustTextFrameWidthAndHeight();
}
if (!IsTextFrame())
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 3090690..328b6f8 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -41,7 +41,7 @@
#include <svx/svdviter.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdr/contact/viewcontactofgraphic.hxx>
-
+#include <svx/svdotable.hxx> // #i124389#
// iterates over all views and unmarks this SdrObject if it is marked
@@ -1193,46 +1193,79 @@ void SdrUndoObjSetText::AfterSetText()
void SdrUndoObjSetText::Undo()
{
+ // only works with SdrTextObj
+ SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(pObj);
+
+ if(!pTarget)
+ {
+ OSL_ENSURE(false, "SdrUndoObjSetText::Undo with SdrObject not based on SdrTextObj (!)");
+ return;
+ }
+
// Trigger PageChangeCall
ImpShowPageOfThisObject();
// save old text for Redo
- if (!bNewTextAvailable)
+ if(!bNewTextAvailable)
+ {
AfterSetText();
+ }
- SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
+ SdrText* pText = pTarget->getText(mnText);
if (pText)
{
// copy text for Undo, because the original now belongs to SetOutlinerParaObject()
OutlinerParaObject* pText1 = pOldText ? new OutlinerParaObject(*pOldText) : NULL;
pText->SetOutlinerParaObject(pText1);
- static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText );
+ pTarget->NbcSetOutlinerParaObjectForText(pText1, pText);
}
- pObj->SetEmptyPresObj( bEmptyPresObj );
- pObj->ActionChanged();
+ pTarget->SetEmptyPresObj(bEmptyPresObj);
+ pTarget->ActionChanged();
+
+ // #i124389# if it's a table, also need to relayout TextFrame
+ if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget))
+ {
+ pTarget->NbcAdjustTextFrameWidthAndHeight();
+ }
// #i122410# 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()
{
- SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
+ // only works with SdrTextObj
+ SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(pObj);
+
+ if(!pTarget)
+ {
+ OSL_ENSURE(false, "SdrUndoObjSetText::Redo with SdrObject not based on SdrTextObj (!)");
+ return;
+ }
+
+ SdrText* pText = pTarget->getText(mnText);
if (pText)
{
// copy text for Undo, because the original now belongs to SetOutlinerParaObject()
OutlinerParaObject* pText1 = pNewText ? new OutlinerParaObject(*pNewText) : NULL;
- static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText );
+ pTarget->NbcSetOutlinerParaObjectForText( pText1, pText );
+ }
+
+ pTarget->ActionChanged();
+
+ // #i124389# if it's a table, als oneed to relayout TextFrame
+ if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget))
+ {
+ pTarget->NbcAdjustTextFrameWidthAndHeight();
}
- pObj->ActionChanged();
// #i122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a
// BroadcastObjectChange, but it is needed to make evtl. SlideSorters
// update their preview.
- pObj->BroadcastObjectChange();
+ pTarget->BroadcastObjectChange();
// Trigger PageChangeCall
ImpShowPageOfThisObject();
More information about the Libreoffice-commits
mailing list