From 528632660b72b105345945c13c5b68060d94a91b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 Feb 2017 08:52:13 +0200 Subject: convert ErrCode to strong typedef would have preferred to re-use o3tl::strong_int, of which this is a modified copy, but there are lots of convenience accessors which are nice to define on the class. Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a Reviewed-on: https://gerrit.libreoffice.org/38497 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/inc/docsh.hxx | 4 +- sw/inc/shellio.hxx | 38 ++++++++--------- sw/inc/swerror.h | 70 ++++++++++++++------------------ sw/qa/extras/uiwriter/uiwriter.cxx | 12 +++--- sw/source/core/doc/swserv.cxx | 2 +- sw/source/core/docnode/section.cxx | 2 +- sw/source/core/edit/edglss.cxx | 2 +- sw/source/core/inc/SwXMLBlockExport.hxx | 4 +- sw/source/core/inc/SwXMLTextBlocks.hxx | 32 +++++++-------- sw/source/core/inc/swblocks.hxx | 24 +++++------ sw/source/core/sw3io/swacorr.cxx | 12 +++--- sw/source/core/swg/SwXMLBlockExport.cxx | 2 +- sw/source/core/swg/SwXMLTextBlocks.cxx | 52 ++++++++++++------------ sw/source/core/swg/SwXMLTextBlocks1.cxx | 28 ++++++------- sw/source/core/swg/swblocks.cxx | 30 +++++++------- sw/source/core/unocore/unocrsrhelper.cxx | 2 +- sw/source/core/unocore/unoobj.cxx | 2 +- sw/source/core/unocore/unostyle.cxx | 2 +- sw/source/filter/ascii/parasc.cxx | 16 ++++---- sw/source/filter/ascii/wrtasc.cxx | 2 +- sw/source/filter/ascii/wrtasc.hxx | 2 +- sw/source/filter/basflt/fltini.cxx | 16 ++++---- sw/source/filter/basflt/shellio.cxx | 12 +++--- sw/source/filter/docx/swdocxreader.cxx | 2 +- sw/source/filter/docx/swdocxreader.hxx | 2 +- sw/source/filter/html/css1atr.cxx | 2 +- sw/source/filter/html/htmlflywriter.cxx | 12 +++--- sw/source/filter/html/htmlplug.cxx | 4 +- sw/source/filter/html/swhtml.cxx | 4 +- sw/source/filter/html/wrthtml.cxx | 4 +- sw/source/filter/html/wrthtml.hxx | 4 +- sw/source/filter/inc/fltini.hxx | 4 +- sw/source/filter/rtf/swparrtf.cxx | 6 +-- sw/source/filter/writer/writer.cxx | 22 +++++----- sw/source/filter/ww8/rtfexport.cxx | 6 +-- sw/source/filter/ww8/rtfexportfilter.hxx | 4 +- sw/source/filter/ww8/wrtww8.cxx | 18 ++++---- sw/source/filter/ww8/wrtww8.hxx | 6 +-- sw/source/filter/ww8/ww8par.cxx | 34 ++++++++-------- sw/source/filter/ww8/ww8par.hxx | 12 +++--- sw/source/filter/ww8/ww8scan.cxx | 4 +- sw/source/filter/ww8/ww8scan.hxx | 4 +- sw/source/filter/xml/swxml.cxx | 20 ++++----- sw/source/filter/xml/wrtxml.cxx | 10 ++--- sw/source/filter/xml/wrtxml.hxx | 8 ++-- sw/source/filter/xml/xmlexp.cxx | 4 +- sw/source/filter/xml/xmlexp.hxx | 2 +- sw/source/ui/app/error.src | 2 +- sw/source/ui/dbui/mmresultdialogs.cxx | 8 ++-- sw/source/uibase/app/docsh.cxx | 26 ++++++------ sw/source/uibase/app/docsh2.cxx | 8 ++-- sw/source/uibase/app/docshini.cxx | 8 ++-- sw/source/uibase/app/swmodule.cxx | 4 +- sw/source/uibase/dochdl/gloshdl.cxx | 6 +-- sw/source/uibase/dochdl/swdtflvr.cxx | 6 +-- sw/source/uibase/misc/glosdoc.cxx | 4 +- sw/source/uibase/shells/drawsh.cxx | 2 +- sw/source/uibase/uiview/srcview.cxx | 2 +- sw/source/uibase/uiview/view2.cxx | 41 ++++++++----------- 59 files changed, 332 insertions(+), 351 deletions(-) (limited to 'sw') diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 801ef8324840..60b25f9c2918 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -277,8 +277,8 @@ public: void ToggleLayoutMode(SwView* pView); - sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, - bool bUnoCall ); + ErrCode LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, + bool bUnoCall ); void InvalidateModel(); void ReactivateModel(); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index a84c73c568fd..0a48eabafb61 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -162,7 +162,7 @@ public: SwReader( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFilename, SwPaM& ); // The only export interface is SwReader::Read(...)!!! - sal_uLong Read( const Reader& ); + ErrCode Read( const Reader& ); // Ask for glossaries. bool HasGlossaries( const Reader& ); @@ -257,7 +257,7 @@ public: void setSotStorageRef(const tools::SvRef& pStgRef) { pStg = pStgRef; }; private: - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; // Everyone who does not need the streams / storages open // has to override the method (W4W!!). @@ -267,7 +267,7 @@ private: class AsciiReader: public Reader { friend class SwReader; - virtual sal_uLong Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; public: AsciiReader(): Reader() {} }; @@ -290,7 +290,7 @@ class SwImpBlocks; class SW_DLLPUBLIC SwTextBlocks { std::unique_ptr pImp; - sal_uLong nErr; + ErrCode nErr; public: SwTextBlocks( const OUString& ); @@ -300,7 +300,7 @@ public: void ClearDoc(); // Delete Doc-contents. OUString GetName(); void SetName( const OUString& ); - sal_uLong GetError() const { return nErr; } + ErrCode GetError() const { return nErr; } OUString GetBaseURL() const; void SetBaseURL( const OUString& rURL ); @@ -315,7 +315,7 @@ public: bool Delete( sal_uInt16 ); void Rename( sal_uInt16, const OUString*, const OUString* ); - sal_uLong CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, + ErrCode CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, const OUString& rLong ); bool BeginGetDoc( sal_uInt16 ); // Read text modules. @@ -379,7 +379,7 @@ protected: void PutNumFormatFontsInAttrPool(); void PutEditEngFontsInAttrPool(); - virtual sal_uLong WriteStream() = 0; + virtual ErrCode WriteStream() = 0; void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } IDocumentSettingAccess& getIDocumentSettingAccess(); @@ -407,10 +407,10 @@ public: Writer(); virtual ~Writer() override; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ); - sal_uLong Write( SwPaM&, SvStream&, const OUString* ); - virtual sal_uLong Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ); - virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* ); + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ); + ErrCode Write( SwPaM&, SvStream&, const OUString* ); + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ); + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ); virtual void SetupFilterOptions(SfxMedium& rMedium); @@ -464,9 +464,9 @@ protected: css::uno::Reference < css::embed::XStorage > xStg; // Create error at call. - virtual sal_uLong WriteStream() override; - virtual sal_uLong WriteStorage() = 0; - virtual sal_uLong WriteMedium( SfxMedium& ) = 0; + virtual ErrCode WriteStream() override; + virtual ErrCode WriteStorage() = 0; + virtual ErrCode WriteMedium( SfxMedium& ) = 0; using Writer::Write; @@ -475,8 +475,8 @@ public: virtual bool IsStgWriter() const override; - virtual sal_uLong Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override; - virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override; + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ) override; SotStorage& GetStorage() const { return *pStg; } }; @@ -497,7 +497,7 @@ class SW_DLLPUBLIC SwWriter bool bWriteAll; public: - sal_uLong Write( WriterRef& rxWriter, const OUString* = nullptr); + ErrCode Write( WriterRef& rxWriter, const OUString* = nullptr); SwWriter( SvStream&, SwCursorShell &, bool bWriteAll = false ); SwWriter( SvStream&, SwDoc & ); @@ -511,8 +511,8 @@ public: typedef Reader* (*FnGetReader)(); typedef void (*FnGetWriter)(const OUString&, const OUString& rBaseURL, WriterRef&); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& ); -sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); +ErrCode SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& ); +ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); struct SwReaderWriterEntry { diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h index a49663312051..4ecd4ac21f56 100644 --- a/sw/inc/swerror.h +++ b/sw/inc/swerror.h @@ -22,9 +22,8 @@ #include -#define ERROR_SW_BASE (ERRCODE_AREA_SW) -#define ERROR_SW_READ_BASE (ERROR_SW_BASE | ERRCODE_CLASS_READ) -#define ERROR_SW_WRITE_BASE (ERROR_SW_BASE | ERRCODE_CLASS_WRITE) +#define ERROR_SW_READ_BASE (ERRCODE_AREA_SW | ERRCODE_CLASS_READ) +#define ERROR_SW_WRITE_BASE (ERRCODE_AREA_SW | ERRCODE_CLASS_WRITE) #define WARN_SW_BASE (ERRCODE_AREA_SW | ERRCODE_WARNING_MASK) #define WARN_SW_READ_BASE (WARN_SW_BASE | ERRCODE_CLASS_READ ) @@ -32,65 +31,56 @@ // Import Errors -#define ERR_SWG_FILE_FORMAT_ERROR (ERROR_SW_READ_BASE | 1 ) -#define ERR_SWG_READ_ERROR (ERROR_SW_READ_BASE | 2 ) +#define ERR_SWG_FILE_FORMAT_ERROR ErrCode(ERROR_SW_READ_BASE | 1 ) +#define ERR_SWG_READ_ERROR ErrCode(ERROR_SW_READ_BASE | 2 ) -#define ERR_SW6_INPUT_FILE (ERROR_SW_READ_BASE | 4 ) -#define ERR_SW6_NOWRITER_FILE (ERROR_SW_READ_BASE | 5 ) -#define ERR_SW6_UNEXPECTED_EOF (ERROR_SW_READ_BASE | 6 ) -#define ERR_SW6_PASSWD (ERROR_SW_READ_BASE | 7 ) +#define ERR_SW6_INPUT_FILE ErrCode(ERROR_SW_READ_BASE | 4 ) +#define ERR_SW6_NOWRITER_FILE ErrCode(ERROR_SW_READ_BASE | 5 ) +#define ERR_SW6_UNEXPECTED_EOF ErrCode(ERROR_SW_READ_BASE | 6 ) +#define ERR_SW6_PASSWD ErrCode(ERROR_SW_READ_BASE | 7 ) -#define ERR_WW6_NO_WW6_FILE_ERR (ERROR_SW_READ_BASE | 8 ) -#define ERR_WW6_FASTSAVE_ERR (ERROR_SW_READ_BASE | 9 ) +#define ERR_WW6_NO_WW6_FILE_ERR ErrCode(ERROR_SW_READ_BASE | 8 ) +#define ERR_WW6_FASTSAVE_ERR ErrCode(ERROR_SW_READ_BASE | 9 ) -#define ERR_FORMAT_ROWCOL (ERROR_SW_READ_BASE | 12) +#define ERR_FORMAT_ROWCOL ErrCode(ERROR_SW_READ_BASE | 12) -#define ERR_SWG_NEW_VERSION (ERROR_SW_READ_BASE | 13) -#define ERR_WW8_NO_WW8_FILE_ERR (ERROR_SW_READ_BASE | 14) +#define ERR_SWG_NEW_VERSION ErrCode(ERROR_SW_READ_BASE | 13) +#define ERR_WW8_NO_WW8_FILE_ERR ErrCode(ERROR_SW_READ_BASE | 14) -#define ERR_FORMAT_FILE_ROWCOL (ERROR_SW_READ_BASE | 15) +#define ERR_FORMAT_FILE_ROWCOL ErrCode(ERROR_SW_READ_BASE | 15) // Export errors -#define ERR_SWG_WRITE_ERROR (ERROR_SW_WRITE_BASE | 30 ) -#define ERR_SWG_OLD_GLOSSARY (ERROR_SW_WRITE_BASE | 31 ) -#define ERR_WRITE_ERROR_FILE (ERROR_SW_WRITE_BASE | 35 ) +#define ERR_SWG_WRITE_ERROR ErrCode(ERROR_SW_WRITE_BASE | 30 ) +#define ERR_SWG_OLD_GLOSSARY ErrCode(ERROR_SW_WRITE_BASE | 31 ) +#define ERR_WRITE_ERROR_FILE ErrCode(ERROR_SW_WRITE_BASE | 35 ) // Import/Export errors -#define ERR_SWG_INTERNAL_ERROR (ERROR_SW_BASE | 50 ) +#define ERR_SWG_INTERNAL_ERROR ErrCode(ERRCODE_AREA_SW | 50 ) -#define ERR_TXTBLOCK_NEWFILE_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_LOCKING | 55 ) +#define ERR_TXTBLOCK_NEWFILE_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_LOCKING | 55 ) // other errors and errorclasses -#define ERR_AUTOPATH_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_PATH | 55 ) -#define ERR_TBLSPLIT_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 56 ) -#define ERR_TBLINSCOL_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 57 ) -#define ERR_TBLDDECHG_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 58 ) +#define ERR_AUTOPATH_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_PATH | 55 ) +#define ERR_TBLSPLIT_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 56 ) +#define ERR_TBLINSCOL_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 57 ) +#define ERR_TBLDDECHG_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 58 ) // Import - Warnings -#define WARN_SWG_NO_DRAWINGS (WARN_SW_READ_BASE | 70 ) -#define WARN_WW6_FASTSAVE_ERR (WARN_SW_READ_BASE | 71 ) +#define WARN_SWG_NO_DRAWINGS ErrCode(WARN_SW_READ_BASE | 70 ) +#define WARN_WW6_FASTSAVE_ERR ErrCode(WARN_SW_READ_BASE | 71 ) // continued below // Import & Export - Warnings -#define WARN_SWG_FEATURES_LOST (WARN_SW_BASE | 72 ) -#define WARN_SWG_OLE (WARN_SW_BASE | 73 ) +#define WARN_SWG_FEATURES_LOST ErrCode(WARN_SW_BASE | 72 ) +#define WARN_SWG_OLE ErrCode(WARN_SW_BASE | 73 ) #define WARN_SWG_POOR_LOAD (WARN_SW_BASE | 74 ) // Export warnings -#define WARN_SWG_HTML_NO_MACROS (WARN_SW_WRITE_BASE |75) -#define WARN_WRITE_ERROR_FILE (WARN_SW_WRITE_BASE |76) +#define WARN_SWG_HTML_NO_MACROS ErrCode(WARN_SW_WRITE_BASE |75) +#define WARN_WRITE_ERROR_FILE ErrCode(WARN_SW_WRITE_BASE |76) // More Import & Export - Warnings -#define WARN_FORMAT_FILE_ROWCOL (WARN_SW_READ_BASE | 77) - -#ifndef __RSC - -inline bool IsError( sal_uLong nErr ) -{ - return nErr && 0 == ( ERRCODE_WARNING_MASK & nErr ); -} - -#endif +#define WARN_FORMAT_FILE_ROWCOL ErrCode(WARN_SW_READ_BASE | 77) #endif diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 4654c2b0d968..0bd0ba789c19 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -749,7 +749,7 @@ void SwUiWriterTest::testImportRTF() SwReader aReader(aStream, OUString(), OUString(), *pWrtShell->GetCursor()); Reader* pRTFReader = SwReaderWriter::GetRtfReader(); CPPUNIT_ASSERT(pRTFReader != nullptr); - CPPUNIT_ASSERT_EQUAL(sal_uLong(0), aReader.Read(*pRTFReader)); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, aReader.Read(*pRTFReader)); sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString("fooHello world!"), pDoc->GetNodes()[nIndex - 1]->GetTextNode()->GetText()); @@ -1992,7 +1992,7 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher("com.sun.star.text.TextDocument"); std::shared_ptr pFilter; - sal_uInt32 filter = aMatcher.DetectFilter(aMedium, pFilter); + ErrCode filter = aMatcher.DetectFilter(aMedium, pFilter); CPPUNIT_ASSERT_EQUAL(ERRCODE_IO_ABORT, filter); //it should not return any Filter CPPUNIT_ASSERT(!pFilter); @@ -2000,8 +2000,8 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium2(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher2; std::shared_ptr pFilter2; - sal_uInt32 filter2 = aMatcher2.DetectFilter(aMedium2, pFilter2); - CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter2); + ErrCode filter2 = aMatcher2.DetectFilter(aMedium2, pFilter2); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, filter2); //Filter should be returned with proper Name CPPUNIT_ASSERT_EQUAL(OUString("calc8"), pFilter2->GetFilterName()); //testing with service type and any .odt file @@ -2009,8 +2009,8 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium3(path2, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher3("com.sun.star.text.TextDocument"); std::shared_ptr pFilter3; - sal_uInt32 filter3 = aMatcher3.DetectFilter(aMedium3, pFilter3); - CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter3); + ErrCode filter3 = aMatcher3.DetectFilter(aMedium3, pFilter3); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, filter3); //Filter should be returned with proper Name CPPUNIT_ASSERT_EQUAL(OUString("writer8"), pFilter3->GetFilterName()); } diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 9c7432dbebaa..f18d00453a65 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -92,7 +92,7 @@ bool SwServerObject::GetData( uno::Any & rData, // Create stream SvMemoryStream aMemStm( 65535, 65535 ); SwWriter aWrt( aMemStm, *pPam, false ); - if( !IsError( aWrt.Write( xWrt )) ) + if( !aWrt.Write( xWrt ).IsError() ) { aMemStm.WriteChar( '\0' ); // append a zero char rData <<= uno::Sequence< sal_Int8 >( diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 79e181f6770f..b074a6a38bf1 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1408,7 +1408,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) // TODO/MBA: it's impossible to set a BaseURL here! SwReader aTmpReader( aStrm, OUString(), pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam ); - if( !IsError( aTmpReader.Read( *pRead ) )) + if( ! aTmpReader.Read( *pRead ).IsError() ) { rSection.SetConnectFlag(); } diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 3dd2d8cfaca0..7c49f728d3d6 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -305,7 +305,7 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk ) xWrt->SetAsciiOptions( aAsciiOpt ); xWrt->bUCS2_WithStartChar = false; - if (!IsError(aWriter.Write(xWrt))) + if ( ! aWriter.Write(xWrt).IsError() ) { aStream.WriteUInt16( '\0' ); diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx index 5d7f8a1ab0c6..7e9e74a17736 100644 --- a/sw/source/core/inc/SwXMLBlockExport.hxx +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -36,7 +36,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} @@ -54,7 +54,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) override {return 0;} + ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) override { return ERRCODE_NONE; } void exportDoc(const OUString & rText); void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 67e571142e05..e4305c071c20 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -59,41 +59,41 @@ public: virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) override; static OUString GeneratePackageName ( const OUString& rShort ); virtual ~SwXMLTextBlocks() override; - virtual sal_uLong Delete( sal_uInt16 ) override; - virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) override; - virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) override; + virtual ErrCode Delete( sal_uInt16 ) override; + virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) override; + virtual ErrCode CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) override; virtual void ClearDoc() override; - virtual sal_uLong GetDoc( sal_uInt16 ) override; - virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) override; - virtual sal_uLong PutDoc() override; - virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) override; - virtual sal_uLong MakeBlockList() override; + virtual ErrCode GetDoc( sal_uInt16 ) override; + virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) override; + virtual ErrCode PutDoc() override; + virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) override; + virtual ErrCode MakeBlockList() override; virtual FileType GetFileType() const override; - virtual sal_uLong OpenFile( bool bReadOnly = true ) override; + virtual ErrCode OpenFile( bool bReadOnly = true ) override; virtual void CloseFile() override; static bool IsFileUCBStorage( const OUString & rFileName); // Methods for the new Autocorrecter - sal_uLong GetText( const OUString& rShort, OUString& ); + ErrCode GetText( const OUString& rShort, OUString& ); virtual bool IsOnlyTextBlock( const OUString& rShort ) const override; bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; void SetIsTextOnly( const OUString& rShort, bool bNewValue ); - virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override; - virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + virtual ErrCode GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override; + virtual ErrCode SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ) override; virtual bool PutMuchEntries( bool bOn ) override; public: SwDoc* GetDoc() const { return m_pDoc; } //void SetDoc( SwDoc * pNewDoc); - sal_uLong StartPutBlock( const OUString& rShort, const OUString& rPackageName ); - sal_uLong PutBlock(); - sal_uLong GetBlockText( const OUString& rShort, OUString& rText ); - sal_uLong PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); + ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName ); + ErrCode PutBlock(); + ErrCode GetBlockText( const OUString& rShort, OUString& rText ); + ErrCode PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); void MakeBlockText( const OUString& rText ); }; diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx index a75e0bbac6fc..d0eaa4ab9670 100644 --- a/sw/source/core/inc/swblocks.hxx +++ b/sw/source/core/inc/swblocks.hxx @@ -103,22 +103,22 @@ public: const OUString& GetBaseURL() const { return m_sBaseURL;} void SetBaseURL( const OUString& rURL ) { m_sBaseURL = rURL; } - virtual sal_uLong Delete( sal_uInt16 ) = 0; - virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) = 0; - virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0; - virtual sal_uLong GetDoc( sal_uInt16 ) = 0; - virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) = 0; - virtual sal_uLong PutDoc() = 0; - virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) = 0; - virtual sal_uLong MakeBlockList() = 0; - - virtual sal_uLong OpenFile( bool bReadOnly = true ) = 0; + virtual ErrCode Delete( sal_uInt16 ) = 0; + virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) = 0; + virtual ErrCode CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0; + virtual ErrCode GetDoc( sal_uInt16 ) = 0; + virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) = 0; + virtual ErrCode PutDoc() = 0; + virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) = 0; + virtual ErrCode MakeBlockList() = 0; + + virtual ErrCode OpenFile( bool bReadOnly = true ) = 0; virtual void CloseFile() = 0; virtual bool IsOnlyTextBlock( const OUString& rShort ) const; - virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ); - virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + virtual ErrCode GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ); + virtual ErrCode SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ); virtual bool PutMuchEntries( bool bOn ); }; diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx index 7299193b1800..6f90feee716d 100644 --- a/sw/source/core/sw3io/swacorr.cxx +++ b/sw/source/core/sw3io/swacorr.cxx @@ -36,10 +36,10 @@ using namespace ::com::sun::star; */ bool SwAutoCorrect::GetLongText( const OUString& rShort, OUString& rLong ) { - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; assert( m_pTextBlocks ); nRet = m_pTextBlocks->GetText( rShort, rLong ); - return !IsError( nRet ) && !rLong.isEmpty(); + return !nRet.IsError() && !rLong.isEmpty(); } void SwAutoCorrect::refreshBlockList( const uno::Reference< embed::XStorage >& rStg ) @@ -69,22 +69,22 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >& rStg, return false; SwDocShell& rDShell = static_cast(rObjSh); - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; // mba: relative URLs don't make sense here SwXMLTextBlocks aBlk( rStg, rFileName ); SwDoc* pDoc = aBlk.GetDoc(); nRet = aBlk.BeginPutDoc( rShort, rShort ); - if( !IsError( nRet ) ) + if( ! nRet.IsError() ) { rDShell.GetEditShell()->CopySelToDoc( pDoc ); nRet = aBlk.PutDoc(); aBlk.AddName ( rShort, rShort ); - if( !IsError( nRet ) ) + if( ! nRet.IsError() ) nRet = aBlk.GetText( rShort, rLong ); } - return !IsError( nRet ); + return ! nRet.IsError(); } SwAutoCorrect::SwAutoCorrect( const SvxAutoCorrect& rACorr ) diff --git a/sw/source/core/swg/SwXMLBlockExport.cxx b/sw/source/core/swg/SwXMLBlockExport.cxx index 6e62df74ff55..43dc87b634a9 100644 --- a/sw/source/core/swg/SwXMLBlockExport.cxx +++ b/sw/source/core/swg/SwXMLBlockExport.cxx @@ -39,7 +39,7 @@ SwXMLBlockListExport::SwXMLBlockListExport( XML_NAMESPACE_BLOCKLIST ); } -sal_uInt32 SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) +ErrCode SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) { GetDocHandler()->startDocument(); diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 231fe15e9ded..500a3eac3c8b 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -161,7 +161,7 @@ void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, m_bInfoChanged = true; } -sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) +ErrCode SwXMLTextBlocks::Delete( sal_uInt16 n ) { const OUString aPckName (m_aNames[n]->aPackageName); uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); @@ -174,21 +174,21 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY ); if ( xTrans.is() ) xTrans->commit(); - return 0; + return ERRCODE_NONE; } catch (const uno::Exception&) { return ERR_SWG_WRITE_ERROR; } } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, const OUString& ) +ErrCode SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, const OUString& ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) - return 0; + return ERRCODE_NONE; OUString aOldName (m_aNames[nIdx]->aPackageName); m_aShort = rNewShort; aPackageName = GeneratePackageName( m_aShort ); @@ -230,13 +230,13 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, c xTrans->commit(); // No need to commit xBlkRoot here as SwTextBlocks::Rename calls // WriteInfo which does the commit - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, +ErrCode SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, const OUString& rLong) { - sal_uLong nError = 0; + ErrCode nError = ERRCODE_NONE; OpenFile(); rDestImp.OpenFile(false); const OUString aGroup( rShort ); @@ -285,11 +285,11 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, return nError; } -sal_uLong SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName ) +ErrCode SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) - return 0; + return ERRCODE_NONE; GetIndex ( rShort ); try { @@ -303,10 +303,10 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString catch (const uno::Exception&) { } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong ) +ErrCode SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong ) { // Store in base class m_aShort = rShort; @@ -316,9 +316,9 @@ sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& return StartPutBlock (rShort, aPackageName); } -sal_uLong SwXMLTextBlocks::PutBlock() +ErrCode SwXMLTextBlocks::PutBlock() { - sal_uLong nRes = 0; // dead variable, this always returns 0 + ErrCode nRes = ERRCODE_NONE; // dead variable, this always returns 0 SwXmlFlags nCommitFlags = nFlags; WriterRef xWrt; @@ -389,26 +389,26 @@ sal_uLong SwXMLTextBlocks::PutBlock() } //TODO/LATER: error handling - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::PutDoc() +ErrCode SwXMLTextBlocks::PutDoc() { SwPaM* pPaM = MakePaM(); - sal_uLong nErr = PutBlock(); + ErrCode nErr = PutBlock(); delete pPaM; return nErr; } -sal_uLong SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) { return GetBlockText( rShort, rText ); } -sal_uLong SwXMLTextBlocks::MakeBlockList() +ErrCode SwXMLTextBlocks::MakeBlockList() { WriteInfo(); - return 0; + return ERRCODE_NONE; } bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) @@ -422,7 +422,7 @@ bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) } else if( !IsFileChanged() ) { - bRet = 0 == OpenFile( false ); + bRet = ERRCODE_NONE == OpenFile( false ); if( bRet ) { nFlags |= SwXmlFlags::NoRootCommit; @@ -454,9 +454,9 @@ bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) return bRet; } -sal_uLong SwXMLTextBlocks::OpenFile( bool bRdOnly ) +ErrCode SwXMLTextBlocks::OpenFile( bool bRdOnly ) { - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; try { uno::Reference < embed::XStorage > refStg = comphelper::OStorageHelper::GetStorageFromURL( m_aFile, @@ -466,7 +466,7 @@ sal_uLong SwXMLTextBlocks::OpenFile( bool bRdOnly ) catch (const uno::Exception&) { //TODO/LATER: error handling - nRet = 1; + nRet = ErrCode(1); } return nRet; @@ -547,10 +547,10 @@ OUString SwXMLTextBlocks::GeneratePackageName ( const OUString& rShort ) return aBuf.makeStringAndClear(); } -sal_uLong SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, +ErrCode SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, const OUString& rText ) { - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; m_aShort = rShort; m_aLong = rName; m_aCurrentText = rText; diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 1b792cbd25b9..861de5d197d5 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -54,7 +54,7 @@ using ::xmloff::token::XML_BLOCK_LIST; using ::xmloff::token::XML_UNFORMATTED_TEXT; using ::xmloff::token::GetXMLToken; -sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) +ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) { OUString aFolderName ( GetPackageName ( nIdx ) ); @@ -145,7 +145,7 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) xRoot = nullptr; } - return 0; + return ERRCODE_NONE; } // event description for autotext events; this constant should really be @@ -157,7 +157,7 @@ const struct SvEventDescription aAutotextEvents[] = { 0, nullptr } }; -sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, +ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ) { // set current auto text @@ -165,12 +165,12 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, m_aLong = m_aNames[nIdx]->aLong; aPackageName = m_aNames[nIdx]->aPackageName; - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; // open stream in proper sub-storage CloseFile(); nRet = OpenFile(); - if ( 0 == nRet ) + if ( ERRCODE_NONE == nRet ) { try { @@ -241,7 +241,7 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, } // and finally, copy macro into table - if (0 == nRet) + if (ERRCODE_NONE == nRet) pDescriptor->copyMacrosIntoTable(rMacroTable); } else @@ -262,9 +262,9 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, return nRet; } -sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) { - sal_uLong n = 0; + ErrCode n = ERRCODE_NONE; OUString aFolderName = GeneratePackageName ( rShort ); OUString aStreamName = aFolderName + ".xml"; rText.clear(); @@ -329,7 +329,7 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText return n; } -sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, +ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ) { GetIndex ( rShort ); @@ -346,7 +346,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; try { @@ -453,7 +453,7 @@ void SwXMLTextBlocks::ReadInfo() } void SwXMLTextBlocks::WriteInfo() { - if ( xBlkRoot.is() || 0 == OpenFile ( false ) ) + if ( xBlkRoot.is() || ERRCODE_NONE == OpenFile ( false ) ) { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -500,7 +500,7 @@ void SwXMLTextBlocks::WriteInfo() } } -sal_uLong SwXMLTextBlocks::SetMacroTable( +ErrCode SwXMLTextBlocks::SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ) { @@ -510,7 +510,7 @@ sal_uLong SwXMLTextBlocks::SetMacroTable( aPackageName = m_aNames[nIdx]->aPackageName; // start XML autotext event export - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -526,7 +526,7 @@ sal_uLong SwXMLTextBlocks::SetMacroTable( CloseFile(); // close (it may be open in read-only-mode) nRes = OpenFile ( false ); - if ( 0 == nRes ) + if ( ERRCODE_NONE == nRes ) { try { diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 0c9c31675f71..dfdfd9e5232b 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -217,14 +217,14 @@ bool SwImpBlocks::IsOnlyTextBlock( const OUString& ) const return false; } -sal_uLong SwImpBlocks::GetMacroTable( sal_uInt16, SvxMacroTableDtor& ) +ErrCode SwImpBlocks::GetMacroTable( sal_uInt16, SvxMacroTableDtor& ) { - return 0; + return ERRCODE_NONE; } -sal_uLong SwImpBlocks::SetMacroTable( sal_uInt16 , const SvxMacroTableDtor& ) +ErrCode SwImpBlocks::SetMacroTable( sal_uInt16 , const SvxMacroTableDtor& ) { - return 0; + return ERRCODE_NONE; } bool SwImpBlocks::PutMuchEntries( bool ) @@ -308,7 +308,7 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == (nErr = pImp->OpenFile( false ) )) + else if( ERRCODE_NONE == (nErr = pImp->OpenFile( false ) )) { nErr = pImp->Delete( n ); if( !nErr ) @@ -324,7 +324,7 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) pImp->CloseFile(); pImp->Touch(); - return ( nErr == 0 ); + return ( nErr == ERRCODE_NONE ); } return false; } @@ -349,7 +349,7 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile( false ))) + else if( ERRCODE_NONE == ( nErr = pImp->OpenFile( false ))) { // Set the new entry in the list before we do that! aNew = GetAppCharClass().uppercase( aNew ); @@ -368,7 +368,7 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) } } -sal_uLong SwTextBlocks::CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, +ErrCode SwTextBlocks::CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, const OUString& rLong ) { bool bIsOld = false; @@ -393,7 +393,7 @@ bool SwTextBlocks::BeginGetDoc( sal_uInt16 n ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile())) + else if( ERRCODE_NONE == ( nErr = pImp->OpenFile())) { pImp->ClearDoc(); nErr = pImp->GetDoc( n ); @@ -402,7 +402,7 @@ bool SwTextBlocks::BeginGetDoc( sal_uInt16 n ) else pImp->m_nCurrentIndex = n; } - return ( nErr == 0 ); + return ( nErr == ERRCODE_NONE ); } return false; } @@ -424,7 +424,7 @@ bool SwTextBlocks::BeginPutDoc( const OUString& s, const OUString& l ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else nErr = pImp->OpenFile( false ); - bOk = 0 == nErr; + bOk = ERRCODE_NONE == nErr; } if( bOk ) { @@ -434,7 +434,7 @@ bool SwTextBlocks::BeginPutDoc( const OUString& s, const OUString& l ) if( nErr ) pImp->CloseFile(); } - return 0 == nErr; + return ERRCODE_NONE == nErr; } sal_uInt16 SwTextBlocks::PutDoc() @@ -479,7 +479,7 @@ sal_uInt16 SwTextBlocks::PutText( const OUString& rShort, const OUString& rName, nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else nErr = pImp->OpenFile( false ); - bOk = 0 == nErr; + bOk = ERRCODE_NONE == nErr; } if( bOk ) { @@ -571,7 +571,7 @@ bool SwTextBlocks::GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTabl { bool bRet = true; if ( pImp && !pImp->m_bInPutMuchBlocks ) - bRet = ( 0 == pImp->GetMacroTable( nIdx, rMacroTable ) ); + bRet = ( ERRCODE_NONE == pImp->GetMacroTable( nIdx, rMacroTable ) ); return bRet; } @@ -579,7 +579,7 @@ bool SwTextBlocks::SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMac { bool bRet = true; if ( pImp && !pImp->m_bInPutMuchBlocks ) - bRet = ( 0 == pImp->SetMacroTable( nIdx, rMacroTable ) ); + bRet = ( ERRCODE_NONE == pImp->SetMacroTable( nIdx, rMacroTable ) ); return bRet; } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 71faf3dbb0bd..91ee7438b020 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1065,7 +1065,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 ); sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex(); - sal_uInt32 nErrno = pRdr->Read( *pRead ); // and paste the document + ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document if(!nErrno) { diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index cf009a9b4d10..070d481a8878 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -187,7 +187,7 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer) const bool bOldShowProgress = xWrt->bShowProgress; xWrt->bShowProgress = false; - if( !IsError( aWriter.Write( xWrt ) ) ) + if( ! aWriter.Write( xWrt ).IsError() ) { const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode ); if (lUniLen < static_cast(SAL_MAX_INT32-1)) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 826806bea226..e9a666bd7102 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -541,7 +541,7 @@ void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL, else if(rProperty.Name == UNO_NAME_LOAD_TEXT_STYLES) aOpt.SetTextFormats(bValue); } - const sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true ); + const ErrCode nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true ); if(nErr) throw io::IOException(); } diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index e03ae3921ae0..ab5512b7976d 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -60,7 +60,7 @@ class SwASCIIParser SvtScriptType nScript; bool bNewDoc; - sal_uLong ReadChars(); + ErrCode ReadChars(); void InsertText( const OUString& rStr ); SwASCIIParser(const SwASCIIParser&) = delete; @@ -71,11 +71,11 @@ public: bool bReadNewDoc, const SwAsciiOptions& rOpts ); ~SwASCIIParser(); - sal_uLong CallParser(); + ErrCode CallParser(); }; // Call for the general reader interface -sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) +ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) { if( !pStrm ) { @@ -85,7 +85,7 @@ sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OU SwASCIIParser* pParser = new SwASCIIParser( &rDoc, rPam, *pStrm, !bInsertMode, aOpt.GetASCIIOpts() ); - sal_uLong nRet = pParser->CallParser(); + ErrCode nRet = pParser->CallParser(); delete pParser; // after Read reset the options @@ -138,7 +138,7 @@ SwASCIIParser::~SwASCIIParser() } // Calling the parser -sal_uLong SwASCIIParser::CallParser() +ErrCode SwASCIIParser::CallParser() { rInput.Seek(STREAM_SEEK_TO_END); rInput.ResetError(); @@ -169,7 +169,7 @@ sal_uLong SwASCIIParser::CallParser() pDoc->SetTextFormatColl(*pPam, pColl); } - sal_uLong nError = ReadChars(); + ErrCode nError = ReadChars(); if( pItemSet ) { @@ -249,7 +249,7 @@ sal_uLong SwASCIIParser::CallParser() return nError; } -sal_uLong SwASCIIParser::ReadChars() +ErrCode SwASCIIParser::ReadChars() { sal_Unicode *pStt = nullptr, *pEnd = nullptr, *pLastStt = nullptr; long nReadCnt = 0, nLineLen = 0; @@ -291,7 +291,7 @@ sal_uLong SwASCIIParser::ReadChars() hConverter = rtl_createTextToUnicodeConverter( currentCharSet ); OSL_ENSURE( hConverter, "no string convert available" ); if (!hConverter) - return ERROR_SW_READ_BASE; + return ErrCode(ERROR_SW_READ_BASE); bSwapUnicode = false; hContext = rtl_createTextToUnicodeContext( hConverter ); } diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 00ed3e928fbd..7a23d1970fba 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -83,7 +83,7 @@ SwASCWriter::SwASCWriter( const OUString& rFltNm ) SwASCWriter::~SwASCWriter() {} -sal_uLong SwASCWriter::WriteStream() +ErrCode SwASCWriter::WriteStream() { if( bASCII_ParaAsCR ) // If predefined m_sLineEnd = "\015"; diff --git a/sw/source/filter/ascii/wrtasc.hxx b/sw/source/filter/ascii/wrtasc.hxx index 82d2b108f498..cb0fdc191bb2 100644 --- a/sw/source/filter/ascii/wrtasc.hxx +++ b/sw/source/filter/ascii/wrtasc.hxx @@ -30,7 +30,7 @@ class SwASCWriter : public Writer { OUString m_sLineEnd; - virtual sal_uLong WriteStream() override; + virtual ErrCode WriteStream() override; public: SwASCWriter( const OUString& rFilterName ); diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index a1459c780fa3..f112ee9a77cb 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -647,8 +647,8 @@ extern "C" { Reader *ImportDOC(); void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& ); Reader *ImportDOCX(); - sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); - sal_uLong GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& ); + sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); + sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& ); } #endif @@ -725,27 +725,27 @@ Reader* GetDOCXReader() #endif } -typedef sal_uLong ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); -typedef sal_uLong ( SAL_CALL *GetSaveWarning )( SfxObjectShell& ); +typedef sal_uInt32 ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); +typedef sal_uInt32 ( SAL_CALL *GetSaveWarning )( SfxObjectShell& ); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName ) +ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName ) { #ifndef DISABLE_DYNLOADING SaveOrDel pFunction = reinterpret_cast( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); if( pFunction ) - return pFunction( rDoc, rStor, bSaveInto, rStorageName ); + return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName )); return ERRCODE_NONE; #else return SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ); #endif } -sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) +ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) { #ifndef DISABLE_DYNLOADING GetSaveWarning pFunction = reinterpret_cast( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); if( pFunction ) - return pFunction( rDocS ); + return ErrCode(pFunction( rDocS )); return ERRCODE_NONE; #else return GetSaveWarningOfMSVBAStorage_ww8( rDocS ); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 615c0d938780..3e2a3ec4393c 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -62,7 +62,7 @@ using namespace ::com::sun::star; -sal_uLong SwReader::Read( const Reader& rOptions ) +ErrCode SwReader::Read( const Reader& rOptions ) { // copy variables Reader* po = const_cast(&rOptions); @@ -83,7 +83,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) return ERR_SWG_FILE_FORMAT_ERROR; } - sal_uLong nError = 0L; + ErrCode nError = ERRCODE_NONE; GetDoc(); @@ -181,7 +181,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); - if( !IsError( nError )) // set the End position already + if( ! nError.IsError() ) // set the End position already { --aEndPos; pCNd = aEndPos.GetNode().GetContentNode(); @@ -727,7 +727,7 @@ SwWriter::SwWriter(SfxMedium& rMedium, SwDoc &rDocument) { } -sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) +ErrCode SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) { // #i73788# SwPauseThreadStarting aPauseThreadStarting; @@ -851,7 +851,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) const bool bOrigPurgeOle = pOutDoc->getIDocumentSettingAccess().get(DocumentSettingId::PURGE_OLE); pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, false); - sal_uLong nError = 0; + ErrCode nError = ERRCODE_NONE; if( pMedium ) nError = rxWriter->Write( *pPam, *pMedium, pRealFileName ); else if( pStg.is() ) @@ -884,7 +884,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) { delete pPam; // delete the created Pam // Everything was written successfully? Tell the document! - if ( !IsError( nError ) && !xDoc.is() ) + if ( !nError.IsError() && !xDoc.is() ) { rDoc.getIDocumentState().ResetModified(); // #i38810# - reset also flag, that indicates updated links diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 3f2bb22b4d26..25ee0567a95e 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -48,7 +48,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOCX() return new SwDOCXReader; } -sal_uLong SwDOCXReader::Read( SwDoc& /* rDoc */, const OUString& /* rBaseURL */, SwPaM& /* rPaM */, const OUString& /* FileName */ ) +ErrCode SwDOCXReader::Read( SwDoc& /* rDoc */, const OUString& /* rBaseURL */, SwPaM& /* rPaM */, const OUString& /* FileName */ ) { return ERR_SWG_READ_ERROR; } diff --git a/sw/source/filter/docx/swdocxreader.hxx b/sw/source/filter/docx/swdocxreader.hxx index 6c6dab0b2d1b..6418194bbdd0 100644 --- a/sw/source/filter/docx/swdocxreader.hxx +++ b/sw/source/filter/docx/swdocxreader.hxx @@ -35,7 +35,7 @@ public: virtual bool ReadGlossaries( SwTextBlocks& rBlocks, bool bSaveRelFiles ) const override; private: - virtual sal_uLong Read( SwDoc&, const OUString&, SwPaM&, const OUString& ) override; + virtual ErrCode Read( SwDoc&, const OUString&, SwPaM&, const OUString& ) override; static bool MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ); }; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 1987153b18aa..1c020e270922 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3161,7 +3161,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt, { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } } aLink.clear(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 9a736f05822a..5c4746f18b8c 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1360,7 +1360,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, OUString aGraphicInBase64; if ( !XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } OStringBuffer sBuffer; @@ -1438,7 +1438,7 @@ Writer& OutHTML_BulletImage( Writer& rWrt, { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } } } @@ -1728,10 +1728,10 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r XOutBitmap::WriteGraphic( aGraphic, GraphicURL, "JPG", (XOutFlags::UseGifIfPossible| - XOutFlags::UseNativeIfPossible) ) != 0 ) + XOutFlags::UseNativeIfPossible) ) != ERRCODE_NONE ) { // empty or incorrect, because there is nothing to output - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } @@ -1796,11 +1796,11 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF aMM100Size = OutputDevice::LogicToLogic( rSize.GetSize(), MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM )); - sal_uInt16 nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGraphicURL, + ErrCode nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGraphicURL, "JPG", nFlags, &aMM100Size ); if( nErr ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } aGraphicURL = URIHelper::SmartRel2Abs( diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 48ae575cf327..981a479b9490 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1313,13 +1313,13 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame if(pTempFileName) aGraphicURL = *pTempFileName; - sal_uInt16 nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL, + ErrCode nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL, "JPG", (XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible) ); if( nErr ) // error, don't write anything { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } aGraphicURL = URIHelper::SmartRel2Abs( diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 7b1e42963dad..a431b466f9b3 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -189,7 +189,7 @@ bool HTMLReader::SetStrmStgPtr() } // Aufruf fuer die allg. Reader-Schnittstelle -sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & rName ) +ErrCode HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & rName ) { if( !pStrm ) { @@ -212,7 +212,7 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, // so nobody steals the document! rDoc.acquire(); - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; tools::SvRef xParser = new SwHTMLParser( &rDoc, rPam, *pStrm, rName, rBaseURL, !bInsertMode, pMedium, IsReadUTF8(), diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 4ba96bb823dd..adf1d388912d 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -185,7 +185,7 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium) } } -sal_uLong SwHTMLWriter::WriteStream() +ErrCode SwHTMLWriter::WriteStream() { SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get(); @@ -1226,7 +1226,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } Strm().WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_background "=\"" ); Strm().WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_data ":" ); diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 6061bd4c2eec..45edb4e7e71a 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -271,7 +271,7 @@ class SwHTMLWriter : public Writer void CollectLinkTargets(); protected: - sal_uLong WriteStream() override; + ErrCode WriteStream() override; void SetupFilterOptions(SfxMedium& rMedium) override; public: @@ -302,7 +302,7 @@ public: sal_uInt32 m_aFontHeights[7]; // font heights 1-7 - sal_uInt32 m_nWarn; // warning code + ErrCode m_nWarn; // warning code sal_uInt32 m_nLastLFPos; // last position of LF HtmlTokenId m_nLastParaToken; // to hold paragraphs together diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 7b5fa11001e4..a5b7f1569a4d 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -33,7 +33,7 @@ class HTMLReader: public Reader { // we don't want to have the streams/storages open virtual bool SetStrmStgPtr() override; - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; virtual OUString GetTemplateName() const override; public: HTMLReader(); @@ -41,7 +41,7 @@ public: class XMLReader : public Reader { - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; public: virtual int GetReaderType() override; diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index d0567a4f7ba1..cb578d4ebc53 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -40,10 +40,10 @@ using namespace ::com::sun::star; /// Glue class to call RtfImport as an internal filter, needed by copy&paste support. class SwRTFReader : public Reader { - sal_uLong Read(SwDoc&, const OUString& rBaseURL, SwPaM&, const OUString&) override; + ErrCode Read(SwDoc&, const OUString& rBaseURL, SwPaM&, const OUString&) override; }; -sal_uLong SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString&) +ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString&) { if (!pStrm) return ERR_SWG_READ_ERROR; @@ -86,7 +86,7 @@ sal_uLong SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rP { "InsertMode", uno::Any(true) }, { "TextInsertModeRange", uno::Any(xInsertTextRange) } })); - sal_uLong ret(0); + ErrCode ret = ERRCODE_NONE; try { xFilter->filter(aDescriptor); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index c46132263491..dab18534b15b 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -240,11 +240,11 @@ SvStream& Writer::OutULong( SvStream& rStrm, sal_uLong nVal ) return lcl_OutLongExt(rStrm, nVal, false); } -sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) +ErrCode Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) { if ( IsStgWriter() ) { - sal_uLong nResult = ERRCODE_ABORT; + ErrCode nResult = ERRCODE_ABORT; try { tools::SvRef aRef = new SotStorage( rStrm ); @@ -268,7 +268,7 @@ sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = WriteStream(); + ErrCode nRet = WriteStream(); ResetWriter(); @@ -278,7 +278,7 @@ sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) void Writer::SetupFilterOptions(SfxMedium& /*rMedium*/) {} -sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileName ) +ErrCode Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileName ) { SetupFilterOptions(rMedium); // This method must be overridden in SwXMLWriter a storage from medium will be used there. @@ -286,13 +286,13 @@ sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileN return Write( rPam, *rMedium.GetOutStream(), pFileName ); } -sal_uLong Writer::Write( SwPaM& /*rPam*/, SotStorage&, const OUString* ) +ErrCode Writer::Write( SwPaM& /*rPam*/, SotStorage&, const OUString* ) { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; } -sal_uLong Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const OUString*, SfxMedium* ) +ErrCode Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const OUString*, SfxMedium* ) { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; @@ -487,13 +487,13 @@ bool Writer::GetBookmarks(const SwContentNode& rNd, sal_Int32 nStt, } // Storage-specific -sal_uLong StgWriter::WriteStream() +ErrCode StgWriter::WriteStream() { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; } -sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFName ) +ErrCode StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFName ) { SetStream(nullptr); pStg = &rStg; @@ -505,7 +505,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFNam // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = WriteStorage(); + ErrCode nRet = WriteStorage(); pStg = nullptr; ResetWriter(); @@ -513,7 +513,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFNam return nRet; } -sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const OUString* pFName, SfxMedium* pMedium ) +ErrCode StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const OUString* pFName, SfxMedium* pMedium ) { SetStream(nullptr); pStg = nullptr; @@ -526,7 +526,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = pMedium ? WriteMedium( *pMedium ) : WriteStorage(); + ErrCode nRet = pMedium ? WriteMedium( *pMedium ) : WriteStorage(); pStg = nullptr; ResetWriter(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 8b2de89d8bc7..e83f11e584c4 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1369,7 +1369,7 @@ private: public: SwRTFWriter(const OUString& rFilterName, const OUString& rBaseURL); - sal_uLong WriteStream() override; + ErrCode WriteStream() override; }; SwRTFWriter::SwRTFWriter(const OUString& rFltName, const OUString& rBaseURL) @@ -1379,12 +1379,12 @@ SwRTFWriter::SwRTFWriter(const OUString& rFltName, const OUString& rBaseURL) m_bOutOutlineOnly = rFltName.startsWith("O"); } -sal_uLong SwRTFWriter::WriteStream() +ErrCode SwRTFWriter::WriteStream() { SwPaM aPam(*pCurPam->End(), *pCurPam->Start()); RtfExport aExport(nullptr, pDoc, &aPam, pCurPam, this, m_bOutOutlineOnly); aExport.ExportDocument(true); - return 0; + return ERRCODE_NONE; } extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF(const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet) diff --git a/sw/source/filter/ww8/rtfexportfilter.hxx b/sw/source/filter/ww8/rtfexportfilter.hxx index c58bf2b89554..5b626344e900 100644 --- a/sw/source/filter/ww8/rtfexportfilter.hxx +++ b/sw/source/filter/ww8/rtfexportfilter.hxx @@ -30,9 +30,9 @@ class RtfWriter : public Writer { protected: - sal_uLong WriteStream() override + ErrCode WriteStream() override { - return 0; + return ERRCODE_NONE; } }; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 2048387249e8..7b1a06f741aa 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3445,7 +3445,7 @@ void WW8Export::PrepareStorage() } } -sal_uLong SwWW8Writer::WriteStorage() +ErrCode SwWW8Writer::WriteStorage() { // #i34818# - update layout (if present), for SwWriteTable SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -3473,19 +3473,19 @@ sal_uLong SwWW8Writer::WriteStorage() } ::EndProgress( pDoc->GetDocShell() ); - return 0; + return ERRCODE_NONE; } -sal_uLong SwWW8Writer::WriteMedium( SfxMedium& ) +ErrCode SwWW8Writer::WriteMedium( SfxMedium& ) { return WriteStorage(); } -sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, +ErrCode SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, const OUString* pFileName ) { mpMedium = &rMed; - sal_uLong nRet = StgWriter::Write( rPaM, rMed, pFileName ); + ErrCode nRet = StgWriter::Write( rPaM, rMed, pFileName ); mpMedium = nullptr; return nRet; } @@ -3625,10 +3625,10 @@ SwWW8Writer::~SwWW8Writer() { } -extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) +extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32 SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) { SvxImportMSVBasic aTmp( rDoc, rStor ); - return aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName ); + return sal_uInt32(aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName )); } extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) @@ -3636,9 +3636,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const OUString& rFltNam xRet = new SwWW8Writer( rFltName, rBaseURL ); } -extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell &rDocS ) +extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32 SAL_CALL GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell &rDocS ) { - return SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( rDocS ); + return sal_uInt32(SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( rDocS )); } bool WW8_WrPlcFootnoteEdn::WriteText( WW8Export& rWrt ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 0957e33220fd..bb371dcdc5b7 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -899,8 +899,8 @@ public: SwWW8Writer(const OUString& rFltName, const OUString& rBaseURL); virtual ~SwWW8Writer() override; - virtual sal_uLong WriteStorage() override; - virtual sal_uLong WriteMedium( SfxMedium& ) override; + virtual ErrCode WriteStorage() override; + virtual ErrCode WriteMedium( SfxMedium& ) override; // TODO most probably we want to be able to get these in // MSExportFilterBase @@ -932,7 +932,7 @@ public: bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ); using StgWriter::Write; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ) override; //Seems not an expected to provide method to access the private member SfxMedium* GetMedia() { return mpMedium; } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 30cf48d92935..a12f89e25dd9 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4870,9 +4870,9 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, } } -sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; m_rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); if (m_bNewDoc && m_pStg && !pGloss) @@ -5382,10 +5382,10 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) return nErrRet; } -sal_uLong SwWW8ImplReader::SetSubStreams(tools::SvRef &rTableStream, +ErrCode SwWW8ImplReader::SetSubStreams(tools::SvRef &rTableStream, tools::SvRef &rDataStream) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; // 6 stands for "6 OR 7", 7 stands for "ONLY 7" switch (m_pWwFib->m_nVersion) { @@ -5657,9 +5657,9 @@ static bool lclReadCryptoAPIHeader(msfilter::RC4EncryptionInfo &info, SvStream & return true; } -sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; if (pGloss) m_pWwFib = pGloss->GetFib(); else @@ -5727,7 +5727,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) // if initialization has failed the EncryptionData should be empty if ( aEncryptionData.getLength() && aCtx.VerifyKey( m_pWwFib->m_nKey, m_pWwFib->m_nHash ) ) { - nErrRet = 0; + nErrRet = ERRCODE_NONE; pTempMain = MakeTemp(aDecryptMain); m_pStrm->Seek(0); @@ -5794,7 +5794,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) if (aEncryptionData.getLength() && xCtx->VerifyKey(info.verifier.encryptedVerifier, info.verifier.encryptedVerifierHash)) { - nErrRet = 0; + nErrRet = ERRCODE_NONE; pTempMain = MakeTemp(aDecryptMain); @@ -5830,7 +5830,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) } } - if (nErrRet == 0) + if (nErrRet == ERRCODE_NONE) { m_pStrm = &aDecryptMain; @@ -6083,9 +6083,9 @@ void SwWW8ImplReader::GetSmartTagInfo(SwFltRDFMark& rMark) rMark.SetAttributes(aAttributes); } -sal_uLong SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; { static const sal_Char* aNames[ 13 ] = { @@ -6217,7 +6217,7 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName) SwPaM aPaM( aIdx ); aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0); pD->SetInReading(true); - bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == 0; + bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == ERRCODE_NONE; pD->SetInReading(false); return bRet; @@ -6238,9 +6238,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream) return TestImportDOC(rStream, "WW6"); } -sal_uLong WW8Reader::OpenMainStream( tools::SvRef& rRef, sal_uInt16& rBuffSize ) +ErrCode WW8Reader::OpenMainStream( tools::SvRef& rRef, sal_uInt16& rBuffSize ) { - sal_uLong nRet = ERR_SWG_READ_ERROR; + ErrCode nRet = ERR_SWG_READ_ERROR; OSL_ENSURE( pStg.get(), "Where is my Storage?" ); rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL); @@ -6251,7 +6251,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef& rRef, sal_u sal_uInt16 nOld = rRef->GetBufferSize(); rRef->SetBufferSize( rBuffSize ); rBuffSize = nOld; - nRet = 0; + nRet = ERRCODE_NONE; } else nRet = rRef->GetError(); @@ -6259,7 +6259,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef& rRef, sal_u return nRet; } -sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) +ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) { sal_uInt16 nOldBuffSize = 32768; bool bNew = !bInsertMode; // New Doc (no inserting) @@ -6267,7 +6267,7 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, co tools::SvRef refStrm; // So that no one else can steal the Stream SvStream* pIn = pStrm; - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; sal_uInt8 nVersion = 8; const OUString sFltName = GetFltName(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index b859a030ef5b..f64509bf1421 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -130,8 +130,8 @@ struct WW8LFOInfo; class WW8Reader : public StgReader { - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; - sal_uLong OpenMainStream( tools::SvRef& rRef, sal_uInt16& rBuffSize ); + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + ErrCode OpenMainStream( tools::SvRef& rRef, sal_uInt16& rBuffSize ); public: virtual int GetReaderType() override; @@ -1513,9 +1513,9 @@ private: //This converts MS Asian Typography information into OOo's void ImportDopTypography(const WW8DopTypography &rTypo); - sal_uLong LoadThroughDecryption(WW8Glossary *pGloss); - sal_uLong SetSubStreams(tools::SvRef &rTableStream, tools::SvRef &rDataStream); - sal_uLong CoreLoad(WW8Glossary *pGloss); + ErrCode LoadThroughDecryption(WW8Glossary *pGloss); + ErrCode SetSubStreams(tools::SvRef &rTableStream, tools::SvRef &rDataStream); + ErrCode CoreLoad(WW8Glossary *pGloss); void ReadDocVars(); @@ -1871,7 +1871,7 @@ public: // really private, but can only be done public const OUString& GetBaseURL() const { return m_sBaseURL; } // load a complete doc file - sal_uLong LoadDoc(WW8Glossary *pGloss=nullptr); + ErrCode LoadDoc(WW8Glossary *pGloss=nullptr); rtl_TextEncoding GetCurrentCharSet(); rtl_TextEncoding GetCurrentCJKCharSet(); rtl_TextEncoding GetCharSetFromLanguage(); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 64f7aceb3e5a..68b3870d83fc 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2165,7 +2165,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) rSt.ReadInt32( nFc ); pPLCF_PosArray[i] = nFc; - failure = rSt.GetError(); + failure = bool(rSt.GetError()); } } @@ -2191,7 +2191,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) rSt.ReadInt32( nFc ); pPLCF_PosArray[nIMax] = nFc; // end of the last Fkp - failure = rSt.GetError(); + failure = bool(rSt.GetError()); } while(false); } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 9a1b277c8480..22ae96e0d85a 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1113,7 +1113,7 @@ public: /* error status */ - sal_uLong m_nFibError; + ErrCode m_nFibError; /* data read from FIB by Ctor (corresponds only approximately to the real structure @@ -1599,7 +1599,7 @@ struct WW8Dop { public: /* Error Status */ - sal_uLong nDopError; + ErrCode nDopError; /* Corresponds only roughly to the actual structure of the Winword DOP, the winword FIB version matters to what exists. diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index a288f7949f4b..8282b081c2e8 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -126,7 +126,7 @@ namespace { /// read a component (file + filter version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( uno::Reference const & xInputStream, uno::Reference const & xModelComponent, const OUString& rStreamName, @@ -273,11 +273,11 @@ sal_Int32 ReadThroughComponent( } // success! - return 0; + return ERRCODE_NONE; } // read a component (storage version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( uno::Reference const & xStorage, uno::Reference const & xModelComponent, const sal_Char* pStreamName, @@ -309,7 +309,7 @@ sal_Int32 ReadThroughComponent( // do we even have an alternative name? if ( nullptr == pCompatibilityStreamName ) - return 0; + return ERRCODE_NONE; // if so, does the stream exist? sStreamName = OUString::createFromAscii(pCompatibilityStreamName); @@ -322,7 +322,7 @@ sal_Int32 ReadThroughComponent( } if (! bContainsStream ) - return 0; + return ERRCODE_NONE; } // set Base URL @@ -490,7 +490,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc) } } -sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) +ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) { // needed for relative URLs, but in clipboard copy/paste there may be none // and also there is the SwXMLTextBlocks special case @@ -768,7 +768,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c } (void)rDoc.acquire(); // prevent deletion - sal_uInt32 nRet = 0; + ErrCode nRet = ERRCODE_NONE; // save redline mode into import info property set const OUString sShowChanges("ShowChanges"); @@ -799,7 +799,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c makeAny( bTextDocInOOoFileFormat ) ); } - sal_uInt32 nWarnRDF = 0; + ErrCode nWarnRDF = ERRCODE_NONE; if ( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFormatsOnly() || bInsertMode) ) { @@ -837,13 +837,13 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c // read storage streams // #i103539#: always read meta.xml for generator - sal_uInt32 const nWarn = ReadThroughComponent( + ErrCode const nWarn = ReadThroughComponent( xStorage, xModelComp, "meta.xml", "Meta.xml", xContext, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" : "com.sun.star.comp.Writer.XMLMetaImporter"), aEmptyArgs, rName, false ); - sal_uInt32 nWarn2 = 0; + ErrCode nWarn2 = ERRCODE_NONE; if( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFormatsOnly() || bInsertMode) ) { diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index f49af4ffeae3..d7690b57cae9 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -69,7 +69,7 @@ SwXMLWriter::~SwXMLWriter() { } -sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xStatusIndicator, +ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xStatusIndicator, const OUString& aDocHierarchicalName ) { // Get service factory @@ -425,15 +425,15 @@ sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& return WARN_SWG_FEATURES_LOST; } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLWriter::WriteStorage() +ErrCode SwXMLWriter::WriteStorage() { return Write_( uno::Reference < task::XStatusIndicator >(), OUString() ); } -sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) +ErrCode SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) { uno::Reference < task::XStatusIndicator > xStatusIndicator; OUString aName; @@ -449,7 +449,7 @@ sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) return Write_( xStatusIndicator, aName ); } -sal_uLong SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, +ErrCode SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, const OUString* pFileName ) { return IsStgWriter() diff --git a/sw/source/filter/xml/wrtxml.hxx b/sw/source/filter/xml/wrtxml.hxx index 558b21fd4521..1dbd9f63dfa0 100644 --- a/sw/source/filter/xml/wrtxml.hxx +++ b/sw/source/filter/xml/wrtxml.hxx @@ -39,20 +39,20 @@ namespace com { namespace sun { namespace star { class SwXMLWriter : public StgWriter { - sal_uInt32 Write_( const css::uno::Reference < css::task::XStatusIndicator>&, const OUString& ); + ErrCode Write_( const css::uno::Reference < css::task::XStatusIndicator>&, const OUString& ); using StgWriter::Write; protected: - virtual sal_uLong WriteStorage() override; - virtual sal_uLong WriteMedium( SfxMedium& aTargetMedium ) override; + virtual ErrCode WriteStorage() override; + virtual ErrCode WriteMedium( SfxMedium& aTargetMedium ) override; public: SwXMLWriter( const OUString& rBaseURL ); virtual ~SwXMLWriter() override; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ) override; private: diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index fa7abe2d94e0..6d41045d0b8c 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -96,7 +96,7 @@ SwXMLExport::SwXMLExport( InitItemExport(); } -sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) +ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) { if( !GetModel().is() ) return ERR_SWG_WRITE_ERROR; @@ -286,7 +286,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) ( nRedlineFlags & RedlineFlags::ShowMask ) | RedlineFlags::ShowInsert ); } - sal_uInt32 nRet = SvXMLExport::exportDoc( eClass ); + ErrCode nRet = SvXMLExport::exportDoc( eClass ); // now we can restore the redline mode (if we changed it previously) if( bSaveRedline ) diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index c08b0e2b33b0..778cf20931c4 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -114,7 +114,7 @@ public: virtual ~SwXMLExport() override; - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; inline const SvXMLUnitConverter& GetTwipUnitConverter() const; diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src index bca00c9503dc..35d774455b5f 100644 --- a/sw/source/ui/app/error.src +++ b/sw/source/ui/app/error.src @@ -36,7 +36,7 @@ String STR_ERROR_CLPBRD_READ Text [ en-US ] = "Error reading from the clipboard." ; }; -#define ERR_CODE( class, err ) (class | (err - ERROR_SW_BASE)) +#define ERR_CODE( class, err ) (class | (err - ERRCODE_AREA_SW)) #define WARN_CODE( class, err ) (class | ( err - WARN_SW_BASE)) StringArray RID_SW_ERRHDL diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 366a42be3e78..2004445fc7c9 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -593,14 +593,14 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) pValues[0].Value <<= sFilter; uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - sal_uInt32 nErrorCode = ERRCODE_NONE; + ErrCode nErrorCode = ERRCODE_NONE; try { xStore->storeToURL( sPath, aValues ); } catch (const task::ErrorCodeIOException& rErrorEx) { - nErrorCode = (sal_uInt32)rErrorEx.ErrCode; + nErrorCode = ErrCode(rErrorEx.ErrCode); } catch (const Exception&) { @@ -650,14 +650,14 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) pValues[0].Value <<= pSfxFlt->GetFilterName(); uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - sal_uInt32 nErrorCode = ERRCODE_NONE; + ErrCode nErrorCode = ERRCODE_NONE; try { xStore->storeToURL( sTargetTempURL, aValues ); } catch (const task::ErrorCodeIOException& rErrorEx) { - nErrorCode = (sal_uInt32)rErrorEx.ErrCode; + nErrorCode = ErrCode(rErrorEx.ErrCode); } catch (const Exception&) { 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& 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(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; -- cgit