summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-14 09:12:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-15 13:43:52 +0100
commit25507f1dc5dada133dc915a2991c40843edbcf78 (patch)
tree68ce15af5c4cbf5f3809df04b24c3429eae46ab7
parent3b778323cb8c6c85077d2a0dc0a2d673da80719f (diff)
weld NavElementBox_Impl Item Window
Change-Id: I72a7cc6d60cb4149838933c3c57982ebefea458d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88677 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx10
-rw-r--r--sw/UIConfig_swriter.mk1
-rw-r--r--sw/inc/pch/precompiled_msword.hxx13
-rw-r--r--sw/inc/pch/precompiled_sw.hxx11
-rw-r--r--sw/inc/pch/precompiled_vbaswobj.hxx6
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx111
-rw-r--r--sw/uiconfig/swriter/ui/combobox.ui52
-rw-r--r--vcl/source/window/toolbox2.cxx2
8 files changed, 135 insertions, 71 deletions
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index ec8f23b7f8f0..43c1d7ec456c 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -106,7 +106,9 @@ public:
virtual void GetFocus() override
{
- m_xWidget->grab_focus();
+ if (m_xWidget)
+ m_xWidget->grab_focus();
+ InterimItemWindow::GetFocus();
}
private:
@@ -396,9 +398,9 @@ void FindTextFieldControl::set_entry_message_type(weld::EntryMessageType eType)
void FindTextFieldControl::GetFocus()
{
- if (!m_xWidget)
- return;
- m_xWidget->grab_focus();
+ if (m_xWidget)
+ m_xWidget->grab_focus();
+ InterimItemWindow::GetFocus();
}
namespace {
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index a1f97fcd7c00..d94a854e1efd 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -114,6 +114,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/columndialog \
sw/uiconfig/swriter/ui/columnpage \
sw/uiconfig/swriter/ui/columnwidth \
+ sw/uiconfig/swriter/ui/combobox \
sw/uiconfig/swriter/ui/comboboxfragment \
sw/uiconfig/swriter/ui/conditionpage \
sw/uiconfig/swriter/ui/converttexttable \
diff --git a/sw/inc/pch/precompiled_msword.hxx b/sw/inc/pch/precompiled_msword.hxx
index dfcc3948e15f..0eff00865266 100644
--- a/sw/inc/pch/precompiled_msword.hxx
+++ b/sw/inc/pch/precompiled_msword.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-01-22 15:58:37 using:
+ Generated on 2020-02-14 09:24:02 using:
./bin/update_pch sw msword --cutoff=4 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -128,6 +128,7 @@
#include <vcl/outdev.hxx>
#include <vcl/outdevmap.hxx>
#include <vcl/outdevstate.hxx>
+#include <vcl/ptrstyle.hxx>
#include <vcl/region.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
@@ -181,12 +182,12 @@
#include <com/sun/star/awt/SystemPointer.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/document/EventObject.hpp>
@@ -220,6 +221,7 @@
#include <com/sun/star/i18n/reservedWords.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -227,6 +229,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/style/TabAlign.hpp>
@@ -343,7 +346,8 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <o3tl/underlyingenumvalue.hxx>
-#include <ooo/vba/word/WdSaveFormat.hpp>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <ooo/vba/word/XParagraphFormat.hpp>
#include <oox/dllapi.h>
#include <oox/drawingml/drawingmltypes.hxx>
#include <oox/export/utils.hxx>
@@ -485,6 +489,9 @@
#include <unotools/transliterationwrapper.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/unotoolsdllapi.h>
+#include <vbahelper/vbadllapi.h>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbahelperinterface.hxx>
#endif // PCH_LEVEL >= 3
#if PCH_LEVEL >= 4
#include <IDocumentDrawModelAccess.hxx>
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index 9784c56086a0..ff6d99eaff68 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.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-13 21:38:09 using:
+ Generated on 2020-02-14 09:24:22 using:
./bin/update_pch sw sw --cutoff=7 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -68,9 +68,6 @@
#include <rtl/math.hxx>
#include <rtl/ref.hxx>
#include <rtl/strbuf.hxx>
-#include <rtl/string.h>
-#include <rtl/stringconcat.hxx>
-#include <rtl/stringutils.hxx>
#include <rtl/tencinfo.h>
#include <rtl/textenc.h>
#include <rtl/unload.h>
@@ -93,9 +90,7 @@
#include <vcl/commandevent.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/dllapi.h>
-#include <vcl/dndhelp.hxx>
#include <vcl/dockwin.hxx>
-#include <vcl/edit.hxx>
#include <vcl/errcode.hxx>
#include <vcl/errinf.hxx>
#include <vcl/event.hxx>
@@ -109,18 +104,14 @@
#include <vcl/imapobj.hxx>
#include <vcl/keycod.hxx>
#include <vcl/lstbox.hxx>
-#include <vcl/menu.hxx>
#include <vcl/metric.hxx>
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
-#include <vcl/textfilter.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/transfer.hxx>
#include <vcl/vclenum.hxx>
-#include <vcl/vclevent.hxx>
#include <vcl/vclptr.hxx>
-#include <vcl/vclreferencebase.hxx>
#include <vcl/virdev.hxx>
#include <vcl/weld.hxx>
#include <vcl/window.hxx>
diff --git a/sw/inc/pch/precompiled_vbaswobj.hxx b/sw/inc/pch/precompiled_vbaswobj.hxx
index 3414f6daee68..b19ca8c76888 100644
--- a/sw/inc/pch/precompiled_vbaswobj.hxx
+++ b/sw/inc/pch/precompiled_vbaswobj.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-01 10:59:00 using:
+ Generated on 2020-02-14 09:24:51 using:
./bin/update_pch sw vbaswobj --cutoff=4 --exclude:system --include:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -193,7 +193,9 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/rdf/XMetadatable.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/table/XCellRange.hpp>
@@ -252,7 +254,7 @@
#include <o3tl/underlyingenumvalue.hxx>
#include <ooo/vba/XCollection.hpp>
#include <ooo/vba/XHelperInterface.hpp>
-#include <ooo/vba/word/WdSaveFormat.hpp>
+#include <ooo/vba/word/XParagraphFormat.hpp>
#include <sfx2/Metadatable.hxx>
#include <sfx2/dllapi.h>
#include <sfx2/shell.hxx>
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 74f1d2d12760..08df1397b935 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -36,8 +36,6 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <vcl/event.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
#include <vcl/settings.hxx>
#include <rtl/ustring.hxx>
#include <swabstdlg.hxx>
@@ -605,25 +603,42 @@ class NavElementToolBoxControl : public svt::ToolboxController,
VclPtr<NavElementBox_Impl> m_pBox;
};
-class NavElementBox_Impl : public ListBox
+class NavElementBox_Impl final : public InterimItemWindow
{
public:
- NavElementBox_Impl( vcl::Window* pParent,
- const uno::Reference< frame::XFrame >& _xFrame,
- NavElementToolBoxControl& rCtrl );
+ NavElementBox_Impl(vcl::Window* pParent,
+ const uno::Reference<frame::XFrame>& _xFrame,
+ NavElementToolBoxControl& rCtrl);
- void Update();
+ virtual void dispose() override
+ {
+ m_xWidget.reset();
+ InterimItemWindow::dispose();
+ }
- virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void GetFocus() override
+ {
+ if (m_xWidget)
+ m_xWidget->grab_focus();
+ InterimItemWindow::GetFocus();
+ }
+
+ virtual ~NavElementBox_Impl() override
+ {
+ disposeOnce();
+ }
-protected:
- virtual void Select() override;
+ void Update();
private:
+ std::unique_ptr<weld::ComboBox> m_xWidget;
NavElementToolBoxControl* m_pCtrl;
bool m_bRelease;
uno::Reference< frame::XFrame > m_xFrame;
+ DECL_LINK(SelectHdl, weld::ComboBox&, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+
void ReleaseFocus_Impl();
};
@@ -632,19 +647,21 @@ private:
NavElementBox_Impl::NavElementBox_Impl(
vcl::Window* _pParent,
const uno::Reference< frame::XFrame >& _xFrame,
- NavElementToolBoxControl& _rCtrl ) :
-
- ListBox( _pParent, WinBits( WB_DROPDOWN ) ),
-
- m_pCtrl ( &_rCtrl ),
- m_bRelease ( true ),
- m_xFrame ( _xFrame )
+ NavElementToolBoxControl& _rCtrl )
+ : InterimItemWindow(_pParent, "modules/swriter/ui/combobox.ui", "ComboBox")
+ , m_xWidget(m_xBuilder->weld_combo_box("combobox"))
+ , m_pCtrl(&_rCtrl)
+ , m_bRelease(true)
+ , m_xFrame(_xFrame)
{
- SetSizePixel( Size( 150, 260 ) );
+ m_xWidget->set_size_request(42, -1); // set to something small so the size set at the .ui takes precedence
+
+ for (sal_uInt16 i = 0; i < NID_COUNT; ++i)
+ m_xWidget->append("", SwResId(aNavigationStrIds[i]), aNavigationImgIds[i]);
+ m_xWidget->connect_changed(LINK(this, NavElementBox_Impl, SelectHdl));
+ m_xWidget->connect_key_press(LINK(this, NavElementBox_Impl, KeyInputHdl));
- sal_uInt16 i;
- for ( i = 0; i < NID_COUNT; i++ )
- InsertEntry( SwResId( aNavigationStrIds[i] ), Image( StockImage::Yes, aNavigationImgIds[i] ) );
+ SetSizePixel(m_xContainer->get_preferred_size());
}
void NavElementBox_Impl::ReleaseFocus_Impl()
@@ -659,15 +676,13 @@ void NavElementBox_Impl::ReleaseFocus_Impl()
m_xFrame->getContainerWindow()->setFocus();
}
-void NavElementBox_Impl::Select()
+IMPL_LINK(NavElementBox_Impl, SelectHdl, weld::ComboBox&, rComboBox, void)
{
- ListBox::Select();
-
- if ( !IsTravelSelect() )
+ if (rComboBox.changed_by_direct_pick()) // only when picked from the list
{
SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
- sal_uInt16 nPos = GetSelectedEntryPos();
+ sal_uInt16 nPos = rComboBox.get_active();
sal_uInt16 nMoveType = aNavigationInsertIds[nPos];
SwView::SetMoveType( nMoveType );
@@ -691,43 +706,39 @@ void NavElementBox_Impl::Update()
{
const char* id = aNavigationStrIds[i];
OUString sText = SwResId( id );
- SelectEntry( sText );
+ m_xWidget->set_active_text(sText);
break;
}
}
}
-bool NavElementBox_Impl::EventNotify( NotifyEvent& rNEvt )
+IMPL_LINK(NavElementBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
{
bool bHandled = false;
- if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
- {
- vcl::KeyCode aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
- sal_uInt16 nCode = aKeyCode.GetCode();
+ sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- switch ( nCode )
+ switch ( nCode )
+ {
+ case KEY_TAB:
{
- case KEY_TAB:
- {
- static_cast<ToolBox*>(GetParent())->ChangeHighlightUpDn( aKeyCode.IsShift() );
- m_bRelease = false;
- [[fallthrough]];
- }
- case KEY_RETURN:
- {
- bHandled = true;
- Select();
- break;
- }
- case KEY_ESCAPE:
- ReleaseFocus_Impl();
- bHandled = true;
- break;
+ m_bRelease = false;
+ SelectHdl(*m_xWidget);
+ break;
+ }
+ case KEY_RETURN:
+ {
+ bHandled = true;
+ SelectHdl(*m_xWidget);
+ break;
}
+ case KEY_ESCAPE:
+ ReleaseFocus_Impl();
+ bHandled = true;
+ break;
}
- return bHandled || ListBox::EventNotify( rNEvt );
+ return bHandled || ChildKeyInput(rKEvt);
}
NavElementToolBoxControl::NavElementToolBoxControl( const uno::Reference< uno::XComponentContext >& rxContext )
diff --git a/sw/uiconfig/swriter/ui/combobox.ui b/sw/uiconfig/swriter/ui/combobox.ui
new file mode 100644
index 000000000000..914a33571019
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/combobox.ui
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sc">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkListStore" id="liststore4">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name image -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name surface -->
+ <column type="CairoSurface"/>
+ </columns>
+ </object>
+ <object class="GtkBox" id="ComboBox">
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore4</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="pixbuf">2</attribute>
+ </attributes>
+ </child>
+ </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/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 1136e35442ff..68cf9a383085 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -881,12 +881,10 @@ void ToolBox::SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits )
void ToolBox::SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive)
{
- fprintf(stderr, "attempt\n");
ImplToolItems::size_type nPos = GetItemPos( nItemId );
if ( nPos < GetItemCount() )
{
- fprintf(stderr, "success\n");
mpData->m_aItems[nPos].mbNonInteractiveWindow = bNonInteractive;
}
}