[Libreoffice-commits] .: toolkit/source vcl/inc vcl/source
Michael Meeks
mmeeks at kemper.freedesktop.org
Thu Dec 9 11:18:13 PST 2010
toolkit/source/layout/core/helper.cxx | 2 +-
vcl/inc/vcl/imagerepository.hxx | 7 ++++++-
vcl/inc/vcl/impimagetree.hxx | 4 ++++
vcl/source/gdi/bitmapex.cxx | 2 +-
vcl/source/gdi/image.cxx | 25 +++++++++----------------
vcl/source/gdi/imagerepository.cxx | 11 +++++++++--
vcl/source/gdi/impimagetree.cxx | 13 +++++++++++--
7 files changed, 41 insertions(+), 23 deletions(-)
New commits:
commit ff7bc816785ec34ea3fc16c03e41d8754cd94c91
Author: Joachim Tremouroux <joachim.tremouroux at gmail.com>
Date: Thu Dec 9 19:15:20 2010 +0000
finish cleanup of missing icon handling code
diff --git a/toolkit/source/layout/core/helper.cxx b/toolkit/source/layout/core/helper.cxx
index 0afd3a4..791901b 100644
--- a/toolkit/source/layout/core/helper.cxx
+++ b/toolkit/source/layout/core/helper.cxx
@@ -595,7 +595,7 @@ uno::Reference< graphic::XGraphic > loadGraphic( const char *pName )
if ( aStr.compareToAscii( ".uno:" ) == 0 )
aStr = aStr.copy( 5 ).toAsciiLowerCase();
- if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) )
+ if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true, true ) )
return uno::Reference< graphic::XGraphic >();
return Graphic( aBmp ).GetXGraphic();
diff --git a/vcl/inc/vcl/imagerepository.hxx b/vcl/inc/vcl/imagerepository.hxx
index a9009df..cb1dc2a 100644
--- a/vcl/inc/vcl/imagerepository.hxx
+++ b/vcl/inc/vcl/imagerepository.hxx
@@ -59,7 +59,12 @@ namespace vcl
static bool loadImage(
const ::rtl::OUString& _rName,
BitmapEx& _out_rImage,
- bool bSearchLanguageDependent
+ bool bSearchLanguageDependent,
+ bool loadMissing = false
+ );
+
+ static bool loadDefaultImage(
+ BitmapEx& _out_rImage
);
};
diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx
index bfaff19..68f9a73 100644
--- a/vcl/inc/vcl/impimagetree.hxx
+++ b/vcl/inc/vcl/impimagetree.hxx
@@ -60,6 +60,10 @@ public:
rtl::OUString const & name, rtl::OUString const & style,
BitmapEx & bitmap, bool localized = false, bool loadMissing = false );
+ bool loadDefaultImage(
+ rtl::OUString const & style,
+ BitmapEx& bitmap);
+
void shutDown();
// a crude form of life cycle control (called from DeInitVCL; otherwise,
// if the ImplImageTree singleton were destroyed during exit that would
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 43589e3..f63c0fe 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -104,7 +104,7 @@ BitmapEx::BitmapEx( const ResId& rResId ) :
const String aFileName( pResMgr->ReadString() );
::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
- if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this ) )
+ if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this, true ) )
{
#ifdef DBG_UTIL
ByteString aErrorStr( "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <" );
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
index db4cfdb..5dff935 100644
--- a/vcl/source/gdi/image.cxx
+++ b/vcl/source/gdi/image.cxx
@@ -44,6 +44,7 @@
#include <vcl/impimagetree.hxx>
#include <vcl/image.h>
#include <vcl/image.hxx>
+#include <vcl/imagerepository.hxx>
#if OSL_DEBUG_LEVEL > 0
#include <rtl/strbuf.hxx>
@@ -490,8 +491,6 @@ ImageList::ImageList( const ::std::vector< ::rtl::OUString >& rNameVector,
mpImplData->maPrefix = rPrefix;
for( sal_uInt32 i = 0; i < rNameVector.size(); ++i )
{
-// fprintf (stderr, "List %p [%d]: '%s'\n",
-// this, i, rtl::OUStringToOString( rNameVector[i], RTL_TEXTENCODING_UTF8 ).getStr() );
mpImplData->AddImage( rNameVector[ i ], static_cast< USHORT >( i ) + 1, BitmapEx() );
}
}
@@ -537,9 +536,6 @@ void ImageAryData::Load(const rtl::OUString &rPrefix)
BitmapEx aBmpEx;
-// fprintf (stderr, "Attempt load of '%s'\n",
-// rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
rtl::OUString aFileName = rPrefix;
aFileName += maName;
#if OSL_DEBUG_LEVEL > 0
@@ -616,8 +612,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
{
USHORT nItems = sal::static_int_cast< USHORT >( rNameVector.size() );
-// fprintf (stderr, "InsertFromHorizontalStrip (1) [%d items]\n", nItems);
-
if (!nItems)
return;
@@ -789,8 +783,6 @@ Image ImageList::GetImage( USHORT nId ) const
{
DBG_CHKTHIS( ImageList, NULL );
-// fprintf (stderr, "GetImage %d\n", nId);
-
Image aRet;
if( mpImplData )
@@ -809,6 +801,14 @@ Image ImageList::GetImage( USHORT nId ) const
}
}
+ if (!aRet)
+ {
+ BitmapEx rBitmap;
+ bool res = ::vcl::ImageRepository::loadDefaultImage(rBitmap);
+ if (res)
+ aRet = Image(rBitmap);
+ }
+
return aRet;
}
@@ -816,9 +816,6 @@ Image ImageList::GetImage( USHORT nId ) const
Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const
{
-// fprintf (stderr, "GetImage '%s'\n",
-// rtl::OUStringToOString( rImageName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
if( mpImplData )
{
ImageAryData *pImg = mpImplData->maNameHash[ rImageName ];
@@ -830,7 +827,6 @@ Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const
return Image( pImg->maBitmapEx );
}
}
-// fprintf (stderr, "no such image\n");
return Image();
}
@@ -979,9 +975,6 @@ Size ImageList::GetImageSize() const
aRet = mpImplData->maImageSize = aTmp.GetSizePixel();
}
}
-// fprintf (stderr, "GetImageSize returns %d, %d\n",
-// aRet.Width(), aRet.Height());
-
return aRet;
}
diff --git a/vcl/source/gdi/imagerepository.cxx b/vcl/source/gdi/imagerepository.cxx
index fa358c9..e1c8aac 100644
--- a/vcl/source/gdi/imagerepository.cxx
+++ b/vcl/source/gdi/imagerepository.cxx
@@ -42,12 +42,19 @@ namespace vcl
//= ImageRepository
//====================================================================
//--------------------------------------------------------------------
- bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent )
+ bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent, bool loadMissing )
{
::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
ImplImageTreeSingletonRef aImplImageTree;
- return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent );
+ return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent, loadMissing );
+ }
+
+ bool ImageRepository::loadDefaultImage( BitmapEx& _out_rImage)
+ {
+ ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
+ ImplImageTreeSingletonRef aImplImageTree;
+ return aImplImageTree->loadDefaultImage( sCurrentSymbolsStyle,_out_rImage);
}
//........................................................................
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 5bf567d..6ad214e 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -167,14 +167,23 @@ bool ImplImageTree::loadImage(
OSL_TRACE(
"ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png",
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
- found = doLoadImage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/missing_icon.png")),
- style, bitmap, false);
+ found = loadDefaultImage(style, bitmap);
} catch (css::uno::RuntimeException &) {
throw;
}
return found;
}
+bool ImplImageTree::loadDefaultImage(
+ rtl::OUString const & style,
+ BitmapEx& bitmap)
+{
+ return doLoadImage(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/grafikde.png")),
+ style, bitmap, false);
+}
+
+
bool ImplImageTree::doLoadImage(
rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
bool localized)
More information about the Libreoffice-commits
mailing list