summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-08 20:43:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-10 15:20:26 +0100
commitabfdfe6ac1bfc917d1693874f9dec80167e0806f (patch)
treeadd0fa41f3d148ca9efaf844ae19552a2a504fb3
parent56f79ad5d70226ca64423044c0ba92e265776802 (diff)
weld SvxFmTbxCtlRecTotal label item window
and SvxFmTbxCtlRecText label item window and SvxFmTbxCtlRecFromText label item window Change-Id: I5c5bbdacfe7e69abd44b9a548deadbf6c4d2a7d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88283 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/toolbox.hxx3
-rw-r--r--include/vcl/weld.hxx2
-rw-r--r--sd/source/ui/sidebar/LayoutMenu.cxx1
-rw-r--r--sfx2/source/control/InterimItemWindow.cxx12
-rw-r--r--solenv/sanitizers/ui/svx.suppr1
-rw-r--r--svx/UIConfig_svx.mk1
-rw-r--r--svx/inc/pch/precompiled_svx.hxx4
-rw-r--r--svx/source/form/tbxform.cxx94
-rw-r--r--svx/source/inc/tbxform.hxx3
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx7
-rw-r--r--svx/uiconfig/ui/labelbox.ui23
-rw-r--r--vcl/inc/toolbox.h1
-rw-r--r--vcl/source/app/salvtables.cxx5
-rw-r--r--vcl/source/window/toolbox.cxx3
-rw-r--r--vcl/source/window/toolbox2.cxx11
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx5
16 files changed, 125 insertions, 51 deletions
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index a0ec7f897fe1..8a85863dd162 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -361,6 +361,9 @@ public:
ToolBoxItemBits GetItemBits( sal_uInt16 nItemId ) const;
void SetItemExpand( sal_uInt16 nItemId, bool bExpand );
+ // e.g. a label used as an itemwindow
+ void SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive);
+
void SetItemData( sal_uInt16 nItemId, void* pNewData );
void* GetItemData( sal_uInt16 nItemId ) const;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 464047bdf843..9ed79878ea70 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -262,6 +262,8 @@ public:
virtual void set_stack_background() = 0;
//make this widget look like it has a highlighted background
virtual void set_highlight_background() = 0;
+ //make this widget suitable for use in a toolbar
+ virtual void set_toolbar_background() = 0;
virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() = 0;
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index 701c1ce27132..2b12aa17f34e 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -755,7 +755,6 @@ void LayoutMenu::DataChanged (const DataChangedEvent& /*rEvent*/)
{
Fill();
mxLayoutValueSet->StyleUpdated();
-//TODO SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
mxLayoutValueSet->SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground));
}
diff --git a/sfx2/source/control/InterimItemWindow.cxx b/sfx2/source/control/InterimItemWindow.cxx
index d2beb658181a..8e6ddb096318 100644
--- a/sfx2/source/control/InterimItemWindow.cxx
+++ b/sfx2/source/control/InterimItemWindow.cxx
@@ -17,6 +17,8 @@ InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXM
m_xVclContentArea->Show();
m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription));
m_xContainer = m_xBuilder->weld_container(rID);
+
+ SetBackground(Wallpaper(COL_TRANSPARENT));
}
InterimItemWindow::~InterimItemWindow() { disposeOnce(); }
@@ -64,16 +66,18 @@ bool InterimItemWindow::ChildKeyInput(const KeyEvent& rKEvt)
SetFakeFocus(true);
GrabFocus();
- /* let toolbox know we have focus so it updates its mnHighItemId to point
+ /* now give focus to our toolbox parent */
+ vcl::Window* pToolBox = GetParent();
+ pToolBox->GrabFocus();
+
+ /* let toolbox know this item window has focus so it updates its mnHighItemId to point
to this toolitem in case tab means to move to another toolitem within
the toolbox
*/
NotifyEvent aNEvt(MouseNotifyEvent::GETFOCUS, this);
- vcl::Window* pToolBox = GetParent();
pToolBox->EventNotify(aNEvt);
- /* now give focus to our toolbox parent and send it the tab */
- pToolBox->GrabFocus();
+ /* send parent the tab */
pToolBox->KeyInput(rKEvt);
return true;
diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 2037cc5c2d90..5baa2b48f9a4 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -46,6 +46,7 @@ svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelFooterFormat'] orphan
svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statusurl'] orphan-label
svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statuspos'] orphan-label
svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statussize'] orphan-label
+svx/uiconfig/ui/labelbox.ui://GtkLabel[@id='label'] orphan-label
svx/uiconfig/ui/mediaplayback.ui://GtkEntry[@id='timeedit'] no-labelled-by
svx/uiconfig/ui/medialine.ui://GtkEntry[@id='timeedit'] no-labelled-by
svx/uiconfig/ui/medialine.ui://GtkLabel[@id='url'] orphan-label
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 69a7e7ea6e92..48f8b24c3e09 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/imapmenu \
svx/uiconfig/ui/interimdockparent \
svx/uiconfig/ui/interimparent \
+ svx/uiconfig/ui/labelbox \
svx/uiconfig/ui/lightingwindow \
svx/uiconfig/ui/linkwarndialog \
svx/uiconfig/ui/measurewidthbar \
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index 335be47a3561..c463eccb9b4a 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-02-07 12:03:14 using:
+ Generated on 2020-02-08 20:53:08 using:
./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -82,11 +82,11 @@
#include <vcl/customweld.hxx>
#include <vcl/dllapi.h>
#include <vcl/dockwin.hxx>
+#include <vcl/edit.hxx>
#include <vcl/errcode.hxx>
#include <vcl/errinf.hxx>
#include <vcl/event.hxx>
#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/font.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/graph.hxx>
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index ab80e13aa4ba..94e00643b897 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -21,14 +21,13 @@
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
#include <svl/stritem.hxx>
+#include <sfx2/InterimItemWindow.hxx>
#include <sfx2/dispatch.hxx>
#include <vcl/event.hxx>
#include <vcl/toolbox.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/settings.hxx>
#include <formtoolbars.hxx>
-
#include <svx/dialmgr.hxx>
#include <svx/svxids.hrc>
#include <svx/strings.hrc>
@@ -143,23 +142,57 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem );
SvxFmTbxCtlRecText::SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
:SfxToolBoxControl( nSlotId, nId, rTbx )
{
+ rTbx.SetItemWindowNonInteractive(nId, true);
}
SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText()
{
}
+class LabelItemWindow final : public InterimItemWindow
+{
+private:
+ std::unique_ptr<weld::Label> m_xLabel;
+public:
+ LabelItemWindow(vcl::Window *pParent, const OUString& rLabel)
+ : InterimItemWindow(pParent, "svx/ui/labelbox.ui", "LabelBox")
+ , m_xLabel(m_xBuilder->weld_label("label"))
+ {
+ m_xLabel->set_label(rLabel);
+ Size aSize(m_xLabel->get_preferred_size());
+ aSize.AdjustWidth(12);
+ m_xLabel->set_size_request(aSize.Width(), -1);
+
+ SetSizePixel(m_xLabel->get_preferred_size());
+
+ m_xLabel->set_toolbar_background();
+ }
+
+ void set_label(const OUString& rLabel)
+ {
+ m_xLabel->set_label(rLabel);
+ }
+
+ virtual void dispose() override
+ {
+ m_xLabel.reset();
+ InterimItemWindow::dispose();
+ }
+
+ virtual ~LabelItemWindow() override
+ {
+ disposeOnce();
+ }
+};
+
VclPtr<vcl::Window> SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent )
{
OUString aText(SvxResId(RID_STR_REC_TEXT));
- VclPtrInstance<FixedText> pFixedText( pParent );
- Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
- pFixedText->SetText( aText );
- aSize.AdjustWidth(6 );
- pFixedText->SetSizePixel( aSize );
- pFixedText->SetBackground(Wallpaper(COL_TRANSPARENT));
-
- return pFixedText;
+ VclPtrInstance<LabelItemWindow> xFixedText(pParent, aText);
+
+ xFixedText->Show();
+
+ return xFixedText;
}
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecFromText, SfxBoolItem );
@@ -167,57 +200,48 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecFromText, SfxBoolItem );
SvxFmTbxCtlRecFromText::SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
:SfxToolBoxControl( nSlotId, nId, rTbx )
{
+ rTbx.SetItemWindowNonInteractive(nId, true);
}
-
SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText()
{
}
-
VclPtr<vcl::Window> SvxFmTbxCtlRecFromText::CreateItemWindow( vcl::Window* pParent )
{
OUString aText(SvxResId(RID_STR_REC_FROM_TEXT));
- VclPtrInstance<FixedText> pFixedText( pParent, WB_CENTER );
- Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
- aSize.AdjustWidth(12 );
- pFixedText->SetText( aText );
- pFixedText->SetSizePixel( aSize );
- pFixedText->SetBackground(Wallpaper(COL_TRANSPARENT));
- return pFixedText.get();
+ VclPtrInstance<LabelItemWindow> xFixedText(pParent, aText);
+
+ xFixedText->Show();
+
+ return xFixedText;
}
SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem );
-
SvxFmTbxCtlRecTotal::SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
- :SfxToolBoxControl( nSlotId, nId, rTbx )
- ,pFixedText( nullptr )
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
{
+ rTbx.SetItemWindowNonInteractive(nId, true);
}
-
SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal()
{
}
-
VclPtr<vcl::Window> SvxFmTbxCtlRecTotal::CreateItemWindow( vcl::Window* pParent )
{
- pFixedText.reset(VclPtr<FixedText>::Create( pParent ));
OUString const aSample("123456");
- Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
- aSize.AdjustWidth(12 );
- pFixedText->SetSizePixel( aSize );
- pFixedText->SetBackground();
- pFixedText->SetPaintTransparent(true);
- return pFixedText;
-}
+ m_xFixedText.reset(VclPtr<LabelItemWindow>::Create(pParent, aSample));
+ m_xFixedText->set_label("");
+ m_xFixedText->Show();
+
+ return m_xFixedText;
+}
void SvxFmTbxCtlRecTotal::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
-
// setting the FixedText
if (GetSlotId() != SID_FM_RECORD_TOTAL)
return;
@@ -228,9 +252,7 @@ void SvxFmTbxCtlRecTotal::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
else
aText = "?";
- pFixedText->SetText( aText );
- pFixedText->Update();
- pFixedText->Flush();
+ m_xFixedText->set_label(aText);
SfxToolBoxControl::StateChanged( nSID, eState,pState );
}
diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx
index 95546f3ce80e..f436a91b2275 100644
--- a/svx/source/inc/tbxform.hxx
+++ b/svx/source/inc/tbxform.hxx
@@ -77,10 +77,11 @@ public:
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window* pParent ) override;
};
+class LabelItemWindow;
class SvxFmTbxCtlRecTotal : public SfxToolBoxControl
{
- VclPtr<FixedText> pFixedText;
+ VclPtr<LabelItemWindow> m_xFixedText;
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index dbbea77c8d37..0fcf01de5d32 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -22,7 +22,6 @@
#include <i18nutil/unicode.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/idle.hxx>
#include <vcl/svapp.hxx>
#include <svl/intitem.hxx>
@@ -215,11 +214,7 @@ ImplGrafControl::ImplGrafControl(
{
OUString sResId(ImplGetRID(rCmd));
mxImage->set_from_icon_name(sResId);
-#if 0
- // we want to see the background of the toolbox, not of the FixedImage or Control
- maImage->SetBackground( Wallpaper( COL_TRANSPARENT ) );
- SetBackground( Wallpaper( COL_TRANSPARENT ) );
-#endif
+ mxImage->set_toolbar_background();
SetBackground( Wallpaper() ); // transparent background
diff --git a/svx/uiconfig/ui/labelbox.ui b/svx/uiconfig/ui/labelbox.ui
new file mode 100644
index 000000000000..5f07290f56ee
--- /dev/null
+++ b/svx/uiconfig/ui/labelbox.ui
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svx">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkBox" id="LabelBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 3012c5916570..b534b219245f 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -35,6 +35,7 @@ namespace vcl { class Window; }
struct ImplToolItem
{
VclPtr<vcl::Window> mpWindow; //don't dispose mpWindow - we get copied around
+ bool mbNonInteractiveWindow;
void* mpUserData;
Image maImage;
long mnImageAngle;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f1bc5c341d47..d53ea9292835 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -734,6 +734,11 @@ public:
set_background(m_xWidget->GetSettings().GetStyleSettings().GetWindowColor());
}
+ virtual void set_toolbar_background() override
+ {
+ m_xWidget->SetBackground(Wallpaper(COL_TRANSPARENT));
+ }
+
virtual void set_highlight_background() override
{
set_background(m_xWidget->GetSettings().GetStyleSettings().GetHighlightColor());
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 6763ca2d09e0..a781b314d751 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -609,7 +609,8 @@ void ToolBox::ImplDrawBorder(vcl::RenderContext& rRenderContext)
static bool ImplIsFixedControl( const ImplToolItem *pItem )
{
return ( pItem->mpWindow &&
- (pItem->mpWindow->GetType() == WindowType::FIXEDTEXT ||
+ (pItem->mbNonInteractiveWindow ||
+ pItem->mpWindow->GetType() == WindowType::FIXEDTEXT ||
pItem->mpWindow->GetType() == WindowType::FIXEDLINE ||
pItem->mpWindow->GetType() == WindowType::GROUPBOX) );
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 75bf5cc95a86..68cf9a383085 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -79,6 +79,7 @@ void ImplToolItem::init(sal_uInt16 nItemId, ToolBoxItemBits nItemBits,
{
mnId = nItemId;
mpWindow = nullptr;
+ mbNonInteractiveWindow = false;
mpUserData = nullptr;
meType = ToolBoxItemType::BUTTON;
mnBits = nItemBits;
@@ -878,6 +879,16 @@ void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits )
}
}
+void ToolBox::SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive)
+{
+ ImplToolItems::size_type nPos = GetItemPos( nItemId );
+
+ if ( nPos < GetItemCount() )
+ {
+ mpData->m_aItems[nPos].mbNonInteractiveWindow = bNonInteractive;
+ }
+}
+
ToolBoxItemBits ToolBox::GetItemBits( sal_uInt16 nItemId ) const
{
ImplToolItem* pItem = ImplGetItem( nItemId );
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e0922c1afe98..7a9d53f8a61f 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2885,6 +2885,11 @@ public:
set_background(&sColor);
}
+ virtual void set_toolbar_background() override
+ {
+ // no-op
+ }
+
virtual ~GtkInstanceWidget() override
{
if (m_pFocusInEvent)