[Libreoffice-commits] core.git: 2 commits - include/svtools include/tools svtools/source svx/source tools/source

Caolán McNamara caolanm at redhat.com
Wed Feb 8 12:19:08 UTC 2017


 include/svtools/ehdl.hxx     |    4 -
 include/svtools/sfxecode.hxx |   34 ---------------
 include/tools/errinf.hxx     |    3 -
 svtools/source/misc/ehdl.cxx |   30 ++-----------
 svx/source/src/errtxt.src    |   97 -------------------------------------------
 tools/source/ref/errinf.cxx  |    9 +--
 6 files changed, 13 insertions(+), 164 deletions(-)

New commits:
commit ff82f13b6837b034987cd6fd26de136071cee0c5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 8 11:14:45 2017 +0000

    drop unused error strings
    
    includes ERRCODE_SFXMSG_STYLEREPLACE
    
    which has the knock on effect that the flags argument
    can be removed from a bunch of methods
    
    Change-Id: I72b58bc2a19376bb4609e61aa44e71f734efb333

diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx
index cb73990..22cdafc 100644
--- a/include/svtools/ehdl.hxx
+++ b/include/svtools/ehdl.hxx
@@ -54,7 +54,7 @@ public:
     virtual ~SfxErrorHandler() override;
 
 protected:
-    bool     GetErrorString(sal_uLong lErrId, OUString &, sal_uInt16&) const;
+    bool     GetErrorString(sal_uLong lErrId, OUString &) const;
 
 private:
 
@@ -66,7 +66,7 @@ private:
                          pFreeMgr;
 
     SVT_DLLPRIVATE static void GetClassString(sal_uLong lErrId, OUString &);
-    virtual bool          CreateString( const ErrorInfo *, OUString &, sal_uInt16 &) const override;
+    virtual bool          CreateString(const ErrorInfo *, OUString &) const override;
 };
 
 #endif
diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx
index 99083f2..e4b5c0b 100644
--- a/include/svtools/sfxecode.hxx
+++ b/include/svtools/sfxecode.hxx
@@ -21,54 +21,20 @@
 
 #include <tools/errcode.hxx>
 
-#define ERRCODE_SFX_NOSTDTEMPLATE           (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|1)
 #define ERRCODE_SFX_NOTATEMPLATE            (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|2)
 #define ERRCODE_SFX_GENERAL                 (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|3)
 #define ERRCODE_SFX_DOLOADFAILED            (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|4)
-#define ERRCODE_SFX_DOSAVECOMPLETEDFAILED   (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|5)
-#define ERRCODE_SFX_COMMITFAILED            (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|6)
-#define ERRCODE_SFX_HANDSOFFFAILED          (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|7)
-#define ERRCODE_SFX_DOINITNEWFAILED         (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|8)
-#define ERRCODE_SFX_CANTREADDOCINFO         (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|9)
 #define ERRCODE_SFX_ALREADYOPEN             (ERRCODE_AREA_SFX|ERRCODE_CLASS_ALREADYEXISTS|10)
 #define ERRCODE_SFX_WRONGPASSWORD           (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11)
 #define ERRCODE_SFX_DOCUMENTREADONLY        (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12)
 #define ERRCODE_SFX_OLEGENERAL              (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14)
-#define ERRCODE_SFXMSG_STYLEREPLACE         (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|13)
 #define ERRCODE_SFX_TEMPLATENOTFOUND        (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15)
-#define ERRCODE_SFX_ISRELATIVE              (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|16)
-#define ERRCODE_SFX_FORCEDOCLOAD            (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|17)
 
-#define ERRCODE_SFX_CANTFINDORIGINAL        (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|19)
-#define ERRCODE_SFX_RESTART                 (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|20)
 #define ERRCODE_SFX_CANTCREATECONTENT       (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|21)
-#define ERRCODE_SFX_CANTCREATELINK          (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|22)
-#define ERRCODE_SFX_WRONGBMKFORMAT          (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|23)
-#define ERRCODE_SFX_WRONGICONFILE           (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|24)
-#define ERRCODE_SFX_CANTDELICONFILE         (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|25)
-#define ERRCODE_SFX_CANTWRITEICONFILE       (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|26)
-#define ERRCODE_SFX_CANTRENAMECONTENT       (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|27)
-#define ERRCODE_SFX_INVALIDBMKPATH          (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|28)
-#define ERRCODE_SFX_CANTWRITEURLCFGFILE     (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|29)
-#define ERRCODE_SFX_WRONGURLCFGFORMAT       (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|30)
-#define ERRCODE_SFX_NODOCUMENT              (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|31)
-#define ERRCODE_SFX_INVALIDLINK             (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|32)
-#define ERRCODE_SFX_INVALIDTRASHPATH        (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|33)
-#define ERRCODE_SFX_NOTRESTORABLE           (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|34)
-#define ERRCODE_SFX_NOTRASH                 (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|35)
 #define ERRCODE_SFX_INVALIDSYNTAX           (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|36)
 #define ERRCODE_SFX_CANTCREATEFOLDER        (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|37)
-#define ERRCODE_SFX_CANTRENAMEFOLDER        (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|38)
-#define ERRCODE_SFX_WRONG_CDF_FORMAT        (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 39)
-#define ERRCODE_SFX_EMPTY_SERVER            (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|40)
-#define ERRCODE_SFX_NO_ABOBOX               (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 41)
 #define ERRCODE_SFX_CANTGETPASSWD           (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 42)
-#define ERRCODE_SFX_TARGETFILECORRUPTED     (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 43)
 #define ERRCODE_SFX_NOMOREDOCUMENTSALLOWED  (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 44)
-#define ERRCODE_SFX_NOFILTER                (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|45)
-#define ERRCODE_SFX_FORCEQUIET              (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|47)
-#define ERRCODE_SFX_CONSULTUSER             (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|48)
-#define ERRCODE_SFX_NEVERCHECKCONTENT       (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|49)
 #define ERRCODE_SFX_CANTCREATEBACKUP        (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50)
 #define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51)
 #define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52)
diff --git a/include/tools/errinf.hxx b/include/tools/errinf.hxx
index 9559eec..6934d53 100644
--- a/include/tools/errinf.hxx
+++ b/include/tools/errinf.hxx
@@ -129,8 +129,7 @@ private:
                               bool bJustCreateString,
                               OUString & rError);
 protected:
-    virtual bool        CreateString( const ErrorInfo *,
-                              OUString &, sal_uInt16& nMask ) const = 0;
+    virtual bool        CreateString(const ErrorInfo *, OUString &) const = 0;
 
 public:
                         ErrorHandler();
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index ea1a7d8..4285b63 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -161,8 +161,7 @@ SfxErrorHandler::~SfxErrorHandler()
 }
 
 
-bool SfxErrorHandler::CreateString(
-    const ErrorInfo *pErr, OUString &rStr, sal_uInt16& nFlags) const
+bool SfxErrorHandler::CreateString(const ErrorInfo *pErr, OUString &rStr) const
 
 /*  [Description]
 
@@ -174,7 +173,7 @@ bool SfxErrorHandler::CreateString(
     sal_uLong nErrCode = pErr->GetErrorCode() & ERRCODE_ERROR_MASK;
     if( nErrCode>=lEnd || nErrCode<=lStart )
         return false;
-    if(GetErrorString(nErrCode, rStr, nFlags))
+    if(GetErrorString(nErrCode, rStr))
     {
         const StringErrorInfo *pStringInfo = dynamic_cast<const StringErrorInfo *>(pErr);
         if(pStringInfo)
@@ -195,38 +194,30 @@ bool SfxErrorHandler::CreateString(
     return false;
 }
 
-
 class ResString: public OUString
-
 /*  [Description]
 
     Helpclass to read a string and optional ExtraData from
     a string Resource.
 
     */
