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 ),
254 if ( nNewHeight > 0 )
260 if ( pFmtDevice != pDev )
282template<
typename ItemType,
typename EnumType>
286 return static_cast<EnumType
>(rItem.GetValue());
291 return lcl_GetValue<SfxBoolItem, bool>(rPattern, nWhich, pCondSet);
298 sal_uInt32 nCurrentNumberFormat = pDoc->
GetNumberFormat( nCellX, nCellY, nTab );
300 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)
723 if (
GetOrient() != SvxCellOrientation::Standard )
742 for (
char i = 0;
i < 10; ++
i)
744 char cDigit =
'0' +
i;
799 if (
GetOrient() != SvxCellOrientation::Standard )
813 for (sal_Int32 nIdx = 0; nIdx <
aString.getLength(); ++nIdx)
855 return static_cast<double>(
aZoomY) /
static_cast<double>(
aZoomX);
874 if ( !
aURL.isEmpty() && pPDFData )
879 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->
GetBookmarks();
880 rBookmarks.push_back( aBookmark );
937 bool bVisRowChanged )
939 bool bDoMerge =
false;
940 bool bIsLeft = ( nX ==
nVisX1 );
941 bool bIsTop = ( nY ==
nVisY1 ) || bVisRowChanged;
961 if ( bHOver && bVOver )
962 bDoMerge = bIsLeft && bIsTop;
975 if ( !bDoMerge && !bHidden )
978 if (rOverX >=
nX1 && !bHidden)
995 if ( !bDoMerge && !bHidden )
1001 if (rOverX >=
nX1 && rOverY >=
nY1 &&
1020 OSL_ENSURE( pNewPattern,
"pNewPattern" );
1022 if ( pNewPattern == rpOldPattern )
1024 else if ( !rpOldPattern )
1090 rpOldPattern = pNewPattern;
1098 if ( !bProgress && pFCell->
GetDirty() )
1107 return ( nScript != SvtScriptType::LATIN &&
1108 nScript != SvtScriptType::ASIAN &&
1109 nScript != SvtScriptType::COMPLEX );
1117 if ( pThisRowInfo && nX <=
nX2 )
1125 if ( !bEmpty && ( nX < nX1 || nX >
nX2 || !pThisRowInfo ) )
1189 sal_uInt16 nHorJustify,
bool bCellIsValue,
1190 bool bBreak,
bool bOverwrite,
1199 SCCOL nCompCol = nX;
1200 while ( nCellX > nCompCol )
1204 pRowInfo[0].basicCellInfo(nCompCol).nWidth :
1206 nCellPosX += nColWidth * nLayoutSign;
1209 while ( nCellX < nCompCol )
1213 pRowInfo[0].basicCellInfo(nCompCol).nWidth :
1215 nCellPosX -= nColWidth * nLayoutSign;
1221 while ( nCellY > nCompRow )
1242 if ( nMergeCols == 0 )
1245 if ( nMergeRows == 0 )
1252 pRowInfo[0].basicCellInfo(nCellX+
i).nWidth :
1254 nMergeSizeX += nColWidth;
1258 if ( rThisRowInfo.
nRowNo == nCellY )
1261 nMergeSizeY += rThisRowInfo.
nHeight;
1285 if ( nNeeded > nMergeSizeX )
1294 case SvxCellHorJustify::Left:
1295 nRightMissing = nMissing;
1297 case SvxCellHorJustify::Right:
1298 nLeftMissing = nMissing;
1300 case SvxCellHorJustify::Center:
1301 nLeftMissing = nMissing / 2;
1302 nRightMissing = nMissing - nLeftMissing;
1312 ::std::swap( nLeftMissing, nRightMissing );
1314 SCCOL nRightX = nCellX;
1315 SCCOL nLeftX = nCellX;
1316 if ( !bMerged && !bCellIsValue && !bBreak )
1320 while ( nRightMissing > 0 && nRightX < mpDoc->MaxCol() && ( bOverwrite ||
IsAvailable( nRightX+1, nCellY ) ) )
1324 nRightMissing -= nAdd;
1327 if ( rThisRowInfo.
nRowNo == nCellY && nRightX >=
nX1 && nRightX <=
nX2 )
1331 while ( nLeftMissing > 0 && nLeftX > 0 && ( bOverwrite ||
IsAvailable( nLeftX-1, nCellY ) ) )
1333 if ( rThisRowInfo.
nRowNo == nCellY && nLeftX >=
nX1 && nLeftX <=
nX2 )
1338 nLeftMissing -= nAdd;
1345 if ( nRightMissing > 0 &&
bMarkClipped && nRightX >=
nX1 && nRightX <=
nX2 && !bBreak && !bCellIsValue )
1352 if ( nLeftMissing > 0 &&
bMarkClipped && nLeftX >=
nX1 && nLeftX <=
nX2 && !bBreak && !bCellIsValue )
1378 fZoom = fZoom > 1.0 ? fZoom : 1.0;
1380 bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
1400bool beginsWithRTLCharacter(
const OUString& rStr)
1407 case i18n::DirectionProperty_RIGHT_TO_LEFT:
1408 case i18n::DirectionProperty_RIGHT_TO_LEFT_ARABIC:
1409 case i18n::DirectionProperty_RIGHT_TO_LEFT_EMBEDDING:
1410 case i18n::DirectionProperty_RIGHT_TO_LEFT_OVERRIDE:
1427 bool bCellIsValue,
const OUString& rText,
1432 bool bUseWritingDirection =
false;
1433 if (eInHorJust == SvxCellHorJustify::Standard)
1437 if (beginsWithRTLCharacter( rText))
1440 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1442 eHorJustContext = SvxCellHorJustify::Right;
1444 else if (bCellIsValue)
1445 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Left : SvxCellHorJustify::Right;
1447 bUseWritingDirection =
true;
1450 if (bUseWritingDirection ||
1451 eInHorJust == SvxCellHorJustify::Block || eInHorJust == SvxCellHorJustify::Repeat)
1454 if (nDirection == SvxFrameDirection::Horizontal_LR_TB || nDirection == SvxFrameDirection::Vertical_LR_TB)
1455 eHorJustContext = SvxCellHorJustify::Left;
1456 else if (nDirection == SvxFrameDirection::Environment)
1458 SAL_WARN_IF( !pDoc,
"sc.ui",
"getAlignmentFromContext - pDoc==NULL");
1462 eHorJustContext = (pDoc && pDoc->
IsLayoutRTL(nTab) && (beginsWithRTLCharacter( rText))) ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1465 eHorJustContext = SvxCellHorJustify::Right;
1467 return eHorJustContext;
1484 mpDev->GetMapMode().GetMapUnit() ==
mpRefDevice->GetMapMode().GetMapUnit(),
1485 "LayoutStrings: different MapUnits ?!?!" );
1498 bool bProgress =
false;
1506 if ( nX2 < mpDoc->MaxCol() )
1507 nLastContentCol = sal::static_int_cast<SCCOL>(
1515 bool bCellIsValue =
false;
1525 std::vector<std::unique_ptr<ScPatternAttr> > aAltPatterns;
1533 if ((bPaint && pThisRowInfo->
bChanged) || (!bPaint && rAddress.
Row() == nY))
1536 if ( nLoopStartX <
nX1 )
1538 for (
SCCOL nX=nLoopStartX; nX<=
nX2; nX++)
1540 bool bMergeEmpty =
false;
1546 bool bDoCell =
false;
1547 bool bUseEditEngine =
false;
1571 if ( bEmpty && !bMergeEmpty && nX <
nX1 && !bOverlapped )
1577 if ( nTempX <
nX1 &&
1588 if ( bEmpty && !bMergeEmpty && nX ==
nX2 && !bOverlapped )
1593 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
1629 if ( nCellY == nY && nCellX == nX && nCellX >=
nX1 && nCellX <=
nX2 )
1636 bUseEditEngine =
true;
1643 bUseEditEngine =
true;
1646 if (bDoCell && !bUseEditEngine)
1648 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1669 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1684 pPattern = pAltPattern;
1691 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1695 pPattern = pAltPattern;
1702 if (nScript == SvtScriptType::NONE)
1705 if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
1709 pCondSet != pOldCondSet || nScript != nOldScript ||
mbSyntaxMode )
1711 aVars.
SetPattern(pPattern, pCondSet, aCell, nScript);
1715 pOldPattern = pPattern;
1716 pOldCondSet = pCondSet;
1717 nOldScript = nScript;
1721 if ( aVars.
GetOrient() == SvxCellOrientation::Stacked ||
1723 bUseEditEngine =
true;
1725 if (bDoCell && !bUseEditEngine)
1731 pOldPattern =
nullptr;
1736 if (bDoCell && !bUseEditEngine)
1748 *pPattern, pCondSet,
mpDoc,
nTab, bNumberFormatIsText );
1757 bool bRepeat = aVars.
IsRepeat() && !bBreak;
1758 bool bShrink = aVars.
IsShrink() && !bBreak && !bRepeat;
1767 GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
1768 *pPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
1769 bCellIsValue || bRepeat || bShrink, bBreak,
false,
1775 if ( aVars.
GetOrient() != SvxCellOrientation::Standard )
1779 bUseEditEngine =
true;
1786 if ( nAvailable > 0 && nScaleSize > 0 )
1788 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
1793 sal_uInt16 nShrinkAgain = 0;
1799 nScale = ( nScale * 9 ) / 10;
1806 if ( nNewSize <= nAvailable )
1813 pOldPattern =
nullptr;
1826 if ( nRepeatSize > 0 )
1828 tools::Long nRepeatCount = nAvailable / nRepeatSize;
1829 if ( nRepeatCount > 1 )
1832 OUStringBuffer aRepeated(aCellStr);
1833 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
1834 aRepeated.append(aCellStr);
1835 aVars.
SetAutoText( aRepeated.makeStringAndClear() );
1843 if ( aVars.
GetOrient() == SvxCellOrientation::Standard )
1853 if (!bUseEditEngine)
1856 aVars.
GetHorJust() == SvxCellHorJustify::Block &&
1866 RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : &
pRowInfo[0];
1909 bool bRightAdjusted =
false;
1910 switch (eOutHorJust)
1912 case SvxCellHorJustify::Left:
1915 case SvxCellHorJustify::Right:
1918 bRightAdjusted =
true;
1920 case SvxCellHorJustify::Center:
1934 case SvxCellVerJustify::Top:
1935 case SvxCellVerJustify::Block:
1939 nTestClipHeight += nTop;
1942 case SvxCellVerJustify::Bottom:
1946 nTestClipHeight += nBot;
1949 case SvxCellVerJustify::Center:
1953 nJustPosY += ( nOutHeight + nTop -
1955 nTestClipHeight += std::abs( nTop - nBot );
1964 if ( nTestClipHeight > nOutHeight )
1974 if ( bHClip || bVClip )
2003 Point aURLStart( nJustPosX, nJustPosY );
2007 case SvxCellOrientation::Standard:
2010 case SvxCellOrientation::TopBottom:
2013 case SvxCellOrientation::BottomUp:
2026 Point aDrawTextPos( nJustPosX, nJustPosY );
2027 if ( bPixelToLogic )
2033 aDrawTextPos =
mpRefDevice->PixelToLogic( aDrawTextPos );
2043 const OUString& aString = aVars.
GetString();
2044 if (!aString.isEmpty())
2050 OUString aShort = aString;
2059 double fVisibleRatio = 1.0;
2061 sal_Int32 nTextLen = aString.getLength();
2065 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2068 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2069 aShort = aShort.copy(0, nShortLen);
2072 else if (eOutHorJust == SvxCellHorJustify::Right && aAreaParam.
mnLeftClipLength > 0)
2075 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2078 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2079 aShort = aShort.copy(nTextLen-nShortLen);
2083 double fOffset = fTextWidth - fShortWidth;
2084 aDrawTextPos.Move(fOffset, 0);
2091 if (!bPaint && rAddress.
Col() == nX)
2094 mpDev->GetTextBoundRect(aRect, aShort);
2095 aRect += aDrawTextPos;
2101 size_t nLen = aShort.getLength();
2102 if (aDX.
size() < nLen)
2111 for (
size_t i = 0;
i < nLen; ++
i)
2112 aDX.
set(
i,
static_cast<sal_Int32
>(aDX[
i] / fMul + 0.5));
2116 mpDev->DrawTextArray(aDrawTextPos, aShort, aDX, {}, 0, nLen);
2121 mpDev->DrawText(aDrawTextPos, aShort, 0, -1,
nullptr,
nullptr,
2126 if ( bHClip || bVClip )
2131 mpDev->SetClipRegion();
2136 if (bPaint && bHasURL)
2157 pEngine->SetUpdateLayout(
false );
2162 nCtrl |= EEControlBits::ONLINESPELLING;
2169 pEngine->SetControlWord( nCtrl );
2215 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
2217 std::vector<sal_Int32> aPortions;
2220 sal_Int32 nStart = 0;
2221 for (
const sal_Int32 nEnd : aPortions )
2230 nWestern = ( nWestern * nPercent ) / 100;
2231 nCJK = ( nCJK * nPercent ) / 100;
2232 nCTL = ( nCTL * nPercent ) / 100;
2260 double nRealOrient =
toRadians(nAttrRotate);
2261 double nAbsCos = fabs( cos( nRealOrient ) );
2262 double nAbsSin = fabs( sin( nRealOrient ) );
2264 return static_cast<tools::Long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin );
2266 return static_cast<tools::Long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin );
2284 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2288 if ( nScaleSize <= rAlignRect.
GetHeight() )
2291 bool bSwap = ( nOrient == SvxCellOrientation::TopBottom || nOrient == SvxCellOrientation::BottomUp );
2293 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2296 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2298 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2300 sal_uInt16 nShrinkAgain = 0;
2305 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2306 nNewSize = bPixelToLogic ?
2307 mpRefDevice->LogicToPixel(
Size(0,rEngineHeight)).Height() : rEngineHeight;
2314 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2315 rNeededPixel = nPixelWidth + nLeftM + nRightM;
2317 else if ( rLeftClip || rRightClip )
2322 tools::Long nScaleSize = rNeededPixel - nLeftM - nRightM;
2324 if ( nScaleSize <= nAvailable )
2327 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2332 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2334 sal_uInt16 nShrinkAgain = 0;
2340 nNewSize = bPixelToLogic ?
2341 mpRefDevice->LogicToPixel(
Size(rEngineWidth,0)).Width() : rEngineWidth;
2344 if ( nNewSize <= nAvailable )
2345 rLeftClip = rRightClip =
false;
2348 rNeededPixel = nNewSize + nLeftM + nRightM;
2349 rEngineHeight =
lcl_GetEditSize( rEngine,
false,
false, nAttrRotate );
2355 meHorJustContext( meHorJustAttr ),
2356 meHorJustResult( meHorJustAttr ),
2360 meOrient( pPattern->GetCellOrientation(pCondSet) ),
2362 mnX(0),
mnCellX(0), mnCellY(0),
2363 mnPosX(0), mnPosY(0), mnInitPosX(0),
2365 mbCellIsValue(bCellIsValue),
2366 mbAsianVertical(false),
2367 mbPixelToLogic(false),
2368 mbHyphenatorSet(false),
2371 mpCondSet(pCondSet),
2372 mpPreviewFontSet(nullptr),
2373 mpOldPattern(nullptr),
2374 mpOldCondSet(nullptr),
2375 mpOldPreviewFontSet(nullptr),
2376 mpThisRowInfo(nullptr),
2377 mpMisspellRanges(nullptr)
2381 const ScDocument* pDoc,
bool bShowNullValues,
bool bShowFormulas,
bool bSyntaxMode,
bool bUseStyleColor,
bool bForceAutoColor,
bool& rWrapFields)
2388 mpEngine->SetTextCurrentDefaults(*
pData);
2390 if ( mbBreak && !mbAsianVertical &&
pData->HasField() )
2400 OSL_FAIL(
"pData == 0");
2406 sal_uInt32 nFormat =
mpPattern->GetNumberFormat(
2408 const Color* pColor;
2416 mpEngine->SetTextCurrentDefaults(aString);
2417 if ( pColor && !bSyntaxMode && !( bUseStyleColor && bForceAutoColor ) )
2421 if (mpMisspellRanges)
2422 mpEngine->SetAllMisspellRanges(*mpMisspellRanges);
2432 if (
mpPattern == mpOldPattern && mpCondSet == mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
2436 bool bCellContrast = bUseStyleColor &&
2439 auto pSet = std::make_unique<SfxItemSet>( mpEngine->GetEmptyItemSet() );
2440 mpPattern->FillEditItemSet( pSet.get(), mpCondSet );
2441 if ( mpPreviewFontSet )
2460 mpEngine->SetDefaults( std::move(pSet) );
2462 mpOldCondSet = mpCondSet;
2463 mpOldPreviewFontSet = mpPreviewFontSet;
2466 if (meOrient == SvxCellOrientation::Stacked)
2467 nControl |= EEControlBits::ONECHARPERLINE;
2470 mpEngine->SetControlWord( nControl );
2472 if ( !mbHyphenatorSet && bParaHyphenate )
2476 mpEngine->SetHyphenator( xXHyphenator );
2477 mbHyphenatorSet =
true;
2481 if ( bUseStyleColor && ( aBackCol.
IsTransparent() || bCellContrast ) )
2482 aBackCol = nConfBackColor;
2483 mpEngine->SetBackgroundColor( aBackCol );
2490 sal_uInt16 nIndent = 0;
2491 if (meHorJustAttr == SvxCellHorJustify::Left || meHorJustAttr == SvxCellHorJustify::Right)
2498 if(meHorJustAttr == SvxCellHorJustify::Right)
2509 calcMargins(nTopM, nLeftM, nBottomM, nRightM,
nPPTX,
nPPTY);
2511 if (isVerticallyOriented())
2522 if (mbAsianVertical)
2535 if (!mbBreak || meOrient == SvxCellOrientation::Stacked || mbAsianVertical)
2540 if (isVerticallyOriented())
2541 std::swap( nEngineWidth, nEngineHeight );
2543 if (meOrient == SvxCellOrientation::Stacked)
2544 nEngineWidth = nEngineWidth * 11 / 10;
2546 rWidth = nEngineWidth;
2547 rHeight = nEngineHeight;
2552 return (mbBreak || (meOrient == SvxCellOrientation::Stacked) || mbAsianVertical);
2560 return maCell.getFormula()->IsHyperLinkCell();
2565 return (meOrient == SvxCellOrientation::TopBottom || meOrient == SvxCellOrientation::BottomUp);
2571 OSL_ENSURE(isVerticallyOriented(),
"Use this only for vertically oriented cell!");
2583 rLogicStart.AdjustY(nTopM );
2585 switch (meHorJustResult)
2587 case SvxCellHorJustify::Center:
2588 rLogicStart.AdjustX((
nCellWidth - nEngineWidth) / 2 );
2590 case SvxCellHorJustify::Right:
2591 rLogicStart.AdjustX(
nCellWidth - nEngineWidth );
2600 if (isVerticallyOriented() || mbAsianVertical)
2605 case SvxCellVerJustify::Top:
2606 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2607 SvxAdjust::Left : SvxAdjust::Right;
2609 case SvxCellVerJustify::Center:
2610 eSvxAdjust = SvxAdjust::Center;
2612 case SvxCellVerJustify::Bottom:
2613 case SvxCellVerJustify::Standard:
2614 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2615 SvxAdjust::Right : SvxAdjust::Left;
2617 case SvxCellVerJustify::Block:
2618 eSvxAdjust = SvxAdjust::Block;
2625 if (meHorJustResult == SvxCellHorJustify::Block)
2635 if (meOrient == SvxCellOrientation::Stacked)
2636 eSvxAdjust = SvxAdjust::Center;
2639 if (meOrient == SvxCellOrientation::Standard)
2640 switch (meHorJustResult)
2642 case SvxCellHorJustify::Repeat:
2643 case SvxCellHorJustify::Standard:
2644 SAL_WARN(
"sc.ui",
"meHorJustResult does not match getAlignmentFromContext()");
2646 case SvxCellHorJustify::Left:
2647 eSvxAdjust = SvxAdjust::Left;
2649 case SvxCellHorJustify::Center:
2650 eSvxAdjust = SvxAdjust::Center;
2652 case SvxCellHorJustify::Right:
2653 eSvxAdjust = SvxAdjust::Right;
2655 case SvxCellHorJustify::Block:
2656 eSvxAdjust = SvxAdjust::Block;
2662 case SvxCellVerJustify::Top:
2663 eSvxAdjust = SvxAdjust::Right;
2665 case SvxCellVerJustify::Center:
2666 eSvxAdjust = SvxAdjust::Center;
2668 case SvxCellVerJustify::Bottom:
2669 case SvxCellVerJustify::Standard:
2670 eSvxAdjust = SvxAdjust::Left;
2672 case SvxCellVerJustify::Block:
2673 eSvxAdjust = SvxAdjust::Block;
2680 if (mbAsianVertical)
2683 if (meHorJustResult == SvxCellHorJustify::Block)
2689 if (meVerJust == SvxCellVerJustify::Block)
2694 mpEngine->SetVertical(mbAsianVertical);
2708 if (meHorJustResult == SvxCellHorJustify::Right || meHorJustResult == SvxCellHorJustify::Center)
2710 SvxAdjust eEditAdjust = (meHorJustResult == SvxCellHorJustify::Center) ?
2711 SvxAdjust::Center : SvxAdjust::Right;
2725 bool bHasURL = pPDFData && isHyperlinkCell();
2730 tools::Long nURLHeight = mpEngine->GetTextHeight();
2733 Size aPaper = mpEngine->GetPaperSize();
2734 if ( mbAsianVertical )
2735 nURLHeight = aPaper.
Height();
2737 nURLWidth = aPaper.
Width();
2739 if (isVerticallyOriented())
2740 std::swap( nURLWidth, nURLHeight );
2741 else if (mbAsianVertical)
2742 aURLStart.AdjustX( -nURLWidth );
2762 bool bVClip =
false;
2785 if (!(bClip || bSimClip))
2795 mpDev->IntersectClipRegion(maRect);
2811 mpDev->SetClipRegion();
2832 rNeededPixel = nEngineWidth;
2834 rNeededPixel += nAddWidthPixels;
2836 return nEngineWidth;
2841 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
2853 rParam.
meOrient = SvxCellOrientation::Standard;
2854 nAttrRotate = 0_deg100;
2879 if ( nXForPos <
nX1 )
2885 if ( nArrYForPos < 1 )
2895 Size aPaperSize( 1000000, 1000000 );
2902 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2930 rParam.
meVerJust = SvxCellVerJustify::Top;
2937 || rParam.
meVerJust==SvxCellVerJustify::Standard);
2941 bool bWrapFields =
false;
2960 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
2961 nNeededPixel += nLeftM + nRightM;
2963 if (!rParam.
mbBreak || bShrink)
2967 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2968 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
2973 nLeftM, nTopM, nRightM, nBottomM,
true,
2975 nEngineWidth, nEngineHeight, nNeededPixel,
2983 tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
2985 if ( nAvailable >= 2 * nFormatted )
2994 if ( nRepeatSize > 0 )
2996 tools::Long nRepeatCount = nAvailable / nRepeatSize;
2997 if ( nRepeatCount > 1 )
2999 OUStringBuffer aRepeated(aCellStr);
3000 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3001 aRepeated.append(aCellStr);
3004 nNeededPixel, (nLeftM + nRightM ) );
3020 if (eOutHorJust != SvxCellHorJustify::Left)
3022 aPaperSize.
setWidth( nNeededPixel + 1 );
3046 if ( eOutHorJust == SvxCellHorJustify::Right )
3047 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3048 else if ( eOutHorJust == SvxCellHorJustify::Center )
3049 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3060 bool bSimClip =
false;
3064 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
3066 aCellSize =
Size( nOutWidth, nOutHeight );
3068 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3078 ( rParam.
mpCondSet && SfxItemState::SET ==
3090 if ( nEngineHeight - aCellSize.
Height() > 100 &&
3113 if (rParam.
meVerJust==SvxCellVerJustify::Standard)
3114 rParam.
meVerJust=SvxCellVerJustify::Top;
3128 aLogicStart =
Point(nStartX, nStartY);
3138 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
3139 rParam.
meVerJust==SvxCellVerJustify::Standard)
3150 aLogicStart.AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
3152 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
3160 aLogicStart.AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
3167 aLogicStart.AdjustY(nTopM );
3170 aURLStart = aLogicStart;
3179 aDocStart -= aLogicStart;
3233 bool bWrapFields,
bool bTop)
3237 bool bSimClip =
false;
3240 if ( nEngineWidth >= aCellSize.
Width() + aRefOne.
Width() )
3250 ( rParam.
mpCondSet && SfxItemState::SET ==
3256 ShowClipMarks( rParam, nEngineWidth, aCellSize, bMerged, aAreaParam, bTop);
3267 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3280 if ( nXForPos <
nX1 )
3286 if ( nArrYForPos < 1 )
3296 Size aPaperSize( 1000000, 1000000 );
3303 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3324 bool bWrapFields =
false;
3343 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3344 nNeededPixel += nLeftM + nRightM;
3346 if (!rParam.
mbBreak || bShrink)
3350 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3351 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3356 nLeftM, nTopM, nRightM, nBottomM,
false,
3358 nEngineWidth, nEngineHeight, nNeededPixel,
3366 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3368 if ( nAvailable >= 2 * nFormatted )
3377 if ( nRepeatSize > 0 )
3379 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3380 if ( nRepeatCount > 1 )
3382 OUStringBuffer aRepeated(aCellStr);
3383 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3384 aRepeated.append(aCellStr);
3387 nNeededPixel, (nLeftM + nRightM ) );
3418 if ( eOutHorJust == SvxCellHorJustify::Right )
3419 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3420 else if ( eOutHorJust == SvxCellHorJustify::Center )
3421 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3433 :
Size( nOutWidth, nOutHeight );
3438 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineWidth, bWrapFields,
true );
3440 Point aLogicStart(nStartX, nStartY);
3443 aURLStart = aLogicStart;
3450 aLogicStart.AdjustY(
3479 aLogicStart.AdjustY(aCellSize.
Height() );
3480 aLogicStart.AdjustY(nTopOffset );
3484 case SvxCellVerJustify::Standard:
3485 case SvxCellVerJustify::Bottom:
3488 case SvxCellVerJustify::Center:
3490 aLogicStart.AdjustY( -(nGap / 2) );
3492 case SvxCellVerJustify::Block:
3493 case SvxCellVerJustify::Top:
3495 aLogicStart.AdjustY( -nGap );
3510 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3523 if ( nXForPos <
nX1 )
3529 if ( nArrYForPos < 1 )
3539 Size aPaperSize( 1000000, 1000000 );
3546 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3567 bool bWrapFields =
false;
3586 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3587 nNeededPixel += nLeftM + nRightM;
3589 if (!rParam.
mbBreak || bShrink)
3593 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3594 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3599 nLeftM, nTopM, nRightM, nBottomM,
false,
3601 nEngineWidth, nEngineHeight, nNeededPixel,
3609 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3611 if ( nAvailable >= 2 * nFormatted )
3621 if ( nRepeatSize > 0 )
3623 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3624 if ( nRepeatCount > 1 )
3626 OUStringBuffer aRepeated(aCellStr);
3627 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3628 aRepeated.append(aCellStr);
3631 nNeededPixel, (nLeftM + nRightM ) );
3660 nStartX += aPaperSize.
Height();
3664 if ( eOutHorJust == SvxCellHorJustify::Right )
3665 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3666 else if ( eOutHorJust == SvxCellHorJustify::Center )
3667 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3679 :
Size( nOutWidth, nOutHeight );
3684 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineWidth, bWrapFields,
false );
3686 Point aLogicStart(nStartX, nStartY);
3689 aURLStart = aLogicStart;
3693 aLogicStart.AdjustX(nEngineWidth );
3714 aLogicStart.AdjustY(nTopOffset );
3718 case SvxCellVerJustify::Standard:
3719 case SvxCellVerJustify::Bottom:
3721 aLogicStart.AdjustY( -nGap );
3723 case SvxCellVerJustify::Center:
3725 aLogicStart.AdjustY( -(nGap / 2) );
3727 case SvxCellVerJustify::Block:
3728 case SvxCellVerJustify::Top:
3747 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3759 rParam.
meOrient = SvxCellOrientation::Standard;
3772 if ( nXForPos <
nX1 )
3778 if ( nArrYForPos < 1 )
3788 Size aPaperSize( 1000000, 1000000 );
3793 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3824 bool bWrapFields =
false;
3843 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
3844 nNeededPixel += nLeftM + nRightM;
3850 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3851 true,
false,
false, aAreaParam );
3854 nLeftM, nTopM, nRightM, nBottomM,
true,
3856 nEngineWidth, nEngineHeight, nNeededPixel,
3866 if ( eOutHorJust != SvxCellHorJustify::Left )
3868 aPaperSize.
setWidth( nNeededPixel + 1 );
3892 if ( eOutHorJust == SvxCellHorJustify::Right )
3893 nStartX -= nNeededPixel -
nCellWidth + nRightM + 1;
3894 else if ( eOutHorJust == SvxCellHorJustify::Center )
3895 nStartX -= ( nNeededPixel -
nCellWidth + nRightM + 1 - nLeftM ) / 2;
3906 bool bSimClip =
false;
3910 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
3912 aCellSize =
Size( nOutWidth, nOutHeight );
3914 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3924 ( rParam.
mpCondSet && SfxItemState::SET ==
3936 if ( nEngineHeight - aCellSize.
Height() > 100 &&
3969 aLogicStart =
Point(nStartX, nStartY);
3971 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
3972 rParam.
meVerJust==SvxCellVerJustify::Standard)
3983 aLogicStart.AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
3985 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
3993 aLogicStart.AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
4000 aLogicStart.AdjustY(nTopM );
4003 aURLStart = aLogicStart;
4006 aPaperLogic.
setWidth( nEngineWidth );
4016 aDocStart -= aLogicStart;
4032 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
4034 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
4038 bool bHidden =
false;
4067 if ( nXForPos <
nX1 )
4073 if ( nArrYForPos < 1 )
4083 Size aPaperSize( 1000000, 1000000 );
4088 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4115 if ( rParam.
meVerJust == SvxCellVerJustify::Standard )
4116 rParam.
meVerJust = SvxCellVerJustify::Top;
4123 bool bWrapFields =
false;
4142 nNeededPixel =
mpRefDevice->LogicToPixel(
Size(nNeededPixel,0)).Width();
4143 nNeededPixel += nLeftM + nRightM;
4147 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4148 rParam.
mbCellIsValue || bShrink,
false,
false, aAreaParam );
4153 nLeftM, nTopM, nRightM, nBottomM,
false,
4155 nEngineWidth, nEngineHeight, nNeededPixel,
4165 if (eOutHorJust != SvxCellHorJustify::Left)
4167 aPaperSize.
setWidth( nNeededPixel + 1 );
4192 bool bSimClip =
false;
4196 aCellSize =
mpRefDevice->PixelToLogic(
Size( nOutWidth, nOutHeight ) );
4198 aCellSize =
Size( nOutWidth, nOutHeight );
4200 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
4210 ( rParam.
mpCondSet && SfxItemState::SET ==
4222 if ( nEngineHeight - aCellSize.
Height() > 100 &&
4223 ( rParam.
mbBreak || rParam.
meOrient == SvxCellOrientation::Stacked ) &&
4256 aLogicStart =
Point(nStartX, nStartY);
4264 aLogicStart.AdjustX(nAvailWidth - nEngineWidth );
4266 aLogicStart.AdjustX((nAvailWidth - nEngineWidth) / 2 );
4269 aLogicStart.AdjustX(nEngineWidth );
4275 aLogicStart.AdjustY(nTopM );
4277 aURLStart = aLogicStart;
4294 std::unique_ptr<ScFieldEditEngine> pEngine;
4295 bool bHyphenatorSet =
false;
4298 const SfxItemSet* pOldPreviewFontSet =
nullptr;
4310 if ( nX2 < mpDoc->MaxCol() )
4311 nLastContentCol = sal::static_int_cast<SCCOL>(
4319 if (nArrY==1) nRowPosY =
nScrY;
4321 if ( pThisRowInfo->
bChanged || nArrY==0 )
4326 std::unique_ptr< ScPatternAttr > pPreviewPattr;
4327 if (nX==
nX1) nPosX = nInitPosX;
4335 bool bDoCell =
false;
4356 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
4379 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 &&
4385 aCell = rCellInfo.
maCell;
4403 pPreviewPattr->SetStyleSheet(pPreviewStyle);
4404 pPattern = pPreviewPattr.get();
4444 aParam.
meOrient = SvxCellOrientation::Standard;
4448 case SvxCellOrientation::BottomUp:
4451 case SvxCellOrientation::TopBottom:
4454 case SvxCellOrientation::Stacked:
4496 std::unique_ptr<ScFieldEditEngine> pEngine;
4497 bool bHyphenatorSet =
false;
4516 if (nArrY==1) nRowPosY =
nScrY;
4521 for (
SCCOL nX=0; nX<=nRotMax; nX++)
4523 if (nX==
nX1) nPosX = nInitPosX;