[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/source
Michael Stahl
mstahl at redhat.com
Fri Mar 1 00:49:33 PST 2013
sw/source/core/crsr/bookmrk.cxx | 7 +++++++
sw/source/core/doc/docbm.cxx | 20 +++++++-------------
sw/source/core/inc/bookmrk.hxx | 5 ++++-
3 files changed, 18 insertions(+), 14 deletions(-)
New commits:
commit d10c1b3a54f0264f895c2e5b0056e955f7d07380
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Feb 28 13:27:57 2013 +0100
sw: remove CH_TXT_ATR_FORMELEMENT when CheckboxFieldmark is deleted
Change-Id: I5f58b558b15f7d11b75554195e10a258d027bcfc
(cherry picked from commit 75b2f6b241046d4467a7c0c9cbf49b4533b46045)
Reviewed-on: https://gerrit.libreoffice.org/2467
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 7e84482..a3c5217 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -355,6 +355,13 @@ namespace sw { namespace mark
// want this for checkboxes
this->GetMarkEnd( ).nContent--;
}
+
+ void CheckboxFieldmark::ReleaseDoc(SwDoc* const pDoc)
+ {
+ lcl_RemoveFieldMarks(this, pDoc,
+ CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
+ }
+
void CheckboxFieldmark::SetChecked(bool checked)
{
if ( IsChecked() != checked )
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index afd9fc2..8f785dd 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -670,18 +670,17 @@ namespace sw { namespace mark
#endif
}
- struct LazyTextFieldmarkDeleter : public IDocumentMarkAccess::ILazyDeleter
+ struct LazyFieldmarkDeleter : public IDocumentMarkAccess::ILazyDeleter
{
- ::boost::shared_ptr<IMark> const m_pTextFieldmark;
+ ::boost::shared_ptr<IMark> const m_pFieldmark;
SwDoc *const m_pDoc;
- LazyTextFieldmarkDeleter(
+ LazyFieldmarkDeleter(
::boost::shared_ptr<IMark> const& pMark, SwDoc *const pDoc)
- : m_pTextFieldmark(pMark), m_pDoc(pDoc)
+ : m_pFieldmark(pMark), m_pDoc(pDoc)
{ }
- virtual ~LazyTextFieldmarkDeleter()
+ virtual ~LazyFieldmarkDeleter()
{
- dynamic_cast<TextFieldmark*>(m_pTextFieldmark.get())
- ->ReleaseDoc(m_pDoc);
+ dynamic_cast<Fieldmark *>(m_pFieldmark.get())->ReleaseDoc(m_pDoc);
}
};
@@ -713,12 +712,7 @@ namespace sw { namespace mark
"<MarkManager::deleteMark(..)>"
" - Bookmark not found.");
m_vFieldmarks.erase(ppFieldmark);
- sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
- if (pTextFieldmark)
- {
- ret.reset(
- new LazyTextFieldmarkDeleter(*ppMark, m_pDoc));
- }
+ ret.reset(new LazyFieldmarkDeleter(*ppMark, m_pDoc));
break;
}
case IDocumentMarkAccess::NAVIGATOR_REMINDER:
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 6937a19..d4959b2 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -213,6 +213,8 @@ namespace sw {
virtual void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext)
{ m_aFieldHelptext = aFieldHelptext; }
+ virtual void ReleaseDoc(SwDoc* const) = 0;
+
virtual void Invalidate();
virtual rtl::OUString ToString() const;
@@ -228,7 +230,7 @@ namespace sw {
public:
TextFieldmark(const SwPaM& rPaM);
virtual void InitDoc(SwDoc* const io_pDoc);
- void ReleaseDoc(SwDoc* const pDoc);
+ virtual void ReleaseDoc(SwDoc* const pDoc);
};
class CheckboxFieldmark
@@ -238,6 +240,7 @@ namespace sw {
public:
CheckboxFieldmark(const SwPaM& rPaM);
virtual void InitDoc(SwDoc* const io_pDoc);
+ virtual void ReleaseDoc(SwDoc* const pDoc);
bool IsChecked() const;
void SetChecked(bool checked);
More information about the Libreoffice-commits
mailing list