diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/fldui/fldpage.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 28 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.hxx | 4 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/fldvarpage.ui | 159 |
5 files changed, 163 insertions, 34 deletions
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 787c33f29728..76155a46fba0 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -305,7 +305,7 @@ IMPL_LINK( SwFieldPage, TreeViewInsertHdl, weld::TreeView&, rBox, void ) InsertHdl(&rBox); } -void SwFieldPage::InsertHdl(void* pBtn) +void SwFieldPage::InsertHdl(weld::Widget* pBtn) { SwFieldDlg *pDlg = static_cast<SwFieldDlg*>(GetTabDialog()); if (pDlg) @@ -313,7 +313,7 @@ void SwFieldPage::InsertHdl(void* pBtn) pDlg->InsertHdl(); if (pBtn) - static_cast<Button*>(pBtn)->GrabFocus(); // because of InputField-Dlg + pBtn->grab_focus(); // because of InputField-Dlg } else { diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx index 3ac09fc7cc46..f09d368ba4f5 100644 --- a/sw/source/ui/fldui/fldpage.hxx +++ b/sw/source/ui/fldui/fldpage.hxx @@ -53,7 +53,7 @@ protected: DECL_LINK( TreeViewInsertHdl, weld::TreeView&, void ); DECL_LINK( NumFormatHdl, weld::TreeView&, void ); - void InsertHdl(void *); + void InsertHdl(weld::Widget*); void Init(); void SavePos( const weld::TreeView& rLst1); diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 05599ab2fd55..49c7f5f6584f 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -53,7 +53,7 @@ SwFieldVarPage::SwFieldVarPage(TabPageParent pParent, const SfxItemSet *const pC , m_xNumFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("numformat"))) , m_xFormatLB(m_xBuilder->weld_tree_view("format")) , m_xChapterFrame(m_xBuilder->weld_widget("chapterframe")) - , m_xChapterLevelLB(m_xBuilder->weld_tree_view("level")) + , m_xChapterLevelLB(m_xBuilder->weld_combo_box("level")) , m_xInvisibleCB(m_xBuilder->weld_check_button("invisible")) , m_xSeparatorFT(m_xBuilder->weld_label("separatorft")) , m_xSeparatorED(m_xBuilder->weld_entry("separator")) @@ -78,7 +78,7 @@ SwFieldVarPage::SwFieldVarPage(TabPageParent pParent, const SfxItemSet *const pC for (sal_uInt16 i = 1; i <= MAXLEVEL; i++) m_xChapterLevelLB->append_text(OUString::number(i)); - m_xChapterLevelLB->select(0); + m_xChapterLevelLB->set_active(0); //enable 'active' language selection m_xNumFormatLB->SetShowLanguageControl(true); } @@ -241,7 +241,6 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox) if (m_xValueFT->get_label() != sOldValueFT) m_xValueFT->set_label(sOldValueFT); - m_xFormatLB->freeze(); FillFormatLB(nTypeId); sal_Int32 nSize = m_xFormatLB->n_children(); @@ -485,9 +484,9 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox) { sal_uInt8 nLevel = static_cast<SwSetExpFieldType*>(pFieldTyp)->GetOutlineLvl(); if( 0x7f == nLevel ) - m_xChapterLevelLB->select( 0 ); + m_xChapterLevelLB->set_active(0); else - m_xChapterLevelLB->select( nLevel + 1 ); + m_xChapterLevelLB->set_active(nLevel + 1); OUString sDelim = static_cast<SwSetExpFieldType*>(pFieldTyp)->GetDelimiter(); m_xSeparatorED->set_text( sDelim ); ChapterHdl(*m_xChapterLevelLB); @@ -535,8 +534,6 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox) m_xInvisibleCB->set_sensitive(bInvisible); ModifyHdl(*m_xNameED); // apply/insert/delete status update - - m_xFormatLB->thaw(); } IMPL_LINK(SwFieldVarPage, SubTypeInsertHdl, weld::TreeView&, rBox, void) @@ -684,6 +681,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId) } // fill Format-Listbox + m_xFormatLB->freeze(); m_xFormatLB->clear(); rWidget.clear(); bool bSpecialFormat = false; @@ -764,15 +762,21 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId) const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode()); + OUString sSelectId; + for (sal_uInt16 i = 0; i < nSize; i++) { const sal_uInt16 nFieldId = GetFieldMgr().GetFormatId( nTypeId, i ); OUString sId(OUString::number(nFieldId)); m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i)); if (IsFieldEdit() && GetCurField() && nFieldId == GetCurField()->GetFormat()) - m_xFormatLB->select_id(sId); + sSelectId = sId; } + m_xFormatLB->thaw(); + if (!sSelectId.isEmpty()) + m_xFormatLB->select_id(sSelectId); + if (nSize && (!IsFieldEdit() || m_xFormatLB->get_selected_index() == -1)) { int nIndex = m_xFormatLB->find_text(sOldSel); @@ -1053,9 +1057,9 @@ IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, rBox, void) } } -IMPL_LINK_NOARG(SwFieldVarPage, ChapterHdl, weld::TreeView&, void) +IMPL_LINK_NOARG(SwFieldVarPage, ChapterHdl, weld::ComboBox&, void) { - bool bEnable = m_xChapterLevelLB->get_selected_index() != 0; + bool bEnable = m_xChapterLevelLB->get_active() != 0; m_xSeparatorED->set_sensitive(bEnable); m_xSeparatorFT->set_sensitive(bEnable); @@ -1065,7 +1069,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ChapterHdl, weld::TreeView&, void) IMPL_LINK_NOARG(SwFieldVarPage, SeparatorHdl, weld::Entry&, void) { bool bEnable = !m_xSeparatorED->get_text().isEmpty() || - m_xChapterLevelLB->get_selected_index() == 0; + m_xChapterLevelLB->get_active() == 0; EnableInsert(bEnable); } @@ -1159,7 +1163,7 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* ) } case TYP_SEQFLD: { - nSubType = static_cast< sal_uInt16 >(m_xChapterLevelLB->get_selected_index()); + nSubType = static_cast< sal_uInt16 >(m_xChapterLevelLB->get_active()); if (nSubType == 0) nSubType = 0x7f; else diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx index 742ae530315d..31b63495bf02 100644 --- a/sw/source/ui/fldui/fldvar.hxx +++ b/sw/source/ui/fldui/fldvar.hxx @@ -45,7 +45,7 @@ class SwFieldVarPage : public SwFieldPage 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::ComboBox> m_xChapterLevelLB; std::unique_ptr<weld::CheckButton> m_xInvisibleCB; std::unique_ptr<weld::Label> m_xSeparatorFT; std::unique_ptr<weld::Entry> m_xSeparatorED; @@ -62,7 +62,7 @@ class SwFieldVarPage : public SwFieldPage 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( ChapterHdl, weld::ComboBox&, void ); DECL_LINK( SeparatorHdl, weld::Entry&, void ); DECL_LINK( SubTypeInsertHdl, weld::TreeView&, void ); void SubTypeHdl(const weld::TreeView*); diff --git a/sw/uiconfig/swriter/ui/fldvarpage.ui b/sw/uiconfig/swriter/ui/fldvarpage.ui index 4b514b0313a4..6d704b1bfe4d 100644 --- a/sw/uiconfig/swriter/ui/fldvarpage.ui +++ b/sw/uiconfig/swriter/ui/fldvarpage.ui @@ -2,7 +2,38 @@ <!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkTreeStore" id="liststore2"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkTreeStore" id="liststore3"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkTreeStore" id="liststore4"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -50,16 +81,37 @@ <property name="hexpand">True</property> <property name="top_padding">6</property> <child> - <object class="GtkTreeView" id="type:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="model">liststore1</property> - <property name="search_column">0</property> - <property name="show_expanders">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection3"/> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="type"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> </child> </object> </child> @@ -113,12 +165,38 @@ <property name="hexpand">True</property> <property name="top_padding">6</property> <child> - <object class="GtkTreeView" id="select:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="dropdown">False</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="select"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore2</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection2"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext2"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> </object> </child> </object> @@ -187,12 +265,38 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkTreeView" id="numformat:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="dropdown">False</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="numformat"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore3</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection3"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn3"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext3"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -201,16 +305,37 @@ </packing> </child> <child> - <object class="GtkTreeView" id="format:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="model">liststore1</property> - <property name="search_column">0</property> - <property name="show_expanders">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection2"/> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="format"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore4</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection4"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn4"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext4"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> </child> </object> <packing> |