LibreOffice Module sw (master)  1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sw::mark::MarkManager Class Reference

#include <MarkManager.hxx>

Inheritance diagram for sw::mark::MarkManager:
[legend]
Collaboration diagram for sw::mark::MarkManager:
[legend]

Public Types

typedef std::vector< sw::mark::MarkBase * > container_t
 
- Public Types inherited from IDocumentMarkAccess
enum  MarkType {
  MarkType::UNO_BOOKMARK,
  MarkType::DDE_BOOKMARK,
  MarkType::BOOKMARK,
  MarkType::CROSSREF_HEADING_BOOKMARK,
  MarkType::CROSSREF_NUMITEM_BOOKMARK,
  MarkType::ANNOTATIONMARK,
  MarkType::TEXT_FIELDMARK,
  MarkType::CHECKBOX_FIELDMARK,
  MarkType::DROPDOWN_FIELDMARK,
  MarkType::DATE_FIELDMARK,
  MarkType::NAVIGATOR_REMINDER
}
 
typedef iterator const_iterator_t
 

Public Member Functions

 MarkManager (SwDoc &rDoc)
 
virtual ::sw::mark::IMarkmakeMark (const SwPaM &rPaM, const OUString &rName, IDocumentMarkAccess::MarkType eMark, sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr) override
 
virtual sw::mark::IFieldmarkmakeFieldBookmark (const SwPaM &rPaM, const OUString &rName, const OUString &rType, SwPosition const *pSepPos=nullptr) override
 
virtual sw::mark::IFieldmarkmakeNoTextFieldBookmark (const SwPaM &rPaM, const OUString &rName, const OUString &rType) override
 
virtual ::sw::mark::IMarkgetMarkForTextNode (const SwTextNode &rTextNode, IDocumentMarkAccess::MarkType eMark) override
 Returns a mark in the document for a paragraph. More...
 
virtual sw::mark::IMarkmakeAnnotationMark (const SwPaM &rPaM, const OUString &rName) override
 
virtual void repositionMark (::sw::mark::IMark *io_pMark, const SwPaM &rPaM) override
 Moves an existing mark to a new selection and performs needed updates. More...
 
virtual bool renameMark (::sw::mark::IMark *io_pMark, const OUString &rNewName) override
 Renames an existing Mark, if possible. More...
 
virtual void correctMarksAbsolute (const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset) override
 Corrects marks (absolute) This method ignores the previous position of the mark in the paragraph. More...
 
virtual void correctMarksRelative (const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset) override
 Corrects marks (relative) This method uses the previous position of the mark in the paragraph as offset. More...
 
virtual void deleteMarks (const SwNodeIndex &rStt, const SwNodeIndex &rEnd, std::vector< ::sw::mark::SaveBookmark > *pSaveBkmk, const SwIndex *pSttIdx, const SwIndex *pEndIdx) override
 Deletes marks in a range. More...
 
virtual std::unique_ptr< ILazyDeleterdeleteMark (const const_iterator_t &ppMark) override
 Deletes a mark. More...
 
virtual void deleteMark (const ::sw::mark::IMark *const pMark) override
 Deletes a mark. More...
 
virtual void clearAllMarks () override
 Clear (deletes) all marks. More...
 
virtual const_iterator_t getAllMarksBegin () const override
 returns a STL-like random access iterator to the begin of the sequence of marks. More...
 
virtual const_iterator_t getAllMarksEnd () const override
 returns a STL-like random access iterator to the end of the sequence of marks. More...
 
virtual sal_Int32 getAllMarksCount () const override
 returns the number of marks. More...
 
virtual const_iterator_t findMark (const OUString &rName) const override
 Finds a mark by name. More...
 
virtual const_iterator_t getBookmarksBegin () const override
 returns a STL-like random access iterator to the begin of the sequence the IBookmarks. More...
 
virtual const_iterator_t getBookmarksEnd () const override
 returns a STL-like random access iterator to the end of the sequence of IBookmarks. More...
 
virtual sal_Int32 getBookmarksCount () const override
 returns the number of IBookmarks. More...
 
virtual const_iterator_t findBookmark (const OUString &rName) const override
 Finds a bookmark by name. More...
 
virtual const_iterator_t findFirstBookmarkStartsAfter (const SwPosition &rPos) const override
 Finds the first mark that is starting after. More...
 
