[Libreoffice-commits] core.git: Branch 'feature/msforms' - 4 commits - include/xmloff officecfg/registry sw/inc sw/Library_swui.mk sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Feb 15 10:10:00 UTC 2019
include/xmloff/odffields.hxx | 1
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 29 +
sw/Library_swui.mk | 1
sw/UIConfig_swriter.mk | 1
sw/inc/cmdid.h | 6
sw/inc/swabstdlg.hxx | 4
sw/sdi/_textsh.sdi | 18
sw/sdi/swriter.sdi | 53 +
sw/source/core/doc/docbm.cxx | 6
sw/source/core/text/itrform2.cxx | 4
sw/source/ui/dialog/swdlgfact.cxx | 12
sw/source/ui/dialog/swdlgfact.hxx | 14
sw/source/ui/dialog/swuiexp.cxx | 1
sw/source/ui/fldui/DropDownFormFieldDialog.cxx | 191 +++++++
sw/source/uibase/inc/DropDownFormFieldDialog.hxx | 69 ++
sw/source/uibase/shells/textfld.cxx | 45 +
sw/source/uibase/uiview/viewling.cxx | 11
sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml | 7
sw/uiconfig/swriter/ui/dropdownformfielddialog.ui | 272 ++++++++++
19 files changed, 744 insertions(+), 1 deletion(-)
New commits:
commit e932812d0ca9486d6292ad1bdfdd4993dada06fc
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Feb 14 13:15:41 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Feb 14 13:15:41 2019 +0100
MSForms: Don't show popup dialog of drop-down field when there is no item list
Change-Id: Ife361e0ee18437da6f188e77713ea51403b70dbc
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 935f974ce75a..c29c1637ab87 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -912,6 +912,17 @@ IMPL_LINK_NOARG(SwView, FieldPopupModeEndHdl, FloatingWindow*, void)
void SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
{
+ // Don't show popup if there is no list item
+ auto pListEntries = fieldBM->GetParameters()->find( ODF_FORMDROPDOWN_LISTENTRY );
+ Sequence< OUString > vListEntries;
+ if(pListEntries != fieldBM->GetParameters()->end())
+ {
+ pListEntries->second >>= vListEntries;
+ }
+
+ if(vListEntries.getLength() == 0)
+ return;
+
const Point aPixPos = GetEditWin().LogicToPixel( rPt );
m_pFieldPopup = VclPtr<SwFieldDialog>::Create( m_pEditWin, fieldBM );
commit 3068c477475c0e2330fe0abdb55fcf21ae09fc77
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Feb 14 12:56:55 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Feb 14 12:56:55 2019 +0100
MSForms: Introduce a properties dialog for Drop-down form field
- Dialog created similar to the edit dialog of Input field
- On the dialog, the user can edit the list of the drop down field
- This dialog is only for editing of the field, so the user can't select
an item from the list to display in the field.
Change-Id: I6222aba9b211afeb0e9d10d97a49347921ff7353
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index bbacb517f697..2da933936257 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -110,6 +110,7 @@ $(eval $(call gb_Library_add_exception_objects,swui,\
sw/source/ui/envelp/labprt \
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 \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 5e03ab5d3d7f..4e0b7ecfc037 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -123,6 +123,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/datasourcesunavailabledialog \
sw/uiconfig/swriter/ui/dropcapspage \
sw/uiconfig/swriter/ui/dropdownfielddialog \
+ sw/uiconfig/swriter/ui/dropdownformfielddialog \
sw/uiconfig/swriter/ui/editcategories \
sw/uiconfig/swriter/ui/editfielddialog \
sw/uiconfig/swriter/ui/editsectiondialog \
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 075d41e873c0..7f0b059bb0a4 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -76,6 +76,9 @@ namespace com{namespace sun{namespace star{
namespace container { class XNamed; }
}}}
+
+namespace sw { namespace mark { class IFieldmark; } }
+
typedef void (*SwLabDlgMethod) (css::uno::Reference< css::frame::XModel> const & xModel, const SwLabItem& rItem);
typedef OUString (*GlossaryGetCurrGroup)();
@@ -387,6 +390,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Window* pParent, sw::mark::IFieldmark* pDropDownField) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index d928f116fd90..e9c1f2add8d3 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -40,6 +40,7 @@
#include <docfnote.hxx>
#include <docstdlg.hxx>
#include <DropDownFieldDialog.hxx>
+#include <DropDownFormFieldDialog.hxx>
#include <envlop.hxx>
#include <label.hxx>
#include <drpcps.hxx>
@@ -85,6 +86,7 @@
#include <uiborder.hxx>
#include <mmresultdialogs.hxx>
+
using namespace ::com::sun::star;
using namespace css::frame;
using namespace css::uno;
@@ -171,6 +173,11 @@ short AbstractDropDownFieldDialog_Impl::Execute()
return m_xDlg->run();
}
+short AbstractDropDownFormFieldDialog_Impl::Execute()
+{
+ return m_xDlg->run();
+}
+
short AbstractSwLabDlg_Impl::Execute()
{
return m_xDlg->run();
@@ -834,6 +841,11 @@ VclPtr<AbstractDropDownFieldDialog> SwAbstractDialogFactory_Impl::CreateDropDown
return VclPtr<AbstractDropDownFieldDialog_Impl>::Create(o3tl::make_unique<sw::DropDownFieldDialog>(pParent, rSh, pField, bPrevButton, bNextButton));
}
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDropDownFormFieldDialog(weld::Window *pParent, sw::mark::IFieldmark* pDropDownField)
+{
+ return VclPtr<AbstractDropDownFormFieldDialog_Impl>::Create(o3tl::make_unique<sw::DropDownFormFieldDialog>(pParent, pDropDownField));
+}
+
VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwWrtShell* pWrtSh, Printer* pPrt,
bool bInsert)
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 067097fcd3aa..76516edbc40b 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -49,6 +49,7 @@ class SwSplitTableDlg;
namespace sw
{
class DropDownFieldDialog;
+class DropDownFormFieldDialog;
}
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
@@ -303,6 +304,18 @@ public:
virtual bool NextButtonPressed() const override;
};
+class AbstractDropDownFormFieldDialog_Impl : public VclAbstractDialog
+{
+protected:
+ std::unique_ptr<sw::DropDownFormFieldDialog> m_xDlg;
+public:
+ explicit AbstractDropDownFormFieldDialog_Impl(std::unique_ptr<sw::DropDownFormFieldDialog> p)
+ : m_xDlg(std::move(p))
+ {
+ }
+ virtual short Execute() override;
+};
+
class AbstractSwLabDlg_Impl : public AbstractSwLabDlg
{
protected:
@@ -613,6 +626,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Window* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) override;
+ virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Window* pParent, sw::mark::IFieldmark* pDropDownField) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) override;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel) override;
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
index c016cc6189a4..048904334f8b 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -27,6 +27,7 @@
#include <srtdlg.hxx>
#include <dbinsdlg.hxx>
#include <DropDownFieldDialog.hxx>
+#include <DropDownFormFieldDialog.hxx>
#include <fldtdlg.hxx>
#include <glossary.hxx>
#include <inpdlg.hxx>
diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
new file mode 100644
index 000000000000..cb00cc2a255b
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include <DropDownFormFieldDialog.hxx>
+#include <vcl/event.hxx>
+#include <IMark.hxx>
+#include <xmloff/odffields.hxx>
+
+namespace sw
+{
+DropDownFormFieldDialog::DropDownFormFieldDialog(weld::Window* pParent,
+ mark::IFieldmark* pDropDownField)
+ : GenericDialogController(pParent, "modules/swriter/ui/dropdownformfielddialog.ui",
+ "DropDownFormFieldDialog")
+ , m_pDropDownField(pDropDownField)
+ , m_bListHasChanged(false)
+ , m_xListItemEntry(m_xBuilder->weld_entry("item_entry"))
+ , m_xListAddButton(m_xBuilder->weld_button("add_button"))
+ , m_xListItemsTreeView(m_xBuilder->weld_tree_view("items_treeview"))
+ , m_xListRemoveButton(m_xBuilder->weld_button("remove_button"))
+ , m_xListUpButton(m_xBuilder->weld_button("up_button"))
+ , m_xListDownButton(m_xBuilder->weld_button("down_button"))
+{
+ getDialog()->connect_key_press(LINK(this, DropDownFormFieldDialog, KeyPressedHdl));
+ getDialog()->connect_key_release(LINK(this, DropDownFormFieldDialog, KeyReleasedHdl));
+
+ m_xListItemsTreeView->set_size_request(m_xListItemEntry->get_preferred_size().Width(),
+ m_xListItemEntry->get_preferred_size().Height() * 5);
+ m_xListItemsTreeView->connect_changed(LINK(this, DropDownFormFieldDialog, ListChangedHdl));
+
+ Link<weld::Button&, void> aPushButtonLink(LINK(this, DropDownFormFieldDialog, ButtonPushedHdl));
+ m_xListAddButton->connect_clicked(aPushButtonLink);
+ m_xListRemoveButton->connect_clicked(aPushButtonLink);
+ m_xListUpButton->connect_clicked(aPushButtonLink);
+ m_xListDownButton->connect_clicked(aPushButtonLink);
+
+ InitControls();
+}
+
+DropDownFormFieldDialog::~DropDownFormFieldDialog() {}
+
+IMPL_LINK_NOARG(DropDownFormFieldDialog, ListChangedHdl, weld::TreeView&, void) { UpdateButtons(); }
+
+IMPL_LINK(DropDownFormFieldDialog, KeyPressedHdl, const KeyEvent&, rEvent, bool)
+{
+ if (m_xListItemEntry->has_focus() && rEvent.GetKeyCode().GetCode() == KEY_RETURN)
+ {
+ AppendItemToList();
+ }
+ return false; // Call the dialog's input handler too
+}
+
+IMPL_LINK_NOARG(DropDownFormFieldDialog, KeyReleasedHdl, const KeyEvent&, bool)
+{
+ if (m_xListItemEntry->has_focus())
+ {
+ UpdateButtons();
+ }
+ return false; // Call the dialog's input handler too
+}
+
+IMPL_LINK(DropDownFormFieldDialog, ButtonPushedHdl, weld::Button&, rButton, void)
+{
+ if (&rButton == m_xListAddButton.get())
+ {
+ AppendItemToList();
+ }
+ else if (m_xListItemsTreeView->get_selected_index() != -1)
+ {
+ int nSelPos = m_xListItemsTreeView->get_selected_index();
+ if (&rButton == m_xListRemoveButton.get())
+ {
+ m_xListItemsTreeView->remove(nSelPos);
+ m_xListItemsTreeView->select(nSelPos > 0 ? nSelPos - 1 : 0);
+ }
+ else if (&rButton == m_xListUpButton.get())
+ {
+ const OUString sEntry = m_xListItemsTreeView->get_selected_text();
+ m_xListItemsTreeView->remove(nSelPos);
+ nSelPos--;
+ m_xListItemsTreeView->insert_text(nSelPos, sEntry);
+ m_xListItemsTreeView->select(nSelPos);
+ }
+ else if (&rButton == m_xListDownButton.get())
+ {
+ const OUString sEntry = m_xListItemsTreeView->get_selected_text();
+ m_xListItemsTreeView->remove(nSelPos);
+ nSelPos++;
+ m_xListItemsTreeView->insert_text(nSelPos, sEntry);
+ m_xListItemsTreeView->select(nSelPos);
+ }
+ m_bListHasChanged = true;
+ }
+ UpdateButtons();
+}
+
+void DropDownFormFieldDialog::InitControls()
+{
+ if (m_pDropDownField != nullptr)
+ {
+ const mark::IFieldmark::parameter_map_t* const pParameters
+ = m_pDropDownField->GetParameters();
+
+ auto pListEntries = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY);
+ if (pListEntries != pParameters->end())
+ {
+ css::uno::Sequence<OUString> vListEntries;
+ pListEntries->second >>= vListEntries;
+ for (const OUString& rItem : vListEntries)
+ m_xListItemsTreeView->append_text(rItem);
+
+ // Select the current one
+ auto pResult = pParameters->find(ODF_FORMDROPDOWN_RESULT);
+ if (pResult != pParameters->end())
+ {
+ sal_Int32 nSelection = -1;
+ pResult->second >>= nSelection;
+ m_xListItemsTreeView->select_text(vListEntries[nSelection]);
+ }
+ }
+ }
+ UpdateButtons();
+}
+
+void DropDownFormFieldDialog::AppendItemToList()
+{
+ if (m_xListAddButton->get_sensitive())
+ {
+ const OUString sEntry(m_xListItemEntry->get_text());
+ if (!sEntry.isEmpty())
+ {
+ m_xListItemsTreeView->append_text(sEntry);
+ m_xListItemsTreeView->select_text(sEntry);
+ m_bListHasChanged = true;
+
+ // Clear entry
+ m_xListItemEntry->set_text(OUString());
+ m_xListItemEntry->grab_focus();
+ }
+ UpdateButtons();
+ }
+}
+
+void DropDownFormFieldDialog::UpdateButtons()
+{
+ m_xListAddButton->set_sensitive(!m_xListItemEntry->get_text().isEmpty()
+ && m_xListItemsTreeView->find_text(m_xListItemEntry->get_text())
+ == -1);
+
+ int nSelPos = m_xListItemsTreeView->get_selected_index();
+ m_xListRemoveButton->set_sensitive(nSelPos != -1);
+ m_xListUpButton->set_sensitive(nSelPos > 0);
+ m_xListDownButton->set_sensitive(nSelPos != -1
+ && nSelPos < m_xListItemsTreeView->n_children() - 1);
+}
+
+void DropDownFormFieldDialog::Apply()
+{
+ if (m_pDropDownField != nullptr && m_bListHasChanged)
+ {
+ mark::IFieldmark::parameter_map_t* pParameters = m_pDropDownField->GetParameters();
+
+ css::uno::Sequence<OUString> vListEntries(m_xListItemsTreeView->n_children());
+ for (int nIndex = 0; nIndex < m_xListItemsTreeView->n_children(); ++nIndex)
+ {
+ vListEntries[nIndex] = m_xListItemsTreeView->get_text(nIndex);
+ }
+
+ if (m_xListItemsTreeView->n_children() != 0)
+ {
+ (*pParameters)[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
+ }
+ else
+ {
+ pParameters->erase(ODF_FORMDROPDOWN_LISTENTRY);
+ }
+
+ // After editing the drop down field's list we don't specify the selected item
+ pParameters->erase(ODF_FORMDROPDOWN_RESULT);
+ }
+}
+
+} // namespace sw
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sw/source/uibase/inc/DropDownFormFieldDialog.hxx b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx
new file mode 100644
index 000000000000..068c30e244ec
--- /dev/null
+++ b/sw/source/uibase/inc/DropDownFormFieldDialog.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DROPDOWNFORMFIELDDIALOG_HXX
+#define INCLUDED_SW_SOURCE_UIBASE_INC_DROPDOWNFORMFIELDDIALOG_HXX
+
+#include <vcl/weld.hxx>
+#include <actctrl.hxx>
+
+namespace sw
+{
+namespace mark
+{
+class IFieldmark;
+}
+} // namespace sw
+
+// Dialog to edit drop down form field
+namespace sw
+{
+class DropDownFormFieldDialog : public weld::GenericDialogController
+{
+private:
+ mark::IFieldmark* m_pDropDownField;
+ bool m_bListHasChanged;
+
+ std::unique_ptr<weld::Entry> m_xListItemEntry;
+ std::unique_ptr<weld::Button> m_xListAddButton;
+
+ std::unique_ptr<weld::TreeView> m_xListItemsTreeView;
+
+ std::unique_ptr<weld::Button> m_xListRemoveButton;
+ std::unique_ptr<weld::Button> m_xListUpButton;
+ std::unique_ptr<weld::Button> m_xListDownButton;
+
+ DECL_LINK(ListChangedHdl, weld::TreeView&, void);
+ DECL_LINK(KeyPressedHdl, const KeyEvent&, bool);
+ DECL_LINK(KeyReleasedHdl, const KeyEvent&, bool);
+ DECL_LINK(ButtonPushedHdl, weld::Button&, void);
+
+ void InitControls();
+ void AppendItemToList();
+ void UpdateButtons();
+ void Apply();
+
+public:
+ DropDownFormFieldDialog(weld::Window* pParent, mark::IFieldmark* pDropDownField);
+ virtual ~DropDownFormFieldDialog() override;
+
+ virtual short run() override
+ {
+ short nRet = GenericDialogController::run();
+ if (nRet == RET_OK)
+ Apply();
+ return nRet;
+ }
+};
+
+} // namespace sw
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sw/uiconfig/swriter/ui/dropdownformfielddialog.ui b/sw/uiconfig/swriter/ui/dropdownformfielddialog.ui
new file mode 100644
index 000000000000..3a170b7cf41d
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/dropdownformfielddialog.ui
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface domain="sw">
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkDialog" id="DropDownFormFieldDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes" context="dropdownformfielddialog|DropDownFormFieldDialog">Drop-down Form Field</property>
+ <property name="resizable">True</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="list_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkGrid" id="grid9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="item_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="dropdownformfielddialog|item_label">Item</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">item_entry</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="item_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_button">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">start</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="listitem_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="dropdownformfielddialog|listitem_label">Items on list</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">items_treeview</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <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="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="items_treeview">
+ <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>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButtonBox" id="buttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="remove_button">
+ <property name="label">gtk-remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="up_button">
+ <property name="label" translatable="yes" context="dropdownformfielddialog|up">Move Up</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="down_button">
+ <property name="label" translatable="yes" context="dropdownformfielddialog|down">Move Down</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5">ok</action-widget>
+ <action-widget response="-6">cancel</action-widget>
+ <action-widget response="-11">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>
commit 9e2f1c0beb1fb812d2bb47da1f38dbd9057db1f3
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Feb 14 12:33:39 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Feb 14 12:33:39 2019 +0100
MSForms: Make Drop-Down form field to have a default size
Similar to MSO Drop-down form field and LO Input List.
Change-Id: Idba278d8c2a2106b6f3cc22d8b9f8570f45bfae9
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx
index bbc1becb6576..27525fb39374 100644
--- a/include/xmloff/odffields.hxx
+++ b/include/xmloff/odffields.hxx
@@ -22,7 +22,7 @@
#define ODF_FORMTEXT "vnd.oasis.opendocument.field.FORMTEXT"
-#define ODF_FORMTEXT_DEFAULT_LENGTH 5
+#define ODF_FORMFIELD_DEFAULT_LENGTH 5
#define ODF_FORMCHECKBOX "vnd.oasis.opendocument.field.FORMCHECKBOX"
#define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText"
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index be10f475fe06..554fb3d99a22 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -859,7 +859,9 @@ namespace sw { namespace mark {
if (nCurrentIdx < vListEntries.getLength())
return vListEntries[nCurrentIdx];
}
- return OUString();
+
+ sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
+ return OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH);
}
} }
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 55c9baaa3a09..c5048e5ee5a6 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -726,8 +726,8 @@ FIELD_INSERT:
if(pCursorPos)
{
// Insert five enspace into the text field so the field has extent
- sal_Unicode vEnSpaces[ODF_FORMTEXT_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
- bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMTEXT_DEFAULT_LENGTH));
+ sal_Unicode vEnSpaces[ODF_FORMFIELD_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
+ bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMFIELD_DEFAULT_LENGTH));
if(bSuccess)
{
IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
commit 54bcdfb5c3d0c5a3911bc99e1c5531217562bef6
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Feb 14 12:33:06 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Feb 14 12:33:06 2019 +0100
MSForms: Insert Legacy Form Fields from MS compatible Forms menu
I added a new submenu under MS compatible Forms menu called Legacy Forms.
Under this submenu user can insert the three legacy form fields. These
field were already supported by DOC / DOCX filters, but were missing from
the UI.
When inserting text form field we insert 5 enspace to make the
field visible, otherwise we use the same insertion methods what is
called by DOC import.
Change-Id: I1fb8c03d969b4c547ca92e783ac5e216767685d5
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx
index 1a4bb2b623f6..bbc1becb6576 100644
--- a/include/xmloff/odffields.hxx
+++ b/include/xmloff/odffields.hxx
@@ -22,6 +22,7 @@
#define ODF_FORMTEXT "vnd.oasis.opendocument.field.FORMTEXT"
+#define ODF_FORMTEXT_DEFAULT_LENGTH 5
#define ODF_FORMCHECKBOX "vnd.oasis.opendocument.field.FORMCHECKBOX"
#define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText"
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index d2df1707437f..97b3e516ee4a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6296,6 +6296,30 @@
<value xml:lang="en-US">Synony~ms</value>
</prop>
</node>
+ <node oor:name=".uno:TextFormField" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Text Form Field</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:CheckBoxFormField" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Check Box Form Field</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:DropDownFormField" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Drop-Down Form Field</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
</node>
<node oor:name="Popups">
<node oor:name=".uno:PasteSpecialMenu" oor:op="replace">
@@ -6814,6 +6838,11 @@
<value xml:lang="en-US">ActiveX Controls</value>
</prop>
</node>
+ <node oor:name=".uno:MSCompatLegacyControls" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Legacy Forms</value>
+ </prop>
+ </node>
</node>
</node>
</oor:component-data>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index b7076905d66f..30b0f44b0e23 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -272,6 +272,12 @@
#define FN_INSERT_MULTI_TOX (FN_INSERT2 + 20) /* insert any TOX */
#define FN_INSERT_AUTH_ENTRY_DLG (FN_INSERT2 + 21) /* insert entry for table of authorities*/
+// MSO legacy form fields
+#define FN_INSERT_TEXT_FORMFIELD (FN_INSERT2 + 22)
+#define FN_INSERT_CHECKBOX_FORMFIELD (FN_INSERT2 + 23)
+#define FN_INSERT_DROPDOWN_FORMFIELD (FN_INSERT2 + 24)
+
+
// Region: Format
#define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* apply autoformat options */
#define FN_AUTOFORMAT_AUTO (FN_FORMAT + 2 ) /* apply autoformat during user input */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 463738966dea..f8c2daee6d65 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1676,5 +1676,23 @@ interface BaseText
DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; // e.g. disable for read-only documents
]
+ FN_INSERT_TEXT_FORMFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ ]
+
+ FN_INSERT_CHECKBOX_FORMFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ ]
+
+ FN_INSERT_DROPDOWN_FORMFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ ]
+
} // end of interface text
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 416b596965e4..5f1ae9e9e09e 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7701,3 +7701,56 @@ SfxBoolItem UseHeaderFooterMenu FN_USE_HEADERFOOTERMENU
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::View;
]
+SfxVoidItem TextFormField FN_INSERT_TEXT_FORMFIELD
+
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Controls;
+]
+
+SfxVoidItem CheckBoxFormField FN_INSERT_CHECKBOX_FORMFIELD
+
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Controls;
+]
+
+SfxVoidItem DropDownFormField FN_INSERT_DROPDOWN_FORMFIELD
+
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Controls;
+]
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f05e2a51a476..17b22b4c2788 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -506,6 +506,9 @@ namespace sw { namespace mark
const OUString& rName,
const OUString& rType)
{
+ bool bEnableSetModified = m_pDoc->getIDocumentState().IsEnableSetModified();
+ m_pDoc->getIDocumentState().SetEnableSetModified(false);
+
sw::mark::IMark* pMark = makeMark( rPaM, rName,
IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK,
sw::mark::InsertMode::New);
@@ -513,6 +516,9 @@ namespace sw { namespace mark
if (pFieldMark)
pFieldMark->SetFieldname( rType );
+ m_pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
+ m_pDoc->getIDocumentState().SetModified();
+
return pFieldMark;
}
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 23b295ead89c..55c9baaa3a09 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -71,6 +71,9 @@
#include <cstddef>
#include <memory>
#include <swmodule.hxx>
+#include <MarkManager.hxx>
+#include <xmloff/odffields.hxx>
+#include <IDocumentContentOperations.hxx>
using namespace nsSwDocInfoSubType;
@@ -716,6 +719,45 @@ FIELD_INSERT:
rReq.Done();
}
break;
+
+ case FN_INSERT_TEXT_FORMFIELD:
+ {
+ SwPaM* pCursorPos = rSh.GetCursor();
+ if(pCursorPos)
+ {
+ // Insert five enspace into the text field so the field has extent
+ sal_Unicode vEnSpaces[ODF_FORMTEXT_DEFAULT_LENGTH] = {8194, 8194, 8194, 8194, 8194};
+ bool bSuccess = rSh.GetDoc()->getIDocumentContentOperations().InsertString(*pCursorPos, OUString(vEnSpaces, ODF_FORMTEXT_DEFAULT_LENGTH));
+ if(bSuccess)
+ {
+ IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
+ SwPaM aFieldPam(pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex()-5,
+ pCursorPos->GetPoint()->nNode, pCursorPos->GetPoint()->nContent.GetIndex());
+ pMarksAccess->makeFieldBookmark(aFieldPam, OUString(), ODF_FORMTEXT);
+ }
+ }
+ }
+ break;
+ case FN_INSERT_CHECKBOX_FORMFIELD:
+ {
+ SwPaM* pCursorPos = rSh.GetCursor();
+ if(pCursorPos)
+ {
+ IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
+ pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMCHECKBOX);
+ }
+ }
+ break;
+ case FN_INSERT_DROPDOWN_FORMFIELD:
+ {
+ SwPaM* pCursorPos = rSh.GetCursor();
+ if(pCursorPos)
+ {
+ IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
+ pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDROPDOWN);
+ }
+ }
+ break;
default:
OSL_FAIL("wrong dispatcher");
return;
@@ -866,6 +908,9 @@ void SwTextShell::StateField( SfxItemSet &rSet )
case FN_INSERT_FLD_TITLE:
case FN_INSERT_FLD_TOPIC:
case FN_INSERT_DBFIELD:
+ case FN_INSERT_TEXT_FORMFIELD:
+ case FN_INSERT_CHECKBOX_FORMFIELD:
+ case FN_INSERT_DROPDOWN_FORMFIELD:
if ( rSh.CursorInsideInputField() )
{
rSet.DisableItem(nWhich);
diff --git a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
index 4b8f5ea0e714..4c8e34467d3e 100644
--- a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
+++ b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
@@ -24,6 +24,13 @@
<menu:menuitem menu:id=".uno:DateField"/>
</menu:menupopup>
</menu:menu>
+ <menu:menu menu:id=".uno:MSCompatLegacyControls">
+ <menu:menupopup>
+ <menu:menuitem menu:id=".uno:TextFormField"/>
+ <menu:menuitem menu:id=".uno:CheckBoxFormField"/>
+ <menu:menuitem menu:id=".uno:DropDownFormField"/>
+ </menu:menupopup>
+ </menu:menu>
</menu:menupopup>
</menu:menu>
</menu:menubar>
More information about the Libreoffice-commits
mailing list