summaryrefslogtreecommitdiff
path: root/sfx2/source/toolbox/imgmgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/toolbox/imgmgr.cxx')
-rw-r--r--sfx2/source/toolbox/imgmgr.cxx140
1 files changed, 62 insertions, 78 deletions
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index 791798b2e9..1055467ee4 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -1,10 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* This file is part of OpenOffice.org.
*
@@ -44,14 +45,9 @@
#include <tools/rcid.h>
#include <tools/link.hxx>
#include <svtools/miscopt.hxx>
-#include <vos/mutex.hxx>
-
-#ifndef GCC
-#endif
+#include <osl/mutex.hxx>
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
#include <comphelper/processfactory.hxx>
-#endif
const sal_uInt32 IMAGELIST_COUNT = 4; // small, small-hi, large, large-hi
@@ -70,14 +66,14 @@ public:
ImageList* m_pImageList[IMAGELIST_COUNT];
SfxModule* m_pModule;
- ImageList* GetImageList( BOOL bBig, BOOL bHiContrast );
- Image GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast );
+ ImageList* GetImageList( BOOL bBig );
+ Image GetImage( USHORT nId, BOOL bBig );
void SetSymbolsSize_Impl( sal_Int16 );
-
+
DECL_LINK( OptionsChanged_Impl, void* );
DECL_LINK( SettingsChanged_Impl, void* );
-
+
SfxImageManager_Impl( SfxModule* pModule );
~SfxImageManager_Impl();
};
@@ -88,14 +84,10 @@ typedef std::hash_map< sal_Int64, sal_Int64 > SfxImageManagerMap;
static SfxImageManager_Impl* pGlobalImageManager = 0;
static SfxImageManagerMap m_ImageManager_ImplMap;
static SfxImageManagerMap m_ImageManagerMap;
-static ImageList* pImageListSmall=0;
-static ImageList* pImageListBig=0;
-static ImageList* pImageListHiSmall=0;
-static ImageList* pImageListHiBig=0;
static SfxImageManager_Impl* GetImageManager( SfxModule* pModule )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
if ( pModule == 0 )
{
@@ -112,9 +104,9 @@ static SfxImageManager_Impl* GetImageManager( SfxModule* pModule )
else
{
pImpl = new SfxImageManager_Impl( pModule );
- m_ImageManager_ImplMap.insert(
- SfxImageManagerMap::value_type(
- sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )),
+ m_ImageManager_ImplMap.insert(
+ SfxImageManagerMap::value_type(
+ sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )),
sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pImpl )) ));
}
return pImpl;
@@ -122,40 +114,32 @@ static SfxImageManager_Impl* GetImageManager( SfxModule* pModule )
}
// Global image list
-static ImageList* GetImageList( BOOL bBig, BOOL bHiContrast )
+static ImageList* GetImageList( BOOL bBig )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- // Has to be changed if we know how the IDs are named!!!
- ImageList*& rpList = bBig ? ( bHiContrast ? pImageListHiBig : pImageListBig ) :
- ( bHiContrast ? pImageListHiSmall : pImageListSmall );
- if ( !rpList )
- {
- ResMgr *pResMgr = SfxApplication::GetOrCreate()->GetOffResManager_Impl();
+ SolarMutexGuard aGuard;
+ ImageList* rpList = NULL;
- ResId aResId( bBig ? ( bHiContrast ? RID_DEFAULTIMAGELIST_LCH : RID_DEFAULTIMAGELIST_LC ) :
- ( bHiContrast ? RID_DEFAULTIMAGELIST_SCH : RID_DEFAULTIMAGELIST_SC ), *pResMgr);
+ ResMgr *pResMgr = SfxApplication::GetOrCreate()->GetOffResManager_Impl();
- aResId.SetRT( RSC_IMAGELIST );
+ ResId aResId( bBig ? ( RID_DEFAULTIMAGELIST_LC ) : ( RID_DEFAULTIMAGELIST_SC ), *pResMgr);
- DBG_ASSERT( pResMgr->IsAvailable(aResId), "No default ImageList!" );
+ aResId.SetRT( RSC_IMAGELIST );
- if ( pResMgr->IsAvailable(aResId) )
- rpList = new ImageList( aResId );
- else
- rpList = new ImageList();
- }
+ DBG_ASSERT( pResMgr->IsAvailable(aResId), "No default ImageList!" );
+
+ if ( pResMgr->IsAvailable(aResId) )
+ rpList = new ImageList( aResId );
+ else
+ rpList = new ImageList();
return rpList;
}
-static sal_Int16 impl_convertBools( sal_Bool bLarge, sal_Bool bHiContrast )
+static sal_Int16 impl_convertBools( sal_Bool bLarge )
{
sal_Int16 nIndex( 0 );
if ( bLarge )
nIndex += 1;
- if ( bHiContrast )
- nIndex += 2;
return nIndex;
}
@@ -185,25 +169,25 @@ SfxImageManager_Impl::~SfxImageManager_Impl()
//-------------------------------------------------------------------------
-ImageList* SfxImageManager_Impl::GetImageList( BOOL bBig, BOOL bHiContrast )
+ImageList* SfxImageManager_Impl::GetImageList( BOOL bBig )
{
- sal_Int32 nIndex = impl_convertBools( bBig, bHiContrast );
+ sal_Int32 nIndex = impl_convertBools( bBig );
if ( !m_pImageList[nIndex] )
{
if ( !m_pModule )
- m_pImageList[nIndex] = ::GetImageList( bBig, bHiContrast );
+ m_pImageList[nIndex] = ::GetImageList( bBig );
else
- m_pImageList[nIndex] = m_pModule->GetImageList_Impl( bBig, bHiContrast );
+ m_pImageList[nIndex] = m_pModule->GetImageList_Impl( bBig );
}
-
+
return m_pImageList[nIndex];
}
//-------------------------------------------------------------------------
-Image SfxImageManager_Impl::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast )
+Image SfxImageManager_Impl::GetImage( USHORT nId, BOOL bBig )
{
- ImageList* pImageList = GetImageList( bBig, bHiContrast );
+ ImageList* pImageList = GetImageList( bBig );
if ( pImageList )
return pImageList->GetImage( nId );
return Image();
@@ -213,8 +197,8 @@ Image SfxImageManager_Impl::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast )
void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+ SolarMutexGuard aGuard;
+
if ( nNewSymbolsSize != m_nSymbolsSize )
{
m_nSymbolsSize = nNewSymbolsSize;
@@ -226,14 +210,13 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
if ( pInf->nFlags & SFX_TOOLBOX_CHANGESYMBOLSET )
{
ToolBox *pBox = pInf->pToolBox;
- BOOL bHiContrast = pBox->GetSettings().GetStyleSettings().GetHighContrastMode();
USHORT nCount = pBox->GetItemCount();
for ( USHORT nPos=0; nPos<nCount; nPos++ )
{
USHORT nId = pBox->GetItemId( nPos );
if ( pBox->GetItemType(nPos) == TOOLBOXITEM_BUTTON )
{
- pBox->SetItemImage( nId, GetImage( nId, bLarge, bHiContrast ) );
+ pBox->SetItemImage( nId, GetImage( nId, bLarge ) );
SfxStateCache *pCache = SfxViewFrame::Current()->GetBindings().GetStateCache( nId );
if ( pCache )
pCache->SetCachedState();
@@ -250,8 +233,8 @@ void SfxImageManager_Impl::SetSymbolsSize_Impl( sal_Int16 nNewSymbolsSize )
aSize.Height() = aActSize.Height();
pBox->SetSizePixel( aSize );
- }
- }
+ }
+ }
}
}
}
@@ -294,17 +277,17 @@ SfxImageManager::~SfxImageManager()
SfxImageManager* SfxImageManager::GetImageManager( SfxModule* pModule )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- SfxImageManagerMap::const_iterator pIter =
+ SolarMutexGuard aGuard;
+
+ SfxImageManagerMap::const_iterator pIter =
m_ImageManagerMap.find( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )));
if ( pIter != m_ImageManagerMap.end() )
return reinterpret_cast< SfxImageManager* >( sal::static_int_cast< sal_IntPtr >( pIter->second ));
else
{
SfxImageManager* pSfxImageManager = new SfxImageManager( pModule );
- m_ImageManagerMap.insert( SfxImageManagerMap::value_type(
- sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )),
+ m_ImageManagerMap.insert( SfxImageManagerMap::value_type(
+ sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pModule )),
sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( pSfxImageManager )) ));
return pSfxImageManager;
}
@@ -312,9 +295,9 @@ SfxImageManager* SfxImageManager::GetImageManager( SfxModule* pModule )
//-------------------------------------------------------------------------
-Image SfxImageManager::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast ) const
+Image SfxImageManager::GetImage( USHORT nId, BOOL bBig ) const
{
- ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast );
+ ImageList* pImageList = pImp->GetImageList( bBig );
if ( pImageList && pImageList->HasImageAtPos( nId ) )
return pImageList->GetImage( nId );
return Image();
@@ -322,23 +305,23 @@ Image SfxImageManager::GetImage( USHORT nId, BOOL bBig, BOOL bHiContrast ) const
//-------------------------------------------------------------------------
-Image SfxImageManager::GetImage( USHORT nId, BOOL bHiContrast ) const
+Image SfxImageManager::GetImage( USHORT nId ) const
{
BOOL bLarge = SvtMiscOptions().AreCurrentSymbolsLarge();
- return GetImage( nId, bLarge, bHiContrast );
+ return GetImage( nId, bLarge );
}
//-------------------------------------------------------------------------
-Image SfxImageManager::SeekImage( USHORT nId, BOOL bBig, BOOL bHiContrast ) const
+Image SfxImageManager::SeekImage( USHORT nId, BOOL bBig ) const
{
sal_Bool bGlobal = ( pImp->m_pModule == 0 );
- ImageList* pImageList = pImp->GetImageList( bBig, bHiContrast );
+ ImageList* pImageList = pImp->GetImageList( bBig );
if ( pImageList && pImageList->HasImageAtPos( nId ) )
return pImageList->GetImage( nId );
else if ( !bGlobal )
{
- pImageList = ::GetImageManager( 0 )->GetImageList( bBig, bHiContrast );
+ pImageList = ::GetImageManager( 0 )->GetImageList( bBig );
if ( pImageList )
return pImageList->GetImage( nId );
}
@@ -347,18 +330,18 @@ Image SfxImageManager::SeekImage( USHORT nId, BOOL bBig, BOOL bHiContrast ) cons
//-------------------------------------------------------------------------
-Image SfxImageManager::SeekImage( USHORT nId, BOOL bHiContrast ) const
+Image SfxImageManager::SeekImage( USHORT nId ) const
{
BOOL bLarge = SvtMiscOptions().AreCurrentSymbolsLarge();
- return SeekImage( nId, bLarge, bHiContrast );
+ return SeekImage( nId, bLarge );
}
//-------------------------------------------------------------------------
void SfxImageManager::RegisterToolBox( ToolBox *pBox, USHORT nFlags )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+ SolarMutexGuard aGuard;
+
ToolBoxInf_Impl* pInf = new ToolBoxInf_Impl;
pInf->pToolBox = pBox;
pInf->nFlags = nFlags;
@@ -369,8 +352,8 @@ void SfxImageManager::RegisterToolBox( ToolBox *pBox, USHORT nFlags )
void SfxImageManager::ReleaseToolBox( ToolBox *pBox )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+ SolarMutexGuard aGuard;
+
for ( sal_uInt32 n=0; n < pImp->m_aToolBoxes.size(); n++ )
{
if ((pImp->m_aToolBoxes[n])->pToolBox == pBox )
@@ -384,17 +367,17 @@ void SfxImageManager::ReleaseToolBox( ToolBox *pBox )
//-------------------------------------------------------------------------
-void SfxImageManager::SetImages( ToolBox& rToolBox, BOOL bHiContrast, BOOL bLarge )
+void SfxImageManager::SetImages( ToolBox& rToolBox, BOOL bLarge )
{
- SetImagesForceSize( rToolBox, bLarge, bHiContrast );
+ SetImagesForceSize( rToolBox, bLarge );
}
//-------------------------------------------------------------------------
-void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, BOOL bHiContrast, BOOL bLarge )
+void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, BOOL bLarge )
{
- ImageList* pImageList = pImp->GetImageList( bLarge, bHiContrast );
-
+ ImageList* pImageList = pImp->GetImageList( bLarge );
+
USHORT nCount = rToolBox.GetItemCount();
for (USHORT n=0; n<nCount; n++)
{
@@ -421,6 +404,7 @@ void SfxImageManager::SetImagesForceSize( ToolBox& rToolBox, BOOL bHiContrast, B
void SfxImageManager::SetImages( ToolBox& rToolBox )
{
BOOL bLarge = ( pImp->m_nSymbolsSize == SFX_SYMBOLS_SIZE_LARGE );
- BOOL bHiContrast = rToolBox.GetSettings().GetStyleSettings().GetHighContrastMode();
- SetImagesForceSize( rToolBox, bHiContrast, bLarge );
+ SetImagesForceSize( rToolBox, bLarge );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */