Hi everybody,
On 11/26/2010 08:42 PM, Michael Meeks wrote:
Where ImageList::GetImage is called
from, I don't know, we should audit that too...
...
$ grep _ZNK9ImageList8GetImageERKN3rtl8OUStringE */unxlngi6.pro/slo/*
Binary file framework/unxlngi6.pro/slo/imagemanagerimpl.o matches
Binary file sfx2/unxlngi6.pro/slo/imgmgr.o matches
Binary file sfx2/unxlngi6.pro/slo/module.o matches
Binary file sfx2/unxlngi6.pro/slo/styfitem.o matches
Binary file sfx2/unxlngi6.pro/slo/templdlg.o matches
Binary file vcl/unxlngi6.pro/slo/image.o matches
And we have five real hits :-) of course, we need to find the relevant
modules that produced those object files - but hopefully it narrows it
down a bit ?
Nice trick! It reminds me things I used to perform a few years ago. 5
years programming in Java makes a man lazy...
Ok, on my side I have more hits, don't know why.
$ grep _ZNK9ImageList8GetImageERKN3rtl8OUStringE */unxlngx6.pro/slo/* |
wc -l
-> 95 matches...
I concentrated in this one:
framework/unxlngi6.pro/slo/imagemanagerimpl.o as it looks used by some
central configuration code:
From the opengrok site, ImageManagerImpl is used in
- ImageManager, used in UIConfigurationManager.
- ModuleImageManager, used in UIModuleConfigurationManager.
This piece of code is called to load icons related to toolbars.
The patch attached allows to fallback on a default icon for a toolbar item.
Here is the test I have done:
Add the 'About Libre Office' entry to the standard toolbar, using an
existing icon.
in ~/.libreoffice/.../lc_imagelist.xml there is the following entry:
<image:entry image:bitmap-index="0" image:command=".uno:About"/>
I replace .uno:About by .uno:AboutFoo, I restart soffice and the default
icon is now loaded for the About button :-)
So basic scenario looks ok. Some other tests I should do?
Regards,
Joachim.
diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx
index 1a09d86..d2fa1fe 100644
--- a/sd/source/ui/view/viewoverlaymanager.cxx
+++ b/sd/source/ui/view/viewoverlaymanager.cxx
@@ -45,7 +45,6 @@
#include <tools/rcid.h>
#include <vcl/help.hxx>
-#include <vcl/imagerepository.hxx>
#include <vcl/lazydelete.hxx>
#include <svx/sdrpagewindow.hxx>
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx
b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index fabf676..5cfa9d1 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -63,6 +63,8 @@
#include <rtl/logfile.hxx>
#include "svtools/miscopt.hxx"
+#include "vcl/imagerepository.hxx"
+
//_________________________________________________________________________________________________________________
// namespaces
//_________________________________________________________________________________________________________________
@@ -322,7 +324,6 @@ Image CmdImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUS
ImageList* pImageList = impl_getImageList( nImageType );
return pImageList->GetImage( pIter->second );
}
-
return Image();
}
@@ -361,7 +362,17 @@ GlobalImageList::~GlobalImageList()
Image GlobalImageList::getImageFromCommandURL( sal_Int16 nImageType, const rtl::OUString&
rCommandURL )
{
osl::MutexGuard guard( getGlobalImageListMutex() );
- return CmdImageList::getImageFromCommandURL( nImageType, rCommandURL );
+ Image aImage = CmdImageList::getImageFromCommandURL( nImageType, rCommandURL );
+
+ if (!aImage)
+ {
+ BitmapEx rBitmap;
+ bool res = ::vcl::ImageRepository::loadDefaultImage(rBitmap);
+ if (res) {
+ aImage = Image(rBitmap);
+ }
+ }
+ return aImage;
}
bool GlobalImageList::hasImage( sal_Int16 nImageType, const rtl::OUString& rCommandURL )
@@ -953,8 +964,9 @@ throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno:
if ( !aImage && m_bUseGlobal )
{
aImage = pDefaultImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
- if ( !aImage )
+ if ( !aImage ) {
aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
+ }
}
aGraphSeq[n] = aImage.GetXGraphic();
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/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)
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.