22 #include <osl/diagnose.h>
56 #include <section.hxx>
60 #include <strings.hrc>
121 if( !m_pCharClass || eLang != m_eCharClassLang )
124 m_eCharClassLang = eLang;
130 {
return (
' ' == c ||
'\t' == c || 0x0a == c|| 0x3000 == c ); }
132 void SetColl( sal_uInt16 nId,
bool bHdLineOrText =
false );
140 return rFrame.
GetText().isEmpty()
159 OUString* pPrefix =
nullptr, OUString* pPostfix =
nullptr,
160 OUString* pNumTypes =
nullptr )
const;
168 void BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel );
189 return !
m_bEnd && pNextFrame
225 while( *pSrc && *pSrc != c )
227 return *pSrc ? pSrc :
nullptr;
234 assert(pFrame &&
"For Autoformat a Layout is needed");
240 SwTextFrame *
const pFrame(const_cast<SwTextFrame*>(&rFrame));
261 sal_uInt16 nSeqNo = 0;
286 #if OSL_DEBUG_LEVEL > 0
288 sText =
"Action text is missing";
337 m_pCurTextNd =
static_cast<SwTextNode*
>(pNewNd);
338 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
348 if (node.GetNode().GetAnchoredFlys() !=
nullptr)
350 assert(!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();
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 )
597 aBox.
SetLine( &aLine, SvxBoxItemLine::BOTTOM );
614 const OUString& rTmp = m_pCurTextFrame->
GetText();
620 || (
'+' != (cChar = rTmp[sal_Int32(nSttPlus)]) &&
'|' != cChar)
621 || (
'+' != (cChar = rTmp[sal_Int32(nEndPlus) - 1]) &&
'|' != cChar))
627 std::vector<sal_uInt16> aPosArr;
631 switch (rTmp[sal_Int32(n)])
642 aPosArr.push_back( static_cast<sal_uInt16>(aInfo.
GetCharPos(n)) );
648 if( ++n == nEndPlus )
652 if( 1 < aPosArr.size() )
655 sal_uInt16 nColCnt = aPosArr.size() - 1;
656 SwTwips nSttPos = aPosArr[ 0 ];
660 case SvxAdjust::Center: eHori = text::HoriOrientation::CENTER;
break;
661 case SvxAdjust::Right: eHori = text::HoriOrientation::RIGHT;
break;
668 aPosArr.push_back( static_cast<sal_uInt16>(m_pCurTextFrame->
getFrameArea().
Width()) );
671 eHori = text::HoriOrientation::LEFT;
681 *m_aDelPam.
GetPoint(), 1, nColCnt, eHori,
685 return 1 < aPosArr.size();
691 for( nL = rStr.getLength(), n = 0; n < nL &&
IsSpace( rStr[n] ); ++n )
700 sal_Int32 nL = rStr.getLength(),
n = nL;
707 return rStr.copy( 0, n+1 );
716 for( nL = rStr.getLength(), n = 0; n < nL &&
IsSpace( rStr[ n ] ); ++n )
723 sal_Int32 nL = rStr.getLength(),
n = nL;
734 const OUString& rText = rFrame.
GetText();
736 nEnd(rText.getLength());
n < nEnd; ++
n)
744 0 != ( i18n::KCharacterType::UPPER &
752 OUString* pPrefix, OUString* pPostfix, OUString* pNumTypes )
const
756 const OUString& rText = rFrame.
GetText();
757 sal_Int32
nPos(rPos);
760 sal_uInt16 nStart = 0;
763 sal_uInt16 nOpeningParentheses = 0;
764 sal_uInt16 nClosingParentheses = 0;
766 while (nPos < rText.getLength() && nDigitLvl <
MAXLEVEL - 1)
771 if( (
'0' <= cCurrentChar &&
'9' >= cCurrentChar) ||
772 (0xff10 <= cCurrentChar && 0xff19 >= cCurrentChar) )
788 else if( pNumTypes && !(eScan &
DIGIT) )
792 if( 0 != (eScan & ~
CHG) && DIGIT != (eScan & ~
CHG))
796 if( 3 == ++nDigitCnt )
800 nStart += cCurrentChar <=
'9' ? cCurrentChar -
'0' : cCurrentChar - 0xff10;
802 else if( rCC.
isAlpha( rText, nPos ) )
805 0 != ( i18n::KCharacterType::UPPER &
812 if( 256 > cLow && strchr(
"mdclxvi", cLow ) )
838 ( 3 == nStart || 4 == nStart) && 256 > cLow &&
839 strchr(
"mdclxvi", cLow ) &&
844 nStart = 3 == nStart ? 100 : 500;
845 if( UPPER_ALPHA == eTmpScan )
856 eScan = (eScan & ~(UPPER_ALPHA|
LOWER_ALPHA)) | eTmpScan;
858 (*pNumTypes) = pNumTypes->replaceAt( pNumTypes->getLength() - 1, 1, OUString(c) );
871 *pNumTypes += OUStringChar(cNumTyp);
874 else if( pNumTypes && !(eScan & eTmpScan) )
875 *pNumTypes += OUStringChar(cNumTyp);
880 if( 0 != ( eScan & ~
CHG ) && eTmpScan != ( eScan & ~
CHG ))
895 case 'm': nVal = 1000;
goto CHECK_ROMAN_1;
896 case 'd': nVal = 500;
goto CHECK_ROMAN_5;
897 case 'c': nVal = 100;
goto CHECK_ROMAN_1;
898 case 'l': nVal = 50;
goto CHECK_ROMAN_5;
899 case 'x': nVal = 10;
goto CHECK_ROMAN_1;
900 case 'v': nVal = 5;
goto CHECK_ROMAN_5;
904 int nMod5 = nStart % (nVal * 5);
905 int nLast = nStart % nVal;
908 if( nMod5 == ((3 * nVal) + n10 ) ||
909 nMod5 == ((4 * nVal) + n10 ) ||
911 nStart = static_cast<sal_uInt16>(nStart + (n10 * 8));
912 else if( nMod5 == 0 ||
913 nMod5 == (1 * nVal) ||
914 nMod5 == (2 * nVal) )
915 nStart = nStart + nVal;
923 if( ( nStart / nVal ) & 1 )
927 int nMod = nStart % nVal;
930 nStart =
static_cast<sal_uInt16
>(nStart + (3 * n10));
932 nStart = nStart + nVal;
940 if( nStart % 5 >= 3 )
956 else if( (256 > cCurrentChar &&
957 strchr(
".)(", cCurrentChar )) ||
958 0x3002 == cCurrentChar ||
959 0xff0e == cCurrentChar ||
960 0xFF08 == cCurrentChar ||
961 0xFF09 == cCurrentChar )
963 if(cCurrentChar ==
'(' || cCurrentChar == 0xFF09)
964 nOpeningParentheses++;
965 else if(cCurrentChar ==
')'|| cCurrentChar == 0xFF08)
966 nClosingParentheses++;
969 *pPrefix += OUStringChar(rText[nPos]);
971 *pPostfix += OUStringChar(rText[nPos]);
977 *pPrefix +=
"\x01" + OUString::number( nStart );
989 nPos == rText.getLength() || !
IsSpace(rText[nPos]) ||
990 (nOpeningParentheses > nClosingParentheses))
994 *pPrefix +=
"\x01" + OUString::number( nStart );
1020 if( SfxItemState::SET == aSet.GetItemState( RES_PARATR_ADJUST,
1021 false, reinterpret_cast<const SfxPoolItem**>(&pAdj) ))
1024 if( bHdLineOrText ? (SvxAdjust::Right != eAdj &&
1025 SvxAdjust::Center != eAdj)
1026 : SvxAdjust::Block != eAdj )
1027 aSet.ClearItem( RES_PARATR_ADJUST );
1040 &&
' ' == pEndFrame->
GetText()[sal_Int32(rEndIndex) - 1])
1046 &&
' ' == pStartFrame->
GetText()[sal_Int32(rStartIndex)])
1075 const OUString& rStr = rTextFrame.
GetText();
1076 sal_Int32
n = rStr.getLength();
1080 while( --n &&
IsSpace( rStr[ n ] ) )
1082 return '.' == rStr[ n ];
1118 bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
1121 bool isNoRedline(
true);
1130 for ( ; tmp < rIDRA.GetRedlineTable().size(); ++tmp)
1132 SwRangeRedline const*
const pRedline(rIDRA.GetRedlineTable()[tmp]);
1133 if (*rDelPam.
End() <= *pRedline->Start())
1137 if (*pRedline->End() <= *rDelPam.
Start())
1141 if (pRedline->GetType() == RedlineType::Delete)
1143 assert(*pRedline->Start() != *pRedline->End());
1144 isNoRedline =
false;
1145 if (*pCurrent < *pRedline->
Start())
1148 rRanges.back()->SetMark();
1149 *rRanges.back()->GetPoint() = *pRedline->Start();
1151 pCurrent = pRedline->End();
1154 if (!isNoRedline && *pCurrent < *rDelPam.
End())
1157 rRanges.back()->SetMark();
1158 *rRanges.back()->GetPoint() = *rDelPam.
End();
1167 std::vector<std::shared_ptr<SwUnoCursor>> ranges;
1168 if (
GetRanges(ranges, *m_pDoc, rDelPam))
1174 for (
auto const& pCursor : ranges)
1187 SwPaM aTmp( *m_pCurTextNd, 0, pShCursor );
1196 SwPaM* pNext = &rPamToCorrect;
1200 p->
MoveTo( &rPamToCorrect );
1201 }
while( p != pPrev );
1205 m_pCurTextFrame =
GetFrame(*m_pCurTextNd);
1212 bool const bIgnoreLeadingBlanks)
1218 SwTextFrame const*
const pEndFrame(pNextFrame ? pNextFrame : m_pCurTextFrame);
1227 nLeadingPos =
TextFrameIndex(m_pCurTextFrame->GetText().getLength());
1232 bool bHasBlnks =
HasSelBlanks(m_pCurTextFrame, nTrailingPos, pEndFrame, nLeadingPos);
1234 *m_aDelPam.
GetPoint() = m_pCurTextFrame->MapViewToModelPos(nTrailingPos);
1260 else if( bTstNextPara )
1295 m_pCurTextFrame = m_pCurTextNd ?
GetFrame( *m_pCurTextNd ) :
nullptr;
1309 std::vector<std::pair<TextFrameIndex, TextFrameIndex>> spaces;
1313 for (
auto iter = spaces.rbegin(); iter != spaces.rend(); ++iter)
1315 auto & rSpaceRange(*iter);
1316 assert(rSpaceRange.first != rSpaceRange.second);
1318 m_pCurTextFrame, rSpaceRange.first,
1319 m_pCurTextFrame, rSpaceRange.second);
1320 if (rSpaceRange.first != rSpaceRange.second)
1370 if (pNextFrame && !
m_bEnd)
1407 static_cast<sal_uInt8>(
CalcLevel(*m_pCurTextFrame)));
1464 if (!pNextFrame || pCurrNode == pNextFrame)
1503 bool bChgBullet =
false, bChgEnum =
false;
1522 const OUString& rStr = m_pCurTextFrame->
GetText();
1527 if (
nullptr != pFndBulletChr &&
IsSpace(rStr[sal_Int32(nTextStt) + 1]))
1537 if( !aRule.GetNumFormat( nLvl ) )
1562 ? nLeftTextPos / nLvl
1568 aFormat.SetBulletChar( cBullChar );
1571 aFormat.SetPrefix(OUString());
1572 aFormat.SetSuffix(OUString());
1574 aFormat.SetAbsLSpace( nAbsPos );
1575 if( !aFormat.GetCharFormat() )
1576 aFormat.SetCharFormat( pCFormat );
1578 aFormat.SetNumAdjust( SvxAdjust::Right );
1580 aRule.Set(
n, aFormat );
1583 nFrameWidth < ( nSpaceSteps * MAXLEVEL ) )
1584 nSpaceSteps = ( nFrameWidth - nLeftTextPos ) /
1585 ( MAXLEVEL - nLvl );
1603 OUString aPostfix, aPrefix, aNumTypes;
1605 &aPrefix, &aPostfix, &aNumTypes);
1611 if( !nDigitLevel && nLeftTextPos )
1612 nLvl = std::min( sal_uInt16( nLeftTextPos /
lNumberIndent ),
1625 sal_Int32 nPrefixIdx{ 0 };
1629 aFormat.
SetPrefix( aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ));
1630 aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ).toInt32()));
1631 aFormat.SetSuffix( aPostfix.getToken( 0,
u'\x0001' ));
1632 aFormat.SetIncludeUpperLevels( 0 );
1634 if( !aFormat.GetCharFormat() )
1635 aFormat.SetCharFormat( pCFormat );
1637 if( !aNumTypes.isEmpty() )
1638 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ 0 ] -
'0'));
1641 aFormat.SetNumAdjust( SvxAdjust::Right );
1642 aRule.Set( nLvl, aFormat );
1646 auto const nSpaceSteps = nLvl ? nLeftTextPos / nLvl : 0;
1648 sal_Int32 nPostfixIdx{ 0 };
1649 for( n = 0; n <= nLvl; ++n )
1654 aFormat.
SetPrefix( aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ));
1655 aFormat.SetStart( static_cast<sal_uInt16>(aPrefix.getToken( 0,
u'\x0001', nPrefixIdx ).toInt32() ));
1656 aFormat.SetSuffix( aPostfix.getToken( 0,
u'\x0001', nPostfixIdx ));
1657 aFormat.SetIncludeUpperLevels(
MAXLEVEL );
1658 if( n < aNumTypes.getLength() )
1659 aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ n ] -
'0'));
1661 aFormat.SetAbsLSpace( nSpaceSteps * n
1664 if( !aFormat.GetCharFormat() )
1665 aFormat.SetCharFormat( pCFormat );
1667 aFormat.SetNumAdjust( SvxAdjust::Right );
1669 aRule.Set( n, aFormat );
1673 bool bDefStep = nFrameWidth < (nSpaceSteps *
MAXLEVEL);
1679 aFormat.SetAbsLSpace( nLeftTextPos +
1682 aFormat.SetAbsLSpace( nSpaceSteps * n
1684 aRule.Set( n, aFormat );
1695 if ( bChgEnum || bChgBullet )
1737 OUString sChgStr(
'\t');
1739 sChgStr = OUString(&m_aFlags.
cBullet, 1) + sChgStr;
1763 aSet.Put( aTStops );
1791 if (!pNextFrame || pCurrNode == pNextFrame)
1814 SetColl( static_cast<sal_uInt16>( nTextPos
1820 const OUString& rStr = m_pCurTextFrame->
GetText();
1821 bool bInsTab =
true;
1823 if (
'\t' == rStr[sal_Int32(nSpacePos) + 1])
1830 while (nSpaceStt &&
IsSpace(rStr[sal_Int32(--nSpaceStt)]))
1834 if (bInsTab &&
'\t' == rStr[sal_Int32(nSpaceStt)])
1844 if( nSpaceStt < nSpacePos )
1862 20 < std::abs( static_cast<tools::Long>(nSpaces - aFInfo.
SetFrame(
1888 sText = sText.replaceAll(
"$(ARG1)", OUString::number( nLvl + 1 ) );
1923 bool bReplaceQuote( aSvxFlags & ACFlags::ChgQuotes );
1924 bool bReplaceSglQuote( aSvxFlags & ACFlags::ChgSglQuotes );
1927 (!m_aFlags.
bAutoCorrect && !bReplaceQuote && !bReplaceSglQuote &&
1934 const OUString* pText = &m_pCurTextFrame->
GetText();
1953 bool bNbspRunNext =
false;
1959 &&
IsSpace(cChar = (*pText)[sal_Int32(nPos)]))
1964 if( ( ( bReplaceQuote &&
'\"' == cChar ) ||
1965 ( bReplaceSglQuote &&
'\'' == cChar ) ) &&
1966 (!nPos ||
' ' == (*pText)[sal_Int32(nPos)-1]))
1976 bool bSetHardBlank =
false;
1978 OUString sReplace( pATst->
GetQuote( aACorrDoc,
1979 sal_Int32(nPos), cChar,
true ));
1983 if( 2 == sReplace.getLength() &&
' ' == sReplace[ 1 ])
1985 sReplace = sReplace.copy( 0, 1 );
1986 bSetHardBlank =
true;
1994 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
1995 pText = &m_pCurTextFrame->
GetText();
2010 bool bCallACorr =
false;
2012 if (nPos &&
IsSpace((*pText)[sal_Int32(nPos) - 1]))
2014 for (nSttPos = nPos; !bBreak && nPos <
TextFrameIndex(pText->getLength()); ++nPos)
2016 cChar = (*pText)[sal_Int32(nPos)];
2021 if( ( cChar ==
'\"' && bReplaceQuote ) || ( cChar ==
'\'' && bReplaceSglQuote ) )
2029 bool bSetHardBlank =
false;
2031 OUString sReplace( pATst->
GetQuote( aACorrDoc,
2032 sal_Int32(nPos), cChar,
false) );
2034 if( 2 == sReplace.getLength() &&
' ' == sReplace[ 0 ])
2036 sReplace = sReplace.copy( 1 );
2037 bSetHardBlank =
true;
2048 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2049 pText = &m_pCurTextFrame->
GetText();
2081 sal_Unicode cBlank = nSttPos ? (*pText)[sal_Int32(nSttPos) - 1] : 0;
2090 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2091 pText = &m_pCurTextFrame->
GetText();
2100 if (cBlank && cBlank != (*pText)[sal_Int32(nSttPos) - 1])
2114 if (pATst->
FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext))
2136 if( nPos == nSttPos )
2149 aACorrDoc.
ChgAutoCorrWord(reinterpret_cast<sal_Int32&>(nSttPos), sal_Int32(nPos), *pATst,
nullptr))
2157 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2158 pText = &m_pCurTextFrame->
GetText();
2179 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2180 pText = &m_pCurTextFrame->
GetText();
2191 pATst->
FnAddNonBrkSpace(aACorrDoc, *pText, sal_Int32(nPos), eLang, bNbspRunNext);
2196 pATst->
FnChgOrdinalNumber(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2199 pATst->
FnChgToEnEmDash(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang)) ||
2203 pATst->
FnSetINetAttr(aACorrDoc, *pText, sal_Int32(nLastBlank), sal_Int32(nPos), eLang)))
2213 pATst->
FnCapitalStartWord(aACorrDoc, *pText, sal_Int32(nSttPos), sal_Int32(nPos), eLang);
2222 bFirst = bFirstSent;
2229 m_pCurTextFrame =
GetFrame( *m_pCurTextNd );
2230 pText = &m_pCurTextFrame->
GetText();
2243 : m_aFlags( rFlags ),
2244 m_aDelPam( pEdShell->GetDoc()->GetNodes().GetEndOfExtras() ),
2245 m_aNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfExtras(), +1 ),
2246 m_aEndNdIdx( pEdShell->GetDoc()->GetNodes().GetEndOfContent() ),
2247 m_pEditShell( pEdShell ),
2248 m_pDoc( pEdShell->GetDoc() ),
2249 m_pCurTextNd( nullptr ), m_pCurTextFrame( nullptr ),
2250 m_nRedlAutoFormatSeqId( 0 )
2252 OSL_ENSURE( (pSttNd && pEndNd) || (!pSttNd && !pEndNd),
2261 bool bNxtEmpty =
false;
2262 bool bNxtAlpha =
false;
2263 sal_uInt16 nNxtLevel = 0;
2272 m_aEndNdIdx = *pEndNd;
2279 bEmptyLine = !pPrevFrame
2289 m_nEndNdIdx = m_aEndNdIdx.
GetIndex();
2293 m_nEndNdIdx = m_aEndNdIdx.
GetIndex();
2315 sal_uInt16 nLastCalcHeadLvl = 0;
2317 sal_uInt16 nLevel = 0;
2318 sal_uInt16 nDigitLvl = 0;
2339 eStat = READ_NEXT_PARA;
2344 case READ_NEXT_PARA:
2347 eStat =
m_bEnd ? IS_END : TST_EMPTY_LINE;
2351 case TST_EMPTY_LINE:
2366 eStat = READ_NEXT_PARA;
2369 eStat = TST_ALPHA_LINE;
2372 case TST_ALPHA_LINE:
2394 eStat = READ_NEXT_PARA;
2397 eStat = GET_ALL_INFO;
2406 eStat = READ_NEXT_PARA;
2413 aFInfo.
SetFrame( m_pCurTextFrame );
2424 eStat = HAS_FMTCOLL;
2436 reinterpret_cast<const SfxPoolItem**>(&pLRSpace) ) &&
2443 nLevel =
CalcLevel(*m_pCurTextFrame, &nDigitLvl);
2447 eStat = READ_NEXT_PARA;
2454 if( bReplaceStyles )
2464 eStat = READ_NEXT_PARA;
2469 nLevel =
CalcLevel( *m_pCurTextFrame, &nDigitLvl );
2498 eStat = TST_ENUMERIC;
2499 if( !bReplaceStyles )
2504 if( sClrStr.isEmpty() )
2507 eStat = READ_NEXT_PARA;
2518 const sal_Unicode cLast = sEndClrStr[sEndClrStr.getLength() - 1];
2524 eStat = READ_NEXT_PARA;
2527 else if( 256 <= cLast || !strchr(
",.;", cLast ) )
2529 if( bNxtEmpty || bNxtAlpha
2539 else if( nLastCalcHeadLvl < nLevel )
2545 else if( nLastCalcHeadLvl > nLevel )
2550 nLastCalcHeadLvl = nLevel;
2556 eStat = READ_NEXT_PARA;
2571 eStat = READ_NEXT_PARA;
2573 else if( bReplaceStyles )
2574 eStat = nLevel ? TST_IDENT : TST_NEG_IDENT;
2576 eStat = READ_NEXT_PARA;
2591 eStat = READ_NEXT_PARA;
2593 else if (nLevel && pNextFrame &&
2594 !bNxtEmpty && !bNxtAlpha && !nNxtLevel &&
2599 eStat = READ_NEXT_PARA;
2602 eStat = TST_TXT_BODY;
2617 eStat = READ_NEXT_PARA;
2619 else if (!nLevel && pNextFrame &&
2620 !bNxtEmpty && !bNxtAlpha && nNxtLevel &&
2625 eStat = READ_NEXT_PARA;
2628 eStat = TST_TXT_BODY;
2650 eStat = READ_NEXT_PARA;
2658 eStat = READ_NEXT_PARA;
2668 if( bReplaceStyles &&
2671 reinterpret_cast<const SfxPoolItem**>(&pLRSpace) ) &&
2711 std::unique_ptr<SwWait> pWait;
2720 aAFFlags = *pAFlags;
2722 pWait.reset(
new SwWait( *
GetDoc()->GetDocShell(),
true ));
2731 if( rPaM.HasMark() )
2733 SwAutoFormat aFormat(
this, aAFFlags, &(rPaM.Start()->nNode),
2734 &(rPaM.End()->nNode) );
2757 bool bRange =
false;
2771 if (pTextNd && !pTextNd->
GetText().isEmpty())
2773 pContent->
Assign( pTextNd, 0 );
2788 if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
2789 ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
2790 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
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)
sal_uLong GetIndex() const
SwNode & GetNode(bool bPoint=true) const
bool FnChgToEnEmDash(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
sal_Int32 getCharacterType(const OUString &rStr, sal_Int32 nPos) const
Represents the style of a paragraph.
void SetWidth(tools::Long nWidth)
static SvxAutoCorrCfg & Get()
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.
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SvxAdjust GetAdjust() const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
#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)
sal_uInt16 const aTextNodeSetRange[]
void SetCompletePaint() const
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
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 ...
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.
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)
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.
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
void StartProgress(const char *pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
#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
#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
sal_uLong GetIndex() 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
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_()
const short lBulletIndent
PaM is Point and Mark: a selection of the document model.
SwTextNode * GetTextNodeFirst()
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
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
#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.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
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()
vector_type::size_type size_type
const short lBulletFirstLineOffset
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.
::rtl::Reference< Content > pContent
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)
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
virtual bool TransliterateRTLWord(sal_Int32 &rSttPos, sal_Int32 nEndPos) override
SwTextNode is a paragraph in the document model.
void SetAttrListLevel(int nLevel)
Sets the list level of this text node.
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
static SvxSwAutoFormatFlags * GetAutoFormatFlags()
const std::vector< OUString > & GetAutoFormatNameLst() const
#define STR_AUTOFMTREDL_UNDER
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
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 sal_uInt16 lNumberIndent
const SwPosition * End() 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
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)
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
const sal_Int32 COMPLETE_STRING
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