diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-10-27 17:39:45 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-10-28 20:55:09 +0000 |
commit | f19f88a0d49859eb714711cac72793f09f5f7d5c (patch) | |
tree | 231418dcaa70bfeab8f184cd18550602c5c7deda /vcl/source | |
parent | 87c518593de59dbf4c0f5f45c720b14a05aeca9e (diff) |
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>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/image/ImageArrayData.cxx | 35 | ||||
-rw-r--r-- | vcl/source/image/ImageList.cxx | 51 |
2 files changed, 44 insertions, 42 deletions
diff --git a/vcl/source/image/ImageArrayData.cxx b/vcl/source/image/ImageArrayData.cxx index cee50461dd82..bd2f1dfec1d7 100644 --- a/vcl/source/image/ImageArrayData.cxx +++ b/vcl/source/image/ImageArrayData.cxx @@ -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: */ diff --git a/vcl/source/image/ImageList.cxx b/vcl/source/image/ImageList.cxx index b4c6c1e62e03..9eeb9e874c7e 100644 --- a/vcl/source/image/ImageList.cxx +++ b/vcl/source/image/ImageList.cxx @@ -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; |