23 #include <officecfg/Office/Common.hxx>
30 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
31 #include <com/sun/star/i18n/WordType.hpp>
32 #include <com/sun/star/i18n/XBreakIterator.hpp>
46 #include <accessibilityoptions.hxx>
53 #include <strings.hrc>
82 const sal_uInt16 nGridWidth =
GetGridWidth(*pGrid, *pDoc);
83 tools::Long nGridWidthAdd = nGridWidth - nFontWidth;
85 while (nGridWidthAdd < 0)
86 nGridWidthAdd += nGridWidth;
106 , m_pScrFont(nullptr)
108 , m_pPrinter(nullptr)
109 , m_nGuessedLeading(USHRT_MAX)
110 , m_nExtLeading(USHRT_MAX)
112 , m_nPrtAscent(USHRT_MAX)
114 , m_nPrtHeight(USHRT_MAX)
115 , m_nPropWidth(rFont.GetPropWidth())
116 , m_nScrHangingBaseline(0)
117 , m_nPrtHangingBaseline(0)
173 return &rRefDev != &rOutDev &&
181 struct CalcLinePosData
186 const bool bSwitchH2V;
187 const bool bSwitchH2VLRBT;
188 const bool bSwitchL2R;
190 sal_Int32* pKernArray;
194 TextFrameIndex const _nCnt,
const bool _bSwitchH2V,
const bool _bSwitchH2VLRBT,
const bool _bSwitchL2R,
195 tools::Long _nHalfSpace, sal_Int32* _pKernArray,
const bool _bBidiPor) :
199 bSwitchH2V( _bSwitchH2V ),
200 bSwitchH2VLRBT( _bSwitchH2VLRBT ),
201 bSwitchL2R( _bSwitchL2R ),
202 nHalfSpace( _nHalfSpace ),
203 pKernArray( _pKernArray ),
204 bBidiPor( _bBidiPor )
220 if ( nEnd < rData.nCnt
221 &&
CH_BLANK == rData.rInf.GetText()[sal_Int32(rData.rInf.GetIdx() + nEnd)] )
224 nBlank -= nTmpSpaceAdd;
226 nBlank -= rData.nHalfSpace;
230 sal_Int32 nKernStart = nStart ? rData.pKernArray[sal_Int32(nStart) - 1] : 0;
231 sal_Int32 nKernEnd = rData.pKernArray[sal_Int32(nEnd) - 1];
233 const Degree10 nDir = rData.bBidiPor ? 1800_deg10
235 rData.bSwitchH2V, rData.bSwitchH2VLRBT);
237 switch ( nDir.
get() )
240 rStart.AdjustX(nKernStart );
241 rEnd.setX( nBlank + rData.rInf.GetPos().X() + nKernEnd );
242 rEnd.setY( rData.rInf.GetPos().Y() );
245 rStart.AdjustY( -nKernStart );
246 rEnd.setX( rData.rInf.GetPos().X() );
247 rEnd.setY( nBlank + rData.rInf.GetPos().Y() - nKernEnd );
250 rStart.AdjustX( -nKernStart );
251 rEnd.setX( rData.rInf.GetPos().X() - nKernEnd - nBlank );
252 rEnd.setY( rData.rInf.GetPos().Y() );
255 rStart.AdjustY(nKernStart );
256 rEnd.setX( rData.rInf.GetPos().X() );
257 rEnd.setY( nBlank + rData.rInf.GetPos().Y() + nKernEnd );
261 if ( rData.bSwitchL2R )
263 rData.rInf.GetFrame()->SwitchLTRtoRTL( rStart );
264 rData.rInf.GetFrame()->SwitchLTRtoRTL( rEnd );
267 if ( rData.bSwitchH2V )
269 rData.rInf.GetFrame()->SwitchHorizontalToVertical( rStart );
270 rData.rInf.GetFrame()->SwitchHorizontalToVertical( rEnd );
284 OSL_ENSURE( USHRT_MAX !=
m_nScrAscent,
"nScrAscent is going berzerk" );
295 m_nPrtAscent = o3tl::narrowing<sal_uInt16>(aOutMet.GetAscent());
303 #if !defined(MACOSX) // #i89844# extleading is below the line for Mac
308 OSL_ENSURE( USHRT_MAX != nRet,
"GetFontAscent returned USHRT_MAX" );
322 OSL_ENSURE( USHRT_MAX !=
m_nScrHeight,
"nScrHeight is going berzerk" );
334 #if OSL_DEBUG_LEVEL > 0
340 "GetTextHeight != Ascent + Descent" );
349 OSL_ENSURE( USHRT_MAX != nRet,
"GetFontHeight returned USHRT_MAX" );
390 const bool bBrowse = ( pSh->
GetWin() &&
400 OSL_ENSURE( USHRT_MAX != nRet,
"GetFontLeading returned USHRT_MAX" );
488 if ( USHRT_MAX == m_nScrHeight )
489 m_nScrHeight = o3tl::narrowing<sal_uInt16>(pOut->
GetTextHeight());
511 rSh.GetWin()->GetOutDev() :
515 MapMode aTmpMap( MapUnit::MapTwip );
521 const sal_uInt16 nWinHeight = sal_uInt16( aWinMet.GetFontSize().Height() );
527 if( nTmpLeading <= 0 )
531 if( nTmpLeading < 0 )
548 aWinMet.GetAscent() - rMet.
GetAscent() - nTmpLeading );
551 OSL_ENSURE(
m_nPrtAscent < USHRT_MAX,
"GuessLeading: PrtAscent-Fault" );
599 #define WRONG_SHOW_MIN 5
609 if ( ( cChar < 0x3001 || cChar > 0x3002 ) &&
610 ( cChar < 0x3008 || cChar > 0x3011 ) &&
611 ( cChar < 0x3014 || cChar > 0x301F ) &&
612 0xFF62 != cChar && 0xFF63 != cChar )
615 else if ( 0x3001 == cChar || 0x3002 == cChar ||
616 0x3009 == cChar || 0x300B == cChar ||
617 0x300D == cChar || 0x300F == cChar ||
618 0x3011 == cChar || 0x3015 == cChar ||
619 0x3017 == cChar || 0x3019 == cChar ||
620 0x301B == cChar || 0x301E == cChar ||
621 0x301F == cChar || 0xFF63 == cChar )
632 return nWidth1 == nWidth2;
644 typedef std::vector<std::pair<TextFrameIndex, TextFrameIndex>>
SwForbidden;
647 SwForbidden &rForbidden,
650 const CalcLinePosData &rCalcLinePosData,
651 const Size &rPrtFontSize )
659 if (!pWList->
Check( nStart, nWrLen ))
673 SwForbidden::iterator pIter = rForbidden.begin();
686 while( nNext < nEnd )
688 while( pIter != rForbidden.end() && pIter->second <= nNext )
694 if( pIter == rForbidden.end() || nNextEnd <= pIter->first )
697 rForbidden.insert(pIter, std::make_pair(nNextStart, nNextEnd));
698 pIter = rForbidden.begin();
703 nNext = pIter->second;
704 if( nNextStart < pIter->
first )
706 nNextEnd = pIter->first;
707 pIter->first = nNextStart;
715 lcl_calcLinePos( rCalcLinePosData, aStart, aEnd, nNextStart, nNextEnd - nNextStart );
718 if (wrongArea !=
nullptr)
741 LineInfo aLineInfo( LineStyle::Solid, 26 );
752 LineInfo aLineInfo( LineStyle::Dash );
762 nStart = nEnd + rInf.
GetIdx();
765 while (nWrLen && pWList->
Check( nStart, nWrLen ));
778 rDevice.
GetTextArray(rStr, &rDXAry, nIndex, nLen, layoutCache, pLayoutCache);
795 OSL_ENSURE( rInf.
GetShell(),
"SwFntObj::DrawText without shell" );
803 const bool bBrowse = ( pWin &&
815 const bool bDirectPrint = bPrt || bBrowse;
818 const bool bUseScrFont =
836 #if OSL_DEBUG_LEVEL > 0
838 const bool bNoAdjust = bPrt ||
848 OSL_ENSURE( bNoAdjust && !bUseScrFont,
"Outdev Check failed" );
850 else if ( rRefDev.IsVirtual() )
852 OSL_ENSURE( !bNoAdjust && bUseScrFont,
"Outdev Check failed" );
856 OSL_FAIL(
"Outdev Check failed" );
864 OSL_ENSURE( !bNoAdjust && bUseScrFont,
"Outdev Check failed" );
866 else if ( rRefDev.IsVirtual() )
868 OSL_ENSURE( !bNoAdjust && bUseScrFont,
"Outdev Check failed" );
872 OSL_FAIL(
"Outdev Check failed" );
881 OSL_ENSURE( !bNoAdjust && bUseScrFont,
"Outdev Check failed" );
883 else if ( rRefDev.IsVirtual() )
885 OSL_ENSURE( !bNoAdjust && bUseScrFont,
"Outdev Check failed" );
889 OSL_ENSURE( bNoAdjust && !bUseScrFont,
"Outdev Check failed" );
893 OSL_FAIL(
"Outdev Check failed" );
898 OSL_FAIL(
"Outdev Check failed" );
904 OSL_ENSURE( pTmpFont,
"No screen or printer font?" );
916 const bool bBidiPor = ( bSwitchL2R !=
940 Color aOldColor( pTmpFont->GetColor() );
945 pTmpFont->SetColor( aOldColor );
963 const sal_uInt16 nGridWidth =
GetGridWidth(*pGrid, *pDoc);
966 std::vector<sal_Int32> aKernArray;
980 const sal_uLong nRatioAvgWidthCharToGridWidth = nAvgWidthPerChar ?
981 ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
984 nAvgWidthPerChar = nRatioAvgWidthCharToGridWidth * nGridWidth;
988 sal_uLong nHalfWidth = nAvgWidthPerChar / 2;
1007 aTextOriginPos.AdjustX(( nAvgWidthPerChar - nCharWidth ) / 2 );
1008 nNextFix = nCharWidth / 2;
1011 nNextFix = nHalfWidth;
1015 aTextOriginPos.AdjustX(nAvgWidthPerChar - nCharWidth );
1016 nNextFix = nCharWidth - nHalfWidth;
1020 for (sal_Int32 j = 1; j < sal_Int32(rInf.
GetLen()); ++j)
1022 tools::Long nCurrentCharWidth = aKernArray[ j ] - aKernArray[ j - 1 ];
1023 nNextFix += nAvgWidthPerChar;
1035 aKernArray[ j - 1 ] = nNextFix - ( nCurrentCharWidth / 2 );
1038 aKernArray[ j - 1 ] = nNextFix - nHalfWidth;
1041 aKernArray[ j - 1 ] = nNextFix + nHalfWidth - nCurrentCharWidth;
1047 aTextOriginPos.X() + rInf.
GetPos().X() ;
1053 aKernArray, sal_Int32(rInf.
GetIdx()), sal_Int32(rInf.
GetLen()));
1070 std::vector<sal_Int32> aKernArray;
1077 const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf, aKernArray[0] );
1086 bool bSpecialJust =
false;
1096 bSpecialJust =
true;
1105 for (sal_Int32 nI = 0; nI < sal_Int32(rInf.
GetLen()); ++nI)
1107 aKernArray[ nI ] += nSpaceSum;
1108 nSpaceSum += nSpaceAdd;
1110 bSpecialJust =
true;
1115 for (sal_Int32
i = 0;
i < sal_Int32(rInf.
GetLen());
i++, nGridAddSum += nGridWidthAdd )
1117 aKernArray[i] += nGridAddSum;
1120 if ( bSpecialJust || rInf.
GetKern() )
1122 for (sal_Int32 i = 0; i < sal_Int32(rInf.
GetLen()); i++, nKernSum += rInf.
GetKern())
1125 nKernSum += nSpaceAdd;
1126 aKernArray[i] += nKernSum;
1137 aKernArray[0] = rInf.
GetWidth() + nSpaceAdd;
1139 aKernArray, sal_Int32(rInf.
GetIdx()), 1);
1143 aKernArray[sal_Int32(rInf.
GetLen()) - 2] += nSpaceAdd;
1145 aKernArray, sal_Int32(rInf.
GetIdx()),
1146 sal_Int32(rInf.
GetLen()));
1152 aKernArray, sal_Int32(rInf.
GetIdx()),
1153 sal_Int32(rInf.
GetLen()));
1160 for (i = 0; i < sal_Int32(rInf.
GetLen()); i++)
1163 nSpaceSum += nSpaceAdd + nKernSum;
1165 aKernArray[i] += nSpaceSum;
1170 sal_Int32(rInf.
GetIdx()),
1171 sal_Int32(rInf.
GetLen()));
1179 tools::Long nGridAddSum = nGridWidthAdd + nKernAdd;
1180 for (sal_Int32
i = 0;
i < sal_Int32(rInf.
GetLen());
1181 i++, nGridAddSum += nGridWidthAdd + nKernAdd)
1183 aKernArray[i] += nGridAddSum;
1186 aKernArray, sal_Int32(rInf.
GetIdx()), sal_Int32(rInf.
GetLen()));
1213 std::vector<sal_Int32> aKernArray;
1218 sal_Int32 nZwi = sal_Int32(rInf.
GetLen()) - 1;
1231 nRest = nZwi - nRest;
1235 for( sal_Int32
i = 0;
i < nZwi; )
1237 aKernArray[
i ] += nSum;
1247 bool bSpecialJust =
false;
1262 bSpecialJust =
true;
1275 bSpecialJust =
true;
1287 rInf.
GetLen(), nSpaceAdd ) != -1 )
1289 bSpecialJust =
true;
1310 bSpecialJust =
true;
1320 for (sal_Int32
i = 0;
i < sal_Int32(rInf.
GetLen());
i++,
1324 nKernSum += nSpaceAdd;
1325 aKernArray[i] += nKernSum;
1336 aKernArray[0] = rInf.
GetWidth() + nSpaceAdd;
1339 aKernArray, sal_Int32(rInf.
GetIdx()), 1 );
1343 aKernArray[ sal_Int32(rInf.
GetLen()) - 2 ] += nSpaceAdd;
1345 aKernArray, sal_Int32(rInf.
GetIdx()), sal_Int32(rInf.
GetLen()));
1350 aKernArray, sal_Int32(rInf.
GetIdx()), sal_Int32(rInf.
GetLen()));
1354 Point aTmpPos( aTextOriginPos );
1357 for( i = 0; i < sal_Int32(rInf.
GetLen()); i++ )
1361 nKernSum += nSpaceAdd;
1364 sal_Int32(rInf.
GetIdx()) + j, i - j);
1366 SwTwips nAdd = aKernArray[ i ] + nKernSum;
1369 aTmpPos.setX( aTextOriginPos.X() + nAdd );
1374 sal_Int32(rInf.
GetIdx()) + j, i - j);
1390 const Color aSaveColor( pTmpFont->GetColor() );
1397 pTmpFont->SetColor( aSaveColor );
1417 const OUString* pStr = &rInf.
GetText();
1420 OUString aBulletOverlay;
1424 std::vector<sal_Int32> aKernArray;
1447 bool bNoHalfSpace =
false;
1485 rInf.
GetLen(), nSpaceAdd ) != -1 )
1488 bNoHalfSpace =
true;
1516 sal_Int32 nCopyStart = sal_Int32(rInf.
GetIdx());
1520 sal_Int32 nCopyLen = sal_Int32(rInf.
GetLen());
1521 if ( nCopyStart + nCopyLen < rInf.
GetText().getLength() )
1524 aStr = rInf.
GetText().copy( nCopyStart, nCopyLen );
1527 aBulletOverlay = rInf.
GetText().copy( nCopyStart, nCopyLen );
1529 for( sal_Int32
i = 0;
i < aBulletOverlay.getLength(); ++
i )
1535 if ((i + nCopyStart + 1 >= sal_Int32(rInf.
GetLen())) ||
1536 aKernArray[i + nCopyStart] != aKernArray[ i + nCopyStart + 1])
1538 aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(
CH_BULLET));
1542 aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(
CH_BLANK));
1547 aBulletOverlay = aBulletOverlay.replaceAt(i, 1, rtl::OUStringChar(
CH_BLANK));
1552 if ( nCnt < rInf.
GetIdx() )
1555 nCnt = nCnt - rInf.
GetIdx();
1574 aKernArray, sal_Int32(rInf.
GetIdx()), 1 );
1577 rInf.
GetIdx() ? 1 : 0, 1 );
1582 bNoHalfSpace =
true;
1585 sal_Int32(nCnt), nSpaceAdd, rInf.
GetKern(), bNoHalfSpace);
1609 bSwitchH2V, bSwitchH2VLRBT);
1611 switch ( nDir.get() )
1614 aEnd.setX( rInf.
GetPos().X() + nKernVal );
1615 aEnd.setY( rInf.
GetPos().Y() );
1618 aEnd.setX( rInf.
GetPos().X() );
1619 aEnd.setY( rInf.
GetPos().Y() - nKernVal );
1622 aEnd.setX( rInf.
GetPos().X() - nKernVal );
1623 aEnd.setY( rInf.
GetPos().Y() );
1626 aEnd.setX( rInf.
GetPos().X() );
1627 aEnd.setY( rInf.
GetPos().Y() + nKernVal );
1661 const tools::Long nHalfSpace = bNoHalfSpace ? 0 : nSpaceAdd / 2;
1662 CalcLinePosData aCalcLinePosData(rInf,
GetFont(), nCnt, bSwitchH2V,
1663 bSwitchH2VLRBT, bSwitchL2R, nHalfSpace,
1664 aKernArray.data(), bBidiPor);
1666 SwForbidden aForbidden;
1679 sal_Int32 nLen = sal_Int32(rInf.
GetLen());
1694 sal_Int32 nTmpIdx = bBullet
1695 ? (rInf.
GetIdx() ? 1 : 0)
1696 : sal_Int32(rInf.
GetIdx());
1698 *pStr, nTmpIdx, nLen);
1700 nTmpIdx , nLen, SalLayoutFlags::NONE, pGlyphs );
1704 Color aPreviousColor = pTmpFont->GetColor();
1706 FontLineStyle aPreviousUnderline = pTmpFont->GetUnderline();
1708 FontStrikeout aPreviousStrikeout = pTmpFont->GetStrikeout();
1720 if (aBulletOverlay.getLength() > nTmpIdx &&
1721 aBulletOverlay[ nTmpIdx ] ==
CH_BULLET )
1724 aTextOriginPos.AdjustY(nShift ) ;
1726 aTextOriginPos.AdjustX(nShift ) ;
1729 for( sal_Int32
i = 1 ;
i < nLen ; ++
i )
1731 if ( aBulletOverlay[
i + nTmpIdx ] ==
CH_BULLET )
1732 aKernArray [
i - 1 ] += nShift ;
1734 aKernArray [
i - 1 ] -= nAdd;
1739 pTmpFont->SetColor( aPreviousColor );
1741 pTmpFont->SetUnderline(aPreviousUnderline);
1742 pTmpFont->SetOverline(aPreviousOverline);
1743 pTmpFont->SetStrikeout(aPreviousStrikeout);
1774 const sal_uInt16 nGridWidth =
GetGridWidth(*pGrid, *pDoc);
1788 sal_Int32(rInf.
GetIdx()), sal_Int32(nLn)) );
1792 "Leading values should be already calculated" );
1799 ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
1802 aTextSize.
setWidth(i * nGridWidth * sal_Int32(nLn));
1826 sal_Int32(rInf.
GetIdx()), sal_Int32(nLn));
1827 const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf, nWidth / sal_Int32(nLn) );
1831 aTextSize.
AdjustWidth(sal_Int32(nLn) * nGridWidthAdd);
1840 const bool bCompress = rInf.
GetKanaComp() && nLn &&
1848 CountCompChg()),
"Compression without info" );
1852 std::vector<sal_Int32> aKernArray;
1864 sal_Int32(rInf.
GetIdx()), sal_Int32(nLn));
1885 aTextSize.
setWidth(aKernArray[sal_Int32(nLn) - 1]);
1889 sal_Int32 nSpaceCount = 0;
1892 for(sal_Int32
i = 1;
i < sal_Int32(nLn); ++
i)
1894 if (nOldValue != aKernArray[
i])
1897 nOldValue = aKernArray[i];
1907 "Leading values should be already calculated" );
1918 if( 0 != nCharacterSpacing )
1919 nKern -= nCharacterSpacing;
1921 std::vector<sal_Int32> aKernArray;
2009 const sal_uInt16 nGridWidth =
GetGridWidth(*pGrid, *pDoc);
2014 ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
2017 nAvgWidthPerChar = i * nGridWidth;
2021 if (2 * (rInf.
GetOffset() - sal_Int32(nCnt) * nAvgWidthPerChar) > nAvgWidthPerChar)
2036 const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf, aKernArray[0] );
2040 tools::Long nScr = aKernArray[sal_Int32(j)] + (nSpaceAdd + nGridWidthAdd) * (sal_Int32(j) + 1);
2051 sal_Int32 nDone = 0;
2063 nSpaceSum += nSpaceAdd;
2069 rInf.
GetText(), sal_Int32(nIdx),
2071 i18n::CharacterIteratorMode::SKIPCELL, 1, nDone));
2072 if ( nIdx <= nLastIdx )
2080 nRight = aKernArray[sal_Int32(nIdx - rInf.
GetIdx()) - 1] + nKernSum + nSpaceSum;
2087 if ( nIdx > rInf.
GetIdx() &&
2091 nCnt = nLastIdx - rInf.
GetIdx();
2093 nCnt = nIdx - rInf.
GetIdx();
2102 sal_uInt16 &rIndex,
const void *pOwn,
SwViewShell const *pSh,
2123 sal_uInt16 nZoom = USHRT_MAX;
2136 if ( ( pFntObj->
GetZoom( ) == nZoom ) &&
2139 static_cast<SwSubFont const *
>(pOwn)->GetPropWidth() )
2149 pFntObj = pFntCache->
First();
2150 while ( pFntObj && !( pFntObj->
m_aFont == *static_cast<vcl::Font const *>(pOwn) &&
2151 pFntObj->
GetZoom() == nZoom &&
2153 static_cast<SwSubFont const *
>(pOwn)->GetPropWidth() &&
2162 while( pTmpObj && !( pTmpObj->
m_aFont == *static_cast<vcl::Font const *>(pOwn) &&
2165 static_cast<SwSubFont const *
>(pOwn)->GetPropWidth() ) )
2177 OSL_ENSURE(pFntObj,
"No Font, no Fun.");
2184 OSL_ENSURE( !pFntObj->
m_pPrinter,
"SwFntAccess: Printer Changed" );
2199 rnFontCacheId =
reinterpret_cast<void*
>(
reinterpret_cast<sal_IntPtr
>(pFntObj->
GetOwner()));
2208 static std::uintptr_t fontCacheIdCounter = 0;
2224 CountCompChg()),
"Compression without info" );
2239 const sal_uInt16 nGridWidth =
GetGridWidth(*pGrid, *pDoc);
2241 std::vector<sal_Int32> aKernArray;
2248 ( nAvgWidthPerChar - 1 ) / nGridWidth + 1:
2251 nAvgWidthPerChar = i * nGridWidth;
2254 while( nTextBreak < rInf.
GetLen() && nTextWidth >= nCurrPos )
2256 nCurrPos += nAvgWidthPerChar;
2260 return nTextBreak + rInf.
GetIdx();
2274 const OUString* pTmpText;
2278 bool bTextReplaced =
false;
2288 const OUString aSnippet(rInf.
GetText().copy(sal_Int32(rInf.
GetIdx()), sal_Int32(nLn)));
2290 const bool bTitle = SvxCaseMap::Capitalize ==
m_aSub[
m_nActual].GetCaseMap();
2293 if ( bTitle && nLn )
2299 i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
2302 OUString aSnippetTmp(aSnippet.copy(0, 1));
2304 aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.getLength(), rtl::OUStringChar(aSnippet[0]) );
2308 pTmpText = &aTmpText;
2311 bTextReplaced =
true;
2315 sal_Int32 nHyphPos = sal_Int32(*rInf.
GetHyphPos());
2319 *pTmpText, nTextWidth,
2321 sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
2332 *pTmpText, nTextWidth,
2333 sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
2337 if (bTextReplaced && sal_Int32(nTextBreak) != -1)
2339 if ( nTmpLen != nLn )
2341 rInf.
GetIdx(), nLn, nTextBreak );
2343 nTextBreak = nTextBreak + rInf.
GetIdx();
2354 ! bCompress && nTextWidth == 0)
2361 nTextBreak2 = nTextBreak2 - rInf.
GetIdx();
2363 if( nTextBreak2 < nLn )
2365 if( !nTextBreak2 && nLn )
2367 else if (nLn > nTextBreak2 + nTextBreak2)
2368 nLn = nTextBreak2 + nTextBreak2;
2369 std::vector<sal_Int32> aKernArray;
2371 sal_Int32(rInf.
GetIdx()), sal_Int32(nLn));
2378 if( nKern && nTextBreak2 )
2379 nKern *= sal_Int32(nTextBreak2) - 1;
2380 while (nTextBreak2 < nLn && nTextWidth >= aKernArray[sal_Int32(nTextBreak2)] + nKern)
2386 *rInf.
GetHyphPos() += nTextBreak2 - nTmpBreak;
2389 nTextBreak2 = nTextBreak2 + rInf.
GetIdx();
2398 bool bChgFntColor =
false;
2399 bool bChgLineColor =
false;
2404 bChgFntColor =
true;
2408 bChgLineColor =
true;
2425 std::optional<Color> pCol;
2440 if(
GetFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect,
false,
true ) )
2442 if (aFillAttributes && aFillAttributes->isUsed())
2480 Color aTmpColor( nNewColor );
2481 if ( pCol->IsDark() && aTmpColor.
IsDark() )
2483 else if ( pCol->IsBright() && aTmpColor.
IsBright() )
2488 if ( bChgFntColor || bChgLineColor )
2490 Color aNewColor( nNewColor );
2494 if ( pFont && aNewColor != pFont->
GetColor() )
2509 if ( bChgLineColor )
2515 if ( aNewColor !=
GetOut().GetOverlineColor() )
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
static void GetTextArray(const OutputDevice &rDevice, const OUString &rStr, std::vector< sal_Int32 > &rDXAry, sal_Int32 nIndex, sal_Int32 nLen, const vcl::text::TextLayoutCache *layoutCache=nullptr)
const Fraction & GetScaleX() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwViewShell const * GetShell() const
OutDevType GetOutDevType() const
void SetDigitLanguage(LanguageType)
sal_uInt16 GetCachePos() const
sw::WrongListIterator * GetGrammarCheck() const
const SwWrongArea * GetWrongElement(TextFrameIndex nStart)
void CreateScrFont(const SwViewShell &rSh, const OutputDevice &rOut)
void SetFontSize(const Size &)
void SetDistance(double nDistance)
bool IsPagePreview() const
virtual SwCacheObj * NewObj() override
Can be use in NewObj.
const OUString & GetFamilyName() const
SwFntAccess(const void *&rnFontCacheId, sal_uInt16 &rIndex, const void *pOwner, SwViewShell const *pShell, bool bCheck=false)
vcl::RenderContext * GetpOut() const
void setWidth(tools::Long nWidth)
virtual bool IsVirtual() const
tools::Long GetCharacterSpacing() const
const SwAccessibilityOptions * GetAccessibilityOptions() const
sw::WrongListIterator * GetWrong() const
const SalLayoutGlyphs * GetLayoutGlyphs(VclPtr< const OutputDevice > outputDevice, const OUString &text, const vcl::text::TextLayoutCache *layoutCache=nullptr)
sal_uInt16 GetFontHeight(const SwViewShell *pSh, const OutputDevice &rOut)
TextFrameIndex * GetHyphPos() const
FontLineStyle GetOverline() const
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
static void lcl_DrawLineForWrongListData(SwForbidden &rForbidden, const SwDrawTextInfo &rInf, sw::WrongListIterator *pWList, const CalcLinePosData &rCalcLinePosData, const Size &rPrtFontSize)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
TextFrameIndex GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
sal_uInt16 GetFontAscent(const SwViewShell *pSh, const OutputDevice &rOut)
void SetWeight(FontWeight)
sal_uInt16 GetGuessedLeading() const
bool IsPosMatchesBounds() const
const MapMode & GetMapMode() const
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
WrongAreaLineType mLineType
sal_uInt16 GetWidth() const
const sal_Unicode CH_BULLET
GDIMetaFile * GetConnectMetaFile() const
bool GetTextRenderModeForResolutionIndependentLayout() const
tools::Long GetTextArray(const OUString &rStr, std::vector< sal_Int32 > *pDXAry, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetDashCount(sal_uInt16 nDashCount)
vcl::text::ComplexTextLayoutFlags GetLayoutMode() const
Of course Writer needs its own rectangles.
static sal_uInt8 lcl_WhichPunctuation(sal_Unicode cChar)
sal_Int32 KashidaJustify(sal_Int32 *pKernArray, TextFrameIndex nStt, TextFrameIndex nLen, tools::Long nSpaceAdd=0) const
Performs a kashida justification on the kerning array.
SwNodeOffset abs(const SwNodeOffset &a)
static TextFrameIndex ThaiJustify(const OUString &rText, sal_Int32 *pKernArray, TextFrameIndex nIdx, TextFrameIndex nLen, TextFrameIndex nNumberOfBlanks=TextFrameIndex(0), tools::Long nSpaceAdd=0)
Performs a thai justification on the kerning array.
sal_uInt16 GetZoom() const
sal_Int32 GetTextBreak(const OUString &rStr, tools::Long nTextWidth, sal_Int32 nIndex, sal_Int32 nLen=-1, tools::Long nCharExtra=0, vcl::text::TextLayoutCache const *=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
sal_uInt8 DirType(const TextFrameIndex nPos) const
VclPtr< OutputDevice > m_pPrinter
bool IsStarSymbol(std::u16string_view rFontName)
size_t CountCompChg() const
tools::Long GetExternalLeading() const
const SwScriptInfo * GetScriptInfo() const
static OutputDevice * GetDefaultDevice()
constexpr tools::Long Width() const
const Color & GetOverlineColor() const
void SetCursorBidiLevel(sal_uInt8 nNew)
static SwFntObj * Next(SwFntObj *pFntObj)
sal_uInt16 GetFontLeading(const SwViewShell *pSh, const OutputDevice &rOut)
void DrawStretchText(const Point &rStartPt, sal_uLong nWidth, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1)
const SwTextFrame * GetFrame() const
tools::Long GetAscent() const
bool getBrowseMode() const
const vcl::Font & GetFont() const
void SetLayoutMode(vcl::text::ComplexTextLayoutFlags nTextLayoutMode)
void SetKanaDiff(tools::Long nNew)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
SvxCaseMap GetCaseMap() const
o3tl::enumarray< SwFontScript, SwSubFont > m_aSub
void SpaceDistribution(std::vector< sal_Int32 > &rKernArray, const OUString &rText, sal_Int32 nStt, sal_Int32 nLen, tools::Long nSpaceAdd, tools::Long nKern, bool bNoHalfSpace)
Distribute space between words and letters.
FontMetric GetFontMetric() const
const std::optional< Color > & GetBackColor() const
void DrawLine(const Point &rStartPt, const Point &rEndPt)
sal_uInt16 GetKanaComp() const
void SetLanguage(LanguageType)
SwFontScript GetActual() const
void SetLen(TextFrameIndex const nNew)
const OUString & GetText() const
sw::WrongListIterator * GetSmartTags() const
vcl::RenderContext & GetRefDev() const
static bool IsArabicText(const OUString &rText, TextFrameIndex nStt, TextFrameIndex nLen)
Checks if text is Arabic text.
void DrawTextArray(const Point &rStartPt, const OUString &rStr, o3tl::span< const sal_Int32 > pDXAry, sal_Int32 nIndex=0, sal_Int32 nLen=-1, SalLayoutFlags flags=SalLayoutFlags::NONE, const SalLayoutGlyphs *pLayoutCache=nullptr)
void CreatePrtFont(const OutputDevice &rOut)
tools::Long Compress(sal_Int32 *pKernArray, TextFrameIndex nIdx, TextFrameIndex nLen, const sal_uInt16 nCompress, const sal_uInt16 nFontHeight, const bool bCentered, Point *pPoint=nullptr) const
const Color & GetColor() const
UNDERLYING_TYPE get() const
bool ApplyAutoColor(vcl::Font *pFnt=nullptr)
void GuessLeading(const SwViewShell &rSh, const FontMetric &rMet)
bool IsIgnoreFrameRTL() const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
static SalLayoutGlyphsCache * self()
SwViewShell const * m_pShell
static bool lcl_IsFullstopCentered(const vcl::RenderContext &rOut)
bool IsFullstopCentered() const
SwPageFrame * FindPageFrame()
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
sal_uInt16 GetFontHangingBaseline(const SwViewShell *pSh, const OutputDevice &rOut)
const sal_Unicode CH_BLANK
TextFrameIndex GetCapitalBreak(SwViewShell const *pSh, const OutputDevice *pOut, const SwScriptInfo *pScript, const OUString &rText, tools::Long nTextWidth, TextFrameIndex nIdx, TextFrameIndex nLen)
bool IsWordLineMode() const
static MapMode * s_pPixMap
const Color & GetLineColor() const
TextFrameIndex sw_CalcCaseMap(const SwFont &rFnt, const OUString &rOrigString, TextFrameIndex nOfst, TextFrameIndex nLen, TextFrameIndex nIdx)
vcl::text::TextLayoutCache const * GetVclCache() const
sal_uInt16 GetPropWidth() const
Provides access to settings of a document.
const Size & GetFontSize() const
#define NON_PRINTING_CHARACTER_COLOR
FontStrikeout GetStrikeout() const
void SetDashLen(double nDashLen)
static void lcl_calcLinePos(const CalcLinePosData &rData, Point &rStart, Point &rEnd, TextFrameIndex const nStart, TextFrameIndex const nWrLen)
static bool lcl_IsFontAdjustNecessary(const vcl::RenderContext &rOutDev, const vcl::RenderContext &rRefDev)
std::vector< std::pair< TextFrameIndex, TextFrameIndex > > SwForbidden
void SetColor(const Color &)
bool Check(TextFrameIndex &rStart, TextFrameIndex &rLen)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
const css::lang::Locale & GetLocale(const LanguageType aLang)
void SetDevFont(const SwViewShell *pSh, OutputDevice &rOut)
LanguageType GetLanguage() const
const Color & GetColor() const
tools::Long GetSpace() const
static bool lcl_IsMonoSpaceFont(const vcl::RenderContext &rOut)
sal_uInt16 m_nScrHangingBaseline
virtual ~SwFntObj() override
constexpr Color gWaveCol(COL_GRAY)
constexpr tools::Long Height() const
TextFrameIndex GetNumberOfBlanks() const
const SwViewOption * GetViewOptions() const
vcl::Window * GetWin() const
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
void SetFont(const vcl::Font &rNewFont)
const Point & GetPos() const
LanguageType GetDigitLanguage() const
Color GetLineColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
tools::Long GetTextHeight() const
TextFrameIndex GetLen() const
static Color & GetFontColor()
tools::Long AdjustWidth(tools::Long n)
tools::Long GetDescent() const
bool IsRightToLeft() const
sal_uInt16 GetZoom() const
tools::Long GetInternalLeading() const
void SetTextRenderModeForResolutionIndependentLayout(bool bMode)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static bool isKorean(LanguageType nLang)
SwFntObj(const SwSubFont &rFont, std::uintptr_t nFontCacheId, SwViewShell const *pSh)
tools::Long GetHangingBaseline() const
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
tools::Long AdjustHeight(tools::Long n)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static vcl::DeleteOnDeinit< VclPtr< OutputDevice > > s_pFntObjPixOut
bool IsAlwaysAutoColor() const
vcl::RenderContext & GetOut() const
tools::Long GetKern() const
void DrawWaveLine(const Point &rStartPos, const Point &rEndPos, tools::Long nLineWidth=1, tools::Long nWaveHeight=3)
basegfx::BColor getBColor() const
bool IsSnapToChars() const
TextFrameIndex GetTextBreak(SwDrawTextInfo const &rInf, tools::Long nTextWidth)
constexpr sal_Int32 COMPLETE_STRING
bool IsSameInstance(const Font &) const
void SetItalic(FontItalic)
void setHeight(tools::Long nHeight)
FontLineStyle GetUnderline() const
size_t CountKashida() const
static void CJKJustify(const OUString &rText, sal_Int32 *pKernArray, TextFrameIndex nStt, TextFrameIndex nLen, LanguageType aLang, tools::Long nSpaceAdd, bool bIsSpaceStop)
void DrawText(SwDrawTextInfo &rInf)
Degree10 UnMapDirection(Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
OutputDevice * get() const
tools::Long GetBulletOffset() const
#define SPACING_PRECISION_FACTOR
Access class for the Cache.
TextFrameIndex GetIdx() const
SwTextGrid GetGridType() const
sal_uInt16 m_nGuessedLeading
static tools::Long s_nPixWidth
void ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
constexpr OUStringLiteral first
sal_Int32 GetOffset() const
sal_uInt16 m_nPrtHangingBaseline
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...
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
sal_uInt16 GetExternalLeading() const
tools::Long GetHeight() const
Color aGlobalRetoucheColor
rtl_TextEncoding GetCharSet() const
const void * GetOwner() const
Size GetTextSize(SwDrawTextInfo &rInf)
determine the TextSize (of the printer)