diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-10-30 16:24:37 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-10-30 18:00:05 +0000 |
commit | b1426b5b502fd591402d666994e3f1fb3a8ad959 (patch) | |
tree | 3614d896993b004e805f9714a126070ec5d5c29f | |
parent | 17b1ebbf86ceabe2e9cabf9626ca94fae3fb9216 (diff) |
tdf#95014 initial support for 32 px icons in toolbar
This adds support for 32 pixel icons - mainly to get them into
the toolbar.
Most changes made are to change the behavior of having only small
and large icons as a boolean choice, but not every code path was
converted to non-boolean choice yet.
Breeze icon theme has the 32px variants so it can be used already.
Change-Id: Iadf832a87826c16b3a83522104dd6c35d61a0f87
Reviewed-on: https://gerrit.libreoffice.org/30398
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
29 files changed, 211 insertions, 91 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 6d08562a321d..20dece223187 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -374,10 +374,14 @@ void InitImageType() css::ui::ImageType::COLOR_NORMAL | css::ui::ImageType::SIZE_DEFAULT; - if ( SvtMiscOptions().AreCurrentSymbolsLarge() ) + if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) { theImageType |= css::ui::ImageType::SIZE_LARGE; } + else if (SvtMiscOptions().GetSymbolsSize() == SFX_SYMBOLS_SIZE_32) + { + theImageType |= css::ui::ImageType::SIZE_32; + } } sal_Int16 GetImageType() @@ -5040,8 +5044,11 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow, pTbSymbol->SetPageScroll( true ); - bool bLargeIcons = GetImageType() & css::ui::ImageType::SIZE_LARGE; - m_nExpectedSize = bLargeIcons ? 26 : 16; + m_nExpectedSize = 16; + if (GetImageType() & css::ui::ImageType::SIZE_LARGE) + m_nExpectedSize = 26; + else if (GetImageType() & css::ui::ImageType::SIZE_32) + m_nExpectedSize = 32; if ( m_nExpectedSize != 16 ) { diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 78f5ad6b99a4..e308843eb438 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -761,6 +761,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* ) case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break; case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break; case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break; + case 3: eSet = SFX_SYMBOLS_SIZE_32; break; default: OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_pIconSizeLB should not be possible!" ); } @@ -953,10 +954,18 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) SvtMiscOptions aMiscOptions; mpOpenGLConfig->reset(); - if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO ) - nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1; + if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO) + { + nSizeLB_InitialSelection = 1; + + if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) + nSizeLB_InitialSelection = 2; + else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32) + nSizeLB_InitialSelection = 3; + } m_pIconSizeLB->SelectEntryPos( nSizeLB_InitialSelection ); m_pIconSizeLB->SaveValue(); + if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::DontCare ) ; // do nothing else if( aMiscOptions.GetSidebarIconSize() == ToolBoxButtonSize::Small ) diff --git a/cui/uiconfig/ui/optviewpage.ui b/cui/uiconfig/ui/optviewpage.ui index 8e4358cdf4e4..06cb489d7e77 100644 --- a/cui/uiconfig/ui/optviewpage.ui +++ b/cui/uiconfig/ui/optviewpage.ui @@ -385,6 +385,7 @@ <item translatable="yes">Automatic</item> <item translatable="yes">Small</item> <item translatable="yes">Large</item> + <item translatable="yes">Extra Large</item> </items> </object> <packing> diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 2f6e2c753ed6..2fbf134df3e9 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -500,7 +500,7 @@ namespace } if ( xFrame.is() ) - _rMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, false, xFrame)); + _rMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, xFrame)); } } // SelectionSupplier diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 4a60aff7559b..48722dec5acb 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -156,11 +156,12 @@ class ToolBarManager : public ToolbarManager_Base typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::container::XIndexAccess > > MenuDescriptionMap; bool m_bDisposed : 1, - m_bSmallSymbols : 1, m_bAddedToTaskPaneList : 1, m_bFrameActionRegistered : 1, m_bUpdateControllers : 1; + sal_Int16 m_eSymbolSize; + VclPtr<ToolBox> m_pToolBar; OUString m_aModuleIdentifier; diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index d229de961a33..bde487dfea39 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -64,10 +64,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui; using namespace ::cppu; -// Image sizes for our toolbars/menus -const sal_Int32 IMAGE_SIZE_NORMAL = 16; -const sal_Int32 IMAGE_SIZE_LARGE = 26; -const sal_Int16 MAX_IMAGETYPE_VALUE = css::ui::ImageType::SIZE_LARGE; +const sal_Int16 MAX_IMAGETYPE_VALUE = css::ui::ImageType::SIZE_32; static const char IMAGE_FOLDER[] = "images"; static const char BITMAPS_FOLDER[] = "Bitmaps"; @@ -77,13 +74,15 @@ static const char ModuleImageList[] = "private:resource/images/moduleimage static const o3tl::enumarray<vcl::ImageType, const char*> IMAGELIST_XML_FILE = { "sc_imagelist.xml", - "lc_imagelist.xml" + "lc_imagelist.xml", + "xc_imagelist.xml" }; static const o3tl::enumarray<vcl::ImageType, const char*> BITMAP_FILE_NAMES = { "sc_userimages.png", - "lc_userimages.png" + "lc_userimages.png", + "xc_userimages.png" }; namespace framework @@ -221,8 +220,9 @@ bool GlobalImageList::hasImage( vcl::ImageType nImageType, const OUString& rComm static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic, const uno::Reference< XGraphic >& rInGraphic, vcl::ImageType nImageType ) { - static Size aNormSize( IMAGE_SIZE_NORMAL, IMAGE_SIZE_NORMAL ); - static Size aLargeSize( IMAGE_SIZE_LARGE, IMAGE_SIZE_LARGE ); + static Size aNormSize(16, 16); + static Size aLargeSize(26, 26); + static Size aSize32(32, 32); if ( !rInGraphic.is() ) { @@ -235,12 +235,14 @@ static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic Size aSize = aImage.GetSizePixel(); bool bMustScale( false ); - if ( nImageType == vcl::ImageType::Color_Large ) - bMustScale = ( aSize != aLargeSize ); + if (nImageType == vcl::ImageType::Size26) + bMustScale = (aSize != aLargeSize); + else if (nImageType == vcl::ImageType::Size32) + bMustScale = (aSize != aSize32); else - bMustScale = ( aSize != aNormSize ); + bMustScale = (aSize != aNormSize); - if ( bMustScale ) + if (bMustScale) { BitmapEx aBitmap = aImage.GetBitmapEx(); aBitmap.Scale( aNormSize ); @@ -249,15 +251,18 @@ static bool implts_checkAndScaleGraphic( uno::Reference< XGraphic >& rOutGraphic } else rOutGraphic = rInGraphic; + return true; } static vcl::ImageType implts_convertImageTypeToIndex( sal_Int16 nImageType ) { - vcl::ImageType nIndex( vcl::ImageType::Color ); - if ( nImageType & css::ui::ImageType::SIZE_LARGE ) - nIndex = vcl::ImageType::Color_Large; - return nIndex; + if (nImageType & css::ui::ImageType::SIZE_LARGE) + return vcl::ImageType::Size26; + else if (nImageType & css::ui::ImageType::SIZE_32) + return vcl::ImageType::Size32; + else + return vcl::ImageType::Size16; } ImageList* ImageManagerImpl::implts_getUserImageList( vcl::ImageType nImageType ) diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 930c62c62c6f..cdca410d7406 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -113,6 +113,10 @@ static Image RetrieveImage( Reference< css::frame::XFrame >& rFrame, bool bBigImage ) { + vcl::ImageType eImageType = vcl::ImageType::Size16; + if (bBigImage) + eImageType = vcl::ImageType::Size26; + Image aImage; if ( !aImageId.isEmpty() ) @@ -121,14 +125,14 @@ static Image RetrieveImage( Reference< css::frame::XFrame >& rFrame, if ( !!aImage ) return aImage; else - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, bBigImage, rFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType); if ( !!aImage ) return aImage; } aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage ); if ( !aImage ) - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, bBigImage, rFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType); return aImage; } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index d78b7ce8a29b..c4df1f21c6c1 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1293,7 +1293,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF // Set image for the addon popup menu item if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST )) { - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( aItemCommand, false, rFrame ); + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, rFrame); if ( !!aImage ) pPopup->SetItemImage( ITEMID_ADDONLIST, aImage ); } @@ -1324,12 +1324,12 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF if ( pMenuAttributes && !pMenuAttributes->aImageId.isEmpty() ) { // Retrieve image id from menu attributes - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( aImageId, false, m_xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, m_xFrame); } if ( !aImage ) { - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( aItemCommand, false, m_xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, m_xFrame); if ( !aImage ) aImage = AddonsOptions().GetImageFromURL( aItemCommand, false ); } @@ -2090,7 +2090,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b if ( !aImageId.isEmpty() ) { - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, false, _xFrame ); + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, _xFrame); if ( !!aImage ) { bImageSet = true; @@ -2101,7 +2101,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b if ( !bImageSet ) { OUString aMenuItemCommand = _pMenu->GetItemCommand( nId ); - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aMenuItemCommand, false, _xFrame ); + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aMenuItemCommand, _xFrame); if ( !aImage ) aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, false ); diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 94b15fca3afb..971e5f535a45 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -92,7 +92,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) if ( !aImageId.isEmpty() ) { - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( aImageId, false, xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, xFrame); if ( !!aImage ) { bImageSet = true; diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index e3a840d5dd69..55d180ee815f 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -53,7 +53,18 @@ using namespace framework; -namespace { +namespace +{ + +vcl::ImageType getImageType(ToolBoxButtonSize eSize) +{ + vcl::ImageType eImageType = vcl::ImageType::Size16; + if (eSize == ToolBoxButtonSize::Large) + eImageType = vcl::ImageType::Size26; + else if (eSize == ToolBoxButtonSize::Size32) + eImageType = vcl::ImageType::Size32; + return eImageType; +} typedef cppu::ImplInheritanceHelper< svt::ToolboxController, css::lang::XServiceInfo > @@ -380,9 +391,10 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand ) pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help. pToolBox->SetItemText( nId, vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, m_xFrame ) ); pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand( rCommand, m_xFrame ) ); - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( rCommand, - pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large, - m_xFrame ); + + vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize()); + + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, m_xFrame, eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); } @@ -499,21 +511,22 @@ void SaveToolbarController::updateImage() if ( !getToolboxId( nId, &pToolBox ) ) return; - bool bLargeIcons = pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large; + vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize()); + Image aImage; if ( m_bReadOnly ) { - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( ".uno:SaveAs", bLargeIcons, m_xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType); } else if ( m_bModified ) { - Image aResImage( bLargeIcons ? FwkResId( IMG_SAVEMODIFIED_LARGE ) : FwkResId( IMG_SAVEMODIFIED_SMALL ) ); + Image aResImage(eImageType == vcl::ImageType::Size16 ? FwkResId(IMG_SAVEMODIFIED_SMALL) : FwkResId(IMG_SAVEMODIFIED_LARGE)); aImage = aResImage; } if ( !aImage ) - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( m_aCommandURL, bLargeIcons, m_xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aCommandURL, m_xFrame, eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index b50d248bb771..af44f8a1199e 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -291,7 +291,13 @@ void SubToolBarController::updateImage() sal_uInt16 nId = 0; if ( getToolboxId( nId, &pToolBox ) ) { - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( m_aLastCommand, pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large, getFrameInterface() ); + vcl::ImageType eImageType = vcl::ImageType::Size16; + if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Large) + eImageType = vcl::ImageType::Size26; + else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32) + eImageType = vcl::ImageType::Size32; + + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index a76e552932a3..ec0e374ad07a 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -54,6 +54,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/sequence.hxx> #include <svtools/miscopt.hxx> +#include <svtools/imgdef.hxx> #include <vcl/svapp.hxx> #include <vcl/menu.hxx> #include <vcl/syswin.hxx> @@ -94,15 +95,6 @@ static const char HELPID_PREFIX_TESTTOOL[] = ".HelpId:"; static const sal_uInt16 STARTID_CUSTOMIZE_POPUPMENU = 1000; - -static sal_Int16 getImageTypeFromBools( bool bBig ) -{ - sal_Int16 n( 0 ); - if ( bBig ) - n |= css::ui::ImageType::SIZE_LARGE; - return n; -} - static css::uno::Reference< css::frame::XLayoutManager > getLayoutManagerFromFrame( css::uno::Reference< css::frame::XFrame >& rFrame ) { @@ -126,6 +118,21 @@ static css::uno::Reference< css::frame::XLayoutManager > getLayoutManagerFromFra return xLayoutManager; } +namespace +{ + +sal_Int16 getCurrentImageType() +{ + SvtMiscOptions aMiscOptions; + sal_Int16 nImageType = css::ui::ImageType::SIZE_DEFAULT; + if (aMiscOptions.GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE) + nImageType |= css::ui::ImageType::SIZE_LARGE; + else if (aMiscOptions.GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32) + nImageType |= css::ui::ImageType::SIZE_32; + return nImageType; +} + +} // end anonymous namespace // XInterface, XTypeProvider, XServiceInfo @@ -134,10 +141,10 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, const OUString& rResourceName, ToolBox* pToolBar ) : m_bDisposed( false ), - m_bSmallSymbols( !SvtMiscOptions().AreCurrentSymbolsLarge() ), m_bAddedToTaskPaneList( true ), m_bFrameActionRegistered( false ), m_bUpdateControllers( false ), + m_eSymbolSize(SvtMiscOptions().GetCurrentSymbolsSize()), m_pToolBar( pToolBar ), m_aResourceName( rResourceName ), m_xFrame( rFrame ), @@ -163,7 +170,13 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, m_pToolBar->SetDoubleClickHdl( LINK( this, ToolBarManager, DoubleClick ) ); m_pToolBar->SetStateChangedHdl( LINK( this, ToolBarManager, StateChanged ) ); m_pToolBar->SetDataChangedHdl( LINK( this, ToolBarManager, DataChanged ) ); - m_pToolBar->SetToolboxButtonSize( m_bSmallSymbols ? ToolBoxButtonSize::Small : ToolBoxButtonSize::Large ); + + if (m_eSymbolSize == SFX_SYMBOLS_SIZE_LARGE) + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Large); + else if (m_eSymbolSize == SFX_SYMBOLS_SIZE_32) + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Size32); + else + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Small); // enables a menu for clipped items and customization SvtCommandOptions aCmdOptions; @@ -252,11 +265,12 @@ void ToolBarManager::CheckAndUpdateImages() bool bRefreshImages = false; SvtMiscOptions aMiscOptions; - bool bCurrentSymbolsSmall = !aMiscOptions.AreCurrentSymbolsLarge(); - if ( m_bSmallSymbols != bCurrentSymbolsSmall ) + sal_Int16 eNewSymbolSize = aMiscOptions.GetCurrentSymbolsSize(); + + if (m_eSymbolSize != eNewSymbolSize ) { bRefreshImages = true; - m_bSmallSymbols = bCurrentSymbolsSmall; + m_eSymbolSize = eNewSymbolSize; } const OUString& sCurrentIconTheme = aMiscOptions.GetIconTheme(); @@ -275,8 +289,22 @@ void ToolBarManager::RefreshImages() { SolarMutexGuard g; - bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() ); - m_pToolBar->SetToolboxButtonSize( bBigImages ? ToolBoxButtonSize::Large : ToolBoxButtonSize::Small ); + vcl::ImageType eImageType = vcl::ImageType::Size16; + + if (m_eSymbolSize == SFX_SYMBOLS_SIZE_LARGE) + { + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Large); + eImageType = vcl::ImageType::Size26; + } + else if (m_eSymbolSize == SFX_SYMBOLS_SIZE_32) + { + eImageType = vcl::ImageType::Size32; + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Size32); + } + else + { + m_pToolBar->SetToolboxButtonSize(ToolBoxButtonSize::Small); + } for ( auto const& it : m_aControllerMap ) { @@ -290,11 +318,12 @@ void ToolBarManager::RefreshImages() else { OUString aCommandURL = m_pToolBar->GetItemCommand( it.first ); - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, bBigImages, m_xFrame); + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame, eImageType); // Try also to query for add-on images before giving up and use an // empty image. + bool bBigImages = eImageType != vcl::ImageType::Size16; if ( !aImage ) - aImage = framework::AddonsOptions().GetImageFromURL( aCommandURL, bBigImages ); + aImage = framework::AddonsOptions().GetImageFromURL(aCommandURL, bBigImages); m_pToolBar->SetItemImage( it.first, aImage ); } } @@ -533,9 +562,7 @@ void ToolBarManager::impl_elementChanged(bool const isRemove, Reference< XNameAccess > xNameAccess; sal_Int16 nImageType = sal_Int16(); - sal_Int16 nCurrentImageType = getImageTypeFromBools( - SvtMiscOptions().AreCurrentSymbolsLarge() - ); + sal_Int16 nCurrentImageType = getCurrentImageType(); if (( Event.aInfo >>= nImageType ) && ( nImageType == nCurrentImageType ) && @@ -1197,12 +1224,13 @@ void ToolBarManager::RequestImages() Sequence< Reference< XGraphic > > aDocGraphicSeq; Sequence< Reference< XGraphic > > aModGraphicSeq; - bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() ); - sal_Int16 p = getImageTypeFromBools( SvtMiscOptions().AreCurrentSymbolsLarge() ); + SvtMiscOptions aMiscOptions; + + sal_Int16 nImageType = getCurrentImageType(); if ( m_xDocImageManager.is() ) - aDocGraphicSeq = m_xDocImageManager->getImages( p, aCmdURLSeq ); - aModGraphicSeq = m_xModuleImageManager->getImages( p, aCmdURLSeq ); + aDocGraphicSeq = m_xDocImageManager->getImages(nImageType, aCmdURLSeq); + aModGraphicSeq = m_xModuleImageManager->getImages(nImageType, aCmdURLSeq); sal_uInt32 i = 0; CommandToInfoMap::iterator pIter = m_aCommandMap.begin(); @@ -1218,7 +1246,7 @@ void ToolBarManager::RequestImages() // Try also to query for add-on images before giving up and use an // empty image. if ( !aImage ) - aImage = framework::AddonsOptions().GetImageFromURL( aCmdURLSeq[i], bBigImages ); + aImage = framework::AddonsOptions().GetImageFromURL( aCmdURLSeq[i], aMiscOptions.AreCurrentSymbolsLarge()); pIter->second.nImageInfo = 1; // mark image as module based } @@ -1461,7 +1489,7 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const pVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE ); pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) ); pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL ); - Image aImage( vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, false, m_xFrame) ); + Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame)); commandToImage[aCommandURL] = aImage; pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage ); } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 44ae069fa0a9..2980d3ebb647 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -175,7 +175,7 @@ void ToolbarsMenuController::addCommand( const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); if ( rSettings.GetUseImagesInMenus() ) - aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( rCommandURL, false, m_xFrame ); + aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommandURL, m_xFrame); VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXPopupMenu::GetImplementation( rPopupMenu )); if ( pPopupMenu ) diff --git a/include/svtools/imgdef.hxx b/include/svtools/imgdef.hxx index cd9c6d9e15d5..7f291897acbe 100644 --- a/include/svtools/imgdef.hxx +++ b/include/svtools/imgdef.hxx @@ -24,6 +24,7 @@ enum SfxSymbolsSize { SFX_SYMBOLS_SIZE_SMALL, SFX_SYMBOLS_SIZE_LARGE, + SFX_SYMBOLS_SIZE_32, SFX_SYMBOLS_SIZE_AUTO }; diff --git a/include/vcl/CommandImageResolver.hxx b/include/vcl/CommandImageResolver.hxx index 36f2f1e85881..f57e79e73889 100644 --- a/include/vcl/CommandImageResolver.hxx +++ b/include/vcl/CommandImageResolver.hxx @@ -24,9 +24,11 @@ namespace vcl enum class ImageType { - Color = 0, - Color_Large, - LAST = Color_Large + Size16, + Size26, + Size32, + Small = Size16, + LAST = Size32, }; class VCL_DLLPUBLIC CommandImageResolver diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx index b15873fc4c0e..fff271b39a9a 100644 --- a/include/vcl/commandinfoprovider.hxx +++ b/include/vcl/commandinfoprovider.hxx @@ -22,6 +22,7 @@ #include <vcl/dllapi.h> #include <vcl/keycod.hxx> #include <vcl/image.hxx> +#include <vcl/CommandImageResolver.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -91,8 +92,8 @@ public: Image GetImageForCommand( const OUString& rsCommandName, - bool bLarge, - const css::uno::Reference<css::frame::XFrame>& rxFrame); + const css::uno::Reference<css::frame::XFrame>& rxFrame, + vcl::ImageType eImageType = vcl::ImageType::Small); sal_Int32 GetPropertiesForCommand( const OUString& rsCommandName, diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index bd516130abac..579b867e15aa 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -228,6 +228,7 @@ enum class ToolbarIconSize Unknown = 0, Small = 1, Large = 2, + Size32 = 3, }; #define STYLE_CURSOR_NOBLINKTIME SAL_MAX_UINT64 diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index ab1dfaf3a1a1..d7b6af8e92b9 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -58,9 +58,15 @@ namespace o3tl template<> struct typed_flags<ToolBoxMenuType> : is_typed_flags<ToolBoxMenuType, 0x0003> {}; } -// small or large force an exact toolbox size for proper alignemnt +// small, large, size32 force an exact toolbox size for proper alignemnt // dontcare will let the toolbox decide about its size -enum class ToolBoxButtonSize { DontCare, Small, Large }; +enum class ToolBoxButtonSize +{ + DontCare, + Small, + Large, + Size32, +}; // ToolBoxLayoutMode::Normal - traditional layout, items are centered in the toolbar // ToolBoxLayoutMode::LockVert - special mode (currently used for calc input/formula diff --git a/offapi/com/sun/star/ui/ImageType.idl b/offapi/com/sun/star/ui/ImageType.idl index 1d4ce2af4e69..8dff0acd4feb 100644 --- a/offapi/com/sun/star/ui/ImageType.idl +++ b/offapi/com/sun/star/ui/ImageType.idl @@ -35,12 +35,20 @@ constants ImageType /** an image with default size. */ const short SIZE_DEFAULT = 0; - /** an image with big size; + + /** an image with large size. */ const short SIZE_LARGE = 1; + + /** an image with size 32. + @since LibreOffice 5.3 + */ + const short SIZE_32 = 2; + /** an image with normal colors. */ const short COLOR_NORMAL = 0; + /** an image with high contrast colors. */ const short COLOR_HIGHCONTRAST = 4; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index c8c7720a2a3c..c2dd5ca454ee 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5710,6 +5710,11 @@ <desc>larger icons</desc> </info> </enumeration> + <enumeration oor:value="2"> + <info> + <desc>32x32 pixel icons</desc> + </info> + </enumeration> </constraints> <value>2</value> </prop> diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index ebc995e2b74a..bf8687340a6b 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -447,7 +447,7 @@ void lcl_insertMenuItemImages( else { const OUString sCommand = rContextMenu.GetItemCommand(nId); - rContextMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(sCommand, false, _rFrame)); + rContextMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(sCommand, _rFrame)); if ( nId == SID_PAGEHEADERFOOTER ) { OUString sText = ModuleRes((_xReportDefinition.is() && _xReportDefinition->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE : RID_STR_PAGEHEADERFOOTER_INSERT); diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index f034f43db690..dc799a1c7e96 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -239,7 +239,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W sSlotStr = ".uno:DuplicatePage"; else sSlotStr = ".uno:Undo"; - aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( sSlotStr, false, xFrame ); + aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(sSlotStr, xFrame); OUString sSlotTitle; if( bInsertPage ) diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 150e9d33eaba..26a758d447f7 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -268,7 +268,14 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) ToolBoxButtonSize eSize = GetIconSize(); - bool bBigImages(eSize == ToolBoxButtonSize::Large); + vcl::ImageType eImageType = vcl::ImageType::Size16; + if (eSize == ToolBoxButtonSize::Large) + eImageType = vcl::ImageType::Size26; + else if (eSize == ToolBoxButtonSize::Size32) + eImageType = vcl::ImageType::Size32; + + bool bBig = (eImageType == vcl::ImageType::Size26 || eImageType == vcl::ImageType::Size32); + SetToolboxButtonSize(eSize); for (auto const& it : maControllers) @@ -286,11 +293,11 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) if(SfxViewFrame::Current()) { css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, bBigImages, xFrame); + Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, xFrame, eImageType); // Try also to query for add-on images before giving up and use an // empty image. if (!aImage) - aImage = framework::AddonsOptions().GetImageFromURL(aCommandURL, bBigImages); + aImage = framework::AddonsOptions().GetImageFromURL(aCommandURL, bBig); SetItemImage(it.first, aImage); } } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 00d283b3d872..9abf5820f8af 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -825,7 +825,9 @@ sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const // Use system settings, we have to retrieve the toolbar icon size from the // Application class ToolbarIconSize nStyleIconSize = Application::GetSettings().GetStyleSettings().GetToolbarIconSize(); - if ( nStyleIconSize == ToolbarIconSize::Large ) + if (nStyleIconSize == ToolbarIconSize::Size32) + eOptSymbolsSize = SFX_SYMBOLS_SIZE_32; + else if (nStyleIconSize == ToolbarIconSize::Large) eOptSymbolsSize = SFX_SYMBOLS_SIZE_LARGE; else eOptSymbolsSize = SFX_SYMBOLS_SIZE_SMALL; @@ -836,7 +838,7 @@ sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const bool SvtMiscOptions::AreCurrentSymbolsLarge() const { - return ( GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE ); + return ( GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE || GetCurrentSymbolsSize() == SFX_SYMBOLS_SIZE_32); } OUString SvtMiscOptions::GetIconTheme() const diff --git a/vcl/source/bitmap/CommandImageResolver.cxx b/vcl/source/bitmap/CommandImageResolver.cxx index 90a5044e00d4..a165adfee9db 100644 --- a/vcl/source/bitmap/CommandImageResolver.cxx +++ b/vcl/source/bitmap/CommandImageResolver.cxx @@ -24,7 +24,8 @@ namespace static const o3tl::enumarray<ImageType, const char*> ImageType_Prefixes = { "cmd/sc_", - "cmd/lc_" + "cmd/lc_", + "cmd/32/" }; OUString lclConvertToCanonicalName(const OUString& rFileName) diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx index 2b23821fc7f7..764326027707 100644 --- a/vcl/source/helper/commandinfoprovider.cxx +++ b/vcl/source/helper/commandinfoprovider.cxx @@ -211,8 +211,9 @@ OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandN return GetCommandProperty("TargetURL", rCommandName); } -Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, bool bLarge, - const Reference<frame::XFrame>& rxFrame) +Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, + const Reference<frame::XFrame>& rxFrame, + vcl::ImageType eImageType) { SetFrame(rxFrame); @@ -220,8 +221,11 @@ Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, boo return Image(); sal_Int16 nImageType(ui::ImageType::COLOR_NORMAL | ui::ImageType::SIZE_DEFAULT); - if (bLarge) + + if (eImageType == vcl::ImageType::Size26) nImageType |= ui::ImageType::SIZE_LARGE; + else if (eImageType == vcl::ImageType::Size32) + nImageType |= ui::ImageType::SIZE_32; try { diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 1c6db662a738..a3d626964eaf 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -890,7 +890,7 @@ namespace if (!aTooltip.isEmpty()) pButton->SetQuickHelpText(aTooltip); - Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, /*bLarge=*/ false, rFrame)); + Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, rFrame)); pButton->SetModeImage(aImage); pButton->SetCommandHandler(aCommand); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index fbc6ac1eb40a..1c88c73b53c6 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -513,7 +513,7 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f { OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame)); OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame)); - Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame)); + Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, rFrame)); InsertItem(nItemId, aLabel, aImage); SetHelpText(nItemId, aTooltip); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 5336f227703f..983fa1fbddf9 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -436,8 +436,16 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css { OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame)); OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame)); - Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand( - rCommand, (GetToolboxButtonSize() == ToolBoxButtonSize::Large), rFrame)); + + vcl::ImageType eImageType = vcl::ImageType::Size16; + + if (GetToolboxButtonSize() == ToolBoxButtonSize::Large) + eImageType = vcl::ImageType::Size26; + else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32) + eImageType = vcl::ImageType::Size32; + + CommandInfoProvider& rInfoProvider = vcl::CommandInfoProvider::Instance(); + Image aImage(rInfoProvider.GetImageForCommand(rCommand, rFrame, eImageType)); sal_uInt16 nItemId = GetItemCount() + 1; InsertItem(nItemId, aImage, aLabel, nBits, nPos); |