Move hasBigImages() from ToolboxController to SfxToolBoxController.

We want to decide whether the images are big or not based on the real
(underlying) ToolBox, not on the global setting, because we can have both
toolbars with large as well as small icons visible at the same time (small in
sidebar, large in toolbars).

Change-Id: I046a12a495f2038df9a571f5779794a639bae6dc
This commit is contained in:
Jan Holesovsky
2013-07-16 16:12:48 +02:00
parent 7cfd340e92
commit 8c69fcd6eb
7 changed files with 16 additions and 34 deletions

View File

@@ -200,8 +200,6 @@ namespace dbaui
Reference<XUIConfigurationManager> xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( OUString("com.sun.star.sdb.OfficeDatabaseDocument") ); Reference<XUIConfigurationManager> xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( OUString("com.sun.star.sdb.OfficeDatabaseDocument") );
Reference<XImageManager> xImageMgr(xUIConfigMgr->getImageManager(),UNO_QUERY); Reference<XImageManager> xImageMgr(xUIConfigMgr->getImageManager(),UNO_QUERY);
short nImageType = hasBigImages() ? ImageType::SIZE_LARGE : ImageType::SIZE_DEFAULT;
Sequence< OUString> aSeq(1); Sequence< OUString> aSeq(1);
sal_uInt16 nCount = pMenu->GetItemCount(); sal_uInt16 nCount = pMenu->GetItemCount();
for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos)
@@ -211,7 +209,7 @@ namespace dbaui
sal_uInt16 nItemId = pMenu->GetItemId(nPos); sal_uInt16 nItemId = pMenu->GetItemId(nPos);
aSeq[0] = pMenu->GetItemCommand(nItemId); aSeq[0] = pMenu->GetItemCommand(nItemId);
Sequence< Reference<XGraphic> > aImages = xImageMgr->getImages(nImageType,aSeq); Sequence< Reference<XGraphic> > aImages = xImageMgr->getImages(ImageType::SIZE_DEFAULT, aSeq);
Image aImage(aImages[0]); Image aImage(aImages[0]);
pMenu->SetItemImage(nItemId,aImage); pMenu->SetItemImage(nItemId,aImage);

View File

@@ -252,6 +252,7 @@ protected:
// helper methods // helper methods
void createAndPositionSubToolBar( const OUString& rSubToolBarResName ); void createAndPositionSubToolBar( const OUString& rSubToolBarResName );
::Size getPersistentFloatingSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& rSubToolBarResName ); ::Size getPersistentFloatingSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& rSubToolBarResName );
bool hasBigImages() const;
public: public:
SFX_DECL_TOOLBOX_CONTROL(); SFX_DECL_TOOLBOX_CONTROL();

View File

@@ -158,7 +158,6 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
void bindListener(); void bindListener();
void unbindListener(); void unbindListener();
sal_Bool isBound() const; sal_Bool isBound() const;
sal_Bool hasBigImages() const;
// TODO remove // TODO remove
::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const; ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const;
// TODO remove // TODO remove

View File

@@ -773,6 +773,11 @@ throw (::com::sun::star::uno::RuntimeException)
return aToolboxSize; return aToolboxSize;
} }
bool SfxToolBoxControl::hasBigImages() const
{
return (GetToolBox().GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE);
}
void SfxToolBoxControl::createAndPositionSubToolBar( const OUString& rSubToolBarResName ) void SfxToolBoxControl::createAndPositionSubToolBar( const OUString& rSubToolBarResName )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;

View File

@@ -634,11 +634,6 @@ sal_Bool ToolboxController::isBound() const
return sal_False; return sal_False;
} }
sal_Bool ToolboxController::hasBigImages() const
{
return SvtMiscOptions().AreCurrentSymbolsLarge();
}
void ToolboxController::updateStatus() void ToolboxController::updateStatus()
{ {
bindListener(); bindListener();

View File

@@ -153,21 +153,12 @@ OUString SAL_CALL SvxTbxCtlCustomShapes::getSubToolbarName() throw (::com::sun::
void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException) void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException)
{ {
// remind the new command // remember the new command
m_aCommand = rCommand; m_aCommand = rCommand;
// Our sub-toolbar wants to execute a function. // Our sub-toolbar wants to execute a function.
// We have to change the image of our toolbar button to reflect the new function. // We have to change the image of our toolbar button to reflect the new function.
SolarMutexGuard aGuard; updateImage();
if ( !m_bDisposed )
{
if ( !m_aCommand.isEmpty() )
{
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
Image aImage = GetImage( xFrame, m_aCommand, hasBigImages() );
if ( !!aImage )
GetToolBox().SetItemImage( GetId(), aImage );
}
}
} }
void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException) void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException)

View File

@@ -98,19 +98,12 @@ OUString SAL_CALL SvxTbxCtlAlign::getSubToolbarName() throw (::com::sun::star::u
void SAL_CALL SvxTbxCtlAlign::functionSelected( const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) void SAL_CALL SvxTbxCtlAlign::functionSelected( const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
{ {
// Our sub-toolbar wants to executes a function. We have to change // remember the new command
// the image of our toolbar button to reflect the new function. m_aCommand = aCommand;
SolarMutexGuard aGuard;
if ( !m_bDisposed ) // Our sub-toolbar wants to execute a function.
{ // We have to change the image of our toolbar button to reflect the new function.
if ( !aCommand.isEmpty() ) updateImage();
{
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
Image aImage = GetImage( xFrame, aCommand, hasBigImages() );
if ( !!aImage )
GetToolBox().SetItemImage( GetId(), aImage );
}
}
} }
void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException) void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException)