summaryrefslogtreecommitdiffstats
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-08 12:51:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-02-08 13:54:23 +0000
commit2c91fc19445bb503652e97cc8b9f9014db436c37 (patch)
tree2d660534cb865ccc88868f36b4bc36e1addabffe /svtools
parentadd IMCSC test case (diff)
downloadcore-2c91fc19445bb503652e97cc8b9f9014db436c37.tar.gz
core-2c91fc19445bb503652e97cc8b9f9014db436c37.zip
replace localresource of strings and keys with StringArray
Change-Id: I402f5485af0c1e60677b8291c879bc7ca14633d3
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/so3res.src215
-rw-r--r--svtools/source/misc/ehdl.cxx60
2 files changed, 94 insertions, 181 deletions
diff --git a/svtools/source/dialogs/so3res.src b/svtools/source/dialogs/so3res.src
index fec8d8925e8c..38dcb1780969 100644
--- a/svtools/source/dialogs/so3res.src
+++ b/svtools/source/dialogs/so3res.src
@@ -22,152 +22,89 @@
#include <svtools/soerr.hxx>
#define S_MAX 0x7fff
-Resource RID_SO_ERROR_HANDLER
+StringArray RID_SO_ERROR_HANDLER
{
- String ERRCODE_SO_GENERALERROR&S_MAX
- {
- Text [ en-US ] = "General OLE error." ;
- };
- String ERRCODE_SO_CANT_BINDTOSOURCE&S_MAX
- {
- Text [ en-US ] = "The connection to the object cannot be established." ;
- };
- String ERRCODE_SO_NOCACHE_UPDATED&S_MAX
- {
- Text [ en-US ] = "No cache files were updated." ;
- };
- String ERRCODE_SO_SOMECACHES_NOTUPDATED&S_MAX
- {
- Text [ en-US ] = "Some cache files were not updated." ;
- };
- String ERRCODE_SO_MK_UNAVAILABLE&S_MAX
- {
- Text [ en-US ] = "Status of object cannot be determined in a timely manner." ;
- };
- String ERRCODE_SO_E_CLASSDIFF&S_MAX
- {
- Text [ en-US ] = "Source of the OLE link has been converted." ;
- };
- String ERRCODE_SO_MK_NO_OBJECT&S_MAX
- {
- Text [ en-US ] = "The object could not be found." ;
- };
- String ERRCODE_SO_MK_EXCEEDED_DEADLINE&S_MAX
- {
- Text [ en-US ] = "The process could not be completed within the specified time period." ;
- };
- String ERRCODE_SO_MK_CONNECT_MANUALLY&S_MAX
- {
- Text [ en-US ] = "OLE could not connect to a network device (server)." ;
- };
- String ERRCODE_SO_MK_INTERMEDIATE_INTERFACE_NOT_SUPPORTED&S_MAX
- {
- Text [ en-US ] = "The object found does not support the interface required for the desired operation." ;
- };
- String ERRCODE_SO_NO_INTERFACE&S_MAX
- {
- Text [ en-US ] = "Interface not supported." ;
- };
- String ERRCODE_SO_OUT_OF_MEMORY&S_MAX
- {
- Text [ en-US ] = "Insufficient memory." ;
- };
- String ERRCODE_SO_MK_SYNTAX&S_MAX
- {
- Text [ en-US ] = "The connection name could not be processed." ;
- };
- String ERRCODE_SO_MK_REDUCED_TO_SELF&S_MAX
- {
- Text [ en-US ] = "The connection name could not be reduced further." ;
- };
- String ERRCODE_SO_MK_NO_INVERSE&S_MAX
- {
- Text [ en-US ] = "The connection name has no inverse." ;
- };
- String ERRCODE_SO_MK_NO_PREFIX&S_MAX
- {
- Text [ en-US ] = "No common prefix exists." ;
- };
- String ERRCODE_SO_MK_HIM&S_MAX
- {
- Text [ en-US ] = "The connection name is contained in the other one." ;
- };
- String ERRCODE_SO_MK_US&S_MAX
- {
- Text [ en-US ] = "The connection names (the receiver and the other moniker) are identical." ;
- };
- String ERRCODE_SO_MK_ME&S_MAX
- {
- Text [ en-US ] = "The connection name is contained in the other one." ;
- };
- String ERRCODE_SO_MK_NOT_BINDABLE&S_MAX
- {
- Text [ en-US ] = "The connection name cannot be connected. This is a relative name." ;
- };
- String ERRCODE_SO_NOT_IMPLEMENTED&S_MAX
- {
- Text [ en-US ] = "Operation not implemented." ;
- };
- String ERRCODE_SO_MK_NO_STORAGE&S_MAX
- {
- Text [ en-US ] = "No storage." ;
- };
- String ERRCODE_SO_FALSE&S_MAX
- {
- Text [ en-US ] = "False." ;
- };
- String ERRCODE_SO_MK_NEED_GENERIC&S_MAX
- {
- Text [ en-US ] = "Monikers must be composed generically." ;
- };
- String ERRCODE_SO_PENDING&S_MAX
- {
- Text [ en-US ] = "Data not available at this time." ;
- };
- String ERRCODE_SO_NOT_INPLACEACTIVE & S_MAX
- {
- Text [ en-US ] = "Object could not be activated InPlace." ;
- };
- String ERRCODE_SO_LINDEX & S_MAX
- {
- Text [ en-US ] = "Invalid index." ;
- };
- String ERRCODE_SO_CANNOT_DOVERB_NOW & S_MAX
- {
- Text [ en-US ] = "The action cannot be executed in the object's current state." ;
- };
- String ERRCODE_SO_OLEOBJ_INVALIDHWND & S_MAX
- {
- Text [ en-US ] = "An invalid window was passed when activated." ;
- };
- String ERRCODE_SO_NOVERBS & S_MAX
- {
- Text [ en-US ] = "The object does not support any actions." ;
- };
- String ERRCODE_SO_INVALIDVERB & S_MAX
- {
- Text [ en-US ] = "The action is not defined. The default action will be executed." ;
- };
- String ERRCODE_SO_MK_CONNECT & S_MAX
- {
- Text [ en-US ] = "A link to the network could not be re-established." ;
- };
- String ERRCODE_SO_NOTIMPL & S_MAX
- {
- Text [ en-US ] = "Object does not support this action." ;
- };
- String ERRCODE_SO_MK_CANTOPENFILE & S_MAX
- {
- Text [ en-US ] = "The specified file could not be opened." ;
+ ItemList [ en-US ] =
+ {
+ < "General OLE error." ;
+ ERRCODE_SO_GENERALERROR&S_MAX ; >;
+ < "The connection to the object cannot be established." ;
+ ERRCODE_SO_CANT_BINDTOSOURCE&S_MAX ; >;
+ < "No cache files were updated." ;
+ ERRCODE_SO_NOCACHE_UPDATED&S_MAX ; >;
+ < "Some cache files were not updated." ;
+ ERRCODE_SO_SOMECACHES_NOTUPDATED&S_MAX ; >;
+ < "Status of object cannot be determined in a timely manner." ;
+ ERRCODE_SO_MK_UNAVAILABLE&S_MAX ; >;
+ < "Source of the OLE link has been converted." ;
+ ERRCODE_SO_E_CLASSDIFF&S_MAX ; >;
+ < "The object could not be found." ;
+ ERRCODE_SO_MK_NO_OBJECT&S_MAX ; >;
+ < "The process could not be completed within the specified time period." ;
+ ERRCODE_SO_MK_EXCEEDED_DEADLINE&S_MAX ; >;
+ < "OLE could not connect to a network device (server)." ;
+ ERRCODE_SO_MK_CONNECT_MANUALLY&S_MAX ; >;
+ < "The object found does not support the interface required for the desired operation." ;
+ ERRCODE_SO_MK_INTERMEDIATE_INTERFACE_NOT_SUPPORTED&S_MAX ; >;
+ < "Interface not supported." ;
+ ERRCODE_SO_NO_INTERFACE&S_MAX ; >;
+ < "Insufficient memory." ;
+ ERRCODE_SO_OUT_OF_MEMORY&S_MAX ; >;
+ < "The connection name could not be processed." ;
+ ERRCODE_SO_MK_SYNTAX&S_MAX ; >;
+ < "The connection name could not be reduced further." ;
+ ERRCODE_SO_MK_REDUCED_TO_SELF&S_MAX ; >;
+ < "The connection name has no inverse." ;
+ ERRCODE_SO_MK_NO_INVERSE&S_MAX ; >;
+ < "No common prefix exists." ;
+ ERRCODE_SO_MK_NO_PREFIX&S_MAX ; >;
+ < "The connection name is contained in the other one." ;
+ ERRCODE_SO_MK_HIM&S_MAX ; >;
+ < "The connection names (the receiver and the other moniker) are identical." ;
+ ERRCODE_SO_MK_US&S_MAX ; >;
+ < "The connection name is contained in the other one." ;
+ ERRCODE_SO_MK_ME&S_MAX ; >;
+ < "The connection name cannot be connected. This is a relative name." ;
+ ERRCODE_SO_MK_NOT_BINDABLE&S_MAX ; >;
+ < "Operation not implemented." ;
+ ERRCODE_SO_NOT_IMPLEMENTED&S_MAX ; >;
+ < "No storage." ;
+ ERRCODE_SO_MK_NO_STORAGE&S_MAX ; >;
+ < "False." ;
+ ERRCODE_SO_FALSE&S_MAX ; >;
+ < "Monikers must be composed generically." ;
+ ERRCODE_SO_MK_NEED_GENERIC&S_MAX ; >;
+ < "Data not available at this time." ;
+ ERRCODE_SO_PENDING&S_MAX ; >;
+ < "Object could not be activated InPlace." ;
+ ERRCODE_SO_NOT_INPLACEACTIVE & S_MAX ; >;
+ < "Invalid index." ;
+ ERRCODE_SO_LINDEX & S_MAX ; >;
+ < "The action cannot be executed in the object's current state." ;
+ ERRCODE_SO_CANNOT_DOVERB_NOW & S_MAX ; >;
+ < "An invalid window was passed when activated." ;
+ ERRCODE_SO_OLEOBJ_INVALIDHWND & S_MAX ; >;
+ < "The object does not support any actions." ;
+ ERRCODE_SO_NOVERBS & S_MAX ; >;
+ < "The action is not defined. The default action will be executed." ;
+ ERRCODE_SO_INVALIDVERB & S_MAX ; >;
+ < "A link to the network could not be re-established." ;
+ ERRCODE_SO_MK_CONNECT & S_MAX ; >;
+ < "Object does not support this action." ;
+ ERRCODE_SO_NOTIMPL & S_MAX ; >;
+ < "The specified file could not be opened." ;
+ ERRCODE_SO_MK_CANTOPENFILE & S_MAX ; >;
};
};
-Resource RID_SO_ERRCTX
+
+StringArray RID_SO_ERRCTX
{
- String ERRCTX_SO_DOVERB
+ ItemList [ en-US ] =
{
- Text [ en-US ] = "$(ERR) activating object" ;
+ < "$(ERR) activating object" ; ERRCTX_SO_DOVERB ; >;
};
};
+
String STR_ERROR_OBJNOCREATE
{
Text [ en-US ] = "Object % could not be inserted." ;
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 4285b63d7168..16503aa591cc 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -19,6 +19,7 @@
#include <osl/mutex.hxx>
#include <tools/rcid.h>
+#include <tools/resary.hxx>
#include <tools/wintypes.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
@@ -218,26 +219,6 @@ ResString::ResString(ResId & rId)
pResMgr->PopContext();
}
-struct ErrorResource_Impl : private Resource
-
-/* [Description]
-
- Helpclass for access to string sub-resources of a resource
- */
-
-{
- ResId aResId;
-
- ErrorResource_Impl(ResId& rErrIdP, sal_uInt16 nId)
- : Resource(rErrIdP),aResId(nId,*rErrIdP.GetResMgr()){}
-
- ~ErrorResource_Impl() { FreeResource(); }
-
- ResString GetResString() { return ResString( aResId ); }
- operator bool() { return IsAvailableRes(aResId.SetRT(RSC_STRING)); }
-
-};
-
void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
/* [Description]
@@ -251,11 +232,11 @@ void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr)
std::unique_ptr<ResMgr> pResMgr(ResMgr::CreateResMgr("ofa", Application::GetSettings().GetUILanguageTag() ));
if( pResMgr )
{
- ResId aId(RID_ERRHDL, *pResMgr );
- ErrorResource_Impl aEr(aId, (sal_uInt16)lClassId);
- if(aEr)
+ ResStringArray aEr(ResId(RID_ERRHDL, *pResMgr));
+ sal_uInt32 nErrIdx = aEr.FindIndex((sal_uInt16)lClassId);
+ if (nErrIdx != RESARRAY_INDEX_NOTFOUND)
{
- rStr = aEr.GetResString().GetString();
+ rStr = aEr.GetString(nErrIdx);
}
}
}
@@ -274,19 +255,16 @@ bool SfxErrorHandler::GetErrorString(sal_uLong lErrId, OUString &rStr) const
bool bRet = false;
rStr = SvtResId(RID_ERRHDL_CLASS).toString();
- ResId aResId(nId, *pMgr);
+ ResStringArray aEr(ResId(nId, *pMgr));
+ sal_uInt32 nErrIdx = aEr.FindIndex((sal_uInt16)lErrId);
+ if (nErrIdx != RESARRAY_INDEX_NOTFOUND)
{
- ErrorResource_Impl aEr(aResId, (sal_uInt16)lErrId);
- if(aEr)
- {
- ResString aErrorString(aEr.GetResString());
- rStr = rStr.replaceAll("$(ERROR)", aErrorString.GetString());
- bRet = true;
- }
- else
- bRet = false;
+ rStr = rStr.replaceAll("$(ERROR)", aEr.GetString(nErrIdx));
+ bRet = true;
}
+ else
+ bRet = false;
if( bRet )
{
@@ -339,12 +317,11 @@ bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr)
{
SolarMutexGuard aGuard;
- ResId aResId( nResId, *pMgr );
-
- ErrorResource_Impl aTestEr( aResId, nCtxId );
- if ( aTestEr )
+ ResStringArray aTestEr(ResId(nResId, *pMgr));
+ sal_uInt32 nErrIdx = aTestEr.FindIndex(nCtxId);
+ if (nErrIdx != RESARRAY_INDEX_NOTFOUND)
{
- rStr = aTestEr.GetResString().GetString();
+ rStr = aTestEr.GetString(nErrIdx);
rStr = rStr.replaceAll("$(ARG1)", aArg1);
bRet = true;
}
@@ -357,9 +334,8 @@ bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr)
if ( bRet )
{
sal_uInt16 nId = ( nErrId & ERRCODE_WARNING_MASK ) ? ERRCTX_WARNING : ERRCTX_ERROR;
- ResId aSfxResId( RID_ERRCTX, *pMgr );
- ErrorResource_Impl aEr( aSfxResId, nId );
- rStr = rStr.replaceAll("$(ERR)", aEr.GetResString().GetString());
+ ResStringArray aEr(ResId(RID_ERRCTX, *pMgr));
+ rStr = rStr.replaceAll("$(ERR)", aEr.GetString(nId));
}
}