summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2012-09-22 18:38:56 +0000
committerAriel Constenla-Haile <arielch@apache.org>2012-09-22 18:38:56 +0000
commitcb99ad779d66d35e7f8539d44a7549df599f8efb (patch)
treef60b97b1e0afd45c0cf019b61f0eb17d47c2593e
parentfa12d0b3a7e876b543dab24919b07339bc20dff8 (diff)
#i119418# - About Dialog improvements
Notes
Notes: ignore: aoo
-rw-r--r--cui/source/dialogs/about.cxx95
-rw-r--r--cui/source/dialogs/about.hrc13
-rw-r--r--cui/source/dialogs/about.src5
-rw-r--r--cui/source/inc/about.hxx6
-rw-r--r--default_images/introabout/logo.png (renamed from default_images/res/orb.png)bin262991 -> 262991 bytes
-rw-r--r--desktop/zipintro/makefile.mk12
-rw-r--r--sd/source/ui/slideshow/slideshowimpl.cxx9
-rw-r--r--sfx2/inc/sfx2/app.hxx3
-rw-r--r--sfx2/source/appl/appmisc.cxx69
-rw-r--r--vcl/inc/vcl/imagerepository.hxx34
-rw-r--r--vcl/source/gdi/imagerepository.cxx80
11 files changed, 186 insertions, 140 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index f2533e52207a..b4da4b7a86bb 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -24,12 +24,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cui.hxx"
-#include <com/sun/star/uno/Any.h>
#include <comphelper/processfactory.hxx>
#include <dialmgr.hxx>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <sfx2/app.hxx>
#include <sfx2/sfxcommands.h>
#include <sfx2/sfxdefs.hxx>
#include <sfx2/sfxuno.hxx>
@@ -40,14 +38,16 @@
#include <unotools/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <vcl/graph.hxx>
+#include <vcl/imagerepository.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabpage.hxx>
-#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/uno/Any.h>
#include "about.hxx"
#include "about.hrc"
@@ -55,6 +55,26 @@
#define _STRINGIFY(x) #x
#define STRINGIFY(x) _STRINGIFY(x)
+/* On Windows/OS2, all the three files have .txt extension
+ and the README file name is in lowercase
+ Readme files are localized and have the locale in their file name:
+ README_de README_en-US
+*/
+#if defined(WNT) || defined(OS2)
+#define FILE_EXTENSION ".txt"
+#define README_FILE "readme"
+#else
+#define FILE_EXTENSION
+#define README_FILE "README"
+#endif
+#define LICENSE_FILE "LICENSE" FILE_EXTENSION
+#define NOTICE_FILE "NOTICE" FILE_EXTENSION
+
+// Dir where the files are located
+#define BRAND_DIR_SHARE_README "${BRAND_BASE_DIR}/share/readme/"
+
+using namespace com::sun::star;
+
namespace
{
@@ -198,12 +218,31 @@ namespace
maTabCtrl.Show();
- const rtl::OUString sReadme( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/README" ) );
- const rtl::OUString sLicense( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/program/LICENSE" ) );
- const rtl::OUString sNotice( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/program/NOTICE" ) );
+ // Notice and License are not localized
+ const rtl::OUString sLicense( RTL_CONSTASCII_USTRINGPARAM( BRAND_DIR_SHARE_README LICENSE_FILE ) );
+ const rtl::OUString sNotice( RTL_CONSTASCII_USTRINGPARAM( BRAND_DIR_SHARE_README NOTICE_FILE ) );
+
+ // get localized README
+ rtl::OUStringBuffer aBuff;
+ lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( BRAND_DIR_SHARE_README README_FILE "_" ) );
+ aBuff.append( aLocale.Language );
+ if ( aLocale.Country.getLength() )
+ {
+ aBuff.append( sal_Unicode( '-') );
+ aBuff.append( aLocale.Country );
+ if ( aLocale.Variant.getLength() )
+ {
+ aBuff.append( sal_Unicode( '-' ) );
+ aBuff.append( aLocale.Variant );
+ }
+ }
+#if defined(WNT) || defined(OS2)
+ aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( FILE_EXTENSION ) );
+#endif
rtl::OUString sReadmeTxt, sLicenseTxt, sNoticeTxt;
- lcl_readTxtFile( sReadme, sReadmeTxt );
+ lcl_readTxtFile( aBuff.makeStringAndClear(), sReadmeTxt );
lcl_readTxtFile( sLicense, sLicenseTxt );
lcl_readTxtFile( sNotice, sNoticeTxt );
@@ -248,11 +287,17 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) :
maBuildInfoEdit( this, ResId( RID_CUI_ABOUT_FTXT_BUILDDATA, *rId.GetResMgr() ) ),
maCopyrightEdit( this, ResId( RID_CUI_ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ),
maCreditsLink( this, ResId( RID_CUI_ABOUT_FTXT_WELCOME_LINK, *rId.GetResMgr() ) ),
- maMainLogo( ResId( RID_CUI_ABOUT_LOGO, *rId.GetResMgr() ) ),
maCopyrightTextStr( ResId( RID_CUI_ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) )
{
- // load image from module path
- maAppLogo = SfxApplication::GetApplicationLogo();
+ bool bLoad = vcl::ImageRepository::loadBrandingImage(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("about")),
+ maAppLogo );
+ OSL_ENSURE( bLoad, "Can't load about image");
+
+ bLoad = vcl::ImageRepository::loadBrandingImage(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logo")),
+ maMainLogo );
+ OSL_ENSURE( bLoad, "Can't load logo image");
InitControls();
@@ -302,8 +347,8 @@ void AboutDialog::ApplyStyleSettings()
// set for background and text the correct system color
const StyleSettings& rSettings = GetSettings().GetStyleSettings();
- Color aWhiteCol( rSettings.GetWindowColor() );
- Wallpaper aWall( aWhiteCol );
+ Color aWindowColor( rSettings.GetWindowColor() );
+ Wallpaper aWall( aWindowColor );
SetBackground( aWall );
Font aNewFont( maCopyrightEdit.GetFont() );
aNewFont.SetTransparent( sal_True );
@@ -311,10 +356,10 @@ void AboutDialog::ApplyStyleSettings()
maVersionText.SetFont( aNewFont );
maCopyrightEdit.SetFont( aNewFont );
- maVersionText.SetBackground();
- maCopyrightEdit.SetBackground();
- maBuildInfoEdit.SetBackground();
- maCreditsLink.SetBackground();
+ maVersionText.SetBackground(aWall);
+ maCopyrightEdit.SetBackground(aWall);
+ maBuildInfoEdit.SetBackground(aWall);
+ maCreditsLink.SetBackground(aWall);
Color aTextColor( rSettings.GetWindowTextColor() );
maVersionText.SetControlForeground( aTextColor );
@@ -487,21 +532,23 @@ IMPL_LINK ( AboutDialog, OpenLinkHdl_Impl, svt::FixedHyperlink*, EMPTYARG )
{
try
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMGR =
- ::comphelper::getProcessServiceFactory();
- com::sun::star::uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell(
- xSMGR->createInstance( ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ),
- com::sun::star::uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xContext =
+ ::comphelper::getProcessComponentContext();
+ uno::Reference< system::XSystemShellExecute > xSystemShell(
+ xContext->getServiceManager()->createInstanceWithContext(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ),
+ xContext ),
+ uno::UNO_QUERY_THROW );
if ( xSystemShell.is() )
- xSystemShell->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
+ xSystemShell->execute( sURL, rtl::OUString(), system::SystemShellExecuteFlags::DEFAULTS );
}
- catch( const com::sun::star::uno::Exception& e )
+ catch( const uno::Exception& e )
{
OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
}
}
+
return 0;
}
diff --git a/cui/source/dialogs/about.hrc b/cui/source/dialogs/about.hrc
index 4f41ead40a88..fa2cbfbc73e3 100644
--- a/cui/source/dialogs/about.hrc
+++ b/cui/source/dialogs/about.hrc
@@ -30,11 +30,10 @@
#define RID_CUI_ABOUT_FTXT_BUILDDATA 5
#define RID_CUI_ABOUT_STR_COPYRIGHT 6
#define RID_CUI_ABOUT_FTXT_WELCOME_LINK 7
-#define RID_CUI_ABOUT_LOGO 8
-#define RID_CUI_README_TBCTL 9
-#define RID_CUI_README_OKBTN 10
-#define RID_CUI_READMEPAGE 11
-#define RID_CUI_LICENSEPAGE 12
-#define RID_CUI_NOTICEPAGE 13
-#define RID_CUI_README_TBPAGE_EDIT 14
+#define RID_CUI_README_TBCTL 8
+#define RID_CUI_README_OKBTN 9
+#define RID_CUI_READMEPAGE 10
+#define RID_CUI_LICENSEPAGE 11
+#define RID_CUI_NOTICEPAGE 12
+#define RID_CUI_README_TBPAGE_EDIT 13
diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src
index 1f3098861bbf..e558fcb7bfb5 100644
--- a/cui/source/dialogs/about.src
+++ b/cui/source/dialogs/about.src
@@ -74,11 +74,6 @@ ModalDialog RID_DEFAULTABOUT
{
Text[ en-US ] = "Copyright © 2012 Apache Software Foundation.\nAll rights reserved.\n\nThis product was created by %OOOVENDOR, based on Apache OpenOffice.\nApache OpenOffice acknowledges all community members, especially those mentioned at";
};
-
- Image RID_CUI_ABOUT_LOGO
- {
- ImageBitmap = Bitmap { File = "orb.png"; };
- };
};
diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx
index 2e5658ffe569..21d233b4a783 100644
--- a/cui/source/inc/about.hxx
+++ b/cui/source/inc/about.hxx
@@ -44,12 +44,12 @@ private:
MultiLineEdit maCopyrightEdit;
svt::FixedHyperlink maCreditsLink;
- Image maMainLogo;
- Image maAppLogo;
-
String maCopyrightTextStr;
rtl::OUString maVersionData;
+ Image maMainLogo;
+ Image maAppLogo;
+
void InitControls();
void ApplyStyleSettings();
void LayoutControls( Size& aDlgSize );
diff --git a/default_images/res/orb.png b/default_images/introabout/logo.png
index bb8a6ecff884..bb8a6ecff884 100644
--- a/default_images/res/orb.png
+++ b/default_images/introabout/logo.png
Binary files differ
diff --git a/desktop/zipintro/makefile.mk b/desktop/zipintro/makefile.mk
index 7b6916073d7c..2db5c491d548 100644
--- a/desktop/zipintro/makefile.mk
+++ b/desktop/zipintro/makefile.mk
@@ -33,16 +33,20 @@ DEFAULT_FLAVOURS=dev dev_nologo nologo intro
ZIP1LIST= \
$(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev$/introabout$/intro.png $(INTRO_BITMAPS)) \
- $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS))
+ $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) \
+ $(MISC)$/$(RSCDEFIMG)$/introabout$/logo.png
ZIP2LIST= \
$(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \
- $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS))
+ $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) \
+ $(MISC)$/$(RSCDEFIMG)$/introabout$/logo.png
ZIP3LIST= \
$(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \
- $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS))
+ $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) \
+ $(MISC)$/$(RSCDEFIMG)$/introabout$/logo.png
ZIP4LIST= \
$(null,$(INTRO_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/intro.png $(INTRO_BITMAPS)) \
- $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS))
+ $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) \
+ $(MISC)$/$(RSCDEFIMG)$/introabout$/logo.png
ZIP1TARGET=dev_intro
ZIP1DEPS=$(ZIP1LIST)
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index bb737d9ff36e..4eaad6d13341 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -48,7 +48,6 @@
#include <sfx2/imagemgr.hxx>
#include <sfx2/request.hxx>
#include <sfx2/docfile.hxx>
-#include <sfx2/app.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdoole2.hxx>
@@ -82,6 +81,7 @@
#include "canvas/prioritybooster.hxx"
#include "avmedia/mediawindow.hxx"
#include "svtools/colrdlg.hxx"
+#include <vcl/imagerepository.hxx>
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
@@ -3322,7 +3322,12 @@ void SAL_CALL SlideshowImpl::gotoNextSlide( ) throw (RuntimeException)
{
if ( maPresSettings.mbShowPauseLogo )
{
- Graphic aGraphic( SfxApplication::GetApplicationLogo().GetBitmapEx() );
+ Image aImage;
+ bool bLoad = vcl::ImageRepository::loadBrandingImage(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "logo" ) ),
+ aImage );
+ OSL_ENSURE( bLoad, "Can't load logo image");
+ Graphic aGraphic(aImage.GetBitmapEx());
mpShowWindow->SetPauseMode( 0, maPresSettings.mnPauseTimeout, &aGraphic );
}
else
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index 1042b6d7c3a7..3dc1e914050f 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -306,9 +306,6 @@ public:
SAL_DLLPRIVATE SfxModule* GetModule_Impl();
SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl();
//#endif
-
- /** loads the application logo as used in the about dialog and impress slideshow pause screen */
- static Image GetApplicationLogo();
};
#define SFX_APP() SfxGetpApp()
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index dd357458ce9e..a2faa56f6345 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -283,72 +283,3 @@ SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->p
SfxSlotPool& SfxApplication::GetAppSlotPool_Impl() const { return *pAppData_Impl->pSlotPool; }
//SfxOptions& SfxApplication::GetOptions() { return *pAppData_Impl->pOptions; }
//const SfxOptions& SfxApplication::GetOptions() const { return *pAppData_Impl->pOptions; }
-
-static bool impl_loadBitmap(
- const rtl::OUString &rPath, const rtl::OUString &rBmpFileName,
- Image &rLogo )
-{
- rtl::OUString uri( rPath );
- rtl::Bootstrap::expandMacros( uri );
- INetURLObject aObj( uri );
- aObj.insertName( rBmpFileName );
- SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
- if ( !aStrm.GetError() )
- {
- // Use graphic class to also support more graphic formats (bmp,png,...)
- Graphic aGraphic;
-
- GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
- pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW );
-
- // Default case, we load the intro bitmap from a seperate file
- // (e.g. staroffice_intro.bmp or starsuite_intro.bmp)
- BitmapEx aBmp = aGraphic.GetBitmapEx();
- rLogo = Image( aBmp );
- return true;
- }
- return false;
-}
-
-/** loads the application logo as used in the about dialog and impress slideshow pause screen */
-Image SfxApplication::GetApplicationLogo()
-{
- Image aAppLogo;
-
- rtl::OUString aAbouts;
- bool bLoaded = false;
- sal_Int32 nIndex = 0;
- do
- {
- bLoaded = impl_loadBitmap(
- rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ),
- aAbouts.getToken( 0, ',', nIndex ), aAppLogo );
- }
- while ( !bLoaded && ( nIndex >= 0 ) );
-
- // fallback to "about.bmp"
- if ( !bLoaded )
- {
- bLoaded = impl_loadBitmap(
- rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ),
- rtl::OUString::createFromAscii( "about.png" ), aAppLogo );
- if ( !bLoaded )
- bLoaded = impl_loadBitmap(
- rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ),
- rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo );
- }
-
- if ( !bLoaded )
- {
- bLoaded = impl_loadBitmap(
- rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ),
- rtl::OUString::createFromAscii( "about.png" ), aAppLogo );
- if ( !bLoaded )
- bLoaded = impl_loadBitmap(
- rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ),
- rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo );
- }
-
- return aAppLogo;
-}
-
diff --git a/vcl/inc/vcl/imagerepository.hxx b/vcl/inc/vcl/imagerepository.hxx
index cef9d43a7ed0..82934c794299 100644
--- a/vcl/inc/vcl/imagerepository.hxx
+++ b/vcl/inc/vcl/imagerepository.hxx
@@ -28,16 +28,15 @@
#include <rtl/ustring.hxx>
class BitmapEx;
+class Image;
-//........................................................................
namespace vcl
{
-//........................................................................
- //====================================================================
- //= ImageRepository
- //====================================================================
- // provides access to the application's image repository (image.zip)
+ /**
+ provides access to the application's image repository
+ (packed images and brand images)
+ */
class VCL_DLLPUBLIC ImageRepository
{
public:
@@ -56,11 +55,26 @@ namespace vcl
BitmapEx& _out_rImage,
bool bSearchLanguageDependent
);
- };
-//........................................................................
-} // namespace vcl
-//........................................................................
+ /** load an image from the application's branding directory
+
+ @param rName
+ the name of the image to load, without extension
+ @param rImage
+ will take the image upon successful return.
+ @param bIgnoreHighContrast
+ if true, high contrast mode is not taken into account when
+ searching for the image
+ @param bSearchLanguageDependent
+ determines whether a language-dependent image is to be searched.
+ */
+ static bool loadBrandingImage(
+ const rtl::OUString &rName,
+ Image &rImage,
+ bool bSearchLanguageDependent = false
+ );
+ };
+}
#endif // VCL_IMAGEREPOSITORY_HXX
diff --git a/vcl/source/gdi/imagerepository.cxx b/vcl/source/gdi/imagerepository.cxx
index b21a7ea02b37..56ebfbbfaaa7 100644
--- a/vcl/source/gdi/imagerepository.cxx
+++ b/vcl/source/gdi/imagerepository.cxx
@@ -27,27 +27,81 @@
#include <vcl/bitmapex.hxx>
#include <vcl/imagerepository.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/image.hxx>
+#include <vcl/pngread.hxx>
+#include <rtl/bootstrap.hxx>
+#include <tools/stream.hxx>
+#include <tools/urlobj.hxx>
#include "impimagetree.hxx"
-//........................................................................
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 )
{
- ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
+ ::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 );
+ }
+
+
+ static bool lcl_loadPNG( const rtl::OUString &rPath,
+ const rtl::OUString &rImageFileName,
+ Image &rImage )
+ {
+ INetURLObject aObj( rPath );
+ aObj.insertName( rImageFileName );
+ SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
+ if ( !aStrm.GetError() )
+ {
+ PNGReader aReader( aStrm );
+ BitmapEx aBmp = aReader.Read();
+ rImage = Image( aBmp );
+
+ return true;
+ }
+
+ return false;
}
-//........................................................................
-} // namespace vcl
-//........................................................................
+ /* TODO support bSearchLanguageDependent */
+ bool ImageRepository::loadBrandingImage( const rtl::OUString &rName,
+ Image &rImage,
+ bool /* bSearchLanguageDependent */ )
+ {
+ rtl::OUString sImages;
+ rtl::OUStringBuffer aBuff( rName );
+ rtl::OUString aBasePath( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/program" ) );
+ rtl::Bootstrap::expandMacros( aBasePath );
+
+ bool bLoaded = false;
+ sal_Int32 nIndex = 0;
+
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( "_hc.png," ) );
+ aBuff.append( rName );
+ }
+ aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( ".png" ) );
+ sImages = aBuff.makeStringAndClear();
+
+ do
+ {
+ bLoaded = lcl_loadPNG( aBasePath,
+ sImages.getToken( 0, ',', nIndex ),
+ rImage );
+ }
+ while ( !bLoaded && ( nIndex >= 0 ) );
+
+ return bLoaded;
+ }
+}