editeng/inc/editdoc.hxx | 28 ++++++++++- editeng/source/editeng/editdoc.cxx | 14 +++-- editeng/source/editeng/impedit2.cxx | 36 +++++++++------ editeng/source/editeng/impedit3.cxx | 86 ++++++++++++++++++++---------------- editeng/source/items/svxfont.cxx | 10 ++-- svx/source/svdraw/svdotext.cxx | 3 + 6 files changed, 117 insertions(+), 60 deletions(-)
New commits: commit 422b199a0a2250b11cb81c521b8a62c21243cc8a Author: Tomaž Vajngerl <[email protected]> AuthorDate: Tue Sep 27 22:21:37 2022 +0200 Commit: Tomaž Vajngerl <[email protected]> CommitDate: Tue Sep 27 22:21:37 2022 +0200 Check Textbox Fit To Frame Change-Id: I4a02658d06b84cd1222713f12adf14a8194b5b93 diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 25a3dca4b1fc..4aa6ff167b45 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -409,7 +409,29 @@ public: sal_Int32 GetLen() const { return nLen; } void SetLen( sal_Int32 nL ) { nLen = nL; } - Size& GetSize() { return aOutSz; } + void setWidth(tools::Long nWidth) + { + aOutSz.setWidth(nWidth); + } + + void setHeight(tools::Long nHeight) + { + aOutSz.setHeight(nHeight); + } + + void adjustSize(tools::Long nDeltaX, tools::Long nDeltaY) + { + if (nDeltaX != 0) + aOutSz.AdjustWidth(nDeltaX); + if (nDeltaY != 0) + aOutSz.AdjustHeight(nDeltaY); + } + + void SetSize(const Size& rSize) + { + aOutSz = rSize; + } + const Size& GetSize() const { return aOutSz; } void SetKind(PortionKind n) { nKind = n; } @@ -728,7 +750,7 @@ private: rtl::Reference<SfxItemPool> pItemPool; Link<LinkParamNone*,void> aModifyHdl; - SvxFont aDefFont; //faster than ever from the pool!! + SvxFont maDefFont; //faster than ever from the pool!! sal_uInt16 nDefTab; bool bIsVertical:1; TextRotation mnRotation; @@ -755,7 +777,7 @@ public: void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) { aModifyHdl = rLink; } void CreateDefFont( bool bUseStyles ); - const SvxFont& GetDefFont() const { return aDefFont; } + const SvxFont& GetDefFont() const { return maDefFont; } void SetDefTab( sal_uInt16 nTab ) { nDefTab = nTab ? nTab : DEFTAB; } sal_uInt16 GetDefTab() const { return nDefTab; } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index c3777f111783..c8113a601cf7 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1988,7 +1988,11 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == SfxItemState::SET ) ) rFont.SetFillColor( rSet.Get( EE_CHAR_BKGCOLOR ).GetValue() ); if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == SfxItemState::SET ) ) - rFont.SetFontSize( Size( rFont.GetFontSize().Width(), static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich_FontHeight ) ).GetHeight() ) ); + { + auto nHeight = static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich_FontHeight ) ).GetHeight(); + printf ("FONTHEIGHT %ld\n", nHeight); + rFont.SetFontSize(Size(rFont.GetFontSize().Width(), nHeight)); + } if ( bSearchInParent || ( rSet.GetItemState( nWhich_Weight ) == SfxItemState::SET ) ) rFont.SetWeight( static_cast<const SvxWeightItem&>(rSet.Get( nWhich_Weight )).GetWeight() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_UNDERLINE ) == SfxItemState::SET ) ) @@ -2039,14 +2043,14 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S void EditDoc::CreateDefFont( bool bUseStyles ) { SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> aTmpSet( GetItemPool() ); - CreateFont( aDefFont, aTmpSet ); - aDefFont.SetVertical( IsEffectivelyVertical() ); - aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); + CreateFont(maDefFont, aTmpSet); + maDefFont.SetVertical( IsEffectivelyVertical() ); + maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ ) { ContentNode* pNode = GetObject( nNode ); - pNode->GetCharAttribs().GetDefFont() = aDefFont; + pNode->GetCharAttribs().GetDefFont() = maDefFont; if ( bUseStyles ) pNode->CreateDefFont(); } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index ffa8913b0c75..ddde6b26f9c7 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3347,6 +3347,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) { + printf("ImpEditEngine::CalcTextWidth\n"); // If still not formatted and not in the process. // Will be brought in the formatting for AutoPageSize. if ( !IsFormatted() && !IsFormatting() ) @@ -3361,12 +3362,13 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) { nMaxWidth = std::max(nMaxWidth, CalcParaWidth(nPara, bIgnoreExtraSpace)); } - + printf("end ImpEditEngine::CalcTextWidth %d\n", nMaxWidth); return nMaxWidth; } sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace ) { + printf("ImpEditEngine::CalcParaWidth\n"); // If still not formatted and not in the process. // Will be brought in the formatting for AutoPageSize. if ( !IsFormatted() && !IsFormatting() ) @@ -3386,8 +3388,8 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace // On the lines of the paragraph ... - sal_Int32 nLines = pPortion->GetLines().Count(); - for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) + sal_Int32 nNumberOfLines = pPortion->GetLines().Count(); + for (sal_Int32 nLine = 0; nLine < nNumberOfLines; nLine++) { EditLine& rLine = pPortion->GetLines()[nLine]; // nCurWidth = pLine->GetStartPosX(); @@ -3396,7 +3398,8 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace // to StartPosX, also the right indents have to be taken into // account! tools::Long nCurWidth = GetXValue( rLRItem.GetTextLeft() + nSpaceBeforeAndMinLabelWidth ); - if ( nLine == 0 ) + printf ("nCurWidth 1 - %ld\n", nCurWidth); + if (nLine == 0) { tools::Long nFI = GetXValue( rLRItem.GetTextFirstLineOffset() ); nCurWidth -= nFI; @@ -3407,17 +3410,19 @@ sal_uInt32 ImpEditEngine::CalcParaWidth( sal_Int32 nPara, bool bIgnoreExtraSpace nCurWidth = pPortion->GetBulletX(); } } - nCurWidth += GetXValue( rLRItem.GetRight() ); - nCurWidth += CalcLineWidth( pPortion, &rLine, bIgnoreExtraSpace ); - if ( nCurWidth > nMaxWidth ) - { - nMaxWidth = nCurWidth; - } + + nCurWidth += GetXValue(rLRItem.GetRight()); + printf ("nCurWidth 2 - %ld\n", nCurWidth); + nCurWidth += CalcLineWidth(pPortion, &rLine, bIgnoreExtraSpace); + printf ("nCurWidth 3 - %ld\n", nCurWidth); + + nMaxWidth = std::max(nCurWidth, nMaxWidth); } } nMaxWidth++; // widen it, because in CreateLines for >= is wrapped. - return static_cast<sal_uInt32>(nMaxWidth); + printf ("max width: %ld\n", nMaxWidth); + return sal_uInt32(nMaxWidth); } sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace ) @@ -3451,7 +3456,9 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, { if ( ( eJustification != SvxAdjust::Block ) || ( !bIgnoreExtraSpace ) ) { - nWidth += rTextPortion.GetSize().Width(); + auto width = rTextPortion.GetSize().Width(); + printf ("WIDTH: %ld\n", width); + nWidth += width; } else { @@ -3459,8 +3466,11 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont ); aTmpFont.SetPhysFont(*GetRefDevice()); ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage()); - nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), + auto width = aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, rTextPortion.GetLen(), nullptr ).Width(); + + printf ("WIDTH: %ld\n", width); + nWidth += width; } } break; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b33b8c5f1554..5ba70bb9c875 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -676,6 +676,7 @@ tools::Long ImpEditEngine::GetColumnWidth(const Size& rPaperSize) const bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { + printf ("ImpEditEngine::CreateLines\n"); ParaPortion* pParaPortion = GetParaPortions()[nPara]; // sal_Bool: Changes in the height of paragraph Yes / No - sal_True/sal_False @@ -838,7 +839,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) EditLine aSaveLine( *pLine ); SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() ); - std::vector<sal_Int32> aBuf( pNode->Len() ); + std::vector<sal_Int32> aCharPositionArray(pNode->Len()); bool bSameLineAgain = false; // For TextRanger, if the height changes. TabInfo aCurrentTab; @@ -973,6 +974,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } // search for Portion that no longer fits in line... + TextPortion* pPortion = nullptr; sal_Int32 nPortionLen = 0; bool bContinueLastPortion = false; @@ -1014,7 +1016,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) nTmpWidth -= rPrev.GetSize().Width(); nTmpPos = nTmpPos - rPrev.GetLen(); rPrev.SetLen(rPrev.GetLen() + nTmpLen); - rPrev.GetSize().setWidth( -1 ); + rPrev.setWidth(-1); } assert( nTmpPortion < pParaPortion->GetTextPortions().Count() && "No more Portions left!" ); @@ -1043,6 +1045,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { case EE_FEATURE_TAB: { + printf ("EE_FEATURE_TAB\n"); tools::Long nOldTmpWidth = nTmpWidth; // Search for Tab-Pos... @@ -1077,11 +1080,11 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) pPortion->SetKind(PortionKind::TAB); pPortion->SetExtraValue( aCurrentTab.aTabStop.GetFill() ); - pPortion->GetSize().setWidth( aCurrentTab.nTabPos - (nTmpWidth+nStartX) ); + pPortion->setWidth( aCurrentTab.nTabPos - (nTmpWidth+nStartX) ); // Height needed... SeekCursor( pNode, nTmpPos+1, aTmpFont ); - pPortion->GetSize().setHeight( GetRefDevice()->GetTextHeight() ); + pPortion->setHeight( GetRefDevice()->GetTextHeight() ); DBG_ASSERT( pPortion->GetSize().Width() >= 0, "Tab incorrectly calculated!" ); @@ -1093,7 +1096,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { // What now? // make the tab fitting - pPortion->GetSize().setWidth( nXWidth-nOldTmpWidth ); + pPortion->setWidth( nXWidth-nOldTmpWidth ); nTmpWidth = nXWidth-1; bEOL = true; bBrokenLine = true; @@ -1106,8 +1109,9 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) break; case EE_FEATURE_LINEBR: { + printf ("EE_FEATURE_LINEBR\n"); assert( pPortion ); - pPortion->GetSize().setWidth( 0 ); + pPortion->setWidth(0); bEOL = true; bLineBreak = true; pPortion->SetKind( PortionKind::LINEBREAK ); @@ -1119,6 +1123,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) break; case EE_FEATURE_FIELD: { + printf ("EE_FEATURE_FIELD\n"); SeekCursor( pNode, nTmpPos+1, aTmpFont ); aTmpFont.SetPhysFont(*GetRefDevice()); ImplInitDigitMode(*GetRefDevice(), aTmpFont.GetLanguage()); @@ -1126,8 +1131,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) OUString aFieldValue = static_cast<const EditCharAttribField*>(pNextFeature)->GetFieldValue(); // get size, but also DXArray to allow length information in line breaking below std::vector<sal_Int32> aTmpDXArray; - pPortion->GetSize() = aTmpFont.QuickGetTextSize(GetRefDevice(), - aFieldValue, 0, aFieldValue.getLength(), &aTmpDXArray); + pPortion->SetSize(aTmpFont.QuickGetTextSize(GetRefDevice(), + aFieldValue, 0, aFieldValue.getLength(), &aTmpDXArray)); // So no scrolling for oversized fields if ( pPortion->GetSize().Width() > nXWidth ) @@ -1232,27 +1237,35 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if (bContinueLastPortion) { Size aSize( aTmpFont.QuickGetTextSize( GetRefDevice(), - pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, &aBuf )); - pPortion->GetSize().AdjustWidth(aSize.Width() ); + pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray )); + pPortion->adjustSize(aSize.Width(), 0); if (pPortion->GetSize().Height() < aSize.Height()) - pPortion->GetSize().setHeight( aSize.Height() ); + pPortion->setHeight(aSize.Height()); } else { - pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), - pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, &aBuf ); + for (auto n : aCharPositionArray) + printf ("%d ", n); + printf ("\n"); + GetRefDevice()->SetText + auto aSize = aTmpFont.QuickGetTextSize(GetRefDevice(), pParaPortion->GetNode()->GetString(), nTmpPos, nPortionLen, &aCharPositionArray); + pPortion->SetSize(aSize); + printf ("SDDDDD %ld %ld - %ld %ld\n", aSize.Width(), aSize.Height(), aTmpFont.GetFontSize().Width(), aTmpFont.GetFontSize().Height()); } // #i9050# Do Kerning also behind portions... if ( ( aTmpFont.GetFixKerning() > 0 ) && ( ( nTmpPos + nPortionLen ) < pNode->Len() ) ) - pPortion->GetSize().AdjustWidth(aTmpFont.GetFixKerning() ); + pPortion->adjustSize(aTmpFont.GetFixKerning(), 0); if ( IsFixedCellHeight() ) - pPortion->GetSize().setHeight( ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) ); + { + printf ("IsFixedCellHeight - true\n"); + pPortion->setHeight( ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) ); + } // The array is generally flattened at the beginning // => Always simply quick inserts. size_t nPos = nTmpPos - pLine->GetStart(); EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray(); - rArray.insert( rArray.begin() + nPos, aBuf.data(), aBuf.data() + nPortionLen); + rArray.insert( rArray.begin() + nPos, aCharPositionArray.data(), aCharPositionArray.data() + nPortionLen); // And now check for Compression: if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() != CharCompressType::NONE ) @@ -1278,7 +1291,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { tools::Long nExtraSpace = pPortion->GetSize().Height()/5; nExtraSpace = GetXValue( nExtraSpace ); - pPortion->GetSize().AdjustWidth(nExtraSpace ); + pPortion->adjustSize(nExtraSpace, 0); nTmpWidth += nExtraSpace; } } @@ -1324,7 +1337,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) aCurrentTab.bValid = false; } TextPortion& rTabPortion = pParaPortion->GetTextPortions()[aCurrentTab.nTabPortion]; - rTabPortion.GetSize().setWidth( aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX ); + rTabPortion.setWidth( aCurrentTab.nTabPos - aCurrentTab.nStartPosX - nW - nStartX ); nTmpWidth = aCurrentTab.nStartPosX + rTabPortion.GetSize().Width() + nWidthAfterTab; } @@ -1576,7 +1589,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { pLine->GetCharPosArray()[ nPosInArray ] = nNewValue; } - rTP.GetSize().AdjustWidth(n ); + rTP.adjustSize(n, 0); } pLine->SetTextWidth( aTextSize.Width() ); @@ -1801,9 +1814,9 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion ) aTmpFont.SetPhysFont(*pRefDev); TextPortion* pDummyPortion = new TextPortion( 0 ); - pDummyPortion->GetSize() = aTmpFont.GetPhysTxtSize( pRefDev ); + pDummyPortion->SetSize(aTmpFont.GetPhysTxtSize(pRefDev)); if ( IsFixedCellHeight() ) - pDummyPortion->GetSize().setHeight( ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) ); + pDummyPortion->setHeight( ImplCalculateFontIndependentLineSpacing( aTmpFont.GetFontHeight() ) ); pParaPortion->GetTextPortions().Append(pDummyPortion); FormatterFontMetric aFormatterMetrics; RecalcFormatterFontMetrics( aFormatterMetrics, aTmpFont ); @@ -2138,7 +2151,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te DBG_ASSERT( rTP.GetKind() == PortionKind::TEXT, "BlankRubber: No TextPortion!" ); DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" ); sal_Int32 nPosInArray = nBreakPos - 1 - pLine->GetStart(); - rTP.GetSize().setWidth( ( nPosInArray && ( rTP.GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ); + rTP.setWidth( ( nPosInArray && ( rTP.GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ); if (o3tl::make_unsigned(nPosInArray) < pLine->GetCharPosArray().size()) { pLine->GetCharPosArray()[ nPosInArray ] = rTP.GetSize().Width(); @@ -2157,7 +2170,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te pHyphPortion->SetLen( nAltDelChar ); if (cAlternateReplChar && !bAltFullLeft) pHyphPortion->SetExtraValue( cAlternateReplChar ); // Correct width of the portion above: - rPrev.GetSize().setWidth( + rPrev.setWidth( pLine->GetCharPosArray()[ nBreakPos-1 - pLine->GetStart() - nAltDelChar ] ); } @@ -2165,8 +2178,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te SvxFont aFont; SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont ); aFont.SetPhysFont(*GetRefDevice()); - pHyphPortion->GetSize().setHeight( GetRefDevice()->GetTextHeight() ); - pHyphPortion->GetSize().setWidth( GetRefDevice()->GetTextWidth( CH_HYPH ) ); + pHyphPortion->SetSize(Size(GetRefDevice()->GetTextHeight(), GetRefDevice()->GetTextWidth(CH_HYPH))); pParaPortion->GetTextPortions().Insert(++nEndPortion, pHyphPortion); } @@ -2251,7 +2263,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, // For the last character the portion must stop behind the blank // => Simplify correction: DBG_ASSERT( ( nPortionStart + rLastPortion.GetLen() ) == ( nLastChar+1 ), "Blank actually not at the end of the portion!?"); - rLastPortion.GetSize().AdjustWidth( -nBlankWidth ); + rLastPortion.adjustSize(-nBlankWidth, 0); nRemainingSpace += nBlankWidth; } pLine->GetCharPosArray()[nLastChar-nFirstChar] -= nBlankWidth; @@ -2288,9 +2300,11 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, TextPortion& rLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; // The width of the portion: - rLastPortion.GetSize().AdjustWidth(nMore4Everyone ); - if ( nSomeExtraSpace ) - rLastPortion.GetSize().AdjustWidth( 1 ); + rLastPortion.adjustSize(nMore4Everyone, 0); + if (nSomeExtraSpace) + { + rLastPortion.adjustSize(1, 0); + } // Correct positions in array sal_Int32 nPortionEnd = nPortionStart + rLastPortion.GetLen(); @@ -2546,7 +2560,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos { // No new GetTextSize, instead use values from the Array: assert( nPos > pCurLine->GetStart() && "SplitTextPortion at the beginning of the line?" ); - pTextPortion->GetSize().setWidth( pCurLine->GetCharPosArray()[ nPos-pCurLine->GetStart()-1 ] ); + pTextPortion->setWidth(pCurLine->GetCharPosArray()[nPos - pCurLine->GetStart() - 1]); if ( pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed ) { @@ -2564,7 +2578,7 @@ sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos } } else - pTextPortion->GetSize().setWidth( -1 ); + pTextPortion->setWidth(-1); return nSplitPortion; } @@ -2702,7 +2716,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta FindPortion( nStartPos, nPortionStart ); TextPortion& rTP = pParaPortion->GetTextPortions()[ nTP ]; rTP.SetLen( rTP.GetLen() + nNewChars ); - rTP.GetSize().setWidth( -1 ); + rTP.setWidth(-1); } } else @@ -2768,7 +2782,7 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nSta TextPortion& rPrev = pParaPortion->GetTextPortions()[nLastPortion - 1]; DBG_ASSERT( rPrev.GetKind() == PortionKind::TEXT, "Portion?!" ); rPrev.SetLen( rPrev.GetLen() + pTP->GetLen() ); - rPrev.GetSize().setWidth( -1 ); + rPrev.setWidth(-1); } pParaPortion->GetTextPortions().Remove( nLastPortion ); } @@ -4743,7 +4757,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, if ( bCompressed && ( n100thPercentFromMax == 10000 ) ) pTextPortion->GetExtraInfos()->nWidthFullCompression = nNewPortionWidth; - pTextPortion->GetSize().setWidth( nNewPortionWidth ); + pTextPortion->setWidth(nNewPortionWidth); if ( pTextPortion->GetExtraInfos() && ( n100thPercentFromMax != 10000 ) ) { @@ -4753,7 +4767,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, nShrink /= 10000; tools::Long nNewWidth = pTextPortion->GetExtraInfos()->nOrgWidth - nShrink; if ( nNewWidth < pTextPortion->GetSize().Width() ) - pTextPortion->GetSize().setWidth( nNewWidth ); + pTextPortion->setWidth(nNewWidth); } } return bCompressed; @@ -4795,7 +4809,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* { pTP = pTP2; pTP->GetExtraInfos()->bCompressed = false; - pTP->GetSize().setWidth( pTP->GetExtraInfos()->nOrgWidth ); + pTP->setWidth(pTP->GetExtraInfos()->nOrgWidth); if ( nCompressPercent ) { sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 65191cab8ed7..f9623936ca54 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -477,9 +477,13 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut ) Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt, const sal_Int32 nIdx, const sal_Int32 nLen, std::vector<sal_Int32>* pDXArray ) const { - if ( !IsCaseMap() && !IsFixKerning() ) - return Size( GetTextArray( pOut, rTxt, pDXArray, nIdx, nLen ), - pOut->GetTextHeight() ); + if (!IsCaseMap() && !IsFixKerning()) + { + printf ("SvxFont TextHeight %ld\n", pOut->GetTextHeight()); + auto nWidth = GetTextArray(pOut, rTxt, pDXArray, nIdx, nLen); + auto nHeight = pOut->GetTextHeight(); + return Size(nWidth, nHeight); + } std::vector<sal_Int32> aDXArray; diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 24223aaee738..c4779866b391 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -199,6 +199,7 @@ SdrTextObj::~SdrTextObj() void SdrTextObj::FitFrameToTextSize() { + printf ("FitFrameToTextSize\n"); ImpJustifyRect(maRect); SdrText* pText = getActiveText(); @@ -866,6 +867,8 @@ std::optional<OutlinerParaObject> SdrTextObj::CreateEditOutlinerParaObject() con void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection) { + printf ("SdrTextObj::ImpSetCharStretching\n"); + OutputDevice* pOut = rOutliner.GetRefDevice(); bool bNoStretching(false);