virtual ::sw::mark::IFieldmarkgetFieldmarkAt (const SwPosition &rPos) const override
 get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos More...
 
virtual ::sw::mark::IFieldmarkgetFieldmarkFor (const SwPosition &rPos) const override
 
virtual ::sw::mark::IFieldmarkgetFieldmarkBefore (const SwPosition &rPos) const override
 
virtual ::sw::mark::IFieldmarkgetFieldmarkAfter (const SwPosition &rPos) const override
 
virtual ::sw::mark::IFieldmarkgetDropDownFor (const SwPosition &rPos) const override
 
virtual std::vector< ::sw::mark::IFieldmark * > getDropDownsFor (const SwPaM &rPaM) const override
 
virtual void deleteFieldmarkAt (const SwPosition &rPos) override
 
virtual ::sw::mark::IFieldmarkchangeFormFieldmarkType (::sw::mark::IFieldmark *pFieldmark, const OUString &rNewType) override
 
virtual void NotifyCursorUpdate (const SwCursorShell &rCursorShell) override
 
virtual void ClearFieldActivation () override
 
void dumpAsXml (xmlTextWriterPtr pWriter) const
 
virtual const_iterator_t getAnnotationMarksBegin () const override
 
virtual const_iterator_t getAnnotationMarksEnd () const override
 
virtual sal_Int32 getAnnotationMarksCount () const override
 
virtual const_iterator_t findAnnotationMark (const OUString &rName) const override
 
virtual sw::mark::IMarkgetAnnotationMarkFor (const SwPosition &rPos) const override
 
virtual const_iterator_t findFirstAnnotationStartsAfter (const SwPosition &rPos) const override
 Finds the first mark that is starting after. More...
 
virtual void assureSortedMarkContainers () const override
 
- Public Member Functions inherited from IDocumentMarkAccess
virtual ::sw::mark::IMarkmakeMark (const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark,::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
 Generates a new mark in the document for a certain selection. More...
 

Private Member Functions

 MarkManager (MarkManager const &)=delete
 
MarkManageroperator= (MarkManager const &)=delete
 
OUString getUniqueMarkName (const OUString &rName) const
 
void sortSubsetMarks ()
 
void sortMarks ()
 

Private Attributes

container_t m_vAllMarks
 
container_t m_vBookmarks
 
container_t m_vFieldmarks
 
MarkBasenameMapUniqueOffset_t m_aMarkBasenameMapUniqueOffset
 
container_t m_vAnnotationMarks
 
SwDoc *const m_pDoc
 
sw::mark::FieldmarkWithDropDownButtonm_pLastActiveFieldmark
 

Additional Inherited Members

- Static Public Member Functions inherited from IDocumentMarkAccess
static SW_DLLPUBLIC MarkType GetType (const ::sw::mark::IMark &rMark)
 Returns the MarkType used to create the mark. More...
 
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix ()
 
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark (const SwPaM &rPaM)
 
static void DeleteFieldmarkCommand (::sw::mark::IFieldmark const &rMark)
 
- Protected Member Functions inherited from IDocumentMarkAccess
virtual ~IDocumentMarkAccess ()
 

Detailed Description

Definition at line 36 of file MarkManager.hxx.

Member Typedef Documentation

Definition at line 114 of file MarkManager.hxx.

Constructor & Destructor Documentation

sw::mark::MarkManager::MarkManager ( SwDoc rDoc)

Definition at line 535 of file docbm.cxx.

sw::mark::MarkManager::MarkManager ( MarkManager const &  )
privatedelete

Member Function Documentation

void sw::mark::MarkManager::assureSortedMarkContainers ( ) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1544 of file docbm.cxx.

References sortMarks().

sw::mark::IFieldmark * sw::mark::MarkManager::changeFormFieldmarkType ( ::sw::mark::IFieldmark pFieldmark,
const OUString &  rNewType 
)
overridevirtual
void sw::mark::MarkManager::clearAllMarks ( )
overridevirtual

Clear (deletes) all marks.

Implements IDocumentMarkAccess.

Definition at line 1230 of file docbm.cxx.

References ClearFieldActivation(), m_vAllMarks, m_vAnnotationMarks, m_vBookmarks, and m_vFieldmarks.

void sw::mark::MarkManager::ClearFieldActivation ( )
overridevirtual
void sw::mark::MarkManager::correctMarksAbsolute ( const SwNodeIndex rOldNode,
const SwPosition rNewPos,
const sal_Int32  nOffset 
)
overridevirtual

Corrects marks (absolute) This method ignores the previous position of the mark in the paragraph.

Parameters
rOldNode[in] the node from which nodes should be moved
rNewPos[in] new position to which marks will be moved, if nOffset == 0
nOffset[in] the offset by which the mark gets positioned of rNewPos

Implements IDocumentMarkAccess.

Definition at line 834 of file docbm.cxx.

References sw::mark::MarkBase::GetMarkPos(), SwNodeIndex::GetNode(), sw::mark::MarkBase::GetOtherMarkPos(), sw::mark::MarkBase::IsExpanded(), m_vAllMarks, SwPosition::nContent, SwPosition::nNode, SAL_INFO, sw::mark::MarkBase::SetMarkPos(), sw::mark::MarkBase::SetOtherMarkPos(), and sortMarks().

void sw::mark::MarkManager::correctMarksRelative ( const SwNodeIndex rOldNode,
const SwPosition rNewPos,
const sal_Int32  nOffset 
)
overridevirtual

Corrects marks (relative) This method uses the previous position of the mark in the paragraph as offset.

Parameters
rOldNode[in] the node from which nodes should be moved
rNewPos[in] new position to which marks from the start of the paragraph will be moved, if nOffset == 0
nOffset[in] the offset by which the mark gets positioned of rNewPos in addition to its old position in the paragraph

Implements IDocumentMarkAccess.

Definition at line 880 of file docbm.cxx.

References SwIndex::GetIndex(), sw::mark::MarkBase::GetMarkPos(), SwNodeIndex::GetNode(), sw::mark::MarkBase::GetOtherMarkPos(), sw::mark::MarkBase::IsExpanded(), m_vAllMarks, SwPosition::nContent, SwPosition::nNode, SAL_INFO, sw::mark::MarkBase::SetMarkPos(), sw::mark::MarkBase::SetOtherMarkPos(), and sortMarks().

void sw::mark::MarkManager::deleteFieldmarkAt ( const SwPosition rPos)
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1318 of file docbm.cxx.

References deleteMark(), getFieldmarkAt(), and m_vAllMarks.

Referenced by changeFormFieldmarkType().

std::unique_ptr< IDocumentMarkAccess::ILazyDeleter > sw::mark::MarkManager::deleteMark ( const const_iterator_t ppMark)
overridevirtual
virtual void sw::mark::MarkManager::deleteMark ( const ::sw::mark::IMark *const  pMark)
overridevirtual

Deletes a mark.

Parameters
ppMark[in] the name of the mark to be deleted.

Implements IDocumentMarkAccess.

void sw::mark::MarkManager::deleteMarks ( const SwNodeIndex rStt,
const SwNodeIndex rEnd,
std::vector< ::sw::mark::SaveBookmark > *  pSaveBkmk,
const SwIndex pSttIdx,
const SwIndex pEndIdx 
)
overridevirtual
void sw::mark::MarkManager::dumpAsXml ( xmlTextWriterPtr  pWriter) const

Definition at line 1562 of file docbm.cxx.

References m_vAllMarks, m_vAnnotationMarks, m_vBookmarks, and m_vFieldmarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::findAnnotationMark ( const OUString &  rName) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1478 of file docbm.cxx.

References m_vAnnotationMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::findBookmark ( const OUString &  rMark) const
overridevirtual

Finds a bookmark by name.

Parameters
rName[in] the name of the bookmark to find.
Returns
an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found.

Implements IDocumentMarkAccess.

Definition at line 1247 of file docbm.cxx.

References m_vBookmarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::findFirstAnnotationStartsAfter ( const SwPosition rPos) const
overridevirtual

Finds the first mark that is starting after.

Returns
an iterator pointing to the mark, or pointing to getAnnotationMarksEnd() if nothing was found.

Implements IDocumentMarkAccess.

Definition at line 1496 of file docbm.cxx.

References m_vAnnotationMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::findFirstBookmarkStartsAfter ( const SwPosition rPos) const
overridevirtual

Finds the first mark that is starting after.

Returns
an iterator pointing to the mark, or pointing to getBookmarksEnd() if nothing was found.

Implements IDocumentMarkAccess.

Definition at line 1272 of file docbm.cxx.

References m_vBookmarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::findMark ( const OUString &  rMark) const
overridevirtual

Finds a mark by name.

Parameters
rName[in] the name of the mark to find.
Returns
an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found.

Implements IDocumentMarkAccess.

Definition at line 1241 of file docbm.cxx.

References m_vAllMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getAllMarksBegin ( ) const
overridevirtual

returns a STL-like random access iterator to the begin of the sequence of marks.

Implements IDocumentMarkAccess.

Definition at line 1253 of file docbm.cxx.

References m_vAllMarks.

sal_Int32 sw::mark::MarkManager::getAllMarksCount ( ) const
overridevirtual

returns the number of marks.

Note: annotation marks are excluded

Implements IDocumentMarkAccess.

Definition at line 1259 of file docbm.cxx.

References m_vAllMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getAllMarksEnd ( ) const
overridevirtual

returns a STL-like random access iterator to the end of the sequence of marks.

Implements IDocumentMarkAccess.

Definition at line 1256 of file docbm.cxx.

References m_vAllMarks.

IMark * sw::mark::MarkManager::getAnnotationMarkFor ( const SwPosition rPos) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1484 of file docbm.cxx.

References sw::mark::IMark::IsCoveringPosition(), and m_vAnnotationMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getAnnotationMarksBegin ( ) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1463 of file docbm.cxx.

References m_vAnnotationMarks.

sal_Int32 sw::mark::MarkManager::getAnnotationMarksCount ( ) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1473 of file docbm.cxx.

References m_vAnnotationMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getAnnotationMarksEnd ( ) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1468 of file docbm.cxx.

References m_vAnnotationMarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getBookmarksBegin ( ) const
overridevirtual

returns a STL-like random access iterator to the begin of the sequence the IBookmarks.

Implements IDocumentMarkAccess.

Definition at line 1262 of file docbm.cxx.

References m_vBookmarks.

sal_Int32 sw::mark::MarkManager::getBookmarksCount ( ) const
overridevirtual

returns the number of IBookmarks.

Implements IDocumentMarkAccess.

Definition at line 1268 of file docbm.cxx.

References m_vBookmarks.

IDocumentMarkAccess::const_iterator_t sw::mark::MarkManager::getBookmarksEnd ( ) const
overridevirtual

returns a STL-like random access iterator to the end of the sequence of IBookmarks.

Implements IDocumentMarkAccess.

Definition at line 1265 of file docbm.cxx.

References m_vBookmarks.

IFieldmark * sw::mark::MarkManager::getDropDownFor ( const SwPosition rPos) const
overridevirtual
std::vector< IFieldmark * > sw::mark::MarkManager::getDropDownsFor ( const SwPaM rPaM) const
overridevirtual
IFieldmark * sw::mark::MarkManager::getFieldmarkAfter ( const SwPosition rPos) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1457 of file docbm.cxx.

References m_vFieldmarks.

IFieldmark * sw::mark::MarkManager::getFieldmarkAt ( const SwPosition rPos) const
overridevirtual

get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos

Implements IDocumentMarkAccess.

Definition at line 1281 of file docbm.cxx.

References SwIndex::GetIndex(), sw::mark::IMark::GetMarkEnd(), sw::mark::IMark::GetMarkStart(), m_vFieldmarks, SwPosition::nContent, and SwPosition::nNode.

Referenced by deleteFieldmarkAt(), and getDropDownFor().

IFieldmark * sw::mark::MarkManager::getFieldmarkBefore ( const SwPosition rPos) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1460 of file docbm.cxx.

References m_vFieldmarks.

IFieldmark * sw::mark::MarkManager::getFieldmarkFor ( const SwPosition rPos) const
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 1297 of file docbm.cxx.

References sw::mark::IMark::IsCoveringPosition(), and m_vFieldmarks.

Referenced by NotifyCursorUpdate().

sw::mark::IMark * sw::mark::MarkManager::getMarkForTextNode ( const SwTextNode rTextNode,
IDocumentMarkAccess::MarkType  eMark 
)
overridevirtual

Returns a mark in the document for a paragraph.

If there is none, a mark will be created.

Parameters
rTextNode[in] the paragraph being marked (a selection over the paragraph is marked)
eMark[in] the type of the new mark.
Returns
a pointer to the new mark (name might have changed).

Implements IDocumentMarkAccess.

Definition at line 761 of file docbm.cxx.

References SwIndex::Assign(), m_vBookmarks, makeMark(), SwPosition::nContent, and sw::mark::New.

OUString sw::mark::MarkManager::getUniqueMarkName ( const OUString &  rName) const
private
sw::mark::IMark * sw::mark::MarkManager::makeAnnotationMark ( const SwPaM rPaM,
const OUString &  rName 
)
overridevirtual

Implements IDocumentMarkAccess.

Definition at line 774 of file docbm.cxx.

References IDocumentMarkAccess::ANNOTATIONMARK, makeMark(), and sw::mark::New.

sw::mark::IFieldmark * sw::mark::MarkManager::makeFieldBookmark ( const SwPaM rPaM,
const OUString &  rName,
const OUString &  rType,
SwPosition const *  pSepPos = nullptr 
)
overridevirtual
sw::mark::IMark * sw::mark::MarkManager::makeMark ( const SwPaM rPaM,
const OUString &  rName,
IDocumentMarkAccess::MarkType  eMark,
sw::mark::InsertMode  eMode,
SwPosition const *  pSepPos = nullptr 
)
override
sw::mark::IFieldmark * sw::mark::MarkManager::makeNoTextFieldBookmark ( const SwPaM rPaM,
const OUString &  rName,
const OUString &  rType 
)
overridevirtual
void sw::mark::MarkManager::NotifyCursorUpdate ( const SwCursorShell rCursorShell)
overridevirtual
MarkManager& sw::mark::MarkManager::operator= ( MarkManager const &  )
privatedelete
bool sw::mark::MarkManager::renameMark ( ::sw::mark::IMark io_pMark,
const OUString &  rNewName 
)
overridevirtual

Renames an existing Mark, if possible.

Parameters
io_pMark[in/out] the mark to be renamed
rNewName[in] new name for the mark
Returns
false, if renaming failed (because the name is already in use)

Implements IDocumentMarkAccess.

Definition at line 805 of file docbm.cxx.

References IDocumentUndoRedo::AppendUndo(), IDocumentUndoRedo::DoesUndo(), SwPosition::GetDoc(), SwDoc::getIDocumentState(), SwDoc::GetIDocumentUndoRedo(), sw::mark::IMark::GetMarkPos(), sw::mark::IMark::GetName(), m_pDoc, m_vAllMarks, and IDocumentState::SetModified().

void sw::mark::MarkManager::repositionMark ( ::sw::mark::IMark io_pMark,
const SwPaM rPaM 
)
overridevirtual

Moves an existing mark to a new selection and performs needed updates.

Parameters
io_pMark[in/out] the mark to be moved
rPaM[in] new selection to be marked

Implements IDocumentMarkAccess.

Definition at line 782 of file docbm.cxx.

References SwPosition::GetDoc(), SwPaM::GetMark(), sw::mark::IMark::GetMarkPos(), SwPaM::GetPoint(), SwPaM::HasMark(), m_pDoc, sw::mark::MarkBase::SetMarkPos(), and sortMarks().

void sw::mark::MarkManager::sortMarks ( )
private
void sw::mark::MarkManager::sortSubsetMarks ( )
private

Definition at line 1549 of file docbm.cxx.

References m_vAnnotationMarks, m_vBookmarks, and m_vFieldmarks.

Referenced by deleteMarks(), and sortMarks().

Member Data Documentation

MarkBasenameMapUniqueOffset_t sw::mark::MarkManager::m_aMarkBasenameMapUniqueOffset
mutableprivate

Definition at line 135 of file MarkManager.hxx.

Referenced by getUniqueMarkName().

SwDoc* const sw::mark::MarkManager::m_pDoc
private
sw::mark::FieldmarkWithDropDownButton* sw::mark::MarkManager::m_pLastActiveFieldmark
private

Definition at line 142 of file MarkManager.hxx.

Referenced by ClearFieldActivation(), deleteMark(), and NotifyCursorUpdate().

container_t sw::mark::MarkManager::m_vAllMarks
private
container_t sw::mark::MarkManager::m_vAnnotationMarks
private
container_t sw::mark::MarkManager::m_vBookmarks
private
container_t sw::mark::MarkManager::m_vFieldmarks
private

The documentation for this class was generated from the following files: