diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 20:42:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 22:33:02 +0200 |
commit | fe6cce01c88d045a1fcf09acf049c34c22299b02 (patch) | |
tree | c118594a43386096bca55179f31b2b61e64dfa48 /sc | |
parent | b894a3d7f991dd248dfd8935b31da8bccfd130b2 (diff) |
Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptr
...where the get member function is defined on a std::__shared_ptr base class,
so loplugin:simplifypointertobool used to miss those until now. (While e.g.
using libc++ on macOS found those cases.)
366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool"
was mistaken in breaking isSmartPointerType(const clang::Type* t) out of
isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix
detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had
introduced that indivisible two-step algorithm on purpose.
The amount of additional hits (on Linux) apparently asked for turning
loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed
that the naive adivce to just "drop the get()" is not sufficient in places that
are not contextually converted to bool, as those places need to be wrapped in a
bool(...) functional cast now. If the expression was already wrapped in
parentheses, those could be reused as part of the functional cast, but
implementing that showed that such cases are not yet found at all by the
existing loplugin:simplifypointertobool. Lets leave that TODO for another
commit.
Besides the changes to compilerplugins/ itself, this change has been generated
fully automatically with the rewriting plugin on Linux.
Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc')
37 files changed, 112 insertions, 112 deletions
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index f62185f81455..332da1efe004 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -6599,7 +6599,7 @@ void Test::testExternalRef() // Sheet2 is not referenced at all; the cache table shouldn't even exist. pCacheTab = pRefMgr->getCacheTable(nFileId, aExtSh2Name, false); - CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 2 should *not* exist.", !pCacheTab.get()); + CPPUNIT_ASSERT_MESSAGE("Cache table for sheet 2 should *not* exist.", !pCacheTab); // Sheet3's row 5 is not referenced; it should not be cached. pCacheTab = pRefMgr->getCacheTable(nFileId, aExtSh3Name, false); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index dd9a36b71763..d0ac658f3e35 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -899,7 +899,7 @@ const OutlinerParaObject* ScPostIt::GetOutlinerObject() const { if( maNoteData.mxCaption ) return maNoteData.mxCaption->GetOutlinerParaObject(); - if( maNoteData.mxInitData.get() ) + if( maNoteData.mxInitData ) return maNoteData.mxInitData->mxOutlinerObj.get(); return nullptr; } @@ -926,7 +926,7 @@ OUString ScPostIt::GetText() const } return aBuffer.makeStringAndClear(); } - if( maNoteData.mxInitData.get() ) + if( maNoteData.mxInitData ) return maNoteData.mxInitData->maSimpleText; return OUString(); } @@ -935,7 +935,7 @@ bool ScPostIt::HasMultiLineText() const { if( const EditTextObject* pEditObj = GetEditTextObject() ) return pEditObj->GetParagraphCount() > 1; - if( maNoteData.mxInitData.get() ) + if( maNoteData.mxInitData ) return maNoteData.mxInitData->maSimpleText.indexOf( '\n' ) >= 0; return false; } @@ -1013,8 +1013,8 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const { // Captions are not created in Undo documents and only rarely in Clipboard, // but otherwise we need caption or initial data. - assert((maNoteData.mxCaption || maNoteData.mxInitData.get()) || mrDoc.IsUndo() || mrDoc.IsClipboard()); - if( !maNoteData.mxInitData.get() ) + assert((maNoteData.mxCaption || maNoteData.mxInitData) || mrDoc.IsUndo() || mrDoc.IsClipboard()); + if( !maNoteData.mxInitData ) return; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 8217c6a411e8..9cdc0c8fc427 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -262,7 +262,7 @@ void ScCompiler::SetNumberFormatter( SvNumberFormatter* pFormatter ) void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap ) { - if (xMap.get()) + if (xMap) { mxSymbols = xMap; if (mxSymbols->isEnglish()) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 644783757893..56309d6878d7 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2461,7 +2461,7 @@ void ScInterpreter::ScCellExternal() // For SHEET, No idea what number we should set, but let's always set // 1 if the external sheet exists, no matter what sheet. Excel does // the same. - if (pRefMgr->getCacheTable(nFileId, aTabName, false).get()) + if (pRefMgr->getCacheTable(nFileId, aTabName, false)) PushInt(1); else SetError(FormulaError::NoName); diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 451f26bcd076..91f01290c154 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -349,7 +349,7 @@ void ImportExcel8::ReadBasic() uno::Reference< io::XInputStream > xIn = rMedium.GetInputStream(); oox::ole::OleStorage root( aCtx, xIn, false ); oox::StorageRef vbaStg = root.openSubStorage( "_VBA_PROJECT_CUR", false ); - if ( vbaStg.get() ) + if ( vbaStg ) { oox::ole::VbaProject aVbaPrj( aCtx, pShell->GetModel(), "Calc" ); // collect names of embedded form controls, as specified in the VBA project diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 51b151a7ba08..c7d6d97ea6de 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -120,7 +120,7 @@ XclExpSstImpl::XclExpSstImpl() : sal_uInt32 XclExpSstImpl::Insert( XclExpStringRef xString ) { OSL_ENSURE( xString.get(), "XclExpSstImpl::Insert - empty pointer not allowed" ); - if( !xString.get() ) + if( !xString ) xString.reset( new XclExpString ); ++mnTotal; @@ -440,10 +440,10 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU } // text mark - if( !mxTextMark.get() && aUrlObj.HasMark() ) + if( !mxTextMark && aUrlObj.HasMark() ) mxTextMark.reset( new XclExpString( aUrlObj.GetMark(), XclStrFlags::ForceUnicode, 255 ) ); - if( mxTextMark.get() ) + if( mxTextMark ) { aXclStrm << sal_uInt32( mxTextMark->Len() + 1 ); // string length + 1 trailing zero word mxTextMark->WriteBuffer( aXclStrm ); // NO flags @@ -739,8 +739,8 @@ void XclExpCFImpl::WriteBody( XclExpStream& rStrm ) // *** formula sizes *** - sal_uInt16 nFmlaSize1 = mxTokArr1.get() ? mxTokArr1->GetSize() : 0; - sal_uInt16 nFmlaSize2 = mxTokArr2.get() ? mxTokArr2->GetSize() : 0; + sal_uInt16 nFmlaSize1 = mxTokArr1 ? mxTokArr1->GetSize() : 0; + sal_uInt16 nFmlaSize2 = mxTokArr2 ? mxTokArr2->GetSize() : 0; rStrm << nFmlaSize1 << nFmlaSize2; // *** formatting blocks *** @@ -817,9 +817,9 @@ void XclExpCFImpl::WriteBody( XclExpStream& rStrm ) // *** formulas *** - if( mxTokArr1.get() ) + if( mxTokArr1 ) mxTokArr1->WriteArray( rStrm ); - if( mxTokArr2.get() ) + if( mxTokArr2 ) mxTokArr2->WriteArray( rStrm ); } @@ -1830,7 +1830,7 @@ void XclExpDV::WriteBody( XclExpStream& rStrm ) // flags and strings rStrm << mnFlags << maPromptTitle << maErrorTitle << maPromptText << maErrorText; // condition formulas - if( mxString1.get() ) + if( mxString1 ) lclWriteDvFormula( rStrm, *mxString1 ); else lclWriteDvFormula( rStrm, mxTokArr1.get() ); @@ -2019,7 +2019,7 @@ XclExpWebQuery::~XclExpWebQuery() void XclExpWebQuery::Save( XclExpStream& rStrm ) { - OSL_ENSURE( !mbEntireDoc || !mxQryTables.get(), "XclExpWebQuery::Save - illegal mode" ); + OSL_ENSURE( !mbEntireDoc || !mxQryTables, "XclExpWebQuery::Save - illegal mode" ); sal_uInt16 nFlags; // QSI record @@ -2059,7 +2059,7 @@ void XclExpWebQuery::Save( XclExpStream& rStrm ) rStrm.EndRecord(); // WEBQRYSETTINGS record - nFlags = mxQryTables.get() ? EXC_WQSETT_SPECTABLES : EXC_WQSETT_ALL; + nFlags = mxQryTables ? EXC_WQSETT_SPECTABLES : EXC_WQSETT_ALL; rStrm.StartRecord( EXC_ID_WQSETT, 28 ); rStrm << EXC_ID_WQSETT // repeated record id ?!? << sal_uInt16( 0x0000 ) @@ -2074,7 +2074,7 @@ void XclExpWebQuery::Save( XclExpStream& rStrm ) rStrm.EndRecord(); // WEBQRYTABLES record - if( mxQryTables.get() ) + if( mxQryTables ) { rStrm.StartRecord( EXC_ID_WQTABLES, 4 + mxQryTables->GetSize() ); rStrm << EXC_ID_WQTABLES // repeated record id ?!? diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index cd01aaeb2b23..66525e1d0a43 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -568,7 +568,7 @@ const XclExpCompConfig* XclExpFmlaCompImpl::GetConfigForType( XclFormulaType eTy void XclExpFmlaCompImpl::Init( XclFormulaType eType ) { // compiler invoked recursively? - store old working data - if( mxData.get() ) + if( mxData ) maDataStack.push_back( mxData ); // new compiler working data structure mxData = std::make_shared<XclExpCompData>( GetConfigForType( eType ) ); @@ -2159,7 +2159,7 @@ void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData ) sal_uInt16 nFileId = rTokData.mpScToken->GetIndex(); OUString aName = rTokData.mpScToken->GetString().getString(); ScExternalRefCache::TokenArrayRef xArray = rExtRefMgr.getRangeNameTokens( nFileId, aName ); - if( xArray.get() ) + if( xArray ) { // store external cell contents in CRN records if( mxData->mpScBasePos ) @@ -2518,7 +2518,7 @@ void XclExpFmlaCompImpl::InsertZeros( sal_uInt16 nInsertPos, sal_uInt16 nInsertS if( nInsertPos < mxData->maOpListVec.size() ) mxData->maOpListVec.insert( mxData->maOpListVec.begin() + nInsertPos, nInsertSize, XclExpOperandListRef() ); for( auto& rxOpList : mxData->maOpListVec ) - if( rxOpList.get() ) + if( rxOpList ) for( auto& rOp : *rxOpList ) if( nInsertPos <= rOp.mnTokPos ) rOp.mnTokPos += nInsertSize; diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index e3efd87072f8..42375c20d46f 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -1912,7 +1912,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT // This is a new'ed instance, so we must manage its life cycle here. ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, rRange, nullptr); - if (!pArray.get()) + if (!pArray) return; FormulaTokenArrayPlainIterator aIter(*pArray); diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index e2160048b597..8e1c6aecd196 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -473,11 +473,11 @@ void XclImpHFConverter::ParseString( const OUString& rHFString ) void XclImpHFConverter::FillToItemSet( SfxItemSet& rItemSet, sal_uInt16 nWhichId ) const { ScPageHFItem aHFItem( nWhichId ); - if( maInfos[ EXC_HF_LEFT ].mxObj.get() ) + if( maInfos[ EXC_HF_LEFT ].mxObj ) aHFItem.SetLeftArea( *maInfos[ EXC_HF_LEFT ].mxObj ); - if( maInfos[ EXC_HF_CENTER ].mxObj.get() ) + if( maInfos[ EXC_HF_CENTER ].mxObj ) aHFItem.SetCenterArea( *maInfos[ EXC_HF_CENTER ].mxObj ); - if( maInfos[ EXC_HF_RIGHT ].mxObj.get() ) + if( maInfos[ EXC_HF_RIGHT ].mxObj ) aHFItem.SetRightArea( *maInfos[ EXC_HF_RIGHT ].mxObj ); rItemSet.Put( aHFItem ); } @@ -575,7 +575,7 @@ void XclImpHFConverter::SetNewPortion( XclImpHFPortion eNew ) { CreateCurrObject(); meCurrObj = eNew; - if( GetCurrObj().get() ) + if( GetCurrObj() ) mrEE.SetText( *GetCurrObj() ); else mrEE.SetText( EMPTY_OUSTRING ); diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 436e00e3b911..a5e248be1214 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1986,7 +1986,7 @@ void XclImpXFRangeBuffer::Finalize() for( const auto& rxColumn : maColumns ) { // apply all cell styles of an existing column - if( rxColumn.get() ) + if( rxColumn ) { XclImpXFRangeColumn& rColumn = *rxColumn; std::vector<ScAttrEntry> aAttrs; diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index a4c48663aa94..448fafaaad1e 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -357,7 +357,7 @@ DateTime XclRoot::GetDateTimeFromDouble( double fValue ) const ScEditEngineDefaulter& XclRoot::GetEditEngine() const { - if( !mrData.mxEditEngine.get() ) + if( !mrData.mxEditEngine ) { mrData.mxEditEngine = std::make_shared<ScEditEngineDefaulter>( GetDoc().GetEnginePool() ); ScEditEngineDefaulter& rEE = *mrData.mxEditEngine; @@ -372,7 +372,7 @@ ScEditEngineDefaulter& XclRoot::GetEditEngine() const ScHeaderEditEngine& XclRoot::GetHFEditEngine() const { - if( !mrData.mxHFEditEngine.get() ) + if( !mrData.mxHFEditEngine ) { mrData.mxHFEditEngine = std::make_shared<ScHeaderEditEngine>( EditEngine::CreatePool() ); ScHeaderEditEngine& rEE = *mrData.mxHFEditEngine; @@ -396,7 +396,7 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const EditEngine& XclRoot::GetDrawEditEngine() const { - if( !mrData.mxDrawEditEng.get() ) + if( !mrData.mxDrawEditEng ) { mrData.mxDrawEditEng = std::make_shared<EditEngine>( &GetDoc().GetDrawLayer()->GetItemPool() ); EditEngine& rEE = *mrData.mxDrawEditEng; diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index a676dd5c0429..87f22f630843 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -252,7 +252,7 @@ bool ScTBC::ImportToolBarControl( ScCTBWrapper& rWrapper, const css::uno::Refere { // how to identify built-in-command ? // bool bBuiltin = false; - if ( tbcd.get() ) + if ( tbcd ) { std::vector< css::beans::PropertyValue > props; bool bBeginGroup = false; diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index b289d3b00553..8e77d935d9a2 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -518,7 +518,7 @@ void FilterColumn::importFilterColumn( SequenceInputStream& rStrm ) ApiFilterSettings FilterColumn::finalizeImport( sal_Int32 nMaxCount ) { ApiFilterSettings aSettings; - if( (0 <= mnColId) && mxSettings.get() ) + if( (0 <= mnColId) && mxSettings ) { // filter settings object creates a sequence of filter fields aSettings = mxSettings->finalizeImport( nMaxCount ); @@ -683,7 +683,7 @@ void AutoFilterBuffer::finalizeImport( sal_Int16 nSheet ) // position of output data (if built-in defined name 'Extract' exists) DefinedNameRef xExtractName = getDefinedNames().getByBuiltinId( BIFF_DEFNAME_EXTRACT, nSheet ); ScRange aOutputRange; - bool bHasOutputRange = xExtractName.get() && xExtractName->getAbsoluteRange( aOutputRange ); + bool bHasOutputRange = xExtractName && xExtractName->getAbsoluteRange( aOutputRange ); aDescProps.setProperty( PROP_CopyOutputData, bHasOutputRange ); if( bHasOutputRange ) { diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index f33284ac3675..3a85f8a6482f 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -157,7 +157,7 @@ void Comment::finalizeImport() // BIFF12 stores cell range instead of cell address, use first cell of this range OSL_ENSURE( maModel.maRange.aStart == maModel.maRange.aEnd, "Comment::finalizeImport - comment anchor should be a single cell" ); - if( !getAddressConverter().checkCellAddress( maModel.maRange.aStart, true ) || !maModel.mxText.get() ) + if( !getAddressConverter().checkCellAddress( maModel.maRange.aStart, true ) || !maModel.mxText ) return; try diff --git a/sc/source/filter/oox/commentsfragment.cxx b/sc/source/filter/oox/commentsfragment.cxx index fd4a4e34050c..0d6a8b27a870 100644 --- a/sc/source/filter/oox/commentsfragment.cxx +++ b/sc/source/filter/oox/commentsfragment.cxx @@ -61,7 +61,7 @@ ContextHandlerRef CommentsFragment::onCreateContext( sal_Int32 nElement, const A case XDR_TOKEN( to ): return this; case XLS_TOKEN( comment ): - if( (nElement == XLS_TOKEN( text )) && mxComment.get() ) + if( (nElement == XLS_TOKEN( text )) && mxComment ) return new RichStringContext( *this, mxComment->createText() ); if( nElement == XLS_TOKEN( commentPr ) ) { mxComment->importCommentPr( rAttribs ); return this; } break; @@ -99,7 +99,7 @@ ContextHandlerRef CommentsFragment::onCreateRecordContext( sal_Int32 nRecId, Seq if( nRecId == BIFF12_ID_COMMENT ) { importComment( rStrm ); return this; } break; case BIFF12_ID_COMMENT: - if( (nRecId == BIFF12_ID_COMMENTTEXT) && mxComment.get() ) + if( (nRecId == BIFF12_ID_COMMENTTEXT) && mxComment ) mxComment->createText()->importString( rStrm, true ); break; } diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 22b5fbde9303..76369bccbeb0 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1070,7 +1070,7 @@ CondFormatRuleRef CondFormat::createRule() void CondFormat::insertRule( CondFormatRuleRef const & xRule ) { - if( xRule.get() && (xRule->getPriority() > 0) ) + if( xRule && (xRule->getPriority() > 0) ) { OSL_ENSURE( maRules.find( xRule->getPriority() ) == maRules.end(), "CondFormat::insertRule - multiple rules with equal priority" ); maRules[ xRule->getPriority() ] = xRule; @@ -1164,12 +1164,12 @@ void CondFormatBuffer::finalizeImport() for( const auto& rxCondFormat : maCondFormats ) { - if ( rxCondFormat.get()) + if ( rxCondFormat) rxCondFormat->finalizeImport(); } for ( const auto& rxCfRule : maCfRules ) { - if ( rxCfRule.get() ) + if ( rxCfRule ) rxCfRule->finalizeImport(); } diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx index 5b7e624aa18a..9c9a47065bac 100644 --- a/sc/source/filter/oox/condformatcontext.cxx +++ b/sc/source/filter/oox/condformatcontext.cxx @@ -198,7 +198,7 @@ void CondFormatContext::onEndElement() switch( getCurrentElement() ) { case XLS_TOKEN( conditionalFormatting ): - if(mxCondFmt.get()) + if(mxCondFmt) mxCondFmt->setReadyForFinalize(); break; } @@ -212,14 +212,14 @@ void CondFormatContext::onStartElement( const AttributeList& rAttribs ) mxCondFmt = getCondFormats().importConditionalFormatting( rAttribs ); break; case XLS_TOKEN( cfRule ): - if( mxCondFmt.get() ) mxRule = mxCondFmt->importCfRule( rAttribs ); + if( mxCondFmt ) mxRule = mxCondFmt->importCfRule( rAttribs ); break; } } void CondFormatContext::onCharacters( const OUString& rChars ) { - if( isCurrentElement( XLS_TOKEN( formula ) ) && mxCondFmt.get() && mxRule.get() ) + if( isCurrentElement( XLS_TOKEN( formula ) ) && mxCondFmt && mxRule ) mxRule->appendFormula( rChars ); } @@ -241,7 +241,7 @@ void CondFormatContext::onStartRecord( SequenceInputStream& rStrm ) mxCondFmt = getCondFormats().importCondFormatting( rStrm ); break; case BIFF12_ID_CFRULE: - if( mxCondFmt.get() ) mxCondFmt->importCfRule( rStrm ); + if( mxCondFmt ) mxCondFmt->importCfRule( rStrm ); break; } } @@ -251,7 +251,7 @@ void CondFormatContext::onEndRecord() switch( getCurrentElement() ) { case BIFF12_ID_CONDFORMATTING: - if( mxCondFmt.get() ) + if( mxCondFmt ) { mxCondFmt->setReadyForFinalize(); } diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 800d52ef769c..9c440d76c0f8 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -255,7 +255,7 @@ void DrawingFragment::onEndElement() case XDR_TOKEN( absoluteAnchor ): case XDR_TOKEN( oneCellAnchor ): case XDR_TOKEN( twoCellAnchor ): - if( mxDrawPage.is() && mxShape.get() && mxAnchor ) + if( mxDrawPage.is() && mxShape && mxAnchor ) { // Rotation is decided by orientation of shape determined // by the anchor position given by 'editAs="oneCell"' diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index 17d5325e52af..4c59a0e9393b 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -106,7 +106,7 @@ bool ExcelFilter::importDocument() the class WorkbookHelper, and execute the import filter by constructing an instance of WorkbookFragment and loading the file. */ WorkbookGlobalsRef xBookGlob(WorkbookHelper::constructGlobals(*this)); - if (xBookGlob.get()) + if (xBookGlob) { rtl::Reference<FragmentHandler> xWorkbookFragment( new WorkbookFragment(*xBookGlob, aWorkbookPath)); bool bRet = importFragment( xWorkbookFragment); diff --git a/sc/source/filter/oox/externallinkfragment.cxx b/sc/source/filter/oox/externallinkfragment.cxx index bcc51246c265..eddc0c607cbd 100644 --- a/sc/source/filter/oox/externallinkfragment.cxx +++ b/sc/source/filter/oox/externallinkfragment.cxx @@ -213,7 +213,7 @@ ContextHandlerRef ExternalLinkFragment::onCreateContext( sal_Int32 nElement, con case XLS_TOKEN( ddeItem ): if( nElement == XLS_TOKEN( values ) ) { - if( mxExtName.get() ) mxExtName->importValues( rAttribs ); + if( mxExtName ) mxExtName->importValues( rAttribs ); return this; } break; @@ -246,7 +246,7 @@ void ExternalLinkFragment::onCharacters( const OUString& rChars ) void ExternalLinkFragment::onEndElement() { - if( isCurrentElement( XLS_TOKEN( value ) ) && mxExtName.get() ) switch( mnResultType ) + if( isCurrentElement( XLS_TOKEN( value ) ) && mxExtName ) switch( mnResultType ) { case XML_b: mxExtName->appendResultValue( maResultValue.toDouble() ); @@ -293,18 +293,18 @@ ContextHandlerRef ExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, case BIFF12_ID_EXTERNALNAME: switch( nRecId ) { - case BIFF12_ID_EXTERNALNAMEFLAGS: if( mxExtName.get() ) mxExtName->importExternalNameFlags( rStrm ); break; - case BIFF12_ID_DDEITEMVALUES: if( mxExtName.get() ) mxExtName->importDdeItemValues( rStrm ); return this; + case BIFF12_ID_EXTERNALNAMEFLAGS: if( mxExtName ) mxExtName->importExternalNameFlags( rStrm ); break; + case BIFF12_ID_DDEITEMVALUES: if( mxExtName ) mxExtName->importDdeItemValues( rStrm ); return this; } break; case BIFF12_ID_DDEITEMVALUES: switch( nRecId ) { - case BIFF12_ID_DDEITEM_BOOL: if( mxExtName.get() ) mxExtName->importDdeItemBool( rStrm ); break; - case BIFF12_ID_DDEITEM_DOUBLE: if( mxExtName.get() ) mxExtName->importDdeItemDouble( rStrm ); break; - case BIFF12_ID_DDEITEM_ERROR: if( mxExtName.get() ) mxExtName->importDdeItemError( rStrm ); break; - case BIFF12_ID_DDEITEM_STRING: if( mxExtName.get() ) mxExtName->importDdeItemString( rStrm ); break; + case BIFF12_ID_DDEITEM_BOOL: if( mxExtName ) mxExtName->importDdeItemBool( rStrm ); break; + case BIFF12_ID_DDEITEM_DOUBLE: if( mxExtName ) mxExtName->importDdeItemDouble( rStrm ); break; + case BIFF12_ID_DDEITEM_ERROR: if( mxExtName ) mxExtName->importDdeItemError( rStrm ); break; + case BIFF12_ID_DDEITEM_STRING: if( mxExtName ) mxExtName->importDdeItemString( rStrm ); break; } break; } diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 51974233f847..4ade10d2e706 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -964,7 +964,7 @@ bool FormulaParserImpl::pushDdeLinkOperand( const OUString& rDdeServer, const OU bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtName, const ExternalLink& rExtLink ) { - if( rxExtName.get() ) switch( rExtLink.getLinkType() ) + if( rxExtName ) switch( rExtLink.getLinkType() ) { case ExternalLinkType::External: return pushEmbeddedRefOperand( *rxExtName, false ); @@ -1419,7 +1419,7 @@ bool OoxFormulaParserImpl::importTableToken( SequenceInputStream& rStrm ) nCol1 = rStrm.readuInt16(); nCol2 = rStrm.readuInt16(); TableRef xTable = getTables().getTable( nTableId ); - sal_Int32 nTokenIndex = xTable.get() ? xTable->getTokenIndex() : -1; + sal_Int32 nTokenIndex = xTable ? xTable->getTokenIndex() : -1; if( nTokenIndex >= 0 ) { sal_Int32 nWidth = xTable->getWidth(); diff --git a/sc/source/filter/oox/pivotcachefragment.cxx b/sc/source/filter/oox/pivotcachefragment.cxx index c60a383ab9fa..1b7e2d36b090 100644 --- a/sc/source/filter/oox/pivotcachefragment.cxx +++ b/sc/source/filter/oox/pivotcachefragment.cxx @@ -196,7 +196,7 @@ void PivotCacheDefinitionFragment::finalizeImport() { SCTAB nSheet = mrPivotCache.getSourceRange().aStart.Tab(); WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, ISegmentProgressBarRef(), WorksheetType::Work, nSheet ); - if( xSheetGlob.get() ) + if( xSheetGlob ) importOoxFragment( new PivotCacheRecordsFragment( *xSheetGlob, aRecFragmentPath, mrPivotCache ) ); } } diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index d587349105ef..3e82ae71c028 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -214,7 +214,7 @@ void QueryTable::finalizeImport() { ConnectionRef xConnection = getConnections().getConnection( maModel.mnConnId ); OSL_ENSURE( xConnection.get(), "QueryTable::finalizeImport - missing connection object" ); - if( xConnection.get() && (xConnection->getConnectionType() == BIFF12_CONNECTION_HTML) ) + if( xConnection && (xConnection->getConnectionType() == BIFF12_CONNECTION_HTML) ) { // check that valid web query properties exist const WebPrModel* pWebPr = xConnection->getModel().mxWebPr.get(); @@ -227,7 +227,7 @@ void QueryTable::finalizeImport() OUString aDefName = maModel.maDefName.replace( ' ', '_' ).replace( '-', '_' ); DefinedNameRef xDefName = getDefinedNames().getByModelName( aDefName, getSheetIndex() ); OSL_ENSURE( xDefName.get(), "QueryTable::finalizeImport - missing defined name" ); - if( xDefName.get() ) + if( xDefName ) { ScRange aDestRange; bool bIsRange = xDefName->getAbsoluteRange( aDestRange ) && (aDestRange.aStart.Tab() == getSheetIndex()); diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index 848ac6917c25..c2ea6afe3120 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -75,7 +75,7 @@ void RichStringPortion::setFontId( sal_Int32 nFontId ) void RichStringPortion::finalizeImport() { - if( mxFont.get() ) + if( mxFont ) mxFont->finalizeImport(); else if( mnFontId >= 0 ) mxFont = getStyles().getFont( mnFontId ); @@ -96,7 +96,7 @@ void RichStringPortion::convert( const Reference< XText >& rxText, bool bReplace if( xRange.is() ) { xRange->setString( maText ); - if( mxFont.get() ) + if( mxFont ) { PropertySet aPropSet( xRange ); mxFont->writeToPropertySet( aPropSet ); @@ -112,7 +112,7 @@ void RichStringPortion::convert( ScEditEngineDefaulter& rEE, ESelection& rSelect rSelection.nStartPara = rSelection.nEndPara; SfxItemSet aItemSet( rEE.GetEmptyItemSet() ); - const Font* pFontToUse = mxFont.get() ? mxFont.get() : lclNeedsRichTextFormat( pFont ) ? pFont : nullptr; + const Font* pFontToUse = mxFont ? mxFont.get() : lclNeedsRichTextFormat( pFont ) ? pFont : nullptr; if ( pFontToUse ) pFontToUse->fillToItemSet( aItemSet, true ); @@ -145,7 +145,7 @@ void RichStringPortion::writeFontProperties( const Reference<XText>& rxText ) co { PropertySet aPropSet(rxText); - if (mxFont.get()) + if (mxFont) mxFont->writeToPropertySet(aPropSet); } diff --git a/sc/source/filter/oox/richstringcontext.cxx b/sc/source/filter/oox/richstringcontext.cxx index 36cd1a165dea..e7c3fd618bed 100644 --- a/sc/source/filter/oox/richstringcontext.cxx +++ b/sc/source/filter/oox/richstringcontext.cxx @@ -52,7 +52,7 @@ ContextHandlerRef RichStringContext::onCreateContext( sal_Int32 nElement, const switch( nElement ) { case XLS_TOKEN( rPr ): - if( mxPortion.get() ) + if( mxPortion ) return new FontContext( *this, mxPortion->createFont() ); break; @@ -77,11 +77,11 @@ void RichStringContext::onCharacters( const OUString& rChars ) if( isCurrentElement( XLS_TOKEN( t ) ) ) switch( getParentElement() ) { case XLS_TOKEN( rPh ): - if( mxPhonetic.get() ) + if( mxPhonetic ) mxPhonetic->setText( rChars ); break; default: - if( mxPortion.get() ) + if( mxPortion ) mxPortion->setText( rChars ); } } diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index d6757af4df91..7c3264c18dc7 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -158,7 +158,7 @@ void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRe void SheetDataBuffer::setStringCell( const CellModel& rModel, sal_Int32 nStringId ) { RichStringRef xString = getSharedStrings().getString( nStringId ); - if( xString.get() ) + if( xString ) setStringCell( rModel, xString ); else setBlankCell( rModel ); diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index 7ca914e6ad4b..242192f67350 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -196,7 +196,7 @@ void SheetDataContext::onEndElement() mrSheetData.setDateCell( maCellData, maCellValue ); break; } - else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr.get() ) + else if( (maCellData.mnCellType == XML_inlineStr) && mxInlineStr ) { mxInlineStr->finalizeImport(); mrSheetData.setStringCell( maCellData, mxInlineStr ); diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 0895f87a2f98..cd1515914663 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1713,7 +1713,7 @@ void Fill::importPatternFill( const AttributeList& rAttribs ) void Fill::importFgColor( const AttributeList& rAttribs ) { OSL_ENSURE( mxPatternModel.get(), "Fill::importFgColor - missing pattern data" ); - if( mxPatternModel.get() ) + if( mxPatternModel ) { mxPatternModel->maPatternColor.importColor( rAttribs ); mxPatternModel->mbPattColorUsed = true; @@ -1723,7 +1723,7 @@ void Fill::importFgColor( const AttributeList& rAttribs ) void Fill::importBgColor( const AttributeList& rAttribs ) { OSL_ENSURE( mxPatternModel.get(), "Fill::importBgColor - missing pattern data" ); - if( mxPatternModel.get() ) + if( mxPatternModel ) { mxPatternModel->maFillColor.importColor( rAttribs ); mxPatternModel->mbFillColorUsed = true; @@ -1744,7 +1744,7 @@ void Fill::importGradientFill( const AttributeList& rAttribs ) void Fill::importColor( const AttributeList& rAttribs, double fPosition ) { OSL_ENSURE( mxGradientModel.get(), "Fill::importColor - missing gradient data" ); - if( mxGradientModel.get() && (fPosition >= 0.0) ) + if( mxGradientModel && (fPosition >= 0.0) ) mxGradientModel->maColors[ fPosition ].importColor( rAttribs ); } @@ -1817,7 +1817,7 @@ void Fill::finalizeImport() { const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper(); - if( mxPatternModel.get() ) + if( mxPatternModel ) { // finalize the OOXML data struct PatternFillModel& rModel = *mxPatternModel; @@ -1882,7 +1882,7 @@ void Fill::finalizeImport() maApiData.mbTransparent = false; } } - else if( mxGradientModel.get() && !mxGradientModel->maColors.empty() ) + else if( mxGradientModel && !mxGradientModel->maColors.empty() ) { GradientFillModel& rModel = *mxGradientModel; maApiData.mbUsed = true; // no support for differential attributes @@ -2301,11 +2301,11 @@ void Dxf::importDxf( SequenceInputStream& rStrm ) void Dxf::finalizeImport() { - if( mxFont.get() ) + if( mxFont ) mxFont->finalizeImport(); bool bRTL = false; // number format already finalized by the number formats buffer - if( mxAlignment.get() ) + if( mxAlignment ) { mxAlignment->finalizeImport(); // how do we detect RTL when text dir is OOX_XF_CONTEXT? ( seems you @@ -2313,13 +2313,13 @@ void Dxf::finalizeImport() if ( mxAlignment->getModel().mnTextDir == OOX_XF_TEXTDIR_RTL ) bRTL = true; } - if( mxProtection.get() ) + if( mxProtection ) mxProtection->finalizeImport(); - if( mxBorder.get() ) + if( mxBorder ) { mxBorder->finalizeImport( bRTL ); } - if( mxFill.get() ) + if( mxFill ) mxFill->finalizeImport(); } @@ -2623,7 +2623,7 @@ void CellStyleBuffer::finalizeImport() sal_Int32 CellStyleBuffer::getDefaultXfId() const { - return mxDefStyle.get() ? mxDefStyle->getModel().mnXfId : -1; + return mxDefStyle ? mxDefStyle->getModel().mnXfId : -1; } OUString CellStyleBuffer::getDefaultStyleName() const @@ -2664,14 +2664,14 @@ void CellStyleBuffer::insertCellStyle( CellStyleRef const & xCellStyle ) ::ScStyleSheet* CellStyleBuffer::getCellStyleSheet( const CellStyleRef& rxCellStyle ) { ::ScStyleSheet* pStyleSheet = nullptr; - if ( rxCellStyle.get() ) + if ( rxCellStyle ) pStyleSheet = rxCellStyle->getStyleSheet(); return pStyleSheet; } OUString CellStyleBuffer::createCellStyle( const CellStyleRef& rxCellStyle ) { - if( rxCellStyle.get() ) + if( rxCellStyle ) { rxCellStyle->createCellStyle(); const OUString& rStyleName = rxCellStyle->getFinalStyleName(); @@ -2860,7 +2860,7 @@ FontRef StylesBuffer::getDefaultFont() const const FontModel& StylesBuffer::getDefaultFontModel() const { FontRef xDefFont = getDefaultFont(); - return xDefFont.get() ? xDefFont->getModel() : getTheme().getDefaultFontModel(); + return xDefFont ? xDefFont->getModel() : getTheme().getDefaultFontModel(); } bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) diff --git a/sc/source/filter/oox/stylesfragment.cxx b/sc/source/filter/oox/stylesfragment.cxx index a6188072b4d8..e6707704dc44 100644 --- a/sc/source/filter/oox/stylesfragment.cxx +++ b/sc/source/filter/oox/stylesfragment.cxx @@ -57,20 +57,20 @@ ContextHandlerRef IndexedColorsContext::onCreateRecordContext( sal_Int32 nRecId, ContextHandlerRef FontContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if( mxFont.get() ) + if( mxFont ) mxFont->importAttribs( nElement, rAttribs ); return nullptr; } void BorderContext::onStartElement( const AttributeList& rAttribs ) { - if( mxBorder.get() && (getCurrentElement() == XLS_TOKEN( border )) ) + if( mxBorder && (getCurrentElement() == XLS_TOKEN( border )) ) mxBorder->importBorder( rAttribs ); } ContextHandlerRef BorderContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if( mxBorder.get() ) switch( getCurrentElement() ) + if( mxBorder ) switch( getCurrentElement() ) { case XLS_TOKEN( border ): mxBorder->importStyle( nElement, rAttribs ); @@ -85,7 +85,7 @@ ContextHandlerRef BorderContext::onCreateContext( sal_Int32 nElement, const Attr ContextHandlerRef FillContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if( mxFill.get() ) switch( getCurrentElement() ) + if( mxFill ) switch( getCurrentElement() ) { case XLS_TOKEN( fill ): switch( nElement ) @@ -118,13 +118,13 @@ ContextHandlerRef FillContext::onCreateContext( sal_Int32 nElement, const Attrib void XfContext::onStartElement( const AttributeList& rAttribs ) { - if( mxXf.get() && (getCurrentElement() == XLS_TOKEN( xf )) ) + if( mxXf && (getCurrentElement() == XLS_TOKEN( xf )) ) mxXf->importXf( rAttribs, mbCellXf ); } ContextHandlerRef XfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if( mxXf.get() ) switch( getCurrentElement() ) + if( mxXf ) switch( getCurrentElement() ) { case XLS_TOKEN( xf ): switch( nElement ) @@ -139,7 +139,7 @@ ContextHandlerRef XfContext::onCreateContext( sal_Int32 nElement, const Attribut ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - if( mxDxf.get() ) switch( getCurrentElement() ) + if( mxDxf ) switch( getCurrentElement() ) { case XLS_TOKEN( dxf ): switch( nElement ) @@ -157,7 +157,7 @@ ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const Attribu break; } - if( mxExtDxf.get() ) switch( getCurrentElement() ) + if( mxExtDxf ) switch( getCurrentElement() ) { case XLS14_TOKEN( dxf ): switch( nElement ) diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 7bcada3bdf08..969a0a6c29ec 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -141,7 +141,7 @@ ContextHandlerRef WorkbookFragment::onCreateContext( sal_Int32 nElement, const A void WorkbookFragment::onCharacters( const OUString& rChars ) { - if( isCurrentElement( XLS_TOKEN( definedName ) ) && mxCurrName.get() ) + if( isCurrentElement( XLS_TOKEN( definedName ) ) && mxCurrName ) mxCurrName->setFormula( rChars ); } @@ -422,7 +422,7 @@ void WorkbookFragment::finalizeImport() // create the WorksheetGlobals object WorksheetGlobalsRef xSheetGlob = WorksheetHelper::constructGlobals( *this, xSheetSegment, eSheetType, nCalcSheet ); OSL_ENSURE( xSheetGlob.get(), "WorkbookFragment::finalizeImport - missing sheet in document" ); - if( xSheetGlob.get() ) + if( xSheetGlob ) { // create the sheet fragment handler ::rtl::Reference< WorksheetFragmentBase > xFragment; diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 2223d3cb692b..892e2e1bd2d2 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -688,7 +688,7 @@ void WorkbookHelper::finalizeWorkbookImport() // contains the workbook code name). Do it before processing formulas in // order to correctly resolve VBA custom function names. StorageRef xVbaPrjStrg = mrBookGlob.getVbaProjectStorage(); - if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() ) + if( xVbaPrjStrg && xVbaPrjStrg->isStorage() ) getBaseFilter().getVbaProject().importModulesAndForms( *xVbaPrjStrg, getBaseFilter().getGraphicHelper() ); // need to import formulas before scenarios diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index aa00eadf7d60..5fc46ecbfd30 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -89,7 +89,7 @@ namespace { void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double fPosition ) { - if( rxProgressBar.get() ) + if( rxProgressBar ) rxProgressBar->setPosition( fPosition ); } @@ -433,7 +433,7 @@ WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& rHelper, const ISegmen mxVmlDrawing.reset( new VmlDrawing( *this ) ); // prepare progress bars - if( mxProgressBar.get() ) + if( mxProgressBar ) { mxRowProgress = mxProgressBar->createSegment( 0.5 ); mxFinalProgress = mxProgressBar->createSegment( 0.5 ); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index bbadc34397f9..a338a2d861c5 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -4801,7 +4801,7 @@ void ScXMLExport::WriteExternalRefCaches() for (const auto& rTabName : aTabNames) { ScExternalRefCache::TableTypeRef pTable = pRefMgr->getCacheTable(nFileId, rTabName, false); - if (!pTable.get() || !pTable->isReferenced()) + if (!pTable || !pTable->isReferenced()) continue; AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, "'" + *pUrl + "'#" + rTabName); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index cc3933eaa34f..9b90a5cbea36 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -526,7 +526,7 @@ ScExternalRefCache::TokenRef ScExternalRefCache::getCellData( } const TableTypeRef& pTableData = rDoc.maTables[itrTabId->second]; - if (!pTableData.get()) + if (!pTableData) { // the table data is not instantiated yet. return TokenRef(); @@ -579,7 +579,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab) { TableTypeRef pTab = rDoc.maTables[nTab]; - if (!pTab.get()) + if (!pTab) return TokenArrayRef(); SCCOL nDataCol1 = nCol1, nDataCol2 = nCol2; @@ -781,7 +781,7 @@ void ScExternalRefCache::setCellData(sal_uInt16 nFileId, const OUString& rTabNam return; TableTypeRef& pTableData = rDoc.maTables[itrTabName->second]; - if (!pTableData.get()) + if (!pTableData) pTableData = std::make_shared<Table>(); pTableData->setCell(nCol, nRow, pToken, nFmtIndex); @@ -819,7 +819,7 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa for (const auto& rItem : rData) { TableTypeRef& pTabData = rDoc.maTables[i]; - if (!pTabData.get()) + if (!pTabData) pTabData = std::make_shared<Table>(); const ScMatrixRef& pMat = rItem.mpRangeData; @@ -1107,7 +1107,7 @@ bool ScExternalRefCache::setCacheDocReferenced( sal_uInt16 nFileId ) for (auto& rxTab : pDocItem->maTables) { - if (rxTab.get()) + if (rxTab) rxTab->setReferenced(true); } addCacheDocToReferenced( nFileId); @@ -1126,7 +1126,7 @@ bool ScExternalRefCache::setCacheTableReferenced( sal_uInt16 nFileId, const OUSt for (size_t i = nIndex; i < nStop; ++i) { TableTypeRef pTab = pDoc->maTables[i]; - if (pTab.get()) + if (pTab) { if (!pTab->isReferenced()) { @@ -1152,7 +1152,7 @@ void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced ) ScExternalRefCache::DocItem& rDocItem = rEntry.second; for (auto& rxTab : rDocItem.maTables) { - if (rxTab.get()) + if (rxTab) rxTab->setReferenced(true); } } @@ -1175,7 +1175,7 @@ void ScExternalRefCache::setAllCacheTableReferencedStati( bool bReferenced ) for (size_t i=0; i < nTables; ++i) { TableTypeRef & xTab = rDocItem.maTables[i]; - if (xTab.get()) + if (xTab) { xTab->setReferenced(false); rDocReferenced.maTables[i] = false; @@ -2041,7 +2041,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getRangeNameTokens( } ScExternalRefCache::TokenArrayRef pArray = maRefCache.getRangeNameTokens(nFileId, rName); - if (pArray.get()) + if (pArray) // This range name is cached. return pArray; diff --git a/sc/source/ui/miscdlgs/retypepassdlg.cxx b/sc/source/ui/miscdlgs/retypepassdlg.cxx index 6c836bb822be..f422915a26a2 100644 --- a/sc/source/ui/miscdlgs/retypepassdlg.cxx +++ b/sc/source/ui/miscdlgs/retypepassdlg.cxx @@ -100,7 +100,7 @@ void ScRetypePassDlg::SetDesiredHash(ScPasswordHash eHash) void ScRetypePassDlg::WriteNewDataToDocument(ScDocument& rDoc) const { - if (mpDocItem.get()) + if (mpDocItem) rDoc.SetDocProtection(mpDocItem.get()); size_t nTabCount = static_cast<size_t>(rDoc.GetTableCount()); @@ -141,7 +141,7 @@ void ScRetypePassDlg::PopulateDialog() void ScRetypePassDlg::SetDocData() { bool bBtnEnabled = false; - if (mpDocItem.get() && mpDocItem->isProtected()) + if (mpDocItem && mpDocItem->isProtected()) { if (mpDocItem->isPasswordEmpty()) mxTextDocStatus->set_label(maTextNotPassProtected); diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 3b3ca6b9cf0d..964ad6732f1d 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -735,7 +735,7 @@ ScUndoReplaceNote::ScUndoReplaceNote( ScDocShell& rDocShell, const ScAddress& rP mpDrawUndo( std::move(pDrawUndo) ) { OSL_ENSURE( maOldData.mxCaption || maNewData.mxCaption, "ScUndoReplaceNote::ScUndoReplaceNote - missing note captions" ); - OSL_ENSURE( !maOldData.mxInitData.get() && !maNewData.mxInitData.get(), "ScUndoReplaceNote::ScUndoReplaceNote - unexpected uninitialized note" ); + OSL_ENSURE( !maOldData.mxInitData && !maNewData.mxInitData, "ScUndoReplaceNote::ScUndoReplaceNote - unexpected uninitialized note" ); maOldData.mxCaption.setNotOwner(); maNewData.mxCaption.setNotOwner(); } diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index a71e8bb2e351..25bd94957236 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -100,7 +100,7 @@ void ScFormulaParserObj::SetCompilerFlags( ScCompiler& rCompiler ) const // If mxOpCodeMap is not empty it overrides mbEnglish, and vice versa. We // don't need to initialize things twice. - if (mxOpCodeMap.get()) + if (mxOpCodeMap) rCompiler.SetFormulaLanguage( mxOpCodeMap ); else { @@ -195,7 +195,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( // Need to recreate the symbol map to change English property // because the map is const. So for performance reasons set // CompileEnglish _before_ OpCodeMap! - if (mxOpCodeMap.get() && mbEnglish != bOldEnglish) + if (mxOpCodeMap && mbEnglish != bOldEnglish) { ScDocument& rDoc = mpDocShell->GetDocument(); ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar()); |