summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 10:35:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-31 20:06:51 +0200
commite21042b43ff3fe93440c543b91a052b5a00d3515 (patch)
tree75b6f4d37bc6bfa6f52ee31f0554742486b170b4 /sw
parentfb8371400e4b2d32b3981b42c910e04f35ab166b (diff)
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@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/frmedt/fefly1.cxx278
-rw-r--r--sw/source/core/frmedt/feshview.cxx106
-rw-r--r--sw/source/core/frmedt/fews.cxx26
-rw-r--r--sw/source/core/frmedt/tblsel.cxx22
-rw-r--r--sw/source/core/graphic/ndgrf.cxx208
5 files changed, 320 insertions, 320 deletions
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#