[Libreoffice-commits] core.git: cui/uiconfig include/vcl solenv/bin sw/Library_swui.mk sw/source sw/uiconfig vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 18 21:11:19 UTC 2019
cui/uiconfig/ui/pageformatpage.ui | 264 +++++++--------
include/vcl/weld.hxx | 8
solenv/bin/native-code.py | 1
sw/Library_swui.mk | 1
sw/source/ui/fldui/FldRefTreeListBox.cxx | 69 ----
sw/source/ui/fldui/FldRefTreeListBox.hxx | 34 --
sw/source/ui/fldui/fldref.cxx | 500 +++++++++++++-----------------
sw/source/ui/fldui/fldref.hxx | 40 +-
sw/uiconfig/swriter/ui/fldrefpage.ui | 184 +++++++++--
sw/uiconfig/swriter/ui/templatedialog8.ui | 22 -
vcl/source/app/salvtables.cxx | 7
vcl/unx/gtk3/gtk3gtkinst.cxx | 10
12 files changed, 567 insertions(+), 573 deletions(-)
New commits:
commit c403c86c6da4db0a6f2864ad4e13def9a3898cd4
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Mar 17 19:22:08 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 18 22:10:57 2019 +0100
weld SwFieldRefPage
Change-Id: I5ae3965aa681ea1f5a005fbc8dad4d0ce36af1b3
Reviewed-on: https://gerrit.libreoffice.org/69373
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/uiconfig/ui/pageformatpage.ui b/cui/uiconfig/ui/pageformatpage.ui
index f864e9f6fdd9..61ae2fca7fe1 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -81,7 +81,6 @@
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="activates_default">True</property>
- <property name="update_policy">if-valid</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -217,6 +216,7 @@
<child>
<object class="GtkDrawingArea" id="drawingareaPageDirection">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
@@ -310,31 +310,43 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkLabel" id="labelTopMargin">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="pageformatpage|labelTopMargin">Top:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">spinMargTop</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="labelBottomMargin">
+ <object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes" context="pageformatpage|labelBottomMargin">Bottom:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">spinMargBot</property>
- <property name="xalign">0</property>
+ <property name="valign">center</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="labelLeftMargin">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="pageformatpage|labelLeftMargin">Left:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spinMargLeft</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelInner">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="pageformatpage|labelInner">I_nner:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spinMargLeft</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
@@ -349,39 +361,6 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="spinMargRight">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinMargTop">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinMargBot">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="activates_default">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -422,43 +401,64 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="box3">
+ <object class="GtkSpinButton" id="spinMargRight">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelTopMargin">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">center</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel" id="labelLeftMargin">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="pageformatpage|labelLeftMargin">Left:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">spinMargLeft</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="labelInner">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="pageformatpage|labelInner">I_nner:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">spinMargLeft</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="label" translatable="yes" context="pageformatpage|labelTopMargin">Top:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spinMargTop</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spinMargTop">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="labelBottomMargin">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="pageformatpage|labelBottomMargin">Bottom:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">spinMargBot</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spinMargBot">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
</packing>
</child>
</object>
@@ -548,6 +548,52 @@
</packing>
</child>
<child>
+ <object class="GtkAlignment" id="alignment8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="labelRegisterStyle">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="pageformatpage|labelRegisterStyle">Reference _Style:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">comboRegisterStyle</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="comboRegisterStyle">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkComboBoxText" id="comboPageLayout">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -637,52 +683,6 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="labelRegisterStyle">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes" context="pageformatpage|labelRegisterStyle">Reference _Style:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">comboRegisterStyle</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBoxText" id="comboRegisterStyle">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
<placeholder/>
</child>
</object>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index f0f7c95f3cf6..a88cfe5ea04f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -515,6 +515,9 @@ public:
class VCL_DLLPUBLIC TreeView : virtual public Container
{
+private:
+ OUString m_sSavedValue;
+
protected:
Link<TreeView&, void> m_aChangeHdl;
Link<TreeView&, void> m_aRowActivatedHdl;
@@ -713,6 +716,7 @@ public:
virtual int n_children() const = 0;
virtual void make_sorted() = 0;
+ virtual void make_unsorted() = 0;
virtual bool get_sort_order() const = 0;
virtual void set_sort_order(bool bAscending) = 0;
// TRUE ascending, FALSE, descending, INDET, neither (off)
@@ -736,6 +740,10 @@ public:
void set_toggle_columns_as_radio(const std::vector<int>& rCols) { m_aRadioIndexes = rCols; }
+ void save_value() { m_sSavedValue = get_selected_text(); }
+ OUString const& get_saved_value() const { return m_sSavedValue; }
+ bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
+
using Widget::set_sensitive;
};
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 88942fe07037..8c93cd1f081f 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -516,7 +516,6 @@ custom_widgets = [
'SvxTextEncodingBox',
'SvxTextEncodingBox',
'SwAddressPreview',
- 'SwFieldRefTreeListBox',
'SwGlTreeListBox',
'SwMarkPreview',
'SwNavHelpToolBox',
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 2da933936257..51d80f89cff9 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -111,7 +111,6 @@ $(eval $(call gb_Library_add_exception_objects,swui,\
sw/source/ui/envelp/mailmrge \
sw/source/ui/fldui/DropDownFieldDialog \
sw/source/ui/fldui/DropDownFormFieldDialog \
- sw/source/ui/fldui/FldRefTreeListBox \
sw/source/ui/fldui/changedb \
sw/source/ui/fldui/flddb \
sw/source/ui/fldui/flddinf \
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.cxx b/sw/source/ui/fldui/FldRefTreeListBox.cxx
deleted file mode 100644
index c69d6141c74c..000000000000
--- a/sw/source/ui/fldui/FldRefTreeListBox.cxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "FldRefTreeListBox.hxx"
-
-#include <vcl/builderfactory.hxx>
-#include <vcl/event.hxx>
-#include <vcl/help.hxx>
-
-SwFieldRefTreeListBox::SwFieldRefTreeListBox(vcl::Window* pParent, WinBits nStyle)
- : SvTreeListBox(pParent, nStyle)
-{
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SwFieldRefTreeListBox, WB_TABSTOP)
-
-void SwFieldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
-{
- bool bCallBase( true );
- if ( rHEvt.GetMode() & HelpEventMode::QUICK )
- {
- Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
- SvTreeListEntry* pEntry = GetEntry( aPos );
- if( pEntry )
- {
- OUString sEntry( GetEntryText( pEntry ) );
- SvLBoxTab* pTab;
- SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
- if( pItem )
- {
- aPos = GetEntryPosition( pEntry );
-
- aPos.setX( GetTabPos( pEntry, pTab ) );
- Size aSize( pItem->GetSize( this, pEntry ) );
-
- if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
- aSize.setWidth( GetSizePixel().Width() - aPos.X() );
-
- aPos = OutputToScreenPixel(aPos);
- tools::Rectangle aItemRect( aPos, aSize );
- Help::ShowQuickHelp( this, aItemRect, sEntry,
- QuickHelpFlags::Left|QuickHelpFlags::VCenter );
- bCallBase = false;
- }
- }
- }
- if ( bCallBase )
- {
- Window::RequestHelp( rHEvt );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.hxx b/sw/source/ui/fldui/FldRefTreeListBox.hxx
deleted file mode 100644
index 6f7631f4489c..000000000000
--- a/sw/source/ui/fldui/FldRefTreeListBox.hxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SW_SOURCE_UI_FLDUI_FLDREFTREELISTBOX_HXX
-#define INCLUDED_SW_SOURCE_UI_FLDUI_FLDREFTREELISTBOX_HXX
-
-#include <vcl/treelistbox.hxx>
-
-class SwFieldRefTreeListBox : public SvTreeListBox
-{
-protected:
- virtual void RequestHelp( const HelpEvent& rHEvt ) override;
-
-public:
- SwFieldRefTreeListBox(vcl::Window* pParent, WinBits nStyle);
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 5e00e0992a6e..d9e084f01413 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -53,70 +53,61 @@ static sal_uInt16 nFieldDlgFormatSel = 0;
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
-SwFieldRefPage::SwFieldRefPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet )
- : SwFieldPage(pParent, "FieldRefPage",
- "modules/swriter/ui/fldrefpage.ui", pCoreSet)
+SwFieldRefPage::SwFieldRefPage(TabPageParent pParent, const SfxItemSet *const pCoreSet )
+ : SwFieldPage(pParent, "modules/swriter/ui/fldrefpage.ui", "FieldRefPage", pCoreSet)
, maOutlineNodes()
, maNumItems()
, mpSavedSelectedTextNode(nullptr)
, mnSavedSelectedPos(0)
+ , m_xTypeLB(m_xBuilder->weld_tree_view("type"))
+ , m_xSelection(m_xBuilder->weld_widget("selectframe"))
+ , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
+ , m_xSelectionToolTipLB(m_xBuilder->weld_tree_view("selecttip"))
+ , m_xFormat(m_xBuilder->weld_widget("formatframe"))
+ , m_xFormatLB(m_xBuilder->weld_tree_view("format"))
+ , m_xNameFT(m_xBuilder->weld_label("nameft"))
+ , m_xNameED(m_xBuilder->weld_entry("name"))
+ , m_xValueED(m_xBuilder->weld_entry("value"))
+ , m_xFilterED(m_xBuilder->weld_entry("filter"))
{
- get(m_pTypeLB, "type");
- get(m_pSelection, "selectframe");
- get(m_pSelectionLB, "select");
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() | WB_SORT);
+ m_xSelectionLB->make_sorted();
// #i83479#
- get(m_pSelectionToolTipLB, "selecttip");
- get(m_pFormat, "formatframe");
- get(m_pFormatLB, "format");
for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_REF_PAGE_TYPES); ++i)
{
- m_pTypeLB->InsertEntry(SwResId(FLD_REF_PAGE_TYPES[i]));
- m_pFormatLB->InsertEntry(SwResId(FLD_REF_PAGE_TYPES[i]));
+ m_xTypeLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
+ m_xFormatLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
}
- get(m_pNameFT, "nameft");
- get(m_pNameED, "name");
- get(m_pValueED, "value");
- get(m_pFilterED, "filter");
-
- sBookmarkText = m_pTypeLB->GetEntry(0);
- sFootnoteText = m_pTypeLB->GetEntry(1);
- sEndnoteText = m_pTypeLB->GetEntry(2);
- // #i83479#
- sHeadingText = m_pTypeLB->GetEntry(3);
- sNumItemText = m_pTypeLB->GetEntry(4);
- m_pTypeLB->Clear();
- long nHeight = m_pTypeLB->GetTextHeight() * 20;
- m_pSelection->set_height_request(nHeight);
- m_pSelectionToolTipLB->set_height_request(nHeight);
+ sBookmarkText = m_xTypeLB->get_text(0);
+ sFootnoteText = m_xTypeLB->get_text(1);
+ sEndnoteText = m_xTypeLB->get_text(2);
+ // #i83479#
+ sHeadingText = m_xTypeLB->get_text(3);
+ sNumItemText = m_xTypeLB->get_text(4);
- nHeight = m_pTypeLB->GetTextHeight() * 8;
- m_pTypeLB->set_height_request(nHeight);
- m_pFormatLB->set_height_request(nHeight);
+ auto nHeight = m_xTypeLB->get_height_rows(8);
+ auto nWidth = LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
+ m_xTypeLB->set_size_request(nWidth, nHeight);
+ m_xFormatLB->set_size_request(nWidth, nHeight);
+ m_xSelection->set_size_request(nWidth * 2, nHeight);
+ nHeight = m_xTypeLB->get_height_rows(20);
+ m_xSelectionToolTipLB->set_size_request(nHeight, nWidth*2);
- long nWidth = m_pTypeLB->LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
- m_pTypeLB->set_width_request(nWidth);
- m_pFormatLB->set_width_request(nWidth);
- m_pSelection->set_width_request(nWidth*2);
- m_pSelectionToolTipLB->set_width_request(nWidth*2);
+ m_xTypeLB->clear();
- m_pNameED->SetModifyHdl(LINK(this, SwFieldRefPage, ModifyHdl));
- m_pFilterED->SetModifyHdl( LINK( this, SwFieldRefPage, ModifyHdl_Impl ) );
+ m_xNameED->connect_changed(LINK(this, SwFieldRefPage, ModifyHdl));
+ m_xFilterED->connect_changed( LINK( this, SwFieldRefPage, ModifyHdl_Impl ) );
- m_pTypeLB->SetDoubleClickHdl (LINK(this, SwFieldRefPage, ListBoxInsertHdl));
- m_pTypeLB->SetSelectHdl (LINK(this, SwFieldRefPage, TypeHdl));
- m_pSelectionLB->SetSelectHdl (LINK(this, SwFieldRefPage, SubTypeListBoxHdl));
- m_pSelectionLB->SetDoubleClickHdl (LINK(this, SwFieldRefPage, ListBoxInsertHdl));
- m_pFormatLB->SetDoubleClickHdl (LINK(this, SwFieldRefPage, ListBoxInsertHdl));
+ m_xTypeLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
+ m_xTypeLB->connect_changed(LINK(this, SwFieldRefPage, TypeHdl));
+ m_xSelectionLB->connect_changed(LINK(this, SwFieldRefPage, SubTypeListBoxHdl));
+ m_xSelectionLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
+ m_xFormatLB->connect_row_activated(LINK(this, SwFieldRefPage, TreeViewInsertHdl));
// #i83479#
- m_pSelectionToolTipLB->SetSelectHdl( LINK(this, SwFieldRefPage, SubTypeTreeListBoxHdl) );
- m_pSelectionToolTipLB->SetDoubleClickHdl( LINK(this, SwFieldRefPage, TreeListBoxInsertHdl) );
- m_pSelectionToolTipLB->SetStyle( m_pSelectionToolTipLB->GetStyle() | WB_HSCROLL );
- m_pSelectionToolTipLB->SetSpaceBetweenEntries(1);
- m_pSelectionToolTipLB->SetHighlightRange();
- m_pFilterED->GrabFocus();
+ m_xSelectionToolTipLB->connect_changed( LINK(this, SwFieldRefPage, SubTypeTreeListBoxHdl) );
+ m_xSelectionToolTipLB->connect_row_activated( LINK(this, SwFieldRefPage, TreeViewInsertHdl) );
+ m_xFilterED->grab_focus();
}
SwFieldRefPage::~SwFieldRefPage()
@@ -124,24 +115,9 @@ SwFieldRefPage::~SwFieldRefPage()
disposeOnce();
}
-void SwFieldRefPage::dispose()
-{
- m_pTypeLB.clear();
- m_pSelection.clear();
- m_pSelectionLB.clear();
- m_pSelectionToolTipLB.clear();
- m_pFormat.clear();
- m_pFormatLB.clear();
- m_pNameFT.clear();
- m_pNameED.clear();
- m_pFilterED.clear();
- m_pValueED.clear();
- SwFieldPage::dispose();
-}
-
-IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl_Impl, weld::Entry&, void)
{
- UpdateSubType(comphelper::string::strip(m_pFilterED->GetText(), ' '));
+ UpdateSubType(comphelper::string::strip(m_xFilterED->get_text(), ' '));
}
// #i83479#
@@ -149,16 +125,16 @@ void SwFieldRefPage::SaveSelectedTextNode()
{
mpSavedSelectedTextNode = nullptr;
mnSavedSelectedPos = 0;
- if ( m_pSelectionToolTipLB->IsVisible() )
+ if ( m_xSelectionToolTipLB->get_visible() )
{
- SvTreeListEntry* pEntry = m_pSelectionToolTipLB->GetCurEntry();
- if ( pEntry )
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ if (nEntry != -1)
{
- const sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
if ( nTypeId == REFFLDFLAG_HEADING )
{
- mnSavedSelectedPos = static_cast<size_t>(reinterpret_cast<sal_uLong>(pEntry->GetUserData()));
+ mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
if ( mnSavedSelectedPos < maOutlineNodes.size() )
{
mpSavedSelectedTextNode = maOutlineNodes[mnSavedSelectedPos];
@@ -166,7 +142,7 @@ void SwFieldRefPage::SaveSelectedTextNode()
}
else if ( nTypeId == REFFLDFLAG_NUMITEM )
{
- mnSavedSelectedPos = static_cast<size_t>(reinterpret_cast<sal_uLong>(pEntry->GetUserData()));
+ mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
if ( mnSavedSelectedPos < maNumItems.size() )
{
mpSavedSelectedTextNode = maNumItems[mnSavedSelectedPos]->GetTextNode();
@@ -180,21 +156,20 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
{
if (!IsFieldEdit())
{
- SavePos(m_pTypeLB);
+ SavePos(*m_xTypeLB);
// #i83479#
SaveSelectedTextNode();
}
- SetSelectionSel(LISTBOX_ENTRY_NOTFOUND);
- SetTypeSel(LISTBOX_ENTRY_NOTFOUND);
+ SetSelectionSel(-1);
+ SetTypeSel(-1);
Init(); // general initialisation
// initialise TypeListBox
- m_pTypeLB->SetUpdateMode(false);
- m_pTypeLB->Clear();
+ m_xTypeLB->freeze();
+ m_xTypeLB->clear();
// fill Type-Listbox
- sal_Int32 nPos;
// set/insert reference
const SwFieldGroupRgn& rRg = SwFieldMgr::GetGroupRange(IsFieldDlgHtmlMode(), GetGroup());
@@ -204,17 +179,14 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
if (!IsFieldEdit() || nTypeId != TYP_SETREFFLD)
{
- nPos = m_pTypeLB->InsertEntry(SwFieldMgr::GetTypeStr(i), i - rRg.nStart);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
}
}
// #i83479#
// entries for headings and numbered items
- nPos = m_pTypeLB->InsertEntry(sHeadingText);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(REFFLDFLAG_HEADING));
- nPos = m_pTypeLB->InsertEntry(sNumItemText);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(REFFLDFLAG_NUMITEM));
+ m_xTypeLB->append(OUString::number(REFFLDFLAG_HEADING), sHeadingText);
+ m_xTypeLB->append(OUString::number(REFFLDFLAG_NUMITEM), sNumItemText);
// fill up with the sequence types
SwWrtShell *pSh = GetWrtShell();
@@ -234,34 +206,30 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->HasWriterListeners() && pSh->IsUsed(*pType))
{
- nPos = m_pTypeLB->InsertEntry(pType->GetName());
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(static_cast<sal_uIntPtr>(REFFLDFLAG | n)));
+ m_xTypeLB->append(OUString::number(REFFLDFLAG | n), pType->GetName());
}
}
// text marks - now always (because of globaldocuments)
- nPos = m_pTypeLB->InsertEntry(sBookmarkText);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(REFFLDFLAG_BOOKMARK));
+ m_xTypeLB->append(OUString::number(REFFLDFLAG_BOOKMARK), sBookmarkText);
// footnotes:
if( pSh->HasFootnotes() )
{
- nPos = m_pTypeLB->InsertEntry(sFootnoteText);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(REFFLDFLAG_FOOTNOTE));
+ m_xTypeLB->append(OUString::number(REFFLDFLAG_FOOTNOTE), sFootnoteText);
}
// endnotes:
if ( pSh->HasFootnotes(true) )
{
- nPos = m_pTypeLB->InsertEntry(sEndnoteText);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(REFFLDFLAG_ENDNOTE));
+ m_xTypeLB->append(OUString::number(REFFLDFLAG_ENDNOTE), sEndnoteText);
}
+ m_xTypeLB->thaw();
+
// select old Pos
if (!IsFieldEdit())
- RestorePos(m_pTypeLB);
-
- m_pTypeLB->SetUpdateMode(true);
+ RestorePos(*m_xTypeLB);
nFieldDlgFormatSel = 0;
@@ -276,11 +244,11 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
const sal_uInt16 nVal = static_cast< sal_uInt16 >(sUserData.getToken(0, ';', nIdx).toInt32());
if(nVal != USHRT_MAX)
{
- for(sal_Int32 i = 0; i < m_pTypeLB->GetEntryCount(); i++)
+ for(sal_Int32 i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; ++i)
{
- if(nVal == static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(i))))
+ if (nVal == m_xTypeLB->get_id(i).toUInt32())
{
- m_pTypeLB->SelectEntryPos(i);
+ m_xTypeLB->select(i);
break;
}
}
@@ -291,31 +259,31 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
}
}
}
- TypeHdl(*m_pTypeLB);
+ TypeHdl(*m_xTypeLB);
if(nFormatBoxPosition != USHRT_MAX)
{
- m_pFormatLB->SelectEntryPos(nFormatBoxPosition);
+ m_xFormatLB->select(nFormatBoxPosition);
}
if (IsFieldEdit())
{
- m_pTypeLB->SaveValue();
- m_pSelectionLB->SaveValue();
- m_pFormatLB->SaveValue();
- m_pNameED->SaveValue();
- m_pValueED->SaveValue();
- m_pFilterED->SetText(OUString());
+ m_xTypeLB->save_value();
+ m_xSelectionLB->save_value();
+ m_xFormatLB->save_value();
+ m_xNameED->save_value();
+ m_xValueED->save_value();
+ m_xFilterED->set_text(OUString());
}
}
-IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void)
{
// save old ListBoxPos
const sal_Int32 nOld = GetTypeSel();
// current ListBoxPos
- SetTypeSel(m_pTypeLB->GetSelectedEntryPos());
+ SetTypeSel(m_xTypeLB->get_selected_index());
- if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ if(GetTypeSel() == -1)
{
if (IsFieldEdit())
{
@@ -370,47 +338,46 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, ListBox&, void)
break;
}
- if (m_pTypeLB->GetEntryPos(sName) == LISTBOX_ENTRY_NOTFOUND) // reference to deleted mark
+ if (m_xTypeLB->find_text(sName) == -1) // reference to deleted mark
{
- sal_Int32 nPos = m_pTypeLB->InsertEntry(sName);
- m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(nFlag));
+ m_xTypeLB->append(OUString::number(nFlag), sName);
}
- m_pTypeLB->SelectEntry(sName);
- SetTypeSel(m_pTypeLB->GetSelectedEntryPos());
+ m_xTypeLB->select_text(sName);
+ SetTypeSel(m_xTypeLB->get_selected_index());
}
else
{
SetTypeSel(0);
- m_pTypeLB->SelectEntryPos(0);
+ m_xTypeLB->select(0);
}
}
if (nOld == GetTypeSel())
return;
- sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
// fill selection-ListBox
- UpdateSubType(comphelper::string::strip(m_pFilterED->GetText(), ' '));
+ UpdateSubType(comphelper::string::strip(m_xFilterED->get_text(), ' '));
bool bName = false;
nFieldDlgFormatSel = 0;
- if ( ( !IsFieldEdit() || m_pSelectionLB->GetEntryCount() ) &&
- nOld != LISTBOX_ENTRY_NOTFOUND )
+ if ( ( !IsFieldEdit() || m_xSelectionLB->n_children() ) &&
+ nOld != -1 )
{
- m_pNameED->SetText(OUString());
- m_pValueED->SetText(OUString());
- m_pFilterED->SetText(OUString());
+ m_xNameED->set_text(OUString());
+ m_xValueED->set_text(OUString());
+ m_xFilterED->set_text(OUString());
}
switch (nTypeId)
{
case TYP_GETREFFLD:
- if (REFFLDFLAG & static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld))))
+ if (REFFLDFLAG & m_xTypeLB->get_id(nOld).toUInt32())
// the old one stays
- nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
+ nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
bName = true;
break;
@@ -424,47 +391,48 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, ListBox&, void)
default:
if( REFFLDFLAG & nTypeId )
{
- const sal_uInt16 nOldId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld)));
+ const sal_uInt16 nOldId = m_xTypeLB->get_id(nOld).toUInt32();
if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
// then the old one stays
- nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
+ nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
}
break;
}
- m_pNameED->Enable(bName);
- m_pNameFT->Enable(bName);
+ m_xNameED->set_sensitive(bName);
+ m_xNameFT->set_sensitive(bName);
// fill Format-Listbox
sal_Int32 nSize = FillFormatLB(nTypeId);
bool bFormat = nSize != 0;
- m_pFormat->Enable(bFormat);
+ m_xFormat->set_sensitive(bFormat);
SubTypeHdl();
- ModifyHdl(*m_pNameED);
- ModifyHdl(*m_pFilterED);
-
+ ModifyHdl(*m_xNameED);
+ ModifyHdl(*m_xFilterED);
}
-IMPL_LINK_NOARG(SwFieldRefPage, SubTypeTreeListBoxHdl, SvTreeListBox*, void)
+IMPL_LINK_NOARG(SwFieldRefPage, SubTypeTreeListBoxHdl, weld::TreeView&, void)
{
SubTypeHdl();
}
-IMPL_LINK_NOARG(SwFieldRefPage, SubTypeListBoxHdl, ListBox&, void)
+
+IMPL_LINK_NOARG(SwFieldRefPage, SubTypeListBoxHdl, weld::TreeView&, void)
{
SubTypeHdl();
}
+
void SwFieldRefPage::SubTypeHdl()
{
- sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
switch(nTypeId)
{
case TYP_GETREFFLD:
- if (!IsFieldEdit() || m_pSelectionLB->GetSelectedEntryCount())
+ if (!IsFieldEdit() || m_xSelectionLB->get_selected_index() != -1)
{
- m_pNameED->SetText(m_pSelectionLB->GetSelectedEntry());
- ModifyHdl(*m_pNameED);
+ m_xNameED->set_text(m_xSelectionLB->get_selected_text());
+ ModifyHdl(*m_xNameED);
}
break;
@@ -475,7 +443,7 @@ void SwFieldRefPage::SubTypeHdl()
pSh = ::GetActiveWrtShell();
if(pSh)
{
- m_pValueED->SetText(pSh->GetSelText());
+ m_xValueED->set_text(pSh->GetSelText());
}
}
@@ -484,17 +452,15 @@ void SwFieldRefPage::SubTypeHdl()
case REFFLDFLAG_HEADING:
case REFFLDFLAG_NUMITEM:
{
- if ( m_pSelectionToolTipLB->GetCurEntry() )
- {
- m_pNameED->SetText( m_pSelectionToolTipLB->GetEntryText(
- m_pSelectionToolTipLB->GetCurEntry() ) );
- }
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ if (nEntry != -1)
+ m_xNameED->set_text(m_xSelectionToolTipLB->get_text(nEntry));
}
break;
default:
- if (!IsFieldEdit() || m_pSelectionLB->GetSelectedEntryCount())
- m_pNameED->SetText(m_pSelectionLB->GetSelectedEntry());
+ if (!IsFieldEdit() || m_xSelectionLB->get_selected_index() != -1)
+ m_xNameED->set_text(m_xSelectionLB->get_selected_text());
break;
}
}
@@ -506,33 +472,32 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
if(!pSh)
pSh = ::GetActiveWrtShell();
SwGetRefField* pRefField = static_cast<SwGetRefField*>(GetCurField());
- const sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
OUString sOldSel;
// #i83479#
- if ( m_pSelectionLB->IsVisible() )
+ if ( m_xSelectionLB->get_visible() )
{
- const sal_Int32 nSelectionSel = m_pSelectionLB->GetSelectedEntryPos();
- if (nSelectionSel != LISTBOX_ENTRY_NOTFOUND)
- {
- sOldSel = m_pSelectionLB->GetEntry(nSelectionSel);
- }
+ const sal_Int32 nSelectionSel = m_xSelectionLB->get_selected_index();
+ if (nSelectionSel != -1)
+ sOldSel = m_xSelectionLB->get_text(nSelectionSel);
}
if (IsFieldEdit() && sOldSel.isEmpty())
sOldSel = OUString::number( pRefField->GetSeqNo() + 1 );
- m_pSelectionLB->SetUpdateMode(false);
- m_pSelectionLB->Clear();
+ m_xSelectionLB->freeze();
+ m_xSelectionLB->clear();
// #i83479#
- m_pSelectionToolTipLB->SetUpdateMode(false);
- m_pSelectionToolTipLB->Clear();
+ m_xSelectionToolTipLB->freeze();
+ m_xSelectionToolTipLB->clear();
+ OUString m_sSelectionToolTipLBId;
bool bShowSelectionToolTipLB( false );
if( REFFLDFLAG & nTypeId )
{
if (nTypeId == REFFLDFLAG_BOOKMARK) // text marks!
{
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle()|WB_SORT);
+ m_xSelectionLB->make_sorted();
// get all text marks
IDocumentMarkAccess* const pMarkAccess = pSh->getIDocumentMarkAccess();
for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
@@ -545,7 +510,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(pBkmk->GetName(), filterString);
if(isSubstring)
{
- m_pSelectionLB->InsertEntry( pBkmk->GetName() );
+ m_xSelectionLB->append_text( pBkmk->GetName() );
}
}
}
@@ -554,7 +519,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
}
else if (nTypeId == REFFLDFLAG_FOOTNOTE)
{
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() & ~WB_SORT);
+ m_xSelectionLB->make_unsorted();
SwSeqFieldList aArr;
const size_t nCnt = pSh->GetSeqFootnoteList( aArr );
@@ -563,7 +528,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
if(isSubstring)
{
- m_pSelectionLB->InsertEntry( aArr[ n ].sDlgEntry );
+ m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
}
if (IsFieldEdit() && pRefField->GetSeqNo() == aArr[ n ].nSeqNo)
sOldSel = aArr[n].sDlgEntry;
@@ -571,7 +536,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
}
else if (nTypeId == REFFLDFLAG_ENDNOTE)
{
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle() & ~WB_SORT);
+ m_xSelectionLB->make_unsorted();
SwSeqFieldList aArr;
const size_t nCnt = pSh->GetSeqFootnoteList( aArr, true );
@@ -580,7 +545,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
if(isSubstring)
{
- m_pSelectionLB->InsertEntry( aArr[ n ].sDlgEntry );
+ m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
}
if (IsFieldEdit() && pRefField->GetSeqNo() == aArr[ n ].nSeqNo)
sOldSel = aArr[n].sDlgEntry;
@@ -603,20 +568,20 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false), filterString);
if(isSubstring)
{
- SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
- pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false));
- pEntry->SetUserData( reinterpret_cast<void*>(nOutlIdx) );
+ OUString sId(OUString::number(nOutlIdx));
+ m_xSelectionToolTipLB->append(sId,
+ pIDoc->getOutlineText(nOutlIdx, pSh->GetLayout(), true, true, false));
if ( ( IsFieldEdit() &&
pRefField->GetReferencedTextNode() == maOutlineNodes[nOutlIdx] ) ||
mpSavedSelectedTextNode == maOutlineNodes[nOutlIdx] )
{
- m_pSelectionToolTipLB->Select( pEntry );
+ m_sSelectionToolTipLBId = sId;
sOldSel.clear();
bCertainTextNodeSelected = true;
}
else if ( !bCertainTextNodeSelected && mnSavedSelectedPos == nOutlIdx )
{
- m_pSelectionToolTipLB->Select( pEntry );
+ m_sSelectionToolTipLBId = sId;
sOldSel.clear();
}
}
@@ -638,20 +603,20 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()), filterString);
if(isSubstring)
{
- SvTreeListEntry* pEntry = m_pSelectionToolTipLB->InsertEntry(
+ OUString sId(OUString::number(nNumItemIdx));
+ m_xSelectionToolTipLB->append(sId,
pIDoc->getListItemText(*maNumItems[nNumItemIdx], *pSh->GetLayout()));
- pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
if ( ( IsFieldEdit() &&
pRefField->GetReferencedTextNode() == maNumItems[nNumItemIdx]->GetTextNode() ) ||
mpSavedSelectedTextNode == maNumItems[nNumItemIdx]->GetTextNode() )
{
- m_pSelectionToolTipLB->Select( pEntry );
+ m_sSelectionToolTipLBId = sId;
sOldSel.clear();
bCertainTextNodeSelected = true;
}
else if ( !bCertainTextNodeSelected && mnSavedSelectedPos == nNumItemIdx )
{
- m_pSelectionToolTipLB->Select( pEntry );
+ m_sSelectionToolTipLBId = sId;
sOldSel.clear();
}
}
@@ -659,7 +624,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
}
else
{
- m_pSelectionLB->SetStyle(m_pSelectionLB->GetStyle()|WB_SORT);
+ m_xSelectionLB->make_sorted();
// get the fields to Seq-FieldType:
SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(
@@ -677,7 +642,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring(aArr[ n ].sDlgEntry, filterString);
if(isSubstring)
{
- m_pSelectionLB->InsertEntry( aArr[ n ].sDlgEntry );
+ m_xSelectionLB->append_text( aArr[ n ].sDlgEntry );
}
if (IsFieldEdit() && sOldSel.isEmpty() &&
aArr[ n ].nSeqNo == pRefField->GetSeqNo())
@@ -698,7 +663,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
bool isSubstring = MatchSubstring( i , filterString );
if(isSubstring)
{
- m_pSelectionLB->InsertEntry(i);
+ m_xSelectionLB->append_text(i);
}
}
@@ -707,42 +672,41 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
}
// #i83479#
- m_pSelectionToolTipLB->Show( bShowSelectionToolTipLB );
- m_pSelectionLB->Show( !bShowSelectionToolTipLB );
+ m_xSelectionLB->thaw();
+ m_xSelectionToolTipLB->thaw();
+ if (!m_sSelectionToolTipLBId.isEmpty())
+ m_xSelectionToolTipLB->select_id(m_sSelectionToolTipLBId);
+ m_xSelectionToolTipLB->set_visible( bShowSelectionToolTipLB );
+ m_xSelectionLB->set_visible( !bShowSelectionToolTipLB );
if ( bShowSelectionToolTipLB )
{
- m_pSelectionToolTipLB->SetUpdateMode(true);
+ bool bEnable = m_xSelectionToolTipLB->n_children() != 0;
+ m_xSelection->set_sensitive( bEnable );
- bool bEnable = m_pSelectionToolTipLB->GetEntryCount() != 0;
- m_pSelection->Enable( bEnable );
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ if (nEntry != -1)
+ m_xSelectionToolTipLB->scroll_to_row(nEntry);
- if ( m_pSelectionToolTipLB->GetCurEntry() != nullptr )
+ if (IsFieldEdit() && nEntry == -1)
{
- m_pSelectionToolTipLB->MakeVisible( m_pSelectionToolTipLB->GetCurEntry() );
- }
-
- if ( IsFieldEdit() && m_pSelectionToolTipLB->GetCurEntry() == nullptr )
- {
- m_pNameED->SetText(sOldSel);
+ m_xNameED->set_text(sOldSel);
}
}
else
{
- m_pSelectionLB->SetUpdateMode(true);
-
// enable or disable
- bool bEnable = m_pSelectionLB->GetEntryCount() != 0;
- m_pSelection->Enable( bEnable );
+ bool bEnable = m_xSelectionLB->n_children() != 0;
+ m_xSelection->set_sensitive( bEnable );
if ( bEnable )
{
- m_pSelectionLB->SelectEntry(sOldSel);
- if (!m_pSelectionLB->GetSelectedEntryCount() && !IsFieldEdit())
- m_pSelectionLB->SelectEntryPos(0);
+ m_xSelectionLB->select_text(sOldSel);
+ if (m_xSelectionLB->get_selected_index() == -1 && !IsFieldEdit())
+ m_xSelectionLB->select(0);
}
- if (IsFieldEdit() && !m_pSelectionLB->GetSelectedEntryCount()) // in case the reference was already deleted...
- m_pNameED->SetText(sOldSel);
+ if (IsFieldEdit() && m_xSelectionLB->get_selected_index() == -1) // in case the reference was already deleted...
+ m_xNameED->set_text(sOldSel);
}
}
@@ -789,12 +753,12 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
{
OUString sOldSel;
- sal_Int32 nFormatSel = m_pFormatLB->GetSelectedEntryPos();
- if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
- sOldSel = m_pFormatLB->GetEntry(nFormatSel);
+ sal_Int32 nFormatSel = m_xFormatLB->get_selected_index();
+ if (nFormatSel != -1)
+ sOldSel = m_xFormatLB->get_text(nFormatSel);
// fill Format-Listbox
- m_pFormatLB->Clear();
+ m_xFormatLB->clear();
// reference has less that the annotation
sal_uInt16 nSize( 0 );
@@ -833,8 +797,8 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
for (sal_uInt16 i = 0; i < nSize; i++)
{
- sal_Int32 nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr( nTypeId, i ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, i )));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i )));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
}
// #i83479#
@@ -842,14 +806,14 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX;
- sal_Int32 nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX;
- nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX;
- nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
nExtraSize = 3;
}
@@ -861,42 +825,42 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
{
for (sal_uInt16 i = 0; i < nSize; i++)
{
- sal_Int32 nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, i + SAL_N_ELEMENTS(FMT_REF_ARY))));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + SAL_N_ELEMENTS(FMT_REF_ARY))));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
}
nExtraSize += nSize;
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- sal_Int32 nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nExtraSize += 3;
}
// uppercase article
for (sal_uInt16 i = 0; i < nSize; i++)
{
- sal_Int32 nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, i + 2 * SAL_N_ELEMENTS(FMT_REF_ARY))));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + 2 * SAL_N_ELEMENTS(FMT_REF_ARY))));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
}
nExtraSize += nSize;
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- sal_Int32 nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- nPos = m_pFormatLB->InsertEntry(SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, nFormat )));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nExtraSize += 3;
}
}
@@ -907,15 +871,16 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
if (nSize)
{
if (!IsFieldEdit())
- m_pFormatLB->SelectEntry(sOldSel);
+ m_xFormatLB->select_text(sOldSel);
else
- m_pFormatLB->SelectEntry(SwResId(FMT_REF_ARY[GetCurField()->GetFormat() % SAL_N_ELEMENTS(FMT_REF_ARY)]));
+ m_xFormatLB->select_text(SwResId(FMT_REF_ARY[GetCurField()->GetFormat() % SAL_N_ELEMENTS(FMT_REF_ARY)]));
- if (!m_pFormatLB->GetSelectedEntryCount())
+ if (m_xFormatLB->get_selected_index() == -1)
{
- m_pFormatLB->SelectEntryPos(nFieldDlgFormatSel);
- if (!m_pFormatLB->GetSelectedEntryCount())
- m_pFormatLB->SelectEntryPos(0);
+ if (nFieldDlgFormatSel < m_xFormatLB->n_children())
+ m_xFormatLB->select(nFieldDlgFormatSel);
+ else
+ m_xFormatLB->select(0);
}
}
@@ -923,13 +888,13 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
}
// Modify
-IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, weld::Entry&, void)
{
- OUString aName(m_pNameED->GetText());
+ OUString aName(m_xNameED->get_text());
const bool bEmptyName = aName.isEmpty();
bool bEnable = true;
- sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
if ((nTypeId == TYP_SETREFFLD && !GetFieldMgr().CanInsertRefMark(aName)) ||
(bEmptyName && (nTypeId == TYP_GETREFFLD || nTypeId == TYP_SETREFFLD ||
@@ -938,21 +903,21 @@ IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, Edit&, void)
EnableInsert(bEnable);
- m_pSelectionLB->SelectEntry(aName);
+ m_xSelectionLB->select_text(aName);
}
bool SwFieldRefPage::FillItemSet(SfxItemSet* )
{
bool bModified = false;
- sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+ sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
sal_uInt16 nSubType = 0;
- const sal_Int32 nEntryPos = m_pFormatLB->GetSelectedEntryPos();
- const sal_uLong nFormat = (nEntryPos == LISTBOX_ENTRY_NOTFOUND)
- ? 0 : reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(nEntryPos));
+ const sal_Int32 nEntryPos = m_xFormatLB->get_selected_index();
+ const sal_uLong nFormat = (nEntryPos == -1)
+ ? 0 : m_xFormatLB->get_id(nEntryPos).toUInt32();
- OUString aVal(m_pValueED->GetText());
- OUString aName(m_pNameED->GetText());
+ OUString aVal(m_xValueED->get_text());
+ OUString aName(m_xNameED->get_text());
switch(nTypeId)
{
@@ -966,8 +931,8 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
if(!pType) // Only insert when the name doesn't exist yet
{
- m_pSelectionLB->InsertEntry(aName);
- m_pSelection->Enable();
+ m_xSelectionLB->append_text(aName);
+ m_xSelection->set_sensitive(true);
}
break;
}
@@ -984,14 +949,14 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
}
if (nTypeId == REFFLDFLAG_BOOKMARK) // text marks!
{
- aName = m_pNameED->GetText();
+ aName = m_xNameED->get_text();
nTypeId = TYP_GETREFFLD;
nSubType = REF_BOOKMARK;
}
else if (REFFLDFLAG_FOOTNOTE == nTypeId) // footnotes
{
SwSeqFieldList aArr;
- SeqFieldLstElem aElem( m_pSelectionLB->GetSelectedEntry(), 0 );
+ SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
size_t nPos = 0;
@@ -1012,7 +977,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
else if (REFFLDFLAG_ENDNOTE == nTypeId) // endnotes
{
SwSeqFieldList aArr;
- SeqFieldLstElem aElem( m_pSelectionLB->GetSelectedEntry(), 0 );
+ SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
size_t nPos = 0;
@@ -1033,13 +998,12 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
// #i83479#
else if ( nTypeId == REFFLDFLAG_HEADING )
{
- SvTreeListEntry* pEntry = m_pSelectionToolTipLB->GetCurEntry();
- OSL_ENSURE( pEntry,
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ OSL_ENSURE( nEntry != -1,
"<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
- if ( pEntry )
+ if (nEntry != -1)
{
- const size_t nOutlIdx( static_cast<size_t>
- (reinterpret_cast<sal_uLong>(pEntry->GetUserData())) );
+ const size_t nOutlIdx(m_xSelectionToolTipLB->get_id(nEntry).toUInt32());
pSh->getIDocumentOutlineNodesAccess()->getOutlineNodes( maOutlineNodes );
if ( nOutlIdx < maOutlineNodes.size() )
{
@@ -1054,14 +1018,13 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
}
else if ( nTypeId == REFFLDFLAG_NUMITEM )
{
- SvTreeListEntry* pEntry = m_pSelectionToolTipLB->GetCurEntry();
- OSL_ENSURE( pEntry,
+ int nEntry = m_xSelectionToolTipLB->get_selected_index();
+ OSL_ENSURE( nEntry != -1,
"<SwFieldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
- if ( pEntry )
+ if (nEntry != -1)
{
- const size_t nNumItemIdx( static_cast<size_t>
- (reinterpret_cast<sal_uLong>(pEntry->GetUserData())) );
- pSh->getIDocumentListItemsAccess()->getNumItems( maNumItems );
+ const size_t nNumItemIdx(m_xSelectionToolTipLB->get_id(nEntry).toUInt32());
+ pSh->getIDocumentListItemsAccess()->getNumItems(maNumItems);
if ( nNumItemIdx < maNumItems.size() )
{
::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTextNode(
@@ -1081,7 +1044,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
if( pType )
{
SwSeqFieldList aArr;
- SeqFieldLstElem aElem( m_pSelectionLB->GetSelectedEntry(), 0 );
+ SeqFieldLstElem aElem( m_xSelectionLB->get_selected_text(), 0 );
size_t nPos = 0;
@@ -1109,16 +1072,16 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
}
if (!IsFieldEdit() || bModified ||
- m_pNameED->IsValueChangedFromSaved() ||
- m_pValueED->IsValueChangedFromSaved() ||
- m_pTypeLB->IsValueChangedFromSaved() ||
- m_pSelectionLB->IsValueChangedFromSaved() ||
- m_pFormatLB->IsValueChangedFromSaved())
+ m_xNameED->get_value_changed_from_saved() ||
+ m_xValueED->get_value_changed_from_saved() ||
+ m_xTypeLB->get_value_changed_from_saved() ||
+ m_xSelectionLB->get_value_changed_from_saved() ||
+ m_xFormatLB->get_value_changed_from_saved())
{
InsertField( nTypeId, nSubType, aName, aVal, nFormat );
}
- ModifyHdl(*m_pNameED); // enable/disable insert if applicable
+ ModifyHdl(*m_xNameED); // enable/disable insert if applicable
return false;
}
@@ -1126,7 +1089,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
VclPtr<SfxTabPage> SwFieldRefPage::Create( TabPageParent pParent,
const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldRefPage>::Create( pParent.pParent, pAttrSet );
+ return VclPtr<SwFieldRefPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldRefPage::GetGroup()
@@ -1136,13 +1099,12 @@ sal_uInt16 SwFieldRefPage::GetGroup()
void SwFieldRefPage::FillUserData()
{
- const sal_Int32 nEntryPos = m_pTypeLB->GetSelectedEntryPos();
- const sal_uInt16 nTypeSel = ( LISTBOX_ENTRY_NOTFOUND == nEntryPos )
+ const sal_Int32 nEntryPos = m_xTypeLB->get_selected_index();
+ const sal_uInt16 nTypeSel = ( -1 == nEntryPos )
? USHRT_MAX
- : sal::static_int_cast< sal_uInt16 >
- (reinterpret_cast< sal_uIntPtr >(m_pTypeLB->GetEntryData( nEntryPos )));
- const sal_Int32 nFormatEntryPos = m_pFormatLB->GetSelectedEntryPos();
- const sal_uInt32 nFormatSel = LISTBOX_ENTRY_NOTFOUND == nFormatEntryPos ? USHRT_MAX : nFormatEntryPos;
+ : m_xTypeLB->get_id(nEntryPos).toUInt32();
+ const sal_Int32 nFormatEntryPos = m_xFormatLB->get_selected_index();
+ const sal_uInt32 nFormatSel = -1 == nFormatEntryPos ? USHRT_MAX : nFormatEntryPos;
SetUserData( USER_DATA_VERSION ";" +
OUString::number( nTypeSel ) + ";" +
OUString::number( nFormatSel ));
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
index 15f026adc385..eacf917b5bb5 100644
--- a/sw/source/ui/fldui/fldref.hxx
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -28,22 +28,10 @@
#include "fldpage.hxx"
#include <IDocumentOutlineNodes.hxx>
#include <IDocumentListItems.hxx>
-#include "FldRefTreeListBox.hxx"
class SwTextNode;
class SwFieldRefPage : public SwFieldPage
{
- VclPtr<ListBox> m_pTypeLB;
- VclPtr<VclContainer> m_pSelection;
- VclPtr<ListBox> m_pSelectionLB;
- // #i83479#
- VclPtr<SwFieldRefTreeListBox> m_pSelectionToolTipLB;
- VclPtr<VclContainer> m_pFormat;
- VclPtr<ListBox> m_pFormatLB;
- VclPtr<FixedText> m_pNameFT;
- VclPtr<Edit> m_pNameED;
- VclPtr<Edit> m_pValueED;
- VclPtr<Edit> m_pFilterED;
OUString sBookmarkText;
OUString sFootnoteText;
OUString sEndnoteText;
@@ -60,11 +48,23 @@ class SwFieldRefPage : public SwFieldPage
// fallback, if previously selected text node doesn't exist anymore
size_t mnSavedSelectedPos;
- DECL_LINK(TypeHdl, ListBox&, void);
- DECL_LINK(SubTypeListBoxHdl, ListBox&, void);
- DECL_LINK(SubTypeTreeListBoxHdl, SvTreeListBox*, void);
- DECL_LINK(ModifyHdl, Edit&, void);
- DECL_LINK(ModifyHdl_Impl, Edit&, void);
+ std::unique_ptr<weld::TreeView> m_xTypeLB;
+ std::unique_ptr<weld::Widget> m_xSelection;
+ std::unique_ptr<weld::TreeView> m_xSelectionLB;
+ // #i83479#
+ std::unique_ptr<weld::TreeView> m_xSelectionToolTipLB;
+ std::unique_ptr<weld::Widget> m_xFormat;
+ std::unique_ptr<weld::TreeView> m_xFormatLB;
+ std::unique_ptr<weld::Label> m_xNameFT;
+ std::unique_ptr<weld::Entry> m_xNameED;
+ std::unique_ptr<weld::Entry> m_xValueED;
+ std::unique_ptr<weld::Entry> m_xFilterED;
+
+ DECL_LINK(TypeHdl, weld::TreeView&, void);
+ DECL_LINK(SubTypeListBoxHdl, weld::TreeView&, void);
+ DECL_LINK(SubTypeTreeListBoxHdl, weld::TreeView&, void);
+ DECL_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_LINK(ModifyHdl_Impl, weld::Entry&, void);
void SubTypeHdl();
@@ -81,10 +81,8 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldRefPage(vcl::Window* pParent, const SfxItemSet* pSet);
-
- virtual ~SwFieldRefPage() override;
- virtual void dispose() override;
+ SwFieldRefPage(TabPageParent pParent, const SfxItemSet* pSet);
+ virtual ~SwFieldRefPage() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rAttrSet);
diff --git a/sw/uiconfig/swriter/ui/fldrefpage.ui b/sw/uiconfig/swriter/ui/fldrefpage.ui
index 042b373f88f4..812ee1cfa0ef 100644
--- a/sw/uiconfig/swriter/ui/fldrefpage.ui
+++ b/sw/uiconfig/swriter/ui/fldrefpage.ui
@@ -1,11 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- 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 gchararray1 -->
+ <!-- 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>
@@ -44,14 +69,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="model">liststore1</property>
- <property name="search_column">0</property>
- <property name="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <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">False</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>
@@ -61,9 +109,9 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="fldrefpage|label1">_Type</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -90,14 +138,37 @@
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<child>
- <object class="GtkTreeView" id="format:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">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="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <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">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>
@@ -107,9 +178,9 @@
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="fldrefpage|label3">Insert _reference to</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -162,9 +233,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
<packing>
<property name="left_attach">0</property>
@@ -176,7 +244,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
- <property name="shadow_type">out</property>
+ <property name="activates_default">True</property>
<property name="placeholder_text" translatable="yes" context="fldrefpage|filter">Filter Selection</property>
</object>
<packing>
@@ -199,25 +267,49 @@
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
- <child type="label">
+ <child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<child>
- <object class="GtkBox" id="box3">
+ <object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="swuilo-SwFieldRefTreeListBox" id="selecttip: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>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Tooltip Tree List-selection"/>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="selecttip">
+ <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>
@@ -227,14 +319,37 @@
</packing>
</child>
<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="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection4"/>
+ <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">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>
@@ -249,11 +364,10 @@
</child>
<child type="label">
<object class="GtkLabel" id="label2">
- <property name="visible">False</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="fldrefpage|label2">S_election</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
@@ -278,10 +392,10 @@
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="fldrefpage|valueft">_Value</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">value</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -294,6 +408,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -304,10 +419,10 @@
<object class="GtkLabel" id="nameft">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="fldrefpage|nameft">Na_me</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -319,6 +434,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/sw/uiconfig/swriter/ui/templatedialog8.ui b/sw/uiconfig/swriter/ui/templatedialog8.ui
index 20640bcddf93..87d5a777394c 100644
--- a/sw/uiconfig/swriter/ui/templatedialog8.ui
+++ b/sw/uiconfig/swriter/ui/templatedialog8.ui
@@ -68,7 +68,7 @@
</child>
<child>
<object class="GtkButton" id="standard">
- <property name="label" translatable="no">Standard</property>
+ <property name="label">Standard</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -162,7 +162,7 @@
<child type="tab">
<object class="GtkLabel" id="organizer">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|organizer">Organizer</property>
</object>
<packing>
@@ -208,7 +208,7 @@
<child type="tab">
<object class="GtkLabel" id="page">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|page">Page</property>
</object>
<packing>
@@ -255,7 +255,7 @@
<child type="tab">
<object class="GtkLabel" id="area">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|area">Area</property>
</object>
<packing>
@@ -302,7 +302,7 @@
<child type="tab">
<object class="GtkLabel" id="transparence">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|transparence">Transparency</property>
</object>
<packing>
@@ -349,7 +349,7 @@
<child type="tab">
<object class="GtkLabel" id="header">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|header">Header</property>
</object>
<packing>
@@ -396,7 +396,7 @@
<child type="tab">
<object class="GtkLabel" id="footer">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|footer">Footer</property>
</object>
<packing>
@@ -443,7 +443,7 @@
<child type="tab">
<object class="GtkLabel" id="borders">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|borders">Borders</property>
</object>
<packing>
@@ -490,7 +490,7 @@
<child type="tab">
<object class="GtkLabel" id="columns">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|columns">Columns</property>
</object>
<packing>
@@ -537,7 +537,7 @@
<child type="tab">
<object class="GtkLabel" id="footnotes">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|footnotes">Footnote</property>
</object>
<packing>
@@ -584,7 +584,7 @@
<child type="tab">
<object class="GtkLabel" id="textgrid">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label" translatable="yes" context="templatedialog8|textgrid">Text Grid</property>
</object>
<packing>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 216de7759527..47f2ecda410f 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2682,7 +2682,7 @@ public:
const OUString* getEntryData(int index) const
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, index);
- return static_cast<const OUString*>(pEntry->GetUserData());
+ return pEntry ? static_cast<const OUString*>(pEntry->GetUserData()) : nullptr;
}
virtual OUString get_id(int pos) const override
@@ -2986,6 +2986,11 @@ public:
set_sort_order(true);
}
+ virtual void make_unsorted() override
+ {
+ m_xTreeView->SetStyle(m_xTreeView->GetStyle() & ~WB_SORT);
+ }
+
virtual void set_sort_order(bool bAscending) override
{
SvTreeList* pListModel = m_xTreeView->GetModel();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 84f13af7c1a6..2a7551456922 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5935,6 +5935,16 @@ public:
gtk_tree_sortable_set_sort_column_id(pSortable, m_nTextCol, GTK_SORT_ASCENDING);
}
+ virtual void make_unsorted() override
+ {
+ m_xSorter.reset();
+ int nSortColumn;
+ GtkSortType eSortType;
+ GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(m_pTreeStore);
+ gtk_tree_sortable_get_sort_column_id(pSortable, &nSortColumn, &eSortType);
+ gtk_tree_sortable_set_sort_column_id(pSortable, GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, eSortType);
+ }
+
virtual void set_sort_order(bool bAscending) override
{
GtkSortType eSortType = bAscending ? GTK_SORT_ASCENDING : GTK_SORT_DESCENDING;
More information about the Libreoffice-commits
mailing list