23 #include <osl/diagnose.h>
47 #include <bookmark.hxx>
56 if(!pCNd &&
nullptr == (pCNd = bNext ? rDoc.
GetNodes().
GoNext(&rIdx)
61 OSL_ENSURE(pCNd,
"no ContentNode found");
69 if (rType.startsWith(
"urn:bails"))
72 aRet =
"tscp/bails.rdf";
81 , m_pAttr(
std::move(pHt) )
82 , m_isAnnotationOnEnd(
false)
113 if (nMk >= rMkNodes.
Count())
116 if (rMkPos == rPtPos &&
117 ((0 != rPtPos.
m_nContent) || (pContentNode && (0 != pContentNode->
Len())))
129 "invalid content index " << rMkPos.
m_nContent <<
" but text node has only " << pCNd->
Len());
137 if (n >= rNodes.
Count())
143 "invalid content index " << rPtPos.
m_nContent <<
" but text node has only " << pCNd->
Len());
148 "attribute or similar crosses section-boundaries" );
168 : m_nFieldFlags(nFieldFl),
m_rDoc(rDo), m_bIsEndStack(
false)
174 OSL_ENSURE(
m_Entries.empty(),
"There are still Attributes on the stack");
189 for (
size_t i = 0, nCnt =
m_Entries.size();
i < nCnt; ++
i)
200 "Attribute ends after end of line" );
221 "Attribute ends after end of line" );
230 for (
size_t i=0;
i < nCnt; ++
i)
239 return (pExtendCandidate &&
245 *(pExtendCandidate->
m_pAttr) == rAttr);
251 sal_uInt16 nWhich = rAttr.
Which();
255 if (couldExtendEntry(pExtendCandidate, rAttr))
265 pExtendCandidate->
m_bOpen=
true;
270 m_Entries.push_back(std::unique_ptr<SwFltStackEntry>(pTmp));
276 OSL_ENSURE(nCnt <
m_Entries.size(),
"Out of range!");
279 auto aElement =
m_Entries.begin() + nCnt;
331 sal_uInt16 nAttrId,
bool bTstEnd,
tools::Long nHand,
332 bool consumedByField)
338 OSL_ENSURE(!nAttrId ||
339 (POOLATTR_BEGIN <= nAttrId && POOLATTR_END > nAttrId) ||
340 (RES_FLTRATTR_BEGIN <= nAttrId && RES_FLTRATTR_END > nAttrId),
341 "Wrong id for attribute");
346 bool bLastEntry = aI ==
m_Entries.end() - 1;
357 else if (nAttrId == rEntry.
m_pAttr->Which())
372 else if (nAttrId ==
RES_FLTR_RDFMARK && nHand == static_cast<SwFltRDFMark*>(rEntry.
m_pAttr.get())->GetHandle())
381 if (bLastEntry && nAttrId == rEntry.
m_pAttr->Which())
408 if (bLastEntry && nAttrId == rEntry.
m_pAttr->Which() &&
437 if (nMk >= rMkNodes.
Count())
477 while( ( rTmpStart <= rEnd )
482 while( ( rTmpEnd <= rEnd )
488 return rTmpStart <= rTmpEnd;
494 SwPaM aRegion( rTmpPos );
496 switch(rEntry.
m_pAttr->Which())
501 if (pFormat !=
nullptr)
538 aTmpStart, aTmpEnd ) )
540 SwPaM aTmpPam( aTmpStart, aTmpEnd );
593 SwTextField const*
const pField = pTextNode ? pTextNode->GetFieldTextAttrAt(
598 dynamic_cast<SwPostItField const*>(pField->GetFormatField().GetField()));
601 assert(pPostIt->
GetName().isEmpty());
617 SAL_WARN(
"sw",
"RES_FLTR_ANNOTATIONMARK: unexpected field");
622 SAL_WARN(
"sw",
"RES_FLTR_ANNOTATIONMARK: missing field");
626 SAL_WARN(
"sw",
"failed to make book region or point");
638 for (
const std::pair<OUString, OUString>& rAttribute : pMark->
GetAttributes())
640 OUString aTypeNS = rAttribute.first;
642 if (aMetadataFilePath.isEmpty())
650 SAL_WARN(
"sw",
"failed to make book region or point");
670 const SfxItemSet* pSet = pNd->GetpSwAttrSet();
677 aBkSet.Put( *pItem );
683 aBkSet.
Put( *pItem );
691 if (pNd && aBkSet.
Count())
692 pNd->SetAttr(aBkSet);
769 if( !rPam.
HasMark() || *pStt >= *pEnd )
775 const sal_Int32 nEndIdx = pEnd->nContent.GetIndex();
778 OSL_ENSURE(aEndNode == aStartNode,
"nodes must be the same, or this method extended");
779 if (aEndNode != aStartNode)
782 for (
size_t nSize =
m_Entries.size(); nSize > 0;)
786 bool bEntryStartAfterSelStart =
790 bool bEntryStartBeforeSelEnd =
794 bool bEntryEndAfterSelStart =
false;
795 bool bEntryEndBeforeSelEnd =
false;
798 bEntryEndAfterSelStart =
802 bEntryEndBeforeSelEnd =
807 bool bTotallyContained =
false;
809 bEntryStartAfterSelStart && bEntryStartBeforeSelEnd &&
810 bEntryEndAfterSelStart && bEntryEndBeforeSelEnd
813 bTotallyContained =
true;
816 if (bTotallyContained)
823 const sal_Int32 nContentDiff = nEndIdx - nStartIdx;
826 if (bEntryStartAfterSelStart)
828 if (bEntryStartBeforeSelEnd)
837 if (bEntryEndAfterSelStart)
839 if (bEntryEndBeforeSelEnd)
888 : m_pFltAnchor(pFltAnchor)
893 if (rHint.
GetId() == SfxHintId::Dying)
895 else if (
auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
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;
932 , mbIsTOCBookmark( bIsTOCBookmark )
951 &&
mnHandle == static_cast<const SwFltBookmark&>(rItem).mnHandle;
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 (
auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
std::vector< std::pair< OUString, OUString > > m_aAttributes
virtual void Notify(const SfxHint &rHint) override
virtual void SetSubType(sal_uInt16 nType) override
Instances of SwFields and those derived from it occur 0 to n times.
SwFrameFormat * m_pFormat
virtual sal_Int32 Len() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
virtual SwFltRDFMark * Clone(SfxItemPool *=nullptr) const override
SwNode & GetNode(bool bPoint=true) const
void SetFrameFormat(SwFrameFormat *_pFrameFormat)
void SetAttributes(std::vector< std::pair< OUString, OUString > > &&rAttributes)
SwFltControlStack(SwFltControlStack const &)=delete
Marks a position in the document model.
bool IsTOCBookmark() const
SW_DLLPUBLIC bool MakeRegion(SwDoc &rDoc, SwPaM &rRegion, RegionMode eCheck) const
virtual bool operator==(const SfxPoolItem &) const =0
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
void Delete(const SwPaM &rPam)
const SwExtendedSubType SUB_INVISIBLE
Invisible.
void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
std::shared_ptr< SwTOXBase > m_xTOXBase
virtual bool operator==(const SfxPoolItem &) const override
const SwPosition * GetMark() const
void SetHandle(tools::Long nHandle)
constexpr TypedWhichId< SwFltRDFMark > RES_FLTR_RDFMARK(196)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
static SwContentNode * GoPrevious(SwNodeIndex *)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_NUMRULE(192)
IDocumentMarkAccess * getIDocumentMarkAccess()
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
IDocumentContentOperations const & getIDocumentContentOperations() const
static bool MakeBookRegionOrPoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
SwFltAnchor * m_pFltAnchor
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
SfxPoolItem * GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 *pPos)
Stores RDF statements on a paragraph (key-value pairs where the subject is the paragraph).
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
constexpr TypedWhichId< SwFltAnchor > RES_FLTR_ANCHOR(191)
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
SW_DLLPUBLIC ~SwFltStackEntry()
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
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.
void DeleteAndDestroy(Entries::size_type nCnt)
SwFltAnchorListener(SwFltAnchor *pFltAnchor)
bool CheckNodesRange(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
SwNodeOffset GetIndex() const
virtual OUString GetName() const override
constexpr TypedWhichId< SfxStringItem > RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN)
FrameDeleteWatch(SwFrameFormat *pFormat)
SwFltTOX(std::shared_ptr< SwTOXBase > xBase)
constexpr OUStringLiteral aData
SwFltAnchor(SwFrameFormat *pFlyFormat)
PaM is Point and Mark: a selection of the document model.
SW_DLLPUBLIC void SetEndPos(const SwPosition &rEndPos)
const SfxPoolItem * GetOpenStackAttr(const SwPosition &rPos, sal_uInt16 nWhich)
SwNumRule * FindNumRulePtr(const OUString &rName) const
virtual void Notify(const SfxHint &) override
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< CntUInt16Item > RES_FLTR_ANNOTATIONMARK(195)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwPosition * GetPoint() const
SwFrameFormat * m_pFrameFormat
SwIndex & Assign(SwIndexReg *, sal_Int32)
const SwPageDesc & GetPageDesc(const size_t i) const
void FromSwPosition(const SwPosition &rPos)
virtual ~SwFltControlStack()
void StealAttr(const SwNodeIndex &rNode)
SwFltBookmark(const OUString &rNa, const OUString &rVa, tools::Long nHand, const bool bIsTOCBookmark=false)
SwContentNode * GetContentNode()
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwFltStackEntry(SwFltStackEntry const &)=delete
size_t GetPageDescCnt() const
constexpr TypedWhichId< SwFltTOX > RES_FLTR_TOX(193)
tools::Long GetHandle() const
virtual bool operator==(const SfxPoolItem &) const override
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Marks a node in the document model.
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)
virtual bool operator==(const SfxPoolItem &) const override
bool StartListening(SvtBroadcaster &rBroadcaster)
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...
bool IsFlagSet(Flags no) const
std::unique_ptr< SfxPoolItem > m_pAttr
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwPosition * Start() const
const OUString & GetName() const
virtual SwFltBookmark * Clone(SfxItemPool *=nullptr) const override
static OUString lcl_getTypePath(OUString &rType)
virtual SwFltRedline * Clone(SfxItemPool *=nullptr) const override
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
SvtBroadcaster & GetNotifier()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
static bool IterateNumrulePiece(const SwNodeIndex &rEnd, SwNodeIndex &rTmpStart, SwNodeIndex &rTmpEnd)
virtual ~SwFltAnchor() override
virtual SwFltAnchor * Clone(SfxItemPool *=nullptr) const override
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
std::unique_ptr< SwFltAnchorListener > m_pListener
#define SAL_WARN_IF(condition, area, stream)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
const SwNodes & GetNodes() const
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
bool m_isAnnotationOnEnd
annotation already moved onto its end pos.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
sal_Int32 GetIndex() const
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
virtual ~FrameDeleteWatch() override
const SwPosition * End() const
const sal_Int32 m_nHandle
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
virtual bool operator==(const SfxPoolItem &) const override
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SwFltRedline > RES_FLTR_REDLINE(194)
bool HadPageDescItem() const
const SwStartNode * FindTableBoxStartNode() const
bool HadBreakItem() const
SwNodeOffset Count() const
const OUString & GetValSys() const
#define SAL_WARN(area, stream)
static bool MakePoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
const SwGetSetExpType GSE_STRING
String.
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
const std::vector< std::pair< OUString, OUString > > & GetAttributes() 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.
bool IsFieldmarkOverlap(SwPaM const &rPaM)
check if rPaM is valid range of new fieldmark
SwFltRedline(RedlineType eType_, std::size_t nAutorNo_, const DateTime &rStamp_)
void SetPos(SwNodeIndex const &rNode, sal_uInt16 nIdx)
virtual SwFltTOX * Clone(SfxItemPool *=nullptr) const override
virtual bool operator==(const SfxPoolItem &rItem) const override
SwContentNode * GoNext(SwNodeIndex *) const
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
virtual void SetAttrInDoc(const SwPosition &rTmpPos, SwFltStackEntry &rEntry)
bool isPARATR_LIST(const sal_uInt16 nWhich)
bool m_bDetectedRangeSegmentation false
void NewAttr(const SwPosition &rPos, const SfxPoolItem &rAttr)
void KillUnlockedAttrs(const SwPosition &pPos)