summaryrefslogtreecommitdiff
path: root/sw/source/core/text
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/text')
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx75
-rw-r--r--sw/source/core/text/SwGrammarMarkUp.cxx6
-rw-r--r--sw/source/core/text/frmcrsr.cxx16
-rw-r--r--sw/source/core/text/frmform.cxx27
-rw-r--r--sw/source/core/text/frmpaint.cxx6
-rw-r--r--sw/source/core/text/inftxt.cxx33
-rw-r--r--sw/source/core/text/inftxt.hxx10
-rw-r--r--sw/source/core/text/itradj.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx6
-rw-r--r--sw/source/core/text/itrcrsr.cxx60
-rw-r--r--sw/source/core/text/itrform2.cxx117
-rw-r--r--sw/source/core/text/itrpaint.cxx12
-rw-r--r--sw/source/core/text/itrtxt.cxx10
-rw-r--r--sw/source/core/text/itrtxt.hxx8
-rw-r--r--sw/source/core/text/porfld.cxx28
-rw-r--r--sw/source/core/text/porfly.cxx15
-rw-r--r--sw/source/core/text/porfly.hxx3
-rw-r--r--sw/source/core/text/porglue.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx25
-rw-r--r--sw/source/core/text/porlay.hxx10
-rw-r--r--sw/source/core/text/porlin.cxx6
-rw-r--r--sw/source/core/text/porlin.hxx12
-rw-r--r--sw/source/core/text/pormulti.cxx137
-rw-r--r--sw/source/core/text/pormulti.hxx2
-rw-r--r--sw/source/core/text/porrst.cxx8
-rw-r--r--sw/source/core/text/portxt.cxx2
-rw-r--r--sw/source/core/text/possiz.hxx30
-rw-r--r--sw/source/core/text/redlnitr.cxx6
-rw-r--r--sw/source/core/text/redlnitr.hxx2
-rw-r--r--sw/source/core/text/txtdrop.cxx24
-rw-r--r--sw/source/core/text/txtfld.cxx3
-rw-r--r--sw/source/core/text/txtfly.cxx10
-rw-r--r--sw/source/core/text/txtfrm.cxx40
-rw-r--r--sw/source/core/text/txtftn.cxx2
-rw-r--r--sw/source/core/text/txttab.cxx89
-rw-r--r--sw/source/core/text/wrong.cxx16
36 files changed, 526 insertions, 336 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 088f21c00b10..53c07abe8c0f 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -424,7 +424,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUS
++m_nEndStructureElement;
#if OSL_DEBUG_LEVEL > 1
- aStructStack.push_back( static_cast<sal_uInt16>(eType) );
+ aStructStack.push_back( o3tl::narrowing<sal_uInt16>(eType) );
#endif
// Store the id of the current structure element if
@@ -688,9 +688,9 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
if ( bRowSpan )
{
- const SwCellFrame* pThisCell = dynamic_cast<const SwCellFrame*>(pFrame);
- if ( pThisCell )
+ if ( pFrame->IsCellFrame() )
{
+ const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(pFrame);
nVal = pThisCell->GetTabBox()->getRowSpan();
if ( nVal > 1 )
mpPDFExtOutDevData->SetStructureAttributeNumerical( vcl::PDFWriter::RowSpan, nVal );
@@ -1117,7 +1117,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
int nRealLevel = pTextNd->GetAttrOutlineLevel()-1;
nRealLevel = std::min(nRealLevel, 5);
- nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
+ nPDFType = o3tl::narrowing<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
switch(nRealLevel)
{
case 0 :
@@ -1808,7 +1808,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Turn media shapes into Screen annotations.
if (SdrObject* pObject = pFrameFormat->FindRealSdrObject())
{
- SwRect aSnapRect = pObject->GetSnapRect();
+ SwRect aSnapRect(pObject->GetSnapRect());
std::vector<sal_Int32> aScreenPageNums = CalcOutputPageNums(aSnapRect);
if (aScreenPageNums.empty())
continue;
@@ -1969,38 +1969,57 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Goto footnote text:
if ( mrSh.GotoFootnoteText() )
{
- // Link PageNums
- std::vector<sal_Int32> aLinkPageNums = CalcOutputPageNums( aLinkRect );
-
// Destination Rectangle
const SwRect& rDestRect = mrSh.GetCharRect();
-
- const SwPageFrame* pCurrPage =
- static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
-
- // Destination PageNum
const sal_Int32 nDestPageNum = CalcOutputPageNum( rDestRect );
-
- for (sal_Int32 aLinkPageNum : aLinkPageNums)
+ if ( -1 != nDestPageNum )
{
- // Link Export
- tools::Rectangle aRect(SwRectToPDFRect(pCurrPage, aLinkRect.SVRect()));
- const sal_Int32 nLinkId =
- pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
+ const SwPageFrame* pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Destination PageNum
+ tools::Rectangle aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
+ // Back link rectangle calculation
+ const SwPageFrame* fnBodyPage = pCurrPage->getRootFrame()->GetPageByPageNum(nDestPageNum+1);
+ SwRect fnSymbolRect;
+ if (fnBodyPage->IsVertical()){
+ tools::Long fnSymbolTop = fnBodyPage->GetTopMargin() + fnBodyPage->getFrameArea().Top();
+ tools::Long symbolHeight = rDestRect.Top() - fnSymbolTop;
+ fnSymbolRect = SwRect(rDestRect.Pos().X(),fnSymbolTop,rDestRect.Width(),symbolHeight);
+ } else {
+ if (fnBodyPage->IsRightToLeft()){
+ tools::Long fnSymbolRight = fnBodyPage->getFrameArea().Right() - fnBodyPage->GetRightMargin();
+ tools::Long symbolWidth = fnSymbolRight - rDestRect.Right();
+ fnSymbolRect = SwRect(rDestRect.Pos().X(),rDestRect.Pos().Y(),symbolWidth,rDestRect.Height());
+ } else {
+ tools::Long fnSymbolLeft = fnBodyPage->GetLeftMargin() + fnBodyPage->getFrameArea().Left();
+ tools::Long symbolWidth = rDestRect.Left() - fnSymbolLeft;
+ fnSymbolRect = SwRect(fnSymbolLeft,rDestRect.Pos().Y(),symbolWidth,rDestRect.Height());
+ }
+ }
+ tools::Rectangle aFootnoteSymbolRect = SwRectToPDFRect(pCurrPage, fnSymbolRect.SVRect());
+ // Export back link
+ const sal_Int32 nBackLinkId = pPDFExtOutDevData->CreateLink(aFootnoteSymbolRect, nDestPageNum);
+ // Destination Export
+ const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(aRect, nDestPageNum);
+ mrSh.GotoFootnoteAnchor();
+ // Link PageNums
+ sal_Int32 aLinkPageNum = CalcOutputPageNum( aLinkRect );
+ pCurrPage = static_cast<const SwPageFrame*>( mrSh.GetLayout()->Lower() );
+ // Link Export
+ aRect = SwRectToPDFRect(pCurrPage, aLinkRect.SVRect());
+ const sal_Int32 nLinkId = pPDFExtOutDevData->CreateLink(aRect, aLinkPageNum);
+ // Back link destination Export
+ const sal_Int32 nBackDestId = pPDFExtOutDevData->CreateDest(aRect, aLinkPageNum);
// Store link info for tagged pdf output:
const IdMapEntry aLinkEntry( aLinkRect, nLinkId );
s_aLinkIdMap.push_back( aLinkEntry );
- if ( -1 != nDestPageNum )
- {
- aRect = SwRectToPDFRect(pCurrPage, rDestRect.SVRect());
- // Destination Export
- const sal_Int32 nDestId = pPDFExtOutDevData->CreateDest(rDestRect.SVRect(), nDestPageNum);
-
- // Connect Link and Destination:
- pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
- }
+ // Store backlink info for tagged pdf output:
+ const IdMapEntry aBackLinkEntry( aFootnoteSymbolRect, nBackLinkId );
+ s_aLinkIdMap.push_back( aBackLinkEntry );
+ // Connect Links and Destinations:
+ pPDFExtOutDevData->SetLinkDest( nLinkId, nDestId );
+ pPDFExtOutDevData->SetLinkDest( nBackLinkId, nBackDestId );
}
}
}
diff --git a/sw/source/core/text/SwGrammarMarkUp.cxx b/sw/source/core/text/SwGrammarMarkUp.cxx
index 3a007ce055d2..53fd4b13c013 100644
--- a/sw/source/core/text/SwGrammarMarkUp.cxx
+++ b/sw/source/core/text/SwGrammarMarkUp.cxx
@@ -54,9 +54,9 @@ void SwGrammarMarkUp::MoveGrammar( sal_Int32 nPos, sal_Int32 nDiff )
}
}
-SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
+std::unique_ptr<SwGrammarMarkUp> SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
{
- SwGrammarMarkUp* pNew = static_cast<SwGrammarMarkUp*>(SplitList( nSplitPos ));
+ std::unique_ptr<SwGrammarMarkUp> pNew( static_cast<SwGrammarMarkUp*>(SplitList( nSplitPos ).release()) );
if( maSentence.empty() )
return pNew;
auto pIter = std::find_if(maSentence.begin(), maSentence.end(),
@@ -64,7 +64,7 @@ SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
if( pIter != maSentence.begin() )
{
if( !pNew ) {
- pNew = new SwGrammarMarkUp();
+ pNew.reset(new SwGrammarMarkUp());
pNew->SetInvalid( 0, COMPLETE_STRING );
}
pNew->maSentence.insert( pNew->maSentence.begin(), maSentence.begin(), pIter );
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index a4cab82d92b1..9ea484912cff 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -307,10 +307,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
{
if ( pFrame->IsRightToLeft() )
{
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aLine );
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aPortion );
}
}
@@ -327,10 +327,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
pCMS->m_aRealHeight.Y() );
}
}
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aLine );
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aPortion );
}
}
@@ -590,7 +590,7 @@ bool SwTextFrame::GetModelPositionForViewPoint_(SwPosition* pPos, const Point& r
// See comment in AdjustFrame()
SwTwips nMaxY = getFrameArea().Top() + getFramePrintArea().Top() + getFramePrintArea().Height();
aLine.TwipsToLine( rPoint.Y() );
- while( aLine.Y() + aLine.GetLineHeight() > nMaxY )
+ while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) > nMaxY )
{
if( !aLine.Prev() )
break;
@@ -1418,7 +1418,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const
if( nDiff > 0 )
{
nDiff /= nDist;
- rFill.Fill().nParaCnt = static_cast<sal_uInt16>(nDiff + 1);
+ rFill.Fill().nParaCnt = o3tl::narrowing<sal_uInt16>(nDiff + 1);
rFill.nLineWidth = 0;
rFill.bInner = false;
rFill.bEmpty = true;
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 0304661e8438..82f2a8dcd893 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -517,9 +517,6 @@ void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit )
css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips CurrentPos )
{
- css::uno::Sequence< css::style::TabStop > tabs(1);
- css::style::TabStop ts;
-
SwTextFormatInfo aInf( getRootFrame()->GetCurrShell()->GetOut(), this );
SwTextFormatter aLine( this, &aInf );
SwTextCursor TextCursor( this, &aInf );
@@ -533,10 +530,11 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
if( !pTS )
{
- return css::uno::Sequence< css::style::TabStop >();
+ return {};
}
// copy tab stop information into a Sequence, which only contains one element.
+ css::style::TabStop ts;
ts.Position = pTS->GetTabPos();
ts.DecimalChar = pTS->GetDecimal();
ts.FillChar = pTS->GetFill();
@@ -550,8 +548,7 @@ css::uno::Sequence< css::style::TabStop > SwTextFrame::GetTabStopInfo( SwTwips C
default: break; // prevent warning
}
- tabs[0] = ts;
- return tabs;
+ return { ts };
}
// AdjustFollow expects the following situation:
@@ -987,7 +984,7 @@ bool SwTextFrame::CalcPreps()
return bRet;
}
-// We rewire the footnotes and the character bound objects
+// Move the as-character objects - footnotes must be moved by RemoveFootnote!
void SwTextFrame::ChangeOffset( SwTextFrame* pFrame, TextFrameIndex nNew )
{
if( pFrame->GetOffset() < nNew )
@@ -1082,6 +1079,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// need to create a Follow.
// We also need to do this if the whole mass of text remains in the Master,
// because a hard line break could necessitate another line (without text mass)!
+ TextFrameIndex const nOld(nEnd);
nEnd = rLine.GetEnd();
if( GetFollow() )
{
@@ -1107,6 +1105,13 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// for the paragraph mark.
nNew |= 1;
}
+ // move footnotes if the follow is kept - if RemoveFootnote() is
+ // called in next format iteration, it will be with the *new*
+ // offset so no effect!
+ if (nNew && nOld < nEnd)
+ {
+ RemoveFootnote(nOld, nEnd - nOld);
+ }
ChangeOffset( GetFollow(), nEnd );
GetFollow()->ManipOfst( nEnd );
}
@@ -1177,8 +1182,8 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
const SwLineLayout *pOldCur = rLine.GetCurr();
const TextFrameIndex nOldLen = pOldCur->GetLen();
- const sal_uInt16 nOldAscent = pOldCur->GetAscent();
- const sal_uInt16 nOldHeight = pOldCur->Height();
+ const sal_uInt32 nOldAscent = pOldCur->GetAscent();
+ const sal_uInt32 nOldHeight = pOldCur->Height();
const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
const bool bOldHyph = pOldCur->IsEndHyph();
SwTwips nOldTop = 0;
@@ -1200,7 +1205,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
bOldHyph == pNew->IsEndHyph();
if ( bUnChg && !bPrev )
{
- const tools::Long nWidthDiff = nOldWidth > pNew->Width()
+ const tools::Long nWidthDiff = nOldWidth > o3tl::narrowing<SwTwips>(pNew->Width())
? nOldWidth - pNew->Width()
: pNew->Width() - nOldWidth;
@@ -1254,7 +1259,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
rLine.SetUnclipped( false );
}
}
- SwTwips nRght = std::max( nOldWidth, pNew->Width() +
+ SwTwips nRght = std::max( nOldWidth, o3tl::narrowing<SwTwips>(pNew->Width()) +
pNew->GetHangingMargin() );
SwViewShell *pSh = getRootFrame()->GetCurrShell();
const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : nullptr;
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 6f1d1fc12ad1..76630fc573f6 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -305,6 +305,8 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
if( getFrameArea().Top() > rRect.Bottom() || getFrameArea().Bottom() < rRect.Top() )
return;
+ PaintOutlineContentVisibilityButton();
+
SwDoc const& rDoc(GetDoc());
const IDocumentRedlineAccess& rIDRA = rDoc.getIDocumentRedlineAccess();
const SwLineNumberInfo &rLineInf = rDoc.GetLineNumberInfo();
@@ -354,7 +356,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
bool bNoDummy = !aLine.GetNext(); // Only one empty line!
- while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
+ while( aLine.Y() + o3tl::narrowing<SwTwips>(aLine.GetLineHeight()) <= rRect.Top() )
{
if( !aLine.GetCurr()->IsDummy() &&
( rLineInf.IsCountBlankLines() ||
@@ -396,7 +398,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
bool bNum = bLineNum && ( aExtra.HasNumber() || aExtra.HasDivider() );
if( bRedInMargin || bNum )
{
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
if ( bRedInMargin )
{
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index bb63a36ae157..f43f811bd744 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -426,7 +426,7 @@ void SwTextSizeInfo::GetTextSize( const SwScriptInfo* pSI, const TextFrameIndex
aDrawInf.SetSnapToGrid( SnapToGrid() );
aDrawInf.SetKanaComp( nComp );
SwPosSize aSize( m_pFnt->GetTextSize_( aDrawInf ) );
- nMaxSizeDiff = static_cast<sal_uInt16>(aDrawInf.GetKanaDiff());
+ nMaxSizeDiff = o3tl::narrowing<sal_uInt16>(aDrawInf.GetKanaDiff());
nMinSize = aSize.Width();
}
@@ -955,7 +955,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rTextPaintInfo, const SwLine
Point aTmpPos( nX, nY );
rNonConstTextPaintInfo.SetPos( aTmpPos );
sal_uInt16 nOldWidth = rPor.Width();
- const_cast<SwLinePortion&>(rPor).Width( static_cast<sal_uInt16>(aFontSize.Width()) );
+ const_cast<SwLinePortion&>(rPor).Width( o3tl::narrowing<sal_uInt16>(aFontSize.Width()) );
rTextPaintInfo.DrawText( aTmp, rPor );
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
rNonConstTextPaintInfo.SetFont( const_cast<SwFont*>(pOldFnt) );
@@ -1023,13 +1023,13 @@ void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
{
aRect.Pos().AdjustY(20 - GetAscent() );
aRect.Pos().AdjustX(20 );
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
cChar = CHAR_LEFT_ARROW;
}
else
{
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > o3tl::narrowing<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
aRect.Pos().AdjustY( -(aRect.Height() + 20) );
aRect.Pos().AdjustX( -(aRect.Width() + 20) );
@@ -1089,8 +1089,7 @@ void SwTextPaintInfo::DrawPostIts( bool bScript ) const
if ( GetTextFrame()->IsVertical() )
GetTextFrame()->SwitchHorizontalToVertical( aTmpRect );
- const tools::Rectangle aRect( aTmpRect.SVRect() );
- SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
+ SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aTmpRect, bScript );
}
@@ -1125,7 +1124,7 @@ void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool
m_pOut->Pop();
}
-void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
+void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pColor ) const
{
OSL_ENSURE( OnWin(), "SwTextPaintInfo::DrawBackground: printer pollution ?" );
@@ -1145,7 +1144,11 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
}
else
{
- pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ if ( pColor )
+ pOut->SetFillColor( *pColor );
+ else
+ pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+
pOut->SetLineColor();
}
@@ -1313,7 +1316,7 @@ void SwTextPaintInfo::DrawBorder( const SwLinePortion &rPor ) const
}
void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
- PortionType nWhich ) const
+ PortionType nWhich, const Color *pColor ) const
{
if( !OnWin() || IsMulti() )
return;
@@ -1366,7 +1369,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
}
}
if ( bDraw )
- DrawBackground( rPor );
+ DrawBackground( rPor, pColor );
}
static void lcl_InitHyphValues( PropertyValues &rVals,
@@ -1758,7 +1761,9 @@ SwTwips SwTextFormatInfo::GetLineWidth()
const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
DocumentSettingId::TAB_OVER_MARGIN);
- if (!bTabOverMargin)
+ const bool bTabOverSpacing = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
+ DocumentSettingId::TAB_OVER_SPACING);
+ if (!bTabOverMargin && !bTabOverSpacing)
return nLineWidth;
SwTabPortion* pLastTab = GetLastTab();
@@ -1789,6 +1794,12 @@ SwTwips SwTextFormatInfo::GetLineWidth()
// text frame area to the right (RR above, but not LL).
nLineWidth = nTextFrameWidth - X();
+ if (!bTabOverMargin) // thus bTabOverSpacing only
+ {
+ // right, center, decimal can back-fill all the available space - same as TabOverMargin
+ if (pLastTab->GetWhichPor() == PortionType::TabLeft)
+ nLineWidth = nTextFrameWidth - pLastTab->GetTabPos();
+ }
return nLineWidth;
}
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index bb245d5b031f..4d5bb0651163 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <memory>
+#include <optional>
#include <com/sun/star/beans/PropertyValues.hpp>
#include <map>
@@ -74,8 +75,7 @@ class SwLineInfo
~SwLineInfo();
public:
// #i24363# tab stops relative to indent - returns the tab stop following nSearchPos or NULL
- const SvxTabStop *GetTabStop( const SwTwips nSearchPos,
- const SwTwips nRight ) const;
+ const SvxTabStop* GetTabStop(const SwTwips nSearchPos, SwTwips& nRight) const;
const SvxLineSpacingItem *GetLineSpacing() const { return m_pSpace; }
sal_uInt16 GetDefTabStop() const { return m_nDefTabStop; }
void SetDefTabStop( sal_uInt16 nNew ) const
@@ -187,7 +187,7 @@ public:
// GetMultiAttr returns the text attribute of the multiportion,
// if rPos is inside any multi-line part.
// rPos will set to the end of the multi-line part.
- std::unique_ptr<SwMultiCreator> GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;
+ std::optional<SwMultiCreator> GetMultiCreator(TextFrameIndex &rPos, SwMultiPortion const* pM) const;
bool OnWin() const { return m_bOnWin; }
void SetOnWin( const bool bNew ) { m_bOnWin = bNew; }
@@ -399,8 +399,8 @@ public:
void DrawLineBreak( const SwLinePortion &rPor ) const;
void DrawRedArrow( const SwLinePortion &rPor ) const;
void DrawPostIts( bool bScript ) const;
- void DrawBackground( const SwLinePortion &rPor ) const;
- void DrawViewOpt( const SwLinePortion &rPor, PortionType nWhich ) const;
+ void DrawBackground( const SwLinePortion &rPor, const Color *pColor=nullptr ) const;
+ void DrawViewOpt( const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr ) const;
void DrawBackBrush( const SwLinePortion &rPor ) const;
/**
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index a5944e49e357..8e7514cf9be3 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -488,7 +488,7 @@ SwTwips SwTextAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
else
nCompress = 10000 - nCompress;
- ( pCurrent->GetKanaComp() )[ nKanaIdx ] = static_cast<sal_uInt16>(nCompress);
+ ( pCurrent->GetKanaComp() )[ nKanaIdx ] = o3tl::narrowing<sal_uInt16>(nCompress);
nKanaDiffSum = 0;
}
@@ -524,7 +524,7 @@ SwTwips SwTextAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
}
else if( pPos->InGlueGrp() && pPos->InFixMargGrp() )
{
- pPos->Width( static_cast<sal_uInt16>(pPos->Width() - nDecompress) );
+ pPos->Width( o3tl::narrowing<sal_uInt16>(pPos->Width() - nDecompress) );
if ( pPos->InTabGrp() )
// set fix width to width
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index a0ae8073c27b..9571324f8dbe 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1009,7 +1009,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
SwViewShell const * pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
OutputDevice* pOut = nullptr;
if( pSh )
- pOut = pSh->GetWin();
+ pOut = pSh->GetWin()->GetOutDev();
if( !pOut )
pOut = Application::GetDefaultDevice();
@@ -1432,7 +1432,7 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
SwTextIter aLine(this, &aInf);
aLine.CharToLine( nStart );
pOut->SetMapMode( aOldMap );
- return static_cast<sal_uInt16>( nWidth ?
+ return o3tl::narrowing<sal_uInt16>( nWidth ?
( ( 100 * aLine.GetCurr()->Height() ) / nWidth ) : 0 );
}
// no frame or no paragraph, we take the height of the character
@@ -1442,7 +1442,7 @@ sal_uInt16 SwTextFrame::GetScalingOfSelectedText(
pOut->SetMapMode( aOldMap );
SwDrawTextInfo aDrawInf(pSh, *pOut, GetText(), sal_Int32(nStart), 1);
- return static_cast<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
+ return o3tl::narrowing<sal_uInt16>( nWidth ? ((100 * aIter.GetFnt()->GetTextSize_( aDrawInf ).Height()) / nWidth ) : 0 );
}
SwTwips SwTextNode::GetWidthOfLeadingTabs() const
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index f7c6380cb3bb..2974826154bb 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -142,7 +142,7 @@ namespace {
nListLevel = MAXLEVEL - 1;
const SwNumFormat& rNumFormat =
- rTextNode.GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) );
+ rTextNode.GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
if ( rNumFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
bRet = true;
@@ -428,7 +428,7 @@ void SwTextCursor::GetEndCharRect(SwRect* pOrig, const TextFrameIndex nOfst,
tools::Long nLast = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
sal_uInt16 nPorHeight = nTmpHeight;
sal_uInt16 nPorAscent = nTmpAscent;
@@ -479,7 +479,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
SwTextSizeInfo aInf( GetInfo(), &aText, m_nStart );
if( GetPropFont() )
aInf.GetFont()->SetProportion( GetPropFont() );
- sal_uInt16 nTmpAscent, nTmpHeight; // Line height
+ sal_uInt32 nTmpAscent, nTmpHeight; // Line height
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
const Size aCharSize( 1, nTmpHeight );
const Point aCharPos;
@@ -505,8 +505,8 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
}
else
{
- sal_uInt16 nPorHeight = nTmpHeight;
- sal_uInt16 nPorAscent = nTmpAscent;
+ sal_uInt32 nPorHeight = nTmpHeight;
+ sal_uInt32 nPorAscent = nTmpAscent;
SwTwips nX = 0;
SwTwips nTmpFirst = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
@@ -676,26 +676,26 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
if( pCMS && pCMS->m_b2Lines )
{
- const bool bRecursion (pCMS->m_p2Lines);
+ const bool bRecursion (pCMS->m_x2Lines);
if ( !bRecursion )
{
- pCMS->m_p2Lines.reset(new Sw2LinesPos);
- pCMS->m_p2Lines->aLine = SwRect(aCharPos, aCharSize);
+ pCMS->m_x2Lines = Sw2LinesPos();
+ pCMS->m_x2Lines->aLine = SwRect(aCharPos, aCharSize);
}
if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
{
if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_270;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_270;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_90;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_90;
}
else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::TWOLINE;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::TWOLINE;
else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::BIDI;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::BIDI;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::RUBY;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::RUBY;
SwTwips nTmpWidth = pPor->Width();
if( nSpaceAdd )
@@ -705,9 +705,9 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
Size( nTmpWidth, pPor->Height() ) );
if ( ! bRecursion )
- pCMS->m_p2Lines->aPortion = aRect;
+ pCMS->m_x2Lines->aPortion = aRect;
else
- pCMS->m_p2Lines->aPortion2 = aRect;
+ pCMS->m_x2Lines->aPortion2 = aRect;
}
// In a multi-portion we use GetCharRect()-function
@@ -1051,7 +1051,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
nPorHeight = nPorAscent;
pOrig->Height( nPorHeight +
static_cast<SwDropPortion*>(pPor)->GetDropDescent() );
- if( nTmpHeight < pOrig->Height() )
+ if( o3tl::narrowing<SwTwips>(nTmpHeight) < pOrig->Height() )
{
nTmpAscent = nPorAscent;
nTmpHeight = sal_uInt16( pOrig->Height() );
@@ -1215,15 +1215,17 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
pOrig->Pos().AdjustX(aCharPos.X() );
pOrig->Pos().AdjustY(aCharPos.Y() );
- if( pCMS && pCMS->m_b2Lines && pCMS->m_p2Lines )
+ if( pCMS && pCMS->m_b2Lines && pCMS->m_x2Lines )
{
- pCMS->m_p2Lines->aLine.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
}
- const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN);
+ const IDocumentSettingAccess& rIDSA = GetTextFrame()->GetDoc().getIDocumentSettingAccess();
+ const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN)
+ || rIDSA.get(DocumentSettingId::TAB_OVER_SPACING);
// Make sure the cursor respects the right margin, unless in compat mode, where the tab size has priority over the margin size.
if( pOrig->Left() > nTmpRight && !bTabOverMargin)
pOrig->Pos().setX( nTmpRight );
@@ -1264,7 +1266,7 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
* Determines if SwTextCursor::GetModelPositionForViewPoint() should consider the next portion when calculating the
* doc model position from a Point.
*/
-static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
+static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt32 nWidth30, sal_uInt16 nX)
{
if (!pPor->GetNextPortion() || pPor->IsBreakPortion())
{
@@ -1321,7 +1323,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// Until here everything in document coordinates.
x -= nLeftMargin;
- sal_uInt16 nX = sal_uInt16( x );
+ sal_uInt32 nX = sal_uInt16( x );
// If there are attribute changes in the line, search for the paragraph,
// in which nX is situated.
@@ -1340,7 +1342,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// nWidth is the width of the line, or the width of
// the paragraph with the font change, in which nX is situated.
- sal_uInt16 nWidth = pPor->Width();
+ sal_uInt32 nWidth = pPor->Width();
if ( m_pCurr->IsSpaceAdd() || pKanaComp )
{
if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -1370,7 +1372,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
}
- sal_uInt16 nWidth30;
+ sal_uInt32 nWidth30;
if ( pPor->IsPostItsPortion() )
nWidth30 = 0;
else
@@ -1625,7 +1627,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
nTmpY = pPor->Height() - nTmpY;
if( nTmpY < 0 )
nTmpY = 0;
- nX = static_cast<sal_uInt16>(nTmpY);
+ nX = o3tl::narrowing<sal_uInt16>(nTmpY);
}
if( static_cast<SwMultiPortion*>(pPor)->HasBrackets() )
@@ -1689,12 +1691,12 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
pCurrPart = pCurrPart->GetFollow();
}
- nX = std::max(0, nX - nSumBorderWidth);
+ nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - nSumBorderWidth);
}
// Shift the offset with the left border width
else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
{
- nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
+ nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - GetInfo().GetFont()->GetLeftBorderSpace());
}
aDrawInf.SetOffset( nX );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index d35159f12d84..8e5a2b403e42 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -54,8 +54,15 @@
#include <IDocumentSettingAccess.hxx>
#include <IMark.hxx>
#include <IDocumentMarkAccess.hxx>
-
-#include <vector>
+#include <comphelper/processfactory.hxx>
+#include <docsh.hxx>
+#include <unocrsrhelper.hxx>
+#include <com/sun/star/rdf/Statement.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/URIs.hpp>
+#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/rdf/XLiteral.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
using namespace ::com::sun::star;
@@ -235,7 +242,7 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf )
// line width is adjusted, so that pPor does not fit to current
// line anymore
- rInf.Width( static_cast<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
+ rInf.Width( o3tl::narrowing<sal_uInt16>(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
rInf.SetLen( pPor->GetLen() );
rInf.SetFull( false );
if( pFly )
@@ -424,7 +431,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
{
SwFontScript nNxtActual = rInf.GetFont()->GetActual();
SwFontScript nLstActual = nNxtActual;
- sal_uInt16 nLstHeight = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight());
+ sal_uInt16 nLstHeight = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight());
bool bAllowBehind = false;
const CharClass& rCC = GetAppCharClass();
@@ -467,7 +474,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
if ( pTmpFnt )
{
nLstActual = pTmpFnt->GetActual();
- nLstHeight = static_cast<sal_uInt16>(pTmpFnt->GetHeight());
+ nLstHeight = o3tl::narrowing<sal_uInt16>(pTmpFnt->GetHeight());
}
}
}
@@ -528,7 +535,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
const SwTwips nRestWidth = rInf.Width() - rInf.X();
if ( nKernWidth <= nRestWidth )
- pGridKernPortion->Width( static_cast<sal_uInt16>(nKernWidth) );
+ pGridKernPortion->Width( o3tl::narrowing<sal_uInt16>(nKernWidth) );
}
if ( pGridKernPortion != pPor )
@@ -615,7 +622,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
(m_pScriptInfo->ScriptType(nTmp - TextFrameIndex(1)) == css::i18n::ScriptType::ASIAN ||
m_pScriptInfo->ScriptType(nTmp) == css::i18n::ScriptType::ASIAN) )
{
- const sal_uInt16 nDist = static_cast<sal_uInt16>(rInf.GetFont()->GetHeight()/5);
+ const sal_uInt16 nDist = o3tl::narrowing<sal_uInt16>(rInf.GetFont()->GetHeight()/5);
if( nDist )
{
@@ -670,7 +677,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
0;
const SwTwips nTmpWidth = i * nGridWidth;
const SwTwips nKernWidth = std::min(nTmpWidth - nSumWidth, nRestWidth);
- const sal_uInt16 nKernWidth_1 = static_cast<sal_uInt16>(nKernWidth / 2);
+ const sal_uInt16 nKernWidth_1 = o3tl::narrowing<sal_uInt16>(nKernWidth / 2);
OSL_ENSURE( nKernWidth <= nRestWidth,
"Not enough space left for adjusting non-asian text in grid mode" );
@@ -842,9 +849,11 @@ namespace {
class SwMetaPortion : public SwTextPortion
{
+ Color m_aShadowColor;
public:
SwMetaPortion() { SetWhichPor( PortionType::Meta ); }
virtual void Paint( const SwTextPaintInfo &rInf ) const override;
+ void SetShadowColor(const Color& rCol ) { m_aShadowColor = rCol; }
};
}
@@ -853,7 +862,12 @@ void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const
{
if ( Width() )
{
- rInf.DrawViewOpt( *this, PortionType::Meta );
+ rInf.DrawViewOpt( *this, PortionType::Meta,
+ // custom shading (RDF metadata)
+ COL_BLACK == m_aShadowColor
+ ? nullptr
+ : &m_aShadowColor );
+
SwTextPortion::Paint( rInf );
}
}
@@ -919,7 +933,50 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
pPor = new SwRefPortion;
else if (GetFnt()->IsMeta())
{
- pPor = new SwMetaPortion;
+ auto pMetaPor = new SwMetaPortion;
+
+ // set custom LO_EXT_SHADING color, if it exists
+ SwTextFrame const*const pFrame(rInf.GetTextFrame());
+ SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
+ SwPaM aPam(aPosition);
+ uno::Reference<text::XTextContent> const xRet(
+ SwUnoCursorHelper::GetNestedTextContent(
+ *aPam.GetNode().GetTextNode(), aPosition.nContent.GetIndex(), false) );
+ if (xRet.is())
+ {
+ const SwDoc & rDoc = rInf.GetTextFrame()->GetDoc();
+ static uno::Reference< uno::XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext());
+
+ static uno::Reference< rdf::XURI > xODF_SHADING(
+ rdf::URI::createKnown(xContext, rdf::URIs::LO_EXT_SHADING), uno::UNO_SET_THROW);
+
+ uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(
+ rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+
+ const css::uno::Reference<css::rdf::XResource> xSubject(xRet, uno::UNO_QUERY);
+ const uno::Reference<rdf::XRepository>& xRepository =
+ xDocumentMetadataAccess->getRDFRepository();
+ const uno::Reference<container::XEnumeration> xEnum(
+ xRepository->getStatements(xSubject, xODF_SHADING, nullptr), uno::UNO_SET_THROW);
+
+ while (xEnum->hasMoreElements())
+ {
+ rdf::Statement stmt;
+ if (!(xEnum->nextElement() >>= stmt)) {
+ throw uno::RuntimeException();
+ }
+ const uno::Reference<rdf::XLiteral> xObject(stmt.Object, uno::UNO_QUERY);
+ if (!xObject.is()) continue;
+ if (xEnum->hasMoreElements()) {
+ SAL_INFO("sw.uno", "ignoring other odf:shading statements");
+ }
+ Color rColor = Color::STRtoRGB(xObject->getValue());
+ pMetaPor->SetShadowColor(rColor);
+ break;
+ }
+ }
+ pPor = pMetaPor;
}
else
{
@@ -1335,7 +1392,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
// We open a multiportion part, if we enter a multi-line part
// of the paragraph.
TextFrameIndex nEnd = rInf.GetIdx();
- std::unique_ptr<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
+ std::optional<SwMultiCreator> pCreate = rInf.GetMultiCreator( nEnd, m_pMulti );
if( pCreate )
{
SwMultiPortion* pTmp = nullptr;
@@ -1431,7 +1488,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
PortionType::TabDecimal == pLastTabPortion->GetWhichPor() )
{
OSL_ENSURE( rInf.X() >= pLastTabPortion->GetFix(), "Decimal tab stop position cannot be calculated" );
- const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = static_cast<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
+ const sal_uInt16 nWidthOfPortionsUpToDecimalPosition = o3tl::narrowing<sal_uInt16>(rInf.X() - pLastTabPortion->GetFix() );
static_cast<SwTabDecimalPortion*>(pLastTabPortion)->SetWidthOfPortionsUpToDecimalPosition( nWidthOfPortionsUpToDecimalPosition );
rInf.SetTabDecimal( 0 );
}
@@ -1574,8 +1631,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// Recycling must be suppressed by changed line height and also
// by changed ascent (lowering of baseline).
- const sal_uInt16 nOldHeight = m_pCurr->Height();
- const sal_uInt16 nOldAscent = m_pCurr->GetAscent();
+ const sal_uInt32 nOldHeight = m_pCurr->Height();
+ const sal_uInt32 nOldAscent = m_pCurr->GetAscent();
m_pCurr->SetEndHyph( false );
m_pCurr->SetMidHyph( false );
@@ -1655,7 +1712,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
if ( IsFlyInCntBase() && (!IsQuick() || (pPorTmp && pPorTmp->IsFlyCntPortion() && !pPorTmp->GetNextPortion() &&
m_pCurr->Height() > pPorTmp->Height())))
{
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
AlignFlyInCntBase( Y() + tools::Long( nTmpAscent ) );
m_pCurr->CalcLine( *this, GetInfo() );
@@ -1772,7 +1829,7 @@ void SwTextFormatter::RecalcRealHeight()
void SwTextFormatter::CalcRealHeight( bool bNewLine )
{
- sal_uInt16 nLineHeight = m_pCurr->Height();
+ sal_uInt32 nLineHeight = m_pCurr->Height();
m_pCurr->SetClipping( false );
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -1806,7 +1863,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp = 100;
nTmp *= nLineHeight;
- nLineHeight = static_cast<sal_uInt16>(nTmp / 100);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp / 100);
}
m_pCurr->SetRealHeight( nLineHeight );
@@ -1841,7 +1898,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp /= 100;
if( !nTmp )
++nTmp;
- nLineHeight = static_cast<sal_uInt16>(nTmp);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp);
sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
#if 0
// could do clipping here (like Word does)
@@ -1899,7 +1956,7 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
nTmp += nLineHeight;
if (nTmp < 1)
nTmp = 1;
- nLineHeight = static_cast<sal_uInt16>(nTmp);
+ nLineHeight = o3tl::narrowing<sal_uInt16>(nTmp);
break;
}
case SvxInterLineSpaceRule::Fix:
@@ -2099,8 +2156,8 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
SwTwips nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
- const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
- sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
+ const sal_uInt32 nTmpHeight = pCurrent->GetRealHeight();
+ sal_uInt32 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
AsCharFlags nFlags = AsCharFlags::UlSpace;
if( GetMulti() )
{
@@ -2365,7 +2422,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
nAscent = pLast->GetAscent();
nHeight = pLast->Height();
- if ( m_pCurr->GetRealHeight() > nHeight )
+ if ( o3tl::narrowing<SwTwips>(m_pCurr->GetRealHeight()) > nHeight )
nTop += m_pCurr->GetRealHeight() - nHeight;
else
// Important for fixed space between lines
@@ -2465,7 +2522,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if( bForced )
{
m_pCurr->SetForcedLeftMargin();
- rInf.ForcedLeftMargin( static_cast<sal_uInt16>(aInter.Width()) );
+ rInf.ForcedLeftMargin( o3tl::narrowing<sal_uInt16>(aInter.Width()) );
}
if( bFullLine )
@@ -2496,7 +2553,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if( nH < SAL_MAX_UINT16 )
pFly->Height( sal_uInt16( nH ) );
}
- if( nAscent < pFly->Height() )
+ if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2512,7 +2569,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
else
{
pFly->Height( sal_uInt16(aInter.Height()) );
- if( nAscent < pFly->Height() )
+ if( nAscent < o3tl::narrowing<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2555,7 +2612,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
const tools::Long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
if ( nNewWidth > 0 )
- rInf.Width( static_cast<sal_uInt16>(nNewWidth) );
+ rInf.Width( o3tl::narrowing<sal_uInt16>(nNewWidth) );
else
rInf.Width( 0 );
@@ -2588,7 +2645,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
// we use this one when calculating the base, or the frame would be positioned
// too much to the top, sliding down after all causing a repaint in an area
// he actually never was in.
- sal_uInt16 nAscent = 0;
+ sal_uInt32 nAscent = 0;
const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
@@ -2598,9 +2655,9 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
pFly->GetRefPoint().Y() );
if ( bUseFlyAscent )
- nAscent = static_cast<sal_uInt16>( std::abs( int( bTextFrameVertical ?
+ nAscent = std::abs( int( bTextFrameVertical ?
pFly->GetRelPos().X() :
- pFly->GetRelPos().Y() ) ) );
+ pFly->GetRelPos().Y() ) );
// Check if be prefer to use the ascent of the last portion:
if ( IsQuick() ||
@@ -2609,7 +2666,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
{
nAscent = rInf.GetLast()->GetAscent();
}
- else if( nAscent > nFlyAsc )
+ else if( o3tl::narrowing<SwTwips>(nAscent) > nFlyAsc )
nFlyAsc = nAscent;
Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 75493bad82be..8ff1067abd0d 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -83,14 +83,14 @@ SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint )
{
SwLinePortion *pLast = nullptr;
// 7529 and 4757: not <= nPaintOfst
- while( pPor && GetInfo().X() + pPor->Width() + (pPor->Height()/2)
+ while( pPor && o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + (pPor->Height()/2))
< nPaintOfst )
{
if( pPor->InSpaceGrp() && GetInfo().GetSpaceAdd() )
{
tools::Long nTmp = GetInfo().X() +pPor->Width() +
pPor->CalcSpacing( GetInfo().GetSpaceAdd(), GetInfo() );
- if( nTmp + (pPor->Height()/2) >= nPaintOfst )
+ if( o3tl::narrowing<SwTwips>(nTmp + (pPor->Height()/2)) >= nPaintOfst )
break;
GetInfo().X( nTmp );
GetInfo().SetIdx( GetInfo().GetIdx() + pPor->GetLen() );
@@ -178,7 +178,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
&& GetDropLines() >= GetLineNr();
}
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
// bClip decides if there's a need to clip
@@ -192,7 +192,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
if( GetInfo().GetPos().X() < rPaint.Left() ||
GetInfo().GetPos().Y() < rPaint.Top() ||
- GetInfo().GetPos().Y() + nTmpHeight > rPaint.Top() + rPaint.Height() )
+ GetInfo().GetPos().Y() + o3tl::narrowing<SwTwips>(nTmpHeight) > rPaint.Top() + rPaint.Height() )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -347,7 +347,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
// A safety distance of half the height is added, so that
// TTF-"f" isn't overlapping into the page margin.
if( bClip &&
- GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 ) > nMaxRight )
+ o3tl::narrowing<SwTwips>(GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 )) > nMaxRight )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -480,7 +480,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTextFrame()->getFrameArea().Bottom();
if( ( nDiff > 0 &&
(GetEnd() < TextFrameIndex(GetInfo().GetText().getLength()) ||
- ( nDiff > nTmpHeight/2 && GetPrevLine() ) ) ) ||
+ ( nDiff > o3tl::narrowing<SwTwips>(nTmpHeight)/2 && GetPrevLine() ) ) ) ||
(nDiff >= 0 && bNextUndersized) )
{
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 220977a24d6d..8e49e490f7e1 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -60,7 +60,7 @@ void SwTextIter::Init()
m_nLineNr = 1;
}
-void SwTextIter::CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const
+void SwTextIter::CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const
{
rHeight = GetLineHeight();
rAscent = m_pCurr->GetAscent() + rHeight - m_pCurr->Height();
@@ -211,9 +211,9 @@ const SwLineLayout *SwTextCursor::CharCursorToLine(TextFrameIndex const nPositio
return bPrevious ? PrevLine() : m_pCurr;
}
-sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
+sal_uInt32 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
const SwLinePortion* pPor,
- sal_uInt16 nPorHeight, sal_uInt16 nPorAscent,
+ sal_uInt32 nPorHeight, sal_uInt32 nPorAscent,
const bool bAutoToCentered ) const
{
if ( pPor )
@@ -222,7 +222,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
nPorAscent = pPor->GetAscent();
}
- sal_uInt16 nOfst = rLine.GetRealHeight() - rLine.Height();
+ sal_uInt32 nOfst = rLine.GetRealHeight() - rLine.Height();
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -299,7 +299,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
void SwTextIter::TwipsToLine( const SwTwips y)
{
- while( m_nY + GetLineHeight() <= y && Next() )
+ while( m_nY + o3tl::narrowing<SwTwips>(GetLineHeight()) <= y && Next() )
;
while( m_nY > y && Prev() )
;
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index f155ee6cc484..960d383fe7cf 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -113,8 +113,8 @@ public:
// Truncates all after pCurr
void TruncLines( bool bNoteFollow = false );
- sal_uInt16 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
- void CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const;
+ sal_uInt32 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
+ void CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const;
// Lots of trouble for querying pCurr == pPara
bool IsFirstTextLine() const
@@ -287,8 +287,8 @@ public:
// calculates baseline for portion rPor
// bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
- sal_uInt16 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
- sal_uInt16 nPorHeight = 0, sal_uInt16 nAscent = 0,
+ sal_uInt32 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
+ sal_uInt32 nPorHeight = 0, sal_uInt32 nAscent = 0,
const bool bAutoToCentered = false ) const;
static void SetRightMargin( const bool bNew ){ s_bRightMargin = bNew; }
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index fdb2e4442916..4d589427850c 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -594,10 +594,10 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
// Height has to be changed
if ( rInf.IsMulti() )
{
- if ( Height() < nDiff )
+ if ( o3tl::narrowing<SwTwips>(Height()) < nDiff )
Height( sal_uInt16( nDiff ) );
}
- else if( Width() < nDiff )
+ else if( o3tl::narrowing<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
}
return bFull;
@@ -785,7 +785,7 @@ SwGrfNumPortion::SwGrfNumPortion(
m_nYPos = 0;
m_eOrient = text::VertOrientation::TOP;
}
- Width( static_cast<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) );
+ Width( o3tl::narrowing<sal_uInt16>(rGrfSize.Width() + 2 * GRFNUM_SECURE) );
m_nFixWidth = Width();
m_nGrfHeight = rGrfSize.Height() + 2 * GRFNUM_SECURE;
Height( sal_uInt16(m_nGrfHeight) );
@@ -834,7 +834,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
if( bFull )
{
- Width( rInf.Width() - static_cast<sal_uInt16>(rInf.X()) );
+ Width( rInf.Width() - o3tl::narrowing<sal_uInt16>(rInf.X()) );
if( bFly )
{
SetLen(TextFrameIndex(0));
@@ -868,7 +868,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
SetHide( true );
}
- if( Width() < nDiff )
+ if( o3tl::narrowing<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
return bFull;
}
@@ -959,8 +959,10 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
Graphic* pGraph = const_cast<Graphic*>(m_pBrush->GetGraphic());
if (pGraph)
{
+ const OutputDevice* pOut = rInf.GetOut();
+ assert(pOut);
pGraph->StartAnimation(
- const_cast<OutputDevice*>(rInf.GetOut()), aPos, aSize, m_nId );
+ *const_cast<OutputDevice*>(pOut), aPos, aSize, m_nId);
}
}
@@ -993,7 +995,9 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
if( bDraw && aTmp.HasArea() )
{
- DrawGraphic( m_pBrush.get(), const_cast<OutputDevice*>(rInf.GetOut()),
+ const OutputDevice* pOut = rInf.GetOut();
+ assert(pOut);
+ DrawGraphic( m_pBrush.get(), *const_cast<OutputDevice*>(pOut),
aTmp, aRepaint, m_bReplace ? GRFNUM_REPLACE : GRFNUM_YES );
}
}
@@ -1166,7 +1170,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
{
rInf.GetOut()->SetFont( rInf.GetFont()->GetFnt( m_aScrType[i] ) );
m_aWidth[ m_aScrType[i] ] =
- static_cast<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3);
+ o3tl::narrowing<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetFontSize().Width() / 3);
}
}
}
@@ -1213,7 +1217,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
SwDrawTextInfo aDrawInf(pSh, *rInf.GetOut(), m_aExpand, i, 1);
Size aSize = aTmpFont.GetTextSize_( aDrawInf );
const sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() );
- m_aPos[ i ] = static_cast<sal_uInt16>(aSize.Width());
+ m_aPos[ i ] = o3tl::narrowing<sal_uInt16>(aSize.Width());
if( i == nTop ) // enter the second line
{
m_nLowPos = nMaxDescent;
@@ -1228,7 +1232,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
if( nAsc > nMaxAscent )
nMaxAscent = nAsc;
if( aSize.Height() - nAsc > nMaxDescent )
- nMaxDescent = static_cast<sal_uInt16>(aSize.Height() - nAsc);
+ nMaxDescent = o3tl::narrowing<sal_uInt16>(aSize.Height() - nAsc);
}
// for one or two characters we double the width of the portion
if( nCount < 3 )
@@ -1253,7 +1257,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
Height( Height() + nMainAscent - GetAscent() );
SetAscent( nMainAscent );
}
- if( Height() < nMainAscent + nMainDescent )
+ if( o3tl::narrowing<SwTwips>(Height()) < nMainAscent + nMainDescent )
Height( nMainAscent + nMainDescent );
// We calculate the x positions of the characters in both lines...
@@ -1291,7 +1295,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
{
if( rInf.GetLineStart() == rInf.GetIdx() && (!rInf.GetLast()->InFieldGrp()
|| !static_cast<SwFieldPortion*>(rInf.GetLast())->IsFollow() ) )
- Width( static_cast<sal_uInt16>( rInf.Width() - rInf.X() ) );
+ Width( o3tl::narrowing<sal_uInt16>( rInf.Width() - rInf.X() ) );
else
{
Truncate();
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 34edc3082b71..b999e3d7c354 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -39,6 +39,7 @@
#include <sortedobjs.hxx>
#include <officecfg/Office/Common.hxx>
+#include <PostItMgr.hxx>
/**
* class SwFlyPortion => we expect a frame-locale SwRect!
@@ -57,7 +58,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf )
rInf.GetLastTab()->FormatEOL( rInf );
rInf.GetLast()->FormatEOL( rInf );
- PrtWidth( static_cast<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(GetFix() - rInf.X() + PrtWidth()) );
if( !Width() )
{
OSL_ENSURE( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" );
@@ -81,7 +82,7 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf )
SetLen(TextFrameIndex(1));
}
- const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth());
+ const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth());
if( rInf.Width() <= nNewWidth )
{
Truncate();
@@ -226,7 +227,7 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
// track changes: cross out the image, if it is deleted
const SwFrame *pFrame = m_pFly->Lower();
- if ( IsDeleted() && pFrame )
+ if ( GetAuthor() != std::string::npos && IsDeleted() && pFrame )
{
SwRect aPaintRect( pFrame->GetPaintArea() );
@@ -236,7 +237,8 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetAntialiasing(AntialiasingFlags::Enable);
tools::Long startX = aPaintRect.Left( ), endX = aPaintRect.Right();
tools::Long startY = aPaintRect.Top( ), endY = aPaintRect.Bottom();
- const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ const_cast<vcl::RenderContext&>(*rInf.GetOut()).SetLineColor(
+ SwPostItMgr::GetColorAnchor(GetAuthor()) );
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, startY), Point(endX, endY));
const_cast<vcl::RenderContext&>(*rInf.GetOut()).DrawLine(Point(startX, endY), Point(endX, startY));
if ( bIsAntiAliasing )
@@ -270,6 +272,7 @@ void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) const
SwFlyCntPortion::SwFlyCntPortion()
: m_bMax(false)
, m_bDeleted(false)
+ , m_nAuthor(std::string::npos)
, m_eAlign(sw::LineAlign::NONE)
{
mnLineLength = TextFrameIndex(1);
@@ -421,14 +424,14 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
SwTwips nRelPos = aObjPositioning.GetRelPosY();
if ( nRelPos < 0 )
{
- mnAscent = static_cast<sal_uInt16>(-nRelPos);
+ mnAscent = -nRelPos;
if( mnAscent > Height() )
Height( mnAscent );
}
else
{
mnAscent = 0;
- Height( Height() + static_cast<sal_uInt16>(nRelPos) );
+ Height( Height() + o3tl::narrowing<sal_uInt16>(nRelPos) );
}
}
else
diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx
index fdd974050513..a519c1109c87 100644
--- a/sw/source/core/text/porfly.hxx
+++ b/sw/source/core/text/porfly.hxx
@@ -46,6 +46,7 @@ class SwFlyCntPortion : public SwLinePortion
Point m_aRef; // Relatively to this point we calculate the AbsPos
bool m_bMax; // Line adjustment and height == line height
bool m_bDeleted; // Part of tracked deletion: it needs strikethrough
+ size_t m_nAuthor; // Redline author for color of the strikethrough
sw::LineAlign m_eAlign;
virtual SdrObject* GetSdrObj(const SwTextFrame&) =0;
@@ -55,6 +56,8 @@ public:
const Point& GetRefPoint() const { return m_aRef; }
bool IsMax() const { return m_bMax; }
bool IsDeleted() const { return m_bDeleted; }
+ void SetAuthor(size_t nAuthor) { m_nAuthor = nAuthor; }
+ size_t GetAuthor() const { return m_nAuthor; }
sw::LineAlign GetAlign() const { return m_eAlign; }
void SetAlign(sw::LineAlign eAlign) { m_eAlign = eAlign; }
void SetMax(bool bMax) { m_bMax = bMax; }
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 7c09ded23a2f..4ccfbbb62172 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -215,7 +215,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
}
while( pPrev != pLeft )
{
- if( bNoMove || pPrev->PrtWidth() >= nRightGlue ||
+ if( bNoMove || o3tl::narrowing<SwTwips>(pPrev->PrtWidth()) >= nRightGlue ||
pPrev->InHyphGrp() || pPrev->IsKernPortion() )
{
// The portion before the pRight cannot be moved
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 3d26e990c50c..95809edf540d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -199,7 +199,7 @@ void SwLineLayout::DeleteNext()
delete a;
}
-void SwLineLayout::Height(const sal_uInt16 nNew, const bool bText)
+void SwLineLayout::Height(const sal_uInt32 nNew, const bool bText)
{
SwPosSize::Height(nNew);
if (bText)
@@ -374,7 +374,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
}
else
{
- const sal_uInt16 nLineHeight = Height();
+ const sal_uInt32 nLineHeight = Height();
Init( GetNextPortion() );
SwLinePortion *pPos = mpNextPortion;
SwLinePortion *pLast = this;
@@ -410,7 +410,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
AddPrtWidth( pPos->Width() );
// #i3952#
- if ( bIgnoreBlanksAndTabsForLineHeightCalculation )
+ if (bIgnoreBlanksAndTabsForLineHeightCalculation && !rInf.GetLineStart())
{
if ( pPos->InTabGrp() || pPos->IsHolePortion() ||
( pPos->IsTextPortion() &&
@@ -437,8 +437,8 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
// We had an attribute change: Sum up/build maxima of length and mass
- sal_uInt16 nPosHeight = pPos->Height();
- sal_uInt16 nPosAscent = pPos->GetAscent();
+ sal_uInt32 nPosHeight = pPos->Height();
+ sal_uInt32 nPosAscent = pPos->GetAscent();
SAL_WARN_IF( nPosHeight < nPosAscent,
"sw.core", "SwLineLayout::CalcLine: bad ascent or height" );
@@ -642,6 +642,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if( pPos->IsFlyCntPortion() )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
if ( bHasRedline )
{
OUString sRedlineText;
@@ -651,10 +652,11 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
rInf.GetTextFrame()->MapViewToModel(nPorSttIdx));
bool bHasFlyRedline = rLine.GetRedln()->CheckLine(flyStart.first->GetIndex(),
flyStart.second, flyStart.first->GetIndex(), flyStart.second, sRedlineText,
- bHasRedlineEnd, eRedlineEnd, /*bFullLine=*/false);
+ bHasRedlineEnd, eRedlineEnd, /*pAuthorAtPos=*/&nAuthor);
bDeleted = bHasFlyRedline && eRedlineEnd == RedlineType::Delete;
}
static_cast<SwFlyCntPortion*>(pPos)->SetDeleted(bDeleted);
+ static_cast<SwFlyCntPortion*>(pPos)->SetAuthor(nAuthor);
}
// anchored to characters
else if ( pPos->IsFlyPortion() )
@@ -670,20 +672,23 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
if ( auto pFly = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
{
bool bDeleted = false;
+ size_t nAuthor = std::string::npos;
const SwFormatAnchor& rAnchor = pAnchoredObj->GetFrameFormat().GetAnchor();
if ( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR )
{
SwPosition aAnchor = *rAnchor.GetContentAnchor();
- const SwPaM aPam(aAnchor, aAnchor);
- if ( rIDRA.HasRedline( aPam, RedlineType::Delete,
- /*bStartOrEndInRange=*/false) )
+ SwRedlineTable::size_type n = 0;
+ const SwRangeRedline* pFnd =
+ rIDRA.GetRedlineTable().FindAtPosition( aAnchor, n );
+ if ( pFnd && RedlineType::Delete == pFnd->GetType() )
{
bDeleted = true;
+ nAuthor = pFnd->GetAuthor();
}
}
pFly->SetDeleted(bDeleted);
+ pFly->SetAuthor(nAuthor);
}
-
}
}
}
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 249ed81f088f..5234a537fa4c 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -81,8 +81,8 @@ private:
SwLineLayout *m_pNext; // The next Line
std::unique_ptr<std::vector<tools::Long>> m_pLLSpaceAdd; // Used for justified alignment
std::unique_ptr<std::deque<sal_uInt16>> m_pKanaComp; // Used for Kana compression
- sal_uInt16 m_nRealHeight; // The height resulting from line spacing and register
- sal_uInt16 m_nTextHeight; // The max height of all non-FlyCnt portions in this Line
+ sal_uInt32 m_nRealHeight; // The height resulting from line spacing and register
+ sal_uInt32 m_nTextHeight; // The max height of all non-FlyCnt portions in this Line
bool m_bFormatAdj : 1;
bool m_bDummy : 1;
bool m_bEndHyph : 1;
@@ -108,7 +108,7 @@ private:
public:
// From SwPosSize
using SwPosSize::Height;
- virtual void Height(const sal_uInt16 nNew, const bool bText = true) override;
+ virtual void Height(const sal_uInt32 nNew, const bool bText = true) override;
// From SwLinePortion
virtual SwLinePortion *Insert( SwLinePortion *pPortion ) override;
@@ -165,8 +165,8 @@ public:
// Collects the data for the line
void CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
- void SetRealHeight( sal_uInt16 nNew ) { m_nRealHeight = nNew; }
- sal_uInt16 GetRealHeight() const { return m_nRealHeight; }
+ void SetRealHeight( sal_uInt32 nNew ) { m_nRealHeight = nNew; }
+ sal_uInt32 GetRealHeight() const { return m_nRealHeight; }
sal_uInt16 GetTextHeight() const { return m_nTextHeight; }
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 035f670d464b..c5dc41ff3db5 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -88,7 +88,7 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
sal_uInt16 nLastWidth = pLast->Width();
if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
- nLastWidth = nLastWidth + static_cast<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ));
+ nLastWidth = nLastWidth + o3tl::narrowing<sal_uInt16>(pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf ));
sal_uInt16 nPos;
SwTextPaintInfo aInf( rInf );
@@ -246,7 +246,7 @@ bool SwLinePortion::Format( SwTextFormatInfo &rInf )
const SwLinePortion *pLast = rInf.GetLast();
Height( pLast->Height() );
SetAscent( pLast->GetAscent() );
- const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth());
+ const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.X() + PrtWidth());
// Only portions with true width can return true
// Notes for example never set bFull==true
if( rInf.Width() <= nNewWidth && PrtWidth() && ! IsKernPortion() )
@@ -290,7 +290,7 @@ void SwLinePortion::Move( SwTextPaintInfo &rInf )
rInf.IncKanaIdx();
}
if( rInf.IsRotated() )
- rInf.Y( rInf.Y() + ( bB2T ? -PrtWidth() : PrtWidth() ) );
+ rInf.Y( rInf.Y() + ( bB2T ? -o3tl::narrowing<SwTwips>(PrtWidth()) : o3tl::narrowing<SwTwips>(PrtWidth()) ) );
else if ( bCounterDir )
rInf.X( rInf.X() - PrtWidth() );
else
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 3d2b8dad29e4..f0efc86e5888 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -53,7 +53,7 @@ protected:
SwLinePortion *mpNextPortion;
// Count of chars and spaces on the line
TextFrameIndex mnLineLength;
- sal_uInt16 mnAscent; // Maximum ascender
+ sal_uInt32 mnAscent; // Maximum ascender
SwLinePortion();
private:
@@ -73,12 +73,12 @@ public:
TextFrameIndex GetLen() const { return mnLineLength; }
void SetLen(TextFrameIndex const nLen) { mnLineLength = nLen; }
void SetNextPortion( SwLinePortion *pNew ){ mpNextPortion = pNew; }
- sal_uInt16 &GetAscent() { return mnAscent; }
- sal_uInt16 GetAscent() const { return mnAscent; }
- void SetAscent( const sal_uInt16 nNewAsc ) { mnAscent = nNewAsc; }
+ sal_uInt32 &GetAscent() { return mnAscent; }
+ sal_uInt32 GetAscent() const { return mnAscent; }
+ void SetAscent( const sal_uInt32 nNewAsc ) { mnAscent = nNewAsc; }
void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); }
- sal_uInt16 PrtWidth() const { return Width(); }
- void AddPrtWidth( const sal_uInt16 nNew ) { Width( Width() + nNew ); }
+ sal_uInt32 PrtWidth() const { return Width(); }
+ void AddPrtWidth( const sal_uInt32 nNew ) { Width( Width() + nNew ); }
void SubPrtWidth( const sal_uInt16 nNew ) { Width( Width() - nNew ); }
// Insert methods
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index c51fb973ad29..b94302bd8ed7 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -351,12 +351,12 @@ void SwDoubleLinePortion::PaintBracket( SwTextPaintInfo &rInf,
aBlank.Width( nChWidth );
aBlank.Height( m_pBracket->nHeight );
{
- std::unique_ptr<SwFont> pTmpFnt( new SwFont( *rInf.GetFont() ) );
+ SwFont aTmpFnt( *rInf.GetFont() );
SwFontScript nAct = bOpen ? m_pBracket->nPreScript : m_pBracket->nPostScript;
if( SW_SCRIPTS > nAct )
- pTmpFnt->SetActual( nAct );
- pTmpFnt->SetProportion( 100 );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( nAct );
+ aTmpFnt.SetProportion( 100 );
+ SwFontSave aSave( rInf, &aTmpFnt );
aBlank.Paint( rInf );
}
if( bOpen )
@@ -384,22 +384,22 @@ void SwDoubleLinePortion::SetBrackets( const SwDoubleLinePortion& rDouble )
void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxWidth )
{
nMaxWidth -= rInf.X();
- std::unique_ptr<SwFont> pTmpFnt( new SwFont( *rInf.GetFont() ) );
- pTmpFnt->SetProportion( 100 );
+ SwFont aTmpFnt( *rInf.GetFont() );
+ aTmpFnt.SetProportion( 100 );
m_pBracket->nAscent = 0;
m_pBracket->nHeight = 0;
if( m_pBracket->cPre )
{
OUString aStr( m_pBracket->cPre );
- SwFontScript nActualScr = pTmpFnt->GetActual();
+ SwFontScript nActualScr = aTmpFnt.GetActual();
if( SW_SCRIPTS > m_pBracket->nPreScript )
- pTmpFnt->SetActual( m_pBracket->nPreScript );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( m_pBracket->nPreScript );
+ SwFontSave aSave( rInf, &aTmpFnt );
SwPosSize aSize = rInf.GetTextSize( aStr );
m_pBracket->nAscent = rInf.GetAscent();
m_pBracket->nHeight = aSize.Height();
- pTmpFnt->SetActual( nActualScr );
- if( nMaxWidth > aSize.Width() )
+ aTmpFnt.SetActual( nActualScr );
+ if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) )
{
m_pBracket->nPreWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -417,8 +417,8 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
{
OUString aStr( m_pBracket->cPost );
if( SW_SCRIPTS > m_pBracket->nPostScript )
- pTmpFnt->SetActual( m_pBracket->nPostScript );
- SwFontSave aSave( rInf, pTmpFnt.get() );
+ aTmpFnt.SetActual( m_pBracket->nPostScript );
+ SwFontSave aSave( rInf, &aTmpFnt );
SwPosSize aSize = rInf.GetTextSize( aStr );
const sal_uInt16 nTmpAsc = rInf.GetAscent();
if( nTmpAsc > m_pBracket->nAscent )
@@ -428,7 +428,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
}
if( aSize.Height() > m_pBracket->nHeight )
m_pBracket->nHeight = aSize.Height();
- if( nMaxWidth > aSize.Width() )
+ if( nMaxWidth > o3tl::narrowing<SwTwips>(aSize.Width()) )
{
m_pBracket->nPostWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -654,9 +654,9 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
TextFrameIndex nSub(0);
switch ( m_nAdjustment )
{
- case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2);
+ case css::text::RubyAdjust_CENTER: nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2);
[[fallthrough]];
- case css::text::RubyAdjust_RIGHT: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break;
+ case css::text::RubyAdjust_RIGHT: nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight); break;
case css::text::RubyAdjust_BLOCK: nSub = TextFrameIndex(1);
[[fallthrough]];
case css::text::RubyAdjust_INDENT_BLOCK:
@@ -683,8 +683,8 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
}
if( nLineDiff > 1 )
{
- nRight = static_cast<sal_uInt16>(nLineDiff / 2);
- nLeft = static_cast<sal_uInt16>(nLineDiff - nRight);
+ nRight = o3tl::narrowing<sal_uInt16>(nLineDiff / 2);
+ nLeft = o3tl::narrowing<sal_uInt16>(nLineDiff - nRight);
}
break;
}
@@ -904,7 +904,7 @@ namespace sw {
// interrupts the first attribute.
// E.g. a ruby portion interrupts a 2-line-attribute, a 2-line-attribute
// with different brackets interrupts another 2-line-attribute.
-std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
+std::optional<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
SwMultiPortion const * pMulti ) const
{
SwScriptInfo& rSI = const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
@@ -936,19 +936,19 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
{
rPos = bFieldBidi ? rPos + TextFrameIndex(1) : rSI.NextDirChg(rPos, &nCurrLevel);
if (TextFrameIndex(COMPLETE_STRING) == rPos)
- return nullptr;
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->pItem = nullptr;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
- pRet->nId = SwMultiCreatorId::Bidi;
- pRet->nLevel = nCurrLevel + 1;
- return pRet;
+ return {};
+ SwMultiCreator aRet;
+ aRet.pItem = nullptr;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
+ aRet.nId = SwMultiCreatorId::Bidi;
+ aRet.nLevel = nCurrLevel + 1;
+ return aRet;
}
// a bidi portion can only contain other bidi portions
if ( pMulti )
- return nullptr;
+ return {};
// need the node that contains input rPos
std::pair<SwTextNode const*, sal_Int32> startPos(m_pFrame->MapViewToModel(rPos));
@@ -1037,26 +1037,26 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
}
if (!pRuby && !pActiveTwoLinesItem && !pActiveRotateItem)
- return nullptr;
+ return {};
if( pRuby )
{ // The winner is ... a ruby attribute and so
// the end of the multiportion is the end of the ruby attribute.
rPos = m_pFrame->MapModelToView(startPos.first, *pRuby->End());
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->pItem = nullptr;
- pRet->pAttr = pRuby;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
- pRet->nId = SwMultiCreatorId::Ruby;
- pRet->nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
- return pRet;
+ SwMultiCreator aRet;
+ aRet.pItem = nullptr;
+ aRet.pAttr = pRuby;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
+ aRet.nId = SwMultiCreatorId::Ruby;
+ aRet.nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
+ return aRet;
}
if (pActiveTwoLinesHint ||
(pNodeTwoLinesItem && pNodeTwoLinesItem == pActiveTwoLinesItem &&
rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a 2-line-attribute,
// the end of the multiportion depends on the following attributes...
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
+ SwMultiCreator aRet;
// We note the endpositions of the 2-line attributes in aEnd as stack
std::deque<TextFrameIndex> aEnd;
@@ -1068,9 +1068,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
if (pActiveTwoLinesHint)
{
- pRet->pItem = nullptr;
- pRet->pAttr = pActiveTwoLinesHint;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
+ aRet.pItem = nullptr;
+ aRet.pAttr = pActiveTwoLinesHint;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
if (pNodeTwoLinesItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1081,18 +1081,18 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
else
{
- aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *pRet->pAttr->End()));
+ aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *aRet.pAttr->End()));
}
}
else
{
- pRet->pItem = pNodeTwoLinesItem;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
+ aRet.pItem = pNodeTwoLinesItem;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
- pRet->nId = SwMultiCreatorId::Double;
- pRet->nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
+ aRet.nId = SwMultiCreatorId::Double;
+ aRet.nLevel = GetTextFrame()->IsRightToLeft() ? 1 : 0;
// pActiveTwoLinesHint is the last 2-line-attribute, which contains
// the actual position.
@@ -1171,7 +1171,7 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
// A ruby attribute stops the 2-line immediately
if (pTmp && RES_TXTATR_CJK_RUBY == pTmp->Which())
- return pRet;
+ return aRet;
if (pTmp ? lcl_Has2Lines(*pTmp, pActiveTwoLinesItem, bTwo)
: lcl_Check2Lines(pNodeTwoLinesItem, pActiveTwoLinesItem, bTwo))
{ // We have an interesting attribute...
@@ -1198,15 +1198,15 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
if( bOn && !aEnd.empty() )
rPos = aEnd.back();
- return pRet;
+ return aRet;
}
if (pActiveRotateHint ||
(pNodeRotateItem && pNodeRotateItem == pActiveRotateItem &&
rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a rotate-attribute,
// the end of the multiportion depends on the following attributes...
- std::unique_ptr<SwMultiCreator> pRet(new SwMultiCreator);
- pRet->nId = SwMultiCreatorId::Rotate;
+ SwMultiCreator aRet;
+ aRet.nId = SwMultiCreatorId::Rotate;
// We note the endpositions of the 2-line attributes in aEnd as stack
std::deque<TextFrameIndex> aEnd;
@@ -1299,9 +1299,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
bOn = true;
if (pActiveRotateHint)
{
- pRet->pItem = nullptr;
- pRet->pAttr = pActiveRotateHint;
- pRet->nStartOfAttr = m_pFrame->MapModelToView(startPos.first, pRet->pAttr->GetStart());
+ aRet.pItem = nullptr;
+ aRet.pAttr = pActiveRotateHint;
+ aRet.nStartOfAttr = m_pFrame->MapModelToView(startPos.first, aRet.pAttr->GetStart());
if (pNodeRotateItem)
{
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
@@ -1310,14 +1310,14 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
}
else
{
- aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *pRet->pAttr->End()));
+ aEnd.push_front(m_pFrame->MapModelToView(startPos.first, *aRet.pAttr->End()));
}
}
else
{
- pRet->pItem = pNodeRotateItem;
- pRet->pAttr = nullptr;
- pRet->nStartOfAttr = TextFrameIndex(-1);
+ aRet.pItem = pNodeRotateItem;
+ aRet.pAttr = nullptr;
+ aRet.nStartOfAttr = TextFrameIndex(-1);
aEnd.push_front(m_pFrame->MapModelToView(startPos.first, startPos.first->Len()));
}
for (sw::MergedAttrIterMulti iter = iterAtStartOfNode; ; )
@@ -1394,9 +1394,9 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
rPos = aEnd.back();
if( rPos > n2Start )
rPos = n2Start;
- return pRet;
+ return aRet;
}
- return nullptr;
+ return {};
}
namespace {
@@ -1679,7 +1679,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
}
else if ( rMulti.IsRuby() && rMulti.OnRight() && GetInfo().IsRuby() )
{
- SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, 0 );
+ SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, static_cast<sal_uInt32>(0) );
GetInfo().Y( nOfst + nLineDiff );
// Draw the ruby text on top of the preserved space.
GetInfo().X( GetInfo().X() - pPor->Height() );
@@ -1899,15 +1899,16 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
SeekAndChg( rInf );
std::unique_ptr<SwFontSave> xFontSave;
+ std::unique_ptr<SwFont> xTmpFont;
if( rMulti.IsDouble() )
{
- SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
+ xTmpFont.reset(new SwFont( *rInf.GetFont() ));
if( rMulti.IsDouble() )
{
SetPropFont( 50 );
- pTmpFnt->SetProportion( GetPropFont() );
+ xTmpFont->SetProportion( GetPropFont() );
}
- xFontSave.reset(new SwFontSave(rInf, pTmpFnt, this));
+ xFontSave.reset(new SwFontSave(rInf, xTmpFont.get(), this));
}
SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() );
@@ -2168,7 +2169,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
// Setting this to the portion width ( = rMulti.Width() )
// can make GetTextBreak inside SwTextGuess::Guess return too small
// values. Therefore we add some extra twips.
- if( nActWidth > nTmpX + rMulti.Width() + 6 )
+ if( nActWidth > nTmpX + o3tl::narrowing<SwTwips>(rMulti.Width()) + 6 )
nActWidth = nTmpX + rMulti.Width() + 6;
nMaxWidth = nActWidth;
nActWidth = ( 3 * nMaxWidth + nMinWidth + 3 ) / 4;
@@ -2453,7 +2454,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
return pRest;
nPosition = nMultiPos + pHelpMulti->GetLen();
- std::unique_ptr<SwMultiCreator> pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );
+ std::optional<SwMultiCreator> pCreate = GetInfo().GetMultiCreator( nMultiPos, nullptr );
if ( !pCreate )
{
@@ -2510,7 +2511,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
SwMultiPortion* pMulti,
SwTwips nY,
- sal_uInt16& nX,
+ sal_uInt32& nX,
TextFrameIndex const nCurrStart,
tools::Long nSpaceAdd )
: pTextCursor(pCursor),
@@ -2519,7 +2520,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
{
pCursor->m_nStart = nCurrStart;
pCursor->m_pCurr = &pMulti->GetRoot();
- while( pCursor->Y() + pCursor->GetLineHeight() < nY &&
+ while( pCursor->Y() + o3tl::narrowing<SwTwips>(pCursor->GetLineHeight()) < nY &&
pCursor->Next() )
; // nothing
nWidth = pCursor->m_pCurr->Width();
@@ -2544,7 +2545,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
}
if( nSpaceAdd > 0 && !pMulti->HasTabulator() )
- pCursor->m_pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) );
+ pCursor->m_pCurr->Width( o3tl::narrowing<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) );
// For a BidiPortion we have to calculate the offset from the
// end of the portion
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index c94dd3125629..7c17df2e175c 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -241,7 +241,7 @@ class SwTextCursorSave
bool bSpaceChg;
public:
SwTextCursorSave( SwTextCursor* pTextCursor, SwMultiPortion* pMulti,
- SwTwips nY, sal_uInt16& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
+ SwTwips nY, sal_uInt32& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
~SwTextCursorSave();
};
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 6f578e0744cd..23f837d63051 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -243,7 +243,7 @@ SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) :
SwArrowPortion::SwArrowPortion( const SwTextPaintInfo &rInf )
: m_bLeft( false )
{
- Height( static_cast<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) );
+ Height( o3tl::narrowing<sal_uInt16>(rInf.GetTextFrame()->getFramePrintArea().Height()) );
m_aPos.setX( rInf.GetTextFrame()->getFrameArea().Left() +
rInf.GetTextFrame()->getFramePrintArea().Right() );
m_aPos.setY( rInf.GetTextFrame()->getFrameArea().Top() +
@@ -455,7 +455,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true );
if( pSh && !pOut )
- pOut = pSh->GetWin();
+ pOut = pSh->GetWin()->GetOutDev();
if( !pOut )
pOut = Application::GetDefaultDevice();
@@ -493,7 +493,7 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
nTmp /= 100;
if( !nTmp )
++nTmp;
- rRegDiff = static_cast<sal_uInt16>(nTmp);
+ rRegDiff = o3tl::narrowing<sal_uInt16>(nTmp);
nNetHeight = rRegDiff;
break;
}
@@ -642,7 +642,7 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const
Point aOldPos = rInf.GetPos();
Point aNewPos( aOldPos );
- auto const deltaX((Width() / 2) - mnHalfCharWidth);
+ auto const deltaX((o3tl::narrowing<SwTwips>(Width()) / 2) - mnHalfCharWidth);
switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()).get())
{
case 0:
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index ed9d3c517bb5..c1fa69bcfc68 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -221,7 +221,7 @@ void SwTextPortion::BreakCut( SwTextFormatInfo &rInf, const SwTextGuess &rGuess
// The word/char is larger than the line
// Special case 1: The word is larger than the line
// We truncate ...
- const sal_uInt16 nLineWidth = static_cast<sal_uInt16>(rInf.Width() - rInf.X());
+ const sal_uInt16 nLineWidth = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X());
TextFrameIndex nLen = rGuess.CutPos() - rInf.GetIdx();
if (nLen > TextFrameIndex(0))
{
diff --git a/sw/source/core/text/possiz.hxx b/sw/source/core/text/possiz.hxx
index fc31ffc11e39..543f037fde55 100644
--- a/sw/source/core/text/possiz.hxx
+++ b/sw/source/core/text/possiz.hxx
@@ -24,17 +24,17 @@
// Compared to the SV sizes SwPosSize is always positive
class SwPosSize
{
- sal_uInt16 m_nWidth;
- sal_uInt16 m_nHeight;
+ sal_uInt32 m_nWidth;
+ sal_uInt32 m_nHeight;
public:
- SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 )
+ SwPosSize( const sal_uInt32 nW = 0, const sal_uInt32 nH = 0 )
: m_nWidth(nW)
, m_nHeight(nH)
{
}
explicit SwPosSize( const Size &rSize )
- : m_nWidth(sal_uInt16(rSize.Width()))
- ,m_nHeight(sal_uInt16(rSize.Height()))
+ : m_nWidth(sal_uInt32(rSize.Width()))
+ ,m_nHeight(sal_uInt32(rSize.Height()))
{
}
#if defined(__COVERITY__)
@@ -46,25 +46,25 @@ public:
SwPosSize(SwPosSize &&) = default;
SwPosSize & operator =(SwPosSize const &) = default;
SwPosSize & operator =(SwPosSize &&) = default;
- sal_uInt16 Height() const { return m_nHeight; }
- virtual void Height(const sal_uInt16 nNew, const bool = true) { m_nHeight = nNew; }
- sal_uInt16 Width() const { return m_nWidth; }
- void Width( const sal_uInt16 nNew ) { m_nWidth = nNew; }
+ sal_uInt32 Height() const { return m_nHeight; }
+ virtual void Height(const sal_uInt32 nNew, const bool = true) { m_nHeight = nNew; }
+ sal_uInt32 Width() const { return m_nWidth; }
+ void Width( const sal_uInt32 nNew ) { m_nWidth = nNew; }
Size SvLSize() const { return Size( m_nWidth, m_nHeight ); }
void SvLSize( const Size &rSize )
{
- m_nWidth = sal_uInt16(rSize.Width());
- m_nHeight = sal_uInt16(rSize.Height());
+ m_nWidth = sal_uInt32(rSize.Width());
+ m_nHeight = sal_uInt32(rSize.Height());
}
void SvXSize( const Size &rSize )
{
- m_nHeight = sal_uInt16(rSize.Width());
- m_nWidth = sal_uInt16(rSize.Height());
+ m_nHeight = sal_uInt32(rSize.Width());
+ m_nWidth = sal_uInt32(rSize.Height());
}
SwPosSize& operator=( const Size &rSize )
{
- m_nWidth = sal_uInt16(rSize.Width());
- m_nHeight = sal_uInt16(rSize.Height());
+ m_nWidth = sal_uInt32(rSize.Width());
+ m_nHeight = sal_uInt32(rSize.Height());
return *this;
}
};
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index faeb0fbbaa8d..d4ced03f1c8c 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -941,13 +941,13 @@ bool SwRedlineItr::ChkSpecialUnderline_() const
bool SwRedlineItr::CheckLine(
sal_uLong const nStartNode, sal_Int32 const nChkStart,
sal_uLong const nEndNode, sal_Int32 nChkEnd, OUString& rRedlineText,
- bool& bRedlineEnd, RedlineType& eRedlineEnd, bool bFullLine)
+ bool& bRedlineEnd, RedlineType& eRedlineEnd, size_t* pAuthorAtPos)
{
// note: previously this would return true in the (!m_bShow && m_pExt)
// case, but surely that was a bug?
if (m_nFirst == SwRedlineTable::npos || m_eMode != Mode::Show)
return false;
- if( nChkEnd == nChkStart && bFullLine ) // empty lines look one char further
+ if( nChkEnd == nChkStart && pAuthorAtPos == nullptr ) // empty lines look one char further
++nChkEnd;
sal_Int32 nOldStart = m_nStart;
sal_Int32 nOldEnd = m_nEnd;
@@ -978,6 +978,8 @@ bool SwRedlineItr::CheckLine(
eRedlineEnd = pRedline->GetType();
bRedlineEnd = true;
isBreak = true;
+ if (pAuthorAtPos)
+ *pAuthorAtPos = pRedline->GetAuthor();
[[fallthrough]];
case SwComparePosition::OverlapBefore:
case SwComparePosition::CollideEnd:
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index 0d0e013ff6d5..087df8bbbba8 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -119,7 +119,7 @@ public:
{ return IsOn() && ChkSpecialUnderline_(); }
bool CheckLine(sal_uLong nStartNode, sal_Int32 nChkStart, sal_uLong nEndNode,
sal_Int32 nChkEnd, OUString& rRedlineText, bool& bRedlineEnd,
- RedlineType& eRedlineEnd, bool bFullLine = true);
+ RedlineType& eRedlineEnd, size_t* pAuthorAtPos = nullptr);
bool LeaveExtend(SwFont& rFnt, sal_uLong const nNode, sal_Int32 const nNew)
{ return m_pExt->Leave(rFnt, nNode, nNew); }
bool ExtOn() {
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 312eb4dd71ba..ce39a3e9e1dc 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -484,8 +484,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
{
const SwLinePortion *const pOldCurr = GetCurr();
sal_uInt16 nDropHght = 0;
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
sal_uInt16 nDropLns = 0;
const bool bRegisterOld = IsRegisterOn();
m_bRegisterOn = false;
@@ -545,8 +545,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
void SwTextFormatter::GuessDropHeight( const sal_uInt16 nLines )
{
OSL_ENSURE( nLines, "GuessDropHeight: Give me more Lines!" );
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
SetDropLines( nLines );
if ( GetDropLines() > 1 )
{
@@ -678,7 +678,7 @@ void SwTextPainter::PaintDropPortion()
Point aLineOrigin( GetTopLeft() );
aLineOrigin.AdjustX(nX );
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
aLineOrigin.AdjustY(nTmpAscent );
GetInfo().SetIdx( GetStart() );
@@ -775,7 +775,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
m_aText[ nTmpIdx ] = aStr;
m_aWishedHeight[ nTmpIdx ] = sal_uInt16(nWishedHeight);
// save initial scaling factor
- m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor);
+ m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor);
}
bool bGrow = (pDrop->GetLen() != TextFrameIndex(0));
@@ -793,7 +793,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
OutputDevice* pOut = rInf.GetOut();
OutputDevice* pWin;
if( rInf.GetVsh() && rInf.GetVsh()->GetWin() )
- pWin = rInf.GetVsh()->GetWin();
+ pWin = rInf.GetVsh()->GetWin()->GetOutDev();
else
pWin = Application::GetDefaultDevice();
@@ -925,7 +925,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
else
{
if ( bUseCache )
- m_aFactor[ nTmpIdx ] = static_cast<sal_uInt16>(nFactor);
+ m_aFactor[ nTmpIdx ] = o3tl::narrowing<sal_uInt16>(nFactor);
nMin = nFactor;
}
@@ -982,7 +982,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
bool SwDropPortion::Format( SwTextFormatInfo &rInf )
{
bool bFull = false;
- m_nFix = static_cast<sal_uInt16>(rInf.X());
+ m_nFix = o3tl::narrowing<sal_uInt16>(rInf.X());
SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
aLayoutModeModifier.SetAuto();
@@ -1020,7 +1020,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
Width();
// set values
- pCurrPart->SetWidth( static_cast<sal_uInt16>(nTmpWidth) );
+ pCurrPart->SetWidth( o3tl::narrowing<sal_uInt16>(nTmpWidth) );
// Move
rInf.SetIdx( rInf.GetIdx() + pCurrPart->GetLen() );
@@ -1029,7 +1029,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
}
SetJoinBorderWithNext(false);
SetJoinBorderWithPrev(false);
- Width( static_cast<sal_uInt16>(rInf.X() - nOldX) );
+ Width( o3tl::narrowing<sal_uInt16>(rInf.X() - nOldX) );
}
// reset my length
@@ -1066,7 +1066,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf )
else
{
const sal_uInt16 nWant = Width() + GetDistance();
- const sal_uInt16 nRest = static_cast<sal_uInt16>(rInf.Width() - rInf.X());
+ const sal_uInt16 nRest = o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X());
if( ( nWant > nRest ) ||
lcl_IsDropFlyInter( rInf, Width() + GetDistance(), m_nDropHeight ) )
m_nDistance = 0;
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index e150f7f489f1..c1375b52fe09 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -304,7 +304,8 @@ static SwFieldPortion * lcl_NewMetaPortion(SwTextAttr & rHint, const bool bPrefi
OSL_ENSURE(pField, "lcl_NewMetaPortion: no meta field?");
if (pField)
{
- pField->GetPrefixAndSuffix(bPrefix ? &fix : nullptr, bPrefix ? nullptr : &fix);
+ OUString color;
+ pField->GetPrefixAndSuffix(bPrefix ? &fix : nullptr, bPrefix ? nullptr : &fix, &color);
}
return new SwFieldPortion( fix );
}
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index a5fb1f6b6731..d91d41ae4a01 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -244,7 +244,7 @@ SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
CacheItem item {
pObj, // due to #37347 the Object must be entered only after GetContour()
std::make_unique<TextRanger>( aPolyPolygon, pPolyPolygon.get(), 20,
- static_cast<sal_uInt16>(rLRSpace.GetLeft()), static_cast<sal_uInt16>(rLRSpace.GetRight()),
+ o3tl::narrowing<sal_uInt16>(rLRSpace.GetLeft()), o3tl::narrowing<sal_uInt16>(rLRSpace.GetRight()),
pFormat->GetSurround().IsOutside(), false, pFrame->IsVertical() )
};
mvItems.insert(mvItems.begin(), std::move(item));
@@ -843,7 +843,8 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
const bool bAllowCompatWrap = m_pCurrFrame->IsInTab() && (bFooterHeader || m_pCurrFrame->IsInFootnote());
const bool bWrapAllowed = ( pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ||
bAllowCompatWrap ||
- (!m_pCurrFrame->IsInFootnote() && !bFooterHeader));
+ (!m_pCurrFrame->IsInFootnote() && !bFooterHeader) ||
+ bFooterHeader );
m_bOn = false;
@@ -885,12 +886,14 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
// #i20505# Do not consider oversized objects
SwAnchoredObject* pAnchoredObj = (*pSorted)[ i ];
assert(pAnchoredObj);
+ const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround();
if ( !pAnchoredObj ||
!rIDDMA.IsVisibleLayerId( pAnchoredObj->GetDrawObj()->GetLayer() ) ||
!pAnchoredObj->ConsiderForTextWrap() ||
( mbIgnoreObjsInHeaderFooter && !bFooterHeader &&
pAnchoredObj->GetAnchorFrame()->FindFooterOrHeader() ) ||
- ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() )
+ ( bAllowCompatWrap && !pAnchoredObj->GetFrameFormat().GetFollowTextFlow().GetValue() ) ||
+ ( !bAllowCompatWrap && bFooterHeader && com::sun::star::text::WrapTextMode_NONE == rFlyFormat.GetSurround() )
)
{
continue;
@@ -928,7 +931,6 @@ SwAnchoredObjList* SwTextFly::InitAnchoredObjList()
mpAnchoredObjList->insert( aInsPosIter, pAnchoredObj );
}
- const SwFormatSurround &rFlyFormat = pAnchoredObj->GetFrameFormat().GetSurround();
// #i68520#
if ( rFlyFormat.IsAnchorOnly() &&
pAnchoredObj->GetAnchorFrame() == GetMaster() )
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index acd1b1b4f5be..1fd412c2e811 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -71,6 +71,10 @@
#include <ftnidx.hxx>
#include <ftnfrm.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <edtwin.hxx>
+#include <FrameControlsManager.hxx>
namespace sw {
@@ -878,6 +882,12 @@ void SwTextFrame::DestroyImpl()
}
}
+ if (!GetDoc().IsInDtor())
+ {
+ if (SwView* pView = GetActiveView())
+ pView->GetEditWin().GetFrameControlsManager().RemoveControls(this);
+ }
+
SwContentFrame::DestroyImpl();
}
@@ -1821,12 +1831,12 @@ static void lcl_SetWrong( SwTextFrame& rFrame, SwTextNode const& rNode,
const sal_Int32 nEnd = nPos + (nCnt > 0 ? nCnt : 1 );
if ( !pTextNode->GetWrong() && !pTextNode->IsWrongDirty() )
{
- pTextNode->SetWrong( new SwWrongList( WRONGLIST_SPELL ) );
+ pTextNode->SetWrong( std::make_unique<SwWrongList>( WRONGLIST_SPELL ) );
pTextNode->GetWrong()->SetInvalid( nPos, nEnd );
}
if ( !pTextNode->GetSmartTags() && !pTextNode->IsSmartTagDirty() )
{
- pTextNode->SetSmartTags( new SwWrongList( WRONGLIST_SMARTTAG ) );
+ pTextNode->SetSmartTags( std::make_unique<SwWrongList>( WRONGLIST_SMARTTAG ) );
pTextNode->GetSmartTags()->SetInvalid( nPos, nEnd );
}
pTextNode->SetWrongDirty(SwTextNode::WrongState::TODO);
@@ -1969,8 +1979,9 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
sw::RedlineUnDelText const* pRedlineUnDelText(nullptr);
sal_uInt16 nWhich = 0;
- if (auto const pHint = dynamic_cast<sw::LegacyModifyHint const*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
pOld = pHint->m_pOld;
pNew = pHint->m_pNew;
nWhich = pHint->GetWhich();
@@ -3312,7 +3323,7 @@ bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst )
return bRet;
}
-sal_uInt16 SwTextFrame::GetParHeight() const
+sal_uInt32 SwTextFrame::GetParHeight() const
{
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
"SwTextFrame::GetParHeight with swapped frame" );
@@ -3320,11 +3331,11 @@ sal_uInt16 SwTextFrame::GetParHeight() const
if( !HasPara() )
{ // For non-empty paragraphs this is a special case
// For UnderSized we can simply just ask 1 Twip more
- sal_uInt16 nRet = static_cast<sal_uInt16>(getFramePrintArea().SSize().Height());
+ sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(getFramePrintArea().SSize().Height());
if( IsUndersized() )
{
if( IsEmpty() || GetText().isEmpty() )
- nRet = static_cast<sal_uInt16>(EmptyHeight());
+ nRet = o3tl::narrowing<sal_uInt16>(EmptyHeight());
else
++nRet;
}
@@ -3333,7 +3344,7 @@ sal_uInt16 SwTextFrame::GetParHeight() const
// TODO: Refactor and improve code
const SwLineLayout* pLineLayout = GetPara();
- sal_uInt16 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
+ sal_uInt32 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
// Is this paragraph scrolled? Our height until now is at least
// one line height too low then
@@ -3475,7 +3486,7 @@ void SwTextFrame::CalcAdditionalFirstLineOffset()
nListLevel = MAXLEVEL - 1;
const SwNumFormat& rNumFormat =
- pTextNode->GetNumRule()->Get( static_cast<sal_uInt16>(nListLevel) );
+ pTextNode->GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
if ( rNumFormat.GetPositionAndSpaceMode() != SvxNumberFormat::LABEL_ALIGNMENT )
return;
@@ -3722,7 +3733,7 @@ sal_uInt16 SwTextFrame::FirstLineHeight() const
if ( !HasPara() )
{
if( IsEmpty() && isFrameAreaDefinitionValid() )
- return IsVertical() ? static_cast<sal_uInt16>(getFramePrintArea().Width()) : static_cast<sal_uInt16>(getFramePrintArea().Height());
+ return IsVertical() ? o3tl::narrowing<sal_uInt16>(getFramePrintArea().Width()) : o3tl::narrowing<sal_uInt16>(getFramePrintArea().Height());
return USHRT_MAX;
}
const SwParaPortion *pPara = GetPara();
@@ -4024,4 +4035,15 @@ void SwTextFrame::repaintTextFrames( const SwTextNode& rNode )
}
}
+void SwTextFrame::UpdateOutlineContentVisibilityButton(SwWrtShell* pWrtSh) const
+{
+ if (pWrtSh && pWrtSh->GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
+ GetTextNodeFirst()->IsOutline())
+ {
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
+ rMngr.SetOutlineContentVisibilityButton(this);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 5b4b9f7492e0..c35388bccb24 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -1181,7 +1181,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
if( nDiff < 0 )
{
nLastLeft = pQuo->GetAscent();
- nQuoWidth = static_cast<sal_uInt16>(-nDiff + nLastLeft);
+ nQuoWidth = o3tl::narrowing<sal_uInt16>(-nDiff + nLastLeft);
}
else
{
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 8e8203c72270..d3319dea4a7a 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -40,16 +40,24 @@
* If the tab stop is outside the print area, we
* return 0 if it is not the first tab stop.
*/
-const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos, const SwTwips nRight ) const
+const SvxTabStop* SwLineInfo::GetTabStop(const SwTwips nSearchPos, SwTwips& nRight) const
{
for( sal_uInt16 i = 0; i < m_pRuler->Count(); ++i )
{
const SvxTabStop &rTabStop = m_pRuler->operator[](i);
- if( rTabStop.GetTabPos() > SwTwips(nRight) )
+ if (nRight && rTabStop.GetTabPos() > nRight)
+ {
+ // Consider the first tabstop to always be in-bounds.
+ if (!i)
+ nRight = rTabStop.GetTabPos();
return i ? nullptr : &rTabStop;
-
+ }
if( rTabStop.GetTabPos() > nSearchPos )
+ {
+ if (!i && !nRight)
+ nRight = rTabStop.GetTabPos();
return &rTabStop;
+ }
}
return nullptr;
}
@@ -61,6 +69,10 @@ sal_uInt16 SwLineInfo::NumberOfTabStops() const
SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto ) const
{
+ IDocumentSettingAccess const& rIDSA(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess());
+ const bool bTabOverSpacing = rIDSA.get(DocumentSettingId::TAB_OVER_SPACING);
+ const bool bTabsRelativeToIndent = rIDSA.get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
+
// Update search location - since Center/Decimal tabstops' width is dependent on the following text.
SwTabPortion* pTmpLastTab = rInf.GetLastTab();
if (pTmpLastTab && (pTmpLastTab->IsTabCenterPortion() || pTmpLastTab->IsTabDecimalPortion()))
@@ -78,8 +90,6 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
// nTabLeft: The absolute value, the tab stops are relative to: Tabs origin.
// #i91133#
- const bool bTabsRelativeToIndent =
- m_pFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT);
const SwTwips nTabLeft = bRTL
? m_pFrame->getFrameArea().Right() -
( bTabsRelativeToIndent ? GetTabLeft() : 0 )
@@ -121,6 +131,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
}
SwTwips nNextPos = 0;
+ bool bAbsoluteNextPos = false;
// #i24363# tab stops relative to indent
// nSearchPos: The current position relative to the tabs origin
@@ -132,8 +143,14 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
// any hard set tab stops:
// Note: If there are no user defined tab stops, there is always a
// default tab stop.
+ const SwTwips nOldRight = nMyRight;
+ // Accept left-tabstops beyond the paragraph margin for bTabOverSpacing
+ if (bTabOverSpacing)
+ nMyRight = 0;
const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight );
- if ( pTabStop )
+ if (!nMyRight)
+ nMyRight = nOldRight;
+ if (pTabStop)
{
cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
cDec = pTabStop->GetDecimal();
@@ -144,6 +161,21 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
//calculate default tab position of default tabs in negative indent
nNextPos = ( nSearchPos / nNextPos ) * nNextPos;
}
+ else if (pTabStop->GetTabPos() > nMyRight
+ && pTabStop->GetAdjustment() != SvxTabAdjust::Left)
+ {
+ // A rather special situation. The tabstop found is:
+ // 1.) in a document compatible with MS formats
+ // 2.) not a left tabstop.
+ // 3.) not the first tabstop (in that case nMyRight was adjusted to match tabPos).
+ // 4.) beyond the end of the text area
+ // Therefore, they act like right-tabstops at the edge of the para area.
+ // This benefits DOCX 2013+, and doesn't hurt the earlier formats,
+ // since up till now these were just treated as automatic tabstops.
+ eAdj = SvxTabAdjust::Right;
+ bAbsoluteNextPos = true;
+ nNextPos = rInf.Width();
+ }
bAutoTabStop = false;
}
else
@@ -154,7 +186,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
const SvxTabStopItem& rTab =
m_pFrame->GetAttrSet()->GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
if( rTab.Count() )
- nDefTabDist = static_cast<sal_uInt16>(rTab[0].GetTabPos());
+ nDefTabDist = o3tl::narrowing<sal_uInt16>(rTab[0].GetTabPos());
else
nDefTabDist = SVX_TAB_DEFDIST;
m_aLineInf.SetDefTabStop( nDefTabDist );
@@ -247,7 +279,8 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto
}
}
- nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
+ if (!bAbsoluteNextPos)
+ nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
OSL_ENSURE( nNextPos >= 0, "GetTabStop: Don't go back!" );
nNewTabPos = sal_uInt16(nNextPos);
}
@@ -323,12 +356,14 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" );
// Here we settle down ...
- SetFix( static_cast<sal_uInt16>(rInf.X()) );
+ SetFix( o3tl::narrowing<sal_uInt16>(rInf.X()) );
IDocumentSettingAccess const& rIDSA(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess());
const bool bTabCompat = rIDSA.get(DocumentSettingId::TAB_COMPAT);
const bool bTabOverflow = rIDSA.get(DocumentSettingId::TAB_OVERFLOW);
const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN);
+ const bool bTabOverSpacing = rIDSA.get(DocumentSettingId::TAB_OVER_SPACING);
+ const sal_Int32 nTextFrameWidth = rInf.GetTextFrame()->getFrameArea().Width();
// The minimal width of a tab is one blank at least.
// #i37686# In compatibility mode, the minimum width
@@ -381,13 +416,23 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
case PortionType::TabLeft:
{
// handle this case in PostFormat
- if( bTabOverMargin && !m_bAutoTabStop && GetTabPos() > rInf.Width() )
+ if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > rInf.Width()
+ && (!m_bAutoTabStop || (!bTabOverMargin && rInf.X() > rInf.Width())))
{
- rInf.SetLastTab( this );
- break;
+ if (bTabOverMargin || GetTabPos() < nTextFrameWidth)
+ {
+ rInf.SetLastTab(this);
+ break;
+ }
+ else
+ {
+ assert(!bTabOverMargin && bTabOverSpacing && GetTabPos() >= nTextFrameWidth);
+ bFull = true;
+ break;
+ }
}
- PrtWidth( static_cast<sal_uInt16>(GetTabPos() - rInf.X()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(GetTabPos() - rInf.X()) );
bFull = rInf.Width() <= rInf.X() + PrtWidth();
// In tabulator compatibility mode, we reset the bFull flag
@@ -396,7 +441,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
bool bAtParaEnd = rInf.GetIdx() + GetLen() == TextFrameIndex(rInf.GetText().getLength());
if ( bFull && bTabCompat &&
( ( bTabOverflow && ( rInf.IsTabOverflow() || !m_bAutoTabStop ) ) || bAtParaEnd ) &&
- GetTabPos() >= rInf.GetTextFrame()->getFrameArea().Width() )
+ GetTabPos() >= nTextFrameWidth)
{
bFull = false;
if ( bTabOverflow && !m_bAutoTabStop )
@@ -417,7 +462,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
// line if there is a fly reducing the line width:
!rInf.GetFly() )
{
- PrtWidth( static_cast<sal_uInt16>(rInf.Width() - rInf.X()) );
+ PrtWidth( o3tl::narrowing<sal_uInt16>(rInf.Width() - rInf.X()) );
SetFixWidth( PrtWidth() );
}
else
@@ -443,13 +488,19 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
{
bool bTabOverMargin = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
DocumentSettingId::TAB_OVER_MARGIN);
-
+ bool bTabOverSpacing = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
+ DocumentSettingId::TAB_OVER_SPACING);
if (rInf.GetTextFrame()->IsInSct())
bTabOverMargin = false;
// If the tab position is larger than the right margin, it gets scaled down by default.
// However, if compat mode enabled, we allow tabs to go over the margin: the rest of the paragraph is not broken into lines.
- const sal_uInt16 nRight = bTabOverMargin ? GetTabPos() : std::min(GetTabPos(), rInf.Width());
+ const sal_uInt16 nRight
+ = bTabOverMargin
+ ? GetTabPos()
+ : bTabOverSpacing
+ ? std::min<long>(GetTabPos(), rInf.GetTextFrame()->getFrameArea().Right())
+ : std::min(GetTabPos(), rInf.Width());
const SwLinePortion *pPor = GetNextPortion();
sal_uInt16 nPorWidth = 0;
@@ -462,7 +513,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
const PortionType nWhich = GetWhichPor();
const bool bTabCompat = rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_COMPAT);
- if ( bTabOverMargin && PortionType::TabLeft == nWhich )
+ if ((bTabOverMargin || bTabOverSpacing) && PortionType::TabLeft == nWhich)
{
nPorWidth = 0;
}
@@ -489,7 +540,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
// centered tabs are problematic:
// We have to detect how much fits into the line.
sal_uInt16 nNewWidth = nPorWidth /2;
- if( !bTabOverMargin && nNewWidth > rInf.Width() - nRight )
+ if (!bTabOverMargin && !bTabOverSpacing && nNewWidth > rInf.Width() - nRight)
nNewWidth = nPorWidth - (rInf.Width() - nRight);
nPorWidth = nNewWidth;
}
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index 5a70c7be9507..347f4feae7d9 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -203,7 +203,7 @@ sal_uInt16 SwWrongList::GetWrongPos( sal_Int32 nValue ) const
return (rST.mnPos <= nValue && nValue < rST.mnPos + rST.mnLen)
|| (rST.mnPos > nValue);
});
- return static_cast<sal_uInt16>(std::distance(maList.begin(), aIter));
+ return o3tl::narrowing<sal_uInt16>(std::distance(maList.begin(), aIter));
}
--nMax;
@@ -442,9 +442,9 @@ bool SwWrongList::InvalidateWrong( )
return false;
}
-SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
+std::unique_ptr<SwWrongList> SwWrongList::SplitList( sal_Int32 nSplitPos )
{
- SwWrongList *pRet = nullptr;
+ std::unique_ptr<SwWrongList> pRet;
sal_uInt16 nLst = 0;
while( nLst < Count() && Pos( nLst ) < nSplitPos )
++nLst;
@@ -462,9 +462,9 @@ SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
if( nLst )
{
if( WRONGLIST_GRAMMAR == GetWrongListType() )
- pRet = new SwGrammarMarkUp();
+ pRet.reset(new SwGrammarMarkUp());
else
- pRet = new SwWrongList( GetWrongListType() );
+ pRet.reset(new SwWrongList( GetWrongListType() ));
pRet->Insert(0, maList.begin(), ( nLst >= maList.size() ? maList.end() : maList.begin() + nLst ) );
pRet->SetInvalid( GetBeginInv(), GetEndInv() );
pRet->Invalidate_( nSplitPos ? nSplitPos - 1 : nSplitPos, nSplitPos );
@@ -559,7 +559,7 @@ void SwWrongList::Remove(sal_uInt16 nIdx, sal_uInt16 nLen )
i1 += nIdx;
std::vector<SwWrongArea>::iterator i2 = i1;
- if ( nIdx + nLen >= static_cast<sal_uInt16>(maList.size()) )
+ if ( nIdx + nLen >= o3tl::narrowing<sal_uInt16>(maList.size()) )
i2 = maList.end(); // robust
else
i2 += nLen;
@@ -602,10 +602,10 @@ void SwWrongList::RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd ) {
return (rST.mnPos != nBegin) || ((rST.mnPos + rST.mnLen) != nEnd);
});
}
- auto nDel = static_cast<sal_uInt16>(std::distance(aDelIter, aIter));
+ auto nDel = o3tl::narrowing<sal_uInt16>(std::distance(aDelIter, aIter));
if( nDel )
{
- auto nDelPos = static_cast<sal_uInt16>(std::distance(maList.cbegin(), aDelIter));
+ auto nDelPos = o3tl::narrowing<sal_uInt16>(std::distance(maList.cbegin(), aDelIter));
Remove( nDelPos, nDel );
}
}