Kaydet (Commit) 761ae519 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

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 c55d29bd)

Conflicts:
	svx/source/svdraw/svdotext.cxx
	svx/source/svdraw/svdundo.cxx

Change-Id: Ie71d85357e2e8378b6df6de42f70188b861b0f76
üst 62175dfc
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include <svx/sdr/properties/textproperties.hxx> #include <svx/sdr/properties/textproperties.hxx>
#include <vcl/metaact.hxx> #include <vcl/metaact.hxx>
#include <svx/sdr/contact/viewcontactoftextobj.hxx> #include <svx/sdr/contact/viewcontactoftextobj.hxx>
#include <svx/svdotable.hxx>
#include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygon.hxx>
...@@ -1442,10 +1441,8 @@ void SdrTextObj::NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObjec ...@@ -1442,10 +1441,8 @@ void SdrTextObj::NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObjec
} }
SetTextSizeDirty(); SetTextSizeDirty();
// #i124389# also need to call NbcAdjustTextFrameWidthAndHeight when we are a table object (triggered from undo) if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth()))
if((IsTextFrame() || 0 != dynamic_cast< sdr::table::SdrTableObj* >(this)) && (IsAutoGrowHeight() || IsAutoGrowWidth())) { // adapt text frame!
{
// adapt text frame
NbcAdjustTextFrameWidthAndHeight(); NbcAdjustTextFrameWidthAndHeight();
} }
if (!IsTextFrame()) if (!IsTextFrame())
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <svx/svdviter.hxx> #include <svx/svdviter.hxx>
#include <svx/svdograf.hxx> #include <svx/svdograf.hxx>
#include <svx/sdr/contact/viewcontactofgraphic.hxx> #include <svx/sdr/contact/viewcontactofgraphic.hxx>
#include <svx/svdotable.hxx> // #i124389#
// iterates over all views and unmarks this SdrObject if it is marked // iterates over all views and unmarks this SdrObject if it is marked
...@@ -1193,46 +1193,79 @@ void SdrUndoObjSetText::AfterSetText() ...@@ -1193,46 +1193,79 @@ void SdrUndoObjSetText::AfterSetText()
void SdrUndoObjSetText::Undo() 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 // Trigger PageChangeCall
ImpShowPageOfThisObject(); ImpShowPageOfThisObject();
// save old text for Redo // save old text for Redo
if (!bNewTextAvailable) if(!bNewTextAvailable)
{
AfterSetText(); AfterSetText();
}
SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText); SdrText* pText = pTarget->getText(mnText);
if (pText) if (pText)
{ {
// copy text for Undo, because the original now belongs to SetOutlinerParaObject() // copy text for Undo, because the original now belongs to SetOutlinerParaObject()
OutlinerParaObject* pText1 = pOldText ? new OutlinerParaObject(*pOldText) : NULL; OutlinerParaObject* pText1 = pOldText ? new OutlinerParaObject(*pOldText) : NULL;
pText->SetOutlinerParaObject(pText1); pText->SetOutlinerParaObject(pText1);
static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText ); pTarget->NbcSetOutlinerParaObjectForText(pText1, pText);
} }
pObj->SetEmptyPresObj( bEmptyPresObj ); pTarget->SetEmptyPresObj(bEmptyPresObj);
pObj->ActionChanged(); 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 // #i122410# SetOutlinerParaObject at SdrText does not trigger a
// BroadcastObjectChange, but it is needed to make evtl. SlideSorters // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
// update their preview. // update their preview.
pObj->BroadcastObjectChange(); pTarget->BroadcastObjectChange();
} }
void SdrUndoObjSetText::Redo() 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) if (pText)
{ {
// copy text for Undo, because the original now belongs to SetOutlinerParaObject() // copy text for Undo, because the original now belongs to SetOutlinerParaObject()
OutlinerParaObject* pText1 = pNewText ? new OutlinerParaObject(*pNewText) : NULL; 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 // #i122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a
// BroadcastObjectChange, but it is needed to make evtl. SlideSorters // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
// update their preview. // update their preview.
pObj->BroadcastObjectChange(); pTarget->BroadcastObjectChange();
// Trigger PageChangeCall // Trigger PageChangeCall
ImpShowPageOfThisObject(); ImpShowPageOfThisObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment