loplugin:mergeclasses
Change-Id: Ia19514d33fd025a1df9d26b94e2d39113d122392
This commit is contained in:
@@ -161,7 +161,6 @@ merge dbmm::IProgressConsumer with dbmm::ProgressDelegator
|
|||||||
merge dbmm::MacroMigrationModuleClient with dbmm::MacroMigrationDialogService
|
merge dbmm::MacroMigrationModuleClient with dbmm::MacroMigrationDialogService
|
||||||
merge dbp::OModuleResourceClient with dbp::OUnoAutoPilot
|
merge dbp::OModuleResourceClient with dbp::OUnoAutoPilot
|
||||||
merge dbtools::ISQLStatementHelper with connectivity::mysql::OTables
|
merge dbtools::ISQLStatementHelper with connectivity::mysql::OTables
|
||||||
merge extensions::resource::IResourceType with extensions::resource::StringResourceAccess
|
|
||||||
merge formula::ExternalReferenceHelper with ScExternalRefManager
|
merge formula::ExternalReferenceHelper with ScExternalRefManager
|
||||||
merge formula::IStructHelper with formula::StructPage
|
merge formula::IStructHelper with formula::StructPage
|
||||||
merge framework::IComboBoxListener with framework::ComboboxToolbarController
|
merge framework::IComboBoxListener with framework::ComboboxToolbarController
|
||||||
|
@@ -39,13 +39,14 @@ namespace extensions { namespace resource
|
|||||||
{
|
{
|
||||||
/** encapsulates access to a fixed resource type
|
/** encapsulates access to a fixed resource type
|
||||||
*/
|
*/
|
||||||
class IResourceType
|
class StringResourceAccess
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
StringResourceAccess();
|
||||||
|
|
||||||
/** returns the RESOURCE_TYPE associated with this instance
|
/** returns the RESOURCE_TYPE associated with this instance
|
||||||
*/
|
*/
|
||||||
virtual RESOURCE_TYPE getResourceType() const = 0;
|
static RESOURCE_TYPE getResourceType();
|
||||||
|
|
||||||
/** reads a single resource from the given resource manager
|
/** reads a single resource from the given resource manager
|
||||||
@param _resourceManager
|
@param _resourceManager
|
||||||
the resource manager to read from
|
the resource manager to read from
|
||||||
@@ -57,31 +58,19 @@ namespace extensions { namespace resource
|
|||||||
the caller checked via <code>_resourceManager.IsAvailable( getResourceType(), _resourceId )</code>
|
the caller checked via <code>_resourceManager.IsAvailable( getResourceType(), _resourceId )</code>
|
||||||
that the required resource really exists
|
that the required resource really exists
|
||||||
*/
|
*/
|
||||||
virtual Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const = 0;
|
static Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId );
|
||||||
|
|
||||||
virtual ~IResourceType() { };
|
|
||||||
};
|
|
||||||
|
|
||||||
class StringResourceAccess : public IResourceType
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StringResourceAccess();
|
|
||||||
|
|
||||||
// IResourceType
|
|
||||||
virtual RESOURCE_TYPE getResourceType() const SAL_OVERRIDE;
|
|
||||||
virtual Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const SAL_OVERRIDE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StringResourceAccess::StringResourceAccess()
|
StringResourceAccess::StringResourceAccess()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RESOURCE_TYPE StringResourceAccess::getResourceType() const
|
RESOURCE_TYPE StringResourceAccess::getResourceType()
|
||||||
{
|
{
|
||||||
return RSC_STRING;
|
return RSC_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
Any StringResourceAccess::getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const
|
Any StringResourceAccess::getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId )
|
||||||
{
|
{
|
||||||
OSL_PRECOND( _resourceManager.IsAvailable( getResourceType(), _resourceId ), "StringResourceAccess::getResource: precondition not met!" );
|
OSL_PRECOND( _resourceManager.IsAvailable( getResourceType(), _resourceId ), "StringResourceAccess::getResource: precondition not met!" );
|
||||||
Any aResource;
|
Any aResource;
|
||||||
@@ -94,7 +83,7 @@ namespace extensions { namespace resource
|
|||||||
class OpenOfficeResourceBundle : public OpenOfficeResourceBundle_Base
|
class OpenOfficeResourceBundle : public OpenOfficeResourceBundle_Base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef std::shared_ptr< IResourceType > ResourceTypePtr;
|
typedef std::shared_ptr< StringResourceAccess > ResourceTypePtr;
|
||||||
typedef ::std::map< OUString, ResourceTypePtr > ResourceTypes;
|
typedef ::std::map< OUString, ResourceTypePtr > ResourceTypes;
|
||||||
|
|
||||||
::osl::Mutex m_aMutex;
|
::osl::Mutex m_aMutex;
|
||||||
@@ -257,11 +246,11 @@ namespace extensions { namespace resource
|
|||||||
if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) )
|
if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( !m_pResourceManager->IsAvailable( resourceType->getResourceType(), resourceId ) )
|
if ( !m_pResourceManager->IsAvailable( StringResourceAccess::getResourceType(), resourceId ) )
|
||||||
// no such resource with the given type/id
|
// no such resource with the given type/id
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_out_Element = resourceType->getResource( *m_pResourceManager, resourceId );
|
_out_Element = StringResourceAccess::getResource( *m_pResourceManager, resourceId );
|
||||||
return _out_Element.hasValue();
|
return _out_Element.hasValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +297,7 @@ namespace extensions { namespace resource
|
|||||||
if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) )
|
if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) )
|
||||||
return sal_False;
|
return sal_False;
|
||||||
|
|
||||||
if ( !m_pResourceManager->IsAvailable( resourceType->getResourceType(), resourceId ) )
|
if ( !m_pResourceManager->IsAvailable( StringResourceAccess::getResourceType(), resourceId ) )
|
||||||
return sal_False;
|
return sal_False;
|
||||||
|
|
||||||
return sal_True;
|
return sal_True;
|
||||||
|
Reference in New Issue
Block a user