-
 {
-    sal_uInt16 nFlags;
   public:
-    sal_uInt16 GetFlags() const {return nFlags;}
     const OUString & GetString() const {return *this;}
     explicit ResString( ResId &rId);
 };
 
-
-ResString::ResString(ResId & rId):
-    OUString(rId.SetAutoRelease(false).toString()),
-    nFlags(0)
+ResString::ResString(ResId & rId)
+    : OUString(rId.SetAutoRelease(false).toString())
 {
     ResMgr * pResMgr = rId.GetResMgr();
      // String ctor temporarily sets global ResManager
     if (pResMgr->GetRemainSize())
-        nFlags = sal_uInt16(pResMgr->ReadShort());
+        (void)pResMgr->ReadShort();
     rId.SetAutoRelease(true);
     pResMgr->PopContext();
 }
 
-
 struct ErrorResource_Impl : private Resource
 
 /*  [Description]
@@ -235,7 +226,6 @@ struct ErrorResource_Impl : private Resource
     */
 
 {
-
     ResId aResId;
 
     ErrorResource_Impl(ResId& rErrIdP, sal_uInt16 nId)
@@ -248,7 +238,6 @@ struct ErrorResource_Impl : private Resource
 
 };
 
-
 void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
 
 /*  [Description]
@@ -271,8 +260,7 @@ void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
     }
 }
 
-bool SfxErrorHandler::GetErrorString(
-    sal_uLong lErrId, OUString &rStr, sal_uInt16 &nFlags) const
+bool SfxErrorHandler::GetErrorString(sal_uLong lErrId, OUString &rStr) const
 
 /*  [Description]
 
@@ -293,10 +281,6 @@ bool SfxErrorHandler::GetErrorString(
         if(aEr)
         {
             ResString aErrorString(aEr.GetResString());
-
-            if (lErrId == ERRCODE_SFXMSG_STYLEREPLACE)
-                nFlags = ERRCODE_MSG_ERROR | ERRCODE_BUTTON_OK_CANCEL;
-
             rStr = rStr.replaceAll("$(ERROR)", aErrorString.GetString());
             bRet = true;
         }
diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src
index 342c8e8..952a5ee 100644
--- a/svx/source/src/errtxt.src
+++ b/svx/source/src/errtxt.src
@@ -278,10 +278,6 @@ Resource RID_ERRHDL
     {
         Text [ en-US ] = "An object cannot be copied into itself." ;
     };
-    String ERRCODE_SFX_NOSTDTEMPLATE
-    {
-        Text [ en-US ] = "The default template could not be opened." ;
-    };
     String ERRCODE_SFX_TEMPLATENOTFOUND
     {
         Text [ en-US ] = "The specified template could not be found." ;
@@ -290,10 +286,6 @@ Resource RID_ERRHDL
     {
         Text [ en-US ] = "The file cannot be used as template." ;
     };
-    String ERRCODE_SFX_CANTREADDOCINFO
-    {
-        Text [ en-US ] = "Document information could not be read from the file because\nthe document information format is unknown or because document information does not\nexist." ;
-    };
     String ERRCODE_SFX_ALREADYOPEN
     {
         Text [ en-US ] = "This document has already been opened for editing." ;
@@ -338,82 +330,14 @@ Resource RID_ERRHDL
     {
         Text [ en-US ] = "The requested Internet data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ;
     };
-    String ERRCODE_SFXMSG_STYLEREPLACE
-    {
-        Text [ en-US ] = "Should the $(ARG1) Style be replaced?" ;
-    };
-    String ERRCODE_SFX_NOFILTER
-    {
-        Text [ en-US ] = "A filter has not been found." ;
-    };
-    String ERRCODE_SFX_CANTFINDORIGINAL
-    {
-        Text [ en-US ] = "The original could not be determined." ;
-    };
     String ERRCODE_SFX_CANTCREATECONTENT
     {
         Text [ en-US ] = "The contents could not be created." ;
     };
-    String ERRCODE_SFX_CANTCREATELINK
-    {
-        Text [ en-US ] = "The link could not be created." ;
-    };
-    String ERRCODE_SFX_WRONGBMKFORMAT
-    {
-        Text [ en-US ] = "The link format is invalid." ;
-    };
-    String ERRCODE_SFX_WRONGICONFILE
-    {
-        Text [ en-US ] = "The configuration of the icon display is invalid." ;
-    };
-    String ERRCODE_SFX_CANTWRITEICONFILE
-    {
-        Text [ en-US ] = "The configuration of the icon display can not be saved." ;
-    };
-    String ERRCODE_SFX_CANTDELICONFILE
-    {
-        Text [ en-US ] = "The configuration of the icon display could not be deleted." ;
-    };
-    String ERRCODE_SFX_CANTRENAMECONTENT
-    {
-        Text [ en-US ] = "Contents cannot be renamed." ;
-    };
-    String ERRCODE_SFX_INVALIDBMKPATH
-    {
-        Text [ en-US ] = "The bookmark folder is invalid." ;
-    };
-    String ERRCODE_SFX_CANTWRITEURLCFGFILE
-    {
-        Text [ en-US ] = "The configuration of the URLs to be saved locally could not be saved." ;
-    };
-    String ERRCODE_SFX_WRONGURLCFGFORMAT
-    {
-        Text [ en-US ] = "The configuration format of the URLs to be saved locally is invalid." ;
-    };
-    String ERRCODE_SFX_NODOCUMENT
-    {
-        Text [ en-US ] = "This action cannot be applied to a document that does not exist." ;
-    };
-    String ERRCODE_SFX_INVALIDLINK
-    {
-        Text [ en-US ] = "The link refers to an invalid target." ;
-    };
-    String ERRCODE_SFX_INVALIDTRASHPATH
-    {
-        Text [ en-US ] = "The Recycle Bin path is invalid." ;
-    };
-    String ERRCODE_SFX_NOTRESTORABLE
-    {
-        Text [ en-US ] = "The entry could not be restored." ;
-    };
     String ERRCODE_IO_NAMETOOLONG
     {
         Text [ en-US ] = "The file name is too long for the target file system." ;
     };
-    String ERRCODE_SFX_CONSULTUSER
-    {
-        Text [ en-US ] = "The details for running the function are incomplete." ;
-    };
     String ERRCODE_SFX_INVALIDSYNTAX
     {
         Text [ en-US ] = "The input syntax is invalid." ;
@@ -422,30 +346,10 @@ Resource RID_ERRHDL
     {
         Text [ en-US ] = "The input syntax is invalid." ;
     };
-    String ERRCODE_SFX_CANTRENAMEFOLDER
-    {
-        Text [ en-US ] = "The input syntax is invalid." ;
-    };
-    String ERRCODE_SFX_WRONG_CDF_FORMAT
-    {
-        Text [ en-US ] = "The channel document has an invalid format." ;
-    };
-    String ERRCODE_SFX_EMPTY_SERVER
-    {
-        Text [ en-US ] = "The server must not be empty." ;
-    };
-    String ERRCODE_SFX_NO_ABOBOX
-    {
-        Text [ en-US ] = "A subscription folder is required to install a Channel." ;
-    };
     String ERRCODE_IO_NOTSTORABLEINBINARYFORMAT
     {
         Text [ en-US ] = "This document contains attributes that cannot be saved in the selected format.\nPlease save the document in a %PRODUCTNAME %PRODUCTVERSION file format.";
     };
-    String ERRCODE_SFX_TARGETFILECORRUPTED
-    {
-        Text [ en-US ] = "The file $(FILENAME) cannot be saved. Please check your system settings. You can find an automatically generated backup copy of this file in folder $(PATH) named $(BACKUPNAME).";
-    };
     String ERRCODE_SFX_NOMOREDOCUMENTSALLOWED
     {
         Text [ en-US ] = "The maximum number of documents that can be opened at the same time has been reached. You need to close one or more documents before you can open a new document.";
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index 4c3eb52..4e205ec 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -147,7 +147,7 @@ StringErrorInfo::StringErrorInfo(
 class ErrorHandler_Impl
 {
 public:
-    static bool         CreateString(const ErrorInfo*, OUString&, sal_uInt16&);
+    static bool         CreateString(const ErrorInfo*, OUString&);
 };
 
 static void aDspFunc(const OUString &rErr, const OUString &rAction)
@@ -272,7 +272,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
             nErrFlags = nDynFlags;
     }
 
-    if(ErrorHandler_Impl::CreateString(pInfo,aErr,nErrFlags))
+    if(ErrorHandler_Impl::CreateString(pInfo,aErr))
     {
         if (bJustCreateString)
         {
@@ -337,12 +337,11 @@ sal_uInt16 ErrorHandler::HandleError(sal_uIntPtr lId, sal_uInt16 nFlags)
     return HandleError_Impl( lId, nFlags, false, aDummy );
 }
 
-bool ErrorHandler_Impl::CreateString( const ErrorInfo* pInfo, OUString& pStr,
-                                    sal_uInt16 &rFlags)
+bool ErrorHandler_Impl::CreateString(const ErrorInfo* pInfo, OUString& rStr)
 {
     for(const ErrorHandler *pHdl : TheEDcrData::get().errorHandlers)
     {
-        if(pHdl->CreateString( pInfo, pStr, rFlags))
+        if(pHdl->CreateString(pInfo, rStr))
             return true;
     }
     return false;
commit 9192e85076f99772884393e4cc2aa9b663b2e43f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 8 10:58:47 2017 +0000

    move the extra data of ERRCODE_SFXMSG_STYLEREPLACE out of the .src
    
    Change-Id: I5c39d785d1f2a78e1fcfcd763deac60f047a5e4b

diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 577953b..ea1a7d8 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -271,7 +271,6 @@ void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
     }
 }
 
-
 bool SfxErrorHandler::GetErrorString(
     sal_uLong lErrId, OUString &rStr, sal_uInt16 &nFlags) const
 
@@ -295,9 +294,9 @@ bool SfxErrorHandler::GetErrorString(
         {
             ResString aErrorString(aEr.GetResString());
 
-            sal_uInt16 nResFlags = aErrorString.GetFlags();
-            if ( nResFlags )
-                nFlags = nResFlags;
+            if (lErrId == ERRCODE_SFXMSG_STYLEREPLACE)
+                nFlags = ERRCODE_MSG_ERROR | ERRCODE_BUTTON_OK_CANCEL;
+
             rStr = rStr.replaceAll("$(ERROR)", aErrorString.GetString());
             bRet = true;
         }
@@ -318,7 +317,6 @@ bool SfxErrorHandler::GetErrorString(
     return bRet;
 }
 
-
 SfxErrorContext::SfxErrorContext(
     sal_uInt16 nCtxIdP, vcl::Window *pWindow, sal_uInt16 nResIdP, ResMgr *pMgrP)
 :   ErrorContext(pWindow), nCtxId(nCtxIdP), nResId(nResIdP), pMgr(pMgrP)
diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src
index 40ff546..342c8e8 100644
--- a/svx/source/src/errtxt.src
+++ b/svx/source/src/errtxt.src
@@ -340,7 +340,6 @@ Resource RID_ERRHDL
     };
     String ERRCODE_SFXMSG_STYLEREPLACE
     {
-        ExtraData = ERRCODE_MSG_ERROR | ERRCODE_BUTTON_OK_CANCEL ;
         Text [ en-US ] = "Should the $(ARG1) Style be replaced?" ;
     };
     String ERRCODE_SFX_NOFILTER


More information about the Libreoffice-commits mailing list