summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-30 19:35:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-03 08:41:11 +0200
commitd3971ec256450e6783920b46f672048b29719949 (patch)
treef4722d0e2bc321cf71b49b7573cf38640e9b28fc /sw
parentf50bf3c5225b49b3c6f77f882e35305e5dc5ccd3 (diff)
new loplugin:blockblock
Change-Id: I7b68b70fa4c7234e8882f7627026959a596968fd Reviewed-on: https://gerrit.libreoffice.org/43025 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx18
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx4
-rw-r--r--sw/source/core/doc/tblrwcl.cxx20
-rw-r--r--sw/source/core/docnode/ndtbl.cxx26
-rw-r--r--sw/source/core/docnode/nodes.cxx54
-rw-r--r--sw/source/core/unocore/unotbl.cxx24
-rw-r--r--sw/source/filter/xml/xmltexte.cxx33
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx36
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx38
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx9
-rw-r--r--sw/source/uibase/shells/textsh1.cxx20
-rw-r--r--sw/source/uibase/wrtsh/select.cxx16
12 files changed, 133 insertions, 165 deletions
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index c54947739ddb..1c220bea373a 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -214,21 +214,13 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat )
SwOLENode* pOLENd = m_rDoc.GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode();
if( pOLENd && pOLENd->GetOLEObj().IsOleRef() )
{
-
- // TODO: the old object closed the object and cleared all references to it, but didn't remove it from the container.
- // I have no idea, why, nobody could explain it - so I do my very best to mimic this behavior
- //uno::Reference < util::XCloseable > xClose( pOLENd->GetOLEObj().GetOleRef(), uno::UNO_QUERY );
- //if ( xClose.is() )
+ try
+ {
+ pOLENd->GetOLEObj().GetOleRef()->changeState( embed::EmbedStates::LOADED );
+ }
+ catch ( uno::Exception& )
{
- try
- {
- pOLENd->GetOLEObj().GetOleRef()->changeState( embed::EmbedStates::LOADED );
- }
- catch ( uno::Exception& )
- {
- }
}
-
}
}
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 685555675402..aca6ee9efdb2 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1634,9 +1634,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
}
if( aSet.Count() )
{
- {
- pNewFormat->SetFormatAttr( aSet );
- }
+ pNewFormat->SetFormatAttr( aSet );
}
return pNewFormat;
}
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index b03fd33f4f49..f0eecddda7cc 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -4409,19 +4409,17 @@ SwFrameFormat* SwShareBoxFormats::GetFormat( const SwFrameFormat& rFormat,
void SwShareBoxFormats::AddFormat( const SwFrameFormat& rOld, SwFrameFormat& rNew )
{
+ sal_uInt16 nPos;
+ SwShareBoxFormat* pEntry;
+ if( !Seek_Entry( rOld, &nPos ))
{
- sal_uInt16 nPos;
- SwShareBoxFormat* pEntry;
- if( !Seek_Entry( rOld, &nPos ))
- {
- pEntry = new SwShareBoxFormat( rOld );
- m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
- }
- else
- pEntry = m_ShareArr[ nPos ].get();
-
- pEntry->AddFormat( rNew );
+ pEntry = new SwShareBoxFormat( rOld );
+ m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
}
+ else
+ pEntry = m_ShareArr[ nPos ].get();
+
+ pEntry->AddFormat( rNew );
}
void SwShareBoxFormats::ChangeFrameFormat( SwTableBox* pBox, SwTableLine* pLn,
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d77518100c33..1cb60f6e6572 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2053,22 +2053,20 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
SwContentNode* pNextNd = GetNodes()[ nNextNd ]->GetContentNode();
if( pNextNd )
{
+ SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
+ const SfxPoolItem *pItem;
+ if( SfxItemState::SET == pTableFormat->GetItemState( RES_PAGEDESC,
+ false, &pItem ) )
{
- SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
- const SfxPoolItem *pItem;
- if( SfxItemState::SET == pTableFormat->GetItemState( RES_PAGEDESC,
- false, &pItem ) )
- {
- pNextNd->SetAttr( *pItem );
- bSavePageDesc = true;
- }
+ pNextNd->SetAttr( *pItem );
+ bSavePageDesc = true;
+ }
- if( SfxItemState::SET == pTableFormat->GetItemState( RES_BREAK,
- false, &pItem ) )
- {
- pNextNd->SetAttr( *pItem );
- bSavePageBreak = true;
- }
+ if( SfxItemState::SET == pTableFormat->GetItemState( RES_BREAK,
+ false, &pItem ) )
+ {
+ pNextNd->SetAttr( *pItem );
+ bSavePageBreak = true;
}
}
SwUndoDelete* pUndo = new SwUndoDelete( aPaM );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 094201d7c5c3..f5ab64dc57f0 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1593,39 +1593,37 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
SwTextNode* const pEndSrcNd = aEndIdx.GetNode().GetTextNode();
if ( pEndSrcNd )
{
+ // at the end of this range a new TextNode will be created
+ if( !bSplitDestNd )
{
- // at the end of this range a new TextNode will be created
- if( !bSplitDestNd )
- {
- if( rPos.nNode < rNodes.GetEndOfContent().GetIndex() )
- {
- ++rPos.nNode;
- }
-
- pDestNd =
- rNodes.MakeTextNode( rPos.nNode, pEndSrcNd->GetTextColl() );
- --rPos.nNode;
- rPos.nContent.Assign( pDestNd, 0 );
- }
- else
+ if( rPos.nNode < rNodes.GetEndOfContent().GetIndex() )
{
- pDestNd = rPos.nNode.GetNode().GetTextNode();
+ ++rPos.nNode;
}
- if (pDestNd && pEnd->nContent.GetIndex())
- {
- // move the content into the new node
- SwIndex aIdx( pEndSrcNd, 0 );
- pEndSrcNd->CutText( pDestNd, rPos.nContent, aIdx,
- pEnd->nContent.GetIndex());
- }
+ pDestNd =
+ rNodes.MakeTextNode( rPos.nNode, pEndSrcNd->GetTextColl() );
+ --rPos.nNode;
+ rPos.nContent.Assign( pDestNd, 0 );
+ }
+ else
+ {
+ pDestNd = rPos.nNode.GetNode().GetTextNode();
+ }
- if (pDestNd && bCopyCollFormat)
- {
- SwDoc* const pInsDoc = pDestNd->GetDoc();
- ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
- pEndSrcNd->CopyCollFormat( *pDestNd );
- }
+ if (pDestNd && pEnd->nContent.GetIndex())
+ {
+ // move the content into the new node
+ SwIndex aIdx( pEndSrcNd, 0 );
+ pEndSrcNd->CutText( pDestNd, rPos.nContent, aIdx,
+ pEnd->nContent.GetIndex());
+ }
+
+ if (pDestNd && bCopyCollFormat)
+ {
+ SwDoc* const pInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
+ pEndSrcNd->CopyCollFormat( *pDestNd );
}
}
else
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 968b30059d6f..39bd373e490c 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -221,20 +221,18 @@ static void lcl_SetSpecialProperty(SwFrameFormat* pFormat,
case FN_TABLE_HEADLINE_REPEAT:
case FN_TABLE_HEADLINE_COUNT:
{
+ SwTable* pTable = SwTable::FindTable( pFormat );
+ UnoActionContext aAction(pFormat->GetDoc());
+ if( pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
{
- SwTable* pTable = SwTable::FindTable( pFormat );
- UnoActionContext aAction(pFormat->GetDoc());
- if( pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
- {
- pFormat->GetDoc()->SetRowsToRepeat( *pTable, aValue.get<bool>() ? 1 : 0 );
- }
- else
- {
- sal_Int32 nRepeat = 0;
- aValue >>= nRepeat;
- if( nRepeat >= 0 && nRepeat < USHRT_MAX )
- pFormat->GetDoc()->SetRowsToRepeat( *pTable, (sal_uInt16) nRepeat );
- }
+ pFormat->GetDoc()->SetRowsToRepeat( *pTable, aValue.get<bool>() ? 1 : 0 );
+ }
+ else
+ {
+ sal_Int32 nRepeat = 0;
+ aValue >>= nRepeat;
+ if( nRepeat >= 0 && nRepeat < USHRT_MAX )
+ pFormat->GetDoc()->SetRowsToRepeat( *pTable, (sal_uInt16) nRepeat );
}
}
break;
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 07e15faad4f6..3e9016dabc70 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -111,13 +111,10 @@ static void lcl_addAspect(
const XMLPropertyState **pStates,
const rtl::Reference < XMLPropertySetMapper >& rMapper )
{
+ sal_Int64 nAspect = rObj.GetViewAspect();
+ if ( nAspect )
{
- sal_Int64 nAspect = rObj.GetViewAspect();
-
- if ( nAspect )
- {
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_DRAW_ASPECT ), uno::makeAny( nAspect ) );
- }
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_DRAW_ASPECT ), uno::makeAny( nAspect ) );
}
}
@@ -126,23 +123,21 @@ static void lcl_addOutplaceProperties(
const XMLPropertyState **pStates,
const rtl::Reference < XMLPropertySetMapper >& rMapper )
{
- {
- MapMode aMode( MapUnit::Map100thMM ); // the API expects this map mode for the embedded objects
- Size aSize = rObj.GetSize( &aMode ); // get the size in the requested map mode
+ MapMode aMode( MapUnit::Map100thMM ); // the API expects this map mode for the embedded objects
+ Size aSize = rObj.GetSize( &aMode ); // get the size in the requested map mode
- if( aSize.Width() && aSize.Height() )
- {
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), Any(sal_Int32(0)) );
- pStates++;
+ if( aSize.Width() && aSize.Height() )
+ {
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), Any(sal_Int32(0)) );
+ pStates++;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(sal_Int32(0)) );
- pStates++;
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(sal_Int32(0)) );
+ pStates++;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any((sal_Int32)aSize.Width()) );
- pStates++;
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any((sal_Int32)aSize.Width()) );
+ pStates++;
- *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any((sal_Int32)aSize.Height()) );
- }
+ *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any((sal_Int32)aSize.Height()) );
}
}
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index edec1e0412ba..e36595431cee 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1418,26 +1418,24 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
for (size_t i = 0; _pMap && i < nCount; ++i)
{
// Why not from the left/from inside or from above?
+ SvxSwFramePosString::StringId eStrId = m_pMirrorPagesCB->IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
+ // --> OD 2009-08-31 #mongolianlayout#
+ eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
+ m_bIsVerticalFrame,
+ m_bIsVerticalL2R,
+ m_bIsInRightToLeft);
+ OUString sEntry(SvxSwFramePosString::GetString(eStrId));
+ if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND)
{
- SvxSwFramePosString::StringId eStrId = m_pMirrorPagesCB->IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
- // --> OD 2009-08-31 #mongolianlayout#
- eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
- m_bIsVerticalFrame,
- m_bIsVerticalL2R,
- m_bIsInRightToLeft);
- OUString sEntry(SvxSwFramePosString::GetString(eStrId));
- if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND)
- {
- // don't insert entries when frames are character bound
- _rLB.InsertEntry(sEntry);
- }
- // i#22341 - add condition to handle map <aVCharMap>
- // that is ambiguous in the alignment.
- if ( _pMap[i].nAlign == _nAlign &&
- ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
- {
- sSelEntry = sEntry;
- }
+ // don't insert entries when frames are character bound
+ _rLB.InsertEntry(sEntry);
+ }
+ // i#22341 - add condition to handle map <aVCharMap>
+ // that is ambiguous in the alignment.
+ if ( _pMap[i].nAlign == _nAlign &&
+ ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
+ {
+ sSelEntry = sEntry;
}
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 7e45823ddd29..2811c217580c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -571,32 +571,30 @@ void SwDBManager::ImportFromConnection( SwWrtShell* pSh )
{
if(pImpl->pMergeData && !pImpl->pMergeData->bEndOfDB)
{
- {
- pSh->StartAllAction();
- pSh->StartUndo();
- bool bGroupUndo(pSh->DoesGroupUndo());
- pSh->DoGroupUndo(false);
-
- if( pSh->HasSelection() )
- pSh->DelRight();
+ pSh->StartAllAction();
+ pSh->StartUndo();
+ bool bGroupUndo(pSh->DoesGroupUndo());
+ pSh->DoGroupUndo(false);
- std::unique_ptr<SwWait> pWait;
+ if( pSh->HasSelection() )
+ pSh->DelRight();
- {
- sal_uLong i = 0;
- do {
+ std::unique_ptr<SwWait> pWait;
- ImportDBEntry(pSh);
- if( 10 == ++i )
- pWait.reset(new SwWait( *pSh->GetView().GetDocShell(), true));
+ {
+ sal_uLong i = 0;
+ do {
- } while(ToNextMergeRecord());
- }
+ ImportDBEntry(pSh);
+ if( 10 == ++i )
+ pWait.reset(new SwWait( *pSh->GetView().GetDocShell(), true));
- pSh->DoGroupUndo(bGroupUndo);
- pSh->EndUndo();
- pSh->EndAllAction();
+ } while(ToNextMergeRecord());
}
+
+ pSh->DoGroupUndo(bGroupUndo);
+ pSh->EndUndo();
+ pSh->EndAllAction();
}
}
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 07c467b126fe..b7aa96bb086a 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5809,11 +5809,10 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos )
if ( !bOverSelect )
{
- { // create only temporary move context because otherwise
- // the query against the content form doesn't work!!!
- SwMvContext aMvContext( &rSh );
- rSh.CallSetCursor(&aDocPos, false);
- }
+ // create only temporary move context because otherwise
+ // the query against the content form doesn't work!!!
+ SwMvContext aMvContext( &rSh );
+ rSh.CallSetCursor(&aDocPos, false);
}
if( !bOverURLGrf )
{
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index ab61baa6bc4c..671906587815 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1815,19 +1815,17 @@ void SwTextShell::GetState( SfxItemSet &rSet )
break;
case FN_NUM_CONTINUE:
{
+ // #i86492#
+ // Search also for bullet list
+ OUString aDummy;
+ const SwNumRule* pRule =
+ rSh.SearchNumRule( true, aDummy );
+ if ( !pRule )
{
- // #i86492#
- // Search also for bullet list
- OUString aDummy;
- const SwNumRule* pRule =
- rSh.SearchNumRule( true, aDummy );
- if ( !pRule )
- {
- pRule = rSh.SearchNumRule( false, aDummy );
- }
- if ( !pRule )
- rSet.DisableItem(nWhich);
+ pRule = rSh.SearchNumRule( false, aDummy );
}
+ if ( !pRule )
+ rSet.DisableItem(nWhich);
}
break;
case SID_INSERT_RLM :
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 231902eeb2b2..0d1f1be27d15 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -536,15 +536,13 @@ void SwWrtShell::EnterStdMode()
// SwActContext opens and action which has to be
// closed prior to the call of
// GetChgLnk().Call()
- {
- SwActContext aActContext(this);
- m_bSelWrd = m_bSelLn = false;
- if( !IsRetainSelection() )
- KillPams();
- ClearMark();
- m_fnSetCursor = &SwWrtShell::SetCursorKillSel;
- m_fnKillSel = &SwWrtShell::ResetSelect;
- }
+ SwActContext aActContext(this);
+ m_bSelWrd = m_bSelLn = false;
+ if( !IsRetainSelection() )
+ KillPams();
+ ClearMark();
+ m_fnSetCursor = &SwWrtShell::SetCursorKillSel;
+ m_fnKillSel = &SwWrtShell::ResetSelect;
}
Invalidate();
SwTransferable::ClearSelection( *this );