[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Oct 28 20:56:05 UTC 2016


 vcl/source/image/ImageArrayData.cxx |   35 ++++++++++++++++++++++++
 vcl/source/image/ImageList.cxx      |   51 ++++++------------------------------
 2 files changed, 44 insertions(+), 42 deletions(-)

New commits:
commit f19f88a0d49859eb714711cac72793f09f5f7d5c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Oct 27 17:39:45 2016 +0200

    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 at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/image/ImageArrayData.cxx b/vcl/source/image/ImageArrayData.cxx
index cee5046..bd2f1df 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 b4c6c1e..9eeb9e8 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;


More information about the Libreoffice-commits mailing list