summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-08 14:10:57 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-09 09:29:34 +0200
commitd884c4be18a82f61fe6db6f22cb1bf1092afd48a (patch)
tree89de580b7cc48cc91e7f072b62fc57c528e7a55a
parentad1f0bdeac30fca1dc56a08803ef23f2aca4db05 (diff)
WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I37166c03ffd0f8f76ddc03ce556b6e6341a02b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167355 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sw/source/core/text/wrong.cxx2
-rw-r--r--sw/source/core/tox/txmsrt.cxx4
-rw-r--r--sw/source/core/txtnode/attrcontentcontrol.cxx7
-rw-r--r--sw/source/core/txtnode/fntcache.cxx3
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx2
-rw-r--r--sw/source/core/undo/undel.cxx16
-rw-r--r--sw/source/core/undo/undobj1.cxx2
-rw-r--r--sw/source/core/undo/undraw.cxx2
-rw-r--r--sw/source/core/undo/unins.cxx4
-rw-r--r--sw/source/core/undo/unnum.cxx2
-rw-r--r--sw/source/core/undo/unsect.cxx2
-rw-r--r--sw/source/core/undo/unspnd.cxx2
-rw-r--r--sw/source/core/undo/untbl.cxx10
-rw-r--r--sw/source/core/unocore/unodraw.cxx1
-rw-r--r--sw/source/core/unocore/unoframe.cxx7
-rw-r--r--sw/source/core/unocore/unoftn.cxx13
-rw-r--r--sw/source/core/unocore/unoidx.cxx16
-rw-r--r--sw/source/core/unocore/unolinebreak.cxx4
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
-rw-r--r--sw/source/core/unocore/unosect.cxx5
-rw-r--r--sw/source/core/unocore/unotbl.cxx13
-rw-r--r--sw/source/core/unocore/unotextmarkup.cxx4
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx2
-rw-r--r--sw/source/core/view/viewsh.cxx2
-rw-r--r--sw/source/filter/html/css1atr.cxx2
-rw-r--r--sw/source/filter/html/htmlatr.cxx2
-rw-r--r--sw/source/filter/html/htmlcss1.cxx4
-rw-r--r--sw/source/filter/html/htmlflywriter.cxx6
-rw-r--r--sw/source/filter/html/htmlform.cxx8
-rw-r--r--sw/source/filter/html/htmlftn.cxx2
-rw-r--r--sw/source/filter/html/htmlsect.cxx2
-rw-r--r--sw/source/filter/html/htmltab.cxx2
-rw-r--r--sw/source/filter/html/svxcss1.cxx38
-rw-r--r--sw/source/filter/html/swhtml.cxx2
-rw-r--r--sw/source/filter/html/wrthtml.cxx9
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx2
-rw-r--r--sw/source/filter/xml/xmltble.cxx6
-rw-r--r--sw/source/filter/xml/xmltbli.cxx4
-rw-r--r--sw/source/ui/chrdlg/break.cxx2
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx2
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx14
-rw-r--r--sw/source/ui/envelp/envfmt.cxx4
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx5
-rw-r--r--sw/source/ui/misc/docfnote.cxx2
-rw-r--r--sw/source/ui/table/tabledlg.cxx3
-rw-r--r--sw/source/uibase/app/docsh.cxx9
-rw-r--r--sw/source/uibase/app/docsh2.cxx12
-rw-r--r--sw/source/uibase/app/docshini.cxx1
-rw-r--r--sw/source/uibase/app/docstyle.cxx12
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx1
-rw-r--r--sw/source/uibase/dialog/watermarkdialog.cxx10
-rw-r--r--sw/source/uibase/lingu/sdrhhcwrap.cxx2
-rw-r--r--sw/source/uibase/shells/drwbassh.cxx4
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx10
-rw-r--r--sw/source/uibase/uitest/uiobject.cxx2
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx4
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx8
-rw-r--r--sw/source/uibase/utlui/uitool.cxx4
-rw-r--r--sw/source/uibase/wrtsh/select.cxx2
62 files changed, 197 insertions, 142 deletions
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index 00be8d5fac4f..5a0ac3da9d93 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -849,6 +849,7 @@ sal_uInt16 WrongListIteratorCounter::GetElementCount()
InCurrentNode = 0;
pNode = rExtent.pNode;
}
+ assert(rExtent.pNode);
SwWrongList const*const pWrongList((rExtent.pNode->*m_pGetWrongList)());
for (; pWrongList && InCurrentNode < pWrongList->Count(); ++InCurrentNode)
{
@@ -893,6 +894,7 @@ WrongListIteratorCounter::GetElementAt(sal_uInt16 nIndex)
InCurrentNode = 0;
pNode = rExtent.pNode;
}
+ assert(rExtent.pNode);
SwWrongList const*const pWrongList((rExtent.pNode->*m_pGetWrongList)());
for (; pWrongList && InCurrentNode < pWrongList->Count(); ++InCurrentNode)
{
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 6133743b898d..d47581d44e80 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -361,7 +361,7 @@ bool SwTOXIndex::sort_lt(const SwTOXSortTabBase& rCmpBase)
TextAndReading SwTOXIndex::GetText_Impl(SwRootFrame const*const pLayout) const
{
- OSL_ENSURE(pTextMark, "pTextMark == 0, No keyword");
+ assert(pTextMark && "pTextMark == 0, No keyword");
const SwTOXMark& rTOXMark = pTextMark->GetTOXMark();
TextAndReading aRet;
@@ -427,7 +427,7 @@ void SwTOXIndex::FillText( SwTextNode& rNd, const SwContentIndex& rInsPos, sal_u
sal_uInt16 SwTOXIndex::GetLevel() const
{
- OSL_ENSURE(pTextMark, "pTextMark == 0, No keyword");
+ assert(pTextMark && "pTextMark == 0, No keyword");
sal_uInt16 nForm = FORM_PRIMARY_KEY;
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 29b27baf77d0..63072f48963d 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -707,11 +707,8 @@ SwTextContentControl::CreateTextContentControl(SwDoc& rDoc, SwTextNode* pTargetT
if (bIsCopy)
{
// the item in rHolder is already cloned, now call DoCopy to copy the SwContentControl
- if (!pTargetTextNode)
- {
- SAL_WARN("sw.core",
- "SwTextContentControl ctor: cannot copy content control without target node");
- }
+ assert(pTargetTextNode
+ && "SwTextContentControl ctor: cannot copy content control without target node");
SwFormatContentControl* pSwFormatContentControl(
static_cast<SwFormatContentControl*>(const_cast<SfxPoolItem*>(rHolder.getItem())));
pSwFormatContentControl->DoCopy(*pTargetTextNode);
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 6b613f4d91ca..2f32ac292bcc 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1923,7 +1923,7 @@ SwFntAccess::SwFntAccess( const void* & rnFontCacheId,
// the Owner will be the "MagicNumber"
SwCacheAccess::m_pOwner = pOwn;
pFntObj = Get(); // will create via NewObj() and lock
- OSL_ENSURE(pFntObj, "No Font, no Fun.");
+ assert(pFntObj && "No Font, no Fun.");
}
else // Font has been found, so we lock it.
{
@@ -1931,6 +1931,7 @@ SwFntAccess::SwFntAccess( const void* & rnFontCacheId,
if (pFntObj->m_pPrinter.get() != pOut) // if no printer is known by now
{
OSL_ENSURE( !pFntObj->m_pPrinter, "SwFntAccess: Printer Changed" );
+ assert(pOut);
pFntObj->CreatePrtFont( *pOut );
pFntObj->m_pPrinter = pOut;
pFntObj->m_pScrFont = nullptr;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 05269577db3b..34619f0c7dfb 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2015,7 +2015,7 @@ static void lcl_CopyHint(
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
OSL_ENSURE( pNewHt, "copying Meta should not fail!" );
- OSL_ENSURE( pDest
+ OSL_ENSURE( pDest && pNewHt
&& (CH_TXTATR_INWORD == pDest->GetText()[pNewHt->GetStart()]),
"missing CH_TXTATR?");
break;
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 02cdf30087ea..c18a9f6d4e23 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -288,7 +288,7 @@ SwTextMeta::CreateTextMeta(
{
if (i_bIsCopy)
{ // i_rAttr is already cloned, now call DoCopy to copy the sw::Meta
- OSL_ENSURE(i_pTargetTextNode, "cannot copy Meta without target node");
+ assert(i_pTargetTextNode && "cannot copy Meta without target node");
SwFormatMeta* pSwFormatMeta(static_cast<SwFormatMeta*>(const_cast<SfxPoolItem*>(i_rAttr.getItem())));
pSwFormatMeta->DoCopy(i_rTargetDocManager, *i_pTargetTextNode);
}
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 7661b5951740..3fb32cced64a 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -410,8 +410,20 @@ SwUndoDelete::SwUndoDelete(
}
}
if( m_nSectDiff || m_nReplaceDummy )
- lcl_MakeAutoFrames( *rDoc.GetSpzFrameFormats(),
- m_bJoinNext ? pEndTextNd->GetIndex() : pSttTextNd->GetIndex() );
+ {
+ SwNodeOffset nIndex;
+ if (m_bJoinNext)
+ {
+ assert(pEndTextNd);
+ nIndex = pEndTextNd->GetIndex();
+ }
+ else
+ {
+ assert(pSttTextNd);
+ nIndex = pSttTextNd->GetIndex();
+ }
+ lcl_MakeAutoFrames( *rDoc.GetSpzFrameFormats(), nIndex);
+ }
}
else
m_nNode = SwNodeOffset(0); // moved no node -> no difference at the end
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index f0430b965bc2..90f644355c82 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -244,7 +244,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
m_nNodePagePos = pAnchorNode->GetIndex();
m_nContentPos = rAnchor.GetAnchorContentOffset();
SwTextNode *const pTextNd = pAnchorNode->GetTextNode();
- OSL_ENSURE( pTextNd, "No Textnode found" );
+ assert(pTextNd && "No Textnode found");
SwTextFlyCnt* const pAttr = static_cast<SwTextFlyCnt*>(
pTextNd->GetTextAttrForCharAt( m_nContentPos, RES_TXTATR_FLYCNT ) );
// attribute is still in TextNode, delete
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index 73a58a0f52e5..1838522b3bc0 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -114,7 +114,7 @@ static void lcl_SaveAnchor( SwFrameFormat* pFormat, SwNodeOffset& rNodePos )
// destroy TextAttribute
SwTextNode *pTextNd = pFormat->GetDoc()->GetNodes()[ rNodePos ]->GetTextNode();
- OSL_ENSURE( pTextNd, "No text node found!" );
+ assert(pTextNd && "No text node found!");
SwTextFlyCnt* pAttr = static_cast<SwTextFlyCnt*>(
pTextNd->GetTextAttrForCharAt( nContentPos, RES_TXTATR_FLYCNT ));
// attribute still in text node, delete
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index bf6c2877b2d4..f47dd38c214d 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -593,7 +593,7 @@ SwUndoReplace::Impl::Impl(
m_bSplitNext = m_nSttNd != pEnd->GetNodeIndex();
SwTextNode* pNd = pStt->GetNode().GetTextNode();
- OSL_ENSURE( pNd, "Dude, where's my TextNode?" );
+ assert(pNd && "Dude, where's my TextNode?");
m_pHistory.reset( new SwHistory );
DelContentIndex(*rPam.GetMark(), *rPam.GetPoint(), DelContentType::AllMask | DelContentType::Replace);
@@ -679,7 +679,7 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext)
if( m_bSplitNext )
{
- assert(m_nSttCnt + m_sOld.getLength() <= pNd->Len());
+ assert(pNd && m_nSttCnt + m_sOld.getLength() <= pNd->Len());
SwPosition aPos(*pNd, m_nSttCnt + m_sOld.getLength());
pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
pNd->RestoreMetadata(m_pMetadataUndoEnd);
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 1251635a3135..d8f924082d93 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -175,7 +175,7 @@ void SwUndoDelNum::UndoImpl(::sw::UndoRedoContext & rContext)
for( const auto& rNode : m_aNodes )
{
SwTextNode* pNd = rDoc.GetNodes()[ rNode.index ]->GetTextNode();
- OSL_ENSURE( pNd, "Where has the TextNode gone?" );
+ assert(pNd && "Where has the TextNode gone?");
pNd->SetAttrListLevel( rNode.level );
if( pNd->GetCondFormatColl() )
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index f3d6f108e20b..3aa830214d5a 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -281,7 +281,7 @@ void SwUndoInsSection::Join( SwDoc& rDoc, SwNodeOffset nNode )
{
SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
SwTextNode* pTextNd = aIdx.GetNode().GetTextNode();
- OSL_ENSURE( pTextNd, "Where is my TextNode?" );
+ assert(pTextNd && "Where is my TextNode?");
{
RemoveIdxRel(
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index 8dc653303251..f16bd1e66e38 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -44,7 +44,7 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc& rDoc, const SwPosition& rPos,
m_bTableFlag( false ), m_bCheckTableStart( bChkTable )
{
SwTextNode *const pTextNd = rPos.GetNode().GetTextNode();
- OSL_ENSURE( pTextNd, "only for TextNode" );
+ assert(pTextNd && "only for TextNode");
if( pTextNd->GetpSwpHints() )
{
m_pHistory.reset(new SwHistory);
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 5da8e4012652..caae49e6f8a2 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -850,7 +850,7 @@ SwUndoTableHeadline::SwUndoTableHeadline( const SwTable& rTable, sal_uInt16 nOld
{
OSL_ENSURE( !rTable.GetTabSortBoxes().empty(), "Table without content" );
const SwStartNode *pSttNd = rTable.GetTabSortBoxes()[ 0 ]->GetSttNd();
- OSL_ENSURE( pSttNd, "Box without content" );
+ assert(pSttNd && "Box without content");
m_nTableNode = pSttNd->StartOfSectionIndex();
}
@@ -1796,7 +1796,7 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
SwTableNode* pTableNd = rDoc.GetNodes()[ m_nSttNode ]->GetTableNode();
- OSL_ENSURE( pTableNd, "no TableNode" );
+ assert(pTableNd && "no TableNode");
CHECK_TABLE( pTableNd->GetTable() )
SwSelBoxes aSelBoxes;
@@ -1843,7 +1843,7 @@ SwUndoTableMerge::SwUndoTableMerge( const SwPaM& rTableSel )
: SwUndo( SwUndoId::TABLE_MERGE, &rTableSel.GetDoc() ), SwUndRng( rTableSel )
{
const SwTableNode* pTableNd = rTableSel.GetPointNode().FindTableNode();
- OSL_ENSURE( pTableNd, "Where is the TableNode?" );
+ assert(pTableNd && "Where is the TableNode?");
m_pSaveTable.reset( new SaveTable( pTableNd->GetTable() ) );
m_nTableNode = pTableNd->GetIndex();
}
@@ -2128,10 +2128,10 @@ void SwUndoTableNumFormat::UndoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
SwStartNode* pSttNd = rDoc.GetNodes()[ m_nNode ]->
FindSttNodeByType( SwTableBoxStartNode );
- OSL_ENSURE( pSttNd, "without StartNode no TableBox" );
+ assert(pSttNd && "without StartNode no TableBox");
SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().GetTableBox(
pSttNd->GetIndex() );
- OSL_ENSURE( pBox, "found no TableBox" );
+ assert(pBox && "found no TableBox");
SwTableBoxFormat* pFormat = rDoc.MakeTableBoxFormat();
pFormat->SetFormatAttr( *m_pBoxSet );
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 82057c08625a..1deb1751c0d9 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -316,6 +316,7 @@ uno::Reference<drawing::XShapeGroup> SwFmDrawPage::GetShapeGroup(SdrObject* pObj
uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) const
{
+ assert(pObj);
uno::Reference< drawing::XShape > xRet;
if(dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr || pObj->GetObjInventor() == SdrInventor::Swg)
{
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 9be13f907fb0..b45252fad8b9 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1293,13 +1293,14 @@ SwXFrame::CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat)
}
if (!xFrame.is())
{
- xFrame = pFrameFormat
- ? new NameLookupIsHard(*pFrameFormat)
- : new NameLookupIsHard(&rDoc);
if (pFrameFormat)
{
+ xFrame = new NameLookupIsHard(*pFrameFormat);
pFrameFormat->SetXObject(cppu::getXWeak(xFrame.get()));
}
+ else
+ xFrame = new NameLookupIsHard(&rDoc);
+
// need a permanent Reference to initialize m_wThis
xFrame->SwXFrame::m_pImpl->m_wThis = uno::Reference<XWeak>(xFrame.get());
}
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 1a73e2e617d8..c4412f8dea42 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -150,13 +150,14 @@ SwXFootnote::CreateXFootnote(SwDoc & rDoc, SwFormatFootnote *const pFootnoteForm
}
if (!xNote.is())
{
- xNote = pFootnoteFormat
- ? new SwXFootnote(rDoc, *pFootnoteFormat)
- : new SwXFootnote(isEndnote);
if (pFootnoteFormat)
{
+ xNote = new SwXFootnote(rDoc, *pFootnoteFormat);
pFootnoteFormat->SetXFootnote(xNote);
}
+ else
+ xNote = new SwXFootnote(isEndnote);
+
// need a permanent Reference to initialize m_wThis
xNote->m_pImpl->m_wThis = xNote.get();
}
@@ -253,7 +254,7 @@ SwXFootnote::setLabel(const OUString& aLabel)
if(pFormat)
{
const SwTextFootnote* pTextFootnote = pFormat->GetTextFootnote();
- OSL_ENSURE(pTextFootnote, "No TextNode?");
+ assert(pTextFootnote && "No TextNode?");
SwTextNode& rTextNode = const_cast<SwTextNode&>(pTextFootnote->GetTextNode());
SwPaM aPam(rTextNode, pTextFootnote->GetStart());
@@ -347,7 +348,7 @@ void SAL_CALL SwXFootnote::dispose()
SwFormatFootnote const& rFormat( m_pImpl->GetFootnoteFormatOrThrow() );
SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
- OSL_ENSURE(pTextFootnote, "no TextNode?");
+ assert(pTextFootnote && "no TextNode?");
SwTextNode& rTextNode = const_cast<SwTextNode&>(pTextFootnote->GetTextNode());
const sal_Int32 nPos = pTextFootnote->GetStart();
SwPaM aPam(rTextNode, nPos, rTextNode, nPos+1);
@@ -491,7 +492,7 @@ SwXFootnote::getPropertyValue(const OUString& rPropertyName)
if (pFormat)
{
SwTextFootnote const*const pTextFootnote = pFormat->GetTextFootnote();
- OSL_ENSURE(pTextFootnote, "no TextNode?");
+ assert(pTextFootnote && "no TextNode?");
aRet <<= static_cast<sal_Int16>(pTextFootnote->GetSeqRefNo());
}
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index c01bc9b9897d..56a8199ade2b 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -411,13 +411,14 @@ SwXDocumentIndex::CreateXDocumentIndex(
}
if (!xIndex.is())
{
- xIndex = pSection
- ? new SwXDocumentIndex(*pSection, rDoc)
- : new SwXDocumentIndex(eTypes, rDoc);
if (pSection)
{
+ xIndex = new SwXDocumentIndex(*pSection, rDoc);
pSection->GetFormat()->SetXObject(xIndex->getXWeak());
}
+ else
+ xIndex = new SwXDocumentIndex(eTypes, rDoc);
+
// need a permanent Reference to initialize m_wThis
xIndex->m_pImpl->m_wThis = xIndex.get();
}
@@ -1647,14 +1648,15 @@ SwXDocumentIndexMark::CreateXDocumentIndexMark(
}
if (!xTOXMark.is())
{
- xTOXMark = pMark
- ? new SwXDocumentIndexMark(rDoc,
- *const_cast<SwTOXType*>(pMark->GetTOXType()), *pMark)
- : new SwXDocumentIndexMark(eType);
if (pMark)
{
+ xTOXMark = new SwXDocumentIndexMark(rDoc,
+ *const_cast<SwTOXType*>(pMark->GetTOXType()), *pMark);
pMark->SetXTOXMark(xTOXMark);
}
+ else
+ xTOXMark = new SwXDocumentIndexMark(eType);
+
// need a permanent Reference to initialize m_wThis
xTOXMark->m_pImpl->m_wThis = xTOXMark.get();
}
diff --git a/sw/source/core/unocore/unolinebreak.cxx b/sw/source/core/unocore/unolinebreak.cxx
index d04011329022..620bffb8fc41 100644
--- a/sw/source/core/unocore/unolinebreak.cxx
+++ b/sw/source/core/unocore/unolinebreak.cxx
@@ -115,11 +115,13 @@ rtl::Reference<SwXLineBreak> SwXLineBreak::CreateXLineBreak(SwFormatLineBreak* p
}
if (!xLineBreak.is())
{
- xLineBreak = pLineBreakFormat ? new SwXLineBreak(*pLineBreakFormat) : new SwXLineBreak;
if (pLineBreakFormat)
{
+ xLineBreak = new SwXLineBreak(*pLineBreakFormat);
pLineBreakFormat->SetXLineBreak(xLineBreak);
}
+ else
+ xLineBreak = new SwXLineBreak;
}
return xLineBreak;
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index f343bd9c3e75..6104e7bb268c 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1812,7 +1812,7 @@ uno::Reference<text::XTextContent> FrameClientToXTextContent(sw::FrameClient* pC
else
{
const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
- OSL_ENSURE(pIdx, "where is the index?");
+ assert(pIdx && "where is the index?");
SwNode const* const pNd = pIdx->GetNodes()[pIdx->GetIndex() + 1];
if (!pNd->IsNoTextNode())
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index b002a695ba58..d7d3d79e56d6 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1450,8 +1450,9 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName)
getXWeak());
}
- std::unique_ptr<SwSectionData> const pSectionData(
- pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr);
+ std::unique_ptr<SwSectionData> pSectionData;
+ if (pFormat)
+ pSectionData.reset(new SwSectionData(*pFormat->GetSection()));
std::optional<SfxItemSet> oNewAttrSet;
bool bLinkModeChanged = false;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index b25c5e2a2700..04b0cc9fd2ce 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1952,13 +1952,18 @@ SwXTextTable::~SwXTextTable()
rtl::Reference<SwXTextTable> SwXTextTable::CreateXTextTable(SwFrameFormat* const pFrameFormat)
{
rtl::Reference<SwXTextTable> xTable;
- if(pFrameFormat)
+ if (pFrameFormat)
xTable = dynamic_cast<SwXTextTable*>(pFrameFormat->GetXObject().get().get()); // cached?
- if(xTable.is())
+ if (xTable.is())
return xTable;
- xTable = pFrameFormat ? new SwXTextTable(*pFrameFormat) : new SwXTextTable();
- if(pFrameFormat)
+ if (pFrameFormat)
+ {
+ xTable = new SwXTextTable(*pFrameFormat);
pFrameFormat->SetXObject(xTable->getXWeak());
+ }
+ else
+ xTable = new SwXTextTable();
+
// need a permanent Reference to initialize m_wThis
xTable->m_pImpl->m_wThis = xTable.get();
return xTable;
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 6c49044f4911..ec2cd1b515c4 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -156,7 +156,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
if( pGrammarContact )
{
pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
- OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
+ assert(pWList && "GrammarContact _has_ to deliver a wrong list");
}
else
{
@@ -410,7 +410,7 @@ void SAL_CALL SwXTextMarkup::commitMultiTextMarkup(
if( pGrammarContact )
{
pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
- OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
+ assert(pWList && "GrammarContact _has_ to deliver a wrong list");
}
else
{
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 5fc740ebfda9..95ae9cec3419 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -1459,6 +1459,8 @@ sal_uInt16 SwPagePreviewLayout::ConvertRelativeToAbsolutePageNum( sal_uInt16 _nR
pTmpPage = static_cast<const SwPageFrame*>( pTmpPage->GetNext() );
}
+ assert(pRet);
+
return pRet->GetPhyPageNum();
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index f20eb694e8f4..ec29a15874c0 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -205,7 +205,7 @@ void SwViewShell::DLPrePaint2(const vcl::Region& rRegion)
// #i74769# use SdrPaintWindow now direct
mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion);
- OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
+ assert(mpTargetPaintWindow && "BeginDrawLayers: Got no SdrPaintWindow (!)");
// #i74769# if prerender, save OutDev and redirect to PreRenderDevice
if(mpTargetPaintWindow->GetPreRenderDevice())
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 0cbf5b36da86..cfd4e9e50fb9 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2185,7 +2185,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
// At last there is the background of the page, and as the final rescue
// the value of the Config.
- OSL_ENSURE( m_pCurrPageDesc, "no page template found" );
+ assert(m_pCurrPageDesc && "no page template found");
if( OutCSS1_FrameFormatBrush( *this,
*m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) )
return;
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index f298f93dc5b2..3ce02bc54a0d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -3174,7 +3174,7 @@ static SwHTMLWriter& OutHTML_SwTextCharFormat( SwHTMLWriter& rWrt, const SfxPool
return rWrt;
const SwHTMLFormatInfo *pFormatInfo = it->get();
- OSL_ENSURE( pFormatInfo, "Why is there no information about the character style?" );
+ assert(pFormatInfo && "Why is there no information about the character style?");
if( rWrt.m_bTagOn )
{
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 92e5d0d94d3a..2e947b90f0f7 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -1164,7 +1164,7 @@ SwCharFormat* SwCSS1Parser::GetChrFormat( HtmlTokenId nToken2, const OUString& r
}
}
- OSL_ENSURE( pCFormat, "No character style???" );
+ assert(pCFormat && "No character style???");
// If a class exists, then search for the class style but don't
// create one.
@@ -1262,9 +1262,9 @@ SwTextFormatColl *SwCSS1Parser::GetTextFormatColl( sal_uInt16 nTextColl,
pColl = GetTextCollFromPool( nTextColl );
}
- OSL_ENSURE( pColl, "No paragraph style???" );
if( !aClass.isEmpty() )
{
+ assert(pColl && "No paragraph style???");
OUString aTmp( pColl->GetName() );
AddClassName( aTmp, aClass );
SwTextFormatColl* pClassColl = m_pDoc->FindTextFormatCollByName( aTmp );
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 80b4abf5eade..e4dad5df1ae8 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1658,7 +1658,7 @@ static SwHTMLWriter & OutHTML_FrameFormatAsMulticol( SwHTMLWriter& rWrt,
const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex();
const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
- OSL_ENSURE( pSttNd, "Where is the start node" );
+ assert(pSttNd && "Where is the start node");
{
// in a block, so that the old state can be restored in time
@@ -1741,7 +1741,7 @@ static SwHTMLWriter& OutHTML_FrameFormatAsDivOrSpan( SwHTMLWriter& rWrt,
rWrt.OutFlyFrame( nStt, 0, HtmlPosition::Any );
const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
- OSL_ENSURE( pSttNd, "Where is the start node" );
+ assert(pSttNd && "Where is the start node");
{
// in a block, so that the old state can be restored in time
@@ -2110,7 +2110,7 @@ SwHTMLWriter& OutHTML_HeaderFooter( SwHTMLWriter& rWrt, const SwFrameFormat& rFr
const SwFormatContent& rFlyContent = rFrameFormat.GetContent();
SwNodeOffset nStt = rFlyContent.GetContentIdx()->GetIndex();
const SwStartNode* pSttNd = rWrt.m_pDoc->GetNodes()[nStt]->GetStartNode();
- OSL_ENSURE( pSttNd, "Where is the start node" );
+ assert(pSttNd && "Where is the start node");
if( !bHeader && !aSpacer.isEmpty() )
{
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 8fcc392e9d8f..8270d104e582 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -2047,8 +2047,8 @@ void SwHTMLParser::NewTextArea()
void SwHTMLParser::EndTextArea()
{
OSL_ENSURE( m_bTextArea, "no TextArea or wrong type" );
- OSL_ENSURE( m_pFormImpl && m_pFormImpl->GetFCompPropSet().is(),
- "TextArea missing" );
+ assert(m_pFormImpl && m_pFormImpl->GetFCompPropSet().is() &&
+ "TextArea missing");
const uno::Reference< beans::XPropertySet > & rPropSet =
m_pFormImpl->GetFCompPropSet();
@@ -2320,8 +2320,8 @@ void SwHTMLParser::EndSelect()
assert(m_vPendingStack.empty());
OSL_ENSURE( m_bSelect, "no Select" );
- OSL_ENSURE( m_pFormImpl && m_pFormImpl->GetFCompPropSet().is(),
- "no select control" );
+ assert(m_pFormImpl && m_pFormImpl->GetFCompPropSet().is() &&
+ "no select control");
const uno::Reference< beans::XPropertySet > & rPropSet =
m_pFormImpl->GetFCompPropSet();
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index 74916af9c705..caa72fa21e0c 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -367,7 +367,7 @@ void SwHTMLWriter::OutFootEndNotes()
SetLFPossible(true);
IncIndentLevel(); // indent content of <DIV>
- OSL_ENSURE( pTextFootnote, "SwHTMLWriter::OutFootEndNotes: SwTextFootnote is missing" );
+ assert(pTextFootnote && "SwHTMLWriter::OutFootEndNotes: SwTextFootnote is missing");
const SwNodeIndex *pSttNdIdx = pTextFootnote->GetStartNode();
OSL_ENSURE( pSttNdIdx,
"SwHTMLWriter::OutFootEndNotes: StartNode-Index is missing" );
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 26a1ec8d0e19..8cd8372bfede 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -420,7 +420,7 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader,
SwFrameFormat *pHdFtFormat =
bHeader ? const_cast<SwFrameFormat*>(rPageFormat.GetHeader().GetHeaderFormat())
: const_cast<SwFrameFormat*>(rPageFormat.GetFooter().GetFooterFormat());
- OSL_ENSURE( pHdFtFormat, "No header or footer" );
+ assert(pHdFtFormat && "No header or footer");
const SwFormatContent& rFlyContent = pHdFtFormat->GetContent();
const SwNodeIndex& rContentStIdx = *rFlyContent.GetContentIdx();
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 1719347fe5dd..9e9727682106 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4727,7 +4727,7 @@ void TableSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDo
m_xCurrentTable->MakeTable(nullptr, nWidth);
HTMLTableContext *pTCntxt = m_xCurrentTable->GetContext();
- OSL_ENSURE( pTCntxt, "Where is the table context" );
+ assert(pTCntxt && "Where is the table context");
SwTableNode *pTableNd = pTCntxt->GetTableNode();
OSL_ENSURE( pTableNd, "Where is the table node" );
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index d186fc295796..f93ff5387c97 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -986,7 +986,7 @@ static void ParseCSS1_font_size( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& rParser )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uLong nHeight = 0;
sal_uInt16 nPropHeight = 100;
@@ -1118,7 +1118,7 @@ static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
switch( pExpr->GetType() )
{
@@ -1249,7 +1249,7 @@ static void ParseCSS1_text_transform( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
// none | capitalize | uppercase | lowercase
@@ -1276,7 +1276,7 @@ static void ParseCSS1_color( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
switch( pExpr->GetType() )
{
@@ -1541,7 +1541,7 @@ static void ParseCSS1_background_color( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
Color aColor;
@@ -1587,7 +1587,7 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uInt16 nHeight = 0;
sal_uInt16 nPropHeight = 0;
@@ -1652,7 +1652,7 @@ static void ParseCSS1_list_style_type( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
if( pExpr->GetType() != CSS1_IDENT )
return;
@@ -1771,7 +1771,7 @@ static void ParseCSS1_letter_spacing( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
switch( pExpr->GetType() )
{
@@ -1925,7 +1925,7 @@ static void ParseCSS1_text_align( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
if( CSS1_IDENT==pExpr->GetType() ||
CSS1_STRING==pExpr->GetType() ) // MS-IE, again
@@ -1945,7 +1945,7 @@ static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
short nIndent = 0;
bool bSet = false;
@@ -1997,7 +1997,7 @@ static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
tools::Long nLeft = 0;
bool bSet = false;
@@ -2056,7 +2056,7 @@ static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
tools::Long nRight = 0;
bool bSet = false;
@@ -2170,7 +2170,7 @@ static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uInt16 nLower = 0;
bool bSet = false;
@@ -2365,7 +2365,7 @@ static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
SvxBoxItemLine nWhichLine )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
bool bSet = false;
sal_uInt16 nDist = 0;
@@ -2484,7 +2484,7 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr,
const SvxCSS1Parser& /*rParser*/,
SvxBoxItemLine nWhichLine, bool bAll )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uInt16 nWidth = USHRT_MAX; // line thickness
sal_uInt16 nNWidth = 1; // named line thickness (and default)
@@ -2580,7 +2580,7 @@ static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr,
const SvxCSS1Parser& /*rParser*/,
SvxBoxItemLine nWhichLine )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
sal_uInt16 nWidth = USHRT_MAX; // line thickness
sal_uInt16 nNWidth = 1; // named line thickness (and default)
@@ -2773,7 +2773,7 @@ static void ParseCSS1_float( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
if( CSS1_IDENT==pExpr->GetType() )
{
@@ -2788,7 +2788,7 @@ static void ParseCSS1_position( const CSS1Expression *pExpr,
SvxCSS1PropertyInfo& rPropInfo,
const SvxCSS1Parser& /*rParser*/ )
{
- OSL_ENSURE( pExpr, "no expression" );
+ assert(pExpr && "no expression");
if( CSS1_IDENT==pExpr->GetType() )
{
@@ -3140,7 +3140,7 @@ static bool CSS1PropEntryFindCompare(CSS1PropEntry const & lhs, OUString const &
void SvxCSS1Parser::DeclarationParsed( const OUString& rProperty,
std::unique_ptr<CSS1Expression> pExpr )
{
- OSL_ENSURE( m_pItemSet, "DeclarationParsed() without ItemSet" );
+ assert(m_pItemSet && "DeclarationParsed() without ItemSet");
auto it = std::lower_bound( std::begin(aCSS1PropFnTab), std::end(aCSS1PropFnTab), rProperty,
CSS1PropEntryFindCompare );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index dbbbc7cc0207..7332fa881c48 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -192,7 +192,7 @@ OUString HTMLReader::GetTemplateName(SwDoc& rDoc) const
bool HTMLReader::SetStrmStgPtr()
{
- OSL_ENSURE( m_pMedium, "Where is the medium??" );
+ assert(m_pMedium && "Where is the medium??");
if( m_pMedium->IsRemote() || !m_pMedium->IsStorage() )
{
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 093cef850614..b13015a11f7a 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -833,7 +833,7 @@ static SwHTMLWriter& OutHTML_Section( SwHTMLWriter& rWrt, const SwSectionNode& r
const SwSection& rSection = rSectNd.GetSection();
const SwSectionFormat *pFormat = rSection.GetFormat();
- OSL_ENSURE( pFormat, "Section without a format?" );
+ assert(pFormat && "Section without a format?");
bool bStartTag = true;
bool bEndTag = true;
@@ -1263,12 +1263,15 @@ void SwHTMLWriter::OutBookmarks()
IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess();
if(m_nBkmkTabPos != -1)
pBookmark = pMarkAccess->getAllMarksBegin()[m_nBkmkTabPos];
+
// Output all bookmarks in this paragraph. The content position
// for the moment isn't considered!
SwNodeOffset nNode = m_pCurrentPam->GetPoint()->GetNodeIndex();
- while( m_nBkmkTabPos != -1
- && pBookmark->GetMarkPos().GetNodeIndex() == nNode )
+ while (m_nBkmkTabPos != -1)
{
+ assert(pBookmark);
+ if (pBookmark->GetMarkPos().GetNodeIndex() != nNode)
+ break;
// The area of bookmarks is first ignored, because it's not read.
// first the SWG specific data:
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 42a12b7567bd..3c23ddc5a0b9 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2325,10 +2325,10 @@ bool WW8_WrPlcSubDoc::WriteGenericText( WW8Export& rWrt, sal_uInt8 nTTyp,
else
{
const SwFrameFormat* pFormat = ::FindFrameFormat( &rObj );
- OSL_ENSURE( pFormat, "where is the format?" );
+ assert(pFormat && "where is the format?");
const SwNodeIndex* pNdIdx = pFormat->GetContent().GetContentIdx();
- OSL_ENSURE( pNdIdx, "where is the StartNode of the Textbox?" );
+ assert(pNdIdx && "where is the StartNode of the Textbox?");
rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
pNdIdx->GetNode().EndOfSectionIndex(),
nTTyp );
@@ -2382,7 +2382,7 @@ bool WW8_WrPlcSubDoc::WriteGenericText( WW8Export& rWrt, sal_uInt8 nTTyp,
const SwFormatFootnote* pFootnote = static_cast<SwFormatFootnote const *>(m_aContent[ i ]);
rWrt.WriteFootnoteBegin( *pFootnote );
const SwNodeIndex* pIdx = pFootnote->GetTextFootnote()->GetStartNode();
- OSL_ENSURE( pIdx, "Where is the start node of Foot-/Endnote?" );
+ assert(pIdx && "Where is the start node of Foot-/Endnote?");
rWrt.WriteSpecialText( pIdx->GetIndex() + 1,
pIdx->GetNode().EndOfSectionIndex(),
nTTyp );
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c5a827c7eea8..45eef231ab27 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5955,7 +5955,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss)
if (nErrRet == ERRCODE_NONE)
{
m_pStrm = pDecryptMain;
-
+ assert(m_pStrm);
m_xWwFib = std::make_shared<WW8Fib>(*m_pStrm, m_nWantedVersion);
if (m_xWwFib->m_nFibError)
nErrRet = ERR_SWG_READ_ERROR;
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 1c7df7bee964..e8ed0c459d86 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -642,7 +642,7 @@ static auto RecursiveContains(SwStartNode const& rRedlineSection, SwNode const&
void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
{
- OSL_ENSURE(nullptr != pRedlineInfo, "need redline info");
+ assert(pRedlineInfo && "need redline info");
OSL_ENSURE(IsReady(pRedlineInfo), "redline info not complete yet!");
// this method will modify the document directly -> lock SolarMutex
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index e34a900def70..afa73020adba 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -1218,11 +1218,11 @@ void SwXMLTextParagraphExport::exportTable(
if( pXTable )
{
SwFrameFormat *const pFormat = pXTable->GetFrameFormat();
- OSL_ENSURE( pFormat, "table format missing" );
+ assert(pFormat && "table format missing");
const SwTable *pTable = SwTable::FindTable( pFormat );
- OSL_ENSURE( pTable, "table missing" );
+ assert(pTable && "table missing");
const SwTableNode *pTableNd = pTable->GetTableNode();
- OSL_ENSURE( pTableNd, "table node missing" );
+ assert(pTableNd && "table node missing");
if( bAutoStyles )
{
// AUTOSTYLES: Optimization: Do not export table autostyle if
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index b426ec88bc85..2eb68996e665 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1246,9 +1246,9 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
SwFrameFormat *const pTableFrameFormat = pXTable->GetFrameFormat();
OSL_ENSURE( pTableFrameFormat, "table format missing" );
SwTable *pTable = SwTable::FindTable( pTableFrameFormat );
- OSL_ENSURE( pTable, "table missing" );
+ assert(pTable && "table missing");
m_pTableNode = pTable->GetTableNode();
- OSL_ENSURE( m_pTableNode, "table node missing" );
+ assert(m_pTableNode && "table node missing");
SwTableLine *pLine1 = m_pTableNode->GetTable().GetTabLines()[0U];
m_pBox1 = pLine1->GetTabBoxes()[0U];
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
index 34048c256459..2a3ee6db0e8d 100644
--- a/sw/source/ui/chrdlg/break.cxx
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -101,7 +101,7 @@ IMPL_LINK_NOARG(SwBreakDlg, OkHdl, weld::Button&, void)
else
pPageDesc = &m_rSh.GetPageDesc(m_rSh.GetCurPageDesc());
- OSL_ENSURE(pPageDesc, "Page description not found.");
+ assert(pPageDesc && "Page description not found.");
const sal_uInt16 nUserPage = sal_uInt16(m_xPageNumEdit->get_value());
bool bOk = true;
switch(pPageDesc->GetUseOn())
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 9c84eb7a97fe..0623d270e842 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -232,7 +232,7 @@ void SwDropCapsPict::UpdatePaintSettings()
SwCharFormat *pFormat = rWrtShell.GetCharStyle(
mpPage->m_xTemplateBox->get_active_text(),
SwWrtShell::GETSTYLE_CREATEANY );
- OSL_ENSURE(pFormat, "character style doesn't exist!");
+ assert(pFormat && "character style doesn't exist!");
const SvxFontItem &rFormatFont = pFormat->GetFont();
aFont.SetFamily(rFormatFont.GetFamily());
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index 1277545c6e12..8677e51854dc 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -33,7 +33,13 @@
#include <comphelper/lok.hxx>
#include <PostItMgr.hxx>
-#define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
+static bool isLOKMobilePhone()
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return false;
+ SfxViewShell* pCurrent = SfxViewShell::Current();
+ return pCurrent && pCurrent->isLOKMobilePhone();
+}
SwWordCountFloatDlg::~SwWordCountFloatDlg()
{
@@ -90,7 +96,7 @@ void SwWordCountFloatDlg::showCJK(bool bShowCJK)
{
m_xCurrentCjkcharsFT->set_visible(bShowCJK);
m_xDocCjkcharsFT->set_visible(bShowCJK);
- if (IS_MOBILE_PHONE && m_xCjkcharsLabelFT2)
+ if (isLOKMobilePhone() && m_xCjkcharsLabelFT2)
m_xCjkcharsLabelFT2->set_visible(bShowCJK);
m_xCjkcharsLabelFT->set_visible(bShowCJK);
}
@@ -99,7 +105,7 @@ void SwWordCountFloatDlg::showStandardizedPages(bool bShowStandardizedPages)
{
m_xCurrentStandardizedPagesFT->set_visible(bShowStandardizedPages);
m_xDocStandardizedPagesFT->set_visible(bShowStandardizedPages);
- if (IS_MOBILE_PHONE && m_xStandardizedPagesLabelFT2)
+ if (isLOKMobilePhone() && m_xStandardizedPagesLabelFT2)
m_xStandardizedPagesLabelFT2->set_visible(bShowStandardizedPages);
m_xStandardizedPagesLabelFT->set_visible(bShowStandardizedPages);
}
@@ -108,7 +114,7 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings,
SfxChildWindow* pChild,
weld::Window *pParent,
SfxChildWinInfo const * pInfo)
- : SfxModelessDialogController(_pBindings, pChild, pParent, IS_MOBILE_PHONE ? OUString("modules/swriter/ui/wordcount-mobile.ui") : OUString("modules/swriter/ui/wordcount.ui"), "WordCountDialog")
+ : SfxModelessDialogController(_pBindings, pChild, pParent, isLOKMobilePhone() ? OUString("modules/swriter/ui/wordcount-mobile.ui") : OUString("modules/swriter/ui/wordcount.ui"), "WordCountDialog")
, m_xCurrentWordFT(m_xBuilder->weld_label("selectwords"))
, m_xCurrentCharacterFT(m_xBuilder->weld_label("selectchars"))
, m_xCurrentCharacterExcludingSpacesFT(m_xBuilder->weld_label("selectcharsnospaces"))
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 9cf6d8e01c9c..89b7ee7b8f70 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -172,11 +172,11 @@ IMPL_LINK(SwEnvFormatPage, SendEditHdl, const OUString&, rIdent, void)
void SwEnvFormatPage::Edit(std::u16string_view rIdent, bool bSender)
{
SwWrtShell* pSh = GetParentSwEnvDlg()->m_pSh;
- OSL_ENSURE(pSh, "Shell missing");
+ assert(pSh && "Shell missing");
SwTextFormatColl* pColl = pSh->GetTextCollFromPool( static_cast< sal_uInt16 >(
bSender ? RES_POOLCOLL_SEND_ADDRESS : RES_POOLCOLL_ENVELOPE_ADDRESS));
- OSL_ENSURE(pColl, "Text collection missing");
+ assert(pColl && "Text collection missing");
if (o3tl::starts_with(rIdent, u"character"))
{
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 2ca5d673712b..2d3ab98cd0e5 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -833,12 +833,13 @@ IMPL_LINK_NOARG(SwIndexMarkPane, DelHdl, weld::Button&, void)
// renew dialog view
void SwIndexMarkPane::UpdateDialog()
{
- OSL_ENSURE(m_pSh && m_pTOXMgr, "no shell?");
+ assert(m_pTOXMgr && "no tox manager?");
SwTOXMark* pMark = m_pTOXMgr->GetCurTOXMark();
OSL_ENSURE(pMark, "no current marker");
if(!pMark)
return;
+ assert(m_pSh && "no shell?");
SwViewShell::SetCareDialog(m_xDialog);
m_aOrgStr = pMark->GetText(m_pSh->GetLayout());
@@ -1510,7 +1511,7 @@ IMPL_LINK(SwAuthorMarkPane, IsEditAllowedHdl, weld::Entry&, rEdit, bool)
void SwAuthorMarkPane::InitControls()
{
- OSL_ENSURE(m_pSh, "no shell?");
+ assert(m_pSh && "no shell?");
SwField* pField = m_pSh->GetCurField();
OSL_ENSURE(m_bNewEntry || pField, "no current marker");
if(m_bNewEntry)
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 0fbe3b7c6ff7..3e0f8cb9abc0 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -350,7 +350,7 @@ bool SwEndNoteOptionPage::FillItemSet( SfxItemSet * )
{
const OUString aFormatName( m_xParaTemplBox->get_active_text() );
SwTextFormatColl *pColl = m_pSh->GetParaStyle(aFormatName, SwWrtShell::GETSTYLE_CREATEANY);
- OSL_ENSURE(pColl, "paragraph style not found");
+ assert(pColl && "paragraph style not found");
pInf->SetFootnoteTextColl(*pColl);
}
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index daedfffe46f1..34e43bec7d40 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -586,10 +586,11 @@ void SwFormatTablePage::Reset( const SfxItemSet* )
void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
{
- OSL_ENSURE(m_pTableData, "table data not available?");
if(SfxItemState::SET != rSet.GetItemState( FN_TABLE_REP ))
return;
+ assert(m_pTableData && "table data not available?");
+
SwTwips nCurWidth = text::HoriOrientation::FULL != m_pTableData->GetAlign() ?
m_pTableData->GetWidth() :
m_pTableData->GetSpace();
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index af678bbdf25c..739be04c6de4 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1107,9 +1107,12 @@ void SwDocShell::GetState(SfxItemSet& rSet)
break;
case SID_NOTEBOOKBAR:
{
- SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
- bool bVisible = sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(),
- u"modules/swriter/ui/");
+ bool bVisible = false;
+ if (SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current())
+ {
+ bVisible = sfx2::SfxNotebookBar::StateMethod(pViewShell->GetViewFrame().GetBindings(),
+ u"modules/swriter/ui/");
+ }
rSet.Put( SfxBoolItem( SID_NOTEBOOKBAR, bVisible ) );
}
break;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 0261e30952ee..285ef0a46c0e 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -152,7 +152,7 @@ std::shared_ptr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(weld
void SwDocShell::ToggleLayoutMode(SwView* pView)
{
- OSL_ENSURE( pView, "SwDocShell::ToggleLayoutMode, pView is null." );
+ assert(pView && "SwDocShell::ToggleLayoutMode, pView is null.");
const SwViewOption& rViewOptions = *pView->GetWrtShell().GetViewOptions();
@@ -1557,10 +1557,12 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
// The HTML template still has to be set
SetHTMLTemplate( *GetDoc() ); //Styles from HTML.vor
- SfxViewShell* pViewShell = GetView() ? static_cast<SfxViewShell*>(GetView())
- : SfxViewShell::Current();
- SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
- rViewFrame.GetDispatcher()->Execute( SID_VIEWSHELL0, SfxCallMode::SYNCHRON );
+ if (SfxViewShell* pViewShell = GetView() ? static_cast<SfxViewShell*>(GetView())
+ : SfxViewShell::Current())
+ {
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+ rViewFrame.GetDispatcher()->Execute( SID_VIEWSHELL0, SfxCallMode::SYNCHRON );
+ }
SubInitNew();
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index f872417e8333..a952e0224690 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -261,6 +261,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
aFont = pPrt->GetFontMetric( aFont );
pColl = m_xDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(aFontIdPoolId[nIdx + 1]);
+ assert(pColl);
if( !bHTMLTemplSet ||
SfxItemState::SET != pColl->GetAttrSet().GetItemState(
nFontWhich, false ) )
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 9d981d905a26..7cfd6f24fef1 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1506,7 +1506,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
if( nFamily == SfxStyleFamily::Char )
{
- SAL_WARN_IF(!m_pCharFormat, "sw.ui", "Where's SwCharFormat");
+ assert(m_pCharFormat && "Where's SwCharFormat");
m_aCoreSet.Put(m_pCharFormat->GetAttrSet());
m_aCoreSet.Put( aBoxInfo );
@@ -1515,7 +1515,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
}
else if ( nFamily == SfxStyleFamily::Para )
{
- OSL_ENSURE(m_pColl, "Where's Collection");
+ assert(m_pColl && "Where's Collection");
m_aCoreSet.Put(m_pColl->GetAttrSet());
m_aCoreSet.Put( aBoxInfo );
m_aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_pColl->IsAutoUpdateOnDirectFormat()));
@@ -1525,7 +1525,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
}
else
{
- OSL_ENSURE(m_pFrameFormat, "Where's FrameFormat");
+ assert(m_pFrameFormat && "Where's FrameFormat");
m_aCoreSet.Put(m_pFrameFormat->GetAttrSet());
m_aCoreSet.Put( aBoxInfo );
m_aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_pFrameFormat->IsAutoUpdateOnDirectFormat()));
@@ -1554,14 +1554,14 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
m_aCoreSet.SetParent(&m_rDoc.GetDfltFrameFormat()->GetAttrSet());
}
- OSL_ENSURE(m_pDesc, "No PageDescriptor");
+ assert(m_pDesc && "No PageDescriptor");
::PageDescToItemSet(*const_cast<SwPageDesc*>(m_pDesc), m_aCoreSet);
}
break;
case SfxStyleFamily::Pseudo:
{
- OSL_ENSURE(m_pNumRule, "No NumRule");
+ assert(m_pNumRule && "No NumRule");
SvxNumRule aRule = m_pNumRule->MakeSvxNumRule();
m_aCoreSet.Put(SvxNumBulletItem(std::move(aRule)));
}
@@ -1583,7 +1583,7 @@ void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
return;
}
- OSL_ENSURE( m_pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
+ assert(m_pColl && "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
::sw::ListLevelIndents const indents(m_pColl->AreListLevelIndentsApplicable());
if (indents == ::sw::ListLevelIndents::No)
return;
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index d7c11eba7575..23f9c89ebd7c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -520,6 +520,7 @@ bool SwDBManager::Merge( const SwMergeDescriptor& rMergeDesc )
lcl_InitNumberFormatter(*m_pImpl->pMergeData, xSource);
+ assert(pWorkShell);
pWorkShell->ChgDBData(aData);
m_bInMerge = true;
diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index 413d20f28415..bfe03c3e94df 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -23,7 +23,13 @@
#include <sfx2/viewsh.hxx>
#include <svl/itemset.hxx>
-#define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
+static bool isLOKMobilePhone()
+{
+ if (!comphelper::LibreOfficeKit::isActive())
+ return false;
+ SfxViewShell* pCurrent = SfxViewShell::Current();
+ return pCurrent && pCurrent->isLOKMobilePhone();
+}
SwWatermarkDialog::SwWatermarkDialog(weld::Window* pParent, SfxBindings& rBindings)
: SfxDialogController(pParent, "modules/swriter/ui/watermarkdialog.ui", "WatermarkDialog")
@@ -37,7 +43,7 @@ SwWatermarkDialog::SwWatermarkDialog(weld::Window* pParent, SfxBindings& rBindin
{
InitFields();
- if (IS_MOBILE)
+ if (isLOKMobilePhone())
{
m_xBuilder->weld_label("ColorLabel")->hide();
m_xColor->hide();
diff --git a/sw/source/uibase/lingu/sdrhhcwrap.cxx b/sw/source/uibase/lingu/sdrhhcwrap.cxx
index 6df5911fd280..1e39a6d0f3f4 100644
--- a/sw/source/uibase/lingu/sdrhhcwrap.cxx
+++ b/sw/source/uibase/lingu/sdrhhcwrap.cxx
@@ -135,7 +135,7 @@ bool SdrHHCWrapper::ConvertNextDocument()
if (HasConvertibleTextPortion( m_nSourceLang ))
{
SdrView *pSdrView = m_pView->GetWrtShell().GetDrawView();
- OSL_ENSURE( pSdrView, "SdrHHCWrapper without DrawView?" );
+ assert(pSdrView && "SdrHHCWrapper without DrawView?");
SdrPageView* pPV = pSdrView->GetSdrPageView();
m_nDocIndex = n;
bNextDoc = true;
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 44e838b96ca7..a0394cdb5598 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -608,7 +608,7 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq)
{
// #i68101#
SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
- OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ assert(pSelected && "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
OUString aOrigName(pSelected->GetName());
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
@@ -648,7 +648,7 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq)
if(1 == pSdrView->GetMarkedObjectCount())
{
SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0);
- OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ assert(pSelected && "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
OUString aTitle(pSelected->GetTitle());
OUString aDescription(pSelected->GetDescription());
bool isDecorative(pSelected->IsDecorative());
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 9600c1a83e1c..56b29f14c16e 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -335,8 +335,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
bRestoreSelection = true;
}
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
+ SwView& rView = GetView();
+ FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>(&rView) != nullptr);
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLCOLOR, EE_ITEMS_START, EE_ITEMS_END> aDlgAttr(GetPool());
@@ -346,7 +346,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(pView->GetFrameWeld(), *pView, aDlgAttr, SwCharDlgMode::Draw));
+ VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(rView.GetFrameWeld(), rView, aDlgAttr, SwCharDlgMode::Draw));
if (nSlot == SID_CHAR_DLG_EFFECT)
{
pDlg->SetCurPageId("fonteffects");
@@ -411,8 +411,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
if (!pArgs)
{
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
+ SwView& rView = GetView();
+ FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>(&rView) != nullptr);
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
SfxItemSetFixed<
EE_ITEMS_START, EE_ITEMS_END,
diff --git a/sw/source/uibase/uitest/uiobject.cxx b/sw/source/uibase/uitest/uiobject.cxx
index 097769e3704f..e57afceedd70 100644
--- a/sw/source/uibase/uitest/uiobject.cxx
+++ b/sw/source/uibase/uitest/uiobject.cxx
@@ -124,7 +124,7 @@ void SwEditWinUIObject::execute(const OUString& rAction,
else if (rAction == "SIDEBAR")
{
SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- DBG_ASSERT(pViewFrm, "SwEditWinUIObject::execute: no viewframe");
+ assert(pViewFrm && "SwEditWinUIObject::execute: no viewframe");
pViewFrm->ShowChildWindow(SID_SIDEBAR);
if (rParameters.find("PANEL") != rParameters.end())
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index a1d28225e51f..b6bd92579188 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -464,7 +464,7 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
{
SwWrtShell *pSh = &GetWrtShell();
SdrView *pSdrView = pSh->GetDrawView();
- OSL_ENSURE( pSdrView, "EnterDrawTextMode without DrawView?" );
+ assert(pSdrView && "EnterDrawTextMode without DrawView?");
bool bReturn = false;
@@ -609,7 +609,7 @@ bool SwView::IsTextTool() const
SdrObjKind nId;
SdrInventor nInvent;
SdrView *pSdrView = GetWrtShell().GetDrawView();
- OSL_ENSURE( pSdrView, "IsTextTool without DrawView?" );
+ assert(pSdrView && "IsTextTool without DrawView?");
if (pSdrView->IsCreateMode())
pSdrView->SetCreateMode(false);
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 3eaf8a419d9f..d005899f8229 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -153,8 +153,12 @@ void SwView::ExecSearch(SfxRequest& rReq)
// for now do nothing
case SID_SEARCH_ITEM:
{
- delete s_pSrchItem;
- s_pSrchItem = pArgs->Get(SID_SEARCH_ITEM).Clone();
+ OSL_ENSURE(pArgs, "Args missing");
+ if (pArgs)
+ {
+ delete s_pSrchItem;
+ s_pSrchItem = pArgs->Get(SID_SEARCH_ITEM).Clone();
+ }
}
break;
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 72c67ce7ab1b..66e08d9f64a5 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -510,7 +510,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
{
const SwFormatHeader &rHeaderFormat = rMaster.GetHeader();
const SwFrameFormat *pHeaderFormat = rHeaderFormat.GetHeaderFormat();
- OSL_ENSURE(pHeaderFormat != nullptr, "no header format");
+ assert(pHeaderFormat && "no header format");
// HeaderInfo, margins, background, border
SfxItemSetFixed<RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82
@@ -559,7 +559,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
{
const SwFormatFooter &rFooterFormat = rMaster.GetFooter();
const SwFrameFormat *pFooterFormat = rFooterFormat.GetFooterFormat();
- OSL_ENSURE(pFooterFormat != nullptr, "no footer format");
+ assert(pFooterFormat && "no footer format");
// FooterInfo, margins, background, border
SfxItemSetFixed<RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index d104ce90aa9b..8394d0086401 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -798,7 +798,7 @@ void SwWrtShell::LeaveSelFrameMode()
IMPL_LINK( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void )
{
const SwFrameFormat *pFormat = pFlyFormat ? static_cast<const SwFrameFormat*>(pFlyFormat) : GetFlyFrameFormat();
- OSL_ENSURE(pFormat, "no frame format");
+ assert(pFormat && "no frame format");
const SvxMacroItem &rFormatMac = pFormat->GetMacro();
if(rFormatMac.HasMacro(SvMacroItemId::SwObjectSelect))