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@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
@@ -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(); }
|
||||
|
@@ -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 )
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user