summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-07 11:01:51 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-07 14:11:27 +0100
commit0093d310dc7ecc8206bfcf6ad802a5c389f006e4 (patch)
tree3cce5f24d311c7085c180640841868fbde6ad3dc
parent069aa870aadb9f9069e8715c8be30394410f0288 (diff)
weld GlueEscDirLB ItemWindow
Change-Id: I472ba595bb2f31bedf1d0e0a890024f9ac3ada39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88176 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sd/UIConfig_simpress.mk1
-rw-r--r--sd/source/ui/dlg/gluectrl.cxx71
-rw-r--r--sd/source/ui/inc/gluectrl.hxx20
-rw-r--r--sd/uiconfig/simpress/ui/gluebox.ui23
4 files changed, 84 insertions, 31 deletions
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index 3b12fc536374..ea014ef301b6 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -121,6 +121,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
sd/uiconfig/simpress/ui/effectmenu \
sd/uiconfig/simpress/ui/fontsizemenu \
sd/uiconfig/simpress/ui/fontstylemenu \
+ sd/uiconfig/simpress/ui/gluebox \
sd/uiconfig/simpress/ui/headerfooterdialog \
sd/uiconfig/simpress/ui/headerfootertab \
sd/uiconfig/simpress/ui/impressprinteroptions \
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index 9f2b9e7f3334..110d945055ee 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -49,26 +49,49 @@ SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlGlueEscDir, SfxUInt16Item )
/**
* Constructor for glue point escape direction Listbox
*/
-GlueEscDirLB::GlueEscDirLB( vcl::Window* pParent, const Reference< XFrame >& rFrame ) :
- ListBox( pParent, WinBits( WB_BORDER | WB_DROPDOWN ) ),
- m_xFrame( rFrame )
+GlueEscDirLB::GlueEscDirLB(vcl::Window* pParent, const Reference<XFrame>& rFrame)
+ : InterimItemWindow(pParent, "modules/simpress/ui/gluebox.ui", "GlueBox")
+ , m_xFrame(rFrame)
+ , m_xWidget(m_xBuilder->weld_combo_box("gluetype"))
{
- Size aXSize( GetTextWidth( "X" ), GetTextHeight() );
- SetSizePixel( Size( aXSize.Width() * 12, aXSize.Height() * 10 ) );
Fill();
+
+ m_xWidget->connect_changed(LINK(this, GlueEscDirLB, SelectHdl));
+ m_xWidget->connect_key_press(LINK(this, GlueEscDirLB, KeyInputHdl));
+
+ SetSizePixel(m_xWidget->get_preferred_size());
+
Show();
}
+void GlueEscDirLB::dispose()
+{
+ m_xWidget.reset();
+ InterimItemWindow::dispose();
+}
+
GlueEscDirLB::~GlueEscDirLB()
{
+ disposeOnce();
+}
+
+void GlueEscDirLB::set_sensitive(bool bSensitive)
+{
+ Enable(bSensitive);
+ m_xWidget->set_sensitive(bSensitive);
+}
+
+IMPL_LINK(GlueEscDirLB, KeyInputHdl, const KeyEvent&, rKEvt, bool)
+{
+ return ChildKeyInput(rKEvt);
}
/**
* Determines the escape direction and sends the corresponding slot
*/
-void GlueEscDirLB::Select()
+IMPL_LINK(GlueEscDirLB, SelectHdl, weld::ComboBox&, rBox, void)
{
- sal_Int32 nPos = GetSelectedEntryPos();
+ sal_Int32 nPos = rBox.get_active();
SfxUInt16Item aItem( SID_GLUE_ESCDIR, static_cast<sal_uInt16>(aEscDirArray[ nPos ]) );
if ( m_xFrame.is() )
@@ -89,19 +112,19 @@ void GlueEscDirLB::Select()
*/
void GlueEscDirLB::Fill()
{
- InsertEntry( SdResId( STR_GLUE_ESCDIR_SMART ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_LEFT ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_RIGHT ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_TOP ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_BOTTOM ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_SMART ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_LEFT ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_RIGHT ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_TOP ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_BOTTOM ) );
/*
- InsertEntry( SdResId( STR_GLUE_ESCDIR_LO ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_LU ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_RO ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_RU ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_HORZ ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_VERT ) );
- InsertEntry( SdResId( STR_GLUE_ESCDIR_ALL ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_LO ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_LU ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_RO ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_RU ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_HORZ ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_VERT ) );
+ m_xWidget->append_text( SdResId( STR_GLUE_ESCDIR_ALL ) );
*/
}
@@ -128,21 +151,21 @@ void SdTbxCtlGlueEscDir::StateChanged( sal_uInt16 nSId,
{
if( pState )
{
- pGlueEscDirLB->Enable();
+ pGlueEscDirLB->set_sensitive(true);
if ( IsInvalidItem( pState ) )
{
- pGlueEscDirLB->SetNoSelection();
+ pGlueEscDirLB->set_active(-1);
}
else
{
SdrEscapeDirection nEscDir = static_cast<SdrEscapeDirection>(static_cast<const SfxUInt16Item*>( pState )->GetValue());
- pGlueEscDirLB->SelectEntryPos( GetEscDirPos( nEscDir ) );
+ pGlueEscDirLB->set_active( GetEscDirPos( nEscDir ) );
}
}
else
{
- pGlueEscDirLB->Disable();
- pGlueEscDirLB->SetNoSelection();
+ pGlueEscDirLB->set_sensitive(false);
+ pGlueEscDirLB->set_active(-1);
}
}
}
diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx
index 15e8a0caf0d4..dcbd0f7fe97f 100644
--- a/sd/source/ui/inc/gluectrl.hxx
+++ b/sd/source/ui/inc/gluectrl.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_SD_SOURCE_UI_INC_GLUECTRL_HXX
#define INCLUDED_SD_SOURCE_UI_INC_GLUECTRL_HXX
-#include <vcl/lstbox.hxx>
+#include <sfx2/InterimItemWindow.hxx>
#include <sfx2/tbxctrl.hxx>
enum class SdrEscapeDirection;
@@ -28,18 +28,24 @@ enum class SdrEscapeDirection;
/**
* GluePointEscDirLB
*/
-class GlueEscDirLB : public ListBox
+class GlueEscDirLB final : public InterimItemWindow
{
private:
css::uno::Reference< css::frame::XFrame > m_xFrame;
+ std::unique_ptr<weld::ComboBox> m_xWidget;
+
+ DECL_LINK(SelectHdl, weld::ComboBox&, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+
public:
- GlueEscDirLB( vcl::Window* pParent,
- const css::uno::Reference< css::frame::XFrame >& rFrame );
- virtual ~GlueEscDirLB() override;
+ GlueEscDirLB(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame);
+ virtual void dispose() override;
+ virtual ~GlueEscDirLB() override;
- virtual void Select() override;
+ void set_active(int nPos) { m_xWidget->set_active(nPos); }
+ void set_sensitive(bool bSensitive);
- void Fill();
+ void Fill();
};
/**
diff --git a/sd/uiconfig/simpress/ui/gluebox.ui b/sd/uiconfig/simpress/ui/gluebox.ui
new file mode 100644
index 000000000000..722f241646af
--- /dev/null
+++ b/sd/uiconfig/simpress/ui/gluebox.ui
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sd">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkBox" id="GlueBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBoxText" id="gluetype">
+ <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>