[Libreoffice-commits] core.git: include/tools tools/source vcl/source
Noel Grandin
noelgrandin at gmail.com
Tue Apr 12 06:47:05 UTC 2016
include/tools/resid.hxx | 35 ++++++++++-------------------------
tools/source/rc/rc.cxx | 11 +++++------
tools/source/rc/resmgr.cxx | 4 ++--
vcl/source/window/resource.cxx | 1 -
4 files changed, 17 insertions(+), 34 deletions(-)
New commits:
commit f9aee52eb56c69373c98ced5aff2128ea8c26f1d
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun Apr 10 14:44:15 2016 +0200
give tools::ResId a shave and a haircut
m_nRT2 and m_nWinBits fields are not in use anymore, at least as far
back as 2013, when the heading files were moved around
Change-Id: Ie3299a5999976450803332aeab72d5c0e68227e2
Reviewed-on: https://gerrit.libreoffice.org/23960
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/tools/resid.hxx b/include/tools/resid.hxx
index aa47075..29452c6 100644
--- a/include/tools/resid.hxx
+++ b/include/tools/resid.hxx
@@ -47,12 +47,10 @@ class ResId
mutable sal_uInt32 m_nResId; // Resource Identifier
mutable RESOURCE_TYPE m_nRT; // type for loading (mutable to be set later)
mutable ResMgr * m_pResMgr; // load from this ResMgr (mutable for setting on demand)
- mutable RESOURCE_TYPE m_nRT2; // type for loading (supersedes m_nRT)
- mutable sal_uInt32 m_nWinBits; // container for original style bits on a window in a resource
void ImplInit( sal_uInt32 nId, ResMgr& rMgr, RSHEADER_TYPE* pRes )
{
- m_pResource = pRes; m_nResId = nId; m_nRT = RSC_NOTYPE; m_pResMgr = &rMgr; m_nRT2 = RSC_NOTYPE; m_nWinBits = 0;
+ m_pResource = pRes; m_nResId = nId; m_nRT = RSC_NOTYPE; m_pResMgr = &rMgr;
OSL_ENSURE( m_pResMgr != nullptr, "ResId without ResMgr created" );
}
@@ -66,8 +64,6 @@ public:
ImplInit( nId, rMgr, nullptr );
}
- void SetWinBits( sal_uInt32 nBits ) const { m_nWinBits = nBits; }
-
RESOURCE_TYPE GetRT() const { return m_nRT; }
/** Set the type if not already set. Ask for type with GetRT()
@@ -81,22 +77,12 @@ public:
@see
ResId::GetRT2(), ResId::GetRT()
*/
- const ResId & SetRT( RESOURCE_TYPE nType ) const
- {
- if( RSC_NOTYPE == m_nRT )
- m_nRT = nType;
- return *this;
- }
-
- /** Get the effective type (m_nRT2 or m_nRT1)
-
- A second resource type is used to supersede settings
- of the base class ( e.g. Window )
- */
- RESOURCE_TYPE GetRT2() const
- {
- return (RSC_NOTYPE == m_nRT2) ? m_nRT : m_nRT2;
- }
+ const ResId & SetRT( RESOURCE_TYPE nType ) const
+ {
+ if( RSC_NOTYPE == m_nRT )
+ m_nRT = nType;
+ return *this;
+ }
ResMgr * GetResMgr() const { return m_pResMgr; }
void SetResMgr( ResMgr * pMgr ) const
@@ -114,11 +100,10 @@ public:
return *this;
}
- bool IsAutoRelease() const
- { return !(m_nResId & RSC_DONTRELEASE); }
+ bool IsAutoRelease() const { return !(m_nResId & RSC_DONTRELEASE); }
- sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; }
- RSHEADER_TYPE* GetpResource() const { return m_pResource; }
+ sal_uInt32 GetId() const { return m_nResId & ~RSC_DONTRELEASE; }
+ RSHEADER_TYPE* GetpResource() const { return m_pResource; }
TOOLS_DLLPUBLIC OUString toString() const;
TOOLS_DLLPUBLIC operator OUString() const { return toString(); }
diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx
index de16eaa..262f07a 100644
--- a/tools/source/rc/rc.cxx
+++ b/tools/source/rc/rc.cxx
@@ -18,7 +18,7 @@
*/
#include <string.h>
-#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <tools/rc.hxx>
@@ -42,6 +42,7 @@ void Resource::GetRes( const ResId& rResId )
OUString ResId::toString() const
{
SetRT( RSC_STRING );
+
ResMgr* pResMgr = GetResMgr();
if ( !pResMgr || !pResMgr->GetResource( *this ) )
@@ -49,11 +50,9 @@ OUString ResId::toString() const
OUString sRet;
#if OSL_DEBUG_LEVEL > 0
- sRet = OUStringBuffer().
- append("<resource id ").
- append(static_cast<sal_Int32>(GetId())).
- append(" not found>").
- makeStringAndClear();
+ sRet = "<resource id "
+ + OUString::number(static_cast<sal_Int32>(GetId()))
+ + " not found>";
#endif
if( pResMgr )
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 8cccee4..668b414 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -913,7 +913,7 @@ bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const
bool bAvailable = false;
RSHEADER_TYPE* pClassRes = rId.GetpResource();
- RESOURCE_TYPE nRT = rId.GetRT2();
+ RESOURCE_TYPE nRT = rId.GetRT();
sal_uInt32 nId = rId.GetId();
const ResMgr* pMgr = rId.GetResMgr();
@@ -978,7 +978,7 @@ bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
}
RSHEADER_TYPE* pClassRes = rId.GetpResource();
- RESOURCE_TYPE nRT = rId.GetRT2();
+ RESOURCE_TYPE nRT = rId.GetRT();
sal_uInt32 nId = rId.GetId();
incStack();
diff --git a/vcl/source/window/resource.cxx b/vcl/source/window/resource.cxx
index 6c3aeb3..4550162 100644
--- a/vcl/source/window/resource.cxx
+++ b/vcl/source/window/resource.cxx
@@ -43,7 +43,6 @@ WinBits Window::ImplInitRes( const ResId& rResId )
char* pRes = static_cast<char*>(GetClassRes());
pRes += 8;
sal_uInt32 nStyle = (sal_uInt32)GetLongRes( static_cast<void*>(pRes) );
- rResId.SetWinBits( nStyle );
return nStyle;
}
More information about the Libreoffice-commits
mailing list