diff options
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/app/swmodule.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/gloshdl.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/misc/glosdoc.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/drawsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 41 |
10 files changed, 49 insertions, 58 deletions
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index fc112a080bff..714b20cac102 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -154,9 +154,9 @@ bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium, Reader *const pRead = StartConvertFrom(rMedium, &pReader, nullptr, &aPam); if (!pRead) return false; - sal_uLong const nError = pReader->Read(*pRead); + ErrCode const nError = pReader->Read(*pRead); delete pReader; - return 0 == nError; + return ERRCODE_NONE == nError; } // Prepare loading @@ -255,7 +255,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) // Restore the pool default if reading a saved document. m_pDoc->RemoveAllFormatLanguageDependencies(); - sal_uLong nErr = pRdr->Read( *pRead ); + ErrCode nErr = pRdr->Read( *pRead ); // Maybe put away one old Doc if (m_pDoc != pRdr->GetDoc()) @@ -277,7 +277,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) SW_MOD()->SetEmbeddedLoadSave( false ); SetError(nErr); - bool bOk = !IsError( nErr ); + bool bOk = !nErr.IsError(); if (bOk && !m_pDoc->IsInLoadAsynchron()) { @@ -307,13 +307,13 @@ bool SwDocShell::Save() m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); } - sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; if( SfxObjectShell::Save() ) { switch( GetCreateMode() ) { case SfxObjectCreateMode::INTERNAL: - nErr = 0; + nErr = ERRCODE_NONE; break; case SfxObjectCreateMode::ORGANIZER: @@ -374,7 +374,7 @@ bool SwDocShell::Save() { pFrame->GetBindings().SetState(SfxBoolItem(SID_DOC_MODIFIED, false)); } - return !IsError( nErr ); + return !nErr.IsError(); } // Save using the Defaultformat @@ -446,7 +446,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); } - sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage(); if( SfxObjectShell::SaveAs( rMedium ) ) { @@ -514,7 +514,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) } SetError(nErr ? nErr : nVBWarning); - return !IsError( nErr ); + return !nErr.IsError(); } // Save all Formats @@ -552,7 +552,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) m_pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin(); } - sal_uLong nVBWarning = 0; + ErrCode nVBWarning = ERRCODE_NONE; if (m_pDoc->ContainsMSVBasic()) { @@ -711,7 +711,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) SfxObjectCreateMode::EMBEDDED == GetCreateMode()); // Span Context in order to suppress the Selection's View - sal_uLong nErrno; + ErrCode nErrno; const OUString aFileName( rMedium.GetName() ); // No View, so the whole Document! @@ -741,7 +741,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if( pSrcView ) { pSrcView->SaveContentTo(rMedium); - nErrno = 0; + nErrno = ERRCODE_NONE; } else { @@ -755,7 +755,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if( !rMedium.IsStorage() ) rMedium.CloseOutStream(); - return !IsError( nErrno ); + return ! nErrno.IsError(); } // Hands off diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index ad675dfd9b0c..89bf88550bd3 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -715,7 +715,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pStrm->SetBufferSize( 16348 ); SwWriter aWrt( *pStrm, *pSmryDoc ); ErrCode eErr = aWrt.Write( xWrt ); - if( !ERRCODE_TOERROR( eErr ) ) + if( !eErr.IgnoreWarning() ) { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); @@ -776,7 +776,7 @@ void SwDocShell::Execute(SfxRequest& rReq) SwWriter aWrt( *pStrm, *GetDoc() ); ErrCode eErr = aWrt.Write( xWrt ); EnableSetModified( bEnable ); - if( !ERRCODE_TOERROR( eErr ) ) + if( !eErr.IgnoreWarning() ) { pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->WriteChar( '\0' ); @@ -1434,10 +1434,10 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie m_pDoc->getIDocumentState().ResetModified(); } -sal_uLong SwDocShell::LoadStylesFromFile( const OUString& rURL, +ErrCode SwDocShell::LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, bool bUnoCall ) { - sal_uLong nErr = 0; + ErrCode nErr = ERRCODE_NONE; // Set filter: SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index a670ff8eb7a0..4419abf03cf2 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -522,7 +522,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) } SwWait aWait( *this, true ); - sal_uInt32 nErr = ERR_SWG_READ_ERROR; + ErrCode nErr = ERR_SWG_READ_ERROR; switch( GetCreateMode() ) { case SfxObjectCreateMode::ORGANIZER: @@ -582,7 +582,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) InitDrawModelAndDocShell(this, m_pDoc ? m_pDoc->getIDocumentDrawModelAccess().GetDrawModel() : nullptr); SetError(nErr); - bRet = !IsError( nErr ); + bRet = !nErr.IsError(); if (bRet && !m_pDoc->IsInLoadAsynchron() && GetCreateMode() == SfxObjectCreateMode::STANDARD) @@ -606,7 +606,7 @@ bool SwDocShell::LoadFrom( SfxMedium& rMedium ) AddLink(); // set Link and update Data!! do { // middle check loop - sal_uInt32 nErr = ERR_SWG_READ_ERROR; + ErrCode nErr = ERR_SWG_READ_ERROR; OUString aStreamName = "styles.xml"; uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY ); if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) @@ -631,7 +631,7 @@ bool SwDocShell::LoadFrom( SfxMedium& rMedium ) } SetError(nErr); - bRet = !IsError( nErr ); + bRet = !nErr.IsError(); } while( false ); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 9b5c6f6debb5..e9b4cb53b571 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -170,8 +170,8 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, pSwResMgr = GetResMgr(); SvxErrorHandler::ensure(); m_pErrorHandler = new SfxErrorHandler( RID_SW_ERRHDL, - ERRCODE_AREA_SW, - ERRCODE_AREA_SW_END, + ErrCode(ERRCODE_AREA_SW), + ErrCode(ERRCODE_AREA_SW_END), pSwResMgr ); m_pModuleConfig = new SwModuleOptions; diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 78293eca2a4d..0d024d7f02ec 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -222,11 +222,11 @@ bool SwGlossaryHdl::CopyOrMove( const OUString& rSourceGroupName, OUString& rSou //The index must be determined here because rSourceShortName maybe changed in CopyBlock sal_uInt16 nDeleteIdx = pSourceGroup->GetIndex( rSourceShortName ); OSL_ENSURE(USHRT_MAX != nDeleteIdx, "entry not found"); - sal_uLong nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName ); + ErrCode nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName ); if(!nRet && bMove) { // the index must be existing - nRet = pSourceGroup->Delete( nDeleteIdx ) ? 0 : 1; + nRet = pSourceGroup->Delete( nDeleteIdx ) ? ERRCODE_NONE : ErrCode(1); } delete pSourceGroup; delete pDestGroup; @@ -643,7 +643,7 @@ bool SwGlossaryHdl::Rename(const OUString& rOldShort, const OUString& rNewShortN (nOldIdx == USHRT_MAX || nOldIdx == nIdx )) { pGlossary->Rename( nIdx, &rNewShortName, &rNewName ); - bRet = pGlossary->GetError() == 0; + bRet = pGlossary->GetError() == ERRCODE_NONE; } if( !pCurGrp ) delete pGlossary; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 94d9bb8296d2..8b1033b76bf3 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -751,7 +751,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream, #endif SwWriter aWrt( *xStream, *pDoc ); - if( !IsError( aWrt.Write( xWrt )) ) + if( ! aWrt.Write( xWrt ).IsError() ) { xStream->WriteChar( '\0' ); // terminate with a zero xStream->Commit(); @@ -1684,7 +1684,7 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, const SwPosition& rInsPos = *rSh.GetCursor()->Start(); SwReader aReader( *pStream, aEmptyOUStr, OUString(), *rSh.GetCursor() ); rSh.SaveTableBoxContent( &rInsPos ); - if( IsError( aReader.Read( *pRead )) ) + if( aReader.Read( *pRead ).IsError() ) nResId = STR_ERROR_CLPBRD_READ; else { @@ -1776,7 +1776,7 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { SwPaM &rPAM = *rSh.GetCursor(); SwReader aReader( xStore, aEmptyOUStr, rPAM ); - if( !IsError( aReader.Read( *pRead )) ) + if( ! aReader.Read( *pRead ).IsError() ) bRet = true; else if( bMsg ) ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_ERROR_CLPBRD_READ), VclMessageType::Info)->Execute(); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index cc7fe903235d..53ea0b2e932a 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -293,7 +293,7 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const OUString &rName, bool bCreate ) co if( pTmp->GetError() ) { ErrorHandler::HandleError( pTmp->GetError() ); - bOk = !IsError( pTmp->GetError() ); + bOk = ! pTmp->GetError().IsError(); } if( bOk && pTmp->GetName().isEmpty() ) @@ -419,7 +419,7 @@ void SwGlossaries::UpdateGlosPath(bool bFull) void SwGlossaries::ShowError() { - sal_uInt32 nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR, + ErrCode nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR, lcl_makePath(m_aInvalidPaths), DialogMask::ButtonsOk ); ErrorHandler::HandleError( nPathError ); } diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 350181edf917..8a9b33502201 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -129,7 +129,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject) if(ERRCODE_NONE == aDlg.Execute()) { Graphic aGraphic; - int nError(aDlg.GetGraphic(aGraphic)); + ErrCode nError = aDlg.GetGraphic(aGraphic); if(ERRCODE_NONE == nError) { diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index afbf0cf24e29..0dd88e045083 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -825,7 +825,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) const OUString sWriteName = pDocShell->HasName() ? pMedium->GetName() : sFileURL; - sal_uLong nRes = aWriter.Write(xWriter, &sWriteName); + ErrCode nRes = aWriter.Write(xWriter, &sWriteName); if(nRes) { ErrorHandler::HandleError(ErrCode(nRes)); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 1fc001e2830d..2250d4985c2d 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -468,27 +468,18 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) } sal_uInt32 nResId(0); - switch( nError ) - { - case ERRCODE_GRFILTER_OPENERROR: - nResId = STR_GRFILTER_OPENERROR; - break; - case ERRCODE_GRFILTER_IOERROR: - nResId = STR_GRFILTER_IOERROR; - break; - case ERRCODE_GRFILTER_FORMATERROR: - nResId = STR_GRFILTER_FORMATERROR; - break; - case ERRCODE_GRFILTER_VERSIONERROR: - nResId = STR_GRFILTER_VERSIONERROR; - break; - case ERRCODE_GRFILTER_FILTERERROR: - nResId = STR_GRFILTER_FILTERERROR; - break; - case ERRCODE_GRFILTER_TOOBIG: - nResId = STR_GRFILTER_TOOBIG; - break; - } + if( nError == ERRCODE_GRFILTER_OPENERROR ) + nResId = STR_GRFILTER_OPENERROR; + else if( nError == ERRCODE_GRFILTER_IOERROR ) + nResId = STR_GRFILTER_IOERROR; + else if( nError ==ERRCODE_GRFILTER_FORMATERROR ) + nResId = STR_GRFILTER_FORMATERROR; + else if( nError ==ERRCODE_GRFILTER_VERSIONERROR ) + nResId = STR_GRFILTER_VERSIONERROR; + else if( nError ==ERRCODE_GRFILTER_FILTERERROR ) + nResId = STR_GRFILTER_FILTERERROR; + else if( nError ==ERRCODE_GRFILTER_TOOBIG ) + nResId = STR_GRFILTER_TOOBIG; rSh.EndAction(); rSh.UnlockPaint(); @@ -2156,7 +2147,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SfxObjectShellRef aRef( pDocSh ); - sal_uInt32 nError = SfxObjectShell::HandleFilter( pMedium, pDocSh ); + ErrCode nError = SfxObjectShell::HandleFilter( pMedium, pDocSh ); // #i16722# aborted? if(nError != ERRCODE_NONE) { @@ -2176,7 +2167,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SwDoc *pDoc = pDocSh->GetDoc(); if( pRead && pDocSh->GetDoc() ) nUndoCheck = lcl_PageDescWithHeader( *pDoc ); - sal_uLong nErrno; + ErrCode nErrno; { //Scope for SwWait-Object, to be able to execute slots //outside this scope. SwWait aWait( *GetDocShell(), true ); @@ -2195,7 +2186,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SwXTextRange::CreateXTextRange(*pDoc, *m_pWrtShell->GetCursor()->GetPoint(), nullptr)); nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition) - ? 0 : ERR_SWG_READ_ERROR; + ? ERRCODE_NONE : ERR_SWG_READ_ERROR; } } @@ -2221,7 +2212,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe if( nErrno ) { ErrorHandler::HandleError( nErrno ); - nFound = IsError( nErrno ) ? -1 : 0; + nFound = nErrno.IsError() ? -1 : 0; } else nFound = 0; |