20#include <config_wasm_strip.h>
33#include <osl/diagnose.h>
34#include <officecfg/Office/Writer.hxx>
69#include <unicode/uchar.h>
72#include <com/sun/star/i18n/WordType.hpp>
73#include <com/sun/star/i18n/ScriptType.hpp>
74#include <com/sun/star/i18n/XBreakIterator.hpp>
91 void DetectAndMarkMissingDictionaries(
SwDoc& rDoc,
92 const uno::Reference< XSpellChecker1 >& xSpell,
95 if( xSpell.is() && !xSpell->hasLanguage( eActLang.
get() ) )
132 while (nPosition != -1)
149 sal_Int32 nStt, sal_Int32 nEnd,
152 sal_Int32 nNumOfMaskedRedlines = 0;
163 if( RedlineType::Delete == pRed->
GetType() )
165 sal_Int32 nRedlineEnd;
166 sal_Int32 nRedlineStart;
170 if ( nRedlineEnd < nStt || nRedlineStart > nEnd )
173 while ( nRedlineStart < nRedlineEnd && nRedlineStart < nEnd )
175 if (nRedlineStart >= nStt)
177 rText[nRedlineStart] = cChar;
178 ++nNumOfMaskedRedlines;
185 return nNumOfMaskedRedlines;
193 sal_Int32 nStt, sal_Int32 nEnd,
196 sal_Int32 nRedlinesMasked = 0;
197 sal_Int32 nHiddenCharsMasked = 0;
219 return (nRedlinesMasked > 0) || (nHiddenCharsMasked > 0);
227 sal_Int32
const nChgStart, sal_Int32
const nChgEnd)
244 bool bSameFrame =
true;
248 if( pEndFrame != pStartFrame )
261 aRectFnSet.
SetTop( aRect, aRectFnSet.
GetTop(aStFrame) );
269 if( pStartFrame == pEndFrame )
278 if( aRectFnSet.
GetTop(aTmp) == aRectFnSet.
GetTop(aRect) )
302 std::shared_ptr<SfxItemSet>& pStyleHandle )
306 std::unique_ptr<SfxItemSet> pNewSet;
310 OSL_ENSURE( nWhichId,
"lcl_HaveCommonAttributes not used correctly" );
311 if ( SfxItemState::SET == rSet2.
GetItemState( nWhichId,
false ) )
313 pNewSet = rSet2.
Clone();
314 pNewSet->ClearItem( nWhichId );
317 else if ( pSet1->
Count() )
326 pNewSet = rSet2.
Clone();
327 pNewSet->ClearItem( pItem->
Which() );
336 if ( pNewSet->Count() )
369 const sal_Int32 nLen,
370 const sal_uInt16 nWhich,
372 const bool bInclRefToxMark,
373 const bool bExactRange )
379 sal_Int32 nEnd = nStt + nLen;
383 if ( pTextInputField ==
nullptr )
387 if ( pTextInputField !=
nullptr )
389 if ( nStt > pTextInputField->
GetStart() )
393 if ( nEnd < *(pTextInputField->
End()) )
395 nEnd = *(pTextInputField->
End());
400 bool bChanged =
false;
403 sal_Int32 nMin =
m_Text.getLength();
404 sal_Int32 nMax = nStt;
405 const bool bNoLen = nMin == 0;
409 std::vector<SwTextAttr *> newAttributes;
410 std::vector<SwTextAttr *> delAttributes;
415 sal_Int32 nAttrStart = sal_Int32();
417 while ( (i < m_pSwpHints->
Count())
418 && ( ( ( nAttrStart =
m_pSwpHints->GetWithoutResorting(
i)->GetStart()) < nEnd )
419 || nLen==0 ) && !bExactRange)
425 const sal_Int32*
const pAttrEnd = pHt->
GetEnd();
426 const bool bKeepAttrWithoutEnd =
428 && ( !bInclRefToxMark
433 if ( bKeepAttrWithoutEnd )
447 bool bSkipAttr =
false;
448 std::shared_ptr<SfxItemSet> pStyleHandle;
465 bSkipAttr = nWhich != pHt->
Which();
471 else if ( !bInclRefToxMark )
488 if (nStt <= nAttrStart)
490 const sal_Int32 nAttrEnd = pAttrEnd !=
nullptr
493 if (nEnd > nAttrStart
494 || (nEnd == nAttrEnd && nEnd == nAttrStart))
496 if ( nMin > nAttrStart )
498 if ( nMax < nAttrEnd )
501 bChanged = bChanged || nEnd > nAttrStart || bNoLen;
502 if (nAttrEnd <= nEnd)
504 delAttributes.push_back(pHt);
509 *pStyleHandle, nAttrStart, nAttrEnd );
510 newAttributes.push_back(pNew);
521 if ( pStyleHandle && nAttrStart < nEnd )
524 *pStyleHandle, nAttrStart, nEnd );
525 newAttributes.push_back(pNew);
530 else if (pAttrEnd !=
nullptr)
532 if (*pAttrEnd > nStt)
534 if (*pAttrEnd < nEnd)
536 if ( nMin > nAttrStart )
538 if ( nMax < *pAttrEnd )
542 const sal_Int32 nAttrEnd = *pAttrEnd;
552 *pStyleHandle, nStt, nAttrEnd );
553 newAttributes.push_back(pNew);
560 if ( nMin > nAttrStart )
562 if ( nMax < *pAttrEnd )
565 const sal_Int32 nTmpEnd = *pAttrEnd;
571 if ( pStyleHandle && nStt < nEnd )
574 *pStyleHandle, nStt, nEnd );
575 newAttributes.push_back(pNew);
581 pHt->
GetAttr(), nEnd, nTmpEnd );
588 newAttributes.push_back(pNew);
607 const sal_Int32* pHintEnd = pHint->
GetEnd();
608 if (!pHintEnd || *pHintEnd != nEnd)
611 delAttributes.push_back(pHint);
615 if (bChanged && !delAttributes.empty())
658 if (
nPos > rStr.getLength())
659 return rStr.getLength();
672 OUString
const& rText(
GetText());
673 assert(sal_Int32(
nPos) <= rText.getLength());
680 sal_Int16 nWordType = WordType::DICTIONARY_WORD;
683 rxBreak->getWordBoundary(rText, sal_Int32(
nPos), aLocale, nWordType,
true);
686 if (aBndry.startPos == aBndry.endPos)
688 aBndry = rxBreak->previousWord(rText, sal_Int32(
nPos), aLocale, nWordType);
693 if (aBndry.endPos != aBndry.startPos
696 aBndry.endPos = aBndry.startPos;
703 return rText.copy(aBndry.startPos,
704 aBndry.endPos - aBndry.startPos);
709 sal_uInt16 nType, sal_Int32 nStart, sal_Int32 nEnd,
bool bClp )
711 [&rNd](sal_Int32 const nBegin, sal_uInt16 const nScript, bool const bNoChar)
712 {
return rNd.
GetLang(nBegin, bNoChar ? 0 : 1, nScript); }
713 , rText, pLang, rConvMap,
nType, nStart, nEnd, bClp)
720 sal_Int32 nEnd,
bool bClp)
721 : m_pGetLangOfChar(pGetLangOfChar)
722 , m_aPreDashReplacementText(rText)
724 , m_ModelToView(rConvMap)
726 , m_nOverriddenDashCount(0)
747 if (sDashes.indexOf(cChar) != -1)
775 sal_Int32 forceEachAsianCodePointToWord(
const OUString &rText, sal_Int32 nBegin, sal_Int32 nLen)
781 sal_uInt16 nCurrScript = rxBreak->getScriptType( rText, nBegin );
783 sal_Int32 indexUtf16 = nBegin;
784 rText.iterateCodePoints(&indexUtf16);
787 if (nCurrScript == i18n::ScriptType::ASIAN)
789 nLen = indexUtf16 - nBegin;
795 while (indexUtf16 < nBegin + nLen)
797 nCurrScript = rxBreak->getScriptType( rText, indexUtf16 );
798 if (nCurrScript == i18n::ScriptType::ASIAN)
800 nLen = indexUtf16 - nBegin;
803 rText.iterateCodePoints(&indexUtf16);
816 std::optional<CharClass> xLocalCharClass;
836 pCC = &*xLocalCharClass;
852 OSL_ENSURE( aBound.endPos >= aBound.startPos,
"broken aBound result" );
862 if(aBound.endPos == aBound.startPos)
885 OSL_ENSURE( aBound.endPos >=
m_nBegin,
"Unexpected aBound result" );
890 const sal_Int32 nScriptEnd =
m_nBegin +
892 const sal_Int32 nEnd =
std::min( aBound.endPos, nScriptEnd );
895 sal_Int32 nScriptBegin = 0;
899 aTmpWord =
m_aText.copy( aBound.startPos,
901 nScriptBegin = aBound.startPos +
906 m_nBegin = std::max( aBound.startPos, nScriptBegin );
912 OUString aTmpWord =
m_aText.copy( aBound.startPos,
913 aBound.endPos - aBound.startPos );
914 const sal_Int32 nScriptEnd = aBound.startPos +
916 const sal_Int32 nEnd =
std::min( aBound.endPos, nScriptEnd );
925 aBound.startPos = std::max( aBound.startPos,
m_nStartPos );
927 if (aBound.endPos < aBound.startPos)
954 const OUString aOldText(
m_Text );
955 OUStringBuffer buf(
m_Text);
957 const bool bRestoreString =
961 m_Text = buf.makeStringAndClear();
964 sal_Int32 nBegin = ( pArgs->
pStartNode != this )
968 sal_Int32 nEnd = ( pArgs->
pEndNode != this )
988 if (nBegin >
m_Text.getLength())
990 nBegin =
m_Text.getLength();
992 if (nEnd >
m_Text.getLength())
994 nEnd =
m_Text.getLength();
1003 if ( bRestoreString )
1017 WordType::DICTIONARY_WORD,
1021 const OUString& rWord = aScanner.
GetWord();
1033 pArgs->
xSpellAlt = pArgs->
xSpeller->spell( rWord,
static_cast<sal_uInt16
>(eActLang),
1034 Sequence< PropertyValue >() );
1042 ( (bRestoreString || bContainsComments) && pArgs->
xSpeller->isValid( rWord.replaceAll(OUStringChar(
CH_TXTATR_INWORD),
""),
1043 static_cast<sal_uInt16
>(eActLang), Sequence< PropertyValue >() ) ) )
1055 sal_Int32 nLeft = 0;
1058 pChar = rWord.getLength() ? rWord.getStr() + rWord.getLength() - 1 :
nullptr;
1059 sal_Int32 nRight = 0;
1074 if ( bRestoreString )
1084 const vcl::Font *pFont, sal_uInt16 nFontWhichId )
1092 OSL_ENSURE( pFont,
"target font missing?" );
1101 aSet.
Put( aFontItem );
1117 const sal_Int32 nTextBegin = ( rArgs.
pStartNode == this )
1121 const sal_Int32 nTextEnd = ( rArgs.
pEndNode == this )
1128 const OUString aOldText(
m_Text );
1129 OUStringBuffer buf(
m_Text);
1130 const bool bRestoreString =
1134 m_Text = buf.makeStringAndClear();
1137 bool bFound =
false;
1138 sal_Int32 nBegin = nTextBegin;
1147 SwPaM aCurPaM( *
this, 0 );
1161 typedef std::pair<sal_Int32, sal_Int32> ImplicitChangesRange;
1162 std::vector<ImplicitChangesRange> aImplicitChanges;
1174 assert(nChPos != -1);
1177 nChPos =
m_Text.getLength();
1180 nLen = nChPos - nBegin;
1181 bFound = bLangOk && nLen > 0;
1186 SwPaM aCurPaM( *
this, nBegin );
1194 bool bIsAsianScript = (SvtScriptType::ASIAN == pEditShell->
GetScriptType());
1200 aImplicitChanges.emplace_back(nBegin, nBegin+nLen);
1204 }
while (!bFound && aIter.
Next());
1207 for (
const auto& rImplicitChange : aImplicitChanges)
1209 SwPaM aPaM( *
this, rImplicitChange.first );
1218 if (nBegin < nTextBegin)
1219 nBegin = nTextBegin;
1220 if (nBegin + nLen > nTextEnd)
1221 nLen = nTextEnd - nBegin;
1222 bool bInSelection = nBegin < nTextEnd;
1224 if (bFound && bInSelection)
1226 OSL_ENSURE( !
m_Text.isEmpty(),
"convertible text portion missing!" );
1239 if ( bRestoreString )
1259 const OUString aOldText( pNode->
GetText() );
1260 OUStringBuffer buf(pNode->
m_Text);
1262 const bool bRestoreString =
1266 pNode->
m_Text = buf.makeStringAndClear();
1271 sal_Int32 nBegin = 0;
1272 sal_Int32 nEnd = pNode->
GetText().getLength();
1273 sal_Int32 nInsertPos = 0;
1275 sal_Int32 nChgEnd = 0;
1277 sal_Int32 nInvEnd = 0;
1300 WordType::DICTIONARY_WORD,
true );
1301 nBegin = aBound.startPos;
1308 if( nInsertPos < pNode->GetWrong()->
Count() &&
1314 bool bFresh = nBegin < nEnd;
1315 bool bPending(
false);
1323 WordType::DICTIONARY_WORD, nBegin, nEnd);
1327 const OUString& rWord = aScanner.
GetWord();
1329 sal_Int32 nLen = aScanner.
GetLen();
1334 DetectAndMarkMissingDictionaries( rDoc, xSpell, eActLang );
1336 bool bSpell = xSpell.is() && xSpell->hasLanguage(
static_cast<sal_uInt16
>(eActLang) );
1337 if( bSpell && !rWord.isEmpty() )
1340 OSL_ENSURE(!bSpell || xSpell.is(),
"NULL pointer");
1341 if( !xSpell->isValid( rWord,
static_cast<sal_uInt16
>(eActLang), Sequence< PropertyValue >() ) &&
1345 ((!bRestoreString && !bContainsComments) || !xSpell->isValid( rWord.replaceAll(OUStringChar(
CH_TXTATR_INWORD),
""),
1346 static_cast<sal_uInt16
>(eActLang), Sequence< PropertyValue >() ) ) )
1348 sal_Int32 nSmartTagStt = nBegin;
1349 sal_Int32 nDummy = 1;
1358 nChgStart, nChgEnd, nBegin, nLen, nInsertPos, nActPos));
1362 pNode->
GetWrong()->
Insert(OUString(),
nullptr, nBegin, nLen, nInsertPos++);
1369 nInvEnd = nBegin + nLen;
1374 else if( bAddAutoCmpl && rACW.
GetMinWordLen() <= rWord.getLength() )
1378 bool bCursorOutsideWord = nActPos > nBegin + nLen || nActPos < nBegin;
1379 if (bCursorOutsideWord)
1388 if ( bRestoreString )
1390 pNode->
m_Text = aOldText;
1396 nEnd, 0, nInsertPos, nActPos );
1400 if( nChgStart < nChgEnd )
1405#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1446 const OUString& rText = pNode->
GetText();
1453 sal_Int32 nBegin = 0;
1454 sal_Int32 nEnd = rText.getLength();
1456 if ( pSmartTagList )
1463 if ( nBegin < nEnd )
1469 if (nEnd > rText.getLength() || nEnd < 0)
1470 nEnd = rText.getLength();
1475 const sal_uInt16 nNumberOfEntries = pSmartTagList ? pSmartTagList->
Count() : 0;
1476 sal_uInt16 nNumberOfRemovedEntries = 0;
1477 sal_uInt16 nNumberOfInsertedEntries = 0;
1480 if ( 0 != nNumberOfEntries )
1483 sal_Int32 nChgEnd = 0;
1484 const sal_uInt16 nCurrentIndex = pSmartTagList->
GetWrongPos( nBegin );
1485 pSmartTagList->
Fresh( nChgStart, nChgEnd, nBegin, nEnd - nBegin, nCurrentIndex,
COMPLETE_STRING );
1486 nNumberOfRemovedEntries = nNumberOfEntries - pSmartTagList->
Count();
1489 if ( nBegin < nEnd )
1493 const OUString& aExpandText = aConversionMap.
getViewText();
1496 uno::Reference<text::XTextMarkup>
const xTextMarkup =
1507 sal_Int32 nLangBegin = nBegin;
1517 nLangEnd = std::min<sal_Int32>( nEnd, aIter.
GetChgPos() );
1524 nLangBegin = nLangEnd;
1526 while ( aIter.
Next() && nLangEnd < nEnd );
1530 const sal_uInt16 nNumberOfEntriesAfterRecognize = pSmartTagList ? pSmartTagList->
Count() : 0;
1531 nNumberOfInsertedEntries = nNumberOfEntriesAfterRecognize - ( nNumberOfEntries - nNumberOfRemovedEntries );
1544 if ( nBegin < nEnd && ( 0 != nNumberOfRemovedEntries ||
1545 0 != nNumberOfInsertedEntries ) )
1566 sal_Int32 nBegin = 0;
1567 sal_Int32 nEnd = pNode->
GetText().getLength();
1569 bool bACWDirty =
false;
1575 WordType::DICTIONARY_WORD, nBegin, nEnd );
1579 nLen = aScanner.
GetLen();
1582 const OUString& rWord = aScanner.
GetWord();
1584 if( nActPos < nBegin || ( nBegin + nLen ) < nActPos )
1621 if (wordStart.first != &rNode || wordEnd.first != &rNode)
1623 SAL_WARN(
"sw.core",
"UpdateTextNodeHyphInfo: outside of node");
1627 o_rHyphInfo.
m_nWordLen = wordEnd.second - wordStart.second;
1642 [&rHyphInf,
this]() {
1643 std::pair<Point, bool> tmp;
1647 tmp.first = *pPoint;
1652 nullptr, pPoint ? &tmp :
nullptr));
1659 OSL_ENSURE( pFrame,
"!SwTextNode::Hyphenate: can't find any frame" );
1688 struct swTransliterationChgData
1693 Sequence< sal_Int32 > aOffsets;
1700 sal_Int32 nStt, sal_Int32 nEnd,
1706 const sal_Int32 selStart = nStt;
1707 const sal_Int32 selEnd = nEnd;
1714 const sal_Int16 nWordType = WordType::ANYWORD_IGNOREWHITESPACES;
1722 std::vector< swTransliterationChgData > aChanges;
1723 swTransliterationChgData aChgData;
1725 if (rTrans.
getType() == TransliterationFlags::TITLE_CASE)
1743 if (aSttBndry.endPos <= nStt)
1751 if (aEndBndry.startPos >= nEnd)
1754 GetText(), aEndBndry.startPos,
1761 if (aSttBndry.startPos >= selEnd || aEndBndry.endPos <= selStart) {
1767 aSttBndry.startPos = std::max(aSttBndry.startPos, selStart);
1768 aEndBndry.startPos = std::max(aSttBndry.startPos, aEndBndry.startPos);
1770 Boundary aCurWordBndry( aSttBndry );
1771 while (aCurWordBndry.startPos <= aEndBndry.startPos)
1773 nStt = aCurWordBndry.startPos;
1774 nEnd = aCurWordBndry.endPos;
1775 const sal_Int32 nLen = nEnd - nStt;
1776 OSL_ENSURE( nLen > 0,
"invalid word length of 0" );
1778 Sequence <sal_Int32> aOffsets;
1782 assert(nStt <
m_Text.getLength());
1783 if (0 != rtl_ustr_shortenedCompare_WithLength(
1785 sChgd.getStr(), sChgd.getLength(), nLen))
1787 aChgData.nStart = nStt;
1788 aChgData.nLen = nLen;
1789 aChgData.sChanged = sChgd;
1790 aChgData.aOffsets = aOffsets;
1791 aChanges.push_back( aChgData );
1800 else if (rTrans.
getType() == TransliterationFlags::SENTENCE_CASE)
1814 sal_Int32 nCurrentStart = nStt;
1821 if (nCurrentEnd <= nStt)
1830 i18n::WordType::DICTIONARY_WORD);
1841 if (nLastStart >= nEnd)
1850 i18n::WordType::DICTIONARY_WORD);
1854 if (nCurrentEnd > nLastEnd)
1855 nCurrentEnd = nLastEnd;
1859 nCurrentStart = std::max(selStart, nCurrentStart);
1860 nCurrentEnd =
std::min(selEnd, nCurrentEnd);
1861 nLastEnd =
std::min(selEnd, nLastEnd);
1863 while (nCurrentStart < nLastEnd)
1865 sal_Int32 nLen = nCurrentEnd - nCurrentStart;
1866 OSL_ENSURE( nLen > 0,
"invalid word length of 0" );
1868 Sequence <sal_Int32> aOffsets;
1870 GetLang(nCurrentStart), nCurrentStart, nLen, &aOffsets) );
1872 assert(nStt <
m_Text.getLength());
1873 if (0 != rtl_ustr_shortenedCompare_WithLength(
1875 sChgd.getStr(), sChgd.getLength(), nLen))
1877 aChgData.nStart = nCurrentStart;
1878 aChgData.nLen = nLen;
1879 aChgData.sChanged = sChgd;
1880 aChgData.aOffsets = aOffsets;
1881 aChanges.push_back( aChgData );
1888 nCurrentStart = aFirstWordBndry.startPos;
1898 std::unique_ptr<SwLanguageIterator> pIter;
1902 sal_Int32 nEndPos = 0;
1907 nLang = pIter->GetLanguage();
1908 nEndPos = pIter->GetChgPos();
1909 if( nEndPos > nEnd )
1917 const sal_Int32 nLen = nEndPos - nStt;
1919 Sequence <sal_Int32> aOffsets;
1923 assert(nStt <
m_Text.getLength());
1924 if (0 != rtl_ustr_shortenedCompare_WithLength(
1926 sChgd.getStr(), sChgd.getLength(), nLen))
1928 aChgData.nStart = nStt;
1929 aChgData.nLen = nLen;
1930 aChgData.sChanged = sChgd;
1931 aChgData.aOffsets = aOffsets;
1932 aChanges.push_back( aChgData );
1936 }
while( nEndPos < nEnd && pIter && pIter->
Next() );
1939 if (aChanges.empty())
1946 for (
size_t i = 0;
i < aChanges.size(); ++
i)
1949 swTransliterationChgData &
rData =
1950 aChanges[ aChanges.size() - 1 -
i ];
1952 nSum +=
rData.sChanged.getLength() -
rData.nLen;
1955 SAL_WARN(
"sw.core",
"SwTextNode::ReplaceTextOnly: "
1956 "node text with insertion > node capacity.");
1960 if ( bUseRedlining )
1981 const OUString & rText,
1982 const Sequence<sal_Int32>& rOffsets )
1988 sal_Int32 nTLen = rText.getLength();
1989 const sal_Int32* pOffsets = rOffsets.getConstArray();
1991 sal_Int32 nMyOff =
nPos;
1992 for( sal_Int32 nI = 0; nI < nTLen; ++nI )
1994 const sal_Int32 nOff = pOffsets[ nI ];
1999 while( nI + nCnt < nTLen && nOff == pOffsets[ nI + nCnt ] )
2007 else if( nOff > nMyOff )
2030 sal_Int32 nStt, sal_Int32 nEnd )
const
2040 bool bCountAll = ( (0 == nStt) && (
GetText().getLength() == nEnd) );
2047 bool bCountNumbering = nStt == 0;
2048 bool bHasBullet =
false, bHasNumbering =
false;
2049 OUString sNumString;
2050 if (bCountNumbering)
2053 bHasNumbering = !sNumString.isEmpty();
2056 bCountNumbering = bHasNumbering || bHasBullet;
2059 if( nStt == nEnd && !bCountNumbering)
2089 const OUString& aExpandText = aConversionMap.
getViewText();
2091 if (aExpandText.isEmpty() && !bCountNumbering)
2108 sal_uInt32 nTmpWords = 0;
2109 sal_uInt32 nTmpAsianWords = 0;
2110 sal_uInt32 nTmpChars = 0;
2111 sal_uInt32 nTmpCharsExcludingSpaces = 0;
2114 if (!aExpandText.isEmpty())
2119 SwScanner aScanner( *
this, aExpandText,
nullptr, aConversionMap, i18n::WordType::WORD_COUNT,
2120 nExpandBegin, nExpandEnd,
true );
2127 if( !aExpandText.match(aBreakWord, aScanner.
GetBegin() ))
2130 const OUString &rWord = aScanner.
GetWord();
2152 i18n::WordType::WORD_COUNT, 0, sNumString.getLength(),
true );
2157 const OUString &rWord = aScanner.
GetWord();
2166 else if ( bHasBullet )
2170 ++nTmpCharsExcludingSpaces;
2186 rStat.
nWord += nTmpWords;
2188 rStat.
nChar += nTmpChars;
2270 "Weird - we have a smart tag list without any recognizers?" );
const sal_Int32 m_nLength
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...
static bool AnyInput(VclInputFlags nType=VCL_INPUT_ANY)
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
static bool IsShowChanges(const RedlineFlags eM)
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual std::shared_ptr< SfxItemSet > getAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily, const OUString *pParentName=nullptr)=0
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
const OUString & getViewText() const
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
virtual std::unique_ptr< SfxItemSet > Clone(bool bItems=true, SfxItemPool *pToPool=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo)
void RecognizeTextRange(const css::uno::Reference< css::text::XTextRange > &rRange, const css::uno::Reference< css::text::XTextMarkup > &rMarkup, const css::uno::Reference< css::frame::XController > &rController) const
void RecognizeString(const OUString &rText, const css::uno::Reference< css::text::XTextMarkup > &rMarkup, const css::uno::Reference< css::frame::XController > &rController, const css::lang::Locale &rLocale, sal_uInt32 nStart, sal_uInt32 nLen) const
void SetStyleName(const OUString &rStyleName)
void SetFamily(FontFamily _eFamily)
void SetPitch(FontPitch _ePitch)
void SetFamilyName(const OUString &rFamilyName)
void SetCharSet(rtl_TextEncoding _eEncoding)
static sal_Int16 CheckSpellLang(css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpell, LanguageType nLang)
bool InsertWord(const OUString &rWord, SwDoc &rDoc)
sal_uInt16 GetMinWordLen() const
sal_Int32 getGraphemeCount(const OUString &rStr, sal_Int32 nStart, sal_Int32 nEnd) const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
const css::lang::Locale & GetLocale(const LanguageType aLang)
SwFormatColl * GetFormatColl() const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
void Push()
store a copy of the current cursor on the cursor stack
void SetSelection(const SwPaM &rCursor)
bool Pop(PopMode)
delete cursor
css::uno::Reference< css::frame::XController > GetController()
static SwAutoCompleteWord & GetAutoCompleteWords()
void SetMissingDictionaries(bool bIsMissing)
Use to notify if the dictionary can be found for a single content portion (has to be called for all p...
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
SwEditShell const * GetEditShell() const
::sw::DocumentSettingManager & GetDocumentSettingManager()
SwDocShell * GetDocShell()
SvtScriptType GetScriptType() const
returns the script type of the selection
SwRect GetPaintArea() const
|* The paintarea is the area, in which the content of a frame is allowed |* to be displayed.
SwRootFrame * getRootFrame()
void SetCompletePaint() const
Marks a character position inside a document model node.
SwIndex & Assign(SwIndexReg *, sal_Int32)
sal_Int32 GetIndex() const
a clone of SwInterHyphInfo, but with TextFrameIndex instead of node index
TextFrameIndex m_nWordLen
SwInterHyphInfoTextFrame(SwTextFrame const &rFrame, SwTextNode const &rNode, SwInterHyphInfo const &rHyphInfo)
TextFrameIndex m_nStart
input: requested range to hyphenate
css::uno::Reference< css::linguistic2::XHyphenatedWord > m_xHyphWord
output: hyphenated word
void UpdateTextNodeHyphInfo(SwTextFrame const &rFrame, SwTextNode const &rNode, SwInterHyphInfo &o_rHyphInfo)
TextFrameIndex m_nWordStart
output: found word
void SetHyphWord(const css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHW)
sal_Int32 m_nWordStart
output: found word
const Point * GetCursorPos() const
LanguageType GetLanguage() const
sal_Int32 GetChgPos() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
bool IsInRedlines() const
Checks if this node is in redlines.
IStyleAccess & getIDocumentStyleAccess()
Provides access to the document automatic styles interface.
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
PaM is Point and Mark: a selection of the document model.
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
const SwPosition * GetPoint() const
const SwPosition * Start() const
void CalcStartEnd(SwNodeOffset nNdIdx, sal_Int32 &rStart, sal_Int32 &rEnd) const
Calculates the intersection with text node number nNdIdx.
RedlineType GetType(sal_uInt16 nPos=0) const
void SetBottom(SwRect &rRect, tools::Long nNew) const
void SetRight(SwRect &rRect, tools::Long nNew) const
tools::Long GetTop(const SwRect &rRect) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetBottom(const SwRect &rRect) const
void SetTop(SwRect &rRect, tools::Long nNew) const
tools::Long GetRight(const SwRect &rRect) const
void SetLeft(SwRect &rRect, tools::Long nNew) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
SwRect & Union(const SwRect &rRect)
vector_type::size_type size_type
SwViewShell * GetCurrShell() const
const LanguageType * m_pLanguage
const ModelToViewHelper m_ModelToView
SwScanner(const std::function< LanguageType(sal_Int32, sal_Int32, bool)> &pGetLangOfChar, const OUString &rText, const LanguageType *pLang, const ModelToViewHelper &rConvMap, sal_uInt16 nWordType, sal_Int32 nStart, sal_Int32 nEnd, bool bClip=false)
const OUString m_aPreDashReplacementText
LanguageType m_aCurrentLang
sal_Int32 GetBegin() const
const OUString & GetWord() const
sal_Int32 getOverriddenDashCount() const
std::function< LanguageType(sal_Int32, sal_Int32, bool)> m_pGetLangOfChar
sal_Int32 m_nOverriddenDashCount
LanguageType GetCurrentLanguage() const
static sal_Int32 MaskHiddenRanges(const SwTextNode &rNode, OUStringBuffer &rText, const sal_Int32 nStt, const sal_Int32 nEnd, const sal_Unicode cChar)
Hidden text attribute handling.
static SwSmartTagMgr & Get()
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SfxPoolItem & GetAttr() const
virtual const sal_Int32 * GetEnd() const
end position
const sal_Int32 * End() const
sal_Int32 GetStart() const
virtual void SetEnd(sal_Int32)
void SetStart(sal_Int32 n)
start position
void SetSortNumber(sal_uInt16 nSortNumber)
sal_uInt16 GetSortNumber() const
Represents the visualization of a paragraph.
SwTextFrame * GetFollow()
TextFrameIndex GetOffset() const
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
void CollectAutoCmplWrds(SwTextNode &, sal_Int32)
Is called by DoIdleJob_()
SwRect SmartTagScan(SwTextNode &)
Is called by DoIdleJob_()
bool Hyphenate(SwInterHyphInfoTextFrame &rInf)
We format a Line for interactive hyphenation.
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
bool IsSymbolAt(TextFrameIndex) const
SwRect AutoSpell_(SwTextNode &, sal_Int32)
Is called by DoIdleJob_() and ExecSpellPopup()
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
bool IsHiddenNow() const
Hidden.
SwTextFrame & GetFrameAtOfst(TextFrameIndex nOfst)
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
OUString GetCurWord(SwPosition const &) const
SwTextNode is a paragraph in the document model.
bool HasBullet() const
Returns if this text node has a bullet.
SAL_DLLPRIVATE void SetLanguageAndFont(const SwPaM &rPaM, LanguageType nLang, sal_uInt16 nLangWhichId, const vcl::Font *pFont, sal_uInt16 nFontWhichId)
sal_Int32 GetSpaceLeft() const
bool IsSmartTagDirty() const
SwWrongList * GetSmartTags()
bool IsGrammarCheckDirty() const
void DestroyAttr(SwTextAttr *pAttr)
void RstTextAttr(const SwIndex &rIdx, const sal_Int32 nLen, const sal_uInt16 nWhich=0, const SfxItemSet *pSet=nullptr, const bool bInclRefToxMark=false, const bool bExactRange=false)
delete all attributes.
bool IsAutoCompleteWordDirty() const
void SetWordCountDirty(bool bNew) const
void SetGrammarCheckDirty(bool bNew) const
void SetSmartTags(std::unique_ptr< SwWrongList > pNew)
void ReplaceTextOnly(sal_Int32 nPos, sal_Int32 nLen, const OUString &rText, const css::uno::Sequence< sal_Int32 > &rOffsets)
void SetSmartTagDirty(bool bNew) const
std::unique_ptr< SwpHints > m_pSwpHints
May be 0.
virtual void Update(SwIndex const &rPos, const sal_Int32 nChangeLen, const bool bNegative=false, const bool bDelete=false) override
override SwIndexReg
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
void SetAutoCompleteWordDirty(bool bNew) const
std::unique_ptr< SwWrongList > ReleaseSmartTags()
bool CountWords(SwDocStat &rStat, sal_Int32 nStart, sal_Int32 nEnd) const
count words in given range - returns true if we refreshed out count
bool Convert(SwConversionArgs &)
bool IsSymbolAt(sal_Int32 nBegin) const
in ndcopy.cxx
bool IsWordCountDirty() const
SAL_DLLPRIVATE void InitSwParaStatistics(bool bNew)
Start: Data collected during idle time.
std::unique_ptr< SwGrammarMarkUp > ReleaseGrammarCheck()
SwGrammarMarkUp * GetGrammarCheck()
SwParaIdleData_Impl * m_pParaIdleData_Impl
void SetWrongDirty(WrongState eNew) const
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns outline of numbering string.
bool Spell(SwSpellArgs *)
bool IsWrongDirty() const
SwpHints * GetpSwpHints()
void SetWrong(std::unique_ptr< SwWrongList > pNew)
const OUString & GetText() const
WrongState GetWrongDirty() const
void TransliterateText(utl::TransliterationWrapper &rTrans, sal_Int32 nStart, sal_Int32 nEnd, SwUndoTransliterate *pUndo, bool bUseRedlining=false)
change text to Upper/Lower/Hiragana/Katakana/...
bool InsertHint(SwTextAttr *const pAttr, const SetAttrMode nMode=SetAttrMode::DEFAULT)
Insert pAttr into hints array.
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
void SetGrammarCheck(std::unique_ptr< SwGrammarMarkUp > pNew)
@ PARENT
EXPAND : (Start < nIndex <= End)
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
bool Hyphenate(SwInterHyphInfo &rHyphInf)
Interactive hyphenation: we find TextFrame and call its CalcHyph.
std::unique_ptr< SwWrongList > ReleaseWrong()
void AddChanges(SwTextNode &rTNd, sal_Int32 nStart, sal_Int32 nLen, css::uno::Sequence< sal_Int32 > const &rOffsets)
static bool IsAutoCompleteWords()
void InvalidateAccessibleParaAttrs(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
const SfxItemPool & GetAttrPool() const
sal_Int32 GetEndInv() const
sal_Int32 Pos(sal_uInt16 nIdx) const
FreshState Fresh(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos, sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos)
Remove given range of entries.
sal_uInt16 GetWrongPos(sal_Int32 nValue) const
Find the first position that is greater or equal to the given value.
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
void SetInvalid(sal_Int32 nBegin, sal_Int32 nEnd)
void Insert(sal_uInt16 nWhere, std::vector< SwWrongArea >::iterator startPos, std::vector< SwWrongArea >::iterator const &endPos)
sal_Int32 GetBeginInv() const
sal_Int32 Len(sal_uInt16 nIdx) const
sal_Int32 NextWrong(sal_Int32 nChk) const
Find next incorrectly selected position.
Implementation of the css::text::XTextMarkup interface.
static bool IsChinese(LanguageType nLang)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
OUString transliterate(const OUString &rStr, sal_Int32 nStart, sal_Int32 nLen) const
bool needLanguageForTheMode() const
TransliterationFlags getType() const
FontFamily GetFamilyType()
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
rtl_TextEncoding GetCharSet() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
bool isTXTATR_WITHEND(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
#define CH_TXTATR_BREAKWORD
CharClass & GetAppCharClass()
#define SAL_WARN(area, stream)
const ContentProperties & rData
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwTextFrame * SwHyphIterCacheLastTextFrame(SwTextNode const *pNode, const sw::Creator &create)
SwInsText MakeSwInsText(SwTextNode &rNode, sal_Int32 const nPos, sal_Int32 const nLen)
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
static LanguageType nLang
This struct defines a position in the model string.
bool bAllowImplicitChangesForNotConvertibleText
LanguageType nConvSrcLang
LanguageType nConvTargetLang
const vcl::Font * pTargetFont
LanguageType nConvTextLang
sal_uLong nCharExcludingSpaces
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
sal_uLong nAllPara
all paragraphs, including empty/hidden ones
sal_uLong nNumberOfCharsExcludingSpaces
std::unique_ptr< SwWrongList > pWrong
SwTextNode::WrongState eWrongDirty
online spell checking needed/done?
std::unique_ptr< SwGrammarMarkUp > pGrammarCheck
sal_uLong nNumberOfAsianWords
std::unique_ptr< SwWrongList > pSmartTags
bool bAutoComplDirty
auto complete list dirty
Marks a position in the document model.
css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller
UNDERLYING_TYPE get() const
Reference< XController > xController
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
@ NOHINTADJUST
attention: NOHINTADJUST prevents MergePortions! when using this need to pay attention to ignore start...
constexpr sal_Int32 COMPLETE_STRING
SwTextAttr * MakeTextAttr(SwDoc &rDoc, SfxPoolItem &rAttr, sal_Int32 const nStt, sal_Int32 const nEnd, CopyOrNewType const bIsCopy, SwTextNode *const pTextNode)
if COPY then pTextNode must be given!
static sal_Int32 clipIndexBounds(const OUString &rStr, sal_Int32 nPos)
static bool lcl_MaskRedlinesAndHiddenText(const SwTextNode &rNode, OUStringBuffer &rText, sal_Int32 nStt, sal_Int32 nEnd, const sal_Unicode cChar=CH_TXTATR_INWORD)
Used for spell checking.
static SwRect lcl_CalculateRepaintRect(const SwTextFrame &rTextFrame, const SwTextNode &rNode, sal_Int32 const nChgStart, sal_Int32 const nChgEnd)
Used for spell checking.
static sal_Int32 lcl_MaskRedlines(const SwTextNode &rNode, OUStringBuffer &rText, sal_Int32 nStt, sal_Int32 nEnd, const sal_Unicode cChar)
static bool lcl_HasComments(const SwTextNode &rNode)
static bool lcl_HaveCommonAttributes(IStyleAccess &rStyleAccess, const SfxItemSet *pSet1, sal_uInt16 nWhichId, const SfxItemSet &rSet2, std::shared_ptr< SfxItemSet > &pStyleHandle)
Used for automatic styles.