vcl: move method to the appropriate file, some C++11-ification
Change-Id: If51d16673c8b241487cae5305e293f213b7db5cb Reviewed-on: https://gerrit.libreoffice.org/30338 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
87c518593d
commit
f19f88a0d4
@ -25,10 +25,18 @@
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/image.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/implimagetree.hxx>
|
||||
|
||||
#include <image.h>
|
||||
#include <memory>
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
#include <rtl/strbuf.hxx>
|
||||
#endif
|
||||
|
||||
#include <vcl/BitmapProcessor.hxx>
|
||||
|
||||
ImageAryData::ImageAryData( const ImageAryData& rData ) :
|
||||
maName( rData.maName ),
|
||||
mnId( rData.mnId ),
|
||||
@ -55,4 +63,31 @@ ImageAryData& ImageAryData::operator=( const ImageAryData& rData )
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ImageAryData::Load(const OUString &rPrefix)
|
||||
{
|
||||
OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
|
||||
|
||||
OUString aFileName = rPrefix;
|
||||
aFileName += maName;
|
||||
|
||||
bool bSuccess = ImplImageTree::get().loadImage(aFileName, aIconTheme, maBitmapEx, true);
|
||||
|
||||
if (bSuccess)
|
||||
{}
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
else
|
||||
{
|
||||
OStringBuffer aMessage;
|
||||
aMessage.append( "ImageAryData::Load: failed to load image '" );
|
||||
aMessage.append( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
aMessage.append( "'" );
|
||||
aMessage.append( " from icon theme '" );
|
||||
aMessage.append( OUStringToOString( aIconTheme, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
aMessage.append( "'" );
|
||||
OSL_FAIL( aMessage.makeStringAndClear().getStr() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include <vcl/implimagetree.hxx>
|
||||
#include <image.h>
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
#include <rtl/strbuf.hxx>
|
||||
#endif
|
||||
|
||||
ImageList::ImageList() :
|
||||
mpImplData( nullptr )
|
||||
{
|
||||
@ -122,31 +118,6 @@ void ImageList::ImplInit( sal_uInt16 nItems, const Size &rSize )
|
||||
mpImplData->maImageSize = rSize;
|
||||
}
|
||||
|
||||
void ImageAryData::Load(const OUString &rPrefix)
|
||||
{
|
||||
OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
|
||||
|
||||
OUString aFileName = rPrefix;
|
||||
aFileName += maName;
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
bool bSuccess =
|
||||
#endif
|
||||
ImplImageTree::get().loadImage(aFileName, aIconTheme, maBitmapEx, true);
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
if ( !bSuccess )
|
||||
{
|
||||
OStringBuffer aMessage;
|
||||
aMessage.append( "ImageAryData::Load: failed to load image '" );
|
||||
aMessage.append( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
aMessage.append( "'" );
|
||||
aMessage.append( " from icon theme '" );
|
||||
aMessage.append( OUStringToOString( aIconTheme, RTL_TEXTENCODING_UTF8 ).getStr() );
|
||||
aMessage.append( "'" );
|
||||
OSL_FAIL( aMessage.makeStringAndClear().getStr() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// FIXME: Rather a performance hazard
|
||||
BitmapEx ImageList::GetAsHorizontalStrip() const
|
||||
{
|
||||
@ -278,21 +249,17 @@ void ImageList::RemoveImage( sal_uInt16 nId )
|
||||
|
||||
Image ImageList::GetImage( sal_uInt16 nId ) const
|
||||
{
|
||||
|
||||
Image aRet;
|
||||
|
||||
if( mpImplData )
|
||||
if (mpImplData)
|
||||
{
|
||||
std::vector<ImageAryData *>::iterator aIter;
|
||||
for( aIter = mpImplData->maImages.begin();
|
||||
aIter != mpImplData->maImages.end(); ++aIter)
|
||||
for (ImageAryData* pImageData : mpImplData->maImages)
|
||||
{
|
||||
if ((*aIter)->mnId == nId)
|
||||
if (pImageData->mnId == nId)
|
||||
{
|
||||
if( (*aIter)->IsLoadable() )
|
||||
(*aIter)->Load( mpImplData->maPrefix );
|
||||
|
||||
aRet = Image( (*aIter)->maBitmapEx );
|
||||
if (pImageData->IsLoadable())
|
||||
pImageData->Load(mpImplData->maPrefix);
|
||||
aRet = Image(pImageData->maBitmapEx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -300,9 +267,9 @@ Image ImageList::GetImage( sal_uInt16 nId ) const
|
||||
if (!aRet)
|
||||
{
|
||||
BitmapEx rBitmap;
|
||||
bool res = vcl::ImageRepository::loadDefaultImage(rBitmap);
|
||||
if (res)
|
||||
aRet = Image(rBitmap);
|
||||
bool bResult = vcl::ImageRepository::loadDefaultImage(rBitmap);
|
||||
if (bResult)
|
||||
aRet = Image(rBitmap);
|
||||
}
|
||||
|
||||
return aRet;
|
||||
|
Loading…
x
Reference in New Issue
Block a user