summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-01-09 11:16:47 +0100
committerJan Holesovsky <kendy@suse.cz>2013-03-04 17:34:24 +0100
commit3803d8f135b573ccdd755cc406d85751595aacd1 (patch)
tree990ff0f0828d1cf87a5b18176b115c445f2f65ed /vcl
parente9799b83ca378c30b1bcc604a6f366638f0e5a68 (diff)
Personas: As Michael suggested, use BitmapEx instead of BitmapEx*.
Conflicts: vcl/inc/vcl/settings.hxx vcl/source/app/settings.cxx Change-Id: Ib1d84b37d452785d12502095c0eedaac4a25fb6b
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/settings.hxx10
-rw-r--r--vcl/source/app/settings.cxx36
-rw-r--r--vcl/source/window/dockingarea.cxx8
-rw-r--r--vcl/source/window/menu.cxx12
4 files changed, 29 insertions, 37 deletions
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index 44bcba45bc4f..67864832f012 100644
--- a/vcl/inc/vcl/settings.hxx
+++ b/vcl/inc/vcl/settings.hxx
@@ -32,13 +32,13 @@
#include "vcl/sv.h"
#include "vcl/dllapi.h"
#include "tools/color.hxx"
+#include "vcl/bitmapex.hxx"
#include "vcl/font.hxx"
#include "vcl/accel.hxx"
#include "vcl/wall.hxx"
#include "com/sun/star/lang/Locale.hpp"
#include <unotools/syslocale.hxx>
-class BitmapEx;
class CollatorWrapper;
class LocaleDataWrapper;
@@ -330,8 +330,8 @@ private:
rtl::OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes.
- BitmapEx* mpPersonaHeaderBitmap; ///< Cache the header bitmap.
- BitmapEx* mpPersonaFooterBitmap; ///< Cache the footer bitmap.
+ BitmapEx mpPersonaHeaderBitmap; ///< Cache the header bitmap.
+ BitmapEx mpPersonaFooterBitmap; ///< Cache the footer bitmap.
};
#define DEFAULT_WORKSPACE_GRADIENT_START_COLOR Color( 0xa3, 0xae, 0xb8 )
@@ -837,8 +837,8 @@ public:
void SetWorkspaceGradient( const Wallpaper& rWall )
{ CopyData(); mpData->maWorkspaceGradient = rWall; }
- const BitmapEx* GetPersonaHeader() const;
- const BitmapEx* GetPersonaFooter() const;
+ const BitmapEx GetPersonaHeader() const;
+ const BitmapEx GetPersonaFooter() const;
void SetStandardStyles();
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 79c8617d68e9..ace45ad3184e 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -43,7 +43,6 @@
#include "vcl/configsettings.hxx"
#include "vcl/gradient.hxx"
#include "vcl/unohelp.hxx"
-#include "vcl/bitmapex.hxx"
#include "unotools/fontcfg.hxx"
#include "unotools/localedatawrapper.hxx"
@@ -213,8 +212,8 @@ sal_Bool MouseSettings::operator ==( const MouseSettings& rSet ) const
ImplStyleData::ImplStyleData() :
maPersonaHeaderFooter(),
- mpPersonaHeaderBitmap( NULL ),
- mpPersonaFooterBitmap( NULL )
+ mpPersonaHeaderBitmap(),
+ mpPersonaFooterBitmap()
{
mnRefCount = 1;
mnScrollBarSize = 16;
@@ -312,8 +311,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maGroupFont( rData.maGroupFont ),
maWorkspaceGradient( rData.maWorkspaceGradient ),
maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
- mpPersonaHeaderBitmap( rData.mpPersonaHeaderBitmap? new BitmapEx( *rData.mpPersonaHeaderBitmap ): NULL ),
- mpPersonaFooterBitmap( rData.mpPersonaFooterBitmap? new BitmapEx( *rData.mpPersonaFooterBitmap ): NULL )
+ mpPersonaHeaderBitmap( rData.mpPersonaHeaderBitmap ),
+ mpPersonaFooterBitmap( rData.mpPersonaFooterBitmap )
{
mnRefCount = 1;
mnBorderSize = rData.mnBorderSize;
@@ -689,7 +688,7 @@ sal_Bool StyleSettings::GetUseImagesInMenus() const
// -----------------------------------------------------------------------
-static BitmapEx* readBitmapEx( const rtl::OUString& rPath )
+static BitmapEx readBitmapEx( const rtl::OUString& rPath )
{
rtl::OUString aPath( rPath );
rtl::Bootstrap::expandMacros( aPath );
@@ -697,19 +696,15 @@ static BitmapEx* readBitmapEx( const rtl::OUString& rPath )
// import the image
Graphic aGraphic;
if ( GraphicFilter::LoadGraphic( aPath, String(), aGraphic ) != GRFILTER_OK )
- return NULL;
+ return BitmapEx();
- const BitmapEx& rBitmap( aGraphic.GetBitmapEx() );
- if ( rBitmap.IsEmpty() )
- return NULL;
-
- return new BitmapEx( rBitmap );
+ return aGraphic.GetBitmapEx();
}
enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
/** Update the setting of the Persona header / footer in ImplStyleData */
-static void setupPersonaHeaderFooter( WhichPersona eWhich, rtl::OUString& /*rHeaderFooter*/, BitmapEx*& pHeaderFooterBitmap )
+static void setupPersonaHeaderFooter( WhichPersona eWhich, rtl::OUString& /*rHeaderFooter*/, BitmapEx& rHeaderFooterBitmap )
{
rtl::OUString aName;
switch ( eWhich ) {
@@ -717,9 +712,6 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, rtl::OUString& /*rHea
case PERSONA_FOOTER: aName = "footer.jpg"; break;
}
- delete pHeaderFooterBitmap;
- pHeaderFooterBitmap = NULL;
-
if ( !aName.isEmpty() )
{
// try the gallery first, then edition, and the program path if
@@ -728,21 +720,21 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, rtl::OUString& /*rHea
rtl::Bootstrap::expandMacros( gallery );
gallery += "/user/gallery/personas/";
- if ( !pHeaderFooterBitmap )
- pHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/program/edition/" + aName );
+ if ( rHeaderFooterBitmap.IsEmpty() )
+ rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/program/edition/" + aName );
- if ( !pHeaderFooterBitmap )
- pHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/program/" + aName );
+ if ( rHeaderFooterBitmap.IsEmpty() )
+ rHeaderFooterBitmap = readBitmapEx( "$BRAND_BASE_DIR/program/" + aName );
}
}
-const BitmapEx* StyleSettings::GetPersonaHeader() const
+const BitmapEx StyleSettings::GetPersonaHeader() const
{
setupPersonaHeaderFooter( PERSONA_HEADER, mpData->maPersonaHeaderFooter, mpData->mpPersonaHeaderBitmap );
return mpData->mpPersonaHeaderBitmap;
}
-const BitmapEx* StyleSettings::GetPersonaFooter() const
+const BitmapEx StyleSettings::GetPersonaFooter() const
{
setupPersonaHeaderFooter( PERSONA_FOOTER, mpData->maPersonaHeaderFooter, mpData->mpPersonaFooterBitmap );
return mpData->mpPersonaFooterBitmap;
diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx
index 3e4e9a786e56..33b1c22da6af 100644
--- a/vcl/source/window/dockingarea.cxx
+++ b/vcl/source/window/dockingarea.cxx
@@ -59,10 +59,10 @@ DockingAreaWindow::ImplData::~ImplData()
static void ImplInitBackground( DockingAreaWindow* pThis )
{
- const BitmapEx* pPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader();
- if ( pPersonaBitmap != NULL && pThis->GetAlign() == WINDOWALIGN_TOP )
+ const BitmapEx& rPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader();
+ if ( !rPersonaBitmap.IsEmpty() && pThis->GetAlign() == WINDOWALIGN_TOP )
{
- Wallpaper aWallpaper( *pPersonaBitmap );
+ Wallpaper aWallpaper( rPersonaBitmap );
aWallpaper.SetStyle( WALLPAPER_TOPRIGHT );
// we need to shift the bitmap vertically so that it spans over the
@@ -184,7 +184,7 @@ void DockingAreaWindow::Paint( const Rectangle& )
}
ControlState nState = CTRL_STATE_ENABLED;
- if ( GetAlign() == WINDOWALIGN_TOP && Application::GetSettings().GetStyleSettings().GetPersonaHeader() )
+ if ( GetAlign() == WINDOWALIGN_TOP && !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
Erase();
else if ( !ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB )
{
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index e7275bd98eee..66de4bfcc193 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3865,10 +3865,10 @@ static void ImplInitMenuWindow( Window* pWin, sal_Bool bFont, sal_Bool bMenuBar
pWin->SetPointFont( rStyleSettings.GetMenuFont() );
if( bMenuBar )
{
- const BitmapEx* pPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader();
- if ( pPersonaBitmap != NULL )
+ const BitmapEx& rPersonaBitmap = Application::GetSettings().GetStyleSettings().GetPersonaHeader();
+ if ( !rPersonaBitmap.IsEmpty() )
{
- Wallpaper aWallpaper( *pPersonaBitmap );
+ Wallpaper aWallpaper( rPersonaBitmap );
aWallpaper.SetStyle( WALLPAPER_TOPRIGHT );
pWin->SetBackground( aWallpaper );
pWin->SetPaintTransparent( sal_False );
@@ -5517,7 +5517,7 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight )
MenubarValue aControlValue;
aControlValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this );
- if ( Application::GetSettings().GetStyleSettings().GetPersonaHeader() )
+ if ( !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
Erase();
else
{
@@ -5553,7 +5553,7 @@ void MenuBarWindow::HighlightItem( sal_uInt16 nPos, sal_Bool bHighlight )
MenubarValue aMenubarValue;
aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this );
- if ( Application::GetSettings().GetStyleSettings().GetPersonaHeader() )
+ if ( !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
Erase( aRect );
else
{
@@ -5797,7 +5797,7 @@ void MenuBarWindow::Paint( const Rectangle& )
MenubarValue aMenubarValue;
aMenubarValue.maTopDockingAreaHeight = ImplGetTopDockingAreaHeight( this );
- if ( Application::GetSettings().GetStyleSettings().GetPersonaHeader() )
+ if ( !Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
Erase();
else
{