summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail..com>2019-08-15 00:31:25 -0800
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-28 10:22:59 +0100
commit9f86b320a997c77069cf93dcb32fb71f09ad1348 (patch)
treec7767f9da6a3fbd465d80f36fee8ec2a9bd567fa /include
parent2d8efd1afe03a4009600e914910144b70982e98d (diff)
tdf#125191 Give object copies unique names
This patch makes a unique name for a copy of an object having a user given name. Change-Id: I14a7f45cc02962fc34a1532dd5db1cb9657b41d3 Reviewed-on: https://gerrit.libreoffice.org/77500 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/svx/svdmodel.hxx7
-rw-r--r--include/svx/svdobj.hxx3
-rw-r--r--include/svx/svdpage.hxx5
3 files changed, 15 insertions, 0 deletions
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index d5c14c0baa57..8153e4f915cc 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -260,6 +260,9 @@ private:
// this is a weak reference to a possible living api wrapper for this model
css::uno::Reference< css::uno::XInterface > mxUnoModel;
+ // used to disable unique name checking during page move
+ bool mbMakePageObjectsNamesUnique = true;
+
public:
SVX_DLLPRIVATE virtual bool IsCreatingDataObj() const { return false; }
bool IsTransportContainer() const { return bTransportContainer; }
@@ -597,6 +600,10 @@ public:
also during the runtime of the Undo() and Redo() methods. */
bool IsUndoEnabled() const;
+ // used to prevent object name change during page move
+ bool DoesMakePageObjectsNamesUnique() const { return mbMakePageObjectsNamesUnique; }
+ void DoMakePageObjectsNamesUnique(bool bDo) { mbMakePageObjectsNamesUnique = bDo; }
+
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 97f082563281..3d0699b3f63c 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -38,6 +38,8 @@
#include <osl/diagnose.h>
#include <typeinfo>
+#include <unordered_set>
+
class SfxBroadcaster;
class AutoTimer;
class OutlinerParaObject;
@@ -425,6 +427,7 @@ public:
// It may also have a Title and a Description for accessibility purposes.
void SetName(const OUString& rStr);
OUString GetName() const;
+ void MakeNameUnique(std::unordered_set<OUString>& rNameSet);
void SetTitle(const OUString& rStr);
OUString GetTitle() const;
void SetDescription(const OUString& rStr);
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 60cf0bb49004..cdeb74d3714b 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -110,6 +110,9 @@ public:
virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE);
virtual void sort( std::vector<sal_Int32>& sortOrder );
+ void InsertObjectThenMakeNameUnique(SdrObject* pObj);
+ void InsertObjectThenMakeNameUnique(SdrObject* pObj, std::unordered_set<rtl::OUString>& rNameSet, size_t nPos=SAL_MAX_SIZE);
+
/// remove from list without delete
virtual SdrObject* NbcRemoveObject(size_t nObjNum);
virtual SdrObject* RemoveObject(size_t nObjNum);
@@ -487,6 +490,8 @@ public:
void TRG_SetMasterPageVisibleLayers(const SdrLayerIDSet& rNew);
sdr::contact::ViewContact& TRG_GetMasterPageDescriptorViewContact() const;
+ void MakePageObjectsNamesUnique();
+
protected:
void TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage);
public: