summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svdstr.hrc8
-rw-r--r--svx/inc/svx/svdundo.hxx36
-rw-r--r--svx/source/svdraw/svdobj.cxx74
-rw-r--r--svx/source/svdraw/svdstr.src14
-rw-r--r--svx/source/svdraw/svdundo.cxx98
5 files changed, 227 insertions, 3 deletions
diff --git a/svx/inc/svdstr.hrc b/svx/inc/svdstr.hrc
index cb1b85079f37..280a9dba6122 100644
--- a/svx/inc/svdstr.hrc
+++ b/svx/inc/svdstr.hrc
@@ -324,7 +324,13 @@
#define STR_UndoNewLayer (STR_UndoBegin +13)
#define STR_UndoDelLayer (STR_UndoBegin +14)
#define STR_UndoMovLayer (STR_UndoBegin +15)
-#define STR_UndoEnd (STR_UndoMovLayer)
+
+// --> OD 2009-07-09 #i73249#
+#define STR_UndoObjName (STR_UndoBegin +16)
+#define STR_UndoObjTitle (STR_UndoBegin +17)
+#define STR_UndoObjDescription (STR_UndoBegin +18)
+// <--
+#define STR_UndoEnd (STR_UndoObjDescription)
#define STR_LayerBegin (STR_UndoEnd+1)
diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx
index f9de0733608d..717b1a070c6f 100644
--- a/svx/inc/svx/svdundo.hxx
+++ b/svx/inc/svx/svdundo.hxx
@@ -484,6 +484,35 @@ public:
virtual bool CanSdrRepeat(SdrView& rView) const;
};
+// --> OD 2009-07-09 #i73249#
+class SdrUndoObjStrAttr : public SdrUndoObj
+{
+public:
+ enum ObjStrAttrType
+ {
+ OBJ_NAME,
+ OBJ_TITLE,
+ OBJ_DESCRIPTION
+ };
+
+protected:
+ const ObjStrAttrType meObjStrAttr;
+ const String msOldStr;
+ const String msNewStr;
+
+public:
+ SdrUndoObjStrAttr( SdrObject& rNewObj,
+ const ObjStrAttrType eObjStrAttr,
+ const String& sOldStr,
+ const String& sNewStr);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+// <--
+
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// @@ @@@@ @@ @@ @@@@@ @@@@@
@@ -827,6 +856,13 @@ public:
virtual SdrUndoAction* CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer );
virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
+ // --> OD 2009-07-09 #i73249#
+ virtual SdrUndoAction* CreateUndoObjectStrAttr( SdrObject& rObject,
+ SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
+ String sOldStr,
+ String sNewStr );
+ // <--
+
// layer
virtual SdrUndoAction* CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
virtual SdrUndoAction* CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index e272a51a4a7a..7ba4aec3e565 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -129,6 +129,10 @@
#include "svx/shapepropertynotifier.hxx"
#include <svx/sdrhittesthelper.hxx>
+// --> OD 2009-07-10 #i73249#
+#include <svx/svdundo.hxx>
+// <--
+
using namespace ::com::sun::star;
// #104018# replace macros above with type-detecting methods
@@ -759,7 +763,29 @@ void SdrObject::SetName(const String& rStr)
if(pPlusData && pPlusData->aObjName != rStr)
{
+ // --> OD 2009-07-09 #i73249#
+ // Undo/Redo for setting object's name
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_NAME,
+ GetName(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
pPlusData->aObjName = rStr;
+ // --> OD 2009-07-09 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
SetChanged();
BroadcastObjectChange();
}
@@ -784,7 +810,29 @@ void SdrObject::SetTitle(const String& rStr)
if(pPlusData && pPlusData->aObjTitle != rStr)
{
+ // --> OD 2009-07-13 #i73249#
+ // Undo/Redo for setting object's title
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_TITLE,
+ GetTitle(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
pPlusData->aObjTitle = rStr;
+ // --> OD 2009-07-13 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
SetChanged();
BroadcastObjectChange();
}
@@ -809,7 +857,29 @@ void SdrObject::SetDescription(const String& rStr)
if(pPlusData && pPlusData->aObjDescription != rStr)
{
+ // --> OD 2009-07-13 #i73249#
+ // Undo/Redo for setting object's description
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_DESCRIPTION,
+ GetDescription(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
pPlusData->aObjDescription = rStr;
+ // --> OD 2009-07-13 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
SetChanged();
BroadcastObjectChange();
}
@@ -2863,8 +2933,8 @@ void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUn
{
maWeakUnoShape = _rxUnoShape;
mpSvxShape = SvxShape::getImplementation( _rxUnoShape );
- OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(),
- "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." );
+// OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(),
+// "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." );
}
/** only for internal use! */
diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src
index 32c457cf3d02..144db41d515f 100644
--- a/svx/source/svdraw/svdstr.src
+++ b/svx/source/svdraw/svdstr.src
@@ -1127,6 +1127,20 @@ String STR_UndoMovLayer
{
Text [ en-US ] = "Change order of layers" ;
};
+// --> OD 2009-07-09 #i73249#
+String STR_UndoObjName
+{
+ Text [ en-US ] = "Change object name of %1 to" ;
+};
+String STR_UndoObjTitle
+{
+ Text [ en-US ] = "Change object title of %1" ;
+};
+String STR_UndoObjDescription
+{
+ Text [ en-US ] = "Change object description of %1" ;
+};
+// <--
String STR_StandardLayerName
{
Text [ en-US ] = "Standard" ;
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index b49d087d0251..08cee1eb17d3 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -1219,6 +1219,95 @@ bool SdrUndoObjSetText::CanSdrRepeat(SdrView& rView) const
return bOk;
}
+// --> OD 2009-07-09 #i73249#
+SdrUndoObjStrAttr::SdrUndoObjStrAttr( SdrObject& rNewObj,
+ const ObjStrAttrType eObjStrAttr,
+ const String& sOldStr,
+ const String& sNewStr)
+ : SdrUndoObj( rNewObj ),
+ meObjStrAttr( eObjStrAttr ),
+ msOldStr( sOldStr ),
+ msNewStr( sNewStr )
+{
+}
+
+void SdrUndoObjStrAttr::Undo()
+{
+ ImpShowPageOfThisObject();
+
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ pObj->SetName( msOldStr );
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ pObj->SetTitle( msOldStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ pObj->SetDescription( msOldStr );
+ }
+ break;
+ }
+}
+
+void SdrUndoObjStrAttr::Redo()
+{
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ pObj->SetName( msNewStr );
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ pObj->SetTitle( msNewStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ pObj->SetDescription( msNewStr );
+ }
+ break;
+ }
+
+ ImpShowPageOfThisObject();
+}
+
+String SdrUndoObjStrAttr::GetComment() const
+{
+ String aStr;
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjName, aStr );
+ aStr += sal_Unicode(' ');
+ aStr += sal_Unicode('\'');
+ aStr += msNewStr;
+ aStr += sal_Unicode('\'');
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjTitle, aStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjDescription, aStr );
+ }
+ break;
+ }
+
+ return aStr;
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
//
@@ -1726,6 +1815,15 @@ SdrUndoAction* SdrUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_
return new SdrUndoObjSetText( rNewObj, nText );
}
+SdrUndoAction* SdrUndoFactory::CreateUndoObjectStrAttr( SdrObject& rObject,
+ SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
+ String sOldStr,
+ String sNewStr )
+{
+ return new SdrUndoObjStrAttr( rObject, eObjStrAttrType, sOldStr, sNewStr );
+}
+
+
// layer
SdrUndoAction* SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
{