diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 244e0db65d31..ebb4d471d718 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -831,5 +831,8 @@ + diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx index 131364d51f66..17a8e48e1202 100644 --- a/include/sfx2/sidebar/SidebarToolBox.hxx +++ b/include/sfx2/sidebar/SidebarToolBox.hxx @@ -59,7 +59,7 @@ public: css::uno::Reference GetFirstController(); -private: +protected: typedef std::map> ControllerContainer; ControllerContainer maControllers; bool mbAreHandlersRegistered; diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 06df8594c644..96a25803fe7a 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -68,6 +68,9 @@ enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, // toolbox is prevented from centering the items enum class ToolBoxLayoutMode { Normal, LockVert }; +// Position of the text when icon and text are painted +enum ToolBoxTextPosition { Right, Bottom }; + struct ImplToolSize { long mnWidth; @@ -146,6 +149,7 @@ private: PointerStyle meLastStyle; WinBits mnWinStyle; ToolBoxLayoutMode meLayoutMode; + ToolBoxTextPosition meTextPosition; Link maClickHdl; Link maDoubleClickHdl; Link maActivateHdl; @@ -511,6 +515,8 @@ public: void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout ); void statusChanged(const css::frame::FeatureStateEvent& rEvent); + + void SetToolBoxTextPosition( ToolBoxTextPosition ePosition ); }; inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck ) diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 460697532fad..02956b1bb23e 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -240,6 +240,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/saveastemplatedlg \ sfx2/source/explorer/nochaos \ sfx2/source/inet/inettbc \ + sfx2/source/notebookbar/BigToolBox \ sfx2/source/notebookbar/DropdownBox \ sfx2/source/notebookbar/NotebookBarPopupMenu \ sfx2/source/notebookbar/NotebookbarToolBox \ diff --git a/sfx2/source/notebookbar/BigToolBox.cxx b/sfx2/source/notebookbar/BigToolBox.cxx new file mode 100644 index 000000000000..8848cba41f52 --- /dev/null +++ b/sfx2/source/notebookbar/BigToolBox.cxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "BigToolBox.hxx" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace sfx2 { namespace notebookbar { + +BigToolBox::BigToolBox(vcl::Window* pParent) + : SidebarToolBox(pParent) +{ + SvtMiscOptions aMiscOptions; + aMiscOptions.RemoveListenerLink(LINK(this, SidebarToolBox, ChangedIconSizeHandler)); + + SetToolboxButtonSize(TOOLBOX_BUTTONSIZE_LARGE); + SetButtonType(ButtonType::SYMBOLTEXT); + SetToolBoxTextPosition(ToolBoxTextPosition::Bottom); +} + +VCL_BUILDER_FACTORY(BigToolBox) + +} } // end of namespace sfx2::notebookbar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/notebookbar/BigToolBox.hxx b/sfx2/source/notebookbar/BigToolBox.hxx new file mode 100644 index 000000000000..4e319437c7cf --- /dev/null +++ b/sfx2/source/notebookbar/BigToolBox.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_NOTEBOOKBAR_BIGTOOLBOX_HXX +#define INCLUDED_SFX2_SOURCE_NOTEBOOKBAR_BIGTOOLBOX_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sfx2 { namespace notebookbar { + +/** BigToolBox +*/ + +class SFX2_DLLPUBLIC BigToolBox : public sfx2::sidebar::SidebarToolBox +{ +public: + BigToolBox(vcl::Window* pParent); +}; + + +} } // end of namespace sfx2::notebookbar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index c5d531b484f0..72ba1ea1bbc6 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -199,11 +199,6 @@ False cmd/lc_zoomoptimal.png - - True - False - cmd/lc_paste.png - True False @@ -421,15 +416,25 @@ True False - + True - True - True - .uno:Paste - image1 - none - top - True + False + center + False + + + False + True + False + True + .uno:Paste + True + + + False + True + + False @@ -441,8 +446,8 @@ True False - vertical center + vertical True @@ -666,11 +671,11 @@ + 20 True False - vertical - 20 center + vertical False @@ -720,11 +725,11 @@ + 20 True False - vertical - 20 center + vertical False @@ -735,11 +740,11 @@ + 20 True False - vertical - 20 center + vertical False @@ -814,8 +819,8 @@ True False Font - vertical center + vertical True @@ -945,8 +950,8 @@ True False - vertical center + vertical True @@ -1113,8 +1118,8 @@ True False - 6 center + 6 True @@ -1348,8 +1353,8 @@ True False - vertical center + vertical True diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 7e6601766b7a..f203f4e5f5f4 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1383,6 +1383,7 @@ void ToolBox::ImplInitToolBoxData() meLastStyle = PointerStyle::Arrow; mnWinStyle = 0; meLayoutMode = ToolBoxLayoutMode::Normal; + meTextPosition = ToolBoxTextPosition::Right; mnLastFocusItemId = 0; mnKeyModifier = 0; mnActivateCount = 0; @@ -1854,14 +1855,28 @@ bool ToolBox::ImplCalcItem() it->maItemSize.Width() = bText ? GetCtrlTextWidth( it->maText )+TB_TEXTOFFSET : 0; it->maItemSize.Height() = bText ? GetTextHeight() : 0; - // leave space between image and text - if( bText ) - it->maItemSize.Width() += TB_IMAGETEXTOFFSET; + if ( meTextPosition == ToolBoxTextPosition::Right ) + { + // leave space between image and text + if( bText ) + it->maItemSize.Width() += TB_IMAGETEXTOFFSET; - // image and text side by side - it->maItemSize.Width() += it->maImage.GetSizePixel().Width(); - if ( it->maImage.GetSizePixel().Height() > it->maItemSize.Height() ) - it->maItemSize.Height() = it->maImage.GetSizePixel().Height(); + // image and text side by side + it->maItemSize.Width() += it->maImage.GetSizePixel().Width(); + if ( it->maImage.GetSizePixel().Height() > it->maItemSize.Height() ) + it->maItemSize.Height() = it->maImage.GetSizePixel().Height(); + } + else + { + // leave space between image and text + if( bText ) + it->maItemSize.Height() += TB_IMAGETEXTOFFSET; + + // text below image + it->maItemSize.Height() += it->maImage.GetSizePixel().Height(); + if ( it->maImage.GetSizePixel().Width() > it->maItemSize.Width() ) + it->maItemSize.Width() = it->maImage.GetSizePixel().Width(); + } it->mbVisibleText = bText; } @@ -1886,8 +1901,16 @@ bool ToolBox::ImplCalcItem() // add in drop down arrow if( it->mnBits & ToolBoxItemBits::DROPDOWN ) { - it->maItemSize.Width() += nDropDownArrowWidth; - it->mnDropDownArrowWidth = nDropDownArrowWidth; + if ( meTextPosition == ToolBoxTextPosition::Right ) + { + it->maItemSize.Width() += nDropDownArrowWidth; + it->mnDropDownArrowWidth = nDropDownArrowWidth; + } + else + { + it->maItemSize.Height() += nDropDownArrowWidth; + it->mnDropDownArrowWidth = nDropDownArrowWidth; + } } // text items will be rotated in vertical mode @@ -1956,7 +1979,8 @@ bool ToolBox::ImplCalcItem() ImplAddButtonBorder( nMaxWidth, nMaxHeight, mpData->mbNativeButtons ); } - if( !ImplIsFloatingMode() && GetToolboxButtonSize() != TOOLBOX_BUTTONSIZE_DONTCARE ) + if( !ImplIsFloatingMode() && GetToolboxButtonSize() != TOOLBOX_BUTTONSIZE_DONTCARE + && ( meTextPosition == ToolBoxTextPosition::Right ) ) { // make sure all vertical toolbars have the same width and horizontal have the same height // this depends on the used button sizes @@ -3164,7 +3188,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, // draw the image nImageOffX = nOffX; nImageOffY = nOffY; - if ( (pItem->mnBits & (ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN)) || bText ) + if ( ( (pItem->mnBits & (ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN)) || bText ) + && ( meTextPosition == ToolBoxTextPosition::Right ) ) { // left align also to leave space for drop down arrow // and when drawing text+image @@ -3175,7 +3200,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, else { nImageOffX += (nBtnWidth-aImageSize.Width())/2; - nImageOffY += (nBtnHeight-aImageSize.Height())/2; + if ( meTextPosition == ToolBoxTextPosition::Right ) + nImageOffY += (nBtnHeight-aImageSize.Height())/2; } if ( nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) ) { @@ -3223,12 +3249,21 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, } else { - // center vertically - nTextOffY += (nBtnHeight-aTxtSize.Height())/2; + if ( meTextPosition == ToolBoxTextPosition::Right ) + { + // center vertically + nTextOffY += (nBtnHeight-aTxtSize.Height())/2; - // add in image offset - if( bImage ) - nTextOffX = nImageOffX + aImageSize.Width() + TB_IMAGETEXTOFFSET; + // add in image offset + if( bImage ) + nTextOffX = nImageOffX + aImageSize.Width() + TB_IMAGETEXTOFFSET; + } + else + { + long nArrowHeight = ( pItem->mnBits & ToolBoxItemBits::DROPDOWN ) + ? TB_DROPDOWNARROWWIDTH : 0; + nTextOffY += nBtnHeight - aTxtSize.Height() - nArrowHeight; + } } // draw selection only if not already drawn during image output (see above) @@ -3253,7 +3288,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, // paint optional drop down arrow if ( pItem->mnBits & ToolBoxItemBits::DROPDOWN ) { - Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz ) ); + Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz && ( meTextPosition == ToolBoxTextPosition::Right ) ) ); bool bSetColor = true; if ( !pItem->mbEnabled || !IsEnabled() ) { @@ -3887,7 +3922,8 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt ) // was dropdown arrow pressed if( (it->mnBits & ToolBoxItemBits::DROPDOWN) ) { - if( ( (it->mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) || it->GetDropDownRect( mbHorz ).IsInside( aMousePos )) + if( ( (it->mnBits & ToolBoxItemBits::DROPDOWNONLY) == ToolBoxItemBits::DROPDOWNONLY) + || it->GetDropDownRect( mbHorz && ( meTextPosition == ToolBoxTextPosition::Right ) ).IsInside( aMousePos )) { // dropdownonly always triggers the dropdown handler, over the whole button area @@ -5658,4 +5694,9 @@ void ToolBox::SetToolbarLayoutMode( ToolBoxLayoutMode eLayout ) meLayoutMode = eLayout; } +void ToolBox::SetToolBoxTextPosition( ToolBoxTextPosition ePosition ) +{ + meTextPosition = ePosition; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */