56 #include <osl/diagnose.h>
59 #include <document.hxx>
65 #include <progress.hxx>
68 #include <stlsheet.hxx>
72 #include <com/sun/star/i18n/DirectionProperty.hpp>
83 #define DROPDOWN_BITMAP_SIZE 18
85 #define DRAWTEXT_MAX 32767
144 void SetAutoText(
const OUString& rAutoText );
176 bool HasEditCharacters()
const;
188 pPattern ( nullptr ),
189 pCondSet ( nullptr ),
204 bLineBreak ( false ),
207 bPixelToLogic( bPTL ),
236 if ( nNewHeight > 0 )
242 if ( pFmtDevice != pDev )
264 template<
typename ItemType,
typename EnumType>
268 return static_cast<EnumType
>(rItem.GetValue());
273 return lcl_GetValue<SfxBoolItem, bool>(rPattern, nWhich, pCondSet);
280 sal_uInt32 nCurrentNumberFormat;
283 return pNumberFormatter->
GetType( nCurrentNumberFormat ) == SvNumFormatType::TEXT;
361 case SvxCellOrientation::Standard:
366 case SvxCellOrientation::Stacked:
370 case SvxCellOrientation::TopBottom:
374 case SvxCellOrientation::BottomUp:
379 OSL_FAIL(
"Invalid SvxCellOrientation value");
396 if ( pFmtDevice != pDev )
484 bool bChanged =
false;
563 if ( nCharWidth < 1 || (
bPixelToLogic && nCharWidth < pOutput->mpRefDevice->PixelToLogic(
Size(1,0)).Width()) )
575 if ( nSpaceToFill <= nCharWidth )
578 tools::Long nCharsToInsert = nSpaceToFill / nCharWidth;
579 OUStringBuffer aFill;
627 sal_uInt16 nNumDigits =
static_cast<sal_uInt16
>(nWidth / nMaxDigit);
638 sal_uInt8 nSignCount = 0, nDecimalCount = 0, nExpCount = 0;
639 sal_Int32 nLen =
aString.getLength();
641 for( sal_Int32
i = 0;
i < nLen; ++
i )
646 else if (c == cDecSep)
654 if (
aString ==
"0" && fVal != 0.0)
658 nWidth += (nMaxDigit -
GetDotWidth()) * nDecimalCount;
664 if (nDecimalCount || nSignCount || nExpCount)
667 nNumDigits =
static_cast<sal_uInt16
>(nWidth / nMaxDigit);
679 if (nActualTextWidth > nWidth)
706 if (
GetOrient() != SvxCellOrientation::Standard )
725 for (
char i = 0;
i < 10; ++
i)
727 char cDigit =
'0' +
i;
776 if (
GetOrient() != SvxCellOrientation::Standard )
790 for (sal_Int32 nIdx = 0; nIdx <
aString.getLength(); ++nIdx)
832 return static_cast<double>(
aZoomY) / static_cast<double>(
aZoomX);
851 if ( !aURL.isEmpty() && pPDFData )
856 std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFData->
GetBookmarks();
857 rBookmarks.push_back( aBookmark );
914 bool bVisRowChanged )
916 bool bDoMerge =
false;
917 bool bIsLeft = ( nX ==
nVisX1 );
918 bool bIsTop = ( nY ==
nVisY1 ) || bVisRowChanged;
938 if ( bHOver && bVOver )
939 bDoMerge = bIsLeft && bIsTop;
952 if ( !bDoMerge && !bHidden )
955 if (rOverX >=
nX1 && !bHidden)
972 if ( !bDoMerge && !bHidden )
978 if (rOverX >=
nX1 && rOverY >=
nY1 &&
997 OSL_ENSURE( pNewPattern,
"pNewPattern" );
999 if ( pNewPattern == rpOldPattern )
1001 else if ( !rpOldPattern )
1067 rpOldPattern = pNewPattern;
1075 if ( !bProgress && pFCell->
GetDirty() )
1084 return ( nScript != SvtScriptType::LATIN &&
1085 nScript != SvtScriptType::ASIAN &&
1086 nScript != SvtScriptType::COMPLEX );
1094 if ( pThisRowInfo && nX <=
nX2 )
1102 if ( !bEmpty && ( nX < nX1 || nX >
nX2 || !pThisRowInfo ) )
1166 sal_uInt16 nHorJustify,
bool bCellIsValue,
1167 bool bBreak,
bool bOverwrite,
1176 SCCOL nCompCol = nX;
1177 while ( nCellX > nCompCol )
1181 pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
1183 nCellPosX += nColWidth * nLayoutSign;
1186 while ( nCellX < nCompCol )
1190 pRowInfo[0].pCellInfo[nCompCol+1].nWidth :
1192 nCellPosX -= nColWidth * nLayoutSign;
1198 while ( nCellY > nCompRow )
1219 if ( nMergeCols == 0 )
1222 if ( nMergeRows == 0 )
1229 pRowInfo[0].pCellInfo[nCellX+i+1].nWidth :
1231 nMergeSizeX += nColWidth;
1235 if ( rThisRowInfo.
nRowNo == nCellY )
1238 nMergeSizeY += rThisRowInfo.
nHeight;
1262 if ( nNeeded > nMergeSizeX )
1271 case SvxCellHorJustify::Left:
1272 nRightMissing = nMissing;
1274 case SvxCellHorJustify::Right:
1275 nLeftMissing = nMissing;
1277 case SvxCellHorJustify::Center:
1278 nLeftMissing = nMissing / 2;
1279 nRightMissing = nMissing - nLeftMissing;
1289 ::std::swap( nLeftMissing, nRightMissing );
1291 SCCOL nRightX = nCellX;
1292 SCCOL nLeftX = nCellX;
1293 if ( !bMerged && !bCellIsValue && !bBreak )
1297 while ( nRightMissing > 0 && nRightX < mpDoc->MaxCol() && ( bOverwrite ||
IsAvailable( nRightX+1, nCellY ) ) )
1301 nRightMissing -= nAdd;
1304 if ( rThisRowInfo.
nRowNo == nCellY && nRightX >=
nX1 && nRightX <=
nX2 )
1308 while ( nLeftMissing > 0 && nLeftX > 0 && ( bOverwrite ||
IsAvailable( nLeftX-1, nCellY ) ) )
1310 if ( rThisRowInfo.
nRowNo == nCellY && nLeftX >=
nX1 && nLeftX <=
nX2 )
1315 nLeftMissing -= nAdd;
1322 if ( nRightMissing > 0 &&
bMarkClipped && nRightX >=
nX1 && nRightX <=
nX2 && !bBreak && !bCellIsValue )
1329 if ( nLeftMissing > 0 &&
bMarkClipped && nLeftX >=
nX1 && nLeftX <=
nX2 && !bBreak && !bCellIsValue )
1355 bool bFit = ( nNeeded + nFilter <= nMergeSizeX );
1375 bool beginsWithRTLCharacter(
const OUString& rStr)
1382 case i18n::DirectionProperty_RIGHT_TO_LEFT:
1383 case i18n::DirectionProperty_RIGHT_TO_LEFT_ARABIC:
1384 case i18n::DirectionProperty_RIGHT_TO_LEFT_EMBEDDING:
1385 case i18n::DirectionProperty_RIGHT_TO_LEFT_OVERRIDE:
1402 bool bCellIsValue,
const OUString& rText,
1407 bool bUseWritingDirection =
false;
1408 if (eInHorJust == SvxCellHorJustify::Standard)
1412 if (beginsWithRTLCharacter( rText))
1415 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1417 eHorJustContext = SvxCellHorJustify::Right;
1419 else if (bCellIsValue)
1420 eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Left : SvxCellHorJustify::Right;
1422 bUseWritingDirection =
true;
1425 if (bUseWritingDirection ||
1426 eInHorJust == SvxCellHorJustify::Block || eInHorJust == SvxCellHorJustify::Repeat)
1429 if (nDirection == SvxFrameDirection::Horizontal_LR_TB || nDirection == SvxFrameDirection::Vertical_LR_TB)
1430 eHorJustContext = SvxCellHorJustify::Left;
1431 else if (nDirection == SvxFrameDirection::Environment)
1433 SAL_WARN_IF( !pDoc,
"sc.ui",
"getAlignmentFromContext - pDoc==NULL");
1437 eHorJustContext = (pDoc && pDoc->
IsLayoutRTL(nTab) && (beginsWithRTLCharacter( rText))) ? SvxCellHorJustify::Right : SvxCellHorJustify::Left;
1440 eHorJustContext = SvxCellHorJustify::Right;
1442 return eHorJustContext;
1454 "LayoutStrings: different MapUnits ?!?!" );
1461 bool bProgress =
false;
1469 if ( nX2 < mpDoc->MaxCol() )
1470 nLastContentCol = sal::static_int_cast<
SCCOL>(
1472 SCCOL nLoopStartX =
nX1;
1478 bool bCellIsValue =
false;
1488 std::vector<std::unique_ptr<ScPatternAttr> > aAltPatterns;
1490 std::vector<tools::Long> aDX;
1496 if ((bPaint && pThisRowInfo->
bChanged) || (!bPaint && rAddress.
Row() == nY))
1499 if ( nLoopStartX <
nX1 )
1501 for (SCCOL nX=nLoopStartX; nX<=
nX2; nX++)
1503 bool bMergeEmpty =
false;
1509 bool bDoCell =
false;
1510 bool bUseEditEngine =
false;
1534 if ( bEmpty && !bMergeEmpty && nX <
nX1 && !bOverlapped )
1540 if ( nTempX <
nX1 &&
1551 if ( bEmpty && !bMergeEmpty && nX ==
nX2 && !bOverlapped )
1556 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
1592 if ( nCellY == nY && nCellX == nX && nCellX >=
nX1 && nCellX <=
nX2 )
1599 bUseEditEngine =
true;
1606 bUseEditEngine =
true;
1609 if (bDoCell && !bUseEditEngine)
1611 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 )
1632 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1641 if ( pFontSet->GetItemState(
ATTR_FONT,
true, &pItem ) == SfxItemState::SET )
1642 pAltPattern->
GetItemSet().
Put( static_cast<const SvxFontItem&>(*pItem) );
1643 if ( pFontSet->GetItemState(
ATTR_CJK_FONT,
true, &pItem ) == SfxItemState::SET )
1644 pAltPattern->
GetItemSet().
Put( static_cast<const SvxFontItem&>(*pItem) );
1645 if ( pFontSet->GetItemState(
ATTR_CTL_FONT,
true, &pItem ) == SfxItemState::SET )
1646 pAltPattern->
GetItemSet().
Put( static_cast<const SvxFontItem&>(*pItem) );
1648 pPattern = pAltPattern;
1655 aAltPatterns.push_back(std::make_unique<ScPatternAttr>(*pPattern));
1659 pPattern = pAltPattern;
1666 if (nScript == SvtScriptType::NONE)
1669 if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
1673 pCondSet != pOldCondSet || nScript != nOldScript ||
mbSyntaxMode )
1675 aVars.
SetPattern(pPattern, pCondSet, aCell, nScript);
1679 pOldPattern = pPattern;
1680 pOldCondSet = pCondSet;
1681 nOldScript = nScript;
1685 if ( aVars.
GetOrient() == SvxCellOrientation::Stacked ||
1687 bUseEditEngine =
true;
1689 if (bDoCell && !bUseEditEngine)
1695 pOldPattern =
nullptr;
1700 if (bDoCell && !bUseEditEngine)
1712 *pPattern, pCondSet,
mpDoc,
nTab, bNumberFormatIsText );
1721 bool bRepeat = aVars.
IsRepeat() && !bBreak;
1722 bool bShrink = aVars.
IsShrink() && !bBreak && !bRepeat;
1731 GetOutputArea( nX, nArrY, nPosX, nPosY, nCellX, nCellY, nNeededWidth,
1732 *pPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
1733 bCellIsValue || bRepeat || bShrink, bBreak,
false,
1739 if ( aVars.
GetOrient() != SvxCellOrientation::Standard )
1743 bUseEditEngine =
true;
1750 if ( nAvailable > 0 && nScaleSize > 0 )
1752 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
1757 sal_uInt16 nShrinkAgain = 0;
1763 nScale = ( nScale * 9 ) / 10;
1770 if ( nNewSize <= nAvailable )
1777 pOldPattern =
nullptr;
1790 if ( nRepeatSize > 0 )
1792 tools::Long nRepeatCount = nAvailable / nRepeatSize;
1793 if ( nRepeatCount > 1 )
1796 OUStringBuffer aRepeated = aCellStr;
1797 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
1798 aRepeated.append(aCellStr);
1799 aVars.
SetAutoText( aRepeated.makeStringAndClear() );
1807 if ( aVars.
GetOrient() == SvxCellOrientation::Standard )
1817 if (!bUseEditEngine)
1820 aVars.
GetHorJust() == SvxCellHorJustify::Block &&
1829 SCCOL nMarkX = ( nCellX <=
nX2 ) ? nCellX :
nX2;
1830 RowInfo* pMarkRowInfo = ( nCellY == nY ) ? pThisRowInfo : &
pRowInfo[0];
1873 bool bRightAdjusted =
false;
1874 switch (eOutHorJust)
1876 case SvxCellHorJustify::Left:
1879 case SvxCellHorJustify::Right:
1882 bRightAdjusted =
true;
1884 case SvxCellHorJustify::Center:
1898 case SvxCellVerJustify::Top:
1899 case SvxCellVerJustify::Block:
1903 nTestClipHeight += nTop;
1906 case SvxCellVerJustify::Bottom:
1910 nTestClipHeight += nBot;
1913 case SvxCellVerJustify::Center:
1917 nJustPosY += ( nOutHeight + nTop -
1919 nTestClipHeight += std::abs( nTop - nBot );
1928 if ( nTestClipHeight > nOutHeight )
1938 if ( bHClip || bVClip )
1967 Point aURLStart( nJustPosX, nJustPosY );
1971 case SvxCellOrientation::Standard:
1974 case SvxCellOrientation::TopBottom:
1977 case SvxCellOrientation::BottomUp:
1990 Point aDrawTextPos( nJustPosX, nJustPosY );
1991 if ( bPixelToLogic )
2007 const OUString& aString = aVars.
GetString();
2008 if (!aString.isEmpty())
2014 OUString aShort = aString;
2023 double fVisibleRatio = 1.0;
2025 sal_Int32 nTextLen = aString.getLength();
2029 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2032 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2033 aShort = aShort.copy(0, nShortLen);
2036 else if (eOutHorJust == SvxCellHorJustify::Right && aAreaParam.
mnLeftClipLength > 0)
2039 if (0.0 < fVisibleRatio && fVisibleRatio < 1.0)
2042 sal_Int32 nShortLen = fVisibleRatio*nTextLen + 1;
2043 aShort = aShort.copy(nTextLen-nShortLen);
2047 double fOffset = fTextWidth - fShortWidth;
2048 aDrawTextPos.Move(fOffset, 0);
2055 if (!bPaint && rAddress.
Col() == nX)
2059 aRect += aDrawTextPos;
2065 size_t nLen = aShort.getLength();
2066 if (aDX.size() < nLen)
2067 aDX.resize(nLen, 0);
2075 for (
size_t i = 0;
i < nLen; ++
i)
2076 aDX[
i] = static_cast<sal_Int32>(aDX[
i] / fMul + 0.5);
2089 if ( bHClip || bVClip )
2099 if (bPaint && bHasURL)
2120 pEngine->SetUpdateMode(
false );
2125 nCtrl |= EEControlBits::ONLINESPELLING;
2132 pEngine->SetControlWord( nCtrl );
2179 for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
2181 std::vector<sal_Int32> aPortions;
2184 sal_Int32 nStart = 0;
2185 for (
const sal_Int32 nEnd : aPortions )
2194 nWestern = ( nWestern * nPercent ) / 100;
2195 nCJK = ( nCJK * nPercent ) / 100;
2196 nCTL = ( nCTL * nPercent ) / 100;
2224 double nRealOrient =
toRadians(nAttrRotate);
2225 double nAbsCos = fabs( cos( nRealOrient ) );
2226 double nAbsSin = fabs( sin( nRealOrient ) );
2228 return static_cast<tools::Long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin );
2230 return static_cast<tools::Long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin );
2252 if ( nScaleSize <= rAlignRect.
GetHeight() )
2255 bool bSwap = ( nOrient == SvxCellOrientation::TopBottom || nOrient == SvxCellOrientation::BottomUp );
2257 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2260 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2264 sal_uInt16 nShrinkAgain = 0;
2269 rEngineHeight =
lcl_GetEditSize( rEngine,
false, bSwap, nAttrRotate );
2270 nNewSize = bPixelToLogic ?
2279 rNeededPixel = nPixelWidth + nLeftM + nRightM;
2281 else if ( rLeftClip || rRightClip )
2286 tools::Long nScaleSize = rNeededPixel - nLeftM - nRightM;
2288 if ( nScaleSize <= nAvailable )
2291 tools::Long nScale = ( nAvailable * 100 ) / nScaleSize;
2298 sal_uInt16 nShrinkAgain = 0;
2304 nNewSize = bPixelToLogic ?
2308 if ( nNewSize <= nAvailable )
2309 rLeftClip = rRightClip =
false;
2312 rNeededPixel = nNewSize + nLeftM + nRightM;
2313 rEngineHeight =
lcl_GetEditSize( rEngine,
false,
false, nAttrRotate );
2319 meHorJustContext( meHorJustAttr ),
2320 meHorJustResult( meHorJustAttr ),
2324 meOrient( pPattern->GetCellOrientation(pCondSet) ),
2326 mnX(0),
mnCellX(0), mnCellY(0),
2327 mnPosX(0), mnPosY(0), mnInitPosX(0),
2329 mbCellIsValue(bCellIsValue),
2330 mbAsianVertical(false),
2331 mbPixelToLogic(false),
2332 mbHyphenatorSet(false),
2335 mpCondSet(pCondSet),
2336 mpPreviewFontSet(nullptr),
2337 mpOldPattern(nullptr),
2338 mpOldCondSet(nullptr),
2339 mpOldPreviewFontSet(nullptr),
2340 mpThisRowInfo(nullptr),
2341 mpMisspellRanges(nullptr)
2345 const ScDocument* pDoc,
bool bShowNullValues,
bool bShowFormulas,
bool bSyntaxMode,
bool bUseStyleColor,
bool bForceAutoColor,
bool& rWrapFields)
2352 mpEngine->SetTextCurrentDefaults(*pData);
2354 if ( mbBreak && !mbAsianVertical && pData->
HasField() )
2364 OSL_FAIL(
"pData == 0");
2370 sal_uInt32 nFormat =
mpPattern->GetNumberFormat(
2373 const Color* pColor;
2375 nFormat,aString, &pColor,
2381 mpEngine->SetTextCurrentDefaults(aString);
2382 if ( pColor && !bSyntaxMode && !( bUseStyleColor && bForceAutoColor ) )
2386 if (mpMisspellRanges)
2387 mpEngine->SetAllMisspellRanges(*mpMisspellRanges);
2397 if (
mpPattern == mpOldPattern && mpCondSet == mpOldCondSet && mpPreviewFontSet == mpOldPreviewFontSet )
2401 bool bCellContrast = bUseStyleColor &&
2404 auto pSet = std::make_unique<SfxItemSet>( mpEngine->GetEmptyItemSet() );
2405 mpPattern->FillEditItemSet( pSet.get(), mpCondSet );
2406 if ( mpPreviewFontSet )
2409 if ( mpPreviewFontSet->GetItemState(
ATTR_FONT,
true, &pItem ) == SfxItemState::SET )
2414 if ( mpPreviewFontSet->GetItemState(
ATTR_CJK_FONT,
true, &pItem ) == SfxItemState::SET )
2419 if ( mpPreviewFontSet->GetItemState(
ATTR_CTL_FONT,
true, &pItem ) == SfxItemState::SET )
2426 mpEngine->SetDefaults( std::move(pSet) );
2428 mpOldCondSet = mpCondSet;
2429 mpOldPreviewFontSet = mpPreviewFontSet;
2432 if (meOrient == SvxCellOrientation::Stacked)
2433 nControl |= EEControlBits::ONECHARPERLINE;
2436 mpEngine->SetControlWord( nControl );
2438 if ( !mbHyphenatorSet && bParaHyphenate )
2442 mpEngine->SetHyphenator( xXHyphenator );
2443 mbHyphenatorSet =
true;
2447 if ( bUseStyleColor && ( aBackCol.
IsTransparent() || bCellContrast ) )
2448 aBackCol = nConfBackColor;
2449 mpEngine->SetBackgroundColor( aBackCol );
2456 sal_uInt16 nIndent = 0;
2457 if (meHorJustAttr == SvxCellHorJustify::Left || meHorJustAttr == SvxCellHorJustify::Right)
2464 if(meHorJustAttr == SvxCellHorJustify::Right)
2475 calcMargins(nTopM, nLeftM, nBottomM, nRightM, nPPTX, nPPTY);
2477 if (isVerticallyOriented())
2488 if (mbAsianVertical)
2501 if (!mbBreak || meOrient == SvxCellOrientation::Stacked || mbAsianVertical)
2506 if (isVerticallyOriented())
2509 nEngineWidth = nEngineHeight;
2510 nEngineHeight = nTemp;
2513 if (meOrient == SvxCellOrientation::Stacked)
2514 nEngineWidth = nEngineWidth * 11 / 10;
2516 rWidth = nEngineWidth;
2517 rHeight = nEngineHeight;
2522 return (mbBreak || (meOrient == SvxCellOrientation::Stacked) || mbAsianVertical);
2530 return maCell.mpFormula->IsHyperLinkCell();
2535 return (meOrient == SvxCellOrientation::TopBottom || meOrient == SvxCellOrientation::BottomUp);
2541 OSL_ENSURE(isVerticallyOriented(),
"Use this only for vertically oriented cell!");
2553 rLogicStart.AdjustY(nTopM );
2555 switch (meHorJustResult)
2557 case SvxCellHorJustify::Center:
2558 rLogicStart.AdjustX((nCellWidth - nEngineWidth) / 2 );
2560 case SvxCellHorJustify::Right:
2561 rLogicStart.AdjustX(nCellWidth - nEngineWidth );
2570 if (isVerticallyOriented() || mbAsianVertical)
2575 case SvxCellVerJustify::Top:
2576 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2577 SvxAdjust::Left : SvxAdjust::Right;
2579 case SvxCellVerJustify::Center:
2580 eSvxAdjust = SvxAdjust::Center;
2582 case SvxCellVerJustify::Bottom:
2583 case SvxCellVerJustify::Standard:
2584 eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ?
2585 SvxAdjust::Right : SvxAdjust::Left;
2587 case SvxCellVerJustify::Block:
2588 eSvxAdjust = SvxAdjust::Block;
2595 if (meHorJustResult == SvxCellHorJustify::Block)
2605 if (meOrient == SvxCellOrientation::Stacked)
2606 eSvxAdjust = SvxAdjust::Center;
2609 if (meOrient == SvxCellOrientation::Standard)
2610 switch (meHorJustResult)
2612 case SvxCellHorJustify::Repeat:
2613 case SvxCellHorJustify::Standard:
2614 SAL_WARN(
"sc.ui",
"meHorJustResult does not match getAlignmentFromContext()");
2616 case SvxCellHorJustify::Left:
2617 eSvxAdjust = SvxAdjust::Left;
2619 case SvxCellHorJustify::Center:
2620 eSvxAdjust = SvxAdjust::Center;
2622 case SvxCellHorJustify::Right:
2623 eSvxAdjust = SvxAdjust::Right;
2625 case SvxCellHorJustify::Block:
2626 eSvxAdjust = SvxAdjust::Block;
2632 case SvxCellVerJustify::Top:
2633 eSvxAdjust = SvxAdjust::Right;
2635 case SvxCellVerJustify::Center:
2636 eSvxAdjust = SvxAdjust::Center;
2638 case SvxCellVerJustify::Bottom:
2639 case SvxCellVerJustify::Standard:
2640 eSvxAdjust = SvxAdjust::Left;
2642 case SvxCellVerJustify::Block:
2643 eSvxAdjust = SvxAdjust::Block;
2650 if (mbAsianVertical)
2653 if (meHorJustResult == SvxCellHorJustify::Block)
2659 if (meVerJust == SvxCellVerJustify::Block)
2664 mpEngine->SetVertical(mbAsianVertical);
2672 const_cast<EditTextObject*
>(pData)->SetVertical(mbAsianVertical);
2678 if (meHorJustResult == SvxCellHorJustify::Right || meHorJustResult == SvxCellHorJustify::Center)
2680 SvxAdjust eEditAdjust = (meHorJustResult == SvxCellHorJustify::Center) ?
2681 SvxAdjust::Center : SvxAdjust::Right;
2695 bool bHasURL = pPDFData && isHyperlinkCell();
2700 tools::Long nURLHeight = mpEngine->GetTextHeight();
2703 Size aPaper = mpEngine->GetPaperSize();
2704 if ( mbAsianVertical )
2705 nURLHeight = aPaper.
Height();
2707 nURLWidth = aPaper.
Width();
2709 if (isVerticallyOriented())
2710 std::swap( nURLWidth, nURLHeight );
2711 else if (mbAsianVertical)
2712 aURLStart.AdjustX( -nURLWidth );
2732 bool bVClip =
false;
2753 :mbMetaFile(bMetaFile)
2755 if (!(bClip || bSimClip))
2802 rNeededPixel = nEngineWidth;
2804 rNeededPixel += nAddWidthPixels;
2806 return nEngineWidth;
2811 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
2823 rParam.
meOrient = SvxCellOrientation::Standard;
2824 nAttrRotate = 0_deg100;
2849 if ( nXForPos <
nX1 )
2855 if ( nArrYForPos < 1 )
2865 Size aPaperSize( 1000000, 1000000 );
2872 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2900 rParam.
meVerJust = SvxCellVerJustify::Top;
2907 bool bWrapFields =
false;
2927 nNeededPixel += nLeftM + nRightM;
2929 if (!rParam.
mbBreak || bShrink)
2933 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
2934 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
2939 nLeftM, nTopM, nRightM, nBottomM,
true,
2941 nEngineWidth, nEngineHeight, nNeededPixel,
2949 tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
2951 if ( nAvailable >= 2 * nFormatted )
2960 if ( nRepeatSize > 0 )
2962 tools::Long nRepeatCount = nAvailable / nRepeatSize;
2963 if ( nRepeatCount > 1 )
2965 OUStringBuffer aRepeated = aCellStr;
2966 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
2967 aRepeated.append(aCellStr);
2970 nNeededPixel, (nLeftM + nRightM ) );
2986 if (eOutHorJust != SvxCellHorJustify::Left)
2988 aPaperSize.
setWidth( nNeededPixel + 1 );
2999 tools::Long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
3012 if ( eOutHorJust == SvxCellHorJustify::Right )
3013 nStartX -= nNeededPixel - nCellWidth + nRightM + 1;
3014 else if ( eOutHorJust == SvxCellHorJustify::Center )
3015 nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2;
3026 bool bSimClip =
false;
3032 aCellSize =
Size( nOutWidth, nOutHeight );
3034 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3044 ( rParam.
mpCondSet && SfxItemState::SET ==
3056 if ( nEngineHeight - aCellSize.
Height() > 100 &&
3089 aLogicStart =
Point(nStartX, nStartY);
3099 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
3100 rParam.
meVerJust==SvxCellVerJustify::Standard)
3111 aLogicStart.AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
3113 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
3121 aLogicStart.AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
3128 aLogicStart.AdjustY(nTopM );
3131 aURLStart = aLogicStart;
3139 Point aDocStart = aClip.getRect().TopLeft();
3140 aDocStart -= aLogicStart;
3141 rParam.
mpEngine->
Draw( mpDev, aClip.getRect(), aDocStart, false );
3161 if ( !(nEngineHeight - aCellSize.
Height() > 100 &&
3190 bool bSimClip =
false;
3193 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3203 ( rParam.
mpCondSet && SfxItemState::SET ==
3209 ShowClipMarks( rParam, nEngineHeight, aCellSize, bMerged, aAreaParam);
3220 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3233 if ( nXForPos <
nX1 )
3239 if ( nArrYForPos < 1 )
3249 Size aPaperSize( 1000000, 1000000 );
3256 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3277 bool bWrapFields =
false;
3297 nNeededPixel += nLeftM + nRightM;
3299 if (!rParam.
mbBreak || bShrink)
3303 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3304 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3309 nLeftM, nTopM, nRightM, nBottomM,
false,
3311 nEngineWidth, nEngineHeight, nNeededPixel,
3319 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3321 if ( nAvailable >= 2 * nFormatted )
3330 if ( nRepeatSize > 0 )
3332 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3333 if ( nRepeatCount > 1 )
3335 OUStringBuffer aRepeated = aCellStr;
3336 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3337 aRepeated.append(aCellStr);
3340 nNeededPixel, (nLeftM + nRightM ) );
3358 const tools::Long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
3371 if ( eOutHorJust == SvxCellHorJustify::Right )
3372 nStartX -= nNeededPixel - nCellWidth + nRightM + 1;
3373 else if ( eOutHorJust == SvxCellHorJustify::Center )
3374 nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2;
3386 :
Size( nOutWidth, nOutHeight );
3391 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineHeight, bWrapFields );
3393 Point aLogicStart(nStartX, nStartY);
3396 aURLStart = aLogicStart;
3403 aLogicStart.AdjustY(
3432 aLogicStart.AdjustY(aCellSize.
Height() );
3433 aLogicStart.AdjustY(nTopOffset );
3437 case SvxCellVerJustify::Standard:
3438 case SvxCellVerJustify::Bottom:
3441 case SvxCellVerJustify::Center:
3443 aLogicStart.AdjustY( -(nGap / 2) );
3445 case SvxCellVerJustify::Block:
3446 case SvxCellVerJustify::Top:
3448 aLogicStart.AdjustY( -nGap );
3463 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3476 if ( nXForPos <
nX1 )
3482 if ( nArrYForPos < 1 )
3492 Size aPaperSize( 1000000, 1000000 );
3499 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3520 bool bWrapFields =
false;
3540 nNeededPixel += nLeftM + nRightM;
3542 if (!rParam.
mbBreak || bShrink)
3546 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3547 rParam.
mbCellIsValue || bRepeat || bShrink,
false,
false, aAreaParam );
3552 nLeftM, nTopM, nRightM, nBottomM,
false,
3554 nEngineWidth, nEngineHeight, nNeededPixel,
3562 const tools::Long nFormatted = nNeededPixel - nLeftM - nRightM;
3564 if ( nAvailable >= 2 * nFormatted )
3574 if ( nRepeatSize > 0 )
3576 const tools::Long nRepeatCount = nAvailable / nRepeatSize;
3577 if ( nRepeatCount > 1 )
3579 OUStringBuffer aRepeated = aCellStr;
3580 for (
tools::Long nRepeat = 1; nRepeat < nRepeatCount; nRepeat++ )
3581 aRepeated.append(aCellStr);
3584 nNeededPixel, (nLeftM + nRightM ) );
3602 const tools::Long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
3613 nStartX += aPaperSize.
Height();
3617 if ( eOutHorJust == SvxCellHorJustify::Right )
3618 nStartX -= nNeededPixel - nCellWidth + nRightM + 1;
3619 else if ( eOutHorJust == SvxCellHorJustify::Center )
3620 nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2;
3632 :
Size( nOutWidth, nOutHeight );
3637 const auto pClipRegion =
Clip( rParam, aCellSize, aAreaParam, nEngineHeight, bWrapFields );
3639 Point aLogicStart(nStartX, nStartY);
3642 aURLStart = aLogicStart;
3646 aLogicStart.AdjustX(nEngineWidth );
3667 aLogicStart.AdjustY(nTopOffset );
3671 case SvxCellVerJustify::Standard:
3672 case SvxCellVerJustify::Bottom:
3674 aLogicStart.AdjustY( -nGap );
3676 case SvxCellVerJustify::Center:
3678 aLogicStart.AdjustY( -(nGap / 2) );
3680 case SvxCellVerJustify::Block:
3681 case SvxCellVerJustify::Top:
3700 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3712 rParam.
meOrient = SvxCellOrientation::Standard;
3725 if ( nXForPos <
nX1 )
3731 if ( nArrYForPos < 1 )
3741 Size aPaperSize( 1000000, 1000000 );
3746 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3777 bool bWrapFields =
false;
3797 nNeededPixel += nLeftM + nRightM;
3803 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
3804 true,
false,
false, aAreaParam );
3807 nLeftM, nTopM, nRightM, nBottomM,
true,
3809 nEngineWidth, nEngineHeight, nNeededPixel,
3819 if ( eOutHorJust != SvxCellHorJustify::Left )
3821 aPaperSize.
setWidth( nNeededPixel + 1 );
3832 tools::Long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
3845 if ( eOutHorJust == SvxCellHorJustify::Right )
3846 nStartX -= nNeededPixel - nCellWidth + nRightM + 1;
3847 else if ( eOutHorJust == SvxCellHorJustify::Center )
3848 nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2;
3859 bool bSimClip =
false;
3865 aCellSize =
Size( nOutWidth, nOutHeight );
3867 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
3877 ( rParam.
mpCondSet && SfxItemState::SET ==
3889 if ( nEngineHeight - aCellSize.
Height() > 100 &&
3922 aLogicStart =
Point(nStartX, nStartY);
3924 if (rParam.
meVerJust==SvxCellVerJustify::Bottom ||
3925 rParam.
meVerJust==SvxCellVerJustify::Standard)
3936 aLogicStart.AdjustY(nTopM + aCellSize.
Height() - nEngineHeight );
3938 else if (rParam.
meVerJust==SvxCellVerJustify::Center)
3946 aLogicStart.AdjustY(nTopM + (aCellSize.
Height() - nEngineHeight) / 2 );
3953 aLogicStart.AdjustY(nTopM );
3956 aURLStart = aLogicStart;
3959 aPaperLogic.
setWidth( nEngineWidth );
3968 Point aDocStart = aClip.getRect().TopLeft();
3969 aDocStart -= aLogicStart;
3970 rParam.
mpEngine->
Draw( mpDev, aClip.getRect(), aDocStart, false );
3985 OSL_ASSERT(rParam.
meOrient == SvxCellOrientation::Standard);
3987 OSL_ASSERT(rParam.
meHorJustAttr != SvxCellHorJustify::Repeat);
3991 bool bHidden =
false;
4020 if ( nXForPos <
nX1 )
4026 if ( nArrYForPos < 1 )
4036 Size aPaperSize( 1000000, 1000000 );
4041 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4068 if ( rParam.
meVerJust == SvxCellVerJustify::Standard )
4069 rParam.
meVerJust = SvxCellVerJustify::Top;
4076 bool bWrapFields =
false;
4096 nNeededPixel += nLeftM + nRightM;
4100 *rParam.
mpPattern, sal::static_int_cast<sal_uInt16>(eOutHorJust),
4101 rParam.
mbCellIsValue || bShrink,
false,
false, aAreaParam );
4106 nLeftM, nTopM, nRightM, nBottomM,
false,
4108 nEngineWidth, nEngineHeight, nNeededPixel,
4118 if (eOutHorJust != SvxCellHorJustify::Left)
4120 aPaperSize.
setWidth( nNeededPixel + 1 );
4130 tools::Long nOutWidth = nCellWidth - 1 - nLeftM - nRightM;
4145 bool bSimClip =
false;
4151 aCellSize =
Size( nOutWidth, nOutHeight );
4153 if ( nEngineHeight >= aCellSize.
Height() + aRefOne.
Height() )
4163 ( rParam.
mpCondSet && SfxItemState::SET ==
4175 if ( nEngineHeight - aCellSize.
Height() > 100 &&
4176 ( rParam.
mbBreak || rParam.
meOrient == SvxCellOrientation::Stacked ) &&
4209 aLogicStart =
Point(nStartX, nStartY);
4217 aLogicStart.AdjustX(nAvailWidth - nEngineWidth );
4219 aLogicStart.AdjustX((nAvailWidth - nEngineWidth) / 2 );
4222 aLogicStart.AdjustX(nEngineWidth );
4228 aLogicStart.AdjustY(nTopM );
4230 aURLStart = aLogicStart;
4247 std::unique_ptr<ScFieldEditEngine> pEngine;
4248 bool bHyphenatorSet =
false;
4251 const SfxItemSet* pOldPreviewFontSet =
nullptr;
4263 if ( nX2 < mpDoc->MaxCol() )
4264 nLastContentCol = sal::static_int_cast<
SCCOL>(
4272 if (nArrY==1) nRowPosY =
nScrY;
4274 if ( pThisRowInfo->
bChanged || nArrY==0 )
4277 for (SCCOL nX=0; nX<=
nX2; nX++)
4279 std::unique_ptr< ScPatternAttr > pPreviewPattr;
4280 if (nX==
nX1) nPosX = nInitPosX;
4289 bool bDoCell =
false;
4310 while (nTempX < nLastContentCol &&
IsEmptyCellText( pThisRowInfo, nTempX, nY ))
4333 if ( nCellY == nY && nCellX >=
nX1 && nCellX <=
nX2 &&
4339 aCell = rCellInfo.
maCell;
4357 pPreviewPattr->SetStyleSheet(pPreviewStyle);
4358 pPattern = pPreviewPattr.get();