61#include <osl/diagnose.h>
65#include <document.hxx>
71#include <progress.hxx>
74#include <stlsheet.hxx>
78#include <com/sun/star/i18n/DirectionProperty.hpp>
92#define DROPDOWN_BITMAP_SIZE 18
94#define DRAWTEXT_MAX 32767
206 pPattern ( nullptr ),
207 pCondSet ( nullptr ),
222 bLineBreak ( false ),
225 bPixelToLogic( bPTL ),
255 if ( nNewHeight > 0 )
261 if ( pFmtDevice != pDev )
283template<
typename ItemType,
typename EnumType>
287 return static_cast<EnumType
>(rItem.GetValue());
292 return lcl_GetValue<SfxBoolItem, bool>(rPattern, nWhich, pCondSet);
299 sal_uInt32 nCurrentNumberFormat = pDoc->
GetNumberFormat( nCellX, nCellY, nTab );
301 return pNumberFormatter->
GetType( nCurrentNumberFormat ) == SvNumFormatType::TEXT;
378 case SvxCellOrientation::Standard:
383 case SvxCellOrientation::Stacked:
387 case SvxCellOrientation::TopBottom:
391 case SvxCellOrientation::BottomUp:
396 OSL_FAIL(
"Invalid SvxCellOrientation value");
413 if ( pFmtDevice != pDev )
501 bool bChanged =
false;
580 if ( nCharWidth < 1 || (
bPixelToLogic && nCharWidth < pOutput->mpRefDevice->PixelToLogic(
Size(1,0)).
Width()) )
592 if ( nSpaceToFill <= nCharWidth )
595 sal_Int32 nCharsToInsert = nSpaceToFill / nCharWidth;
596 OUStringBuffer aFill(nCharsToInsert);
644 sal_uInt16 nNumDigits =
static_cast<sal_uInt16
>(nWidth / nMaxDigit);
655 sal_uInt8 nSignCount = 0, nDecimalCount = 0, nExpCount = 0;
656 sal_Int32 nLen =
aString.getLength();
658 for( sal_Int32
i = 0;
i < nLen; ++
i )
663 else if (c == cDecSep)
671 if (
aString ==
"0" && fVal != 0.0)
675 nWidth += (nMaxDigit -
GetDotWidth()) * nDecimalCount;
681 if (nDecimalCount || nSignCount || nExpCount)
684 nNumDigits =
static_cast<sal_uInt16
>(nWidth / nMaxDigit);
696 if (nActualTextWidth > nWidth)
724 if (
GetOrient() != SvxCellOrientation::Standard )
743 for (
char i = 0;
i < 10; ++
i)
745 char cDigit =
'0' +
i;
800 if (
GetOrient() != SvxCellOrientation::Standard )
814 for (sal_Int32 nIdx = 0; nIdx <
aString.getLength(); ++nIdx)
861 return static_cast<double>(
aZoomY) /
static_cast<double>(
aZoomX);
880 if ( !
aURL.isEmpty() && pPDFData )
885 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->
GetBookmarks();
886 rBookmarks.push_back( aBookmark );
943 bool bVisRowChanged )
945 bool bDoMerge =
false;
946 bool bIsLeft = ( nX ==
nVisX1 );
947 bool bIsTop = ( nY ==
nVisY1 ) || bVisRowChanged;
967 if ( bHOver && bVOver )
968 bDoMerge = bIsLeft && bIsTop;
981 if ( !bDoMerge && !bHidden )
984 if (rOverX >=
nX1 && !bHidden)
1001 if ( !bDoMerge && !bHidden )
1007 if (rOverX >=
nX1 && rOverY >=
nY1 &&
1026 OSL_ENSURE( pNewPattern,
"pNewPattern" );
1028 if ( pNewPattern == rpOldPattern )
1030 else if ( !rpOldPattern )
1096 rpOldPattern = pNewPattern;
1104 if ( !bProgress && pFCell->
GetDirty() )
1113 return ( nScript != SvtScriptType::LATIN &&
1114 nScript != SvtScriptType::ASIAN &&
1115 nScript != SvtScriptType::COMPLEX );
1123 if ( pThisRowInfo && nX <=
nX2 )
1131 if ( !bEmpty && ( nX < nX1 || nX >
nX2 || !pThisRowInfo ) )
1195 sal_uInt16 nHorJustify,
bool bCellIsValue,
1196 bool bBreak,
bool bOverwrite,
1205 SCCOL nCompCol = nX;
1206 while ( nCellX > nCompCol )
1210 pRowInfo[0].basicCellInfo(nCompCol).nWidth :
1212 nCellPosX += nColWidth * nLayoutSign;
1215 while ( nCellX < nCompCol )
1219 pRowInfo[0].basicCellInfo(nCompCol).nWidth :
1221 nCellPosX -= nColWidth * nLayoutSign;
1227 while ( nCellY > nCompRow )
1248 if ( nMergeCols == 0 )
1251 if ( nMergeRows == 0 )
1258 pRowInfo[0].basicCellInfo(nCellX+
i).nWidth :
1260 nMergeSizeX += nColWidth;
1264 if ( rThisRowInfo.
nRowNo == nCellY )
1267 nMergeSizeY += rThisRowInfo.
nHeight;
1291 if ( nNeeded > nMergeSizeX )
1300 case SvxCellHorJustify::Left:
1301 nRightMissing = nMissing;
1303 case SvxCellHorJustify::Right:
1304 nLeftMissing = nMissing;
1306 case SvxCellHorJustify::Center:
1307 nLeftMissing = nMissing / 2;
1308 nRightMissing = nMissing - nLeftMissing;
1318 ::std::swap( nLeftMissing, nRightMissing );
1320 SCCOL nRightX = nCellX;
1321 SCCOL nLeftX = nCellX;
1322 if ( !bMerged && !bCellIsValue && !bBreak )
1326 while ( nRightMissing > 0 && nRightX < mpDoc->MaxCol() && ( bOverwrite ||
IsAvailable( nRightX+1, nCellY ) ) )
1330 nRightMissing -= nAdd;
1333 if ( rThisRowInfo.
nRowNo == nCellY && nRightX >=
nX1 && nRightX <=
nX2 )
1337 while ( nLeftMissing > 0 && nLeftX > 0 && ( bOverwrite ||
IsAvailable( nLeftX-1, nCellY ) ) )
1339 if ( rThisRowInfo.
nRowNo == nCellY && nLeftX >=
nX1 && nLeftX <=
nX2 )
1344 nLeftMissing -= nAdd;
1351 if ( nRightMissing > 0 &&
bMarkClipped && nRightX >=
nX1 && nRightX <=
nX2 && !bBreak && !bCellIsValue )
1358 if ( nLeftMissing > 0 &&
bMarkClipped && nLeftX >=
nX1 && nLeftX <=
nX2 && !bBreak && !bCellIsValue )
1384 fZoom = fZoom > 1.0 ? fZoom : 1.0;
1386 bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
1406bool beginsWithRTLCharacter(
const OUString& rStr)
1413 case i18n::DirectionProperty_RIGHT_TO_LEFT:
1414 case i18n::DirectionProperty_RIGHT_TO_LEFT_ARABIC:
1415 case i18n::DirectionProperty_RIGHT_TO_LEFT_EMBEDDING:
1416 case i18n::DirectionProperty_RIGHT_TO_LEFT_OVERRIDE:
1433 bool bCellIsValue,
const OUString& rText,
1438 bool bUseWritingDirection =
false;
1439 if (eInHorJust == SvxCellHorJustify::Standard)
1443 if (beginsWithRTLCharacter( rText))
1446 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1448 eHorJustContext = SvxCellHorJustify::Right;
1450 else if (bCellIsValue)
1451 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Left : SvxCellHorJustify::Right;
1453 bUseWritingDirection =
true;
1456 if (bUseWritingDirection ||
1457 eInHorJust == SvxCellHorJustify::Block || eInHorJust == SvxCellHorJustify::Repeat)
1460 if (nDirection == SvxFrameDirection::Horizontal_LR_TB || nDirection == SvxFrameDirection::Vertical_LR_TB)
1461 eHorJustContext = SvxCellHorJustify::Left;
1462 else if (nDirection == SvxFrameDirection::Environment)
1464 SAL_WARN_IF( !pDoc,
"sc.ui",
"getAlignmentFromContext - pDoc==NULL");
1468 eHorJustContext = (pDoc && pDoc->
IsLayoutRTL(nTab) && (beginsWithRTLCharacter( rText))) ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1471 eHorJustContext = SvxCellHorJustify::Right;
1473 return eHorJustContext;
1490 mpDev->GetMapMode().GetMapUnit() ==
mpRefDevice->GetMapMode().GetMapUnit(),
1491 "LayoutStrings: different MapUnits ?!?!" );
1504 bool bProgress =
false;
1512 if ( nX2 < mpDoc->MaxCol() )
1513 nLastContentCol = sal::static_int_cast<SCCOL>(
1521 bool bCellIsValue =
false;
1531 std::vector<std::unique_ptr<ScPatternAttr> > aAltPatterns;
1542 if ( nLoopStartX <
nX1 )
1544 for (
SCCOL nX=nLoopStartX; nX<=
nX2; nX++)
1546 bool bMergeEmpty =
false;
1552 bool bDoCell =
false;
1553 bool bUseEditEngine =
false;
1577 if ( bEmpty && !bMergeEmpty && nX <
nX1 && !bOverlapped )
1583 if ( nTempX <
nX1 &&
1594 if ( bEmpty && !bMergeEmpty && nX ==
nX2 && !bOverlapped )
1599 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
1635 if ( nCellY == nY && nCellX == nX && nCellX >=
nX1 && nCellX <=
nX2 )
1642 bUseEditEngine =
true;
1649 bUseEditEngine =
true;
1652 if (bDoCell && !bUseEditEngine)
1654 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1675 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1690 pPattern = pAltPattern;
1697 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1701 pPattern = pAltPattern;
1708 if (nScript == SvtScriptType::NONE)
1711 if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
1715 pCondSet != pOldCondSet || nScript != nOldScript ||
mbSyntaxMode )
1717 aVars.
SetPattern(pPattern, pCondSet, aCell, nScript);
1721 pOldPattern = pPattern;
1722 pOldCondSet = pCondSet;
1723 nOldScript = nScript;
1727 if ( aVars.
GetOrient() == SvxCellOrientation::Stacked ||
1729 bUseEditEngine =
true;
1731 if (bDoCell && !bUseEditEngine)
1737 pOldPattern =
nullptr;
1742 if (bDoCell && !bUseEditEngine)
1754 *pPattern, pCondSet,
mpDoc,
nTab, bNumberFormatIsText );
1763 bool bRepeat = aVars.
IsRepeat() && !bBreak;
1764 bool bShrink = aVars.
IsShrink() && !bBreak && !bRepeat;
1773 GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
1774 *pPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
1775 bCellIsValue || bRepeat || bShrink, bBreak,
false,
1781 if ( aVars.
GetOrient() != SvxCellOrientation::Standard )
1785 bUseEditEngine =
true;
1792 if ( nAvailable > 0 && nScaleSize > 0 )
1794 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
1799 sal_uInt16 nShrinkAgain = 0;
1805 nScale = ( nScale * 9 ) / 10;
1812 if ( nNewSize <= nAvailable )
1819 pOldPattern =
nullptr;
1832 if ( nRepeatSize > 0 )
1834 tools::Long nRepeatCount = nAvailable / nRepeatSize;
1835 if ( nRepeatCount > 1 )
1838 OUStringBuffer aRepeated(aCellStr);
1839 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
1840 aRepeated.append(aCellStr);
1841 aVars.
SetAutoText( aRepeated.makeStringAndClear() );
1849 if ( aVars.
GetOrient() == SvxCellOrientation::Standard )
1859 if (!bUseEditEngine)
1862 aVars.
GetHorJust() == SvxCellHorJustify::Block &&
1872 RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : &
pRowInfo[0];
1880 bool bHasHashText =
false;
1884 bHasHashText =
true;
1894 if ( eOutHorJust == SvxCellHorJustify::Left )
1896 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1901 else if ( eOutHorJust == SvxCellHorJustify::Right )
1903 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1910 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1946 bool bRightAdjusted =
false;
1947 switch (eOutHorJust)
1949 case SvxCellHorJustify::Left:
1952 case SvxCellHorJustify::Right:
1955 bRightAdjusted =
true;
1957 case SvxCellHorJustify::Center:
1971 case SvxCellVerJustify::Top:
1972 case SvxCellVerJustify::Block:
1976 nTestClipHeight += nTop;
1979 case SvxCellVerJustify::Bottom:
1983 nTestClipHeight += nBot;
1986 case SvxCellVerJustify::Center:
1990 nJustPosY += ( nOutHeight + nTop -
1992 nTestClipHeight += std::abs( nTop - nBot );
2001 if ( nTestClipHeight > nOutHeight )
2011 if ( bHClip || bVClip )
2040 Point aURLStart( nJustPosX, nJustPosY );
2044 case SvxCellOrientation::Standard:
2047 case SvxCellOrientation::TopBottom:
2050 case SvxCellOrientation::BottomUp:
2063 Point aDrawTextPos( nJustPosX, nJustPosY );
2064 if ( bPixelToLogic )
2070 aDrawTextPos =
mpRefDevice->PixelToLogic( aDrawTextPos );
2080 const OUString& aString = aVars.
GetString();
2081 if (!aString.isEmpty())
2087 OUString aShort = aString;
2096 double fVisibleRatio = 1.0;
2098 sal_Int32 nTextLen = aString.getLength();
2102 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2105 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2106 aShort = aShort.copy(0, nShortLen);
2109 else if (eOutHorJust == SvxCellHorJustify::Right && aAreaParam.
mnLeftClipLength > 0)
2112 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2115 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2116 aShort = aShort.copy(nTextLen-nShortLen);
2120 double fOffset = fTextWidth - fShortWidth;
2121 aDrawTextPos.
Move(fOffset, 0);
2128 size_t nLen = aShort.getLength();
2129 if (aDX.
size() < nLen)
2138 for (
size_t i = 0;
i < nLen; ++
i)
2139 aDX.
set(
i,
static_cast<sal_Int32
>(aDX[
i] / fMul + 0.5));
2142 mpDev->DrawTextArray(aDrawTextPos, aShort, aDX, {}, 0, nLen);
2146 mpDev->DrawText(aDrawTextPos, aShort, 0, -1,
nullptr,
nullptr,
2151 if ( bHClip || bVClip )
2156 mpDev->SetClipRegion();
2180 pEngine->SetUpdateLayout(
false );
2185 nCtrl |= EEControlBits::ONLINESPELLING;
2192 pEngine->SetControlWord( nCtrl );
2238 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
2240 std::vector<sal_Int32> aPortions;
2243 sal_Int32 nStart = 0;
2244 for (
const sal_Int32 nEnd : aPortions )
2253 nWestern = ( nWestern * nPercent ) / 100;
2254 nCJK = ( nCJK * nPercent ) / 100;
2255 nCTL = ( nCTL * nPercent ) / 100;
2283 double nRealOrient =
toRadians(nAttrRotate);
2284 double nAbsCos = fabs( cos( nRealOrient ) );
2285 double nAbsSin = fabs( sin( nRealOrient ) );
2287 return static_cast<tools::Long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin );
2289 return static_cast<tools::Long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin );
2307 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2311 if ( nScaleSize <= rAlignRect.
GetHeight() )
2314 bool bSwap = ( nOrient == SvxCellOrientation::TopBottom || nOrient == SvxCellOrientation::BottomUp );
2316 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2319 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2321 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2323 sal_uInt16 nShrinkAgain = 0;
2328 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2329 nNewSize = bPixelToLogic ?
2330 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2337 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2338 rNeededPixel = nPixelWidth + nLeftM + nRightM;
2340 else if ( rLeftClip || rRightClip )
2345 tools::Long nScaleSize = rNeededPixel - nLeftM - nRightM;
2347 if ( nScaleSize <= nAvailable )
2350 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2355 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2357 sal_uInt16 nShrinkAgain = 0;
2363 nNewSize = bPixelToLogic ?
2364 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2367 if ( nNewSize <= nAvailable )
2368 rLeftClip = rRightClip =
false;
2371 rNeededPixel = nNewSize + nLeftM + nRightM;
2372 rEngineHeight =
lcl_GetEditSize( rEngine,
false,
false, nAttrRotate );
2378 meHorJustContext( meHorJustAttr ),
2379 meHorJustResult( meHorJustAttr ),
2383 meOrient( pPattern->GetCellOrientation(pCondSet) ),
2385 mnX(0),
mnCellX(0), mnCellY(0),
2386 mnPosX(0), mnPosY(0), mnInitPosX(0),
2388 mbCellIsValue(bCellIsValue),
2389 mbAsianVertical(false),
2390 mbPixelToLogic(false),
2391 mbHyphenatorSet(false),
2394 mpCondSet(pCondSet),
2395 mpPreviewFontSet(nullptr),
2396 mpOldPattern(nullptr),
2397 mpOldCondSet(nullptr),
2398 mpOldPreviewFontSet(nullptr),
2399 mpThisRowInfo(nullptr),
2400 mpMisspellRanges(nullptr)
2404 const ScDocument* pDoc,
bool bShowNullValues,
bool bShowFormulas,
bool bSyntaxMode,
bool bUseStyleColor,
bool bForceAutoColor,
bool& rWrapFields)
2411 mpEngine->SetTextCurrentDefaults(*
pData);
2413 if ( mbBreak && !mbAsianVertical &&
pData->HasField() )
2423 OSL_FAIL(
"pData == 0");
2429 sal_uInt32 nFormat =
mpPattern->GetNumberFormat(
2431 const Color* pColor;
2439 mpEngine->SetTextCurrentDefaults(aString);
2440 if ( pColor && !bSyntaxMode && !( bUseStyleColor && bForceAutoColor ) )
2444 if (mpMisspellRanges)
2445 mpEngine->SetAllMisspellRanges(*mpMisspellRanges);
2455 if (
mpPattern == mpOldPattern && mpCondSet == mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
2459 bool bCellContrast = bUseStyleColor &&
2462 auto pSet = std::make_unique<SfxItemSet>( mpEngine->GetEmptyItemSet() );
2463 mpPattern->FillEditItemSet( pSet.get(), mpCondSet );
2464 if ( mpPreviewFontSet )
2483 mpEngine->SetDefaults( std::move(pSet) );
2485 mpOldCondSet = mpCondSet;
2486 mpOldPreviewFontSet = mpPreviewFontSet;
2489 if (meOrient == SvxCellOrientation::Stacked)
2490 nControl |= EEControlBits::ONECHARPERLINE;
2493 mpEngine->SetControlWord( nControl );
2495 if ( !mbHyphenatorSet && bParaHyphenate )
2499 mpEngine->SetHyphenator( xXHyphenator );
2500 mbHyphenatorSet =
true;
2504 if ( bUseStyleColor && ( aBackCol.
IsTransparent() || bCellContrast ) )
2505 aBackCol = nConfBackColor;
2506 mpEngine->SetBackgroundColor( aBackCol );
2513 sal_uInt16 nIndent = 0;
2514 if (meHorJustAttr == SvxCellHorJustify::Left || meHorJustAttr == SvxCellHorJustify::Right)
2521 if(meHorJustAttr == SvxCellHorJustify::Right)
2532 calcMargins(nTopM, nLeftM, nBottomM, nRightM,
nPPTX,
nPPTY);
2534 if (isVerticallyOriented())
2545 if (mbAsianVertical)
2558 if (!mbBreak || meOrient == SvxCellOrientation::Stacked || mbAsianVertical)
2563 if (isVerticallyOriented())
2564 std::swap( nEngineWidth, nEngineHeight );
2566 if (meOrient == SvxCellOrientation::Stacked)
2567 nEngineWidth = nEngineWidth * 11 / 10;
2569 rWidth = nEngineWidth;
2570 rHeight = nEngineHeight;
2575 return (mbBreak || (meOrient == SvxCellOrientation::Stacked) || mbAsianVertical);
2583 return maCell.getFormula()->IsHyperLinkCell();
2588 return (meOrient == SvxCellOrientation::TopBottom || meOrient == SvxCellOrientation::BottomUp);
2594 OSL_ENSURE(isVerticallyOriented(),
"Use this only for vertically oriented cell!");
2608 switch (meHorJustResult)
2610 case SvxCellHorJustify::Center:
2613 case SvxCellHorJustify::Right:
2623 if (isVerticallyOriented() || mbAsianVertical)
2628 case SvxCellVerJustify::Top:
2629 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2630 SvxAdjust::Left : SvxAdjust::Right;
2632 case SvxCellVerJustify::Center:
2633 eSvxAdjust = SvxAdjust::Center;
2635 case SvxCellVerJustify::Bottom:
2636 case SvxCellVerJustify::Standard:
2637 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2638 SvxAdjust::Right : SvxAdjust::Left;
2640 case SvxCellVerJustify::Block:
2641 eSvxAdjust = SvxAdjust::Block;
2648 if (meHorJustResult == SvxCellHorJustify::Block)
2658 if (meOrient == SvxCellOrientation::Stacked)
2659 eSvxAdjust = SvxAdjust::Center;
2662 if (meOrient == SvxCellOrientation::Standard)
2663 switch (meHorJustResult)
2665 case SvxCellHorJustify::Repeat:
2666 case SvxCellHorJustify::Standard:
2667 SAL_WARN(
"sc.ui",
"meHorJustResult does not match getAlignmentFromContext()");
2669 case SvxCellHorJustify::Left:
2670 eSvxAdjust = SvxAdjust::Left;
2672 case SvxCellHorJustify::Center:
2673 eSvxAdjust = SvxAdjust::Center;
2675 case SvxCellHorJustify::Right:
2676 eSvxAdjust = SvxAdjust::Right;
2678 case SvxCellHorJustify::Block:
2679 eSvxAdjust = SvxAdjust::Block;
2685 case SvxCellVerJustify::Top:
2686 eSvxAdjust = SvxAdjust::Right;
2688 case SvxCellVerJustify::Center:
2689 eSvxAdjust = SvxAdjust::Center;
2691 case SvxCellVerJustify::Bottom:
2692 case SvxCellVerJustify::Standard:
2693 eSvxAdjust = SvxAdjust::Left;
2695 case SvxCellVerJustify::Block:
2696 eSvxAdjust = SvxAdjust::Block;
2703 if (mbAsianVertical)
2706 if (meHorJustResult == SvxCellHorJustify::Block)
2712 if (meVerJust == SvxCellVerJustify::Block)
2717 mpEngine->SetVertical(mbAsianVertical);
2731 if (meHorJustResult == SvxCellHorJustify::Right || meHorJustResult == SvxCellHorJustify::Center)
2733 SvxAdjust eEditAdjust = (meHorJustResult == SvxCellHorJustify::Center) ?
2734 SvxAdjust::Center : SvxAdjust::Right;
2748 bool bHasURL = pPDFData && isHyperlinkCell();
2753 tools::Long nURLHeight = mpEngine->GetTextHeight();
2756 Size aPaper = mpEngine->GetPaperSize();
2757 if ( mbAsianVertical )
2758 nURLHeight = aPaper.
Height();
2760 nURLWidth = aPaper.
Width();
2762 if (isVerticallyOriented())
2763 std::swap( nURLWidth, nURLHeight );
2764 else if (mbAsianVertical)
2765 aURLStart.
AdjustX( -nURLWidth );
2785 bool bVClip =
false;
2808 if (!(bClip || bSimClip))
2818 mpDev->IntersectClipRegion(maRect);
2834 mpDev->SetClipRegion();
2855 rNeededPixel = nEngineWidth;
2857 rNeededPixel += nAddWidthPixels;
2859 return nEngineWidth;
2864 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
2876 rParam.
meOrient = SvxCellOrientation::Standard;
2877 nAttrRotate = 0_deg100;
2902 if ( nXForPos <
nX1 )
2908 if ( nArrYForPos < 1 )
2918 Size aPaperSize( 1000000, 1000000 );
2925 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2953 rParam.
meVerJust = SvxCellVerJustify::Top;
2960 || rParam.
meVerJust==SvxCellVerJustify::Standard);
2964 bool bWrapFields =
false;
2983 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
2984 nNeededPixel += nLeftM + nRightM;
2986 if (!rParam.
mbBreak || bShrink)
2990 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2991 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
2996 nLeftM, nTopM, nRightM, nBottomM,
true,
2998 nEngineWidth, nEngineHeight, nNeededPixel,
3006 tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3008 if ( nAvailable >= 2 * nFormatted )
3017 if ( nRepeatSize > 0 )
3019 tools::Long nRepeatCount = nAvailable / nRepeatSize;
3020 if ( nRepeatCount > 1 )
3022 OUStringBuffer aRepeated(aCellStr);
3023 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3024 aRepeated.append(aCellStr);
3027 nNeededPixel, (nLeftM + nRightM ) );
3041 SetClipMarks( aAreaParam, pClipMarkCell, eOutHorJust,
true, nLayoutSign );
3044 if (eOutHorJust != SvxCellHorJustify::Left)
3046 aPaperSize.
setWidth( nNeededPixel + 1 );
3070 if ( eOutHorJust == SvxCellHorJustify::Right )
3071 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3072 else if ( eOutHorJust == SvxCellHorJustify::Center )
3073 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3084 bool bSimClip =
false;
3088 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
3090 aCellSize =
Size( nOutWidth, nOutHeight );
3092 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3102 ( rParam.
mpCondSet && SfxItemState::SET ==
3114 if ( nEngineHeight - aCellSize.
Height() > 100 &&
3137 if (rParam.
meVerJust==SvxCellVerJustify::Standard)
3138 rParam.
meVerJust=SvxCellVerJustify::Top;
3152 aLogicStart =
Point(nStartX, nStartY);
3162 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
3163 rParam.
meVerJust==SvxCellVerJustify::Standard)
3174 aLogicStart.
AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
3176 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
3184 aLogicStart.
AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
3194 aURLStart = aLogicStart;
3203 aDocStart -= aLogicStart;
3219 if ( !bHasHashText )
3224 if ( eOutHorJust == SvxCellHorJustify::Left )
3230 else if ( eOutHorJust == SvxCellHorJustify::Right )
3289 bool bWrapFields,
bool bTop)
3293 bool bSimClip =
false;
3296 if ( nEngineWidth >= aCellSize.
Width() + aRefOne.
Width() )
3306 ( rParam.
mpCondSet && SfxItemState::SET ==
3312 ShowClipMarks( rParam, nEngineWidth, aCellSize, bMerged, aAreaParam, bTop);
3323 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3336 if ( nXForPos <
nX1 )
3342 if ( nArrYForPos < 1 )
3352 Size aPaperSize( 1000000, 1000000 );
3359 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3380 bool bWrapFields =
false;
3399 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3400 nNeededPixel += nLeftM + nRightM;
3402 if (!rParam.
mbBreak || bShrink)
3406 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3407 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3412 nLeftM, nTopM, nRightM, nBottomM,
false,
3414 nEngineWidth, nEngineHeight, nNeededPixel,
3422 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3424 if ( nAvailable >= 2 * nFormatted )
3433 if ( nRepeatSize > 0 )
3435 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3436 if ( nRepeatCount > 1 )
3438 OUStringBuffer aRepeated(aCellStr);
3439 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3440 aRepeated.append(aCellStr);
3443 nNeededPixel, (nLeftM + nRightM ) );
3474 if ( eOutHorJust == SvxCellHorJustify::Right )
3475 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3476 else if ( eOutHorJust == SvxCellHorJustify::Center )
3477 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3489 :
Size( nOutWidth, nOutHeight );
3494 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineWidth, bWrapFields,
true );
3496 Point aLogicStart(nStartX, nStartY);
3499 aURLStart = aLogicStart;
3536 aLogicStart.
AdjustY(nTopOffset );
3540 case SvxCellVerJustify::Standard:
3541 case SvxCellVerJustify::Bottom:
3544 case SvxCellVerJustify::Center:
3546 aLogicStart.
AdjustY( -(nGap / 2) );
3548 case SvxCellVerJustify::Block:
3549 case SvxCellVerJustify::Top:
3566 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3579 if ( nXForPos <
nX1 )
3585 if ( nArrYForPos < 1 )
3595 Size aPaperSize( 1000000, 1000000 );
3602 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3623 bool bWrapFields =
false;
3642 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3643 nNeededPixel += nLeftM + nRightM;
3645 if (!rParam.
mbBreak || bShrink)
3649 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3650 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3655 nLeftM, nTopM, nRightM, nBottomM,
false,
3657 nEngineWidth, nEngineHeight, nNeededPixel,
3665 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3667 if ( nAvailable >= 2 * nFormatted )
3677 if ( nRepeatSize > 0 )
3679 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3680 if ( nRepeatCount > 1 )
3682 OUStringBuffer aRepeated(aCellStr);
3683 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3684 aRepeated.append(aCellStr);
3687 nNeededPixel, (nLeftM + nRightM ) );
3716 nStartX += aPaperSize.
Height();
3720 if ( eOutHorJust == SvxCellHorJustify::Right )
3721 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3722 else if ( eOutHorJust == SvxCellHorJustify::Center )
3723 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3735 :
Size( nOutWidth, nOutHeight );
3740 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineWidth, bWrapFields,
false );
3742 Point aLogicStart(nStartX, nStartY);
3745 aURLStart = aLogicStart;
3749 aLogicStart.
AdjustX(nEngineWidth );
3770 aLogicStart.
AdjustY(nTopOffset );
3774 case SvxCellVerJustify::Standard:
3775 case SvxCellVerJustify::Bottom:
3779 case SvxCellVerJustify::Center:
3781 aLogicStart.
AdjustY( -(nGap / 2) );
3783 case SvxCellVerJustify::Block:
3784 case SvxCellVerJustify::Top:
3803 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3815 rParam.
meOrient = SvxCellOrientation::Standard;
3828 if ( nXForPos <
nX1 )
3834 if ( nArrYForPos < 1 )
3844 Size aPaperSize( 1000000, 1000000 );
3849 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3880 bool bWrapFields =
false;
3899 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3900 nNeededPixel += nLeftM + nRightM;
3906 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3907 true,
false,
false, aAreaParam );
3910 nLeftM, nTopM, nRightM, nBottomM,
true,
3912 nEngineWidth, nEngineHeight, nNeededPixel,
3920 SetClipMarks( aAreaParam, pClipMarkCell, eOutHorJust,
true, nLayoutSign );
3923 if ( eOutHorJust != SvxCellHorJustify::Left )
3925 aPaperSize.
setWidth( nNeededPixel + 1 );
3949 if ( eOutHorJust == SvxCellHorJustify::Right )
3950 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3951 else if ( eOutHorJust == SvxCellHorJustify::Center )
3952 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3963 bool bSimClip =
false;
3967 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
3969 aCellSize =
Size( nOutWidth, nOutHeight );
3971 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3981 ( rParam.
mpCondSet && SfxItemState::SET ==
3993 if ( nEngineHeight - aCellSize.
Height() > 100 &&
4026 aLogicStart =
Point(nStartX, nStartY);
4028 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
4029 rParam.
meVerJust==SvxCellVerJustify::Standard)
4040 aLogicStart.
AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
4042 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
4050 aLogicStart.
AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
4060 aURLStart = aLogicStart;
4063 aPaperLogic.
setWidth( nEngineWidth );
4073 aDocStart -= aLogicStart;
4089 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
4091 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
4095 bool bHidden =
false;
4124 if ( nXForPos <
nX1 )
4130 if ( nArrYForPos < 1 )
4140 Size aPaperSize( 1000000, 1000000 );
4145 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4172 if ( rParam.
meVerJust == SvxCellVerJustify::Standard )
4173 rParam.
meVerJust = SvxCellVerJustify::Top;
4180 bool bWrapFields =
false;
4199 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
4200 nNeededPixel += nLeftM + nRightM;
4204 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4205 rParam.
mbCellIsValue || bShrink,
false,
false, aAreaParam );
4210 nLeftM, nTopM, nRightM, nBottomM,
false,
4212 nEngineWidth, nEngineHeight, nNeededPixel,
4220 SetClipMarks( aAreaParam, pClipMarkCell, eOutHorJust,
true, nLayoutSign );
4223 if (eOutHorJust != SvxCellHorJustify::Left)
4225 aPaperSize.
setWidth( nNeededPixel + 1 );
4250 bool bSimClip =
false;
4254 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
4256 aCellSize =
Size( nOutWidth, nOutHeight );
4258 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
4268 ( rParam.
mpCondSet && SfxItemState::SET ==
4280 if ( nEngineHeight - aCellSize.
Height() > 100 &&
4281 ( rParam.
mbBreak || rParam.
meOrient == SvxCellOrientation::Stacked ) &&
4314 aLogicStart =
Point(nStartX, nStartY);
4322 aLogicStart.
AdjustX(nAvailWidth - nEngineWidth );
4324 aLogicStart.
AdjustX((nAvailWidth - nEngineWidth) / 2 );
4327 aLogicStart.
AdjustX(nEngineWidth );
4335 aURLStart = aLogicStart;
4352 std::unique_ptr<ScFieldEditEngine> pEngine;
4353 bool bHyphenatorSet =
false;
4356 const SfxItemSet* pOldPreviewFontSet =
nullptr;
4368 if ( nX2 < mpDoc->MaxCol() )
4369 nLastContentCol = sal::static_int_cast<SCCOL>(
4377 if (nArrY==1) nRowPosY =
nScrY;
4379 if ( pThisRowInfo->
bChanged || nArrY==0 )
4384 std::unique_ptr< ScPatternAttr > pPreviewPattr;
4385 if (nX==
nX1) nPosX = nInitPosX;
4393 bool bDoCell =
false;
4414 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
4437 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 &&
4443 aCell = rCellInfo.
maCell;
4461 pPreviewPattr->SetStyleSheet(pPreviewStyle);
4462 pPattern = pPreviewPattr.get();