Hi everybody,
Here is another patch for the duplicate icons task.
On 11/25/2010 02:18 PM, Michael Meeks wrote:
On Tue, 2010-11-23 at 22:04 +0100, Joachim Trémouroux wrote:
I have looked at the calling places. The ImplImageTree::loadImage
method is called here:
vcl/source/gdi/bitmapex.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/imagerepository.cxx
Right; we should clearly clobber the BitmapEx constructor from a
ResId
- since this is just grabbing a path from a resource file - to load the
missing icon if it is not there.
I have modified BitmapEx in the attached patch
Where ImageList::GetImage is called
from, I don't know, we should audit that too.
g grep "vcl/image.hxx" | wc -l returns 179 lines...
I guess I need more time to check this ;-)
ImageRepository::loadImage is called in
libs-gui/svtools/source/graphic/provider.cxx (method
GraphicProvider::queryGraphicDescriptor)
itself called in components/cui/source/customize/cfg.cxx
and in impress/sd/source/filter/grf/sdgrffilter.cxx
Right - this badly needs the return value; perhaps we should add the
loadMissing parameter - and default to false on the ImageRepository
class as well.
Done.
libs-gui/toolkit/source/layout/core/helper.cxx (method
layoutimpl::loadGraphic)
itself called in toolkit/source/awt/vclxbutton.cxx
and in toolkit/source/layout/vcl/wbutton.cxx
This should be substituting missing icons.
Done in helper.cxx
Wrt. testing, I would try adding a custom item / icon to a toolbar
and
then editing the file to rename the icon named (so it doesn't exist),
and re-loading [ prolly easiest if saved as flat-XML ? ] to see if we
get the right behaviour with the missing icon code there (?).
Is there a tutorial somewhere? It doesn't look so obvious to me...
I have tried to rename an icon in a existing .xhp file but I still see the
correct icon. Not sure I have modified the correct file
Attached patch is LGPLv3+/MPL.
As suggested by Andrew I have used an existing icon for the fallback icon.
I'll continue with auditing the usage of vcl/image.hxx. And of course a bit
of testing.
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/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..c51b3c6 100644
--- a/vcl/inc/vcl/imagerepository.hxx
+++ b/vcl/inc/vcl/imagerepository.hxx
@@ -59,7 +59,8 @@ namespace vcl
static bool loadImage(
const ::rtl::OUString& _rName,
BitmapEx& _out_rImage,
- bool bSearchLanguageDependent
+ bool bSearchLanguageDependent,
+ bool loadMissing = false
);
};
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..416bc88 100644
--- a/vcl/source/gdi/imagerepository.cxx
+++ b/vcl/source/gdi/imagerepository.cxx
@@ -42,12 +42,12 @@ 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 );
}
//........................................................................
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 5bf567d..61fb625 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -165,9 +165,9 @@ bool ImplImageTree::loadImage(
try {
OSL_TRACE(
- "ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png",
+ "ImplImageTree::loadImage exception couldn't load \"%s\", fetching res/grafikde.png",
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
- found = doLoadImage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/missing_icon.png")),
+ found = doLoadImage( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/grafikde.png")),
style, bitmap, false);
} catch (css::uno::RuntimeException &) {
throw;
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.