summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-10 23:24:00 +0200
committerEike Rathke <erack@redhat.com>2017-04-10 23:31:59 +0200
commit98940fc97fe134af332bd0f9d41ec76e21bc521c (patch)
treef3463aefea09e4e7b8a4f8098f0a97c4adfa4afe
parent71f942731b5cec0abb7eecfe5e8dad9b516cd213 (diff)
introduce ScCaptionPtr InUndo
Change-Id: Iccc2671b61f524244107233b77b56aaa45f5c72a
-rw-r--r--sc/inc/postit.hxx11
-rw-r--r--sc/source/core/data/postit.cxx13
2 files changed, 20 insertions, 4 deletions
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 993de2af6565..a630aef271db 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -85,6 +85,9 @@ public:
*/
bool forget();
+ /** Flag that this instance is in Undo, so drawing layer owns it. */
+ void setInUndo();
+
oslInterlockedCount getRefs() const;
private:
@@ -101,6 +104,14 @@ private:
Head* mpHead; ///< points to the "master" entry
mutable ScCaptionPtr* mpNext; ///< next in list
SdrCaptionObj* mpCaption; ///< the caption object, managed by head master
+ bool mbInUndo; ///< whether this caption object is held in Undo
+ /* TODO: can that be moved to Head?
+ * It's unclear when to reset, so
+ * each instance has its own flag.
+ * The last reference count
+ * decrement automatically has the
+ * then current state available.
+ * */
void newHead(); //< Allocate a new Head and init.
void incRef() const;
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 524328ea0a81..67efdf202648 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -445,12 +445,12 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& r
ScCaptionPtr::ScCaptionPtr() :
- mpHead(nullptr), mpNext(nullptr), mpCaption(nullptr)
+ mpHead(nullptr), mpNext(nullptr), mpCaption(nullptr), mbInUndo(false)
{
}
ScCaptionPtr::ScCaptionPtr( SdrCaptionObj* p ) :
- mpHead(nullptr), mpNext(nullptr), mpCaption(p)
+ mpHead(nullptr), mpNext(nullptr), mpCaption(p), mbInUndo(false)
{
if (p)
{
@@ -459,7 +459,7 @@ ScCaptionPtr::ScCaptionPtr( SdrCaptionObj* p ) :
}
ScCaptionPtr::ScCaptionPtr( const ScCaptionPtr& r ) :
- mpHead(r.mpHead), mpCaption(r.mpCaption)
+ mpHead(r.mpHead), mpCaption(r.mpCaption), mbInUndo(false)
{
if (r.mpCaption)
{
@@ -477,7 +477,7 @@ ScCaptionPtr::ScCaptionPtr( const ScCaptionPtr& r ) :
}
ScCaptionPtr::ScCaptionPtr( ScCaptionPtr&& r ) :
- mpHead(r.mpHead), mpNext(r.mpNext), mpCaption(r.mpCaption)
+ mpHead(r.mpHead), mpNext(r.mpNext), mpCaption(r.mpCaption), mbInUndo(false)
{
r.replaceInList( this );
r.mpCaption = nullptr;
@@ -534,6 +534,11 @@ ScCaptionPtr& ScCaptionPtr::operator=( const ScCaptionPtr& r )
return *this;
}
+void ScCaptionPtr::setInUndo()
+{
+ mbInUndo = true;
+}
+
ScCaptionPtr::Head::Head( ScCaptionPtr* p ) :
mpFirst(p), mnRefs(1)
{