20 #include <com/sun/star/lang/Locale.hpp>
21 #include <com/sun/star/util/SearchAlgorithms2.hpp>
22 #include <com/sun/star/util/SearchFlags.hpp>
25 #include <osl/diagnose.h>
57 switch( rItem1.
Which() )
68 if (oNumOffset1 != oNumOffset2)
73 return rItem1 == rItem2;
77 sal_Int32 nContentPos )
79 while( rPos < rHtsArr.
Count() )
83 if( pTextHt->
GetStart() >= nContentPos )
90 sal_Int32 nContentPos )
96 if( pTextHt->
GetStart() < nContentPos )
103 const bool bSaveMark )
105 sal_Int32 nContentPos;
119 if( bTstEnd && *pEnd > nContentPos )
169 SwSrchChrAttr(): nWhich(0), nStt(0), nEnd(0) {}
172 sal_Int32 nStart, sal_Int32 nAnyEnd )
173 : nWhich( rItem.Which() ), nStt( nStart ), nEnd( nAnyEnd )
179 SwSrchChrAttr *m_pFindArr, *m_pStackArr;
180 sal_Int32 m_nNodeStart;
181 sal_Int32 m_nNodeEnd;
182 sal_uInt16 m_nArrStart, m_nArrLen;
183 sal_uInt16 m_nFound, m_nStackCount;
189 SwAttrCheckArr(
const SfxItemSet& rSet,
bool bForward,
bool bNoCollections );
195 sal_uInt16
Count()
const {
return m_aComapeSet.
Count(); }
196 bool Found()
const {
return m_nFound == m_aComapeSet.
Count(); }
199 sal_Int32
Start()
const;
200 sal_Int32
End()
const;
202 sal_Int32 GetNdStt()
const {
return m_nNodeStart; }
203 sal_Int32 GetNdEnd()
const {
return m_nNodeEnd; }
211 SwAttrCheckArr::SwAttrCheckArr(
const SfxItemSet& rSet,
bool bFwd,
212 bool bNoCollections )
218 , m_bNoColls(bNoCollections)
221 m_aComapeSet.
Put( rSet,
false );
225 m_nArrStart = m_aComapeSet.
GetWhichByPos( aIter.GetFirstPos() );
226 m_nArrLen = m_aComapeSet.
GetWhichByPos( aIter.GetLastPos() ) - m_nArrStart+1;
228 char* pFndChar =
new char[ m_nArrLen *
sizeof(SwSrchChrAttr) ];
229 char* pStackChar =
new char[ m_nArrLen *
sizeof(SwSrchChrAttr) ];
231 m_pFindArr =
reinterpret_cast<SwSrchChrAttr*
>(pFndChar);
232 m_pStackArr =
reinterpret_cast<SwSrchChrAttr*
>(pStackChar);
235 SwAttrCheckArr::~SwAttrCheckArr()
237 delete[]
reinterpret_cast<char*
>(m_pFindArr);
238 delete[]
reinterpret_cast<char*
>(m_pStackArr);
241 void SwAttrCheckArr::SetNewSet(
const SwTextNode& rTextNd,
const SwPaM& rPam )
243 std::fill(m_pFindArr, m_pFindArr + m_nArrLen, SwSrchChrAttr());
244 std::fill(m_pStackArr, m_pStackArr + m_nArrLen, SwSrchChrAttr());
253 : rTextNd.
GetText().getLength();
281 if( SfxItemState::SET == rSet.
GetItemState( nWhich, !m_bNoColls, &pFndItem )
284 m_pFindArr[ nWhich - m_nArrStart ] =
285 SwSrchChrAttr( *pFndItem, m_nNodeStart, m_nNodeEnd );
291 nWhich = pItem->
Which();
295 if(
CmpAttr( rSet.
Get( nWhich, !m_bNoColls ), *pItem ) )
297 m_pFindArr[ nWhich - m_nArrStart ] =
298 SwSrchChrAttr( *pItem, m_nNodeStart, m_nNodeEnd );
303 pItem = aIter.NextItem();
309 SwSrchChrAttr
const& rTmp)
317 return ((nNdEnd == nNdStart)
318 ? ((rTmp.nEnd < nNdStart) || (nNdEnd < rTmp.nStt))
319 : ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt)));
322 bool SwAttrCheckArr::SetAttrFwd(
const SwTextAttr& rAttr )
334 sal_uInt16 nWhch = rAttr.
Which();
335 std::unique_ptr<SfxWhichIter> pIter;
347 nWhch = pIter->FirstWhich();
349 SfxItemState::SET != pSet->
GetItemState( nWhch,
true, &pTmpItem ) )
350 nWhch = pIter->NextWhich();
361 if( SfxItemState::DONTCARE == eState || SfxItemState::SET == eState )
367 SwSrchChrAttr* pArrPtr;
369 for( pArrPtr = m_pFindArr, n = 0; n < m_nArrLen;
371 if( pArrPtr->nWhich && pArrPtr->nEnd <= aTmp.nStt )
381 for( pArrPtr = m_pStackArr, n=0; n < m_nArrLen; ++n, ++pArrPtr )
383 if( !pArrPtr->nWhich )
386 if( pArrPtr->nEnd <= aTmp.nStt )
389 if( !--m_nStackCount )
392 else if( pArrPtr->nStt <= aTmp.nStt )
394 pCmp = &m_pFindArr[ n ];
397 if( pCmp->nEnd < pArrPtr->nEnd )
398 pCmp->nEnd = pArrPtr->nEnd;
406 if( !--m_nStackCount )
411 bool bContinue =
false;
413 if( SfxItemState::DONTCARE == eState )
420 pCmp = &m_pFindArr[ nWhch - m_nArrStart ];
426 else if( pCmp->nEnd < aTmp.nEnd )
427 pCmp->nEnd = aTmp.nEnd;
433 else if(
CmpAttr( *pItem, *pTmpItem ) )
435 m_pFindArr[ nWhch - m_nArrStart ] = aTmp;
443 pCmp = &m_pFindArr[ nWhch - m_nArrStart ];
447 if( pCmp->nEnd > aTmp.nEnd )
449 OSL_ENSURE( !m_pStackArr[ nWhch - m_nArrStart ].nWhich,
450 "slot on stack is still in use" );
452 if( aTmp.nStt <= pCmp->nStt )
453 pCmp->nStt = aTmp.nEnd;
455 pCmp->nEnd = aTmp.nStt;
457 m_pStackArr[ nWhch - m_nArrStart ] = *pCmp;
467 assert(pSet &&
"otherwise no pIter");
468 nWhch = pIter->NextWhich();
470 SfxItemState::SET != pSet->
GetItemState( nWhch,
true, &pTmpItem ) )
471 nWhch = pIter->NextWhich();
482 bool SwAttrCheckArr::SetAttrBwd(
const SwTextAttr& rAttr )
494 sal_uInt16 nWhch = rAttr.
Which();
495 std::unique_ptr<SfxWhichIter> pIter;
507 nWhch = pIter->FirstWhich();
509 SfxItemState::SET != pSet->
GetItemState( nWhch,
true, &pTmpItem ) )
510 nWhch = pIter->NextWhich();
521 if( SfxItemState::DONTCARE == eState || SfxItemState::SET == eState )
527 SwSrchChrAttr* pArrPtr;
529 for( pArrPtr = m_pFindArr, n = 0; n < m_nArrLen; ++n, ++pArrPtr )
530 if( pArrPtr->nWhich && pArrPtr->nStt >= aTmp.nEnd )
540 for( pArrPtr = m_pStackArr, n = 0; n < m_nArrLen; ++n, ++pArrPtr )
542 if( !pArrPtr->nWhich )
545 if( pArrPtr->nStt >= aTmp.nEnd )
548 if( !--m_nStackCount )
551 else if( pArrPtr->nEnd >= aTmp.nEnd )
553 pCmp = &m_pFindArr[ n ];
556 if( pCmp->nStt > pArrPtr->nStt )
557 pCmp->nStt = pArrPtr->nStt;
565 if( !--m_nStackCount )
570 bool bContinue =
false;
571 if( SfxItemState::DONTCARE == eState )
578 pCmp = &m_pFindArr[ nWhch - m_nArrStart ];
584 else if( pCmp->nStt > aTmp.nStt )
585 pCmp->nStt = aTmp.nStt;
591 else if(
CmpAttr( *pItem, *pTmpItem ))
593 m_pFindArr[ nWhch - m_nArrStart ] = aTmp;
601 pCmp = &m_pFindArr[ nWhch - m_nArrStart ];
605 if( pCmp->nStt < aTmp.nStt )
607 OSL_ENSURE( !m_pStackArr[ nWhch - m_nArrStart ].nWhich,
608 "slot on stack is still in use" );
610 if( aTmp.nEnd <= pCmp->nEnd )
611 pCmp->nEnd = aTmp.nStt;
613 pCmp->nStt = aTmp.nEnd;
615 m_pStackArr[ nWhch - m_nArrStart ] = *pCmp;
625 assert(pSet &&
"otherwise no pIter");
626 nWhch = pIter->NextWhich();
628 SfxItemState::SET != pSet->
GetItemState( nWhch,
true, &pTmpItem ) )
629 nWhch = pIter->NextWhich();
640 sal_Int32 SwAttrCheckArr::Start()
const
642 sal_Int32 nStart = m_nNodeStart;
643 SwSrchChrAttr* pArrPtr = m_pFindArr;
644 for( sal_uInt16 n = 0; n < m_nArrLen; ++n, ++pArrPtr )
645 if( pArrPtr->nWhich && pArrPtr->nStt > nStart )
646 nStart = pArrPtr->nStt;
651 sal_Int32 SwAttrCheckArr::End()
const
653 SwSrchChrAttr* pArrPtr = m_pFindArr;
654 sal_Int32 nEnd = m_nNodeEnd;
655 for( sal_uInt16 n = 0; n < m_nArrLen; ++n, ++pArrPtr )
656 if( pArrPtr->nWhich && pArrPtr->nEnd < nEnd )
657 nEnd = pArrPtr->nEnd;
662 bool SwAttrCheckArr::CheckStack()
668 const sal_Int32 nSttPos =
Start();
669 const sal_Int32 nEndPos =
End();
670 SwSrchChrAttr* pArrPtr;
671 for( pArrPtr = m_pStackArr, n = 0; n < m_nArrLen; ++n, ++pArrPtr )
673 if( !pArrPtr->nWhich )
676 if( m_bForward ? pArrPtr->nEnd <= nSttPos : pArrPtr->nStt >= nEndPos )
679 if( !--m_nStackCount )
680 return m_nFound == m_aComapeSet.
Count();
682 else if( m_bForward ? pArrPtr->nStt < nEndPos : pArrPtr->nEnd > nSttPos )
685 OSL_ENSURE( !m_pFindArr[ n ].nWhich,
"slot in array is already in use" );
686 m_pFindArr[ n ] = *pArrPtr;
689 if( !--m_nStackCount )
690 return m_nFound == m_aComapeSet.
Count();
693 return m_nFound == m_aComapeSet.
Count();
700 rCmpArr.SetNewSet( rTextNd, rPam );
703 if( !rCmpArr.Found() )
705 nEndPos = rCmpArr.GetNdEnd();
715 if( rCmpArr.Found() )
717 for( ; nPos < rHtArr.
Count(); ++nPos )
719 pAttr = rHtArr.
Get( nPos );
720 if( !rCmpArr.SetAttrFwd( *pAttr ) )
722 if( rCmpArr.GetNdStt() < pAttr->
GetStart() )
735 if( nPos == rHtArr.
Count() && rCmpArr.Found() )
738 nEndPos = rCmpArr.GetNdEnd();
745 for( ; nPos < rHtArr.
Count(); ++nPos )
747 pAttr = rHtArr.
Get( nPos );
748 if( rCmpArr.SetAttrFwd( *pAttr ) )
752 while( ++nPos < rHtArr.
Count() )
754 pAttr = rHtArr.
Get( nPos );
755 if( nSttPos != pAttr->
GetStart() || !rCmpArr.SetAttrFwd( *pAttr ) )
759 if( !rCmpArr.Found() )
763 nSttPos = rCmpArr.Start();
764 nEndPos = rCmpArr.End();
765 if( nSttPos > nEndPos )
773 if( !rCmpArr.CheckStack() )
775 nSttPos = rCmpArr.Start();
776 nEndPos = rCmpArr.End();
777 if( nSttPos > nEndPos )
788 rCmpArr.SetNewSet( rTextNd, rPam );
791 if( !rCmpArr.Found() )
793 nEndPos = rCmpArr.GetNdEnd();
804 if( rCmpArr.Found() )
809 if( !rCmpArr.SetAttrBwd( *pAttr ) )
812 if( nSttPos < rCmpArr.GetNdEnd() )
815 nEndPos = rCmpArr.GetNdEnd();
825 if( !nPos && rCmpArr.Found() )
828 nEndPos = rCmpArr.GetNdEnd();
837 if( rCmpArr.SetAttrBwd( *pAttr ) )
846 if( nEndPos != pAttr->
GetAnyEnd() || !rCmpArr.SetAttrBwd( *pAttr ) )
850 if( !rCmpArr.Found() )
854 nSttPos = rCmpArr.Start();
855 nEndPos = rCmpArr.End();
856 if( nSttPos > nEndPos )
864 if( !rCmpArr.CheckStack() )
866 nSttPos = rCmpArr.Start();
867 nEndPos = rCmpArr.End();
868 if( nSttPos > nEndPos )
892 if( SfxItemState::SET != rNdSet.
GetItemState( nWhich, !bNoColls, &pNdItem )
898 nWhich = pItem->
Which();
900 if( !
CmpAttr( rNdSet.
Get( nWhich, !bNoColls ), *pItem ))
913 const SwPaM & rRegion,
bool bInReadOnly,
917 const sal_uInt16 nWhich = rAttr.
Which();
930 ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetContentNode()->Len()
931 : !pPam->GetPoint()->nContent.GetIndex() )
933 if( !(*fnMove.
fnNds)( &pPam->GetPoint()->nNode, false ))
938 pPam->GetPoint()->nContent.Assign( pNd, bSrchForward ? 0 : pNd->
Len() );
941 while (
nullptr != (pNode = ::
GetNode(*pPam, bFirst, fnMove, bInReadOnly, pLayout)))
963 && (pAttrNode->
GetIndex() < pPam->GetPoint()->nNode.GetIndex()
964 || (pAttrNode->
GetIndex() == pPam->GetPoint()->nNode.GetIndex()
965 && pAttr->
GetStart() < pPam->GetPoint()->nContent.GetIndex())
966 || pAttr->
Which() != nWhich));
976 && (pPam->GetPoint()->nNode.GetIndex() < pAttrNode->
GetIndex()
977 || (pPam->GetPoint()->nNode.GetIndex() == pAttrNode->
GetIndex()
978 && pPam->GetPoint()->nContent.GetIndex() <= pAttr->
GetStart())
979 || pAttr->
Which() != nWhich));
984 pPam->GetPoint()->nNode = *pAttrNode;
999 *rSearchPam.
GetPoint() = *pPam->GetPoint();
1000 *rSearchPam.
GetMark() = *pPam->GetMark();
1012 if( !aFormatArr.insert( pTmpFormat ).second )
1022 *rSearchPam.
GetPoint() = *pPam->GetPoint();
1032 if( bFound && !bSrchForward )
1044 const SwPaM & rRegion,
bool bInReadOnly,
bool bMoveFirst,
1049 bool bFound =
false;
1056 SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls );
1059 aOtherSet.Put( rSet,
false );
1068 ? pPam->GetPoint()->nContent.GetIndex() == pPam->GetContentNode()->Len()
1069 : !pPam->GetPoint()->nContent.GetIndex() ) )
1071 if( !(*fnMove.
fnNds)( &pPam->GetPoint()->nNode, false ))
1076 pPam->GetPoint()->nContent.Assign( pNd, bSrchForward ? 0 : pNd->
Len() );
1079 while (
nullptr != (pNode = ::
GetNode(*pPam, bFirst, fnMove, bInReadOnly, pLayout)))
1091 if( aCmpArr.Count() )
1096 if (aOtherSet.Count() &&
1097 !
lcl_Search(rPropsNode, aOtherSet, bNoColls))
1108 if (pMergedPara->extents.empty())
1110 if (rStart.nNode.GetIndex() <= rPropsNode.GetIndex()
1111 && rPropsNode.GetIndex() <= rEnd.nNode.GetIndex())
1113 SwPaM tmp(rPropsNode, 0, rPropsNode, 0);
1114 bFound = (*fnSearch)(*pNode->
GetTextNode(), aCmpArr, tmp);
1126 for (
size_t i = 0;
i < pMergedPara->extents.size(); ++
i)
1128 auto const rExtent(pMergedPara->extents[bSrchForward
1130 : pMergedPara->extents.size() -
i - 1]);
1131 if (rExtent.pNode->GetIndex() < rStart.nNode.GetIndex()
1132 || rEnd.nNode.GetIndex() < rExtent.pNode->GetIndex())
1136 sal_Int32
const nStart(rExtent.pNode == &rStart.nNode.GetNode()
1137 ? rStart.nContent.GetIndex()
1139 if (rExtent.nEnd <= nStart)
1143 sal_Int32
const nEnd(rExtent.pNode == &rEnd.nNode.GetNode()
1144 ? rEnd.nContent.GetIndex()
1145 : rExtent.pNode->Len());
1146 if (nEnd < rExtent.nStart
1147 || (nStart != nEnd && nEnd == rExtent.nStart))
1151 SwPaM tmp(*rExtent.pNode, std::max(nStart, rExtent.nStart),
1152 *rExtent.pNode, std::min(nEnd, rExtent.nEnd));
1154 bFound = (*fnSearch)(*rExtent.pNode, aCmpArr, tmp);
1165 bFound = (*fnSearch)(*pNode->
GetTextNode(), aCmpArr, *pPam);
1171 *rSearchPam.
GetPoint() = *pPam->GetPoint();
1172 *rSearchPam.
GetMark() = *pPam->GetMark();
1178 if( !aOtherSet.Count() )
1183 if (!rPropsNode.HasSwAttrSet())
1185 SwFormat* pTmpFormat = rPropsNode.GetFormatColl();
1186 if( !aFormatArr.
insert( pTmpFormat ).second )
1190 if (
lcl_Search(rPropsNode, aOtherSet, bNoColls))
1196 *rSearchPam.
GetPoint() = *pPam->GetPoint();
1203 *rSearchPam.
GetPoint() = *pPam->GetPoint();
1234 bool m_bNoCollection;
1239 std::unique_ptr<utl::TextSearch> pSText;
1241 SwFindParaAttr(
const SfxItemSet& rSet,
bool bNoCollection,
1244 : m_bNoCollection(bNoCollection)
1247 , pSearchOpt( pOpt )
1248 , m_rCursor(rCursor)
1249 , m_pLayout(pLayout)
1252 virtual ~SwFindParaAttr() {}
1255 std::unique_ptr<SvxSearchItem>& xSearchItem)
override;
1262 const SwPaM & rRegion,
bool bInReadOnly,
1263 std::unique_ptr<SvxSearchItem>& xSearchItem)
1266 bool bReplaceText = pSearchOpt && ( !pSearchOpt->replaceString.isEmpty() ||
1268 bool bReplaceAttr = pReplSet && pReplSet->Count();
1269 bool bMoveFirst = !bReplaceAttr;
1270 if( bInReadOnly && (bReplaceAttr || bReplaceText ))
1271 bInReadOnly =
false;
1276 SwPaM* pTextRegion = &aRegion;
1284 if (!
FindAttrsImpl(aSrchPam, *pSet, m_bNoCollection, fnMove, aRegion, bInReadOnly, bMoveFirst, m_pLayout))
1291 pTextRegion = &aSrchPam;
1293 else if( !pSearchOpt )
1302 aTmp.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE |
1303 SearchFlags::REG_NOT_ENDOFLINE);
1313 if (
sw::FindTextImpl(aSrchPam, *pSearchOpt,
false, *pSText, fnMove, *pTextRegion, bInReadOnly, m_pLayout, xSearchItem) &&
1314 *aSrchPam.GetMark() != *aSrchPam.GetPoint() )
1316 else if( !pSet->
Count() )
1319 *aRegion.GetMark() = *aSrchPam.GetPoint();
1322 *rCursor.
GetPoint() = *aSrchPam.GetPoint();
1324 *rCursor.
GetMark() = *aSrchPam.GetMark();
1330 SearchAlgorithms2::REGEXP == pSearchOpt->AlgorithmType2);
1332 const sal_Int32 nSttCnt = rSttCntIdx.
GetIndex();
1335 SwPaM* pPrevRing(
nullptr);
1338 pPrevRing =
const_cast<SwPaM &
>(rRegion).GetPrev();
1339 const_cast<SwPaM &
>(rRegion).GetRingContainer().merge( m_rCursor.GetRingContainer() );
1342 std::optional<OUString> xRepl;
1346 xRepl ? *xRepl : pSearchOpt->replaceString, bRegExp,
1347 m_rCursor.
GetDoc(), m_pLayout);
1349 m_rCursor.SaveTableBoxContent( rCursor.
GetPoint() );
1359 p->
MoveTo(const_cast<SwPaM*>(&rRegion));
1360 }
while( p != pPrevRing );
1362 rSttCntIdx = nSttCnt;
1370 if( !pSet->
Count() )
1378 SfxItemSet aSet( *pPool, pReplSet->GetRanges() );
1386 pReplSet->GetItemState( pItem->
Which(), false ))
1389 pItem = aIter.NextItem();
1391 aSet.Put( *pReplSet );
1402 bool SwFindParaAttr::IsReplaceMode()
const
1404 return ( pSearchOpt && !pSearchOpt->replaceString.isEmpty() ) ||
1405 ( pReplSet && pReplSet->Count() );
1421 bool bReplace = ( pSearchOpt && ( !pSearchOpt->
replaceString.isEmpty() ||
1422 !rSet.
Count() ) ) ||
1423 (pReplSet && pReplSet->
Count());
1430 SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt,
1431 pReplSet, *
this, pLayout );
1433 sal_uLong nRet =
FindAll( aSwFindParaAttr, nStart, nEnd, eFndRngs, bCancel );
1435 if( nRet && bReplace )
std::optional< OUString > ReplaceBackReferences(const i18nutil::SearchOptions2 &rSearchOpt, SwPaM *const pPam, SwRootFrame const *const pLayout)
Helperfunction to resolve backward references in regular expressions.
Represents the visualization of a paragraph.
virtual sal_Int32 Len() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
virtual int DoFind(SwPaM &, SwMoveFnCollection const &, const SwPaM &, bool, std::unique_ptr< SvxSearchItem > &xSearchItem)=0
sal_uLong GetIndex() const
Marks a position in the document model.
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
bool isCHRATR(const sal_uInt16 nWhich)
const OUString & GetText() const
std::unique_ptr< SwPaM > MakeRegion(SwMoveFnCollection const &fnMove, const SwPaM &rOrigRg)
make a new region
bool isTXTATR(const sal_uInt16 nWhich)
const SwTextAttr * GetBkwrdTextHint(const SwpHints &rHtsArr, size_t &rPos, sal_Int32 nContentPos)
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
virtual void SetModified()=0
Must be called manually at changes of format.
const SwPosition * GetMark() const
sw::MergedPara * GetMergedPara()
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
void SetOle2Link(const Link< bool, void > &rLink)
SwTextAttr const * PrevAttr(SwTextNode const **ppNode=nullptr)
static bool lcl_IsAttributeIgnorable(sal_Int32 const nNdStart, sal_Int32 const nNdEnd, SwSrchChrAttr const &rTmp)
SwTextAttr * GetSortedByEnd(size_t nPos) const
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
sal_Int32 GetAnyEnd() const
end (if available), else start
static bool CmpAttr(const SfxPoolItem &rItem1, const SfxPoolItem &rItem2)
IDocumentContentOperations const & getIDocumentContentOperations() const
The root element of a Writer document layout.
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
void MoveTo(value_type *pDestRing)
Removes this item from its current ring container and adds it to another ring container.
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
SwContentNode * GetContentNode(bool bPoint=true) const
const SfxPoolItem * NextItem()
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr sal_uInt16 RES_GRFATR_END(150)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
const Link< bool, void > & GetOle2Link() const
sal_Int32 GetStart() const
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
virtual bool DoesUndo() const =0
Is Undo enabled?
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
bool FindAttrImpl(SwPaM &rSearchPam, const SfxPoolItem &rAttr, SwMoveFnCollection const &fnMove, const SwPaM &rRegion, bool bInReadOnly, SwRootFrame const *const pLayout)
PaM is Point and Mark: a selection of the document model.
SwTextNode const * GetTextNodeForParaProps() const
virtual bool IsReplaceMode() const =0
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
sal_uLong FindAll(SwFindParas &, SwDocPositions, SwDocPositions, FindRanges, bool &bCancel)
SwTextAttr * Get(size_t nPos) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
T & StaticWhichCast(TypedWhichId< T > nId)
const SwPosition * GetPoint() const
const SwTextAttr * GetFrwrdTextHint(const SwpHints &rHtsArr, size_t &rPos, sal_Int32 nContentPos)
SwIndex & Assign(SwIndexReg *, sal_Int32)
static bool lcl_Search(const SwContentNode &rCNd, const SfxItemSet &rCmpSet, bool bNoColls)
SwContentNode * GetContentNode()
void MakeStartIndex(SwIndex *pIdx)
Marks a character position inside a document model node.
IDocumentState const & getIDocumentState() const
SwpHints & GetSwpHints()
getters for SwpHints
bool HasSwAttrSet() const
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
bool ReplaceImpl(SwPaM &rCursor, OUString const &rReplacement, bool const bRegExp, SwDoc &rDoc, SwRootFrame const *const pLayout)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const SwPosition * Start() const
sal_uInt16 GetCurPos() const
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
An SwTextAttr container, stores all directly formatted text portions for a text node.
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uLong FindAttrs(const SfxItemSet &rSet, bool bNoCollections, SwDocPositions nStart, SwDocPositions nEnd, bool &bCancel, FindRanges, const i18nutil::SearchOptions2 *pSearchOpt, const SfxItemSet *rReplSet=nullptr, SwRootFrame const *const pLayout=nullptr)
search for attributes
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
sal_Int32 GetIndex() const
const sal_Int32 * End() const
static bool FindAttrsImpl(SwPaM &rSearchPam, const SfxItemSet &rSet, bool bNoColls, SwMoveFnCollection const &fnMove, const SwPaM &rRegion, bool bInReadOnly, bool bMoveFirst, SwRootFrame const *const pLayout)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
const SfxPoolItem & GetAttr() const
const LanguageTag & GetLanguageTag() const
SwFormatColl * GetFormatColl() const
bool FindTextImpl(SwPaM &rSearchPam, const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, utl::TextSearch &rSText, SwMoveFnCollection const &fnMove, const SwPaM &rRegion, bool bInReadOnly, SwRootFrame const *const pLayout, std::unique_ptr< SvxSearchItem > &xSearchItem)
Search.
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
std::pair< const_iterator, bool > insert(Value &&x)
bool IsInvalidItem(const SfxPoolItem *pItem)
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
bool(* FnSearchAttr)(const SwTextNode &, SwAttrCheckArr &, SwPaM &)
static void lcl_SetAttrPam(SwPaM &rPam, sal_Int32 nStart, const sal_Int32 *pEnd, const bool bSaveMark)
void MakeEndIndex(SwIndex *pIdx)
static bool lcl_SearchForward(const SwTextNode &rTextNd, SwAttrCheckArr &rCmpArr, SwPaM &rPam)
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
static bool lcl_SearchAttr(const SwTextNode &rTextNd, SwPaM &rPam, const SfxPoolItem &rCmpItem, SwMoveFnCollection const &fnMove)
search for a text attribute
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
static bool lcl_SearchBackward(const SwTextNode &rTextNd, SwAttrCheckArr &rCmpArr, SwPaM &rPam)