sw: remove CH_TXT_ATR_FORMELEMENT when CheckboxFieldmark is deleted
Change-Id: I5f58b558b15f7d11b75554195e10a258d027bcfc
This commit is contained in:
parent
5bf6797e81
commit
75b2f6b241
3 changed files with 18 additions and 14 deletions
|
@ -357,6 +357,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 )
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue