GSoC possibility to change icon size in the SidebarToolBox
+ Added registy entry to store icon size + Added UI to change settings: Tools -> Options... -> View + Loading last settings in the SidebarToolBox + Settings update listener Update icon code from: framework/source/uielement/toolbarmanager.cxx Change-Id: I1d713c50fccfc19e1c8ea82eba68556ddb76cd3c Reviewed-on: https://gerrit.libreoffice.org/26362 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
663b7aec30
commit
4760c44c80
@@ -612,6 +612,7 @@ void CanvasSettings::EnabledHardwareAcceleration( bool _bEnabled ) const
|
||||
OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
|
||||
: SfxTabPage(pParent, "OptViewPage", "cui/ui/optviewpage.ui", &rSet)
|
||||
, nSizeLB_InitialSelection(0)
|
||||
, nSidebarSizeLB_InitialSelection(0)
|
||||
, nStyleLB_InitialSelection(0)
|
||||
, pAppearanceCfg(new SvtTabAppearanceCfg)
|
||||
, pCanvasSettings(new CanvasSettings)
|
||||
@@ -620,6 +621,7 @@ OfaViewTabPage::OfaViewTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
|
||||
{
|
||||
get(m_pWindowSizeMF, "windowsize");
|
||||
get(m_pIconSizeLB, "iconsize");
|
||||
get(m_pSidebarIconSizeLB, "sidebariconsize");
|
||||
get(m_pIconStyleLB, "iconstyle");
|
||||
|
||||
get(m_pFontAntiAliasing, "aafont");
|
||||
@@ -701,6 +703,7 @@ void OfaViewTabPage::dispose()
|
||||
pAppearanceCfg = nullptr;
|
||||
m_pWindowSizeMF.clear();
|
||||
m_pIconSizeLB.clear();
|
||||
m_pSidebarIconSizeLB.clear();
|
||||
m_pIconStyleLB.clear();
|
||||
m_pFontAntiAliasing.clear();
|
||||
m_pAAPointLimitLabel.clear();
|
||||
@@ -759,6 +762,22 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
|
||||
aMiscOptions.SetSymbolsSize( eSet );
|
||||
}
|
||||
|
||||
const sal_Int32 nSidebarSizeLB_NewSelection = m_pSidebarIconSizeLB->GetSelectEntryPos();
|
||||
if( nSidebarSizeLB_InitialSelection != nSidebarSizeLB_NewSelection )
|
||||
{
|
||||
// from now on it's modified, even if via auto setting the same size was set as now selected in the LB
|
||||
sal_Int16 eSet = TOOLBOX_BUTTONSIZE_DONTCARE;
|
||||
switch( nSidebarSizeLB_NewSelection )
|
||||
{
|
||||
case 0: eSet = TOOLBOX_BUTTONSIZE_DONTCARE; break;
|
||||
case 1: eSet = TOOLBOX_BUTTONSIZE_SMALL; break;
|
||||
case 2: eSet = TOOLBOX_BUTTONSIZE_LARGE; break;
|
||||
default:
|
||||
OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_pSidebarIconSizeLB should not be possible!" );
|
||||
}
|
||||
aMiscOptions.SetSidebarIconSize( eSet );
|
||||
}
|
||||
|
||||
const sal_Int32 nStyleLB_NewSelection = m_pIconStyleLB->GetSelectEntryPos();
|
||||
if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
|
||||
{
|
||||
@@ -904,6 +923,10 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
|
||||
nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1;
|
||||
m_pIconSizeLB->SelectEntryPos( nSizeLB_InitialSelection );
|
||||
m_pIconSizeLB->SaveValue();
|
||||
if( aMiscOptions.GetSidebarIconSize() != TOOLBOX_BUTTONSIZE_DONTCARE )
|
||||
nSidebarSizeLB_InitialSelection = aMiscOptions.GetSidebarIconSize();
|
||||
m_pSidebarIconSizeLB->SelectEntryPos( nSidebarSizeLB_InitialSelection );
|
||||
m_pSidebarIconSizeLB->SaveValue();
|
||||
|
||||
if (aMiscOptions.IconThemeWasSetAutomatically()) {
|
||||
nStyleLB_InitialSelection = 0;
|
||||
|
@@ -81,6 +81,7 @@ class OfaViewTabPage : public SfxTabPage
|
||||
private:
|
||||
VclPtr<MetricField> m_pWindowSizeMF;
|
||||
VclPtr<ListBox> m_pIconSizeLB;
|
||||
VclPtr<ListBox> m_pSidebarIconSizeLB;
|
||||
VclPtr<ListBox> m_pIconStyleLB;
|
||||
|
||||
VclPtr<CheckBox> m_pFontAntiAliasing;
|
||||
@@ -103,6 +104,7 @@ private:
|
||||
VclPtr<ListBox> m_pMouseMiddleLB;
|
||||
|
||||
sal_Int32 nSizeLB_InitialSelection;
|
||||
sal_Int32 nSidebarSizeLB_InitialSelection;
|
||||
sal_Int32 nStyleLB_InitialSelection;
|
||||
|
||||
SvtTabAppearanceCfg* pAppearanceCfg;
|
||||
|
@@ -367,7 +367,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -396,7 +396,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -411,7 +411,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -426,7 +426,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -439,7 +439,36 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Sidebar _icon size:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">iconsize</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="sidebariconsize">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<items>
|
||||
<item translatable="yes">Automatic</item>
|
||||
<item translatable="yes">Small</item>
|
||||
<item translatable="yes">Large</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -66,6 +66,7 @@ private:
|
||||
DECL_LINK_TYPED(ClickHandler, ToolBox*, void);
|
||||
DECL_LINK_TYPED(DoubleClickHandler, ToolBox*, void);
|
||||
DECL_LINK_TYPED(SelectHandler, ToolBox*, void);
|
||||
DECL_LINK_TYPED(ChangedIconSizeHandler, LinkParamNone*, void );
|
||||
|
||||
css::uno::Reference<css::frame::XToolbarController> GetControllerForItemId(const sal_uInt16 nItemId) const;
|
||||
|
||||
|
@@ -62,6 +62,8 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options
|
||||
|
||||
sal_Int16 GetSymbolsSize() const;
|
||||
void SetSymbolsSize( sal_Int16 eSet );
|
||||
sal_Int16 GetSidebarIconSize() const;
|
||||
void SetSidebarIconSize( sal_Int16 eSet );
|
||||
sal_Int16 GetCurrentSymbolsSize() const;
|
||||
bool AreCurrentSymbolsLarge() const;
|
||||
|
||||
|
@@ -5695,6 +5695,30 @@
|
||||
</constraints>
|
||||
<value>2</value>
|
||||
</prop>
|
||||
<prop oor:name="SidebarIconSize" oor:type="xs:short" oor:nillable="false">
|
||||
<!-- UIHints: Tools Options General View -->
|
||||
<info>
|
||||
<desc>Specifies which size of the icons is used for the
|
||||
sidebar.</desc>
|
||||
</info>
|
||||
<constraints>
|
||||
<enumeration oor:value="0">
|
||||
<info>
|
||||
<desc>will let the toolbox decide about its size</desc>
|
||||
</info>
|
||||
</enumeration>
|
||||
<enumeration oor:value="1">
|
||||
<info>
|
||||
<desc>small icons</desc>
|
||||
</info>
|
||||
</enumeration>
|
||||
<enumeration oor:value="2">
|
||||
<info>
|
||||
<desc>large icons</desc>
|
||||
</info>
|
||||
</enumeration>
|
||||
</constraints>
|
||||
</prop>
|
||||
<prop oor:name="SymbolStyle" oor:type="xs:string" oor:nillable="false">
|
||||
<!-- UIHints: Tools Options General View -->
|
||||
<info>
|
||||
|
@@ -21,13 +21,17 @@
|
||||
#include <sfx2/sidebar/ControllerFactory.hxx>
|
||||
#include <sfx2/sidebar/Theme.hxx>
|
||||
#include <sfx2/sidebar/Tools.hxx>
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
|
||||
#include <vcl/builderfactory.hxx>
|
||||
#include <vcl/commandinfoprovider.hxx>
|
||||
#include <vcl/gradient.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <toolkit/helper/vclunohelper.hxx>
|
||||
#include <svtools/miscopt.hxx>
|
||||
#include <com/sun/star/frame/XSubToolbarController.hpp>
|
||||
#include <framework/addonsoptions.hxx>
|
||||
|
||||
using namespace css;
|
||||
using namespace css::uno;
|
||||
@@ -59,7 +63,17 @@ SidebarToolBox::SidebarToolBox (vcl::Window* pParentWindow)
|
||||
{
|
||||
SetBackground(Wallpaper());
|
||||
SetPaintTransparent(true);
|
||||
SetToolboxButtonSize( TOOLBOX_BUTTONSIZE_SMALL );
|
||||
|
||||
ToolBoxButtonSize eSize = TOOLBOX_BUTTONSIZE_SMALL;
|
||||
|
||||
SvtMiscOptions aMiscOptions;
|
||||
aMiscOptions.AddListenerLink(LINK(this, SidebarToolBox, ChangedIconSizeHandler));
|
||||
|
||||
sal_uInt16 nSize = aMiscOptions.GetSidebarIconSize();
|
||||
if (nSize <= TOOLBOX_BUTTONSIZE_LARGE)
|
||||
eSize = static_cast<ToolBoxButtonSize>(nSize);
|
||||
|
||||
SetToolboxButtonSize(eSize);
|
||||
|
||||
#ifdef DEBUG
|
||||
SetText(OUString("SidebarToolBox"));
|
||||
@@ -75,6 +89,9 @@ SidebarToolBox::~SidebarToolBox()
|
||||
|
||||
void SidebarToolBox::dispose()
|
||||
{
|
||||
SvtMiscOptions aMiscOptions;
|
||||
aMiscOptions.RemoveListenerLink(LINK(this, SidebarToolBox, ChangedIconSizeHandler));
|
||||
|
||||
ControllerContainer aControllers;
|
||||
aControllers.swap(maControllers);
|
||||
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
|
||||
@@ -241,6 +258,48 @@ IMPL_LINK_TYPED(SidebarToolBox, SelectHandler, ToolBox*, pToolBox, void)
|
||||
xController->execute((sal_Int16)pToolBox->GetModifier());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG_TYPED(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void)
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
|
||||
ToolBoxButtonSize eSize = TOOLBOX_BUTTONSIZE_SMALL;
|
||||
|
||||
SvtMiscOptions aMiscOptions;
|
||||
sal_uInt16 nSize = aMiscOptions.GetSidebarIconSize();
|
||||
if(nSize <= TOOLBOX_BUTTONSIZE_LARGE)
|
||||
eSize = static_cast<ToolBoxButtonSize>(nSize);
|
||||
|
||||
bool bBigImages(eSize == TOOLBOX_BUTTONSIZE_LARGE);
|
||||
SetToolboxButtonSize(eSize);
|
||||
|
||||
for (auto const& it : maControllers)
|
||||
{
|
||||
Reference<frame::XSubToolbarController> xController(it.second, UNO_QUERY);
|
||||
if (xController.is() && xController->opensSubToolbar())
|
||||
{
|
||||
// The button should show the last function that was selected from the
|
||||
// dropdown. The controller should know better than us what it was.
|
||||
xController->updateImage();
|
||||
}
|
||||
else
|
||||
{
|
||||
OUString aCommandURL = GetItemCommand(it.first);
|
||||
if(SfxViewFrame::Current())
|
||||
{
|
||||
css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
|
||||
Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, bBigImages, xFrame);
|
||||
// Try also to query for add-on images before giving up and use an
|
||||
// empty image.
|
||||
if (!aImage)
|
||||
aImage = framework::AddonsOptions().GetImageFromURL(aCommandURL, bBigImages);
|
||||
SetItemImage(it.first, aImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
queue_resize();
|
||||
}
|
||||
|
||||
} } // end of namespace sfx2::sidebar
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -62,6 +62,8 @@ using namespace ::com::sun::star;
|
||||
#define PROPERTYHANDLE_EXPERIMENTALMODE 8
|
||||
#define PROPERTYNAME_MACRORECORDERMODE "MacroRecorderMode"
|
||||
#define PROPERTYHANDLE_MACRORECORDERMODE 9
|
||||
#define PROPERTYNAME_SIDEBARICONSIZE "SidebarIconSize"
|
||||
#define PROPERTYHANDLE_SIDEBARICONSIZE 10
|
||||
|
||||
#define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx>
|
||||
|
||||
@@ -75,6 +77,8 @@ private:
|
||||
bool m_bIsPluginsEnabledRO;
|
||||
sal_Int16 m_nSymbolsSize;
|
||||
bool m_bIsSymbolsSizeRO;
|
||||
sal_Int16 m_nSidebarIconSize;
|
||||
bool m_bIsSidebarIconSizeRO;
|
||||
bool m_bIsSymbolsStyleRO;
|
||||
sal_Int16 m_nToolboxStyle;
|
||||
bool m_bIsToolboxStyleRO;
|
||||
@@ -146,8 +150,13 @@ public:
|
||||
inline sal_Int16 GetSymbolsSize()
|
||||
{ return m_nSymbolsSize; }
|
||||
|
||||
inline sal_Int16 GetSidebarIconSize()
|
||||
{ return m_nSidebarIconSize; }
|
||||
|
||||
void SetSymbolsSize( sal_Int16 nSet );
|
||||
|
||||
void SetSidebarIconSize( sal_Int16 nSet );
|
||||
|
||||
static OUString GetIconTheme();
|
||||
|
||||
enum SetModifiedFlag { SET_MODIFIED, DONT_SET_MODIFIED };
|
||||
@@ -225,6 +234,8 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
|
||||
, m_bIsPluginsEnabledRO( false )
|
||||
, m_nSymbolsSize( 0 )
|
||||
, m_bIsSymbolsSizeRO( false )
|
||||
, m_nSidebarIconSize( 0 )
|
||||
, m_bIsSidebarIconSizeRO( false )
|
||||
, m_bIsSymbolsStyleRO( false )
|
||||
, m_nToolboxStyle( 1 )
|
||||
, m_bIsToolboxStyleRO( false )
|
||||
@@ -275,6 +286,16 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
|
||||
break;
|
||||
}
|
||||
|
||||
case PROPERTYHANDLE_SIDEBARICONSIZE :
|
||||
{
|
||||
if( !(seqValues[nProperty] >>= m_nSidebarIconSize) )
|
||||
{
|
||||
OSL_FAIL("Wrong type of \"Misc\\SidebarIconSize\"!" );
|
||||
}
|
||||
m_bIsSidebarIconSizeRO = seqRO[nProperty];
|
||||
break;
|
||||
}
|
||||
|
||||
case PROPERTYHANDLE_TOOLBOXSTYLE :
|
||||
{
|
||||
if( !(seqValues[nProperty] >>= m_nToolboxStyle) )
|
||||
@@ -404,6 +425,13 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROPERTYHANDLE_SIDEBARICONSIZE : {
|
||||
if( !(seqValues[nProperty] >>= m_nSidebarIconSize) )
|
||||
{
|
||||
OSL_FAIL("Wrong type of \"Misc\\SidebarIconSize\"!" );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROPERTYHANDLE_TOOLBOXSTYLE : {
|
||||
if( !(seqValues[nProperty] >>= m_nToolboxStyle) )
|
||||
{
|
||||
@@ -486,6 +514,13 @@ void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet )
|
||||
CallListeners();
|
||||
}
|
||||
|
||||
void SvtMiscOptions_Impl::SetSidebarIconSize( sal_Int16 nSet )
|
||||
{
|
||||
m_nSidebarIconSize = nSet;
|
||||
SetModified();
|
||||
CallListeners();
|
||||
}
|
||||
|
||||
OUString SvtMiscOptions_Impl::GetIconTheme()
|
||||
{
|
||||
return Application::GetSettings().GetStyleSettings().DetermineIconTheme();
|
||||
@@ -553,6 +588,13 @@ void SvtMiscOptions_Impl::ImplCommit()
|
||||
break;
|
||||
}
|
||||
|
||||
case PROPERTYHANDLE_SIDEBARICONSIZE :
|
||||
{
|
||||
if ( !m_bIsSidebarIconSizeRO )
|
||||
seqValues[nProperty] <<= m_nSidebarIconSize;
|
||||
break;
|
||||
}
|
||||
|
||||
case PROPERTYHANDLE_TOOLBOXSTYLE :
|
||||
{
|
||||
if ( !m_bIsToolboxStyleRO )
|
||||
@@ -634,7 +676,8 @@ Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames()
|
||||
OUString(PROPERTYNAME_SHOWLINKWARNINGDIALOG),
|
||||
OUString(PROPERTYNAME_DISABLEUICUSTOMIZATION),
|
||||
OUString(PROPERTYNAME_EXPERIMENTALMODE),
|
||||
OUString(PROPERTYNAME_MACRORECORDERMODE)
|
||||
OUString(PROPERTYNAME_MACRORECORDERMODE),
|
||||
OUString(PROPERTYNAME_SIDEBARICONSIZE)
|
||||
};
|
||||
|
||||
// Initialize return sequence with these list ...
|
||||
@@ -701,6 +744,16 @@ void SvtMiscOptions::SetSymbolsSize( sal_Int16 nSet )
|
||||
m_pImpl->SetSymbolsSize( nSet );
|
||||
}
|
||||
|
||||
sal_Int16 SvtMiscOptions::GetSidebarIconSize() const
|
||||
{
|
||||
return m_pDataContainer->GetSidebarIconSize();
|
||||
}
|
||||
|
||||
void SvtMiscOptions::SetSidebarIconSize( sal_Int16 nSet )
|
||||
{
|
||||
m_pDataContainer->SetSidebarIconSize( nSet );
|
||||
}
|
||||
|
||||
sal_Int16 SvtMiscOptions::GetCurrentSymbolsSize() const
|
||||
{
|
||||
sal_Int16 eOptSymbolsSize = m_pImpl->GetSymbolsSize();
|
||||
|
Reference in New Issue
Block a user