23#include <osl/diagnose.h>
47#include <bookmark.hxx>
57 if(!pCNd &&
nullptr == (pCNd = bNext ? rDoc.
GetNodes().
GoNext(&rPos)
62 OSL_ENSURE(pCNd,
"no ContentNode found");
70 if (rType.startsWith(
"urn:bails"))
73 aRet =
"tscp/bails.rdf";
82 , m_pAttr(
std::move(pHt) )
83 , m_isAnnotationOnEnd(false)
114 if (nMk >= rMkNodes.
Count())
117 if (rMkPos == rPtPos &&
118 ((0 != rPtPos.
m_nContent) || (pContentNode && (0 != pContentNode->
Len())))
130 "invalid content index " << rMkPos.
m_nContent <<
" but text node has only " << pCNd->
Len());
143 "invalid content index " << rPtPos.
m_nContent <<
" but text node has only " << pCNd->
Len());
147 "attribute or similar crosses section-boundaries" );
167 : m_nFieldFlags(nFieldFl),
m_rDoc(rDo), m_bIsEndStack(false)
173 OSL_ENSURE(
m_Entries.empty(),
"There are still Attributes on the stack");
188 for (
size_t i = 0, nCnt =
m_Entries.size();
i < nCnt; ++
i)
199 "Attribute ends after end of line" );
220 "Attribute ends after end of line" );
229 for (
size_t i=0;
i < nCnt; ++
i)
238 return (pExtendCandidate &&
244 *(pExtendCandidate->
m_pAttr) == rAttr);
250 sal_uInt16 nWhich = rAttr.
Which();
254 if (couldExtendEntry(pExtendCandidate, rAttr))
264 pExtendCandidate->
m_bOpen=
true;
269 m_Entries.push_back(std::unique_ptr<SwFltStackEntry>(pTmp));
275 OSL_ENSURE(nCnt <
m_Entries.size(),
"Out of range!");
278 auto aElement =
m_Entries.begin() + nCnt;
330 sal_uInt16 nAttrId,
bool bTstEnd,
tools::Long nHand,
331 bool consumedByField)
337 OSL_ENSURE(!nAttrId ||
338 (POOLATTR_BEGIN <= nAttrId && POOLATTR_END > nAttrId) ||
339 (RES_FLTRATTR_BEGIN <= nAttrId && RES_FLTRATTR_END > nAttrId),
340 "Wrong id for attribute");
345 bool bLastEntry = aI ==
m_Entries.end() - 1;
356 else if (nAttrId == rEntry.
m_pAttr->Which())
380 if (bLastEntry && nAttrId == rEntry.
m_pAttr->Which())
407 if (bLastEntry && nAttrId == rEntry.
m_pAttr->Which() &&
436 if (nMk >= rMkNodes.
Count())
476 while( ( rTmpStart <= rEnd.
GetNode() )
481 while( ( rTmpEnd <= rEnd.
GetNode() )
487 return rTmpStart <= rTmpEnd;
493 SwPaM aRegion( rTmpPos );
495 switch(rEntry.
m_pAttr->Which())
500 if (pFormat !=
nullptr)
537 aTmpStart, aTmpEnd ) )
539 SwPaM aTmpPam( aTmpStart, aTmpEnd );
600 assert(pPostIt->
GetName().isEmpty());
616 SAL_WARN(
"sw",
"RES_FLTR_ANNOTATIONMARK: unexpected field");
621 SAL_WARN(
"sw",
"RES_FLTR_ANNOTATIONMARK: missing field");
625 SAL_WARN(
"sw",
"failed to make book region or point");
637 for (
const std::pair<OUString, OUString>& rAttribute : pMark->
GetAttributes())
639 OUString aTypeNS = rAttribute.first;
641 if (aMetadataFilePath.isEmpty())
649 SAL_WARN(
"sw",
"failed to make book region or point");
676 aBkSet.
Put( *pItem );
682 aBkSet.
Put( *pItem );
690 if (pNd && aBkSet.
Count())
766 auto [pStt, pEnd] = rPam.
StartEnd();
768 if( !rPam.
HasMark() || *pStt >= *pEnd )
772 const sal_Int32 nStartIdx = pStt->GetContentIndex();
774 const sal_Int32 nEndIdx = pEnd->GetContentIndex();
777 OSL_ENSURE(aEndNode == aStartNode,
"nodes must be the same, or this method extended");
778 if (aEndNode != aStartNode)
781 for (
size_t nSize =
m_Entries.size(); nSize > 0;)
785 bool bEntryStartAfterSelStart =
789 bool bEntryStartBeforeSelEnd =
793 bool bEntryEndAfterSelStart =
false;
794 bool bEntryEndBeforeSelEnd =
false;
797 bEntryEndAfterSelStart =
801 bEntryEndBeforeSelEnd =
806 bool bTotallyContained =
false;
808 bEntryStartAfterSelStart && bEntryStartBeforeSelEnd &&
809 bEntryEndAfterSelStart && bEntryEndBeforeSelEnd
812 bTotallyContained =
true;
815 if (bTotallyContained)
822 const sal_Int32 nContentDiff = nEndIdx - nStartIdx;
825 if (bEntryStartAfterSelStart)
827 if (bEntryStartBeforeSelEnd)
836 if (bEntryEndAfterSelStart)
838 if (bEntryEndBeforeSelEnd)
887 : m_pFltAnchor(pFltAnchor)
892 if (rHint.
GetId() == SfxHintId::Dying)
894 else if (rHint.
GetId() == SfxHintId::SwDrawFrameFormat)
901 else if (rHint.
GetId() == SfxHintId::SwLegacyModify)
906 auto pFormatChg =
dynamic_cast<const SwFormatChg*
>(pLegacyHint->m_pNew);
907 auto pFrameFormat = pFormatChg ?
dynamic_cast<SwFrameFormat*
>(pFormatChg->pChangedFormat) :
nullptr;
931 , maVal(
std::move( aVa ))
932 , mbIsTOCBookmark( bIsTOCBookmark )
967 if (!SfxPoolItem::operator==(rItem))
1003 m_bHadBreakItem( false ), m_bHadPageDescItem( false )
1034 : m_pFormat(pFormat)
1042 bool bDying =
false;
1043 if (rHint.
GetId() == SfxHintId::Dying)
1045 else if (rHint.
GetId() == SfxHintId::SwDrawFrameFormat)
@ ShowDelete
show all deletes
@ ShowInsert
show all inserts
sal_uInt16 GetValue() const
virtual void Notify(const SfxHint &rHint) override
SwFrameFormat * m_pFormat
FrameDeleteWatch(SwFrameFormat *pFormat)
virtual ~FrameDeleteWatch() override
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
virtual ::sw::mark::IMark * makeMark(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.
@ CROSSREF_HEADING_BOOKMARK
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool operator==(const SfxPoolItem &) const=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual bool SetAttr(const SfxPoolItem &)
made virtual
virtual sal_Int32 Len() const
const SwAttrSet * GetpSwAttrSet() const
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
SwNumRule * FindNumRulePtr(const OUString &rName) const
size_t GetPageDescCnt() const
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
OUString SetNumRule(const SwPaM &, const SwNumRule &, bool bCreateNewList, SwRootFrame const *pLayout=nullptr, const OUString &sContinuedListId=OUString(), bool bSetItem=true, const bool bResetIndentAttrs=false)
Accept changes of outline styles for OutlineRule.
IDocumentMarkAccess * getIDocumentMarkAccess()
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
const SwAttrPool & GetAttrPool() const
const SwPageDesc & GetPageDesc(const size_t i) const
Instances of SwFields and those derived from it occur 0 to n times.
Used by SwFltAnchor, to listen to an SwFrameFormat (to be aware when it is replaced or deleted).
virtual void Notify(const SfxHint &) override
SwFltAnchorListener(SwFltAnchor *pFltAnchor)
SwFltAnchor * m_pFltAnchor
SwFrameFormat * m_pFrameFormat
std::unique_ptr< SwFltAnchorListener > m_pListener
virtual ~SwFltAnchor() override
virtual bool operator==(const SfxPoolItem &) const override
SwFltAnchor(SwFrameFormat *pFlyFormat)
virtual SwFltAnchor * Clone(SfxItemPool *=nullptr) const override
void SetFrameFormat(SwFrameFormat *_pFrameFormat)
virtual SwFltBookmark * Clone(SfxItemPool *=nullptr) const override
virtual bool operator==(const SfxPoolItem &) const override
tools::Long GetHandle() const
bool IsTOCBookmark() const
SwFltBookmark(const OUString &rNa, OUString aVa, tools::Long nHand, const bool bIsTOCBookmark=false)
const OUString & GetValSys() const
bool IsFlagSet(Flags no) const
void StealAttr(const SwNode &rNode)
void DeleteAndDestroy(Entries::size_type nCnt)
void NewAttr(const SwPosition &rPos, const SfxPoolItem &rAttr)
SwFltControlStack(SwFltControlStack const &)=delete
void KillUnlockedAttrs(const SwPosition &pPos)
void MoveAttrs(const SwPosition &rPos, MoveAttrsMode=MoveAttrsMode::DEFAULT)
virtual SwFltStackEntry * SetAttr(const SwPosition &rPos, sal_uInt16 nAttrId, bool bTstEnd=true, tools::Long nHand=LONG_MAX, bool consumedByField=false)
const SfxPoolItem * GetOpenStackAttr(const SwPosition &rPos, sal_uInt16 nWhich)
void Delete(const SwPaM &rPam)
SfxPoolItem * GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 *pPos)
virtual void SetAttrInDoc(const SwPosition &rTmpPos, SwFltStackEntry &rEntry)
virtual ~SwFltControlStack()
Stores RDF statements on a paragraph (key-value pairs where the subject is the paragraph).
tools::Long GetHandle() const
void SetHandle(tools::Long nHandle)
virtual bool operator==(const SfxPoolItem &) const override
virtual SwFltRDFMark * Clone(SfxItemPool *=nullptr) const override
void SetAttributes(std::vector< std::pair< OUString, OUString > > &&rAttributes)
const std::vector< std::pair< OUString, OUString > > & GetAttributes() const
std::vector< std::pair< OUString, OUString > > m_aAttributes
virtual SwFltRedline * Clone(SfxItemPool *=nullptr) const override
virtual bool operator==(const SfxPoolItem &rItem) const override
SwFltRedline(RedlineType eType_, std::size_t nAutorNo_, const DateTime &rStamp_)
SW_DLLPUBLIC ~SwFltStackEntry()
bool m_isAnnotationOnEnd
annotation already moved onto its end pos.
SW_DLLPUBLIC bool MakeRegion(SwDoc &rDoc, SwPaM &rRegion, RegionMode eCheck) const
SW_DLLPUBLIC void SetEndPos(const SwPosition &rEndPos)
SwFltStackEntry(SwFltStackEntry const &)=delete
std::unique_ptr< SfxPoolItem > m_pAttr
std::shared_ptr< SwTOXBase > m_xTOXBase
SwFltTOX(std::shared_ptr< SwTOXBase > xBase)
bool HadBreakItem() const
virtual SwFltTOX * Clone(SfxItemPool *=nullptr) const override
bool HadPageDescItem() const
virtual bool operator==(const SfxPoolItem &) const override
Marks a node in the document model.
const SwNodes & GetNodes() const
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
const SwStartNode * FindTableBoxStartNode() const
SwContentNode * GetContentNode()
static SwContentNode * GoPrevious(SwNodeIndex *)
SwContentNode * GoNext(SwNodeIndex *) const
SwNodeOffset Count() const
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
const OUString & GetName() const
static void addTextNodeStatement(const OUString &rType, const OUString &rPath, SwTextNode &rTextNode, const OUString &rKey, const OUString &rValue)
Add an (rTextNode, key, value) statement in the graph of type rType – or if it does not exist,...
virtual void SetSubType(sal_uInt16 nType) override
const SwFormatField & GetFormatField() const
SwTextNode is a paragraph in the document model.
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Expand) const
virtual OUString GetName() const override
const sal_Int32 m_nHandle
static bool IterateNumrulePiece(const SwPosition &rEnd, SwNodeIndex &rTmpStart, SwNodeIndex &rTmpEnd)
static OUString lcl_getTypePath(OUString &rType)
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
static bool MakeBookRegionOrPoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
static bool MakePoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
constexpr TypedWhichId< SwFltAnchor > RES_FLTR_ANCHOR(191)
constexpr TypedWhichId< CntUInt16Item > RES_FLTR_ANNOTATIONMARK(195)
constexpr TypedWhichId< SwFltRedline > RES_FLTR_REDLINE(194)
bool isPARATR_LIST(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SwFltTOX > RES_FLTR_TOX(193)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SwFltRDFMark > RES_FLTR_RDFMARK(196)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_NUMRULE(192)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
const SwExtendedSubType SUB_INVISIBLE
Invisible.
const SwGetSetExpType GSE_STRING
String.
bool IsFieldmarkOverlap(SwPaM const &rPaM)
check if rPaM is valid range of new fieldmark
bool CheckNodesRange(const SwNode &rStt, const SwNode &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
void FromSwPosition(const SwPosition &rPos)
void SetPos(SwNodeIndex const &rNode, sal_uInt16 nIdx)
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
SwNodeOffset GetNodeIndex() const
const SwNodes & GetNodes() const
sal_Int32 GetContentIndex() const
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.