Kaydet (Commit) b1249cea authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwFieldVarPage

Change-Id: Ifd71cbb4c3ed3baa33136c5b86c042144faa5002
Reviewed-on: https://gerrit.libreoffice.org/69435
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 531a331e
......@@ -300,18 +300,10 @@
generic-name="URLBox" parent="svtlo-SvtURLBox"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="SelectionListBox" name="swuilo-SelectionListBox"
generic-name="SelectionListBox" parent="VclComboBoxText"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="PropertyControl" name="sdlo-PropertyControl"
generic-name="PropertyControl" parent="VclComboBoxText"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="NumFormatListBox" name="swlo-NumFormatListBox"
generic-name="NumFormatListBox" parent="VclComboBoxText"
icon-name="widget-gtk-comboboxtext"/>
<glade-widget-class title="Language ListBox" name="svxcorelo-SvxLanguageBox"
generic-name="LanguageBox" parent="VclComboBoxText"
icon-name="widget-gtk-combobox"/>
......@@ -358,10 +350,6 @@
generic-name="Cursor Reference Edit" parent="foruilo-RefEdit"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="Condition Edit" name="swlo-ConditionEdit"
generic-name="Condition Edit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="Text View" name="sclo-ScEditWindow"
generic-name="Text View" parent="GtkTextView"
icon-name="widget-gtk-textentry"/>
......
......@@ -937,6 +937,7 @@ public:
// nEndPos can be -1 in order to select all text
virtual void select_region(int nStartPos, int nEndPos) = 0;
virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void replace_selection(const OUString& rText) = 0;
// nCursorPos can be -1 to set to the end
virtual void set_position(int nCursorPos) = 0;
virtual int get_position() const = 0;
......
......@@ -430,7 +430,6 @@ custom_widgets = [
'ClassificationEditView',
'ColorConfigCtrl',
'ColumnEdit',
'ConditionEdit',
'ContentListBox',
'ContextVBox',
'CustomAnimationList',
......@@ -453,7 +452,6 @@ custom_widgets = [
'LookUpComboBox',
'ManagedMenuButton',
'MultiLineEditSyntaxHighlight',
'NumFormatListBox',
'OFileURLControl',
'OptionalBox',
'PageNumberListBox',
......@@ -482,7 +480,6 @@ custom_widgets = [
'SdPageObjsTLB',
'SearchBox',
'SearchResultsBox',
'SelectionListBox',
'SentenceEditWindow',
'ShowNupOrderWindow',
'ShowNupOrderWindow',
......
......@@ -72,7 +72,7 @@ sw/uiconfig/swriter/ui/fldrefpage.ui://GtkLabel[@id='label4'] orphan-label
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkLabel[@id='nameft'] orphan-label
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkEntry[@id='name'] no-labelled-by
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkLabel[@id='valueft'] orphan-label
sw/uiconfig/swriter/ui/fldvarpage.ui://swlo-ConditionEdit[@id='value'] no-labelled-by
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkEntry[@id='value'] no-labelled-by
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkLabel[@id='label5'] orphan-label
sw/uiconfig/swriter/ui/fldvarpage.ui://GtkComboBoxText[@id='level'] no-labelled-by
sw/uiconfig/swriter/ui/floatingnavigation.ui://GtkLabel[@id='label'] orphan-label
......
This diff is collapsed.
......@@ -32,41 +32,25 @@
class SwFieldVarPage;
class SelectionListBox : public ListBox
{
bool bCallAddSelection;
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
public:
SelectionListBox(vcl::Window* pParent, WinBits nStyle);
// detect selection via Ctrl or Alt and evaluate with SelectHdl
bool IsCallAddSelection() const {return bCallAddSelection;}
void ResetCallAddSelection() {bCallAddSelection = false;}
};
class SwFieldVarPage : public SwFieldPage
{
friend class SelectionListBox;
VclPtr<ListBox> m_pTypeLB;
VclPtr<VclContainer> m_pSelection;
VclPtr<SelectionListBox> m_pSelectionLB;
VclPtr<FixedText> m_pNameFT;
VclPtr<Edit> m_pNameED;
VclPtr<FixedText> m_pValueFT;
VclPtr<ConditionEdit> m_pValueED;
VclPtr<VclContainer> m_pFormat;
VclPtr<NumFormatListBox> m_pNumFormatLB;
VclPtr<ListBox> m_pFormatLB;
VclPtr<VclContainer> m_pChapterFrame;
VclPtr<ListBox> m_pChapterLevelLB;
VclPtr<CheckBox> m_pInvisibleCB;
VclPtr<FixedText> m_pSeparatorFT;
VclPtr<Edit> m_pSeparatorED;
VclPtr<PushButton> m_pNewPB;
VclPtr<PushButton> m_pDelPB;
std::unique_ptr<weld::TreeView> m_xTypeLB;
std::unique_ptr<weld::Widget> m_xSelection;
std::unique_ptr<weld::TreeView> m_xSelectionLB;
std::unique_ptr<weld::Label> m_xNameFT;
std::unique_ptr<weld::Entry> m_xNameED;
std::unique_ptr<weld::Label> m_xValueFT;
std::unique_ptr<SwConditionEdit> m_xValueED;
std::unique_ptr<weld::Widget> m_xFormat;
std::unique_ptr<SwNumFormatTreeView> m_xNumFormatLB;
std::unique_ptr<weld::TreeView> m_xFormatLB;
std::unique_ptr<weld::Widget> m_xChapterFrame;
std::unique_ptr<weld::TreeView> m_xChapterLevelLB;
std::unique_ptr<weld::CheckButton> m_xInvisibleCB;
std::unique_ptr<weld::Label> m_xSeparatorFT;
std::unique_ptr<weld::Entry> m_xSeparatorED;
std::unique_ptr<weld::Button> m_xNewPB;
std::unique_ptr<weld::Button> m_xDelPB;
OUString sOldValueFT;
OUString sOldNameFT;
......@@ -74,13 +58,14 @@ class SwFieldVarPage : public SwFieldPage
sal_uInt32 nOldFormat;
bool bInit;
DECL_LINK( TypeHdl, ListBox&, void );
DECL_LINK( SubTypeListBoxHdl, ListBox&, void );
DECL_LINK( ModifyHdl, Edit&, void );
DECL_LINK( TBClickHdl, Button*, void );
DECL_LINK( ChapterHdl, ListBox&, void );
DECL_LINK( SeparatorHdl, Edit&, void );
void SubTypeHdl(ListBox const *);
DECL_LINK( TypeHdl, weld::TreeView&, void );
DECL_LINK( SubTypeListBoxHdl, weld::TreeView&, void );
DECL_LINK( ModifyHdl, weld::Entry&, void );
DECL_LINK( TBClickHdl, weld::Button&, void );
DECL_LINK( ChapterHdl, weld::TreeView&, void );
DECL_LINK( SeparatorHdl, weld::Entry&, void );
DECL_LINK( SubTypeInsertHdl, weld::TreeView&, void );
void SubTypeHdl(const weld::TreeView*);
void UpdateSubType();
void FillFormatLB(sal_uInt16 nTypeId);
......@@ -89,10 +74,9 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
SwFieldVarPage(vcl::Window* pParent, const SfxItemSet* pSet);
SwFieldVarPage(TabPageParent pParent, const SfxItemSet* pSet);
virtual ~SwFieldVarPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rAttrSet);
......
......@@ -77,6 +77,7 @@ public:
bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_xControl->connect_changed(rLink); }
void replace_selection(const OUString& rText) { m_xControl->replace_selection(rText); }
void hide() { m_xControl->hide(); }
weld::Entry& get_widget() { return *m_xControl; }
......
......@@ -165,6 +165,10 @@ public:
virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
virtual void set_active(int nPos) override { mxControl->select(nPos); }
virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
OUString get_selected_text() const { return mxControl->get_selected_text(); }
bool get_visible() const { return mxControl->get_visible(); }
bool get_value_changed_from_saved() const { return mxControl->get_value_changed_from_saved(); }
void save_value() { return mxControl->save_value(); }
void show() { mxControl->show(); }
void hide() { mxControl->hide(); }
int get_selected_index() const { return mxControl->get_selected_index(); }
......
......@@ -113,7 +113,7 @@
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<child>
<object class="swuilo-SelectionListBox" id="select:border">
<object class="GtkTreeView" id="select:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......@@ -187,7 +187,7 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="swlo-NumFormatListBox" id="numformat:border">
<object class="GtkTreeView" id="numformat:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......@@ -416,7 +416,7 @@
</packing>
</child>
<child>
<object class="swlo-ConditionEdit" id="value">
<object class="GtkEntry" id="value">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
......
......@@ -2096,6 +2096,11 @@ public:
return rSelection.Len();
}
virtual void replace_selection(const OUString& rText) override
{
m_xEntry->ReplaceSelected(rText);
}
virtual void set_position(int nCursorPos) override
{
disable_notify_events();
......
......@@ -5190,6 +5190,15 @@ public:
return gtk_editable_get_selection_bounds(GTK_EDITABLE(m_pEntry), &rStartPos, &rEndPos);
}
virtual void replace_selection(const OUString& rText) override
{
gtk_editable_delete_selection(GTK_EDITABLE(m_pEntry));
OString sText(OUStringToOString(rText, RTL_TEXTENCODING_UTF8));
gint position = gtk_editable_get_position(GTK_EDITABLE(m_pEntry));
gtk_editable_insert_text(GTK_EDITABLE(m_pEntry), sText.getStr(), sText.getLength(),
&position);
}
virtual void set_position(int nCursorPos) override
{
disable_notify_events();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment