GSoC notebookbar: BigToolBox
+ New container: sfxlo-BigToolBox + Writer: Paste button with dropdown menu Change-Id: I8fa9ff2cbf594078cc2347bef790b8647ce4e6ea Reviewed-on: https://gerrit.libreoffice.org/28156 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
9a3457b1be
commit
ce59d3be31
@@ -831,5 +831,8 @@
|
|||||||
<glade-widget-class title="Box which can move own content to the popup" name="sfxlo-DropdownBox"
|
<glade-widget-class title="Box which can move own content to the popup" name="sfxlo-DropdownBox"
|
||||||
generic-name="DropdownBox" parent="GtkBox"
|
generic-name="DropdownBox" parent="GtkBox"
|
||||||
icon-name="widget-gtk-box"/>
|
icon-name="widget-gtk-box"/>
|
||||||
|
<glade-widget-class title="Big ToolBox" name="sfxlo-BigToolBox"
|
||||||
|
generic-name="Big ToolBox" parent="GtkToolbar"
|
||||||
|
icon-name="widget-gtk-toolbar"/>
|
||||||
</glade-widget-classes>
|
</glade-widget-classes>
|
||||||
</glade-catalog>
|
</glade-catalog>
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
css::uno::Reference<css::frame::XToolbarController> GetFirstController();
|
css::uno::Reference<css::frame::XToolbarController> GetFirstController();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
typedef std::map<sal_uInt16, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer;
|
typedef std::map<sal_uInt16, css::uno::Reference<css::frame::XToolbarController>> ControllerContainer;
|
||||||
ControllerContainer maControllers;
|
ControllerContainer maControllers;
|
||||||
bool mbAreHandlersRegistered;
|
bool mbAreHandlersRegistered;
|
||||||
|
@@ -68,6 +68,9 @@ enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL,
|
|||||||
// toolbox is prevented from centering the items
|
// toolbox is prevented from centering the items
|
||||||
enum class ToolBoxLayoutMode { Normal, LockVert };
|
enum class ToolBoxLayoutMode { Normal, LockVert };
|
||||||
|
|
||||||
|
// Position of the text when icon and text are painted
|
||||||
|
enum ToolBoxTextPosition { Right, Bottom };
|
||||||
|
|
||||||
struct ImplToolSize
|
struct ImplToolSize
|
||||||
{
|
{
|
||||||
long mnWidth;
|
long mnWidth;
|
||||||
@@ -146,6 +149,7 @@ private:
|
|||||||
PointerStyle meLastStyle;
|
PointerStyle meLastStyle;
|
||||||
WinBits mnWinStyle;
|
WinBits mnWinStyle;
|
||||||
ToolBoxLayoutMode meLayoutMode;
|
ToolBoxLayoutMode meLayoutMode;
|
||||||
|
ToolBoxTextPosition meTextPosition;
|
||||||
Link<ToolBox *, void> maClickHdl;
|
Link<ToolBox *, void> maClickHdl;
|
||||||
Link<ToolBox *, void> maDoubleClickHdl;
|
Link<ToolBox *, void> maDoubleClickHdl;
|
||||||
Link<ToolBox *, void> maActivateHdl;
|
Link<ToolBox *, void> maActivateHdl;
|
||||||
@@ -511,6 +515,8 @@ public:
|
|||||||
|
|
||||||
void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
|
void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
|
||||||
void statusChanged(const css::frame::FeatureStateEvent& rEvent);
|
void statusChanged(const css::frame::FeatureStateEvent& rEvent);
|
||||||
|
|
||||||
|
void SetToolBoxTextPosition( ToolBoxTextPosition ePosition );
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck )
|
inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck )
|
||||||
|
@@ -240,6 +240,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
|
|||||||
sfx2/source/doc/saveastemplatedlg \
|
sfx2/source/doc/saveastemplatedlg \
|
||||||
sfx2/source/explorer/nochaos \
|
sfx2/source/explorer/nochaos \
|
||||||
sfx2/source/inet/inettbc \
|
sfx2/source/inet/inettbc \
|
||||||
|
sfx2/source/notebookbar/BigToolBox \
|
||||||
sfx2/source/notebookbar/DropdownBox \
|
sfx2/source/notebookbar/DropdownBox \
|
||||||
sfx2/source/notebookbar/NotebookBarPopupMenu \
|
sfx2/source/notebookbar/NotebookBarPopupMenu \
|
||||||
sfx2/source/notebookbar/NotebookbarToolBox \
|
sfx2/source/notebookbar/NotebookbarToolBox \
|
||||||
|
53
sfx2/source/notebookbar/BigToolBox.cxx
Normal file
53
sfx2/source/notebookbar/BigToolBox.cxx
Normal file
@@ -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 <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>
|
||||||
|
|
||||||
|
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: */
|
48
sfx2/source/notebookbar/BigToolBox.hxx
Normal file
48
sfx2/source/notebookbar/BigToolBox.hxx
Normal file
@@ -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 <sfx2/sidebar/SidebarToolBox.hxx>
|
||||||
|
#include <sfx2/dllapi.h>
|
||||||
|
#include <vcl/toolbox.hxx>
|
||||||
|
#include <com/sun/star/frame/XDispatch.hpp>
|
||||||
|
#include <com/sun/star/frame/XFrame.hpp>
|
||||||
|
#include <com/sun/star/frame/XToolbarController.hpp>
|
||||||
|
#include <com/sun/star/util/URL.hpp>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
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: */
|
@@ -199,11 +199,6 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="pixbuf">cmd/lc_zoomoptimal.png</property>
|
<property name="pixbuf">cmd/lc_zoomoptimal.png</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="pixbuf">cmd/lc_paste.png</property>
|
|
||||||
</object>
|
|
||||||
<object class="GtkImage" id="inserttableimg">
|
<object class="GtkImage" id="inserttableimg">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@@ -421,15 +416,25 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="vcllo-SmallButton" id="button5">
|
<object class="sfxlo-BigToolBox" id="pastebox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="show_arrow">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuToolButton" id="Paste">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="is_important">True</property>
|
||||||
<property name="action_name">.uno:Paste</property>
|
<property name="action_name">.uno:Paste</property>
|
||||||
<property name="image">image1</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="relief">none</property>
|
</object>
|
||||||
<property name="image_position">top</property>
|
<packing>
|
||||||
<property name="always_show_image">True</property>
|
<property name="expand">False</property>
|
||||||
|
<property name="homogeneous">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -441,8 +446,8 @@
|
|||||||
<object class="GtkBox" id="box6">
|
<object class="GtkBox" id="box6">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="sfxlo-NotebookbarToolBox" id="cutbox">
|
<object class="sfxlo-NotebookbarToolBox" id="cutbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -666,11 +671,11 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparator" id="separator30">
|
<object class="GtkSeparator" id="separator30">
|
||||||
|
<property name="height_request">20</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="height_request">20</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -720,11 +725,11 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparator" id="separator32">
|
<object class="GtkSeparator" id="separator32">
|
||||||
|
<property name="height_request">20</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="height_request">20</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -735,11 +740,11 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparator" id="separator31">
|
<object class="GtkSeparator" id="separator31">
|
||||||
|
<property name="height_request">20</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="height_request">20</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@@ -814,8 +819,8 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">Font</property>
|
<property name="tooltip_text" translatable="yes">Font</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box77">
|
<object class="GtkBox" id="box77">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -945,8 +950,8 @@
|
|||||||
<object class="GtkBox" id="box19">
|
<object class="GtkBox" id="box19">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="sfxlo-NotebookbarToolBox" id="numberbullet">
|
<object class="sfxlo-NotebookbarToolBox" id="numberbullet">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -1113,8 +1118,8 @@
|
|||||||
<object class="GtkGrid" id="grid1">
|
<object class="GtkGrid" id="grid1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="column_spacing">6</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="column_spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="sfxlo-NotebookbarToolBox" id="verticalalignment1">
|
<object class="sfxlo-NotebookbarToolBox" id="verticalalignment1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -1348,8 +1353,8 @@
|
|||||||
<object class="GtkBox" id="box32">
|
<object class="GtkBox" id="box32">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box66">
|
<object class="GtkBox" id="box66">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@@ -1383,6 +1383,7 @@ void ToolBox::ImplInitToolBoxData()
|
|||||||
meLastStyle = PointerStyle::Arrow;
|
meLastStyle = PointerStyle::Arrow;
|
||||||
mnWinStyle = 0;
|
mnWinStyle = 0;
|
||||||
meLayoutMode = ToolBoxLayoutMode::Normal;
|
meLayoutMode = ToolBoxLayoutMode::Normal;
|
||||||
|
meTextPosition = ToolBoxTextPosition::Right;
|
||||||
mnLastFocusItemId = 0;
|
mnLastFocusItemId = 0;
|
||||||
mnKeyModifier = 0;
|
mnKeyModifier = 0;
|
||||||
mnActivateCount = 0;
|
mnActivateCount = 0;
|
||||||
@@ -1854,6 +1855,8 @@ bool ToolBox::ImplCalcItem()
|
|||||||
it->maItemSize.Width() = bText ? GetCtrlTextWidth( it->maText )+TB_TEXTOFFSET : 0;
|
it->maItemSize.Width() = bText ? GetCtrlTextWidth( it->maText )+TB_TEXTOFFSET : 0;
|
||||||
it->maItemSize.Height() = bText ? GetTextHeight() : 0;
|
it->maItemSize.Height() = bText ? GetTextHeight() : 0;
|
||||||
|
|
||||||
|
if ( meTextPosition == ToolBoxTextPosition::Right )
|
||||||
|
{
|
||||||
// leave space between image and text
|
// leave space between image and text
|
||||||
if( bText )
|
if( bText )
|
||||||
it->maItemSize.Width() += TB_IMAGETEXTOFFSET;
|
it->maItemSize.Width() += TB_IMAGETEXTOFFSET;
|
||||||
@@ -1862,6 +1865,18 @@ bool ToolBox::ImplCalcItem()
|
|||||||
it->maItemSize.Width() += it->maImage.GetSizePixel().Width();
|
it->maItemSize.Width() += it->maImage.GetSizePixel().Width();
|
||||||
if ( it->maImage.GetSizePixel().Height() > it->maItemSize.Height() )
|
if ( it->maImage.GetSizePixel().Height() > it->maItemSize.Height() )
|
||||||
it->maItemSize.Height() = it->maImage.GetSizePixel().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;
|
it->mbVisibleText = bText;
|
||||||
}
|
}
|
||||||
@@ -1885,10 +1900,18 @@ bool ToolBox::ImplCalcItem()
|
|||||||
|
|
||||||
// add in drop down arrow
|
// add in drop down arrow
|
||||||
if( it->mnBits & ToolBoxItemBits::DROPDOWN )
|
if( it->mnBits & ToolBoxItemBits::DROPDOWN )
|
||||||
|
{
|
||||||
|
if ( meTextPosition == ToolBoxTextPosition::Right )
|
||||||
{
|
{
|
||||||
it->maItemSize.Width() += nDropDownArrowWidth;
|
it->maItemSize.Width() += nDropDownArrowWidth;
|
||||||
it->mnDropDownArrowWidth = nDropDownArrowWidth;
|
it->mnDropDownArrowWidth = nDropDownArrowWidth;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
it->maItemSize.Height() += nDropDownArrowWidth;
|
||||||
|
it->mnDropDownArrowWidth = nDropDownArrowWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// text items will be rotated in vertical mode
|
// text items will be rotated in vertical mode
|
||||||
// -> swap width and height
|
// -> swap width and height
|
||||||
@@ -1956,7 +1979,8 @@ bool ToolBox::ImplCalcItem()
|
|||||||
ImplAddButtonBorder( nMaxWidth, nMaxHeight, mpData->mbNativeButtons );
|
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
|
// make sure all vertical toolbars have the same width and horizontal have the same height
|
||||||
// this depends on the used button sizes
|
// this depends on the used button sizes
|
||||||
@@ -3164,7 +3188,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
|
|||||||
// draw the image
|
// draw the image
|
||||||
nImageOffX = nOffX;
|
nImageOffX = nOffX;
|
||||||
nImageOffY = nOffY;
|
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
|
// left align also to leave space for drop down arrow
|
||||||
// and when drawing text+image
|
// and when drawing text+image
|
||||||
@@ -3175,6 +3200,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
nImageOffX += (nBtnWidth-aImageSize.Width())/2;
|
nImageOffX += (nBtnWidth-aImageSize.Width())/2;
|
||||||
|
if ( meTextPosition == ToolBoxTextPosition::Right )
|
||||||
nImageOffY += (nBtnHeight-aImageSize.Height())/2;
|
nImageOffY += (nBtnHeight-aImageSize.Height())/2;
|
||||||
}
|
}
|
||||||
if ( nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) )
|
if ( nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) )
|
||||||
@@ -3222,6 +3248,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
|
|||||||
rRenderContext.SetFont(aRotateFont);
|
rRenderContext.SetFont(aRotateFont);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( meTextPosition == ToolBoxTextPosition::Right )
|
||||||
{
|
{
|
||||||
// center vertically
|
// center vertically
|
||||||
nTextOffY += (nBtnHeight-aTxtSize.Height())/2;
|
nTextOffY += (nBtnHeight-aTxtSize.Height())/2;
|
||||||
@@ -3230,6 +3258,13 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
|
|||||||
if( bImage )
|
if( bImage )
|
||||||
nTextOffX = nImageOffX + aImageSize.Width() + TB_IMAGETEXTOFFSET;
|
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)
|
// draw selection only if not already drawn during image output (see above)
|
||||||
if ( !bImage && (nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) ) )
|
if ( !bImage && (nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) ) )
|
||||||
@@ -3253,7 +3288,7 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
|
|||||||
// paint optional drop down arrow
|
// paint optional drop down arrow
|
||||||
if ( pItem->mnBits & ToolBoxItemBits::DROPDOWN )
|
if ( pItem->mnBits & ToolBoxItemBits::DROPDOWN )
|
||||||
{
|
{
|
||||||
Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz ) );
|
Rectangle aDropDownRect( pItem->GetDropDownRect( mbHorz && ( meTextPosition == ToolBoxTextPosition::Right ) ) );
|
||||||
bool bSetColor = true;
|
bool bSetColor = true;
|
||||||
if ( !pItem->mbEnabled || !IsEnabled() )
|
if ( !pItem->mbEnabled || !IsEnabled() )
|
||||||
{
|
{
|
||||||
@@ -3887,7 +3922,8 @@ void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
|
|||||||
// was dropdown arrow pressed
|
// was dropdown arrow pressed
|
||||||
if( (it->mnBits & ToolBoxItemBits::DROPDOWN) )
|
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
|
// dropdownonly always triggers the dropdown handler, over the whole button area
|
||||||
|
|
||||||
@@ -5658,4 +5694,9 @@ void ToolBox::SetToolbarLayoutMode( ToolBoxLayoutMode eLayout )
|
|||||||
meLayoutMode = eLayout;
|
meLayoutMode = eLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolBox::SetToolBoxTextPosition( ToolBoxTextPosition ePosition )
|
||||||
|
{
|
||||||
|
meTextPosition = ePosition;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user