[Libreoffice-commits] core.git: 2 commits - sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Aug 1 07:20:40 UTC 2020
sw/source/core/doc/DocumentChartDataProviderManager.cxx | 40 -
sw/source/core/doc/DocumentContentOperationsManager.cxx | 308 ++++----
sw/source/core/doc/DocumentDeviceManager.cxx | 56 -
sw/source/core/doc/DocumentDrawModelManager.cxx | 26
sw/source/core/doc/DocumentFieldsManager.cxx | 62 -
sw/source/core/doc/DocumentRedlineManager.cxx | 120 +--
sw/source/core/doc/DocumentSettingManager.cxx | 40 -
sw/source/core/doc/DocumentStatisticsManager.cxx | 22
sw/source/core/doc/acmplwrd.cxx | 28
sw/source/core/doc/doc.cxx | 140 +--
sw/source/core/doc/docbm.cxx | 42 -
sw/source/core/doc/docchart.cxx | 24
sw/source/core/doc/doccomp.cxx | 204 ++---
sw/source/core/doc/docdesc.cxx | 48 -
sw/source/core/doc/docedt.cxx | 78 +-
sw/source/core/doc/docfld.cxx | 70 -
sw/source/core/doc/docfmt.cxx | 68 -
sw/source/core/doc/doclay.cxx | 50 -
sw/source/core/doc/docnew.cxx | 34
sw/source/core/doc/docnum.cxx | 101 +-
sw/source/core/doc/docredln.cxx | 184 ++---
sw/source/core/doc/docsort.cxx | 22
sw/source/core/doc/doctxm.cxx | 51 -
sw/source/core/doc/docxforms.cxx | 56 -
sw/source/core/doc/extinput.cxx | 287 +++----
sw/source/core/doc/fmtcol.cxx | 28
sw/source/core/doc/htmltbl.cxx | 491 ++++++-------
sw/source/core/doc/notxtfrm.cxx | 72 -
sw/source/core/doc/number.cxx | 126 +--
sw/source/core/doc/swserv.cxx | 152 ++--
sw/source/core/doc/tblafmt.cxx | 134 +--
sw/source/core/doc/tblcpy.cxx | 236 +++---
sw/source/core/doc/tblrwcl.cxx | 96 +-
sw/source/core/doc/textboxhelper.cxx | 578 ++++++++--------
sw/source/core/doc/visiturl.cxx | 78 +-
sw/source/core/draw/dcontact.cxx | 148 ++--
sw/source/core/draw/dflyobj.cxx | 234 +++---
sw/source/core/draw/dview.cxx | 136 +--
sw/source/core/edit/acorrect.cxx | 66 -
sw/source/core/edit/autofmt.cxx | 94 +-
sw/source/core/edit/edfcol.cxx | 54 -
sw/source/core/edit/editsh.cxx | 38 -
sw/source/core/edit/edlingu.cxx | 200 ++---
sw/source/core/edit/edsect.cxx | 30
sw/source/core/edit/edtox.cxx | 44 -
sw/source/core/edit/edundo.cxx | 30
46 files changed, 2613 insertions(+), 2613 deletions(-)
New commits:
commit da64ad86e9f2dd66fbcecb46dcc22626e9f5a6a6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:34:02 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Aug 1 09:20:08 2020 +0200
loplugin:flatten in sw/core/doc
Change-Id: If7738d47ec0273f24eee99b7336380cfa78c1243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99896
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/doc/DocumentChartDataProviderManager.cxx b/sw/source/core/doc/DocumentChartDataProviderManager.cxx
index 90785725e2dd..72640b4629d4 100644
--- a/sw/source/core/doc/DocumentChartDataProviderManager.cxx
+++ b/sw/source/core/doc/DocumentChartDataProviderManager.cxx
@@ -55,32 +55,32 @@ SwChartDataProvider * DocumentChartDataProviderManager::GetChartDataProvider( bo
void DocumentChartDataProviderManager::CreateChartInternalDataProviders( const SwTable *pTable )
{
- if (pTable)
+ if (!pTable)
+ return;
+
+ OUString aName( pTable->GetFrameFormat()->GetName() );
+ SwOLENode *pONd;
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *m_rDoc.GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while (nullptr != (pStNd = aIdx.GetNode().GetStartNode()))
{
- OUString aName( pTable->GetFrameFormat()->GetName() );
- SwOLENode *pONd;
- SwStartNode *pStNd;
- SwNodeIndex aIdx( *m_rDoc.GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
- while (nullptr != (pStNd = aIdx.GetNode().GetStartNode()))
+ ++aIdx;
+ pONd = aIdx.GetNode().GetOLENode();
+ if( pONd &&
+ aName == pONd->GetChartTableName() /* OLE node is chart? */ &&
+ nullptr != (pONd->getLayoutFrame( m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout() )) /* chart frame is not hidden */ )
{
- ++aIdx;
- pONd = aIdx.GetNode().GetOLENode();
- if( pONd &&
- aName == pONd->GetChartTableName() /* OLE node is chart? */ &&
- nullptr != (pONd->getLayoutFrame( m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout() )) /* chart frame is not hidden */ )
+ uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
{
- uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef();
- if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) )
- {
- uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
- if (xChart.is())
- xChart->createInternalDataProvider( true );
+ uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY );
+ if (xChart.is())
+ xChart->createInternalDataProvider( true );
- // there may be more than one chart for each table thus we need to continue the loop...
- }
+ // there may be more than one chart for each table thus we need to continue the loop...
}
- aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
}
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
}
}
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 434be7f7de7b..695057d342c2 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -335,86 +335,86 @@ namespace
{
const SwDoc* pSrcDoc = rPam.GetDoc();
const SwRedlineTable& rTable = pSrcDoc->getIDocumentRedlineAccess().GetRedlineTable();
- if( !rTable.empty() )
- {
- SwDoc* pDestDoc = rCpyPam.GetDoc();
- SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
- std::unique_ptr<SwPaM> pDelPam;
- const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
- // We have to count the "non-copied" nodes
- sal_uLong nDelCount;
- SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount));
-
- SwRedlineTable::size_type n = 0;
- pSrcDoc->getIDocumentRedlineAccess().GetRedline( *pStt, &n );
- for( ; n < rTable.size(); ++n )
+ if( rTable.empty() )
+ return;
+
+ SwDoc* pDestDoc = rCpyPam.GetDoc();
+ SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
+ std::unique_ptr<SwPaM> pDelPam;
+ const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+ // We have to count the "non-copied" nodes
+ sal_uLong nDelCount;
+ SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount));
+
+ SwRedlineTable::size_type n = 0;
+ pSrcDoc->getIDocumentRedlineAccess().GetRedline( *pStt, &n );
+ for( ; n < rTable.size(); ++n )
+ {
+ const SwRangeRedline* pRedl = rTable[ n ];
+ if( RedlineType::Delete == pRedl->GetType() && pRedl->IsVisible() )
{
- const SwRangeRedline* pRedl = rTable[ n ];
- if( RedlineType::Delete == pRedl->GetType() && pRedl->IsVisible() )
- {
- const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
+ const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
- SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
- switch( eCmpPos )
- {
- case SwComparePosition::CollideEnd:
- case SwComparePosition::Before:
- // Pos1 is before Pos2
- break;
+ SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, *pRStt, *pREnd );
+ switch( eCmpPos )
+ {
+ case SwComparePosition::CollideEnd:
+ case SwComparePosition::Before:
+ // Pos1 is before Pos2
+ break;
- case SwComparePosition::CollideStart:
- case SwComparePosition::Behind:
- // Pos1 is after Pos2
- n = rTable.size();
- break;
+ case SwComparePosition::CollideStart:
+ case SwComparePosition::Behind:
+ // Pos1 is after Pos2
+ n = rTable.size();
+ break;
- default:
+ default:
+ {
+ pDelPam.reset(new SwPaM( *pCpyStt, pDelPam.release() ));
+ if( *pStt < *pRStt )
{
- pDelPam.reset(new SwPaM( *pCpyStt, pDelPam.release() ));
- if( *pStt < *pRStt )
- {
- lcl_NonCopyCount( rPam, aCorrIdx, pRStt->nNode.GetIndex(), nDelCount );
- lcl_SetCpyPos( *pRStt, *pStt, *pCpyStt,
- *pDelPam->GetPoint(), nDelCount );
- }
- pDelPam->SetMark();
+ lcl_NonCopyCount( rPam, aCorrIdx, pRStt->nNode.GetIndex(), nDelCount );
+ lcl_SetCpyPos( *pRStt, *pStt, *pCpyStt,
+ *pDelPam->GetPoint(), nDelCount );
+ }
+ pDelPam->SetMark();
- if( *pEnd < *pREnd )
- *pDelPam->GetPoint() = *pCpyEnd;
- else
- {
- lcl_NonCopyCount( rPam, aCorrIdx, pREnd->nNode.GetIndex(), nDelCount );
- lcl_SetCpyPos( *pREnd, *pStt, *pCpyStt,
- *pDelPam->GetPoint(), nDelCount );
- }
+ if( *pEnd < *pREnd )
+ *pDelPam->GetPoint() = *pCpyEnd;
+ else
+ {
+ lcl_NonCopyCount( rPam, aCorrIdx, pREnd->nNode.GetIndex(), nDelCount );
+ lcl_SetCpyPos( *pREnd, *pStt, *pCpyStt,
+ *pDelPam->GetPoint(), nDelCount );
+ }
- if (pDelPam->GetNext() && *pDelPam->GetNext()->End() == *pDelPam->Start())
- {
- *pDelPam->GetNext()->End() = *pDelPam->End();
- pDelPam.reset(pDelPam->GetNext());
- }
+ if (pDelPam->GetNext() && *pDelPam->GetNext()->End() == *pDelPam->Start())
+ {
+ *pDelPam->GetNext()->End() = *pDelPam->End();
+ pDelPam.reset(pDelPam->GetNext());
}
}
}
}
+ }
- if( pDelPam )
- {
- RedlineFlags eOld = pDestDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld | RedlineFlags::Ignore );
+ if( !pDelPam )
+ return;
- ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
+ RedlineFlags eOld = pDestDoc->getIDocumentRedlineAccess().GetRedlineFlags();
+ pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld | RedlineFlags::Ignore );
- do {
- pDestDoc->getIDocumentContentOperations().DeleteAndJoin( *pDelPam->GetNext() );
- if( !pDelPam->IsMultiSelection() )
- break;
- delete pDelPam->GetNext();
- } while( true );
+ ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
- pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
- }
- }
+ do {
+ pDestDoc->getIDocumentContentOperations().DeleteAndJoin( *pDelPam->GetNext() );
+ if( !pDelPam->IsMultiSelection() )
+ break;
+ delete pDelPam->GetNext();
+ } while( true );
+
+ pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange const & rCpyRg )
@@ -2948,23 +2948,23 @@ void DocumentContentOperationsManager::ReRead( SwPaM& rPam, const OUString& rGrf
const OUString& rFltName, const Graphic* pGraphic )
{
SwGrfNode *pGrfNd;
- if( ( !rPam.HasMark()
+ if( !(( !rPam.HasMark()
|| rPam.GetPoint()->nNode.GetIndex() == rPam.GetMark()->nNode.GetIndex() )
- && nullptr != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() ) )
+ && nullptr != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() )) )
+ return;
+
+ if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
- if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
- {
- m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoReRead>(rPam, *pGrfNd));
- }
+ m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoReRead>(rPam, *pGrfNd));
+ }
- // Because we don't know if we can mirror the graphic, the mirror attribute is always reset
- if( MirrorGraph::Dont != pGrfNd->GetSwAttrSet().
- GetMirrorGrf().GetValue() )
- pGrfNd->SetAttr( SwMirrorGrf() );
+ // Because we don't know if we can mirror the graphic, the mirror attribute is always reset
+ if( MirrorGraph::Dont != pGrfNd->GetSwAttrSet().
+ GetMirrorGrf().GetValue() )
+ pGrfNd->SetAttr( SwMirrorGrf() );
- pGrfNd->ReRead( rGrfName, rFltName, pGraphic );
- m_rDoc.getIDocumentState().SetModified();
- }
+ pGrfNd->ReRead( rGrfName, rFltName, pGraphic );
+ m_rDoc.getIDocumentState().SetModified();
}
// Insert drawing object, which has to be already inserted in the DrawModel
@@ -3399,28 +3399,28 @@ void DocumentContentOperationsManager::InsertItemSet ( const SwPaM &rRg, const S
void DocumentContentOperationsManager::RemoveLeadingWhiteSpace(const SwPosition & rPos )
{
const SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
- if ( pTNd )
+ if ( !pTNd )
+ return;
+
+ const OUString& rText = pTNd->GetText();
+ sal_Int32 nIdx = 0;
+ while (nIdx < rText.getLength())
{
- const OUString& rText = pTNd->GetText();
- sal_Int32 nIdx = 0;
- while (nIdx < rText.getLength())
+ sal_Unicode const cCh = rText[nIdx];
+ if (('\t' != cCh) && (' ' != cCh))
{
- sal_Unicode const cCh = rText[nIdx];
- if (('\t' != cCh) && (' ' != cCh))
- {
- break;
- }
- ++nIdx;
+ break;
}
+ ++nIdx;
+ }
- if ( nIdx > 0 )
- {
- SwPaM aPam(rPos);
- aPam.GetPoint()->nContent = 0;
- aPam.SetMark();
- aPam.GetMark()->nContent = nIdx;
- DeleteRange( aPam );
- }
+ if ( nIdx > 0 )
+ {
+ SwPaM aPam(rPos);
+ aPam.GetPoint()->nContent = 0;
+ aPam.SetMark();
+ aPam.GetMark()->nContent = nIdx;
+ DeleteRange( aPam );
}
}
@@ -3798,41 +3798,41 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
// Rebuild as much as possible of all chains that are available in the original,
OSL_ENSURE( aSet.size() == aVecSwFrameFormat.size(), "Missing new Flys" );
- if ( aSet.size() == aVecSwFrameFormat.size() )
+ if ( aSet.size() != aVecSwFrameFormat.size() )
+ return;
+
+ size_t n = 0;
+ for (const auto& rFlyN : aSet)
{
- size_t n = 0;
- for (const auto& rFlyN : aSet)
+ const SwFrameFormat *pFormatN = rFlyN.GetFormat();
+ const SwFormatChain &rChain = pFormatN->GetChain();
+ int nCnt = int(nullptr != rChain.GetPrev());
+ nCnt += rChain.GetNext() ? 1: 0;
+ size_t k = 0;
+ for (const auto& rFlyK : aSet)
{
- const SwFrameFormat *pFormatN = rFlyN.GetFormat();
- const SwFormatChain &rChain = pFormatN->GetChain();
- int nCnt = int(nullptr != rChain.GetPrev());
- nCnt += rChain.GetNext() ? 1: 0;
- size_t k = 0;
- for (const auto& rFlyK : aSet)
+ const SwFrameFormat *pFormatK = rFlyK.GetFormat();
+ if ( rChain.GetPrev() == pFormatK )
{
- const SwFrameFormat *pFormatK = rFlyK.GetFormat();
- if ( rChain.GetPrev() == pFormatK )
- {
- ::lcl_ChainFormats( static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[k]),
- static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[n]) );
- --nCnt;
- }
- else if ( rChain.GetNext() == pFormatK )
- {
- ::lcl_ChainFormats( static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[n]),
- static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[k]) );
- --nCnt;
- }
- ++k;
+ ::lcl_ChainFormats( static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[k]),
+ static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[n]) );
+ --nCnt;
+ }
+ else if ( rChain.GetNext() == pFormatK )
+ {
+ ::lcl_ChainFormats( static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[n]),
+ static_cast< SwFlyFrameFormat* >(aVecSwFrameFormat[k]) );
+ --nCnt;
}
- ++n;
+ ++k;
}
-
- // Re-create content property of draw formats, knowing how old shapes
- // were paired with old fly formats (aOldTextBoxes) and that aSet is
- // parallel with aVecSwFrameFormat.
- SwTextBoxHelper::restoreLinks(aSet, aVecSwFrameFormat, aOldTextBoxes, aOldContent);
+ ++n;
}
+
+ // Re-create content property of draw formats, knowing how old shapes
+ // were paired with old fly formats (aOldTextBoxes) and that aSet is
+ // parallel with aVecSwFrameFormat.
+ SwTextBoxHelper::restoreLinks(aSet, aVecSwFrameFormat, aOldTextBoxes, aOldContent);
}
/*
@@ -4550,20 +4550,20 @@ static void lcl_PushNumruleState(
// Safe numrule item at destination.
// #i86492# - Safe also <ListId> item of destination.
const SfxItemSet * pAttrSet = pDestTextNd->GetpSwAttrSet();
- if (pAttrSet != nullptr)
+ if (pAttrSet == nullptr)
+ return;
+
+ const SfxPoolItem * pItem = nullptr;
+ aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem);
+ if (SfxItemState::SET == aNumRuleState)
{
- const SfxPoolItem * pItem = nullptr;
- aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem);
- if (SfxItemState::SET == aNumRuleState)
- {
- aNumRuleItem.reset(static_cast<SwNumRuleItem*>(pItem->Clone()));
- }
+ aNumRuleItem.reset(static_cast<SwNumRuleItem*>(pItem->Clone()));
+ }
- aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem);
- if (SfxItemState::SET == aListIdState)
- {
- aListIdItem.reset(static_cast<SfxStringItem*>(pItem->Clone()));
- }
+ aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem);
+ if (SfxItemState::SET == aListIdState)
+ {
+ aListIdItem.reset(static_cast<SfxStringItem*>(pItem->Clone()));
}
}
@@ -4575,24 +4575,24 @@ static void lcl_PopNumruleState(
/* If only a part of one paragraph is copied
restore the numrule at the destination. */
// #i86492# - restore also <ListId> item
- if ( !lcl_MarksWholeNode(rPam) )
+ if ( lcl_MarksWholeNode(rPam) )
+ return;
+
+ if (SfxItemState::SET == aNumRuleState)
{
- if (SfxItemState::SET == aNumRuleState)
- {
- pDestTextNd->SetAttr(*aNumRuleItem);
- }
- else
- {
- pDestTextNd->ResetAttr(RES_PARATR_NUMRULE);
- }
- if (SfxItemState::SET == aListIdState)
- {
- pDestTextNd->SetAttr(*aListIdItem);
- }
- else
- {
- pDestTextNd->ResetAttr(RES_PARATR_LIST_ID);
- }
+ pDestTextNd->SetAttr(*aNumRuleItem);
+ }
+ else
+ {
+ pDestTextNd->ResetAttr(RES_PARATR_NUMRULE);
+ }
+ if (SfxItemState::SET == aListIdState)
+ {
+ pDestTextNd->SetAttr(*aListIdItem);
+ }
+ else
+ {
+ pDestTextNd->ResetAttr(RES_PARATR_LIST_ID);
}
}
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 18da1249341c..5dadd15d2130 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -143,38 +143,38 @@ OutputDevice* DocumentDeviceManager::getReferenceDevice(/*[in]*/ bool bCreate )
void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*[in]*/ bool bNewHiRes )
{
- if ( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual ||
- m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) != bNewHiRes )
- {
- if ( bNewVirtual )
- {
- VirtualDevice* pMyVirDev = getVirtualDevice( true );
- if ( !bNewHiRes )
- pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::Dpi600 );
- else
- pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 );
+ if ( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_VIRTUAL_DEVICE) == bNewVirtual &&
+ m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE) == bNewHiRes )
+ return;
- if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() )
- m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev );
- }
+ if ( bNewVirtual )
+ {
+ VirtualDevice* pMyVirDev = getVirtualDevice( true );
+ if ( !bNewHiRes )
+ pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::Dpi600 );
else
- {
- // #i41075#
- // We have to take care that a printer exists before calling
- // PrtDataChanged() in order to prevent that PrtDataChanged()
- // triggers this funny situation:
- // getReferenceDevice()->getPrinter()->CreatePrinter_()
- // ->setPrinter()-> PrtDataChanged()
- SfxPrinter* pPrinter = getPrinter( true );
- if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() )
- m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter );
- }
+ pMyVirDev->SetReferenceDevice( VirtualDevice::RefDevMode::MSO1 );
- m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_VIRTUAL_DEVICE, bNewVirtual );
- m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes );
- PrtDataChanged();
- m_rDoc.getIDocumentState().SetModified();
+ if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() )
+ m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev );
+ }
+ else
+ {
+ // #i41075#
+ // We have to take care that a printer exists before calling
+ // PrtDataChanged() in order to prevent that PrtDataChanged()
+ // triggers this funny situation:
+ // getReferenceDevice()->getPrinter()->CreatePrinter_()
+ // ->setPrinter()-> PrtDataChanged()
+ SfxPrinter* pPrinter = getPrinter( true );
+ if( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() )
+ m_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter );
}
+
+ m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_VIRTUAL_DEVICE, bNewVirtual );
+ m_rDoc.GetDocumentSettingManager().set(DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE, bNewHiRes );
+ PrtDataChanged();
+ m_rDoc.getIDocumentState().SetModified();
}
const JobSetup* DocumentDeviceManager::getJobsetup() const
diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx
index ef1aa1a29d65..57ecf006d278 100644
--- a/sw/source/core/doc/DocumentDrawModelManager.cxx
+++ b/sw/source/core/doc/DocumentDrawModelManager.cxx
@@ -131,21 +131,21 @@ void DocumentDrawModelManager::InitDrawModel()
mpDrawModel->SetNotifyUndoActionHdl( std::bind( &SwDoc::AddDrawUndo, &m_rDoc, std::placeholders::_1 ));
SwViewShell* const pSh = m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell();
- if ( pSh )
+ if ( !pSh )
+ return;
+
+ for(const SwViewShell& rViewSh : pSh->GetRingContainer())
{
- for(const SwViewShell& rViewSh : pSh->GetRingContainer())
+ SwRootFrame* pRoot = rViewSh.GetLayout();
+ if( pRoot && !pRoot->GetDrawPage() )
{
- SwRootFrame* pRoot = rViewSh.GetLayout();
- if( pRoot && !pRoot->GetDrawPage() )
- {
- // Disable "multiple layout" for the moment:
- // use pMasterPage instead of a new created SdrPage
- // mpDrawModel->AllocPage( FALSE );
- // mpDrawModel->InsertPage( pDrawPage );
- SdrPage* pDrawPage = pMasterPage;
- pRoot->SetDrawPage( pDrawPage );
- pDrawPage->SetSize( pRoot->getFrameArea().SSize() );
- }
+ // Disable "multiple layout" for the moment:
+ // use pMasterPage instead of a new created SdrPage
+ // mpDrawModel->AllocPage( FALSE );
+ // mpDrawModel->InsertPage( pDrawPage );
+ SdrPage* pDrawPage = pMasterPage;
+ pRoot->SetDrawPage( pDrawPage );
+ pDrawPage->SetSize( pRoot->getFrameArea().SSize() );
}
}
}
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index af90f08f8270..c77e93aa00c9 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -343,43 +343,43 @@ void DocumentFieldsManager::RemoveFieldType(size_t nField)
/*
* Dependent fields present -> ErrRaise
*/
- if(nField < mpFieldTypes->size())
- {
- SwFieldType* pTmp = (*mpFieldTypes)[nField].get();
+ if(nField >= mpFieldTypes->size())
+ return;
- // JP 29.07.96: Optionally prepare FieldList for Calculator
- SwFieldIds nWhich = pTmp->Which();
- switch( nWhich )
- {
- case SwFieldIds::SetExp:
- case SwFieldIds::User:
- mpUpdateFields->RemoveFieldType( *pTmp );
- [[fallthrough]];
- case SwFieldIds::Dde:
- if( pTmp->HasWriterListeners() && !m_rDoc.IsUsed( *pTmp ) )
- {
- if( SwFieldIds::SetExp == nWhich )
- static_cast<SwSetExpFieldType*>(pTmp)->SetDeleted( true );
- else if( SwFieldIds::User == nWhich )
- static_cast<SwUserFieldType*>(pTmp)->SetDeleted( true );
- else
- static_cast<SwDDEFieldType*>(pTmp)->SetDeleted( true );
- nWhich = SwFieldIds::Database;
- }
- break;
- default: break;
- }
+ SwFieldType* pTmp = (*mpFieldTypes)[nField].get();
- if( nWhich != SwFieldIds::Database )
+ // JP 29.07.96: Optionally prepare FieldList for Calculator
+ SwFieldIds nWhich = pTmp->Which();
+ switch( nWhich )
+ {
+ case SwFieldIds::SetExp:
+ case SwFieldIds::User:
+ mpUpdateFields->RemoveFieldType( *pTmp );
+ [[fallthrough]];
+ case SwFieldIds::Dde:
+ if( pTmp->HasWriterListeners() && !m_rDoc.IsUsed( *pTmp ) )
{
- OSL_ENSURE( !pTmp->HasWriterListeners(), "Dependent fields present!" );
+ if( SwFieldIds::SetExp == nWhich )
+ static_cast<SwSetExpFieldType*>(pTmp)->SetDeleted( true );
+ else if( SwFieldIds::User == nWhich )
+ static_cast<SwUserFieldType*>(pTmp)->SetDeleted( true );
+ else
+ static_cast<SwDDEFieldType*>(pTmp)->SetDeleted( true );
+ nWhich = SwFieldIds::Database;
}
- else
- (*mpFieldTypes)[nField].release(); // DB fields are ref-counted and delete themselves
+ break;
+ default: break;
+ }
- mpFieldTypes->erase( mpFieldTypes->begin() + nField );
- m_rDoc.getIDocumentState().SetModified();
+ if( nWhich != SwFieldIds::Database )
+ {
+ OSL_ENSURE( !pTmp->HasWriterListeners(), "Dependent fields present!" );
}
+ else
+ (*mpFieldTypes)[nField].release(); // DB fields are ref-counted and delete themselves
+
+ mpFieldTypes->erase( mpFieldTypes->begin() + nField );
+ m_rDoc.getIDocumentState().SetModified();
}
// All have to be re-evaluated.
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 143e20e21005..52bd17fd5230 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -957,81 +957,81 @@ RedlineFlags DocumentRedlineManager::GetRedlineFlags() const
void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode )
{
- if( meRedlineFlags != eMode )
+ if( meRedlineFlags == eMode )
+ return;
+
+ if( (RedlineFlags::ShowMask & meRedlineFlags) != (RedlineFlags::ShowMask & eMode)
+ || !(RedlineFlags::ShowMask & eMode) )
{
- if( (RedlineFlags::ShowMask & meRedlineFlags) != (RedlineFlags::ShowMask & eMode)
- || !(RedlineFlags::ShowMask & eMode) )
+ bool bSaveInXMLImportFlag = m_rDoc.IsInXMLImport();
+ m_rDoc.SetInXMLImport( false );
+ // and then hide/display everything
+ void (SwRangeRedline::*pFnc)(sal_uInt16, size_t); // Allow compiler warn if use of
+ // uninitialized ptr is possible
+
+ RedlineFlags eShowMode = RedlineFlags::ShowMask & eMode;
+ if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
+ pFnc = &SwRangeRedline::Show;
+ else if (eShowMode == RedlineFlags::ShowInsert)
+ pFnc = &SwRangeRedline::Hide;
+ else if (eShowMode == RedlineFlags::ShowDelete)
+ pFnc = &SwRangeRedline::ShowOriginal;
+ else
{
- bool bSaveInXMLImportFlag = m_rDoc.IsInXMLImport();
- m_rDoc.SetInXMLImport( false );
- // and then hide/display everything
- void (SwRangeRedline::*pFnc)(sal_uInt16, size_t); // Allow compiler warn if use of
- // uninitialized ptr is possible
-
- RedlineFlags eShowMode = RedlineFlags::ShowMask & eMode;
- if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
- pFnc = &SwRangeRedline::Show;
- else if (eShowMode == RedlineFlags::ShowInsert)
- pFnc = &SwRangeRedline::Hide;
- else if (eShowMode == RedlineFlags::ShowDelete)
- pFnc = &SwRangeRedline::ShowOriginal;
- else
- {
- pFnc = &SwRangeRedline::Hide;
- eMode |= RedlineFlags::ShowInsert;
- }
+ pFnc = &SwRangeRedline::Hide;
+ eMode |= RedlineFlags::ShowInsert;
+ }
- CheckAnchoredFlyConsistency(m_rDoc);
- CHECK_REDLINE( *this )
+ CheckAnchoredFlyConsistency(m_rDoc);
+ CHECK_REDLINE( *this )
- o3tl::sorted_vector<SwRootFrame *> hiddenLayouts;
- if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
+ o3tl::sorted_vector<SwRootFrame *> hiddenLayouts;
+ if (eShowMode == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete))
+ {
+ // sw_redlinehide: the problem here is that MoveFromSection
+ // creates the frames wrongly (non-merged), because its own
+ // SwRangeRedline has wrong positions until after the nodes
+ // are all moved, so fix things up by force by re-creating
+ // all merged frames from scratch.
+ o3tl::sorted_vector<SwRootFrame *> const layouts(m_rDoc.GetAllLayouts());
+ for (SwRootFrame *const pLayout : layouts)
{
- // sw_redlinehide: the problem here is that MoveFromSection
- // creates the frames wrongly (non-merged), because its own
- // SwRangeRedline has wrong positions until after the nodes
- // are all moved, so fix things up by force by re-creating
- // all merged frames from scratch.
- o3tl::sorted_vector<SwRootFrame *> const layouts(m_rDoc.GetAllLayouts());
- for (SwRootFrame *const pLayout : layouts)
+ if (pLayout->IsHideRedlines())
{
- if (pLayout->IsHideRedlines())
- {
- pLayout->SetHideRedlines(false);
- hiddenLayouts.insert(pLayout);
- }
+ pLayout->SetHideRedlines(false);
+ hiddenLayouts.insert(pLayout);
}
}
+ }
- for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
- for (size_t i = 0; i < mpRedlineTable->size(); ++i)
- {
- SwRangeRedline *const pRedline((*mpRedlineTable)[i]);
- (pRedline->*pFnc)(nLoop, i);
- while (mpRedlineTable->size() <= i
- || (*mpRedlineTable)[i] != pRedline)
- { // ensure current position
- --i; // a previous redline may have been deleted
- }
+ for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
+ for (size_t i = 0; i < mpRedlineTable->size(); ++i)
+ {
+ SwRangeRedline *const pRedline((*mpRedlineTable)[i]);
+ (pRedline->*pFnc)(nLoop, i);
+ while (mpRedlineTable->size() <= i
+ || (*mpRedlineTable)[i] != pRedline)
+ { // ensure current position
+ --i; // a previous redline may have been deleted
}
+ }
- //SwRangeRedline::MoveFromSection routinely changes
- //the keys that mpRedlineTable is sorted by
- mpRedlineTable->Resort();
-
- CheckAnchoredFlyConsistency(m_rDoc);
- CHECK_REDLINE( *this )
+ //SwRangeRedline::MoveFromSection routinely changes
+ //the keys that mpRedlineTable is sorted by
+ mpRedlineTable->Resort();
- for (SwRootFrame *const pLayout : hiddenLayouts)
- {
- pLayout->SetHideRedlines(true);
- }
+ CheckAnchoredFlyConsistency(m_rDoc);
+ CHECK_REDLINE( *this )
- m_rDoc.SetInXMLImport( bSaveInXMLImportFlag );
+ for (SwRootFrame *const pLayout : hiddenLayouts)
+ {
+ pLayout->SetHideRedlines(true);
}
- meRedlineFlags = eMode;
- m_rDoc.getIDocumentState().SetModified();
+
+ m_rDoc.SetInXMLImport( bSaveInXMLImportFlag );
}
+ meRedlineFlags = eMode;
+ m_rDoc.getIDocumentState().SetModified();
// #TODO - add 'SwExtraRedlineTable' also ?
}
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 09f0d5efb2cc..843b6067f3c6 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -571,28 +571,28 @@ CharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const
void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/CharCompressType n )
{
- if( meChrCmprType != n )
+ if( meChrCmprType == n )
+ return;
+
+ meChrCmprType = n;
+
+ SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
+ if( pDrawModel )
{
- meChrCmprType = n;
-
- SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
- if( pDrawModel )
- {
- pDrawModel->SetCharCompressType( n );
- if( !m_rDoc.IsInReading() )
- pDrawModel->ReformatAllTextObjects();
- }
-
- SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
- if( pTmpRoot && !m_rDoc.IsInReading() )
- {
- pTmpRoot->StartAllAction();
- for( auto aLayout : m_rDoc.GetAllLayouts() )
- aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
- pTmpRoot->EndAllAction();
- }
- m_rDoc.getIDocumentState().SetModified();
+ pDrawModel->SetCharCompressType( n );
+ if( !m_rDoc.IsInReading() )
+ pDrawModel->ReformatAllTextObjects();
}
+
+ SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
+ if( pTmpRoot && !m_rDoc.IsInReading() )
+ {
+ pTmpRoot->StartAllAction();
+ for( auto aLayout : m_rDoc.GetAllLayouts() )
+ aLayout->InvalidateAllContent(SwInvalidateFlags::Size);
+ pTmpRoot->EndAllAction();
+ }
+ m_rDoc.getIDocumentState().SetModified();
}
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index 9508e6d7216c..03e00df6ceee 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -86,19 +86,19 @@ void DocumentStatisticsManager::SetDocStat( const SwDocStat& rStat )
void DocumentStatisticsManager::UpdateDocStat( bool bCompleteAsync, bool bFields )
{
- if( mpDocStat->bModified || !mbInitialized)
+ if( !(mpDocStat->bModified || !mbInitialized))
+ return;
+
+ if (!bCompleteAsync)
{
- if (!bCompleteAsync)
- {
- maStatsUpdateIdle.Stop();
- while (IncrementalDocStatCalculate(
- std::numeric_limits<long>::max(), bFields)) {}
- }
- else if (IncrementalDocStatCalculate(5000, bFields))
- maStatsUpdateIdle.Start();
- else
- maStatsUpdateIdle.Stop();
+ maStatsUpdateIdle.Stop();
+ while (IncrementalDocStatCalculate(
+ std::numeric_limits<long>::max(), bFields)) {}
}
+ else if (IncrementalDocStatCalculate(5000, bFields))
+ maStatsUpdateIdle.Start();
+ else
+ maStatsUpdateIdle.Stop();
}
// returns true while there is more to do
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index b256c50658a1..720dfd6c9120 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -361,22 +361,22 @@ void SwAutoCompleteWord::CheckChangedList(
}
}
// remove the elements at the end of the array
- if( nMyPos < nMyLen )
+ if( nMyPos >= nMyLen )
+ return;
+
+ // clear LRU array first then delete the string object
+ for( ; nNewPos < nMyLen; ++nNewPos )
{
- // clear LRU array first then delete the string object
- for( ; nNewPos < nMyLen; ++nNewPos )
- {
- SwAutoCompleteString *const pDel =
- dynamic_cast<SwAutoCompleteString*>(m_WordList[nNewPos]);
- SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pDel );
- OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
- m_aLRUList.erase( it );
- delete pDel;
- }
- // remove from array
- m_WordList.erase(m_WordList.begin() + nMyPos,
- m_WordList.begin() + nMyLen);
+ SwAutoCompleteString *const pDel =
+ dynamic_cast<SwAutoCompleteString*>(m_WordList[nNewPos]);
+ SwAutoCompleteStringPtrDeque::iterator it = std::find( m_aLRUList.begin(), m_aLRUList.end(), pDel );
+ OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
+ m_aLRUList.erase( it );
+ delete pDel;
}
+ // remove from array
+ m_WordList.erase(m_WordList.begin() + nMyPos,
+ m_WordList.begin() + nMyLen);
}
void SwAutoCompleteWord::DocumentDying(const SwDoc& rDoc)
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index b51e957810b3..f560de2e7238 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1185,20 +1185,20 @@ void SwDoc::SpellItAgainSam( bool bInvalid, bool bOnlyWrong, bool bSmartTags )
void SwDoc::InvalidateAutoCompleteFlag()
{
SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
- if( pTmpRoot )
- {
- o3tl::sorted_vector<SwRootFrame*> aAllLayouts = GetAllLayouts();
- for( auto aLayout : aAllLayouts )
- aLayout->AllInvalidateAutoCompleteWords();
- for( sal_uLong nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd )
- {
- SwTextNode* pTextNode = GetNodes()[ nNd ]->GetTextNode();
- if ( pTextNode ) pTextNode->SetAutoCompleteWordDirty( true );
- }
+ if( !pTmpRoot )
+ return;
- for( auto aLayout : aAllLayouts )
- aLayout->SetIdleFlags();
+ o3tl::sorted_vector<SwRootFrame*> aAllLayouts = GetAllLayouts();
+ for( auto aLayout : aAllLayouts )
+ aLayout->AllInvalidateAutoCompleteWords();
+ for( sal_uLong nNd = 1, nCnt = GetNodes().Count(); nNd < nCnt; ++nNd )
+ {
+ SwTextNode* pTextNode = GetNodes()[ nNd ]->GetTextNode();
+ if ( pTextNode ) pTextNode->SetAutoCompleteWordDirty( true );
}
+
+ for( auto aLayout : aAllLayouts )
+ aLayout->SetIdleFlags();
}
const SwFormatINetFormat* SwDoc::FindINetAttr( const OUString& rName ) const
@@ -1223,73 +1223,73 @@ const SwFormatINetFormat* SwDoc::FindINetAttr( const OUString& rName ) const
void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress )
{
const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds();
- if( pExtDoc && !rOutNds.empty() )
+ if( !(pExtDoc && !rOutNds.empty()) )
+ return;
+
+ ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.size(), GetDocShell() );
+ SwNodeIndex aEndOfDoc( pExtDoc->GetNodes().GetEndOfContent(), -1 );
+ for( SwOutlineNodes::size_type i = 0; i < rOutNds.size(); ++i )
{
- ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.size(), GetDocShell() );
- SwNodeIndex aEndOfDoc( pExtDoc->GetNodes().GetEndOfContent(), -1 );
- for( SwOutlineNodes::size_type i = 0; i < rOutNds.size(); ++i )
+ ::SetProgressState( static_cast<long>(i), GetDocShell() );
+ const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
+
+ const int nLvl = GetNodes()[ nIndex ]->GetTextNode()->GetAttrOutlineLevel()-1;
+ if( nLvl > nLevel )
+ continue;
+ long nEndOfs = 1;
+ sal_uInt8 nWish = nPara;
+ sal_uLong nNextOutNd = i + 1 < rOutNds.size() ?
+ rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count();
+ bool bKeep = false;
+ while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
+ GetNodes()[ nIndex + nEndOfs ]->IsTextNode() )
{
- ::SetProgressState( static_cast<long>(i), GetDocShell() );
- const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
+ SwTextNode* pTextNode = GetNodes()[ nIndex+nEndOfs ]->GetTextNode();
+ if (pTextNode->GetText().getLength() && nWish)
+ --nWish;
+ bKeep = pTextNode->GetSwAttrSet().GetKeep().GetValue();
+ ++nEndOfs;
+ }
- const int nLvl = GetNodes()[ nIndex ]->GetTextNode()->GetAttrOutlineLevel()-1;
- if( nLvl > nLevel )
- continue;
- long nEndOfs = 1;
- sal_uInt8 nWish = nPara;
- sal_uLong nNextOutNd = i + 1 < rOutNds.size() ?
- rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count();
- bool bKeep = false;
- while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
- GetNodes()[ nIndex + nEndOfs ]->IsTextNode() )
+ SwNodeRange aRange( *rOutNds[ i ], 0, *rOutNds[ i ], nEndOfs );
+ GetNodes().Copy_( aRange, aEndOfDoc );
+ }
+ const SwTextFormatColls *pColl = pExtDoc->GetTextFormatColls();
+ for( SwTextFormatColls::size_type i = 0; i < pColl->size(); ++i )
+ (*pColl)[ i ]->ResetFormatAttr( RES_PAGEDESC, RES_BREAK );
+ SwNodeIndex aIndx( pExtDoc->GetNodes().GetEndOfExtras() );
+ ++aEndOfDoc;
+ while( aIndx < aEndOfDoc )
+ {
+ bool bDelete = false;
+ SwNode *pNode = &aIndx.GetNode();
+ if( pNode->IsTextNode() )
+ {
+ SwTextNode *pNd = pNode->GetTextNode();
+ if( pNd->HasSwAttrSet() )
+ pNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
+ if( bImpress )
{
- SwTextNode* pTextNode = GetNodes()[ nIndex+nEndOfs ]->GetTextNode();
- if (pTextNode->GetText().getLength() && nWish)
- --nWish;
- bKeep = pTextNode->GetSwAttrSet().GetKeep().GetValue();
- ++nEndOfs;
+ SwTextFormatColl* pMyColl = pNd->GetTextColl();
+
+ const sal_uInt16 nHeadLine = static_cast<sal_uInt16>(
+ !pMyColl->IsAssignedToListLevelOfOutlineStyle()
+ ? RES_POOLCOLL_HEADLINE2
+ : RES_POOLCOLL_HEADLINE1 );
+ pMyColl = pExtDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nHeadLine );
+ pNd->ChgFormatColl( pMyColl );
}
-
- SwNodeRange aRange( *rOutNds[ i ], 0, *rOutNds[ i ], nEndOfs );
- GetNodes().Copy_( aRange, aEndOfDoc );
- }
- const SwTextFormatColls *pColl = pExtDoc->GetTextFormatColls();
- for( SwTextFormatColls::size_type i = 0; i < pColl->size(); ++i )
- (*pColl)[ i ]->ResetFormatAttr( RES_PAGEDESC, RES_BREAK );
- SwNodeIndex aIndx( pExtDoc->GetNodes().GetEndOfExtras() );
- ++aEndOfDoc;
- while( aIndx < aEndOfDoc )
- {
- bool bDelete = false;
- SwNode *pNode = &aIndx.GetNode();
- if( pNode->IsTextNode() )
+ if( !pNd->Len() &&
+ pNd->StartOfSectionIndex()+2 < pNd->EndOfSectionIndex() )
{
- SwTextNode *pNd = pNode->GetTextNode();
- if( pNd->HasSwAttrSet() )
- pNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
- if( bImpress )
- {
- SwTextFormatColl* pMyColl = pNd->GetTextColl();
-
- const sal_uInt16 nHeadLine = static_cast<sal_uInt16>(
- !pMyColl->IsAssignedToListLevelOfOutlineStyle()
- ? RES_POOLCOLL_HEADLINE2
- : RES_POOLCOLL_HEADLINE1 );
- pMyColl = pExtDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nHeadLine );
- pNd->ChgFormatColl( pMyColl );
- }
- if( !pNd->Len() &&
- pNd->StartOfSectionIndex()+2 < pNd->EndOfSectionIndex() )
- {
- bDelete = true;
- pExtDoc->GetNodes().Delete( aIndx );
- }
+ bDelete = true;
+ pExtDoc->GetNodes().Delete( aIndx );
}
- if( !bDelete )
- ++aIndx;
}
- ::EndProgress( GetDocShell() );
+ if( !bDelete )
+ ++aIndx;
}
+ ::EndProgress( GetDocShell() );
}
namespace
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 429c2e1129f6..002582c6cb4a 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1759,29 +1759,29 @@ void SaveBookmark::SetInDoc(
else
aPam.GetPoint()->nContent.Assign(aPam.GetContentNode(), m_nContent1);
- if(!aPam.HasMark()
- || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true))
+ if(!(!aPam.HasMark()
+ || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true)))
+ return;
+
+ ::sw::mark::IBookmark* const pBookmark = dynamic_cast<::sw::mark::IBookmark*>(
+ pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName,
+ m_eOrigBkmType, sw::mark::InsertMode::New));
+ if(!pBookmark)
+ return;
+
+ pBookmark->SetKeyCode(m_aCode);
+ pBookmark->SetShortName(m_aShortName);
+ pBookmark->Hide(m_bHidden);
+ pBookmark->SetHideCondition(m_aHideCondition);
+
+ if (m_pMetadataUndo)
{
- ::sw::mark::IBookmark* const pBookmark = dynamic_cast<::sw::mark::IBookmark*>(
- pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName,
- m_eOrigBkmType, sw::mark::InsertMode::New));
- if(pBookmark)
+ ::sfx2::Metadatable * const pMeta(
+ dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
+ assert(pMeta && "metadata undo, but not metadatable?");
+ if (pMeta)
{
- pBookmark->SetKeyCode(m_aCode);
- pBookmark->SetShortName(m_aShortName);
- pBookmark->Hide(m_bHidden);
- pBookmark->SetHideCondition(m_aHideCondition);
-
- if (m_pMetadataUndo)
- {
- ::sfx2::Metadatable * const pMeta(
- dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
- assert(pMeta && "metadata undo, but not metadatable?");
- if (pMeta)
- {
- pMeta->RestoreMetadata(m_pMetadataUndo);
- }
- }
+ pMeta->RestoreMetadata(m_pMetadataUndo);
}
}
}
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 4acfb511949a..0e2cef59555b 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -78,19 +78,19 @@ bool SwTable::IsTableComplexForChart( const OUString& rSelection ) const
void SwDoc::DoUpdateAllCharts()
{
SwViewShell* pVSh = getIDocumentLayoutAccess().GetCurrentViewShell();
- if( pVSh )
+ if( !pVSh )
+ return;
+
+ const SwFrameFormats& rTableFormats = *GetTableFrameFormats();
+ for( size_t n = 0; n < rTableFormats.size(); ++n )
{
- const SwFrameFormats& rTableFormats = *GetTableFrameFormats();
- for( size_t n = 0; n < rTableFormats.size(); ++n )
- {
- const SwFrameFormat* pFormat = rTableFormats[ n ];
- if( SwTable* pTmpTable = SwTable::FindTable( pFormat ) )
- if( const SwTableNode* pTableNd = pTmpTable->GetTableNode() )
- if( pTableNd->GetNodes().IsDocNodes() )
- {
- UpdateCharts_( *pTmpTable, *pVSh );
- }
- }
+ const SwFrameFormat* pFormat = rTableFormats[ n ];
+ if( SwTable* pTmpTable = SwTable::FindTable( pFormat ) )
+ if( const SwTableNode* pTableNd = pTmpTable->GetTableNode() )
+ if( pTableNd->GetNodes().IsDocNodes() )
+ {
+ UpdateCharts_( *pTmpTable, *pVSh );
+ }
}
}
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 279fbdeb4c54..149f2e1eb518 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -543,32 +543,32 @@ Hash::Hash( sal_uLong nSize )
void Hash::CalcHashValue( CompareData& rData )
{
- if( m_pHashArr )
+ if( !m_pHashArr )
+ return;
+
+ for( size_t n = 0; n < rData.GetLineCount(); ++n )
{
- for( size_t n = 0; n < rData.GetLineCount(); ++n )
- {
- const SwCompareLine* pLine = rData.GetLine( n );
- OSL_ENSURE( pLine, "where is the line?" );
- sal_uLong nH = pLine->GetHashValue();
-
- sal_uLong* pFound = &m_pHashArr[ nH % m_nPrime ];
- size_t i;
- for( i = *pFound; ; i = m_pDataArr[i].nNext )
- if( !i )
- {
- i = m_nCount++;
- m_pDataArr[i].nNext = *pFound;
- m_pDataArr[i].nHash = nH;
- m_pDataArr[i].pLine = pLine;
- *pFound = i;
- break;
- }
- else if( m_pDataArr[i].nHash == nH &&
- m_pDataArr[i].pLine->Compare( *pLine ))
- break;
+ const SwCompareLine* pLine = rData.GetLine( n );
+ OSL_ENSURE( pLine, "where is the line?" );
+ sal_uLong nH = pLine->GetHashValue();
- rData.SetIndex( n, i );
- }
+ sal_uLong* pFound = &m_pHashArr[ nH % m_nPrime ];
+ size_t i;
+ for( i = *pFound; ; i = m_pDataArr[i].nNext )
+ if( !i )
+ {
+ i = m_nCount++;
+ m_pDataArr[i].nNext = *pFound;
+ m_pDataArr[i].nHash = nH;
+ m_pDataArr[i].pLine = pLine;
+ *pFound = i;
+ break;
+ }
+ else if( m_pDataArr[i].nHash == nH &&
+ m_pDataArr[i].pLine->Compare( *pLine ))
+ break;
+
+ rData.SetIndex( n, i );
}
}
@@ -1703,82 +1703,82 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
}
pTmp = m_pInsertRing.get();
- if( pTmp )
- {
- do {
- if( pTmp->GetPoint()->nContent == 0 )
- {
- ++pTmp->GetPoint()->nNode;
- pTmp->GetPoint()->nContent.Assign( pTmp->GetContentNode(), 0 );
- }
- // #i101009#
- // prevent redlines that end on structural end node
- if (& GetEndOfContent() ==
- & pTmp->GetPoint()->nNode.GetNode())
- {
- --pTmp->GetPoint()->nNode;
- SwContentNode *const pContentNode( pTmp->GetContentNode() );
- pTmp->GetPoint()->nContent.Assign( pContentNode,
- pContentNode ? pContentNode->Len() : 0 );
- // tdf#106218 try to avoid losing a paragraph break here:
- if (pTmp->GetMark()->nContent == 0)
- {
- SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
- if (prev.GetNode().IsTextNode())
- {
- *pTmp->GetMark() = SwPosition(
- *prev.GetNode().GetTextNode(),
- prev.GetNode().GetTextNode()->Len());
- }
- }
- }
- } while( m_pInsertRing.get() != ( pTmp = pTmp->GetNext()) );
- SwRedlineData aRedlnData( RedlineType::Insert, nAuthor, aTimeStamp,
- OUString(), nullptr );
+ if( !pTmp )
+ return;
- // combine consecutive
- if( pTmp->GetNext() != m_pInsertRing.get() )
+ do {
+ if( pTmp->GetPoint()->nContent == 0 )
{
- do {
- SwPosition& rSttEnd = *pTmp->End(),
- & rEndStt = *pTmp->GetNext()->Start();
- const SwContentNode* pCNd;
- if( rSttEnd == rEndStt ||
- (!rEndStt.nContent.GetIndex() &&
- rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
- nullptr != ( pCNd = rSttEnd.nNode.GetNode().GetContentNode() ) &&
- rSttEnd.nContent.GetIndex() == pCNd->Len()))
+ ++pTmp->GetPoint()->nNode;
+ pTmp->GetPoint()->nContent.Assign( pTmp->GetContentNode(), 0 );
+ }
+ // #i101009#
+ // prevent redlines that end on structural end node
+ if (& GetEndOfContent() ==
+ & pTmp->GetPoint()->nNode.GetNode())
+ {
+ --pTmp->GetPoint()->nNode;
+ SwContentNode *const pContentNode( pTmp->GetContentNode() );
+ pTmp->GetPoint()->nContent.Assign( pContentNode,
+ pContentNode ? pContentNode->Len() : 0 );
+ // tdf#106218 try to avoid losing a paragraph break here:
+ if (pTmp->GetMark()->nContent == 0)
+ {
+ SwNodeIndex const prev(pTmp->GetMark()->nNode, -1);
+ if (prev.GetNode().IsTextNode())
{
- if( pTmp->GetNext() == m_pInsertRing.get() )
- {
- // are consecutive, so combine
- rEndStt = *pTmp->Start();
- delete pTmp;
- pTmp = m_pInsertRing.get();
- }
- else
- {
- // are consecutive, so combine
- rSttEnd = *pTmp->GetNext()->End();
- delete pTmp->GetNext();
- }
+ *pTmp->GetMark() = SwPosition(
+ *prev.GetNode().GetTextNode(),
+ prev.GetNode().GetTextNode()->Len());
}
- else
- pTmp = pTmp->GetNext();
- } while( m_pInsertRing.get() != pTmp );
+ }
}
+ } while( m_pInsertRing.get() != ( pTmp = pTmp->GetNext()) );
+ SwRedlineData aRedlnData( RedlineType::Insert, nAuthor, aTimeStamp,
+ OUString(), nullptr );
+ // combine consecutive
+ if( pTmp->GetNext() != m_pInsertRing.get() )
+ {
do {
- if (IDocumentRedlineAccess::AppendResult::APPENDED ==
- m_rDoc.getIDocumentRedlineAccess().AppendRedline(
- new SwRangeRedline(aRedlnData, *pTmp), true) &&
- m_rDoc.GetIDocumentUndoRedo().DoesUndo())
+ SwPosition& rSttEnd = *pTmp->End(),
+ & rEndStt = *pTmp->GetNext()->Start();
+ const SwContentNode* pCNd;
+ if( rSttEnd == rEndStt ||
+ (!rEndStt.nContent.GetIndex() &&
+ rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
+ nullptr != ( pCNd = rSttEnd.nNode.GetNode().GetContentNode() ) &&
+ rSttEnd.nContent.GetIndex() == pCNd->Len()))
{
- m_rDoc.GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoCompDoc>( *pTmp, true ));
+ if( pTmp->GetNext() == m_pInsertRing.get() )
+ {
+ // are consecutive, so combine
+ rEndStt = *pTmp->Start();
+ delete pTmp;
+ pTmp = m_pInsertRing.get();
+ }
+ else
+ {
+ // are consecutive, so combine
+ rSttEnd = *pTmp->GetNext()->End();
+ delete pTmp->GetNext();
+ }
}
- } while( m_pInsertRing.get() != ( pTmp = pTmp->GetNext()) );
+ else
+ pTmp = pTmp->GetNext();
+ } while( m_pInsertRing.get() != pTmp );
}
+
+ do {
+ if (IDocumentRedlineAccess::AppendResult::APPENDED ==
+ m_rDoc.getIDocumentRedlineAccess().AppendRedline(
+ new SwRangeRedline(aRedlnData, *pTmp), true) &&
+ m_rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_rDoc.GetIDocumentUndoRedo().AppendUndo(
+ std::make_unique<SwUndoCompDoc>( *pTmp, true ));
+ }
+ } while( m_pInsertRing.get() != ( pTmp = pTmp->GetNext()) );
}
typedef std::shared_ptr<CompareData> CompareDataPtr;
@@ -1924,19 +1924,19 @@ SaveMergeRedline::SaveMergeRedline( const SwNode& rDstNd,
aPos.nContent.Assign( const_cast<SwContentNode*>(static_cast<const SwContentNode*>(&rDstNd)), pStt->nContent.GetIndex() );
pDestRedl = new SwRangeRedline( rSrcRedl.GetRedlineData(), aPos );
- if( RedlineType::Delete == pDestRedl->GetType() )
- {
- // mark the area as deleted
- const SwPosition* pEnd = pStt == rSrcRedl.GetPoint()
- ? rSrcRedl.GetMark()
- : rSrcRedl.GetPoint();
+ if( RedlineType::Delete != pDestRedl->GetType() )
+ return;
- pDestRedl->SetMark();
- pDestRedl->GetPoint()->nNode += pEnd->nNode.GetIndex() -
- pStt->nNode.GetIndex();
- pDestRedl->GetPoint()->nContent.Assign( pDestRedl->GetContentNode(),
- pEnd->nContent.GetIndex() );
- }
+ // mark the area as deleted
+ const SwPosition* pEnd = pStt == rSrcRedl.GetPoint()
+ ? rSrcRedl.GetMark()
+ : rSrcRedl.GetPoint();
+
+ pDestRedl->SetMark();
+ pDestRedl->GetPoint()->nNode += pEnd->nNode.GetIndex() -
+ pStt->nNode.GetIndex();
+ pDestRedl->GetPoint()->nContent.Assign( pDestRedl->GetContentNode(),
+ pEnd->nContent.GetIndex() );
}
sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline)
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 036185e88d7d..e63097b29279 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -770,36 +770,36 @@ void SwDoc::PrtOLENotify( bool bAll )
IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
{
SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
- if( pSh )
- {
- mbOLEPrtNotifyPending = mbAllOLENotify = false;
+ if( !pSh )
+ return;
- std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
- if( pNodes )
- {
- ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
- 0, pNodes->size(), GetDocShell());
- getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
- SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
+ mbOLEPrtNotifyPending = mbAllOLENotify = false;
- for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
- {
- ::SetProgressState( i, GetDocShell() );
+ std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
+ if( !pNodes )
+ return;
- SwOLENode* pOLENd = (*pNodes)[i];
- pOLENd->SetOLESizeInvalid( false );
+ ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
+ 0, pNodes->size(), GetDocShell());
+ getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
+ SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
- // We don't know it, so the object has to be loaded.
- // If it doesn't want to be informed
- if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
- {
- pOLENd->ModifyNotification( &aMsgHint, &aMsgHint );
- }
- }
- getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
- ::EndProgress( GetDocShell() );
+ for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
+ {
+ ::SetProgressState( i, GetDocShell() );
+
+ SwOLENode* pOLENd = (*pNodes)[i];
+ pOLENd->SetOLESizeInvalid( false );
+
+ // We don't know it, so the object has to be loaded.
+ // If it doesn't want to be informed
+ if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
+ {
+ pOLENd->ModifyNotification( &aMsgHint, &aMsgHint );
}
}
+ getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
+ ::EndProgress( GetDocShell() );
}
static SwPageDesc* lcl_FindPageDesc( const SwPageDescs *pPageDescs,
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 07902efe3fd4..ceb7ada2f865 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -264,23 +264,23 @@ SaveRedlEndPosForRestore::SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx,
{
SwNode& rNd = rInsIdx.GetNode();
SwDoc* pDest = rNd.GetDoc();
- if( !pDest->getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ if( pDest->getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ return;
+
+ SwRedlineTable::size_type nFndPos;
+ const SwPosition* pEnd;
+ SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
+ pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
+ const SwRangeRedline* pRedl;
+ while( nFndPos--
+ && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
+ && *pRedl->Start() < aSrcPos )
{
- SwRedlineTable::size_type nFndPos;
- const SwPosition* pEnd;
- SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
- pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
- const SwRangeRedline* pRedl;
- while( nFndPos--
- && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
- && *pRedl->Start() < aSrcPos )
+ if( !mpSaveIndex )
{
- if( !mpSaveIndex )
- {
- mpSaveIndex.reset(new SwNodeIndex( rInsIdx, -1 ));
- }
- mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
+ mpSaveIndex.reset(new SwNodeIndex( rInsIdx, -1 ));
}
+ mvSavArr.push_back( const_cast<SwPosition*>(pEnd) );
}
}
@@ -328,31 +328,31 @@ void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& rJoinPrev )
{
rJoinText = false;
rJoinPrev = false;
- if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
- {
- const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
- SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
- if( pSttNd )
- {
- SwTextNode *pEndNd = pEnd->nNode.GetNode().GetTextNode();
- rJoinText = nullptr != pEndNd;
- if( rJoinText )
- {
- bool bExchange = pStt == rPam.GetPoint();
- if( !pStt->nContent.GetIndex() &&
- pEndNd->GetText().getLength() != pEnd->nContent.GetIndex())
- bExchange = !bExchange;
- if( bExchange )
- rPam.Exchange();
- rJoinPrev = rPam.GetPoint() == pStt;
- OSL_ENSURE( !pStt->nContent.GetIndex() &&
- pEndNd->GetText().getLength() != pEnd->nContent.GetIndex()
- ? (rPam.GetPoint()->nNode < rPam.GetMark()->nNode)
- : (rPam.GetPoint()->nNode > rPam.GetMark()->nNode),
- "sw_GetJoinFlags");
- }
- }
- }
+ if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode )
+ return;
+
+ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+ SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
+ if( !pSttNd )
+ return;
+
+ SwTextNode *pEndNd = pEnd->nNode.GetNode().GetTextNode();
+ rJoinText = nullptr != pEndNd;
+ if( !rJoinText )
+ return;
+
+ bool bExchange = pStt == rPam.GetPoint();
+ if( !pStt->nContent.GetIndex() &&
+ pEndNd->GetText().getLength() != pEnd->nContent.GetIndex())
+ bExchange = !bExchange;
+ if( bExchange )
+ rPam.Exchange();
+ rJoinPrev = rPam.GetPoint() == pStt;
+ OSL_ENSURE( !pStt->nContent.GetIndex() &&
+ pEndNd->GetText().getLength() != pEnd->nContent.GetIndex()
+ ? (rPam.GetPoint()->nNode < rPam.GetMark()->nNode)
+ : (rPam.GetPoint()->nNode > rPam.GetMark()->nNode),
+ "sw_GetJoinFlags");
}
bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 7d4691a3422c..57f976d27e5b 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -1094,21 +1094,21 @@ void SwDocUpdateField::InsertFieldType( const SwFieldType& rType )
OSL_ENSURE( false, "No valid field type" );
}
- if( !sFieldName.isEmpty() )
- {
- SetFieldsDirty( true );
- // look up and remove from the hash table
- sFieldName = GetAppCharClass().lowercase( sFieldName );
- sal_uInt16 n;
+ if( sFieldName.isEmpty() )
+ return;
+
+ SetFieldsDirty( true );
+ // look up and remove from the hash table
+ sFieldName = GetAppCharClass().lowercase( sFieldName );
+ sal_uInt16 n;
- SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
+ SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
- if( !pFnd )
- {
- SwCalcFieldType* pNew = new SwCalcFieldType( sFieldName, &rType );
- pNew->pNext.reset( m_FieldTypeTable[n].release() );
- m_FieldTypeTable[n].reset(pNew);
- }
+ if( !pFnd )
+ {
+ SwCalcFieldType* pNew = new SwCalcFieldType( sFieldName, &rType );
+ pNew->pNext.reset( m_FieldTypeTable[n].release() );
+ m_FieldTypeTable[n].reset(pNew);
}
}
@@ -1126,29 +1126,29 @@ void SwDocUpdateField::RemoveFieldType( const SwFieldType& rType )
default: break;
}
- if( !sFieldName.isEmpty() )
- {
- SetFieldsDirty( true );
- // look up and remove from the hash table
- sFieldName = GetAppCharClass().lowercase( sFieldName );
- sal_uInt16 n;
+ if( sFieldName.isEmpty() )
+ return;
- SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
- if( pFnd )
- {
- if (m_FieldTypeTable[n].get() == pFnd)
- {
- m_FieldTypeTable[n].reset(static_cast<SwCalcFieldType*>(pFnd->pNext.release()));
- }
- else
- {
- SwHash* pPrev = m_FieldTypeTable[n].get();
- while( pPrev->pNext.get() != pFnd )
- pPrev = pPrev->pNext.get();
- pPrev->pNext = std::move(pFnd->pNext);
- // no need to explicitly delete here, the embedded linked list uses unique_ptr
- }
- }
+ SetFieldsDirty( true );
+ // look up and remove from the hash table
+ sFieldName = GetAppCharClass().lowercase( sFieldName );
+ sal_uInt16 n;
+
+ SwCalcFieldType* pFnd = GetFieldTypeTable().Find( sFieldName, &n );
+ if( !pFnd )
+ return;
+
+ if (m_FieldTypeTable[n].get() == pFnd)
+ {
+ m_FieldTypeTable[n].reset(static_cast<SwCalcFieldType*>(pFnd->pNext.release()));
+ }
+ else
+ {
+ SwHash* pPrev = m_FieldTypeTable[n].get();
+ while( pPrev->pNext.get() != pFnd )
+ pPrev = pPrev->pNext.get();
+ pPrev->pNext = std::move(pFnd->pNext);
+ // no need to explicitly delete here, the embedded linked list uses unique_ptr
}
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index dfab43445940..b0d5f00dfd40 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1364,45 +1364,45 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
else
pOldFormat = static_cast<SwFormatFooter*>(pNewItem.get())->GetFooterFormat();
- if( pOldFormat )
- {
- SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
- GetDfltFrameFormat() );
- pNewFormat->CopyAttrs( *pOldFormat );
+ if( !pOldFormat )
+ return;
+
+ SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
+ GetDfltFrameFormat() );
+ pNewFormat->CopyAttrs( *pOldFormat );
- if( SfxItemState::SET == pNewFormat->GetAttrSet().GetItemState(
- RES_CNTNT, false, &pItem ))
+ if( SfxItemState::SET == pNewFormat->GetAttrSet().GetItemState(
+ RES_CNTNT, false, &pItem ))
+ {
+ const SwFormatContent* pContent = static_cast<const SwFormatContent*>(pItem);
+ if( pContent->GetContentIdx() )
{
- const SwFormatContent* pContent = static_cast<const SwFormatContent*>(pItem);
- if( pContent->GetContentIdx() )
- {
- SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
- const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
- SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmpIdx,
- bCpyHeader
- ? SwHeaderStartNode
- : SwFooterStartNode );
- const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
- SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
- aTmpIdx = *pSttNd->EndOfSectionNode();
- rSrcNds.Copy_( aRg, aTmpIdx );
- aTmpIdx = *pSttNd;
- rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
- // TODO: investigate calling CopyWithFlyInFly?
- SwPaM const source(aRg.aStart, aRg.aEnd);
- SwPosition dest(aTmpIdx);
- sw::CopyBookmarks(source, dest);
- pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
- }
- else
- pNewFormat->ResetFormatAttr( RES_CNTNT );
+ SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
+ const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
+ SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmpIdx,
+ bCpyHeader
+ ? SwHeaderStartNode
+ : SwFooterStartNode );
+ const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
+ SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
+ aTmpIdx = *pSttNd->EndOfSectionNode();
+ rSrcNds.Copy_( aRg, aTmpIdx );
+ aTmpIdx = *pSttNd;
+ rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
+ // TODO: investigate calling CopyWithFlyInFly?
+ SwPaM const source(aRg.aStart, aRg.aEnd);
+ SwPosition dest(aTmpIdx);
+ sw::CopyBookmarks(source, dest);
+ pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
}
- if( bCpyHeader )
- static_cast<SwFormatHeader*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
else
- static_cast<SwFormatFooter*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
- rDestFormat.SetFormatAttr( *pNewItem );
+ pNewFormat->ResetFormatAttr( RES_CNTNT );
}
+ if( bCpyHeader )
+ static_cast<SwFormatHeader*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
+ else
+ static_cast<SwFormatFooter*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
+ rDestFormat.SetFormatAttr( *pNewItem );
}
void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index af02d317d284..61108557a752 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1290,18 +1290,18 @@ static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, sal_Int32
lcl_collectUsedNums(rSetFlags, nNmLen, sName, rCmpName);
// tdf#122487 take groups into account, iterate and recurse through their
// contents for name collision check
- if (rObj.IsGroupObject())
+ if (!rObj.IsGroupObject())
+ return;
+
+ const SdrObjList* pSub(rObj.GetSubList());
+ assert(pSub && "IsGroupObject is implemented as GetSubList != nullptr");
+ const size_t nCount = pSub->GetObjCount();
+ for (size_t i = 0; i < nCount; ++i)
{
- const SdrObjList* pSub(rObj.GetSubList());
- assert(pSub && "IsGroupObject is implemented as GetSubList != nullptr");
- const size_t nCount = pSub->GetObjCount();
- for (size_t i = 0; i < nCount; ++i)
- {
- SdrObject* pObj = pSub->GetObj(i);
- if (!pObj)
- continue;
- lcl_collectUsedNums(rSetFlags, nNmLen, *pObj, rCmpName);
- }
+ SdrObject* pObj = pSub->GetObj(i);
+ if (!pObj)
+ continue;
+ lcl_collectUsedNums(rSetFlags, nNmLen, *pObj, rCmpName);
}
}
@@ -1531,21 +1531,21 @@ void SwDoc::SetAllUniqueFlyNames()
}
aArr.clear();
- if( !GetFootnoteIdxs().empty() )
+ if( GetFootnoteIdxs().empty() )
+ return;
+
+ SwTextFootnote::SetUniqueSeqRefNo( *this );
+ // #i52775# Chapter footnotes did not get updated correctly.
+ // Calling UpdateAllFootnote() instead of UpdateFootnote() solves this problem,
+ // but I do not dare to call UpdateAllFootnote() in all cases: Safety first.
+ if ( FTNNUM_CHAPTER == GetFootnoteInfo().m_eNum )
{
- SwTextFootnote::SetUniqueSeqRefNo( *this );
- // #i52775# Chapter footnotes did not get updated correctly.
- // Calling UpdateAllFootnote() instead of UpdateFootnote() solves this problem,
- // but I do not dare to call UpdateAllFootnote() in all cases: Safety first.
- if ( FTNNUM_CHAPTER == GetFootnoteInfo().m_eNum )
- {
- GetFootnoteIdxs().UpdateAllFootnote();
- }
- else
- {
- SwNodeIndex aTmp( GetNodes() );
- GetFootnoteIdxs().UpdateFootnote( aTmp );
- }
+ GetFootnoteIdxs().UpdateAllFootnote();
+ }
+ else
+ {
+ SwNodeIndex aTmp( GetNodes() );
+ GetFootnoteIdxs().UpdateFootnote( aTmp );
}
}
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index e4f38b44bbb0..24f5a218048e 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -580,26 +580,26 @@ SwDoc::~SwDoc()
void SwDoc::SetDocShell( SwDocShell* pDSh )
{
- if( mpDocShell != pDSh )
+ if( mpDocShell == pDSh )
+ return;
+
+ if (mpDocShell)
{
- if (mpDocShell)
- {
- mpDocShell->SetUndoManager(nullptr);
- }
- mpDocShell = pDSh;
- if (mpDocShell)
- {
- mpDocShell->SetUndoManager(& GetUndoManager());
- GetUndoManager().SetDocShell(mpDocShell);
- }
+ mpDocShell->SetUndoManager(nullptr);
+ }
+ mpDocShell = pDSh;
+ if (mpDocShell)
+ {
+ mpDocShell->SetUndoManager(& GetUndoManager());
+ GetUndoManager().SetDocShell(mpDocShell);
+ }
- getIDocumentLinksAdministration().GetLinkManager().SetPersist( mpDocShell );
+ getIDocumentLinksAdministration().GetLinkManager().SetPersist( mpDocShell );
- // set DocShell pointer also on DrawModel
- InitDrawModelAndDocShell(mpDocShell, GetDocumentDrawModelManager().GetDrawModel());
- assert(!GetDocumentDrawModelManager().GetDrawModel() ||
- GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
- }
+ // set DocShell pointer also on DrawModel
+ InitDrawModelAndDocShell(mpDocShell, GetDocumentDrawModelManager().GetDrawModel());
+ assert(!GetDocumentDrawModelManager().GetDrawModel() ||
+ GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
}
// Convenience method; to avoid excessive includes from docsh.hxx
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 13b6136ef89a..477f83220f32 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -81,19 +81,20 @@ namespace {
void ExpandPamForParaPropsNodes(SwPaM& rPam, SwRootFrame const*const pLayout)
{
- if (pLayout)
- { // ensure that selection from the Shell includes the para-props node
- // to which the attributes should be applied
- if (rPam.GetPoint()->nNode.GetNode().IsTextNode())
- {
- rPam.GetPoint()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetPoint()->nNode);
- rPam.GetPoint()->nContent.Assign(rPam.GetPoint()->nNode.GetNode().GetContentNode(), 0);
- }
- if (rPam.GetMark()->nNode.GetNode().IsTextNode())
- {
- rPam.GetMark()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetMark()->nNode);
- rPam.GetMark()->nContent.Assign(rPam.GetMark()->nNode.GetNode().GetContentNode(), 0);
- }
+ if (!pLayout)
+ return;
+
+ // ensure that selection from the Shell includes the para-props node
+ // to which the attributes should be applied
+ if (rPam.GetPoint()->nNode.GetNode().IsTextNode())
+ {
+ rPam.GetPoint()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetPoint()->nNode);
+ rPam.GetPoint()->nContent.Assign(rPam.GetPoint()->nNode.GetNode().GetContentNode(), 0);
+ }
+ if (rPam.GetMark()->nNode.GetNode().IsTextNode())
+ {
+ rPam.GetMark()->nNode = *sw::GetParaPropsNode(*pLayout, rPam.GetMark()->nNode);
+ rPam.GetMark()->nContent.Assign(rPam.GetMark()->nNode.GetNode().GetContentNode(), 0);
}
}
}
@@ -1002,21 +1003,21 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, bool bFlag )
{
SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
- if (pTextNd)
+ if (!pTextNd)
+ return;
+
+ const SwNumRule* pRule = pTextNd->GetNumRule();
+ if( pRule && !bFlag != !pTextNd->IsListRestart())
{
- const SwNumRule* pRule = pTextNd->GetNumRule();
- if( pRule && !bFlag != !pTextNd->IsListRestart())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoNumRuleStart>(rPos, bFlag) );
- }
+ GetIDocumentUndoRedo().AppendUndo(
+ std::make_unique<SwUndoNumRuleStart>(rPos, bFlag) );
+ }
- pTextNd->SetListRestart(bFlag);
+ pTextNd->SetListRestart(bFlag);
- getIDocumentState().SetModified();
- }
+ getIDocumentState().SetModified();
}
}
@@ -1024,20 +1025,20 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt )
{
SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
- if (pTextNd)
+ if (!pTextNd)
+ return;
+
+ if ( !pTextNd->HasAttrListRestartValue() ||
+ pTextNd->GetAttrListRestartValue() != nStt )
{
- if ( !pTextNd->HasAttrListRestartValue() ||
- pTextNd->GetAttrListRestartValue() != nStt )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoNumRuleStart>(rPos, nStt) );
- }
- pTextNd->SetAttrListRestartValue( nStt );
-
- getIDocumentState().SetModified();
+ GetIDocumentUndoRedo().AppendUndo(
+ std::make_unique<SwUndoNumRuleStart>(rPos, nStt) );
}
+ pTextNd->SetAttrListRestartValue( nStt );
+
+ getIDocumentState().SetModified();
}
}
@@ -1085,23 +1086,23 @@ bool SwDoc::DelNumRule( const OUString& rName, bool bBroadcast )
void SwDoc::ChgNumRuleFormats( const SwNumRule& rRule )
{
SwNumRule* pRule = FindNumRulePtr( rRule.GetName() );
- if( pRule )
- {
- SwUndoInsNum* pUndo = nullptr;
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- pUndo = new SwUndoInsNum( *pRule, rRule, this );
- pUndo->GetHistory();
- GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
- }
- ::lcl_ChgNumRule( *this, rRule );
- if (pUndo)
- {
- pUndo->SetLRSpaceEndPos();
- }
+ if( !pRule )
+ return;
- getIDocumentState().SetModified();
+ SwUndoInsNum* pUndo = nullptr;
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoInsNum( *pRule, rRule, this );
+ pUndo->GetHistory();
+ GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
+ }
+ ::lcl_ChgNumRule( *this, rRule );
+ if (pUndo)
+ {
+ pUndo->SetLRSpaceEndPos();
}
+
+ getIDocumentState().SetModified();
}
bool SwDoc::RenameNumRule(const OUString & rOldName, const OUString & rNewName,
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 585a6600acc0..6cbffb7b56d5 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1107,34 +1107,34 @@ void SwRangeRedline::CallDisplayFunc(size_t nMyPos)
void SwRangeRedline::Show(sal_uInt16 nLoop, size_t nMyPos)
{
- if( 1 <= nLoop )
- {
- SwDoc* pDoc = GetDoc();
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore);
- ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ if( 1 > nLoop )
+ return;
- switch( GetType() )
- {
- case RedlineType::Insert: // Content has been inserted
- m_bIsVisible = true;
- MoveFromSection(nMyPos);
- break;
+ SwDoc* pDoc = GetDoc();
+ RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
+ pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore);
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
- case RedlineType::Delete: // Content has been deleted
- m_bIsVisible = true;
- MoveFromSection(nMyPos);
- break;
+ switch( GetType() )
+ {
+ case RedlineType::Insert: // Content has been inserted
+ m_bIsVisible = true;
+ MoveFromSection(nMyPos);
+ break;
- case RedlineType::Format: // Attributes have been applied
- case RedlineType::Table: // Table structure has been modified
- InvalidateRange(Invalidation::Add);
- break;
- default:
- break;
- }
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ case RedlineType::Delete: // Content has been deleted
+ m_bIsVisible = true;
+ MoveFromSection(nMyPos);
+ break;
+
+ case RedlineType::Format: // Attributes have been applied
+ case RedlineType::Table: // Table structure has been modified
+ InvalidateRange(Invalidation::Add);
+ break;
+ default:
+ break;
}
+ pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
void SwRangeRedline::Hide(sal_uInt16 nLoop, size_t nMyPos)
@@ -1451,88 +1451,88 @@ void SwRangeRedline::CopyToSection()
void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
{
- if( m_pContentSect )
- {
- const SwPosition* pStt = Start(),
- * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
+ if( !m_pContentSect )
+ return;
- SwDoc* pDoc = GetDoc();
- SwPaM aPam( *pStt, *pEnd );
- SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode();
- SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode();
+ const SwPosition* pStt = Start(),
+ * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
- if( !pCSttNd )
- {
- // In order to not move other Redlines' indices, we set them
- // to the end (is exclusive)
- const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- for(SwRangeRedline* pRedl : rTable)
- {
- if( pRedl->GetBound() == *pStt )
- pRedl->GetBound() = *pEnd;
- if( pRedl->GetBound(false) == *pStt )
- pRedl->GetBound(false) = *pEnd;
- }
- }
+ SwDoc* pDoc = GetDoc();
+ SwPaM aPam( *pStt, *pEnd );
+ SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode();
+ SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode();
- if( pCSttNd && pCEndNd )
+ if( !pCSttNd )
+ {
+ // In order to not move other Redlines' indices, we set them
+ // to the end (is exclusive)
+ const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ for(SwRangeRedline* pRedl : rTable)
{
- // #i100466# - force a <join next> on <delete and join> operation
- // tdf#125319 - rather not?
- pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam/*, true*/);
+ if( pRedl->GetBound() == *pStt )
+ pRedl->GetBound() = *pEnd;
+ if( pRedl->GetBound(false) == *pStt )
+ pRedl->GetBound(false) = *pEnd;
}
- else if( pCSttNd || pCEndNd )
- {
- if( pCSttNd && !pCEndNd )
- m_bDelLastPara = true;
- pDoc->getIDocumentContentOperations().DeleteRange( aPam );
+ }
- if( m_bDelLastPara )
+ if( pCSttNd && pCEndNd )
+ {
+ // #i100466# - force a <join next> on <delete and join> operation
+ // tdf#125319 - rather not?
+ pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam/*, true*/);
+ }
+ else if( pCSttNd || pCEndNd )
+ {
+ if( pCSttNd && !pCEndNd )
+ m_bDelLastPara = true;
+ pDoc->getIDocumentContentOperations().DeleteRange( aPam );
+
+ if( m_bDelLastPara )
+ {
+ // To prevent dangling references to the paragraph to
+ // be deleted, redline that point into this paragraph should be
+ // moved to the new end position. Since redlines in the redline
+ // table are sorted and the pEnd position is an endnode (see
+ // bDelLastPara condition above), only redlines before the
+ // current ones can be affected.
+ const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ size_t n = nMyPos;
+ for( bool bBreak = false; !bBreak && n > 0; )
{
- // To prevent dangling references to the paragraph to
- // be deleted, redline that point into this paragraph should be
- // moved to the new end position. Since redlines in the redline
- // table are sorted and the pEnd position is an endnode (see
- // bDelLastPara condition above), only redlines before the
- // current ones can be affected.
- const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- size_t n = nMyPos;
- for( bool bBreak = false; !bBreak && n > 0; )
+ --n;
+ bBreak = true;
+ if( rTable[ n ]->GetBound() == *aPam.GetPoint() )
{
- --n;
- bBreak = true;
- if( rTable[ n ]->GetBound() == *aPam.GetPoint() )
- {
- rTable[ n ]->GetBound() = *pEnd;
- bBreak = false;
- }
- if( rTable[ n ]->GetBound(false) == *aPam.GetPoint() )
- {
- rTable[ n ]->GetBound(false) = *pEnd;
- bBreak = false;
- }
+ rTable[ n ]->GetBound() = *pEnd;
+ bBreak = false;
+ }
+ if( rTable[ n ]->GetBound(false) == *aPam.GetPoint() )
+ {
+ rTable[ n ]->GetBound(false) = *pEnd;
+ bBreak = false;
}
+ }
- *GetPoint() = *pEnd;
- *GetMark() = *pEnd;
- DeleteMark();
+ *GetPoint() = *pEnd;
+ *GetMark() = *pEnd;
+ DeleteMark();
- aPam.GetBound().nContent.Assign( nullptr, 0 );
- aPam.GetBound( false ).nContent.Assign( nullptr, 0 );
- aPam.DeleteMark();
- pDoc->getIDocumentContentOperations().DelFullPara( aPam );
- }
- }
- else
- {
- pDoc->getIDocumentContentOperations().DeleteRange( aPam );
+ aPam.GetBound().nContent.Assign( nullptr, 0 );
+ aPam.GetBound( false ).nContent.Assign( nullptr, 0 );
+ aPam.DeleteMark();
+ pDoc->getIDocumentContentOperations().DelFullPara( aPam );
}
+ }
+ else
+ {
+ pDoc->getIDocumentContentOperations().DeleteRange( aPam );
+ }
- if( pStt == GetPoint() )
- Exchange();
+ if( pStt == GetPoint() )
+ Exchange();
- DeleteMark();
- }
+ DeleteMark();
}
void SwRangeRedline::MoveFromSection(size_t nMyPos)
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 18b128769939..b15a22dbe1f9 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -740,19 +740,19 @@ FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const FndBox_& rBoxRef) :
m_nCol(0)
{ // If the array is symmetric
m_bSym = CheckLineSymmetry(rBoxRef);
- if( m_bSym )
- {
- // Determine column/row count
- m_nCols = GetColCount(rBoxRef);
- m_nRows = GetRowCount(rBoxRef);
+ if( !m_bSym )
+ return;
- // Create linear array
- size_t nCount = static_cast<size_t>(m_nRows) * m_nCols;
- m_pArr = std::make_unique<FndBox_ const *[]>(nCount);
- memset(m_pArr.get(), 0, sizeof(const FndBox_*) * nCount);
+ // Determine column/row count
+ m_nCols = GetColCount(rBoxRef);
+ m_nRows = GetRowCount(rBoxRef);
- FillFlat( rBoxRef );
- }
+ // Create linear array
+ size_t nCount = static_cast<size_t>(m_nRows) * m_nCols;
+ m_pArr = std::make_unique<FndBox_ const *[]>(nCount);
+ memset(m_pArr.get(), 0, sizeof(const FndBox_*) * nCount);
+
+ FillFlat( rBoxRef );
}
FlatFndBox::~FlatFndBox()
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 10b2be028f55..d5857479f6fe 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1871,33 +1871,32 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
}
// The main entries should get their character style
- if (xCharStyleIdx && !xCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty())
- {
- // eventually the last index must me appended
- if (xCharStyleIdx->size()&0x01)
- xCharStyleIdx->push_back(aNumStr.getLength());
-
- // search by name
- SwDoc* pDoc = pNd->GetDoc();
- sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), SwGetPoolIdFromName::ChrFmt );
- SwCharFormat* pCharFormat = nullptr;
- if(USHRT_MAX != nPoolId)
- pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
- else
- pCharFormat = pDoc->FindCharFormatByName( GetMainEntryCharStyle() );
- if(!pCharFormat)
- pCharFormat = pDoc->MakeCharFormat(GetMainEntryCharStyle(), nullptr);
-
- // find the page numbers in aNumStr and set the character style
- sal_Int32 nOffset = pNd->GetText().getLength() - aNumStr.getLength();
- SwFormatCharFormat aCharFormat(pCharFormat);
- for (size_t j = 0; j < xCharStyleIdx->size(); j += 2)
- {
- sal_Int32 nStartIdx = (*xCharStyleIdx)[j] + nOffset;
- sal_Int32 nEndIdx = (*xCharStyleIdx)[j + 1] + nOffset;
- pNd->InsertItem(aCharFormat, nStartIdx, nEndIdx, SetAttrMode::DONTEXPAND);
- }
+ if (!(xCharStyleIdx && !xCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty()))
+ return;
+
+ // eventually the last index must me appended
+ if (xCharStyleIdx->size()&0x01)
+ xCharStyleIdx->push_back(aNumStr.getLength());
+ // search by name
+ SwDoc* pDoc = pNd->GetDoc();
+ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), SwGetPoolIdFromName::ChrFmt );
+ SwCharFormat* pCharFormat = nullptr;
+ if(USHRT_MAX != nPoolId)
+ pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
+ else
+ pCharFormat = pDoc->FindCharFormatByName( GetMainEntryCharStyle() );
+ if(!pCharFormat)
+ pCharFormat = pDoc->MakeCharFormat(GetMainEntryCharStyle(), nullptr);
+
+ // find the page numbers in aNumStr and set the character style
+ sal_Int32 nOffset = pNd->GetText().getLength() - aNumStr.getLength();
+ SwFormatCharFormat aCharFormat(pCharFormat);
+ for (size_t j = 0; j < xCharStyleIdx->size(); j += 2)
+ {
+ sal_Int32 nStartIdx = (*xCharStyleIdx)[j] + nOffset;
+ sal_Int32 nEndIdx = (*xCharStyleIdx)[j + 1] + nOffset;
+ pNd->InsertItem(aCharFormat, nStartIdx, nEndIdx, SetAttrMode::DONTEXPAND);
}
}
diff --git a/sw/source/core/doc/docxforms.cxx b/sw/source/core/doc/docxforms.cxx
index ea827d58d9ad..2a7ee714cece 100644
--- a/sw/source/core/doc/docxforms.cxx
+++ b/sw/source/core/doc/docxforms.cxx
@@ -89,38 +89,38 @@ void SwDoc::initXForms( bool bCreateDefaultModel )
void SwDoc::disposeXForms( )
{
// get XForms models
- if( mxXForms.is() )
+ if( !mxXForms.is() )
+ return;
+
+ // iterate over all models
+ const uno::Sequence<OUString> aNames = mxXForms->getElementNames();
+ for( const OUString& rName : aNames )
{
- // iterate over all models
- const uno::Sequence<OUString> aNames = mxXForms->getElementNames();
- for( const OUString& rName : aNames )
+ Reference< xforms::XModel > xModel(
+ mxXForms->getByName( rName ), UNO_QUERY );
+
+ if( xModel.is() )
{
- Reference< xforms::XModel > xModel(
- mxXForms->getByName( rName ), UNO_QUERY );
+ // ask model for bindings
+ Reference< XIndexAccess > xBindings(
+ xModel->getBindings(), UNO_QUERY );
+
+ // Then release them one by one
+ int nCount = xBindings->getCount();
+ for( int i = nCount-1; i >= 0; i-- )
+ {
+ xModel->getBindings()->remove(xBindings->getByIndex( i ));
+ }
+
+ // ask model for Submissions
+ Reference< XIndexAccess > xSubmissions(
+ xModel->getSubmissions(), UNO_QUERY );
- if( xModel.is() )
+ // Then release them one by one
+ nCount = xSubmissions->getCount();
+ for( int i = nCount-1; i >= 0; i-- )
{
- // ask model for bindings
- Reference< XIndexAccess > xBindings(
- xModel->getBindings(), UNO_QUERY );
-
- // Then release them one by one
- int nCount = xBindings->getCount();
- for( int i = nCount-1; i >= 0; i-- )
- {
- xModel->getBindings()->remove(xBindings->getByIndex( i ));
- }
-
- // ask model for Submissions
- Reference< XIndexAccess > xSubmissions(
- xModel->getSubmissions(), UNO_QUERY );
-
- // Then release them one by one
- nCount = xSubmissions->getCount();
- for( int i = nCount-1; i >= 0; i-- )
- {
- xModel->getSubmissions()->remove(xSubmissions->getByIndex( i ));
- }
+ xModel->getSubmissions()->remove(xSubmissions->getByIndex( i ));
}
}
}
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index d9d22c25f695..83325d73ecd1 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -50,160 +50,159 @@ SwExtTextInput::~SwExtTextInput()
if (pDoc->IsInDtor()) { return; /* #i58606# */ }
SwTextNode* pTNd = GetPoint()->nNode.GetNode().GetTextNode();
- if( pTNd )
+ if( !pTNd )
+ return;
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list