weld bibliography EditBox control ItemWindow
Change-Id: I17859c10714afa387f47385d2abd8b8827770038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94099 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -14,8 +14,9 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/sbibliography,\
|
||||
))
|
||||
|
||||
$(eval $(call gb_UIConfig_add_uifiles,modules/sbibliography,\
|
||||
extensions/uiconfig/sbibliography/ui/combobox \
|
||||
extensions/uiconfig/sbibliography/ui/choosedatasourcedialog \
|
||||
extensions/uiconfig/sbibliography/ui/combobox \
|
||||
extensions/uiconfig/sbibliography/ui/editbox \
|
||||
extensions/uiconfig/sbibliography/ui/generalpage \
|
||||
extensions/uiconfig/sbibliography/ui/querydialog \
|
||||
extensions/uiconfig/sbibliography/ui/mappingdialog \
|
||||
|
||||
@@ -194,12 +194,35 @@ ComboBoxControl::~ComboBoxControl()
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
EditControl::EditControl(vcl::Window* pParent)
|
||||
: InterimItemWindow(pParent, "modules/sbibliography/ui/editbox.ui", "EditBox")
|
||||
, m_xFtQuery(m_xBuilder->weld_label("label"))
|
||||
, m_xEdQuery(m_xBuilder->weld_entry("entry"))
|
||||
{
|
||||
m_xFtQuery->set_toolbar_background();
|
||||
m_xEdQuery->set_toolbar_background();
|
||||
m_xEdQuery->set_size_request(100, -1);
|
||||
SetSizePixel(get_preferred_size());
|
||||
}
|
||||
|
||||
void EditControl::dispose()
|
||||
{
|
||||
m_xEdQuery.reset();
|
||||
m_xFtQuery.reset();
|
||||
InterimItemWindow::dispose();
|
||||
}
|
||||
|
||||
EditControl::~EditControl()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink)
|
||||
: ToolBox(pParent, "toolbar", "modules/sbibliography/ui/toolbar.ui")
|
||||
, xSource(VclPtr<ComboBoxControl>::Create(this))
|
||||
, pLbSource(xSource->get_widget())
|
||||
, aFtQuery(VclPtr<FixedText>::Create(this,WB_VCENTER))
|
||||
, aEdQuery(VclPtr<Edit>::Create(this))
|
||||
, xQuery(VclPtr<EditControl>::Create(this))
|
||||
, pEdQuery(xQuery->get_widget())
|
||||
, pPopupMenu(VclPtr<PopupMenu>::Create())
|
||||
, nMenuId(0)
|
||||
, nSelMenuItem(0)
|
||||
@@ -223,26 +246,18 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink)
|
||||
|
||||
SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl));
|
||||
|
||||
aEdQuery->SetSizePixel(pLbSource->get_preferred_size());
|
||||
aEdQuery->Show();
|
||||
xQuery->Show();
|
||||
|
||||
nTBC_SOURCE = GetItemId(".uno:Bib/source");
|
||||
nTBC_FT_QUERY = GetItemId("TBC_FT_QUERY");
|
||||
nTBC_ED_QUERY = GetItemId(".uno:Bib/query");
|
||||
nTBC_QUERY = GetItemId(".uno:Bib/query");
|
||||
nTBC_BT_AUTOFILTER = GetItemId(".uno:Bib/autoFilter");
|
||||
nTBC_BT_COL_ASSIGN = GetItemId("TBC_BT_COL_ASSIGN");
|
||||
nTBC_BT_CHANGESOURCE = GetItemId(".uno:Bib/sdbsource");
|
||||
nTBC_BT_FILTERCRIT = GetItemId(".uno:Bib/standardFilter");
|
||||
nTBC_BT_REMOVEFILTER = GetItemId(".uno:Bib/removeFilter");
|
||||
|
||||
OUString aStr=GetItemText(nTBC_FT_QUERY);
|
||||
aFtQuery->SetText(aStr);
|
||||
aFtQuery->SetSizePixel(aFtQuery->get_preferred_size());
|
||||
aFtQuery->SetBackground(Wallpaper( COL_TRANSPARENT ));
|
||||
|
||||
SetItemWindow(nTBC_SOURCE, xSource.get());
|
||||
SetItemWindow(nTBC_FT_QUERY , aFtQuery.get());
|
||||
SetItemWindow(nTBC_ED_QUERY , aEdQuery.get());
|
||||
SetItemWindow(nTBC_QUERY , xQuery.get());
|
||||
|
||||
ApplyImageList();
|
||||
|
||||
@@ -259,8 +274,9 @@ void BibToolBar::dispose()
|
||||
SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
|
||||
Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
|
||||
::bib::RemoveFromTaskPaneList( this );
|
||||
aFtQuery.disposeAndClear();
|
||||
aEdQuery.disposeAndClear();
|
||||
pEdQuery = nullptr;
|
||||
xQuery.disposeAndClear();
|
||||
pLbSource = nullptr;
|
||||
xSource.disposeAndClear();
|
||||
ToolBox::dispose();
|
||||
}
|
||||
@@ -283,7 +299,7 @@ void BibToolBar::InitListener()
|
||||
for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++)
|
||||
{
|
||||
sal_uInt16 nId=GetItemId(nPos);
|
||||
if(!nId || nId == nTBC_FT_QUERY)
|
||||
if (!nId)
|
||||
continue;
|
||||
|
||||
util::URL aURL;
|
||||
@@ -298,7 +314,7 @@ void BibToolBar::InitListener()
|
||||
{
|
||||
xListener=new BibTBListBoxListener(this,aURL.Complete,nId);
|
||||
}
|
||||
else if (nId == nTBC_ED_QUERY)
|
||||
else if (nId == nTBC_QUERY)
|
||||
{
|
||||
xListener=new BibTBEditListener(this,aURL.Complete,nId);
|
||||
}
|
||||
@@ -332,7 +348,7 @@ void BibToolBar::Select()
|
||||
Sequence<PropertyValue> aPropVal(2);
|
||||
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
|
||||
pPropertyVal[0].Name="QueryText";
|
||||
OUString aSelection = aEdQuery->GetText();
|
||||
OUString aSelection = pEdQuery->get_text();
|
||||
pPropertyVal[0].Value <<= aSelection;
|
||||
|
||||
pPropertyVal[1].Name="QueryField";
|
||||
@@ -440,22 +456,20 @@ void BibToolBar::SelectSourceEntry(const OUString& aStr)
|
||||
|
||||
void BibToolBar::EnableQuery(bool bFlag)
|
||||
{
|
||||
aFtQuery->Enable(bFlag);
|
||||
aEdQuery->Enable(bFlag);
|
||||
xQuery->set_sensitive(bFlag);
|
||||
}
|
||||
|
||||
void BibToolBar::SetQueryString(const OUString& aStr)
|
||||
{
|
||||
aEdQuery->SetText(aStr);
|
||||
pEdQuery->set_text(aStr);
|
||||
}
|
||||
|
||||
|
||||
bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
MouseNotifyEvent nSwitch=rNEvt.GetType();
|
||||
if(aEdQuery->HasFocus() && nSwitch==MouseNotifyEvent::KEYINPUT)
|
||||
if (pEdQuery && pEdQuery->has_focus() && nSwitch == MouseNotifyEvent::KEYINPUT)
|
||||
{
|
||||
const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
|
||||
sal_uInt16 nKey = aKeyCode.GetCode();
|
||||
@@ -464,7 +478,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
|
||||
Sequence<PropertyValue> aPropVal(2);
|
||||
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
|
||||
pPropertyVal[0].Name = "QueryText";
|
||||
OUString aSelection = aEdQuery->GetText();
|
||||
OUString aSelection = pEdQuery->get_text();
|
||||
pPropertyVal[0].Value <<= aSelection;
|
||||
pPropertyVal[1].Name="QueryField";
|
||||
pPropertyVal[1].Value <<= aQueryField;
|
||||
@@ -515,7 +529,7 @@ IMPL_LINK_NOARG( BibToolBar, MenuHdl, ToolBox*, void)
|
||||
Sequence<PropertyValue> aPropVal(2);
|
||||
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
|
||||
pPropertyVal[0].Name = "QueryText";
|
||||
OUString aSelection = aEdQuery->GetText();
|
||||
OUString aSelection = pEdQuery->get_text();
|
||||
pPropertyVal[0].Value <<= aSelection;
|
||||
pPropertyVal[1].Name="QueryField";
|
||||
pPropertyVal[1].Value <<= aQueryField;
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include <svtools/InterimItemWindow.hxx>
|
||||
#include <vcl/toolbox.hxx>
|
||||
#include <vcl/edit.hxx>
|
||||
#include <vcl/fixed.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <vector>
|
||||
@@ -118,6 +116,27 @@ private:
|
||||
std::unique_ptr<weld::ComboBox> m_xLBSource;
|
||||
};
|
||||
|
||||
class EditControl final : public InterimItemWindow
|
||||
{
|
||||
public:
|
||||
EditControl(vcl::Window* pParent);
|
||||
virtual ~EditControl() override;
|
||||
virtual void dispose() override;
|
||||
|
||||
weld::Entry* get_widget() { return m_xEdQuery.get(); }
|
||||
|
||||
void set_sensitive(bool bSensitive)
|
||||
{
|
||||
m_xFtQuery->set_sensitive(bSensitive);
|
||||
m_xEdQuery->set_sensitive(bSensitive);
|
||||
Enable(bSensitive);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<weld::Label> m_xFtQuery;
|
||||
std::unique_ptr<weld::Entry> m_xEdQuery;
|
||||
};
|
||||
|
||||
class BibToolBar: public ToolBox
|
||||
{
|
||||
private:
|
||||
@@ -127,8 +146,8 @@ class BibToolBar: public ToolBox
|
||||
Idle aIdle;
|
||||
VclPtr<ComboBoxControl> xSource;
|
||||
weld::ComboBox* pLbSource;
|
||||
VclPtr<FixedText> aFtQuery;
|
||||
VclPtr<Edit> aEdQuery;
|
||||
VclPtr<EditControl> xQuery;
|
||||
weld::Entry* pEdQuery;
|
||||
ScopedVclPtr<PopupMenu> pPopupMenu;
|
||||
sal_uInt16 nMenuId;
|
||||
sal_uInt16 nSelMenuItem;
|
||||
@@ -138,8 +157,7 @@ class BibToolBar: public ToolBox
|
||||
sal_Int16 nOutStyle;
|
||||
|
||||
sal_uInt16 nTBC_SOURCE;
|
||||
sal_uInt16 nTBC_FT_QUERY;
|
||||
sal_uInt16 nTBC_ED_QUERY;
|
||||
sal_uInt16 nTBC_QUERY;
|
||||
sal_uInt16 nTBC_BT_AUTOFILTER;
|
||||
sal_uInt16 nTBC_BT_COL_ASSIGN;
|
||||
sal_uInt16 nTBC_BT_CHANGESOURCE;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<interface domain="svt">
|
||||
<requires lib="gtk+" version="3.18"/>
|
||||
<object class="GtkBox" id="EditBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes" context="editbox|TBC_FT_QUERY">Search Key</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">entry</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -42,20 +42,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="TBC_FT_QUERY">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="action_name">TBC_FT_QUERY</property>
|
||||
<property name="label" translatable="yes" context="toolbar|TBC_FT_QUERY">Search Key</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="TBC_ED_QUERY">
|
||||
<object class="GtkToolButton" id="TBC_QUERY">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="action_name">.uno:Bib/query</property>
|
||||
|
||||
Reference in New Issue
Block a user