[Libreoffice-commits] core.git: 2 commits - sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 31 18:07:27 UTC 2020
sw/source/core/frmedt/fefly1.cxx | 278 +++++------
sw/source/core/frmedt/feshview.cxx | 106 ++--
sw/source/core/frmedt/fews.cxx | 26 -
sw/source/core/frmedt/tblsel.cxx | 22
sw/source/core/graphic/ndgrf.cxx | 208 ++++----
sw/source/core/text/EnhancedPDFExportHelper.cxx | 51 +-
sw/source/core/text/frmform.cxx | 110 ++--
sw/source/core/text/frmpaint.cxx | 30 -
sw/source/core/text/inftxt.cxx | 594 ++++++++++++------------
sw/source/core/text/itrform2.cxx | 160 +++---
sw/source/core/text/porexp.cxx | 24
sw/source/core/text/porfld.cxx | 232 ++++-----
sw/source/core/text/porfly.cxx | 80 +--
sw/source/core/text/porglue.cxx | 48 -
sw/source/core/text/porlay.cxx | 74 +-
sw/source/core/text/pormulti.cxx | 24
sw/source/core/text/porrst.cxx | 136 ++---
sw/source/core/text/redlnitr.cxx | 72 +-
sw/source/core/text/txtdrop.cxx | 36 -
sw/source/core/text/txtfld.cxx | 84 +--
sw/source/core/text/txtfrm.cxx | 284 +++++------
sw/source/core/text/txthyph.cxx | 42 -
sw/source/core/text/txtpaint.cxx | 20
sw/source/core/text/txttab.cxx | 34 -
sw/source/core/text/widorp.cxx | 60 +-
sw/source/core/tox/txmsrt.cxx | 68 +-
26 files changed, 1451 insertions(+), 1452 deletions(-)
New commits:
commit e21042b43ff3fe93440c543b91a052b5a00d3515
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:35:08 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 31 20:06:51 2020 +0200
loplugin:flatten in sw/core/frmedt
Change-Id: I64f743d6f696584ff4c3c9185ae1e8fa42451677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99884
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 24da5bbb72c6..3a31d3a5cc75 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -245,30 +245,30 @@ void SwFEShell::SelectFlyFrame( SwFlyFrame& rFrame )
// The frames should not be selected by the document position, because
// it should have been selected!
SwViewShellImp *pImpl = Imp();
- if( GetWin() )
- {
- OSL_ENSURE( rFrame.IsFlyFrame(), "SelectFlyFrame wants a Fly" );
+ if( !GetWin() )
+ return;
- // nothing to be done if the Fly already was selected
- if (GetSelectedFlyFrame() == &rFrame)
- return;
+ OSL_ENSURE( rFrame.IsFlyFrame(), "SelectFlyFrame wants a Fly" );
- // assure the anchor is drawn
- if( rFrame.IsFlyInContentFrame() && rFrame.GetAnchorFrame() )
- rFrame.GetAnchorFrame()->SetCompletePaint();
+ // nothing to be done if the Fly already was selected
+ if (GetSelectedFlyFrame() == &rFrame)
+ return;
- if( pImpl->GetDrawView()->AreObjectsMarked() )
- pImpl->GetDrawView()->UnmarkAll();
+ // assure the anchor is drawn
+ if( rFrame.IsFlyInContentFrame() && rFrame.GetAnchorFrame() )
+ rFrame.GetAnchorFrame()->SetCompletePaint();
- pImpl->GetDrawView()->MarkObj( rFrame.GetVirtDrawObj(),
- pImpl->GetPageView() );
+ if( pImpl->GetDrawView()->AreObjectsMarked() )
+ pImpl->GetDrawView()->UnmarkAll();
- rFrame.SelectionHasChanged(this);
+ pImpl->GetDrawView()->MarkObj( rFrame.GetVirtDrawObj(),
+ pImpl->GetPageView() );
- KillPams();
- ClearMark();
- SelFlyGrabCursor();
- }
+ rFrame.SelectionHasChanged(this);
+
+ KillPams();
+ ClearMark();
+ SelFlyGrabCursor();
}
// Get selected fly
@@ -882,24 +882,24 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName,
EndAllAction();
- if( pFormat )
- {
- const Point aPt( GetCursorDocPos() );
- SwFlyFrame* pFrame = pFormat->GetFrame( &aPt );
+ if( !pFormat )
+ return;
- if( pFrame )
- {
- // fdo#36681: Invalidate the content and layout to refresh
- // the picture anchoring properly
- SwPageFrame* pPageFrame = pFrame->FindPageFrameOfAnchor();
- pPageFrame->InvalidateFlyLayout();
- pPageFrame->InvalidateContent();
+ const Point aPt( GetCursorDocPos() );
+ SwFlyFrame* pFrame = pFormat->GetFrame( &aPt );
- SelectFlyFrame( *pFrame );
- }
- else
- GetLayout()->SetAssertFlyPages();
+ if( pFrame )
+ {
+ // fdo#36681: Invalidate the content and layout to refresh
+ // the picture anchoring properly
+ SwPageFrame* pPageFrame = pFrame->FindPageFrameOfAnchor();
+ pPageFrame->InvalidateFlyLayout();
+ pPageFrame->InvalidateContent();
+
+ SelectFlyFrame( *pFrame );
}
+ else
+ GetLayout()->SetAssertFlyPages();
}
SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj,
@@ -1167,24 +1167,24 @@ void SwFEShell::ResetFlyFrameAttr( const SfxItemSet* pSet )
SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame();
OSL_ENSURE( pFly, "SetFlyFrameAttr, no Fly selected." );
- if( pFly )
- {
- StartAllAction();
+ if( !pFly )
+ return;
+
+ StartAllAction();
- SfxItemIter aIter( *pSet );
- for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
+ SfxItemIter aIter( *pSet );
+ for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
+ {
+ if( !IsInvalidItem( pItem ) )
{
- if( !IsInvalidItem( pItem ) )
- {
- sal_uInt16 nWhich = pItem->Which();
- if( RES_ANCHOR != nWhich && RES_CHAIN != nWhich && RES_CNTNT != nWhich )
- pFly->GetFormat()->ResetFormatAttr( nWhich );
- }
+ sal_uInt16 nWhich = pItem->Which();
+ if( RES_ANCHOR != nWhich && RES_CHAIN != nWhich && RES_CNTNT != nWhich )
+ pFly->GetFormat()->ResetFormatAttr( nWhich );
}
-
- EndAllActionAndCall();
- GetDoc()->getIDocumentState().SetModified();
}
+
+ EndAllActionAndCall();
+ GetDoc()->getIDocumentState().SetModified();
}
// Returns frame-format if frame, otherwise 0
@@ -1211,38 +1211,38 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
else
pFly = GetSelectedFlyFrame();
OSL_ENSURE( pFly, "SetFrameFormat: no frame" );
- if( pFly )
- {
- StartAllAction();
- CurrShell aCurr( this );
+ if( !pFly )
+ return;
- SwFlyFrameFormat* pFlyFormat = pFly->GetFormat();
- const Point aPt( pFly->getFrameArea().Pos() );
+ StartAllAction();
+ CurrShell aCurr( this );
- std::unique_ptr<SfxItemSet> pSet;
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == pNewFormat->GetItemState( RES_ANCHOR, false, &pItem ))
- {
- pSet.reset(new SfxItemSet( GetDoc()->GetAttrPool(), aFrameFormatSetRange ));
- pSet->Put( *pItem );
- if( !sw_ChkAndSetNewAnchor( *pFly, *pSet ))
- {
- pSet.reset();
- }
- }
+ SwFlyFrameFormat* pFlyFormat = pFly->GetFormat();
+ const Point aPt( pFly->getFrameArea().Pos() );
- if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, pSet.get(), bKeepOrient ))
+ std::unique_ptr<SfxItemSet> pSet;
+ const SfxPoolItem* pItem;
+ if( SfxItemState::SET == pNewFormat->GetItemState( RES_ANCHOR, false, &pItem ))
+ {
+ pSet.reset(new SfxItemSet( GetDoc()->GetAttrPool(), aFrameFormatSetRange ));
+ pSet->Put( *pItem );
+ if( !sw_ChkAndSetNewAnchor( *pFly, *pSet ))
{
- SwFlyFrame* pFrame = pFlyFormat->GetFrame( &aPt );
- if( pFrame )
- SelectFlyFrame( *pFrame );
- else
- GetLayout()->SetAssertFlyPages();
+ pSet.reset();
}
- pSet.reset();
+ }
- EndAllActionAndCall();
+ if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, pSet.get(), bKeepOrient ))
+ {
+ SwFlyFrame* pFrame = pFlyFormat->GetFrame( &aPt );
+ if( pFrame )
+ SelectFlyFrame( *pFrame );
+ else
+ GetLayout()->SetAssertFlyPages();
}
+ pSet.reset();
+
+ EndAllActionAndCall();
}
const SwFrameFormat* SwFEShell::GetFlyFrameFormat() const
@@ -1777,52 +1777,52 @@ void SwFEShell::ReplaceSdrObj( const OUString& rGrfName, const Graphic* pGrf )
CurrShell aCurr( this );
const SdrMarkList *pMrkList;
- if( Imp()->HasDrawView() && 1 ==
- ( pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList())->GetMarkCount() )
- {
- SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
- SwFrameFormat *pFormat = FindFrameFormat( pObj );
+ if( !(Imp()->HasDrawView() && 1 ==
+ ( pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList())->GetMarkCount()) )
+ return;
- // store attributes, then set the graphic
- SfxItemSet aFrameSet( mxDoc->GetAttrPool(),
- pFormat->GetAttrSet().GetRanges() );
- aFrameSet.Set( pFormat->GetAttrSet() );
+ SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ SwFrameFormat *pFormat = FindFrameFormat( pObj );
- // set size and position?
- if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
- {
- // then let's do it:
- const tools::Rectangle &rBound = pObj->GetSnapRect();
- Point aRelPos( pObj->GetRelativePos() );
+ // store attributes, then set the graphic
+ SfxItemSet aFrameSet( mxDoc->GetAttrPool(),
+ pFormat->GetAttrSet().GetRanges() );
+ aFrameSet.Set( pFormat->GetAttrSet() );
- const long nWidth = rBound.Right() - rBound.Left();
- const long nHeight= rBound.Bottom() - rBound.Top();
- aFrameSet.Put( SwFormatFrameSize( SwFrameSize::Minimum,
- std::max( nWidth, long(MINFLY) ),
- std::max( nHeight, long(MINFLY) )));
+ // set size and position?
+ if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
+ {
+ // then let's do it:
+ const tools::Rectangle &rBound = pObj->GetSnapRect();
+ Point aRelPos( pObj->GetRelativePos() );
- if( SfxItemState::SET != aFrameSet.GetItemState( RES_HORI_ORIENT ))
- aFrameSet.Put( SwFormatHoriOrient( aRelPos.getX(), text::HoriOrientation::NONE, text::RelOrientation::FRAME ));
+ const long nWidth = rBound.Right() - rBound.Left();
+ const long nHeight= rBound.Bottom() - rBound.Top();
+ aFrameSet.Put( SwFormatFrameSize( SwFrameSize::Minimum,
+ std::max( nWidth, long(MINFLY) ),
+ std::max( nHeight, long(MINFLY) )));
- if( SfxItemState::SET != aFrameSet.GetItemState( RES_VERT_ORIENT ))
- aFrameSet.Put( SwFormatVertOrient( aRelPos.getY(), text::VertOrientation::NONE, text::RelOrientation::FRAME ));
+ if( SfxItemState::SET != aFrameSet.GetItemState( RES_HORI_ORIENT ))
+ aFrameSet.Put( SwFormatHoriOrient( aRelPos.getX(), text::HoriOrientation::NONE, text::RelOrientation::FRAME ));
- }
+ if( SfxItemState::SET != aFrameSet.GetItemState( RES_VERT_ORIENT ))
+ aFrameSet.Put( SwFormatVertOrient( aRelPos.getY(), text::VertOrientation::NONE, text::RelOrientation::FRAME ));
- pObj->GetOrdNum();
+ }
+
+ pObj->GetOrdNum();
- StartAllAction();
- StartUndo();
+ StartAllAction();
+ StartUndo();
- // delete "Sdr-Object", insert the graphic instead
- DelSelectedObj();
+ // delete "Sdr-Object", insert the graphic instead
+ DelSelectedObj();
- GetDoc()->getIDocumentContentOperations().InsertGraphic(
- *GetCursor(), rGrfName, "", pGrf, &aFrameSet, nullptr, nullptr);
+ GetDoc()->getIDocumentContentOperations().InsertGraphic(
+ *GetCursor(), rGrfName, "", pGrf, &aFrameSet, nullptr, nullptr);
- EndUndo();
- EndAllAction();
- }
+ EndUndo();
+ EndAllAction();
}
static sal_uInt16 SwFormatGetPageNum(const SwFlyFrameFormat * pFormat)
@@ -1961,23 +1961,23 @@ OUString SwFEShell::GetObjTitle() const
void SwFEShell::SetObjTitle( const OUString& rTitle )
{
- if ( Imp()->HasDrawView() )
+ if ( !Imp()->HasDrawView() )
+ return;
+
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() != 1 )
+ return;
+
+ SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ SwFrameFormat* pFormat = FindFrameFormat( pObj );
+ if ( pFormat->Which() == RES_FLYFRMFMT )
{
- const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
- if ( pMrkList->GetMarkCount() == 1 )
- {
- SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
- SwFrameFormat* pFormat = FindFrameFormat( pObj );
- if ( pFormat->Which() == RES_FLYFRMFMT )
- {
- GetDoc()->SetFlyFrameTitle( dynamic_cast<SwFlyFrameFormat&>(*pFormat),
- rTitle );
- }
- else
- {
- pObj->SetTitle( rTitle );
- }
- }
+ GetDoc()->SetFlyFrameTitle( dynamic_cast<SwFlyFrameFormat&>(*pFormat),
+ rTitle );
+ }
+ else
+ {
+ pObj->SetTitle( rTitle );
}
}
@@ -2003,23 +2003,23 @@ OUString SwFEShell::GetObjDescription() const
void SwFEShell::SetObjDescription( const OUString& rDescription )
{
- if ( Imp()->HasDrawView() )
+ if ( !Imp()->HasDrawView() )
+ return;
+
+ const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
+ if ( pMrkList->GetMarkCount() != 1 )
+ return;
+
+ SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
+ SwFrameFormat* pFormat = FindFrameFormat( pObj );
+ if ( pFormat->Which() == RES_FLYFRMFMT )
{
- const SdrMarkList *pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList();
- if ( pMrkList->GetMarkCount() == 1 )
- {
- SdrObject* pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
- SwFrameFormat* pFormat = FindFrameFormat( pObj );
- if ( pFormat->Which() == RES_FLYFRMFMT )
- {
- GetDoc()->SetFlyFrameDescription(dynamic_cast<SwFlyFrameFormat&>(*pFormat),
- rDescription);
- }
- else
- {
- pObj->SetDescription( rDescription );
- }
- }
+ GetDoc()->SetFlyFrameDescription(dynamic_cast<SwFlyFrameFormat&>(*pFormat),
+ rDescription);
+ }
+ else
+ {
+ pObj->SetDescription( rDescription );
}
}
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 115e2cc37b3d..c8cb2ba2ad85 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -740,40 +740,40 @@ void SwFEShell::EndDrag()
{
OSL_ENSURE( Imp()->HasDrawView(), "EndDrag without DrawView?" );
SdrView *pView = Imp()->GetDrawView();
- if ( pView->IsDragObj() )
- {
- for(SwViewShell& rSh : GetRingContainer())
- rSh.StartAction();
+ if ( !pView->IsDragObj() )
+ return;
- StartUndo( SwUndoId::START );
+ for(SwViewShell& rSh : GetRingContainer())
+ rSh.StartAction();
- // #50778# Bug during dragging: In StartAction a HideShowXor is called.
- // In EndDragObj() this is reversed, for no reason and even wrong.
- // To restore consistency we should bring up the Xor again.
+ StartUndo( SwUndoId::START );
- // Reanimation from the hack #50778 to fix bug #97057
- // May be not the best solution, but the one with lowest risc at the moment.
- // pView->ShowShownXor( GetOut() );
+ // #50778# Bug during dragging: In StartAction a HideShowXor is called.
+ // In EndDragObj() this is reversed, for no reason and even wrong.
+ // To restore consistency we should bring up the Xor again.
- pView->EndDragObj();
+ // Reanimation from the hack #50778 to fix bug #97057
+ // May be not the best solution, but the one with lowest risc at the moment.
+ // pView->ShowShownXor( GetOut() );
- // DrawUndo on to flyframes are not stored
- // The flys change the flag.
- GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(true);
- ChgAnchor( RndStdIds::FLY_AT_PARA, true );
+ pView->EndDragObj();
- EndUndo( SwUndoId::END );
+ // DrawUndo on to flyframes are not stored
+ // The flys change the flag.
+ GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(true);
+ ChgAnchor( RndStdIds::FLY_AT_PARA, true );
- for(SwViewShell& rSh : GetRingContainer())
- {
- rSh.EndAction();
- if( dynamic_cast<const SwCursorShell *>(&rSh) != nullptr )
- static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
- }
+ EndUndo( SwUndoId::END );
- GetDoc()->getIDocumentState().SetModified();
- ::FrameNotify( this );
+ for(SwViewShell& rSh : GetRingContainer())
+ {
+ rSh.EndAction();
+ if( dynamic_cast<const SwCursorShell *>(&rSh) != nullptr )
+ static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
}
+
+ GetDoc()->getIDocumentState().SetModified();
+ ::FrameNotify( this );
}
void SwFEShell::BreakDrag()
@@ -1102,39 +1102,39 @@ SdrLayerID SwFEShell::GetLayerId() const
// If <SwFEShell> exists, layout exists!!
void SwFEShell::ChangeOpaque( SdrLayerID nLayerId )
{
- if ( Imp()->HasDrawView() )
+ if ( !Imp()->HasDrawView() )
+ return;
+
+ const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
+ const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess();
+ // correct type of <nControls>
+ for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
{
- const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
- const IDocumentDrawModelAccess& rIDDMA = getIDocumentDrawModelAccess();
- // correct type of <nControls>
- for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
- {
- SdrObject* pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
- if( !pObj )
- continue;
- // or group objects containing controls.
- // --> #i113730#
- // consider that a member of a drawing group has been selected.
- const SwContact* pContact = ::GetUserCall( pObj );
- OSL_ENSURE( pContact && pContact->GetMaster(), "<SwFEShell::ChangeOpaque(..)> - missing contact or missing master object at contact!" );
- const bool bControlObj = ( pContact && pContact->GetMaster() )
- ? ::CheckControlLayer( pContact->GetMaster() )
- : ::CheckControlLayer( pObj );
- if ( !bControlObj && pObj->GetLayer() != nLayerId )
+ SdrObject* pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if( !pObj )
+ continue;
+ // or group objects containing controls.
+ // --> #i113730#
+ // consider that a member of a drawing group has been selected.
+ const SwContact* pContact = ::GetUserCall( pObj );
+ OSL_ENSURE( pContact && pContact->GetMaster(), "<SwFEShell::ChangeOpaque(..)> - missing contact or missing master object at contact!" );
+ const bool bControlObj = ( pContact && pContact->GetMaster() )
+ ? ::CheckControlLayer( pContact->GetMaster() )
+ : ::CheckControlLayer( pObj );
+ if ( !bControlObj && pObj->GetLayer() != nLayerId )
+ {
+ pObj->SetLayer( nLayerId );
+ InvalidateWindows( SwRect( pObj->GetCurrentBoundRect() ) );
+ if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
{
- pObj->SetLayer( nLayerId );
- InvalidateWindows( SwRect( pObj->GetCurrentBoundRect() ) );
- if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
- {
- SwFormat *pFormat = pVirtO->GetFlyFrame()->GetFormat();
- SvxOpaqueItem aOpa( pFormat->GetOpaque() );
- aOpa.SetValue( nLayerId == rIDDMA.GetHellId() );
- pFormat->SetFormatAttr( aOpa );
- }
+ SwFormat *pFormat = pVirtO->GetFlyFrame()->GetFormat();
+ SvxOpaqueItem aOpa( pFormat->GetOpaque() );
+ aOpa.SetValue( nLayerId == rIDDMA.GetHellId() );
+ pFormat->SetFormatAttr( aOpa );
}
}
- GetDoc()->getIDocumentState().SetModified();
}
+ GetDoc()->getIDocumentState().SetModified();
}
void SwFEShell::SelectionToHeaven()
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 8ebb6234f023..662b681dc91c 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -1223,19 +1223,19 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
}
}
- if( !_opRef )
- {
- if( bVertic && !bVerticalL2R )
- _orRect.Pos( aPos.getX() - _orRect.Width() - _orRect.Left(), _orRect.Top() - aPos.getY() );
- else if( bVerticalL2R )
- _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
- else if ( bRTL )
- _orRect.Pos( - ( _orRect.Right() - aPos.getX() ), _orRect.Top() - aPos.getY() );
- else
- _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
- if( _bMirror )
- _orRect.Pos( -_orRect.Right(), _orRect.Top() );
- }
+ if( _opRef )
+ return;
+
+ if( bVertic && !bVerticalL2R )
+ _orRect.Pos( aPos.getX() - _orRect.Width() - _orRect.Left(), _orRect.Top() - aPos.getY() );
+ else if( bVerticalL2R )
+ _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
+ else if ( bRTL )
+ _orRect.Pos( - ( _orRect.Right() - aPos.getX() ), _orRect.Top() - aPos.getY() );
+ else
+ _orRect.Pos( _orRect.Left() - aPos.getX(), _orRect.Top() - aPos.getY() );
+ if( _bMirror )
+ _orRect.Pos( -_orRect.Right(), _orRect.Top() );
}
Size SwFEShell::GetGraphicDefaultSize() const
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 33bc25fc896f..1c0d99c56f72 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2523,22 +2523,22 @@ void FndBox_::MakeNewFrames( SwTable &rTable, const sal_uInt16 nNumber,
// If necessary headlines should be processed. In order to
// not to fragment good code, we iterate once more.
const sal_uInt16 nRowsToRepeat = rTable.GetRowsToRepeat();
- if ( nRowsToRepeat > 0 &&
+ if ( !(nRowsToRepeat > 0 &&
( ( !bBehind && ( nBfPos == USHRT_MAX || nBfPos + 1 < nRowsToRepeat ) ) ||
- ( bBehind && ( ( nBfPos == USHRT_MAX && nRowsToRepeat > 1 ) || nBfPos + 2 < nRowsToRepeat ) ) ) )
+ ( bBehind && ( ( nBfPos == USHRT_MAX && nRowsToRepeat > 1 ) || nBfPos + 2 < nRowsToRepeat ) ) )) )
+ return;
+
+ for ( pTable = aTabIter.First(); pTable; pTable = aTabIter.Next() )
{
- for ( pTable = aTabIter.First(); pTable; pTable = aTabIter.Next() )
+ if ( pTable->Lower() )
{
- if ( pTable->Lower() )
+ if ( pTable->IsFollow() )
{
- if ( pTable->IsFollow() )
- {
- lcl_UpdateRepeatedHeadlines( *pTable, true );
- }
-
- OSL_ENSURE( static_cast<SwRowFrame*>(pTable->Lower())->GetTabLine() ==
- rTable.GetTabLines()[0], "MakeNewFrames: Table corruption!" );
+ lcl_UpdateRepeatedHeadlines( *pTable, true );
}
+
+ OSL_ENSURE( static_cast<SwRowFrame*>(pTable->Lower())->GetTabLine() ==
+ rTable.GetTabLines()[0], "MakeNewFrames: Table corruption!" );
}
}
}
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index bb39141cc49a..2495deaf5636 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -308,48 +308,48 @@ void SwGrfNode::onGraphicChanged()
// when it is set.
SwFlyFrameFormat* pFlyFormat = dynamic_cast< SwFlyFrameFormat* >(GetFlyFormat());
- if(pFlyFormat)
+ if(!pFlyFormat)
+ return;
+
+ OUString aName;
+ OUString aTitle;
+ OUString aDesc;
+ auto const & rVectorGraphicDataPtr = GetGrf().getVectorGraphicData();
+
+ if (rVectorGraphicDataPtr)
{
- OUString aName;
- OUString aTitle;
- OUString aDesc;
- auto const & rVectorGraphicDataPtr = GetGrf().getVectorGraphicData();
+ const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
- if (rVectorGraphicDataPtr)
+ if(!aSequence.empty())
{
- const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
+ drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ drawinglayer::processor2d::ObjectInfoPrimitiveExtractor2D aProcessor(aViewInformation2D);
- if(!aSequence.empty())
- {
- drawinglayer::geometry::ViewInformation2D aViewInformation2D;
- drawinglayer::processor2d::ObjectInfoPrimitiveExtractor2D aProcessor(aViewInformation2D);
-
- aProcessor.process(aSequence);
+ aProcessor.process(aSequence);
- const drawinglayer::primitive2d::ObjectInfoPrimitive2D* pResult = aProcessor.getResult();
+ const drawinglayer::primitive2d::ObjectInfoPrimitive2D* pResult = aProcessor.getResult();
- if(pResult)
- {
- aName = pResult->getName();
- aTitle = pResult->getTitle();
- aDesc = pResult->getDesc();
- }
+ if(pResult)
+ {
+ aName = pResult->getName();
+ aTitle = pResult->getTitle();
+ aDesc = pResult->getDesc();
}
}
+ }
- if(!aTitle.isEmpty())
- {
- SetTitle(aTitle);
- }
- else if (!aName.isEmpty())
- {
- SetTitle(aName);
- }
+ if(!aTitle.isEmpty())
+ {
+ SetTitle(aTitle);
+ }
+ else if (!aName.isEmpty())
+ {
+ SetTitle(aName);
+ }
- if(!aDesc.isEmpty())
- {
- SetDescription(aDesc);
- }
+ if(!aDesc.isEmpty())
+ {
+ SetDescription(aDesc);
}
}
@@ -558,63 +558,63 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName )
mxLink = new SwBaseLink( SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::GDIMETAFILE, this );
IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration();
- if( GetNodes().IsDocNodes() )
+ if( !GetNodes().IsDocNodes() )
+ return;
+
+ mxLink->SetVisible( rIDLA.IsVisibleLinks() );
+ if( rFltName == "DDE" )
{
- mxLink->SetVisible( rIDLA.IsVisibleLinks() );
- if( rFltName == "DDE" )
- {
- sal_Int32 nTmp = 0;
- const OUString sApp{ rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ) };
- const OUString sTopic{ rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ) };
- const OUString sItem{ rGrfName.copy( nTmp ) };
- rIDLA.GetLinkManager().InsertDDELink( mxLink.get(), sApp, sTopic, sItem );
- }
- else
- {
- const bool bSync = rFltName == "SYNCHRON";
- mxLink->SetSynchron( bSync );
- mxLink->SetContentType( SotClipboardFormatId::SVXB );
+ sal_Int32 nTmp = 0;
+ const OUString sApp{ rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ) };
+ const OUString sTopic{ rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ) };
+ const OUString sItem{ rGrfName.copy( nTmp ) };
+ rIDLA.GetLinkManager().InsertDDELink( mxLink.get(), sApp, sTopic, sItem );
+ }
+ else
+ {
+ const bool bSync = rFltName == "SYNCHRON";
+ mxLink->SetSynchron( bSync );
+ mxLink->SetContentType( SotClipboardFormatId::SVXB );
- rIDLA.GetLinkManager().InsertFileLink( *mxLink,
- sfx2::SvBaseLinkObjectType::ClientGraphic, rGrfName,
- (!bSync && !rFltName.isEmpty() ? &rFltName : nullptr) );
- }
+ rIDLA.GetLinkManager().InsertFileLink( *mxLink,
+ sfx2::SvBaseLinkObjectType::ClientGraphic, rGrfName,
+ (!bSync && !rFltName.isEmpty() ? &rFltName : nullptr) );
}
}
void SwGrfNode::ReleaseLink()
{
- if( mxLink.is() )
- {
- Graphic aLocalGraphic(maGrfObj.GetGraphic());
- const bool bHasOriginalData(aLocalGraphic.IsGfxLink());
+ if( !mxLink.is() )
+ return;
- {
- mbInSwapIn = true;
- SwBaseLink* pLink = static_cast<SwBaseLink*>( mxLink.get() );
- pLink->SwapIn( true, true );
- mbInSwapIn = false;
- }
+ Graphic aLocalGraphic(maGrfObj.GetGraphic());
+ const bool bHasOriginalData(aLocalGraphic.IsGfxLink());
- getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
- mxLink.clear();
- aLocalGraphic.setOriginURL("");
-
- // #i15508# added extra processing after getting rid of the link. Use whatever is
- // known from the formerly linked graphic to get to a state as close to a directly
- // unlinked inserted graphic as possible. Goal is to have a valid GfxLink at the
- // ImplGraphic (see there) that holds temporary data to the original data and type
- // information about the original data. Only when this is given will
- // SvXMLGraphicHelper::ImplInsertGraphicURL which is used at export use that type
- // and use the original graphic at export for the ODF, without evtl. recoding
- // of the bitmap graphic data to something without loss (e.g. PNG) but bigger
- if(bHasOriginalData)
- {
- // #i15508# if we have the original data at the Graphic, let it survive
- // by using that Graphic again, this time at a GraphicObject without link.
- // This happens e.g. when inserting a linked graphic and breaking the link
- maGrfObj.SetGraphic(aLocalGraphic);
- }
+ {
+ mbInSwapIn = true;
+ SwBaseLink* pLink = static_cast<SwBaseLink*>( mxLink.get() );
+ pLink->SwapIn( true, true );
+ mbInSwapIn = false;
+ }
+
+ getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
+ mxLink.clear();
+ aLocalGraphic.setOriginURL("");
+
+ // #i15508# added extra processing after getting rid of the link. Use whatever is
+ // known from the formerly linked graphic to get to a state as close to a directly
+ // unlinked inserted graphic as possible. Goal is to have a valid GfxLink at the
+ // ImplGraphic (see there) that holds temporary data to the original data and type
+ // information about the original data. Only when this is given will
+ // SvXMLGraphicHelper::ImplInsertGraphicURL which is used at export use that type
+ // and use the original graphic at export for the ODF, without evtl. recoding
+ // of the bitmap graphic data to something without loss (e.g. PNG) but bigger
+ if(bHasOriginalData)
+ {
+ // #i15508# if we have the original data at the Graphic, let it survive
+ // by using that Graphic again, this time at a GraphicObject without link.
+ // This happens e.g. when inserting a linked graphic and breaking the link
+ maGrfObj.SetGraphic(aLocalGraphic);
}
}
@@ -801,20 +801,20 @@ void SwGrfNode::TriggerAsyncRetrieveInputStream()
return;
}
- if (mpThreadConsumer == nullptr)
- {
- mpThreadConsumer.reset(new SwAsyncRetrieveInputStreamThreadConsumer(*this), o3tl::default_delete<SwAsyncRetrieveInputStreamThreadConsumer>());
+ if (mpThreadConsumer != nullptr)
+ return;
- OUString sGrfNm;
- sfx2::LinkManager::GetDisplayNames( mxLink.get(), nullptr, &sGrfNm );
- OUString sReferer;
- SfxObjectShell * sh = GetDoc()->GetPersist();
- if (sh != nullptr && sh->HasName())
- {
- sReferer = sh->GetMedium()->GetName();
- }
- mpThreadConsumer->CreateThread( sGrfNm, sReferer );
+ mpThreadConsumer.reset(new SwAsyncRetrieveInputStreamThreadConsumer(*this), o3tl::default_delete<SwAsyncRetrieveInputStreamThreadConsumer>());
+
+ OUString sGrfNm;
+ sfx2::LinkManager::GetDisplayNames( mxLink.get(), nullptr, &sGrfNm );
+ OUString sReferer;
+ SfxObjectShell * sh = GetDoc()->GetPersist();
+ if (sh != nullptr && sh->HasName())
+ {
+ sReferer = sh->GetMedium()->GetName();
}
+ mpThreadConsumer->CreateThread( sGrfNm, sReferer );
}
@@ -838,19 +838,19 @@ void SwGrfNode::ApplyInputStream(
void SwGrfNode::UpdateLinkWithInputStream()
{
// do not work on link, if a <SwapIn> has been triggered.
- if ( !mbInSwapIn && IsLinkedFile() )
- {
- GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly );
- GetLink()->Update();
- SwMsgPoolItem aMsgHint( RES_GRAPHIC_ARRIVED );
- ModifyNotification( &aMsgHint, &aMsgHint );
+ if ( !(!mbInSwapIn && IsLinkedFile()) )
+ return;
- // #i88291#
- mxInputStream.clear();
- GetLink()->clearStreamToLoadFrom();
- mbLinkedInputStreamReady = false;
- mpThreadConsumer.reset();
- }
+ GetLink()->setStreamToLoadFrom( mxInputStream, mbIsStreamReadOnly );
+ GetLink()->Update();
+ SwMsgPoolItem aMsgHint( RES_GRAPHIC_ARRIVED );
+ ModifyNotification( &aMsgHint, &aMsgHint );
+
+ // #i88291#
+ mxInputStream.clear();
+ GetLink()->clearStreamToLoadFrom();
+ mbLinkedInputStreamReady = false;
+ mpThreadConsumer.reset();
}
// #i90395#
commit fb8371400e4b2d32b3981b42c910e04f35ab166b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:36:05 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 31 20:06:38 2020 +0200
loplugin:flatten in sw/core/text
Change-Id: I086860cefe9f26c3728fe0d8266c35dae37b9570
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99887
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index b54877aedef6..1fc61a93e765 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -295,46 +295,45 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo,
mpPDFExtOutDevData =
dynamic_cast< vcl::PDFExtOutDevData*>( rOut.GetExtOutDevData() );
- if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() )
- {
+ if ( !(mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF()) )
+ return;
+
#if OSL_DEBUG_LEVEL > 1
- sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
- lcl_DBGCheckStack();
+ sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
+ lcl_DBGCheckStack();
#endif
- if ( mpNumInfo )
- BeginNumberedListStructureElements();
- else if ( mpFrameInfo )
- BeginBlockStructureElements();
- else if ( mpPorInfo )
- BeginInlineStructureElements();
- else
- BeginTag( vcl::PDFWriter::NonStructElement, OUString() );
+ if ( mpNumInfo )
+ BeginNumberedListStructureElements();
+ else if ( mpFrameInfo )
+ BeginBlockStructureElements();
+ else if ( mpPorInfo )
+ BeginInlineStructureElements();
+ else
+ BeginTag( vcl::PDFWriter::NonStructElement, OUString() );
#if OSL_DEBUG_LEVEL > 1
- nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
- lcl_DBGCheckStack();
- (void)nCurrentStruct;
+ nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
+ lcl_DBGCheckStack();
+ (void)nCurrentStruct;
#endif
- }
}
SwTaggedPDFHelper::~SwTaggedPDFHelper()
{
- if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() )
- {
+ if ( !(mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF()) )
+ return;
+
#if OSL_DEBUG_LEVEL > 1
- sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
- lcl_DBGCheckStack();
+ sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
+ lcl_DBGCheckStack();
#endif
- EndStructureElements();
+ EndStructureElements();
#if OSL_DEBUG_LEVEL > 1
- nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
- lcl_DBGCheckStack();
- (void)nCurrentStruct;
+ nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement();
+ lcl_DBGCheckStack();
+ (void)nCurrentStruct;
#endif
-
- }
}
bool SwTaggedPDFHelper::CheckReopenTag()
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 71e417c3ad54..8513f33b078c 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -116,20 +116,20 @@ void SwTextFrame::ValidateFrame()
static void ValidateBodyFrame_( SwFrame *pFrame )
{
vcl::RenderContext* pRenderContext = pFrame ? pFrame->getRootFrame()->GetCurrShell()->GetOut() : nullptr;
- if( pFrame && !pFrame->IsCellFrame() )
+ if( !(pFrame && !pFrame->IsCellFrame()) )
+ return;
+
+ if( !pFrame->IsBodyFrame() && pFrame->GetUpper() )
+ ValidateBodyFrame_( pFrame->GetUpper() );
+ if( !pFrame->IsSctFrame() )
+ pFrame->Calc(pRenderContext);
+ else
{
- if( !pFrame->IsBodyFrame() && pFrame->GetUpper() )
- ValidateBodyFrame_( pFrame->GetUpper() );
- if( !pFrame->IsSctFrame() )
- pFrame->Calc(pRenderContext);
- else
- {
- const bool bOld = static_cast<SwSectionFrame*>(pFrame)->IsContentLocked();
- static_cast<SwSectionFrame*>(pFrame)->SetContentLock( true );
- pFrame->Calc(pRenderContext);
- if( !bOld )
- static_cast<SwSectionFrame*>(pFrame)->SetContentLock( false );
- }
+ const bool bOld = static_cast<SwSectionFrame*>(pFrame)->IsContentLocked();
+ static_cast<SwSectionFrame*>(pFrame)->SetContentLock( true );
+ pFrame->Calc(pRenderContext);
+ if( !bOld )
+ static_cast<SwSectionFrame*>(pFrame)->SetContentLock( false );
}
}
@@ -338,22 +338,22 @@ void SwTextFrame::MakePos()
{
SwFrame::MakePos();
// Inform LOK clients about change in position of redlines (if any)
- if(comphelper::LibreOfficeKit::isActive())
+ if(!comphelper::LibreOfficeKit::isActive())
+ return;
+
+ SwTextNode const* pTextNode = GetTextNodeFirst();
+ const SwRedlineTable& rTable = pTextNode->getIDocumentRedlineAccess().GetRedlineTable();
+ for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos)
{
- SwTextNode const* pTextNode = GetTextNodeFirst();
- const SwRedlineTable& rTable = pTextNode->getIDocumentRedlineAccess().GetRedlineTable();
- for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos)
+ SwRangeRedline* pRedln = rTable[nRedlnPos];
+ if (pTextNode->GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex())
{
- SwRangeRedline* pRedln = rTable[nRedlnPos];
- if (pTextNode->GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex())
+ pRedln->MaybeNotifyRedlinePositionModification(getFrameArea().Top());
+ if (GetMergedPara()
+ && pRedln->GetType() == RedlineType::Delete
+ && pRedln->GetPoint()->nNode != pRedln->GetMark()->nNode)
{
- pRedln->MaybeNotifyRedlinePositionModification(getFrameArea().Top());
- if (GetMergedPara()
- && pRedln->GetType() == RedlineType::Delete
- && pRedln->GetPoint()->nNode != pRedln->GetMark()->nNode)
- {
- pTextNode = pRedln->End()->nNode.GetNode().GetTextNode();
- }
+ pTextNode = pRedln->End()->nNode.GetNode().GetTextNode();
}
}
}
@@ -1603,24 +1603,24 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
}
}
- if( !rInf.IsTest() )
+ if( rInf.IsTest() )
+ return;
+
+ // FormatAdjust does not pay off at OnceMore
+ if( bAdjust || !rLine.GetDropFormat() || !rLine.CalcOnceMore() )
{
- // FormatAdjust does not pay off at OnceMore
- if( bAdjust || !rLine.GetDropFormat() || !rLine.CalcOnceMore() )
- {
- FormatAdjust( rLine, aFrameBreak, nStrLen, rInf.IsStop() );
- }
- if( rRepaint.HasArea() )
- SetRepaint();
- rLine.SetTruncLines( false );
- if( nOldBottom ) // We check whether paragraphs that need scrolling can
- // be shrunk, so that they don't need scrolling anymore
- {
- rLine.Bottom();
- SwTwips nNewBottom = rLine.Y();
- if( nNewBottom < nOldBottom )
- SetOffset_(TextFrameIndex(0));
- }
+ FormatAdjust( rLine, aFrameBreak, nStrLen, rInf.IsStop() );
+ }
+ if( rRepaint.HasArea() )
+ SetRepaint();
+ rLine.SetTruncLines( false );
+ if( nOldBottom ) // We check whether paragraphs that need scrolling can
+ // be shrunk, so that they don't need scrolling anymore
+ {
+ rLine.Bottom();
+ SwTwips nNewBottom = rLine.Y();
+ if( nNewBottom < nOldBottom )
+ SetOffset_(TextFrameIndex(0));
}
}
@@ -1726,20 +1726,20 @@ void SwTextFrame::Format_( vcl::RenderContext* pRenderContext, SwParaPortion *pP
OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Format_" );
- if( 1 < aLine.GetDropLines() )
+ if( 1 >= aLine.GetDropLines() )
+ return;
+
+ if( SvxAdjust::Left != aLine.GetAdjust() &&
+ SvxAdjust::Block != aLine.GetAdjust() )
{
- if( SvxAdjust::Left != aLine.GetAdjust() &&
- SvxAdjust::Block != aLine.GetAdjust() )
- {
- aLine.CalcDropAdjust();
- aLine.SetPaintDrop( true );
- }
+ aLine.CalcDropAdjust();
+ aLine.SetPaintDrop( true );
+ }
- if( aLine.IsPaintDrop() )
- {
- aLine.CalcDropRepaint();
- aLine.SetPaintDrop( false );
- }
+ if( aLine.IsPaintDrop() )
+ {
+ aLine.CalcDropRepaint();
+ aLine.SetPaintDrop( false );
}
}
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index ea54168b379f..4704b55044e4 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -160,23 +160,23 @@ SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh,
m_nX += pFrame->getFrameArea().Width() + m_rLineInf.GetPosFromLeft();
}
}
- if( eHor != text::HoriOrientation::NONE )
+ if( eHor == text::HoriOrientation::NONE )
+ return;
+
+ if( text::HoriOrientation::INSIDE == eHor || text::HoriOrientation::OUTSIDE == eHor )
{
- if( text::HoriOrientation::INSIDE == eHor || text::HoriOrientation::OUTSIDE == eHor )
- {
- if (!oIsRightPage)
- oIsRightPage = pFrame->FindPageFrame()->OnRightPage();
- if (*oIsRightPage)
- eHor = eHor == text::HoriOrientation::INSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
- else
- eHor = eHor == text::HoriOrientation::OUTSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
- }
- const SwFrame* pTmpFrame = pFrame->FindTabFrame();
- if( !pTmpFrame )
- pTmpFrame = pFrame;
- m_nRedX = text::HoriOrientation::LEFT == eHor ? pTmpFrame->getFrameArea().Left() - REDLINE_DISTANCE :
- pTmpFrame->getFrameArea().Right() + REDLINE_DISTANCE;
+ if (!oIsRightPage)
+ oIsRightPage = pFrame->FindPageFrame()->OnRightPage();
+ if (*oIsRightPage)
+ eHor = eHor == text::HoriOrientation::INSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
+ else
+ eHor = eHor == text::HoriOrientation::OUTSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
}
+ const SwFrame* pTmpFrame = pFrame->FindTabFrame();
+ if( !pTmpFrame )
+ pTmpFrame = pFrame;
+ m_nRedX = text::HoriOrientation::LEFT == eHor ? pTmpFrame->getFrameArea().Left() - REDLINE_DISTANCE :
+ pTmpFrame->getFrameArea().Right() + REDLINE_DISTANCE;
}
void SwExtraPainter::PaintExtra( SwTwips nY, long nAsc, long nMax, bool bRed )
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index a6903b9aab75..a167af3ce922 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -976,42 +976,42 @@ void SwTextPaintInfo::DrawRect( const SwRect &rRect, bool bRetouche ) const
void SwTextPaintInfo::DrawTab( const SwLinePortion &rPor ) const
{
- if( OnWin() )
- {
- SwRect aRect;
- CalcRect( rPor, &aRect );
+ if( !OnWin() )
+ return;
- if ( ! aRect.HasArea() )
- return;
+ SwRect aRect;
+ CalcRect( rPor, &aRect );
+
+ if ( ! aRect.HasArea() )
+ return;
- const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB;
- const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE;
+ const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ? CHAR_TAB_RTL : CHAR_TAB;
+ const sal_uInt8 nOptions = DRAW_SPECIAL_OPTIONS_CENTER | DRAW_SPECIAL_OPTIONS_ROTATE;
- lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
- }
+ lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
}
void SwTextPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
{
- if( OnWin() )
- {
- sal_uInt16 nOldWidth = rPor.Width();
- const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
+ if( !OnWin() )
+ return;
- SwRect aRect;
- CalcRect( rPor, &aRect );
+ sal_uInt16 nOldWidth = rPor.Width();
+ const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
- if( aRect.HasArea() )
- {
- const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ?
- CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
- const sal_uInt8 nOptions = 0;
+ SwRect aRect;
+ CalcRect( rPor, &aRect );
- lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
- }
+ if( aRect.HasArea() )
+ {
+ const sal_Unicode cChar = GetTextFrame()->IsRightToLeft() ?
+ CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
+ const sal_uInt8 nOptions = 0;
- const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
+ lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
}
+
+ const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
}
void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
@@ -1098,31 +1098,31 @@ void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool
{
SwRect aIntersect;
CalcRect( rPor, &aIntersect );
- if ( aIntersect.HasArea() )
+ if ( !aIntersect.HasArea() )
+ return;
+
+ if (OnWin() && SwViewOption::IsFieldShadings() &&
+ !GetOpt().IsPagePreview())
{
- if (OnWin() && SwViewOption::IsFieldShadings() &&
- !GetOpt().IsPagePreview())
- {
- OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
- pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
- pOut->SetLineColor();
- pOut->DrawRect( aIntersect.SVRect() );
- pOut->Pop();
- }
- const int delta=10;
- tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
- m_pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- m_pOut->SetLineColor( Color(0, 0, 0));
- m_pOut->SetFillColor();
- m_pOut->DrawRect( r );
- if (bChecked)
- {
- m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
- m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
- }
- m_pOut->Pop();
+ OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
+ pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ pOut->SetLineColor();
+ pOut->DrawRect( aIntersect.SVRect() );
+ pOut->Pop();
}
+ const int delta=10;
+ tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta);
+ m_pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ m_pOut->SetLineColor( Color(0, 0, 0));
+ m_pOut->SetFillColor();
+ m_pOut->DrawRect( r );
+ if (bChecked)
+ {
+ m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
+ m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
+ }
+ m_pOut->Pop();
}
void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
@@ -1132,25 +1132,25 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
SwRect aIntersect;
CalcRect( rPor, nullptr, &aIntersect, true );
- if ( aIntersect.HasArea() )
- {
- OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
- pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ if ( !aIntersect.HasArea() )
+ return;
- // For dark background we do not want to have a filled rectangle
- if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
- {
- pOut->SetLineColor( SwViewOption::GetFontColor() );
- }
- else
- {
- pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
- pOut->SetLineColor();
- }
+ OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
+ pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- DrawRect( aIntersect, true );
- pOut->Pop();
+ // For dark background we do not want to have a filled rectangle
+ if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) )
+ {
+ pOut->SetLineColor( SwViewOption::GetFontColor() );
+ }
+ else
+ {
+ pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
+ pOut->SetLineColor();
}
+
+ DrawRect( aIntersect, true );
+ pOut->Pop();
}
void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
@@ -1187,117 +1187,117 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
SwRect aIntersect;
CalcRect( rPor, nullptr, &aIntersect, true );
- if ( aIntersect.HasArea() )
- {
- OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
+ if ( !aIntersect.HasArea() )
+ return;
- // #i16816# tagged pdf support
- SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
+ OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
- Color aFillColor;
+ // #i16816# tagged pdf support
+ SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pTmpOut );
- if( m_pFnt->GetHighlightColor() != COL_TRANSPARENT )
- {
- aFillColor = m_pFnt->GetHighlightColor();
- }
- else
- {
- if( !m_pFnt->GetBackColor() )
- return;
- aFillColor = *m_pFnt->GetBackColor();
- }
+ Color aFillColor;
- // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
- // for LTR mode only
- if ( !GetTextFrame()->IsRightToLeft() )
+ if( m_pFnt->GetHighlightColor() != COL_TRANSPARENT )
+ {
+ aFillColor = m_pFnt->GetHighlightColor();
+ }
+ else
+ {
+ if( !m_pFnt->GetBackColor() )
+ return;
+ aFillColor = *m_pFnt->GetBackColor();
+ }
+
+ // tdf#104349 do not highlight portions of space chars before end of line if the compatibility option is enabled
+ // for LTR mode only
+ if ( !GetTextFrame()->IsRightToLeft() )
+ {
+ if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
{
- if (GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS))
- {
- bool draw = false;
- bool full = false;
- SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
- TextFrameIndex nIdx = GetIdx();
- TextFrameIndex nLen;
+ bool draw = false;
+ bool full = false;
+ SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
+ TextFrameIndex nIdx = GetIdx();
+ TextFrameIndex nLen;
- do
+ do
+ {
+ nLen = pPos->GetLen();
+ for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
{
- nLen = pPos->GetLen();
- for (TextFrameIndex i = nIdx; i < (nIdx + nLen); ++i)
+ if (i < TextFrameIndex(GetText().getLength())
+ && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
{
- if (i < TextFrameIndex(GetText().getLength())
- && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
+ if ( i >= (GetIdx() + rPor.GetLen()) )
{
- if ( i >= (GetIdx() + rPor.GetLen()) )
- {
- goto drawcontinue;
- }
+ goto drawcontinue;
}
- if (i >= TextFrameIndex(GetText().getLength())
- || GetText()[sal_Int32(i)] != CH_BLANK)
+ }
+ if (i >= TextFrameIndex(GetText().getLength())
+ || GetText()[sal_Int32(i)] != CH_BLANK)
+ {
+ draw = true;
+ if ( i >= (GetIdx() + rPor.GetLen()) )
{
- draw = true;
- if ( i >= (GetIdx() + rPor.GetLen()) )
- {
- full = true;
- goto drawcontinue;
- }
+ full = true;
+ goto drawcontinue;
}
}
- nIdx += nLen;
- pPos = pPos->GetNextPortion();
- } while ( pPos );
+ }
+ nIdx += nLen;
+ pPos = pPos->GetNextPortion();
+ } while ( pPos );
- drawcontinue:
+ drawcontinue:
- if ( !draw )
- return;
+ if ( !draw )
+ return;
- if ( !full )
- {
- pPos = const_cast<SwLinePortion *>(&rPor);
- nIdx = GetIdx();
+ if ( !full )
+ {
+ pPos = const_cast<SwLinePortion *>(&rPor);
+ nIdx = GetIdx();
- nLen = pPos->GetLen();
- for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
- i >= nIdx; --i)
+ nLen = pPos->GetLen();
+ for (TextFrameIndex i = nIdx + nLen - TextFrameIndex(1);
+ i >= nIdx; --i)
+ {
+ if (i < TextFrameIndex(GetText().getLength())
+ && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
{
- if (i < TextFrameIndex(GetText().getLength())
- && GetText()[sal_Int32(i)] == CH_TXTATR_NEWLINE)
- {
- continue;
- }
- if (i >= TextFrameIndex(GetText().getLength())
- || GetText()[sal_Int32(i)] != CH_BLANK)
- {
- sal_uInt16 nOldWidth = rPor.Width();
- sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
- GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
-
- const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
- CalcRect( rPor, nullptr, &aIntersect, true );
- const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
+ continue;
+ }
+ if (i >= TextFrameIndex(GetText().getLength())
+ || GetText()[sal_Int32(i)] != CH_BLANK)
+ {
+ sal_uInt16 nOldWidth = rPor.Width();
+ sal_uInt16 nNewWidth = GetTextSize(m_pOut, nullptr,
+ GetText(), nIdx, (i + TextFrameIndex(1) - nIdx)).Width();
- if ( !aIntersect.HasArea() )
- {
- return;
- }
+ const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
+ CalcRect( rPor, nullptr, &aIntersect, true );
+ const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
- break;
+ if ( !aIntersect.HasArea() )
+ {
+ return;
}
+
+ break;
}
}
}
}
+ }
- pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+ pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
- pTmpOut->SetFillColor(aFillColor);
- pTmpOut->SetLineColor();
+ pTmpOut->SetFillColor(aFillColor);
+ pTmpOut->SetLineColor();
- DrawRect( aIntersect, false );
+ DrawRect( aIntersect, false );
- pTmpOut->Pop();
- }
+ pTmpOut->Pop();
}
void SwTextPaintInfo::DrawBorder( const SwLinePortion &rPor ) const
@@ -1315,58 +1315,58 @@ void SwTextPaintInfo::DrawBorder( const SwLinePortion &rPor ) const
void SwTextPaintInfo::DrawViewOpt( const SwLinePortion &rPor,
PortionType nWhich ) const
{
- if( OnWin() && !IsMulti() )
+ if( !(OnWin() && !IsMulti()) )
+ return;
+
+ bool bDraw = false;
+ switch( nWhich )
{
- bool bDraw = false;
- switch( nWhich )
+ case PortionType::Footnote:
+ case PortionType::QuoVadis:
+ case PortionType::Number:
+ case PortionType::Field:
+ case PortionType::Hidden:
+ case PortionType::Tox:
+ case PortionType::Ref:
+ case PortionType::Meta:
+ case PortionType::ControlChar:
+ if ( !GetOpt().IsPagePreview()
+ && !GetOpt().IsReadonly()
+ && SwViewOption::IsFieldShadings()
+ && ( PortionType::Number != nWhich
+ || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
{
- case PortionType::Footnote:
- case PortionType::QuoVadis:
- case PortionType::Number:
- case PortionType::Field:
- case PortionType::Hidden:
- case PortionType::Tox:
- case PortionType::Ref:
- case PortionType::Meta:
- case PortionType::ControlChar:
- if ( !GetOpt().IsPagePreview()
- && !GetOpt().IsReadonly()
- && SwViewOption::IsFieldShadings()
- && ( PortionType::Number != nWhich
- || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) // #i27615#
- {
- bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
- }
- break;
- case PortionType::Bookmark:
- // no shading
- break;
- case PortionType::InputField:
- // input field shading also in read-only mode
- if ( !GetOpt().IsPagePreview()
- && SwViewOption::IsFieldShadings() )
- {
- bDraw = true;
- }
- break;
- case PortionType::Table:
- if ( GetOpt().IsTab() ) bDraw = true;
- break;
- case PortionType::SoftHyphen:
- if ( GetOpt().IsSoftHyph() )bDraw = true;
- break;
- case PortionType::Blank:
- if ( GetOpt().IsHardBlank())bDraw = true;
+ bDraw = PortionType::Footnote != nWhich || m_pFrame->IsFootnoteAllowed();
+ }
+ break;
+ case PortionType::Bookmark:
+ // no shading
+ break;
+ case PortionType::InputField:
+ // input field shading also in read-only mode
+ if ( !GetOpt().IsPagePreview()
+ && SwViewOption::IsFieldShadings() )
+ {
+ bDraw = true;
+ }
+ break;
+ case PortionType::Table:
+ if ( GetOpt().IsTab() ) bDraw = true;
+ break;
+ case PortionType::SoftHyphen:
+ if ( GetOpt().IsSoftHyph() )bDraw = true;
+ break;
+ case PortionType::Blank:
+ if ( GetOpt().IsHardBlank())bDraw = true;
+ break;
+ default:
+ {
+ OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
break;
- default:
- {
- OSL_ENSURE( false, "SwTextPaintInfo::DrawViewOpt: don't know how to draw this" );
- break;
- }
}
- if ( bDraw )
- DrawBackground( rPor );
}
+ if ( bDraw )
+ DrawBackground( rPor );
}
static void lcl_InitHyphValues( PropertyValues &rVals,
@@ -1816,97 +1816,97 @@ SwTextSlot::SwTextSlot(
}
// The text is replaced ...
- if( bOn )
+ if( !bOn )
+ return;
+
+ pInf = const_cast<SwTextSizeInfo*>(pNew);
+ nIdx = pInf->GetIdx();
+ nLen = pInf->GetLen();
+ pOldText = &(pInf->GetText());
+ m_pOldCachedVclData = pInf->GetCachedVclData();
+ pInf->SetText( aText );
+ pInf->SetIdx(TextFrameIndex(0));
+ pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
+ pInf->SetCachedVclData(nullptr);
+
+ // ST2
+ if ( !bExgLists )
+ return;
+
+ m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
+ if (m_pOldSmartTagList)
{
- pInf = const_cast<SwTextSizeInfo*>(pNew);
- nIdx = pInf->GetIdx();
- nLen = pInf->GetLen();
- pOldText = &(pInf->GetText());
- m_pOldCachedVclData = pInf->GetCachedVclData();
- pInf->SetText( aText );
- pInf->SetIdx(TextFrameIndex(0));
- pInf->SetLen(bTextLen ? TextFrameIndex(pInf->GetText().getLength()) : pPor->GetLen());
- pInf->SetCachedVclData(nullptr);
-
- // ST2
- if ( bExgLists )
+ std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
+ SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
+ if (pSmartTags)
{
- m_pOldSmartTagList = static_cast<SwTextPaintInfo*>(pInf)->GetSmartTags();
- if (m_pOldSmartTagList)
+ const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
+ const sal_Int32 nListPos = pSmartTags->Pos(nPos);
+ if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
{
- std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
- SwWrongList const*const pSmartTags(pos.first->GetSmartTags());
- if (pSmartTags)
- {
- const sal_uInt16 nPos = pSmartTags->GetWrongPos(pos.second);
- const sal_Int32 nListPos = pSmartTags->Pos(nPos);
- if (nListPos == pos.second && pSmartTags->SubList(nPos) != nullptr)
- {
- m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
- static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
- }
- else if (!m_pTempList && nPos < pSmartTags->Count()
- && nListPos < pos.second && !aText.isEmpty())
- {
- m_pTempList.reset(new SwWrongList( WRONGLIST_SMARTTAG ));
- m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
- m_pTempIter.reset(new sw::WrongListIterator(*m_pTempList));
- static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
- }
- else
- static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
- }
- else
- static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
+ m_pTempIter.reset(new sw::WrongListIterator(*pSmartTags->SubList(nPos)));
+ static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
}
- m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
- if (m_pOldGrammarCheckList)
+ else if (!m_pTempList && nPos < pSmartTags->Count()
+ && nListPos < pos.second && !aText.isEmpty())
{
- std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
- SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
- if (pGrammar)
- {
- const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
- const sal_Int32 nListPos = pGrammar->Pos(nPos);
- if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
- {
- m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
- static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
- }
- else if (!m_pTempList && nPos < pGrammar->Count()
- && nListPos < pos.second && !aText.isEmpty())
- {
- m_pTempList.reset(new SwWrongList( WRONGLIST_GRAMMAR ));
- m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
- m_pTempIter.reset(new sw::WrongListIterator(*m_pTempList));
- static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
- }
- else
- static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
- }
- else
- static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
+ m_pTempList.reset(new SwWrongList( WRONGLIST_SMARTTAG ));
+ m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
+ m_pTempIter.reset(new sw::WrongListIterator(*m_pTempList));
+ static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pTempIter.get());
}
+ else
+ static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
}
+ else
+ static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(nullptr);
}
+ m_pOldGrammarCheckList = static_cast<SwTextPaintInfo*>(pInf)->GetGrammarCheckList();
+ if (!m_pOldGrammarCheckList)
+ return;
+
+ std::pair<SwTextNode const*, sal_Int32> pos(pNew->GetTextFrame()->MapViewToModel(nIdx));
+ SwWrongList const*const pGrammar(pos.first->GetGrammarCheck());
+ if (pGrammar)
+ {
+ const sal_uInt16 nPos = pGrammar->GetWrongPos(pos.second);
+ const sal_Int32 nListPos = pGrammar->Pos(nPos);
+ if (nListPos == pos.second && pGrammar->SubList(nPos) != nullptr)
+ {
+ m_pTempIter.reset(new sw::WrongListIterator(*pGrammar->SubList(nPos)));
+ static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
+ }
+ else if (!m_pTempList && nPos < pGrammar->Count()
+ && nListPos < pos.second && !aText.isEmpty())
+ {
+ m_pTempList.reset(new SwWrongList( WRONGLIST_GRAMMAR ));
+ m_pTempList->Insert( OUString(), nullptr, 0, aText.getLength(), 0 );
+ m_pTempIter.reset(new sw::WrongListIterator(*m_pTempList));
+ static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pTempIter.get());
+ }
+ else
+ static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
+ }
+ else
+ static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(nullptr);
}
SwTextSlot::~SwTextSlot()
{
- if( bOn )
- {
- pInf->SetCachedVclData(m_pOldCachedVclData);
- pInf->SetText( *pOldText );
- pInf->SetIdx( nIdx );
- pInf->SetLen( nLen );
-
- // ST2
- // Restore old smart tag list
- if (m_pOldSmartTagList)
- static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
- if (m_pOldGrammarCheckList)
- static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
- }
+ if( !bOn )
+ return;
+
+ pInf->SetCachedVclData(m_pOldCachedVclData);
+ pInf->SetText( *pOldText );
+ pInf->SetIdx( nIdx );
+ pInf->SetLen( nLen );
+
+ // ST2
+ // Restore old smart tag list
+ if (m_pOldSmartTagList)
+ static_cast<SwTextPaintInfo*>(pInf)->SetSmartTags(m_pOldSmartTagList);
+ if (m_pOldGrammarCheckList)
+ static_cast<SwTextPaintInfo*>(pInf)->SetGrammarCheckList(m_pOldGrammarCheckList);
}
SwFontSave::SwFontSave(const SwTextSizeInfo &rInf, SwFont *pNew,
@@ -1915,33 +1915,33 @@ SwFontSave::SwFontSave(const SwTextSizeInfo &rInf, SwFont *pNew,
, pFnt(pNew ? const_cast<SwTextSizeInfo&>(rInf).GetFont() : nullptr)
, pIter(nullptr)
{
- if( pFnt )
+ if( !pFnt )
+ return;
+
+ pInf = &const_cast<SwTextSizeInfo&>(rInf);
+ // In these cases we temporarily switch to the new font:
+ // 1. the fonts have a different magic number
+ // 2. they have different script types
+ // 3. their background colors differ (this is not covered by 1.)
+ if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
+ pNew->GetActual() != pFnt->GetActual() ||
+ ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
+ ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
+ ( pNew->GetBackColor() && pFnt->GetBackColor() &&
+ ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
{
- pInf = &const_cast<SwTextSizeInfo&>(rInf);
- // In these cases we temporarily switch to the new font:
- // 1. the fonts have a different magic number
- // 2. they have different script types
- // 3. their background colors differ (this is not covered by 1.)
- if( pFnt->DifferentFontCacheId( pNew, pFnt->GetActual() ) ||
- pNew->GetActual() != pFnt->GetActual() ||
- ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
- ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
- ( pNew->GetBackColor() && pFnt->GetBackColor() &&
- ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
- {
- pNew->SetTransparent( true );
- pNew->SetAlign( ALIGN_BASELINE );
- pInf->SetFont( pNew );
- }
- else
- pFnt = nullptr;
- pNew->Invalidate();
- pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
- if( pItr && pItr->GetFnt() == pFnt )
- {
- pIter = pItr;
- pIter->SetFnt( pNew );
- }
+ pNew->SetTransparent( true );
+ pNew->SetAlign( ALIGN_BASELINE );
+ pInf->SetFont( pNew );
+ }
+ else
+ pFnt = nullptr;
+ pNew->Invalidate();
+ pNew->ChgPhysFnt( pInf->GetVsh(), *pInf->GetOut() );
+ if( pItr && pItr->GetFnt() == pFnt )
+ {
+ pIter = pItr;
+ pIter->SetFnt( pNew );
}
}
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index aec314e56b8b..fd7bdc577efb 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2635,111 +2635,111 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
but we have handle them just like portions */
void SwTextFormatter::MergeCharacterBorder( SwDropPortion const & rPortion )
{
- if( rPortion.GetLines() > 1 )
+ if( rPortion.GetLines() <= 1 )
+ return;
+
+ SwDropPortionPart* pCurrPart = rPortion.GetPart();
+ while( pCurrPart )
{
- SwDropPortionPart* pCurrPart = rPortion.GetPart();
- while( pCurrPart )
+ if( pCurrPart->GetFollow() &&
+ ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont()) )
{
- if( pCurrPart->GetFollow() &&
- ::lcl_HasSameBorder(pCurrPart->GetFont(), pCurrPart->GetFollow()->GetFont()) )
- {
- pCurrPart->SetJoinBorderWithNext(true);
- pCurrPart->GetFollow()->SetJoinBorderWithPrev(true);
- }
- pCurrPart = pCurrPart->GetFollow();
+ pCurrPart->SetJoinBorderWithNext(true);
+ pCurrPart->GetFollow()->SetJoinBorderWithPrev(true);
}
+ pCurrPart = pCurrPart->GetFollow();
}
}
void SwTextFormatter::MergeCharacterBorder( SwLinePortion& rPortion, SwLinePortion const *pPrev, SwTextFormatInfo& rInf )
{
const SwFont aCurFont = *rInf.GetFont();
- if( aCurFont.HasBorder() )
+ if( !aCurFont.HasBorder() )
+ return;
+
+ if (pPrev && pPrev->GetJoinBorderWithNext() )
{
- if (pPrev && pPrev->GetJoinBorderWithNext() )
+ // In some case border merge is called twice to the portion
+ if( !rPortion.GetJoinBorderWithPrev() )
{
- // In some case border merge is called twice to the portion
- if( !rPortion.GetJoinBorderWithPrev() )
- {
- rPortion.SetJoinBorderWithPrev(true);
- if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetLeftBorderSpace() )
- rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
- }
- }
- else
- {
- rPortion.SetJoinBorderWithPrev(false);
- m_pFirstOfBorderMerge = &rPortion;
+ rPortion.SetJoinBorderWithPrev(true);
+ if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetLeftBorderSpace() )
+ rPortion.Width(rPortion.Width() - aCurFont.GetLeftBorderSpace());
}
+ }
+ else
+ {
+ rPortion.SetJoinBorderWithPrev(false);
+ m_pFirstOfBorderMerge = &rPortion;
+ }
- // Get next portion's font
- bool bSeek = false;
- if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
- rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
- {
- bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
- }
- // Don't join the next portion if SwKernPortion sits between two different boxes.
- bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
- // If next portion has the same border then merge
- if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) && !bDisconnect )
+ // Get next portion's font
+ bool bSeek = false;
+ if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
+ rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
+ {
+ bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
+ }
+ // Don't join the next portion if SwKernPortion sits between two different boxes.
+ bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
+ // If next portion has the same border then merge
+ if( bSeek && GetFnt()->HasBorder() && ::lcl_HasSameBorder(aCurFont, *GetFnt()) && !bDisconnect )
+ {
+ // In some case border merge is called twice to the portion
+ if( !rPortion.GetJoinBorderWithNext() )
{
- // In some case border merge is called twice to the portion
- if( !rPortion.GetJoinBorderWithNext() )
- {
- rPortion.SetJoinBorderWithNext(true);
- if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetRightBorderSpace() )
- rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
- }
+ rPortion.SetJoinBorderWithNext(true);
+ if( rPortion.InTextGrp() && rPortion.Width() > aCurFont.GetRightBorderSpace() )
+ rPortion.Width(rPortion.Width() - aCurFont.GetRightBorderSpace());
}
- // If this is the last portion of the merge group then make the real height merge
- else
+ }
+ // If this is the last portion of the merge group then make the real height merge
+ else
+ {
+ rPortion.SetJoinBorderWithNext(false);
+ if( m_pFirstOfBorderMerge != &rPortion )
{
- rPortion.SetJoinBorderWithNext(false);
- if( m_pFirstOfBorderMerge != &rPortion )
+ // Calculate maximum height and ascent
+ SwLinePortion* pActPor = m_pFirstOfBorderMerge;
+ sal_uInt16 nMaxAscent = 0;
+ sal_uInt16 nMaxHeight = 0;
+ bool bReachCurrent = false;
+ while( pActPor )
{
- // Calculate maximum height and ascent
- SwLinePortion* pActPor = m_pFirstOfBorderMerge;
- sal_uInt16 nMaxAscent = 0;
- sal_uInt16 nMaxHeight = 0;
- bool bReachCurrent = false;
- while( pActPor )
- {
- if( nMaxHeight < pActPor->Height() )
- nMaxHeight = pActPor->Height();
- if( nMaxAscent < pActPor->GetAscent() )
- nMaxAscent = pActPor->GetAscent();
+ if( nMaxHeight < pActPor->Height() )
+ nMaxHeight = pActPor->Height();
+ if( nMaxAscent < pActPor->GetAscent() )
+ nMaxAscent = pActPor->GetAscent();
- pActPor = pActPor->GetNextPortion();
- if( !pActPor && !bReachCurrent )
- {
- pActPor = &rPortion;
- bReachCurrent = true;
- }
+ pActPor = pActPor->GetNextPortion();
+ if( !pActPor && !bReachCurrent )
+ {
+ pActPor = &rPortion;
+ bReachCurrent = true;
}
+ }
- // Change all portion's height and ascent
- pActPor = m_pFirstOfBorderMerge;
- bReachCurrent = false;
- while( pActPor )
- {
- if( nMaxHeight > pActPor->Height() )
- pActPor->Height(nMaxHeight);
- if( nMaxAscent > pActPor->GetAscent() )
- pActPor->SetAscent(nMaxAscent);
+ // Change all portion's height and ascent
+ pActPor = m_pFirstOfBorderMerge;
+ bReachCurrent = false;
+ while( pActPor )
+ {
+ if( nMaxHeight > pActPor->Height() )
+ pActPor->Height(nMaxHeight);
+ if( nMaxAscent > pActPor->GetAscent() )
+ pActPor->SetAscent(nMaxAscent);
- pActPor = pActPor->GetNextPortion();
- if( !pActPor && !bReachCurrent )
- {
- pActPor = &rPortion;
- bReachCurrent = true;
- }
+ pActPor = pActPor->GetNextPortion();
+ if( !pActPor && !bReachCurrent )
+ {
+ pActPor = &rPortion;
+ bReachCurrent = true;
}
- m_pFirstOfBorderMerge = nullptr;
}
+ m_pFirstOfBorderMerge = nullptr;
}
- Seek(rInf.GetIdx());
}
+ Seek(rInf.GetIdx());
}
namespace {
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 659b5532d3b9..0e79a2145e7b 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -160,20 +160,20 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTextFormatInfo &rInf,
void SwBlankPortion::FormatEOL( SwTextFormatInfo &rInf )
{
sal_uInt16 nMay = MayUnderflow( rInf, rInf.GetIdx() - nLineLength, true );
- if( nMay )
+ if( !nMay )
+ return;
+
+ if( nMay > 1 )
{
- if( nMay > 1 )
- {
- if( rInf.GetLast() == this )
- rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
- rInf.X( rInf.X() - PrtWidth() );
- rInf.SetIdx( rInf.GetIdx() - GetLen() );
- }
- Truncate();
- rInf.SetUnderflow( this );
- if( rInf.GetLast()->IsKernPortion() )
- rInf.SetUnderflow( rInf.GetLast() );
+ if( rInf.GetLast() == this )
+ rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
+ rInf.X( rInf.X() - PrtWidth() );
+ rInf.SetIdx( rInf.GetIdx() - GetLen() );
}
+ Truncate();
+ rInf.SetUnderflow( this );
+ if( rInf.GetLast()->IsKernPortion() )
+ rInf.SetUnderflow( rInf.GetLast() );
}
/**
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index fb414dc8772e..d411c9e17377 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -158,26 +158,26 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP
bOn = pPor->GetExpText( *pNew, aText );
// The text will be replaced ...
- if( bOn )
+ if( !bOn )
+ return;
+
+ pInf = const_cast<SwTextFormatInfo*>(pNew);
+ nIdx = pInf->GetIdx();
+ nLen = pInf->GetLen();
+ pOldText = &(pInf->GetText());
+ m_pOldCachedVclData = pInf->GetCachedVclData();
+ pInf->SetLen(TextFrameIndex(aText.getLength()));
+ pInf->SetCachedVclData(nullptr);
+ if( pPor->IsFollow() )
{
- pInf = const_cast<SwTextFormatInfo*>(pNew);
- nIdx = pInf->GetIdx();
- nLen = pInf->GetLen();
- pOldText = &(pInf->GetText());
- m_pOldCachedVclData = pInf->GetCachedVclData();
- pInf->SetLen(TextFrameIndex(aText.getLength()));
- pInf->SetCachedVclData(nullptr);
- if( pPor->IsFollow() )
- {
- pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
- pInf->SetIdx(TextFrameIndex(0));
- }
- else if (nIdx < TextFrameIndex(pOldText->getLength()))
- {
- aText = (*pOldText).replaceAt(sal_Int32(nIdx), 1, aText);
- }
- pInf->SetText( aText );
+ pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
+ pInf->SetIdx(TextFrameIndex(0));
+ }
+ else if (nIdx < TextFrameIndex(pOldText->getLength()))
+ {
+ aText = (*pOldText).replaceAt(sal_Int32(nIdx), 1, aText);
}
+ pInf->SetText( aText );
}
SwFieldSlot::~SwFieldSlot()
@@ -660,77 +660,77 @@ void SwNumberPortion::Paint( const SwTextPaintInfo &rInf ) const
pThis->Width( nOldWidth );
}
- if( !m_aExpand.isEmpty() )
- {
- const SwFont *pTmpFnt = rInf.GetFont();
- bool bPaintSpace = ( LINESTYLE_NONE != pTmpFnt->GetUnderline() ||
- LINESTYLE_NONE != pTmpFnt->GetOverline() ||
- STRIKEOUT_NONE != pTmpFnt->GetStrikeout() ) &&
- !pTmpFnt->IsWordLineMode();
- if( bPaintSpace && m_pFont )
- bPaintSpace = ( LINESTYLE_NONE != m_pFont->GetUnderline() ||
- LINESTYLE_NONE != m_pFont->GetOverline() ||
- STRIKEOUT_NONE != m_pFont->GetStrikeout() ) &&
- !m_pFont->IsWordLineMode();
+ if( m_aExpand.isEmpty() )
+ return;
- SwFontSave aSave( rInf, m_pFont.get() );
+ const SwFont *pTmpFnt = rInf.GetFont();
+ bool bPaintSpace = ( LINESTYLE_NONE != pTmpFnt->GetUnderline() ||
+ LINESTYLE_NONE != pTmpFnt->GetOverline() ||
+ STRIKEOUT_NONE != pTmpFnt->GetStrikeout() ) &&
+ !pTmpFnt->IsWordLineMode();
+ if( bPaintSpace && m_pFont )
+ bPaintSpace = ( LINESTYLE_NONE != m_pFont->GetUnderline() ||
+ LINESTYLE_NONE != m_pFont->GetOverline() ||
+ STRIKEOUT_NONE != m_pFont->GetStrikeout() ) &&
+ !m_pFont->IsWordLineMode();
+
+ SwFontSave aSave( rInf, m_pFont.get() );
- if( nFixWidth == Width() && ! HasFollow() )
+ if( nFixWidth == Width() && ! HasFollow() )
+ SwExpandPortion::Paint( rInf );
+ else
+ {
+ // logical const: reset width
+ SwNumberPortion *pThis = const_cast<SwNumberPortion*>(this);
+ bPaintSpace = bPaintSpace && nFixWidth < nOldWidth;
+ sal_uInt16 nSpaceOffs = nFixWidth;
+ pThis->Width( nFixWidth );
+
+ if( ( IsLeft() && ! rInf.GetTextFrame()->IsRightToLeft() ) ||
+ ( ! IsLeft() && ! IsCenter() && rInf.GetTextFrame()->IsRightToLeft() ) )
SwExpandPortion::Paint( rInf );
else
{
- // logical const: reset width
- SwNumberPortion *pThis = const_cast<SwNumberPortion*>(this);
- bPaintSpace = bPaintSpace && nFixWidth < nOldWidth;
- sal_uInt16 nSpaceOffs = nFixWidth;
- pThis->Width( nFixWidth );
-
- if( ( IsLeft() && ! rInf.GetTextFrame()->IsRightToLeft() ) ||
- ( ! IsLeft() && ! IsCenter() && rInf.GetTextFrame()->IsRightToLeft() ) )
- SwExpandPortion::Paint( rInf );
+ SwTextPaintInfo aInf( rInf );
+ if( nOffset < nMinDist )
+ nOffset = 0;
else
{
- SwTextPaintInfo aInf( rInf );
- if( nOffset < nMinDist )
- nOffset = 0;
- else
+ if( IsCenter() )
{
- if( IsCenter() )
- {
- /* #110778# a / 2 * 2 == a is not a tautology */
- sal_uInt16 nTmpOffset = nOffset;
- nOffset /= 2;
- if( nOffset < nMinDist )
- nOffset = nTmpOffset - nMinDist;
- }
- else
- nOffset = nOffset - nMinDist;
+ /* #110778# a / 2 * 2 == a is not a tautology */
+ sal_uInt16 nTmpOffset = nOffset;
+ nOffset /= 2;
+ if( nOffset < nMinDist )
+ nOffset = nTmpOffset - nMinDist;
}
- aInf.X( aInf.X() + nOffset );
- SwExpandPortion::Paint( aInf );
- if( bPaintSpace )
- nSpaceOffs = nSpaceOffs + nOffset;
+ else
+ nOffset = nOffset - nMinDist;
}
- if( bPaintSpace && nOldWidth > nSpaceOffs )
- {
- SwTextPaintInfo aInf( rInf );
- aInf.X( aInf.X() + nSpaceOffs );
+ aInf.X( aInf.X() + nOffset );
+ SwExpandPortion::Paint( aInf );
+ if( bPaintSpace )
+ nSpaceOffs = nSpaceOffs + nOffset;
+ }
+ if( bPaintSpace && nOldWidth > nSpaceOffs )
+ {
+ SwTextPaintInfo aInf( rInf );
+ aInf.X( aInf.X() + nSpaceOffs );
- // #i53199# Adjust position of underline:
- if ( rInf.GetUnderFnt() )
- {
- const Point aNewPos( aInf.GetPos().X(), rInf.GetUnderFnt()->GetPos().Y() );
- rInf.GetUnderFnt()->SetPos( aNewPos );
- }
+ // #i53199# Adjust position of underline:
+ if ( rInf.GetUnderFnt() )
+ {
+ const Point aNewPos( aInf.GetPos().X(), rInf.GetUnderFnt()->GetPos().Y() );
+ rInf.GetUnderFnt()->SetPos( aNewPos );
+ }
- pThis->Width( nOldWidth - nSpaceOffs + 12 );
- {
- SwTextSlot aDiffText( &aInf, this, true, false, " " );
- aInf.DrawText( *this, aInf.GetLen(), true );
- }
+ pThis->Width( nOldWidth - nSpaceOffs + 12 );
+ {
+ SwTextSlot aDiffText( &aInf, this, true, false, " " );
+ aInf.DrawText( *this, aInf.GetLen(), true );
}
- pThis->Width( nOldWidth );
}
+ pThis->Width( nOldWidth );
}
}
@@ -998,59 +998,59 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
void SwGrfNumPortion::SetBase( long nLnAscent, long nLnDescent,
long nFlyAsc, long nFlyDesc )
{
- if ( GetOrient() != text::VertOrientation::NONE )
+ if ( GetOrient() == text::VertOrientation::NONE )
+ return;
+
+ SetRelPos( 0 );
+ if ( GetOrient() == text::VertOrientation::CENTER )
+ SetRelPos( GetGrfHeight() / 2 );
+ else if ( GetOrient() == text::VertOrientation::TOP )
+ SetRelPos( GetGrfHeight() - GRFNUM_SECURE );
+ else if ( GetOrient() == text::VertOrientation::BOTTOM )
+ ;
+ else if ( GetOrient() == text::VertOrientation::CHAR_CENTER )
+ SetRelPos( ( GetGrfHeight() + nLnAscent - nLnDescent ) / 2 );
+ else if ( GetOrient() == text::VertOrientation::CHAR_TOP )
+ SetRelPos( nLnAscent );
+ else if ( GetOrient() == text::VertOrientation::CHAR_BOTTOM )
+ SetRelPos( GetGrfHeight() - nLnDescent );
+ else
{
- SetRelPos( 0 );
- if ( GetOrient() == text::VertOrientation::CENTER )
- SetRelPos( GetGrfHeight() / 2 );
- else if ( GetOrient() == text::VertOrientation::TOP )
- SetRelPos( GetGrfHeight() - GRFNUM_SECURE );
- else if ( GetOrient() == text::VertOrientation::BOTTOM )
- ;
- else if ( GetOrient() == text::VertOrientation::CHAR_CENTER )
- SetRelPos( ( GetGrfHeight() + nLnAscent - nLnDescent ) / 2 );
- else if ( GetOrient() == text::VertOrientation::CHAR_TOP )
- SetRelPos( nLnAscent );
- else if ( GetOrient() == text::VertOrientation::CHAR_BOTTOM )
- SetRelPos( GetGrfHeight() - nLnDescent );
- else
+ if( GetGrfHeight() >= nFlyAsc + nFlyDesc )
{
- if( GetGrfHeight() >= nFlyAsc + nFlyDesc )
- {
- // If I'm as large as the line, I do not need to adjust
- // at the line; I'll leave the max. ascent unchanged
- SetRelPos( nFlyAsc );
- }
- else if ( GetOrient() == text::VertOrientation::LINE_CENTER )
- SetRelPos( ( GetGrfHeight() + nFlyAsc - nFlyDesc ) / 2 );
- else if ( GetOrient() == text::VertOrientation::LINE_TOP )
- SetRelPos( nFlyAsc );
- else if ( GetOrient() == text::VertOrientation::LINE_BOTTOM )
- SetRelPos( GetGrfHeight() - nFlyDesc );
+ // If I'm as large as the line, I do not need to adjust
+ // at the line; I'll leave the max. ascent unchanged
+ SetRelPos( nFlyAsc );
}
+ else if ( GetOrient() == text::VertOrientation::LINE_CENTER )
+ SetRelPos( ( GetGrfHeight() + nFlyAsc - nFlyDesc ) / 2 );
+ else if ( GetOrient() == text::VertOrientation::LINE_TOP )
+ SetRelPos( nFlyAsc );
+ else if ( GetOrient() == text::VertOrientation::LINE_BOTTOM )
+ SetRelPos( GetGrfHeight() - nFlyDesc );
}
}
void SwTextFrame::StopAnimation( OutputDevice* pOut )
{
OSL_ENSURE( HasAnimation(), "SwTextFrame::StopAnimation: Which Animation?" );
- if( HasPara() )
+ if( !HasPara() )
+ return;
+
+ SwLineLayout *pLine = GetPara();
+ while( pLine )
{
- SwLineLayout *pLine = GetPara();
- while( pLine )
+ SwLinePortion *pPor = pLine->GetNextPortion();
+ while( pPor )
{
- SwLinePortion *pPor = pLine->GetNextPortion();
- while( pPor )
- {
- if( pPor->IsGrfNumPortion() )
- static_cast<SwGrfNumPortion*>(pPor)->StopAnimation( pOut );
- // The NumberPortion is always at the first char,
- // which means we can cancel as soon as we've reached a portion
- // with a length > 0
- pPor = pPor->GetLen() ? nullptr : pPor->GetNextPortion();
- }
- pLine = pLine->GetLen() ? nullptr : pLine->GetNext();
+ if( pPor->IsGrfNumPortion() )
+ static_cast<SwGrfNumPortion*>(pPor)->StopAnimation( pOut );
+ // The NumberPortion is always at the first char,
+ // which means we can cancel as soon as we've reached a portion
+ // with a length > 0
+ pPor = pPor->GetLen() ? nullptr : pPor->GetNextPortion();
}
+ pLine = pLine->GetLen() ? nullptr : pLine->GetNext();
}
}
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 31602d3c3ac6..8a34966b7873 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -149,31 +149,31 @@ void SwTextFrame::MoveFlyInCnt(SwTextFrame *pNew,
TextFrameIndex const nStart, TextFrameIndex const nEnd)
{
SwSortedObjs *pObjs = GetDrawObjs();
- if ( nullptr != pObjs )
+ if ( nullptr == pObjs )
+ return;
+
+ for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i )
{
- for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i )
+ // Consider changed type of <SwSortedList> entries
+ SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
+ const SwFormatAnchor& rAnch = pAnchoredObj->GetFrameFormat().GetAnchor();
+ if (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{
- // Consider changed type of <SwSortedList> entries
- SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
- const SwFormatAnchor& rAnch = pAnchoredObj->GetFrameFormat().GetAnchor();
- if (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
+ const SwPosition* pPos = rAnch.GetContentAnchor();
+ TextFrameIndex const nIndex(MapModelToViewPos(*pPos));
+ if (nStart <= nIndex && nIndex < nEnd)
{
- const SwPosition* pPos = rAnch.GetContentAnchor();
- TextFrameIndex const nIndex(MapModelToViewPos(*pPos));
- if (nStart <= nIndex && nIndex < nEnd)
+ if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ {
+ RemoveFly( static_cast<SwFlyFrame*>(pAnchoredObj) );
+ pNew->AppendFly( static_cast<SwFlyFrame*>(pAnchoredObj) );
+ }
+ else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) != nullptr )
{
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
- {
- RemoveFly( static_cast<SwFlyFrame*>(pAnchoredObj) );
- pNew->AppendFly( static_cast<SwFlyFrame*>(pAnchoredObj) );
- }
- else if ( dynamic_cast< const SwAnchoredDrawObject *>( pAnchoredObj ) != nullptr )
- {
- RemoveDrawObj( *pAnchoredObj );
- pNew->AppendDrawObj( *pAnchoredObj );
- }
- --i;
+ RemoveDrawObj( *pAnchoredObj );
+ pNew->AppendDrawObj( *pAnchoredObj );
}
+ --i;
}
}
}
@@ -209,30 +209,30 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
if(rInf.GetTextFrame()->IsVertical())
rInf.GetTextFrame()->SwitchHorizontalToVertical(aRepaintRect);
- if((m_pFly->IsCompletePaint() ||
+ if(!((m_pFly->IsCompletePaint() ||
m_pFly->getFrameArea().IsOver(aRepaintRect)) &&
- SwFlyFrame::IsPaint(m_pFly->GetVirtDrawObj(), m_pFly->getRootFrame()->GetCurrShell()))
- {
- SwRect aRect(m_pFly->getFrameArea());
- if(!m_pFly->IsCompletePaint())
- aRect.Intersection_(aRepaintRect);
-
- // GetFlyFrame() may change the layout mode at the output device.
- {
- SwLayoutModeModifier aLayoutModeModifier(*rInf.GetOut());
- m_pFly->PaintSwFrame(const_cast<vcl::RenderContext&>(*rInf.GetOut()), aRect);
- }
- const_cast<SwTextPaintInfo&>(rInf).GetRefDev()->SetLayoutMode(rInf.GetOut()->GetLayoutMode());
+ SwFlyFrame::IsPaint(m_pFly->GetVirtDrawObj(), m_pFly->getRootFrame()->GetCurrShell())))
+ return;
- // As the OutputDevice might be anything, the font must be re-selected.
- // Being in const method should not be a problem.
- const_cast<SwTextPaintInfo&>(rInf).SelectFont();
+ SwRect aRect(m_pFly->getFrameArea());
+ if(!m_pFly->IsCompletePaint())
+ aRect.Intersection_(aRepaintRect);
- assert(rInf.GetVsh());
- SAL_WARN_IF(rInf.GetVsh()->GetOut() != rInf.GetOut(), "sw.core", "SwFlyCntPortion::Paint: Outdev has changed");
- if(rInf.GetVsh())
- const_cast<SwTextPaintInfo&>(rInf).SetOut(rInf.GetVsh()->GetOut());
+ // GetFlyFrame() may change the layout mode at the output device.
+ {
+ SwLayoutModeModifier aLayoutModeModifier(*rInf.GetOut());
+ m_pFly->PaintSwFrame(const_cast<vcl::RenderContext&>(*rInf.GetOut()), aRect);
}
+ const_cast<SwTextPaintInfo&>(rInf).GetRefDev()->SetLayoutMode(rInf.GetOut()->GetLayoutMode());
+
+ // As the OutputDevice might be anything, the font must be re-selected.
+ // Being in const method should not be a problem.
+ const_cast<SwTextPaintInfo&>(rInf).SelectFont();
+
+ assert(rInf.GetVsh());
+ SAL_WARN_IF(rInf.GetVsh()->GetOut() != rInf.GetOut(), "sw.core", "SwFlyCntPortion::Paint: Outdev has changed");
+ if(rInf.GetVsh())
+ const_cast<SwTextPaintInfo&>(rInf).SetOut(rInf.GetVsh()->GetOut());
}
void sw::DrawFlyCntPortion::Paint(const SwTextPaintInfo&) const
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list