22 #include <osl/diagnose.h>
57 #include <section.hxx>
61 #include <strings.hrc>
123 if( !m_pCharClass || eLang != m_eCharClassLang )
126 m_eCharClassLang = eLang;
132 {
return (
' ' == c ||
'\t' == c || 0x0a == c|| 0x3000 == c ); }
134 void SetColl( sal_uInt16 nId,
bool bHdLineOrText =
false );
142 return rFrame.
GetText().isEmpty()
161 OUString* pPrefix =
nullptr, OUString* pPostfix =
nullptr,
162 OUString* pNumTypes =
nullptr )
const;
170 void BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel );
191 return !
m_bEnd && pNextFrame
227 while( *pSrc && *pSrc != c )
229 return *pSrc ? pSrc :
nullptr;
236 assert(pFrame &&
"For Autoformat a Layout is needed");
242 SwTextFrame *
const pFrame(const_cast<SwTextFrame*>(&rFrame));
263 sal_uInt16 nSeqNo = 0;
288 #if OSL_DEBUG_LEVEL > 0
290 sText =
"Action text is missing";
339 m_pCurTextNd =
static_cast<SwTextNode*
>(pNewNd);
340 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
351 if (!node.GetNode().GetAnchoredFlys().empty())
389 const OUString& rText = rFrame.
GetText();
414 const sal_Int32 nLen = sTmp.getLength();
419 while (nIdx < nLen && !
IsSpace(sTmp[nIdx])) ++nIdx;
423 const sal_Int32 nFirst = nIdx;
424 while (nIdx < nLen &&
IsSpace(sTmp[nIdx])) ++nIdx;
433 sal_uInt16 *
const pDigitLvl)
const
435 sal_uInt16 nLvl = 0, nBlnk = 0;
436 const OUString& rText = rFrame.
GetText();
438 *pDigitLvl = USHRT_MAX;
460 nEnd(rText.getLength());
n < nEnd; ++
n)
462 switch (rText[sal_Int32(
n)])
464 case ' ':
if( 3 == ++nBlnk )
497 return aFInfo.
GetBigIndent( rCurrentSpacePos, pNextFrame );
502 const OUString& rStr = rFrame.
GetText();
506 sal_Int32 nANChar = 0, nBlnk = 0;
509 nEnd(rStr.getLength());
n < nEnd; ++
n)
521 sal_uLong nLen = rStr.getLength() - nBlnk;
522 nLen = ( nLen * 3 ) / 4;
523 return sal_Int32(nLen) < (rStr.getLength() - nANChar - nBlnk);
531 OUString
const& rText(m_pCurTextFrame->
GetText());
534 while (nCnt < rText.getLength())
539 case '-': eTmp = 1;
break;
540 case '_': eTmp = 2;
break;
541 case '=': eTmp = 3;
break;
542 case '*': eTmp = 4;
break;
543 case '~': eTmp = 5;
break;
544 case '#': eTmp = 6;
break;
550 else if( eState != eTmp )
596 aBox.
SetLine( &aLine, SvxBoxItemLine::BOTTOM );
613 const OUString& rTmp = m_pCurTextFrame->
GetText();
619 || (
'+' != (cChar = rTmp[sal_Int32(nSttPlus)]) &&
'|' != cChar)
620 || (
'+' != (cChar = rTmp[sal_Int32(nEndPlus) - 1]) &&
'|' != cChar))
626 std::vector<sal_uInt16> aPosArr;
630 switch (rTmp[sal_Int32(n)])
641 aPosArr.push_back( o3tl::narrowing<sal_uInt16>(aInfo.
GetCharPos(n)) );
647 if( ++n == nEndPlus )
651 if( 1 < aPosArr.size() )
654 sal_uInt16 nColCnt = aPosArr.size() - 1;
655 SwTwips nSttPos = aPosArr[ 0 ];
659 case SvxAdjust::Center: eHori = text::HoriOrientation::CENTER;
break;
660 case SvxAdjust::Right: eHori = text::HoriOrientation::RIGHT;
break;
667 aPosArr.push_back( o3tl::narrowing<sal_uInt16>(m_pCurTextFrame->
getFrameArea().
Width()) );
670 eHori = text::HoriOrientation::LEFT;
680 *m_aDelPam.
GetPoint(), 1, nColCnt, eHori,
684 return 1 < aPosArr.size();
690 for( nL = rStr.getLength(), n = 0; n < nL &&
IsSpace( rStr[n] ); ++n )
699 sal_Int32 nL = rStr.getLength(),
n = nL;
706 return rStr.copy( 0, n+1 );
715 for( nL = rStr.getLength(), n = 0; n < nL &&
IsSpace( rStr[ n ] ); ++n )
722 sal_Int32 nL = rStr.getLength(),
n = nL;
733 const OUString& rText = rFrame.
GetText();
735 nEnd(rText.getLength());
n < nEnd; ++
n)
743 0 != ( i18n::KCharacterType::UPPER &
751 OUString* pPrefix, OUString* pPostfix, OUString* pNumTypes )
const
755 const OUString& rText = rFrame.
GetText();
756 sal_Int32
nPos(rPos);
759 sal_uInt16 nStart = 0;
762 sal_uInt16 nOpeningParentheses = 0;
763 sal_uInt16 nClosingParentheses = 0;
765 while (nPos < rText.getLength() && nDigitLvl <
MAXLEVEL - 1)
770 if( (
'0' <= cCurrentChar &&
'9' >= cCurrentChar) ||
771 (0xff10 <= cCurrentChar && 0xff19 >= cCurrentChar) )
787 else if( pNumTypes && !(eScan &
DIGIT) )
791 if( 0 != (eScan & ~
CHG) && DIGIT != (eScan & ~
CHG))
795 if( 3 == ++nDigitCnt )
799 nStart += cCurrentChar <=
'9' ? cCurrentChar -
'0' : cCurrentChar - 0xff10;
801 else if( rCC.
isAlpha( rText, nPos ) )
804 0 != ( i18n::KCharacterType::UPPER &
811 if( 256 > cLow && strchr(
"mdclxvi", cLow ) )
837 ( 3 == nStart || 4 == nStart) && 256 > cLow &&
838 strchr(
"mdclxvi", cLow ) &&
843 nStart = 3 == nStart ? 100 : 500;
844 if( UPPER_ALPHA == eTmpScan )
855 eScan = (eScan & ~(UPPER_ALPHA|
LOWER_ALPHA)) | eTmpScan;
857 (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, rtl::OUStringChar(c) );
870 *pNumTypes += OUStringChar(cNumTyp);
873 else if( pNumTypes && !(eScan & eTmpScan) )
874 *pNumTypes += OUStringChar(cNumTyp);
879 if( 0 != ( eScan & ~
CHG ) && eTmpScan != ( eScan & ~
CHG ))
894 case 'm': nVal = 1000;
goto CHECK_ROMAN_1;
895 case 'd': nVal = 500;
goto CHECK_ROMAN_5;
896 case 'c': nVal = 100;
goto CHECK_ROMAN_1;
897 case 'l': nVal = 50;
goto CHECK_ROMAN_5;
898 case 'x': nVal = 10;
goto CHECK_ROMAN_1;
899 case 'v': nVal = 5;
goto CHECK_ROMAN_5;
903 int nMod5 = nStart % (nVal * 5);
904 int nLast = nStart % nVal;
907 if( nMod5 == ((3 * nVal) + n10 ) ||
908 nMod5 == ((4 * nVal) + n10 ) ||
910 nStart = o3tl::narrowing<sal_uInt16>(nStart + (n10 * 8));
911 else if( nMod5 == 0 ||
912 nMod5 == (1 * nVal) ||
913 nMod5 == (2 * nVal) )
914 nStart = nStart + nVal;
922 if( ( nStart / nVal ) & 1 )
926 int nMod = nStart % nVal;
929 nStart = o3tl::narrowing<sal_uInt16>(nStart + (3 * n10));
931 nStart = nStart + nVal;
939 if( nStart % 5 >= 3 )
955 else if( (256 > cCurrentChar &&
956 strchr(
".)(", cCurrentChar )) ||
957 0x3002 == cCurrentChar ||
958 0xff0e == cCurrentChar ||
959 0xFF08 == cCurrentChar ||
960 0xFF09 == cCurrentChar )
962 if(cCurrentChar ==
'(' || cCurrentChar == 0xFF09)
963 nOpeningParentheses++;
964 else if(cCurrentChar ==
')'|| cCurrentChar == 0xFF08)
965 nClosingParentheses++;
968 *pPrefix += OUStringChar(rText[nPos]);
970 *pPostfix += OUStringChar(rText[nPos]);
976 *pPrefix +=
"\x01" + OUString::number( nStart );
988 nPos == rText.getLength() || !
IsSpace(rText[nPos]) ||
989 (nOpeningParentheses > nClosingParentheses))
993 *pPrefix +=
"\x01" + OUString::number( nStart );
1016 if(
SvxAdjustItem const * pAdj = aSet.GetItemIfSet( RES_PARATR_ADJUST,
false) )
1019 if( bHdLineOrText ? (SvxAdjust::Right != eAdj &&
1020 SvxAdjust::Center != eAdj)
1021 : SvxAdjust::Block != eAdj )
1022 aSet.ClearItem( RES_PARATR_ADJUST );
1035 &&
' ' == pEndFrame->
GetText()[sal_Int32(rEndIndex) - 1])
1041 &&
' ' == pStartFrame->
GetText()[sal_Int32(rStartIndex)])
1056 if( pBreakItem && SvxBreak::NONE != pBreakItem->
GetBreak() )
1069 const OUString& rStr = rTextFrame.
GetText();
1070 sal_Int32
n = rStr.getLength();
1074 while( --n &&
IsSpace( rStr[ n ] ) )
1076 return '.' == rStr[ n ];
1112 bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
1115 bool isNoRedline(
true);
1124 for ( ; tmp < rIDRA.GetRedlineTable().size(); ++tmp)
1126 SwRangeRedline const*
const pRedline(rIDRA.GetRedlineTable()[tmp]);
1127 if (*rDelPam.
End() <= *pRedline->Start())
1131 if (*pRedline->End() <= *rDelPam.
Start())
1135 if (pRedline->GetType() == RedlineType::Delete)
1137 assert(*pRedline->Start() != *pRedline->End());
1138 isNoRedline =
false;
1139 if (*pCurrent < *pRedline->
Start())
1143 *rRanges.back()->GetPoint() = *pRedline->Start();
1145 pCurrent = pRedline->End();
1148 if (!isNoRedline && *pCurrent < *rDelPam.
End())
1151 rRanges.back()->SetMark();
1152 *rRanges.back()->GetPoint() = *rDelPam.
End();
1161 std::vector<std::shared_ptr<SwUnoCursor>> ranges;
1162 if (
GetRanges(ranges, *m_pDoc, rDelPam))
1168 for (
auto const& pCursor : ranges)
1181 SwPaM aTmp( *m_pCurTextNd, 0, pShCursor );
1190 SwPaM* pNext = &rPamToCorrect;
1194 p->
MoveTo( &rPamToCorrect );
1195 }
while( p != pPrev );
1199 m_pCurTextFrame =
GetFrame(*m_pCurTextNd);
1206 bool const bIgnoreLeadingBlanks)
1212 SwTextFrame const*
const pEndFrame(pNextFrame ? pNextFrame : m_pCurTextFrame);
1221 nLeadingPos =
TextFrameIndex(m_pCurTextFrame->GetText().getLength());
1226 bool bHasBlnks =
HasSelBlanks(m_pCurTextFrame, nTrailingPos, pEndFrame, nLeadingPos);
1228 *m_aDelPam.
GetPoint() = m_pCurTextFrame->MapViewToModelPos(nTrailingPos);
1254 else if( bTstNextPara )
1289 m_pCurTextFrame = m_pCurTextNd ?
GetFrame( *m_pCurTextNd ) :
nullptr;
1303 std::vector<std::pair<TextFrameIndex, TextFrameIndex>> spaces;
1307 for (
auto iter = spaces.rbegin(); iter != spaces.rend(); ++iter)
1309 auto & rSpaceRange(*iter);
1310 assert(rSpaceRange.first != rSpaceRange.second);
1312 m_pCurTextFrame, rSpaceRange.first,
1313 m_pCurTextFrame, rSpaceRange.second);
1314 if (rSpaceRange.first != rSpaceRange.second)
1364 if (pNextFrame && !
m_bEnd)
1401 static_cast<sal_uInt8>(
CalcLevel(*m_pCurTextFrame)));
1458 if (!pNextFrame || pCurrNode == pNextFrame)
1497 bool bChgBullet =
false, bChgEnum =
false;
1516 const OUString& rStr = m_pCurTextFrame->
GetText();
1521 if (
nullptr != pFndBulletChr &&
IsSpace(rStr[sal_Int32(nTextStt) + 1]))
1531 if( !aRule.GetNumFormat( nLvl ) )
1556 ? nLeftTextPos / nLvl
1562 aFormat.SetBulletChar( cBullChar );
1565 aFormat.SetPrefix(OUString());
1566 aFormat.SetSuffix(OUString());
1568 aFormat.SetAbsLSpace( nAbsPos );
1569 if( !aFormat.GetCharFormat() )
1570 aFormat.SetCharFormat( pCFormat );
1572 aFormat.SetNumAdjust( SvxAdjust::Right );
1574 aRule.Set(
n, aFormat );
1577 nFrameWidth < ( nSpaceSteps * MAXLEVEL ) )
1578 nSpaceSteps = ( nFrameWidth - nLeftTextPos ) /
1579 ( MAXLEVEL - nLvl );
1597 OUString aPostfix, aPrefix, aNumTypes;
1599 &aPrefix, &aPostfix, &aNumTypes);
1600 if (USHRT_MAX != nDigitLevel)
1605 if( !nDigitLevel && nLeftTextPos )
1619 sal_Int32 nPrefixIdx{ 0 };
1623 aFormat.
SetPrefix( aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ));
1625 aFormat.SetSuffix( aPostfix.getToken( 0,
u'\x0001' ));
1626 aFormat.SetIncludeUpperLevels( 0 );
1628 if( !aFormat.GetCharFormat() )
1629 aFormat.SetCharFormat( pCFormat );
1631 if( !aNumTypes.isEmpty() )
1632 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ 0 ] -
'0'));
1635 aFormat.SetNumAdjust( SvxAdjust::Right );
1636 aRule.Set( nLvl, aFormat );
1640 auto const nSpaceSteps = nLvl ? nLeftTextPos / nLvl : 0;
1642 sal_Int32 nPostfixIdx{ 0 };
1643 for( n = 0; n <= nLvl; ++n )
1648 aFormat.
SetPrefix( aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ));
1650 aFormat.SetSuffix( aPostfix.getToken( 0,
u'\x0001', nPostfixIdx ));
1651 aFormat.SetIncludeUpperLevels(
MAXLEVEL );
1652 if( n < aNumTypes.getLength() )
1653 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ n ] -
'0'));
1655 aFormat.SetAbsLSpace( nSpaceSteps * n
1658 if( !aFormat.GetCharFormat() )
1659 aFormat.SetCharFormat( pCFormat );
1661 aFormat.SetNumAdjust( SvxAdjust::Right );
1663 aRule.Set( n, aFormat );
1667 bool bDefStep = nFrameWidth < (nSpaceSteps *
MAXLEVEL);
1673 aFormat.SetAbsLSpace( nLeftTextPos +
1676 aFormat.SetAbsLSpace( nSpaceSteps * n
1678 aRule.Set( n, aFormat );
1689 if ( bChgEnum || bChgBullet )
1731 OUString sChgStr(
'\t');
1733 sChgStr = OUString(&m_aFlags.
cBullet, 1) + sChgStr;
1757 aSet.Put( aTStops );
1785 if (!pNextFrame || pCurrNode == pNextFrame)
1808 SetColl( o3tl::narrowing<sal_uInt16>( nTextPos
1814 const OUString& rStr = m_pCurTextFrame->
GetText();
1815 bool bInsTab =
true;
1817 if (
'\t' == rStr[sal_Int32(nSpacePos) + 1])
1824 while (nSpaceStt &&
IsSpace(rStr[sal_Int32(--nSpaceStt)]))
1828 if (bInsTab &&
'\t' == rStr[sal_Int32(nSpaceStt)])
1838 if( nSpaceStt < nSpacePos )
1882 sText = sText.replaceAll(
"$(ARG1)", OUString::number( nLvl + 1 ) );
1917 bool bReplaceQuote( aSvxFlags & ACFlags::ChgQuotes );
1918 bool bReplaceSglQuote( aSvxFlags & ACFlags::ChgSglQuotes );
1921 (!m_aFlags.
bAutoCorrect && !bReplaceQuote && !bReplaceSglQuote &&
1928 const OUString* pText = &m_pCurTextFrame->
GetText();
1947 bool bNbspRunNext =
false;
1953 &&
IsSpace(cChar = (*pText)[sal_Int32(nPos)]))
1958 if( ( ( bReplaceQuote &&
'\"' == cChar ) ||
1959 ( bReplaceSglQuote &&
'\'' == cChar ) ) &&
1960 (!nPos ||
' ' == (*pText)[sal_Int32(nPos)-1]))
1970 bool bSetHardBlank =
false;
1972 OUString sReplace( pATst->
GetQuote( aACorrDoc,
1973 sal_Int32(nPos), cChar,
true ));
1977 if( 2 == sReplace.getLength() &&
' ' == sReplace[ 1 ])
1979 sReplace = sReplace.copy( 0, 1 );
1980 bSetHardBlank =
true;
1988 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
1989 pText = &m_pCurTextFrame->
GetText();
2004 bool bCallACorr =
false;
2006 if (nPos &&
IsSpace((*pText)[sal_Int32(nPos) - 1]))
2008 for (nSttPos = nPos; !bBreak && nPos <
TextFrameIndex(pText->getLength()); ++nPos)
2010 cChar = (*pText)[sal_Int32(nPos)];
2015 if( ( cChar ==
'\"' && bReplaceQuote ) || ( cChar ==
'\'' && bReplaceSglQuote ) )
2023 bool bSetHardBlank =
false;
2025 OUString sReplace( pATst->
GetQuote( aACorrDoc,
2026 sal_Int32(nPos), cChar,
false) );
2028 if( 2 == sReplace.getLength() &&
' ' == sReplace[ 0 ])
2030 sReplace = sReplace.copy( 1 );
2031 bSetHardBlank =
true;
2042 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2043 pText = &m_pCurTextFrame->
GetText();
2075 sal_Unicode cBlank = nSttPos ? (*pText)[sal_Int32(nSttPos) - 1] : 0;
2084 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2085 pText = &m_pCurTextFrame->
GetText();
2094 if (cBlank && cBlank != (*pText)[sal_Int32(nSttPos) - 1])
2108 if (pATst->
FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext))
2130 if( nPos == nSttPos )
2157 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2158 pText = &m_pCurTextFrame->
GetText();
2167 aACorrDoc.
ChgAutoCorrWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), *pATst,
nullptr) )
2174 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2175 pText = &m_pCurTextFrame->
GetText();
2186 pATst->
FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext);
2191 pATst->
FnChgOrdinalNumber(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2194 pATst->
FnChgToEnEmDash(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2198 pATst->
FnSetINetAttr(aACorrDoc, *pText, sal_Int32(nLastBlank), sal_Int32(nPos), eLang)))
2208 pATst->
FnCapitalStartWord(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang);
2217 bFirst = bFirstSent;
2224 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2225 pText = &m_pCurTextFrame->
GetText();
2238 : m_aFlags( rFlags ),
2239 m_aDelPam( pEdShell->GetDoc()->GetNodes().GetEndOfExtras() ),
2240 m_aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(),
SwNodeOffset(+1) ),
2241 m_aEndNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfContent() ),
2242 m_pEditShell( pEdShell ),
2243 m_pDoc( pEdShell->GetDoc() ),
2244 m_pCurTextNd( nullptr ), m_pCurTextFrame( nullptr ),
2245 m_nRedlAutoFormatSeqId( 0 )
2247 OSL_ENSURE( (pSttNd && pEndNd) || (!pSttNd && !pEndNd),
2256 bool bNxtEmpty =
false;
2257 bool bNxtAlpha =
false;
2258 sal_uInt16 nNxtLevel = 0;
2267 m_aEndNdIdx = *pEndNd;
2274 bEmptyLine = !pPrevFrame
2284 m_nEndNdIdx = m_aEndNdIdx.
GetIndex();
2288 m_nEndNdIdx = m_aEndNdIdx.
GetIndex();
2290 sal_Int32(m_nEndNdIdx),
2310 sal_uInt16 nLastCalcHeadLvl = 0;
2311 sal_uInt16 nLastHeadLvl = USHRT_MAX;
2312 sal_uInt16 nLevel = 0;
2313 sal_uInt16 nDigitLvl = 0;
2334 eStat = READ_NEXT_PARA;
2339 case READ_NEXT_PARA:
2342 eStat =
m_bEnd ? IS_END : TST_EMPTY_LINE;
2346 case TST_EMPTY_LINE:
2361 eStat = READ_NEXT_PARA;
2364 eStat = TST_ALPHA_LINE;
2367 case TST_ALPHA_LINE:
2389 eStat = READ_NEXT_PARA;
2392 eStat = GET_ALL_INFO;
2401 eStat = READ_NEXT_PARA;
2408 aFInfo.
SetFrame( m_pCurTextFrame );
2419 eStat = HAS_FMTCOLL;
2437 nLevel =
CalcLevel(*m_pCurTextFrame, &nDigitLvl);
2441 eStat = READ_NEXT_PARA;
2448 if( bReplaceStyles )
2458 eStat = READ_NEXT_PARA;
2463 nLevel =
CalcLevel( *m_pCurTextFrame, &nDigitLvl );
2492 eStat = TST_ENUMERIC;
2493 if( !bReplaceStyles )
2498 if( sClrStr.isEmpty() )
2501 eStat = READ_NEXT_PARA;
2512 const sal_Unicode cLast = sEndClrStr[sEndClrStr.getLength() - 1];
2518 eStat = READ_NEXT_PARA;
2521 else if( 256 <= cLast || !strchr(
",.;", cLast ) )
2523 if( bNxtEmpty || bNxtAlpha
2531 if( USHRT_MAX == nLastHeadLvl )
2533 else if( nLastCalcHeadLvl < nLevel )
2539 else if( nLastCalcHeadLvl > nLevel )
2544 nLastCalcHeadLvl = nLevel;
2550 eStat = READ_NEXT_PARA;
2565 eStat = READ_NEXT_PARA;
2567 else if( bReplaceStyles )
2568 eStat = nLevel ? TST_IDENT : TST_NEG_IDENT;
2570 eStat = READ_NEXT_PARA;
2585 eStat = READ_NEXT_PARA;
2587 else if (nLevel && pNextFrame &&
2588 !bNxtEmpty && !bNxtAlpha && !nNxtLevel &&
2593 eStat = READ_NEXT_PARA;
2596 eStat = TST_TXT_BODY;
2611 eStat = READ_NEXT_PARA;
2613 else if (!nLevel && pNextFrame &&
2614 !bNxtEmpty && !bNxtAlpha && nNxtLevel &&
2619 eStat = READ_NEXT_PARA;
2622 eStat = TST_TXT_BODY;
2644 eStat = READ_NEXT_PARA;
2652 eStat = READ_NEXT_PARA;
2662 if( bReplaceStyles &&
2704 std::unique_ptr<SwWait> pWait;
2713 aAFFlags = *pAFlags;
2715 pWait.reset(
new SwWait( *
GetDoc()->GetDocShell(),
true ));
2724 if( rPaM.HasMark() )
2726 SwAutoFormat aFormat(
this, aAFFlags, &(rPaM.Start()->nNode),
2727 &(rPaM.End()->nNode) );
2750 bool bRange =
false;
2764 if (pTextNd && !pTextNd->
GetText().isEmpty())
2766 pContent->
Assign( pTextNd, 0 );
2781 if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
2782 ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
2783 ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr | ACFlags::Autocorrect ))
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
vcl::RenderContext * GetOut() const
static SwTwips GetLineStart(const SwTextCursor &rLine)
const SwEndNode * EndOfSectionNode() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
void merge(RingContainer< value_type > aDestRing)
Merges two ring containers.
Represents the visualization of a paragraph.
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
const SvxLRSpaceItem & GetLRSpace(bool=true) const
void SetBorderLineStyle(SvxBorderLineStyle nNew)
bool Insert(const SvxTabStop &rTab)
SwNode & GetNode(bool bPoint=true) const
sal_Int32 getCharacterType(const OUString &rStr, sal_Int32 nPos) const
Represents the style of a paragraph.
void SetWidth(tools::Long nWidth)
static SvxAutoCorrCfg & Get()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor >> &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Marks a position in the document model.
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
bool isAlpha(const OUString &rStr, sal_Int32 nPos) const
bool IsSectionNode() const
const OUString & GetFamilyName() const
bool IsMultiSelection() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SvxAdjust GetAdjust() const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
SwPageDesc * GetPageDesc()
bool FnChgToEnEmDash(SvxAutoCorrDoc &, std::u16string_view, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
#define STR_AUTOFMTREDL_NON_BREAK_SPACE
const OUString & GetText() const
static ShellResource * GetShellRes()
SwDocShell * GetDocShell()
static bool isLetterType(sal_Int32 nType)
const OUString & GetStyleName() const
bool FnChgOrdinalNumber(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
void SetCompletePaint() const
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
SAL_DLLPRIVATE void DeleteSel(SwPaM &rPam, bool *pUndo=nullptr)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
const SwRect & getFramePrintArea() const
const SwPosition * GetMark() const
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
SVX_NUM_CHARS_UPPER_LETTER
sw::MergedPara * GetMergedPara()
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
helper class to disable creation of an action by a callback event in particular, change event from a ...
constexpr sal_uInt8 MAXLEVEL
void AutoCorrect(SvxAutoCorrect &rACorr, bool bInsertMode, sal_Unicode cChar)
Call AutoCorrect.
bool IsPoolUserFormat(sal_uInt16 nId)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
static bool HasSelBlanks(SwTextFrame const *const pStartFrame, TextFrameIndex &rStartIndex, SwTextFrame const *const pEndFrame, TextFrameIndex &rEndIndex)
void EndProgress(SwDocShell const *pDocShell)
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
virtual void Calc(vcl::RenderContext *pRenderContext) const
Of course Writer needs its own rectangles.
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
SwNodeOffset abs(const SwNodeOffset &a)
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
IDocumentContentOperations const & getIDocumentContentOperations() const
sal_Int32 GetBigIndent(TextFrameIndex &rFndPos, const SwTextFrame *pNextFrame) const
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.
UseOnPage GetUseOn() const
bool isFrameAreaDefinitionValid() const
#define LANGUAGE_HUNGARIAN
FontFamily GetFamilyType()
const SwSection & GetSection() const
SwContentNode * GetContentNode(bool bPoint=true) const
const sal_Unicode cStarSymbolEmDash
#define STR_AUTOFMTREDL_DEL_MORELINES
void FnCapitalStartSentence(SvxAutoCorrDoc &, const OUString &, bool bNormalPos, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
#define STR_AUTOFMTREDL_CPTL_STT_WORD
bool IsBullet(TextFrameIndex nTextPos) const
WhichRangesContainer const aTextNodeSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
const SwRect & getFrameArea() const
#define STR_AUTOFMTREDL_USE_REPLACE
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
static const sal_Int16 Medium
#define STR_AUTOFMTREDL_TYPO
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
void SetAllScriptItem(SfxItemSet &rSet, const SfxPoolItem &rItem)
bool IsFilled(const sal_uInt8 nPercent) const
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
void Width(tools::Long nNew)
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
sal_uInt8 GetAutoFormatLvl() const
#define STR_AUTOFMTREDL_SET_TMPL_TEXT
bool IsProtectFlag() const
SwNodeOffset GetIndex() const
void GotoNextLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
virtual bool DoesUndo() const =0
Is Undo enabled?
SwTwips GetFirstIndent() const
void FnCapitalStartWord(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
SwRect GetPaintSwRect()
Page number etc.
SwShellCursor * GetCursor_()
PaM is Point and Mark: a selection of the document model.
SwTextNode * GetTextNodeFirst()
const SwAttrSet * GetpSwAttrSet() const
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
SwTextNode const * GetTextNodeForParaProps() const
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
tools::Long GetTextLeft() const
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
constexpr sal_uInt16 lNumberIndent
#define STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT
SVX_NUM_CHARS_LOWER_LETTER
bool IsInRightToLeftText() const
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
void AutoFormat(const SvxSwAutoFormatFlags *pAFlags)
Set our styles according to the respective rules.
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
#define STR_AUTOFMTREDL_DEL_EMPTY_PARA
const SwPosition * GetPoint() const
void AutoFormatBySplitNode()
#define STR_AUTOFMTREDL_BOLD
#define STR_AUTOFMTREDL_FRACTION
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
SwIndex & Assign(SwIndexReg *, sal_Int32)
void Push()
store a copy of the current cursor on the cursor stack
SvxAutoCorrect * GetAutoCorrect()
bool FnAddNonBrkSpace(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos, LanguageType eLang, bool &io_bNbspRunNext)
bool IsHiddenFlag() const
SwContentNode * GetContentNode()
SwNodeOffset GetIndex() const
vector_type::size_type size_type
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
tools::Long GetLeft() const
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
const SvxAdjustItem & GetAdjust(bool=true) const
Marks a character position inside a document model node.
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
bool FnSetINetAttr(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
const sal_Unicode pBulletChar[6]
short GetTextFirstLineOffset() const
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
Marks a node in the document model.
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
bool HasSwAttrSet() const
ring_container GetRingContainer()
void SetDistance(sal_uInt16 nNew, SvxBoxItemLine nLine)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
static sal_uInt16 GetNumIndent(sal_uInt8 nLvl)
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
#define STR_AUTOFMTREDL_CPTL_STT_SENT
void SetAutoFormatRedlineComment(const OUString *pText, sal_uInt16 nSeqNo=0)
Set comment-text for Redline.
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
#define STR_AUTOFMTREDL_SET_TMPL_INDENT
const SwPosition * Start() const
Text body first line indent.
static SvxSwAutoFormatFlags * s_pAutoFormatFlags
SwTextFrameInfo & SetFrame(const SwTextFrame *pNew)
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
#define STR_AUTOFMTREDL_SET_TMPL_HEADLINE
const sal_Unicode cStarSymbolEnDash
#define STR_AUTOFMTREDL_DETECT_URL
#define STR_AUTOFMTREDL_SET_NUMBER_BULLET
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
void SetAttrListLevel(int nLevel)
Sets the list level of this text node.
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
static const sal_Int16 Hairline
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
virtual bool TransliterateRTLWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, bool bApply=false) override
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
static SvxSwAutoFormatFlags * GetAutoFormatFlags()
constexpr short lBulletFirstLineOffset
const std::vector< OUString > & GetAutoFormatNameLst() const
static const sal_Int16 Thin
#define STR_AUTOFMTREDL_UNDER
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
#define STR_AUTOFMTREDL_TRANSLITERATE_RTL
#define STR_AUTOFMTREDL_ORDINAL
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
sal_Int32 GetIndex() const
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
const SwPosition * End() const
bool IsRightToLeft() const
virtual bool ChgAutoCorrWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, SvxAutoCorrect &rACorrect, OUString *pPara) override
#define STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
static const sal_Unicode * StrChr(const sal_Unicode *pSrc, sal_Unicode c)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
SwMoveFnCollection const & fnMoveBackward
const SwTextFrame * GetFrame() const
SwTableNode * FindTableNode()
Search table node, in which it is.
void GetSpaces(std::vector< std::pair< TextFrameIndex, TextFrameIndex >> &, bool bWithLineBreak) const
constexpr sal_Int32 COMPLETE_STRING
SwNodeOffset Count() const
void GotoPrevLayoutTextFrame(SwNodeIndex &rIndex, SwRootFrame const *const pLayout)
SwTwips GetCharPos(TextFrameIndex nChar, bool bCenter=true) const
SwTextNode const * pLastNode
mainly for sanity checks
#define STR_AUTOFMTREDL_END
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
bool FnChgWeightUnderl(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos)
constexpr short lBulletIndent
Text body hanging indent.
SwSectionNode * GetSectionNode()
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool Pop(PopMode)
delete cursor
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.
constexpr TypedWhichId< SwParaConnectBorderItem > RES_PARATR_CONNECT_BORDER(78)
void StartAllAction()
For all views of this document.
static void SetAutoFormatFlags(SvxSwAutoFormatFlags const *)
SwRootFrame * GetLayout() const
SwViewShell * GetCurrShell() const
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...
const SwTable * InsertTable(const SwInsertTableOptions &rInsTableOpts, const SwPosition &rPos, sal_uInt16 nRows, sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFormat *pTAFormat=nullptr, const std::vector< sal_uInt16 > *pColArr=nullptr, bool bCalledFromShell=false, bool bNewModel=true)
Insert new table at position.
CharClass & GetAppCharClass()
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
const sal_uInt16 cnNumBullColls
static const sal_Int16 Thick
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
SwRootFrame * getRootFrame()
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
rtl_TextEncoding GetCharSet() const
SwTextFormatColl & GetNextTextFormatColl() const
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
void SetAutoFormatRedline(bool bFlag)
#define STR_AUTOFMTREDL_DASH
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
Base class of the Writer document model elements.
SwTextFormatColl * GetTextColl() const