[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - include/xmloff officecfg/registry sw/inc sw/Library_swui.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jul 13 22:15:58 UTC 2019
include/xmloff/odffields.hxx | 1
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 8
sw/Library_swui.mk | 1
sw/UIConfig_swriter.mk | 1
sw/inc/cmdid.h | 2
sw/inc/swabstdlg.hxx | 2
sw/qa/extras/uiwriter/uiwriter2.cxx | 34 ++
sw/sdi/_textsh.sdi | 6
sw/sdi/swriter.sdi | 18 +
sw/source/ui/dialog/swdlgfact.cxx | 8
sw/source/ui/dialog/swdlgfact.hxx | 7
sw/source/ui/dialog/swuiexp.cxx | 1
sw/source/ui/fldui/DateFormFieldDialog.cxx | 65 +++++
sw/source/uibase/docvw/edtwin.cxx | 2
sw/source/uibase/inc/DateFormFieldDialog.hxx | 48 +++
sw/source/uibase/shells/textfld.cxx | 16 +
sw/source/uibase/shells/textsh1.cxx | 15 +
sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml | 2
sw/uiconfig/swriter/ui/dateformfielddialog.ui | 123 ++++++++++
19 files changed, 357 insertions(+), 3 deletions(-)
New commits:
commit e632e9f69adc1bb006fdaedd95f06456907c55ef
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jul 12 16:53:18 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Jul 14 00:15:22 2019 +0200
MSForms: Introduce a properties dialog for date form field
* The dialog can be opened by the menu item and also by double click.
* The dialog contains a list to specify the date format.
Reviewed-on: https://gerrit.libreoffice.org/75439
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 870c66694e7ed392141f0956ef74d1f71cdf8975)
Change-Id: I109a688752c5155f5bfabff272da3d6ab90dcded
Reviewed-on: https://gerrit.libreoffice.org/75533
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx
index 82127a57628e..0b0ec4676f39 100644
--- a/include/xmloff/odffields.hxx
+++ b/include/xmloff/odffields.hxx
@@ -34,6 +34,7 @@
#define ODF_FORMDROPDOWN_RESULT "Dropdown_Selected"
#define ODF_FORMDATE "vnd.oasis.opendocument.field.FORMDATE"
+#define ODF_FORMDATE_DATEFORMAT "DateField_DateFormat"
#define ODF_TOC "vnd.oasis.opendocument.field.TOC"
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 20e6a46b1c95..807ef5649f24 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -109,6 +109,7 @@ $(eval $(call gb_Library_add_exception_objects,swui,\
sw/source/ui/envelp/labfmt \
sw/source/ui/envelp/labprt \
sw/source/ui/envelp/mailmrge \
+ sw/source/ui/fldui/DateFormFieldDialog \
sw/source/ui/fldui/DropDownFieldDialog \
sw/source/ui/fldui/DropDownFormFieldDialog \
sw/source/ui/fldui/FldRefTreeListBox \
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index b435a03993ba..178a8ce6f6f7 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/createautomarkdialog \
sw/uiconfig/swriter/ui/customizeaddrlistdialog \
sw/uiconfig/swriter/ui/datasourcesunavailabledialog \
+ sw/uiconfig/swriter/ui/dateformfielddialog \
sw/uiconfig/swriter/ui/dropcapspage \
sw/uiconfig/swriter/ui/dropdownfielddialog \
sw/uiconfig/swriter/ui/dropdownformfielddialog \
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index d3a948c40d6e..cdf3cbe96506 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -412,10 +412,12 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) = 0;
+
virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(sw::mark::IFieldmark* pDropDownField) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(sw::mark::IFieldmark* pDateField) = 0;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(const SfxItemSet& rSet,
SwDBManager* pDBManager, bool bLabel) = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 172c59989013..0c87c82c68b8 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -39,6 +39,7 @@
#include <dbinsdlg.hxx>
#include <docfnote.hxx>
#include <docstdlg.hxx>
+#include <DateFormFieldDialog.hxx>
#include <DropDownFieldDialog.hxx>
#include <DropDownFormFieldDialog.hxx>
#include <envlop.hxx>
@@ -102,6 +103,7 @@ IMPL_ABSTDLG_BASE(AbstractSwConvertTableDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractSwInsertDBColAutoPilot_Impl);
IMPL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractDropDownFormFieldDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractDateFormFieldDialog_Impl);
IMPL_ABSTDLG_BASE(AbstractSwLabDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractSwSelGlossaryDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl);
@@ -781,6 +783,12 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDropDownFormFieldD
return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
}
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(sw::mark::IFieldmark* pDateField)
+{
+ VclPtr<sw::DateFormFieldDialog> pDlg = VclPtr<sw::DateFormFieldDialog>::Create(nullptr, pDateField);
+ return VclPtr<VclAbstractDialog_Impl>::Create( pDlg );
+}
+
VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( vcl::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 63aa088a8e8e..af097968c438 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -45,6 +45,7 @@ namespace sw
{
class DropDownFieldDialog;
class DropDownFormFieldDialog;
+class DateFormFieldDialog;
}
#define DECL_ABSTDLG_BASE(Class,DialogClass) \
@@ -173,6 +174,11 @@ class AbstractDropDownFormFieldDialog_Impl : public VclAbstractDialog
DECL_ABSTDLG_BASE(AbstractDropDownFormFieldDialog_Impl, sw::DropDownFormFieldDialog)
};
+class AbstractDateFormFieldDialog_Impl : public VclAbstractDialog
+{
+ DECL_ABSTDLG_BASE(AbstractDateFormFieldDialog_Impl, sw::DateFormFieldDialog)
+};
+
class AbstractSwLabDlg_Impl : public AbstractSwLabDlg
{
DECL_ABSTDLG_BASE(AbstractSwLabDlg_Impl,SwLabDlg)
@@ -410,6 +416,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) override;
virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(sw::mark::IFieldmark* pDropDownField) override;
+ virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(sw::mark::IFieldmark* pDateField) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg ( vcl::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert ) override;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(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 6398698961aa..f002223f075a 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -26,6 +26,7 @@
#include <dbinsdlg.hxx>
#include <DropDownFieldDialog.hxx>
#include <DropDownFormFieldDialog.hxx>
+#include <DateFormFieldDialog.hxx>
#include <fldtdlg.hxx>
#include <glossary.hxx>
#include <inpdlg.hxx>
diff --git a/sw/source/ui/fldui/DateFormFieldDialog.cxx b/sw/source/ui/fldui/DateFormFieldDialog.cxx
new file mode 100644
index 000000000000..8a74b1537954
--- /dev/null
+++ b/sw/source/ui/fldui/DateFormFieldDialog.cxx
@@ -0,0 +1,65 @@
+/* -*- 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 <DateFormFieldDialog.hxx>
+#include <vcl/event.hxx>
+#include <IMark.hxx>
+#include <xmloff/odffields.hxx>
+
+namespace sw
+{
+DateFormFieldDialog::DateFormFieldDialog(vcl::Window* pParent, mark::IFieldmark* pDateField)
+ : SvxStandardDialog(pParent, "DateFormFieldDialog", "modules/swriter/ui/dateformfielddialog.ui")
+ , m_pDateField(pDateField)
+{
+ get(m_xFormatLB, "date_formats_treeview");
+ m_xFormatLB->SetFormatType(css::util::NumberFormat::DATE);
+ m_xFormatLB->SetShowLanguageControl(true);
+ m_xFormatLB->SetAutomaticLanguage(true);
+ m_xFormatLB->SetOneArea(true);
+
+ InitControls();
+}
+
+DateFormFieldDialog::~DateFormFieldDialog() { disposeOnce(); }
+
+void DateFormFieldDialog::dispose()
+{
+ m_xFormatLB.clear();
+ SvxStandardDialog::dispose();
+}
+
+void DateFormFieldDialog::Apply()
+{
+ if (m_pDateField != nullptr)
+ {
+ mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+ (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= m_xFormatLB->GetFormat();
+ }
+}
+
+void DateFormFieldDialog::InitControls()
+{
+ if (m_pDateField != nullptr)
+ {
+ mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+
+ auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
+ if (pResult != pParameters->end())
+ {
+ sal_uInt32 nDateFormat = 0;
+ pResult->second >>= nDateFormat;
+ m_xFormatLB->SetDefFormat(nDateFormat);
+ }
+ }
+}
+
+} // namespace sw
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index e45c19fabf00..3e605f318c70 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3408,7 +3408,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
aContentAtPos.aFnd.pFieldmark != nullptr)
{
IFieldmark *pFieldBM = const_cast< IFieldmark* > ( aContentAtPos.aFnd.pFieldmark );
- if ( pFieldBM->GetFieldname( ) == ODF_FORMDROPDOWN )
+ if ( pFieldBM->GetFieldname( ) == ODF_FORMDROPDOWN || pFieldBM->GetFieldname( ) == ODF_FORMDATE )
{
RstMBDownFlags();
rSh.getIDocumentMarkAccess()->ClearFieldActivation();
diff --git a/sw/source/uibase/inc/DateFormFieldDialog.hxx b/sw/source/uibase/inc/DateFormFieldDialog.hxx
new file mode 100644
index 000000000000..b79673ee584b
--- /dev/null
+++ b/sw/source/uibase/inc/DateFormFieldDialog.hxx
@@ -0,0 +1,48 @@
+/* -*- 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_DATEFORMFIELDDIALOG_HXX
+#define INCLUDED_SW_SOURCE_UIBASE_INC_DATEFORMFIELDDIALOG_HXX
+
+#include <svx/stddlg.hxx>
+#include "actctrl.hxx"
+#include "numfmtlb.hxx"
+
+namespace sw
+{
+namespace mark
+{
+class IFieldmark;
+}
+} // namespace sw
+
+/// Dialog to specify the properties of date form field
+namespace sw
+{
+class DateFormFieldDialog : public SvxStandardDialog
+{
+private:
+ mark::IFieldmark* m_pDateField;
+
+ VclPtr<NumFormatListBox> m_xFormatLB;
+
+ virtual void Apply() override;
+ void InitControls();
+
+public:
+ DateFormFieldDialog(vcl::Window* pParent, mark::IFieldmark* pDateField);
+ virtual ~DateFormFieldDialog() override;
+ virtual void dispose() override;
+};
+
+} // namespace sw
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 7c54938843a0..cda646cde90d 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1411,6 +1411,19 @@ void SwTextShell::Execute(SfxRequest &rReq)
dynamic_cast<::sw::mark::DropDownFieldmark*>(pFieldBM)->HideButton();
}
}
+ else if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDATE )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDateFormFieldDialog(pFieldBM));
+ if (pDlg->Execute() == RET_OK)
+ {
+ pFieldBM->Invalidate();
+ rWrtSh.InvalidateWindows( rWrtSh.GetView().GetVisArea() );
+ rWrtSh.UpdateCursor(); // cursor position might be invalid
+ // Hide the button here and make it visible later, to make transparent background work with SAL_USE_VCLPLUGIN=gen
+ dynamic_cast<::sw::mark::DateFieldmark*>(pFieldBM)->HideButton();
+ }
+ }
else
{
SfxRequest aReq( GetView().GetViewFrame(), SID_FM_CTL_PROPERTIES );
@@ -1980,7 +1993,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
--aPos.nContent;
pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
}
- if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN )
+ if ( pFieldBM && (pFieldBM->GetFieldname() == ODF_FORMDROPDOWN || pFieldBM->GetFieldname() == ODF_FORMDATE) )
{
bDisable = false;
}
diff --git a/sw/uiconfig/swriter/ui/dateformfielddialog.ui b/sw/uiconfig/swriter/ui/dateformfielddialog.ui
new file mode 100644
index 000000000000..6328f23d3047
--- /dev/null
+++ b/sw/uiconfig/swriter/ui/dateformfielddialog.ui
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.4 -->
+<interface domain="sw">
+ <requires lib="gtk+" version="3.18"/>
+ <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkDialog" id="DateFormFieldDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes" context="dateformfielddialog|DateFormFieldDialog">Date Picker Content Control</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="GtkLabel" id="date_format_list_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="dateformfielddialog|date_format_list_label">Date Format</property>
+ <property name="use_underline">True</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="swlo-NumFormatListBox" id="date_formats_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="dropdown">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</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>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
commit 2ef312950a34bfdd2648e432c7b036bf96dc7b98
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri May 31 17:55:10 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Jul 14 00:15:11 2019 +0200
MSForms: Insert text-based date field from MS compatible Forms menu
Reviewed-on: https://gerrit.libreoffice.org/75438
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 75099d6788672a98389d8592b88777c8d3a25fa6)
Change-Id: I2f08fa806dc55a185adf67ca616af8d81bb23bda
Reviewed-on: https://gerrit.libreoffice.org/75532
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 1a26c35eb2d1..9d9635537518 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6205,6 +6205,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:DatePickerFormField" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Date Picker Content Control</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">
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index cafbd2b4ab1f..b78c68fcd2bc 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -276,6 +276,8 @@
#define FN_INSERT_CHECKBOX_FORMFIELD (FN_INSERT2 + 23)
#define FN_INSERT_DROPDOWN_FORMFIELD (FN_INSERT2 + 24)
+// MSO content controls
+#define FN_INSERT_DATE_FORMFIELD (FN_INSERT2 + 25)
// Region: Format
#define FN_AUTOFORMAT_APPLY (FN_FORMAT + 1 ) /* apply autoformat options */
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 954db3082ea1..833a937f4091 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -53,6 +53,7 @@ public:
void testTdf122942();
void testImageComment();
void testImageCommentAtChar();
+ void testDateFormFieldInsertion();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testTdf101534);
@@ -67,6 +68,7 @@ public:
CPPUNIT_TEST(testTdf122942);
CPPUNIT_TEST(testImageComment);
CPPUNIT_TEST(testImageCommentAtChar);
+ CPPUNIT_TEST(testDateFormFieldInsertion);
CPPUNIT_TEST_SUITE_END();
private:
@@ -602,6 +604,38 @@ void SwUiWriterTest2::testImageCommentAtChar()
CPPUNIT_ASSERT_EQUAL(*pImageAnchor, rAnnotationMarkStart);
}
+void SwUiWriterTest2::testDateFormFieldInsertion()
+{
+ SwDoc* pDoc = createDoc();
+ CPPUNIT_ASSERT(pDoc);
+ IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess();
+ CPPUNIT_ASSERT(pMarkAccess);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
+
+ // Insert a date form field
+ lcl_dispatchCommand(mxComponent, ".uno:DatePickerFormField", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount());
+
+ // Check whether the fieldmark is created
+ auto aIter = pMarkAccess->getAllMarksBegin();
+ CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
+ ::sw::mark::IFieldmark* pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(aIter->get());
+ CPPUNIT_ASSERT(pFieldmark);
+ CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
+
+ // Undo insertion
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount());
+
+ // Redo insertion
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ aIter = pMarkAccess->getAllMarksBegin();
+ CPPUNIT_ASSERT(aIter != pMarkAccess->getAllMarksEnd());
+ pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(aIter->get());
+ CPPUNIT_ASSERT(pFieldmark);
+ CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 557c036a569d..1c6c90d884e6 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1694,6 +1694,12 @@ interface BaseText
StateMethod = StateField ;
]
+ FN_INSERT_DATE_FORMFIELD
+ [
+ ExecMethod = ExecField ;
+ StateMethod = StateField ;
+ ]
+
SID_FM_CTL_PROPERTIES
[
ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 5fcf1e53ef87..f65d8e8bd6a0 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7704,3 +7704,21 @@ SfxVoidItem DropDownFormField FN_INSERT_DROPDOWN_FORMFIELD
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Controls;
]
+
+SfxVoidItem DatePickerFormField FN_INSERT_DATE_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/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 73ec7c99508f..278ad3212282 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -720,6 +720,21 @@ FIELD_INSERT:
rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
}
break;
+ case FN_INSERT_DATE_FORMFIELD:
+ {
+ rSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
+
+ SwPaM* pCursorPos = rSh.GetCursor();
+ if(pCursorPos)
+ {
+ IDocumentMarkAccess* pMarksAccess = rSh.GetDoc()->getIDocumentMarkAccess();
+ pMarksAccess->makeNoTextFieldBookmark(*pCursorPos, OUString(), ODF_FORMDATE);
+ }
+
+ rSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT_FORM_FIELD, nullptr);
+ rSh.GetView().GetViewFrame()->GetBindings().Invalidate( SID_UNDO );
+ }
+ break;
default:
OSL_FAIL("wrong dispatcher");
return;
@@ -879,6 +894,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
case FN_INSERT_TEXT_FORMFIELD:
case FN_INSERT_CHECKBOX_FORMFIELD:
case FN_INSERT_DROPDOWN_FORMFIELD:
+ case FN_INSERT_DATE_FORMFIELD:
if ( rSh.CursorInsideInputField() )
{
rSet.DisableItem(nWhich);
diff --git a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
index 4d157908dd71..c9f2c0884754 100644
--- a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
+++ b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
@@ -32,7 +32,7 @@
</menu:menu>
<menu:menu menu:id=".uno:MSCompatContentControls">
<menu:menupopup>
- <menu:menuitem menu:id=".uno:DateField"/>
+ <menu:menuitem menu:id=".uno:DatePickerFormField"/>
</menu:menupopup>
</menu:menu>
</menu:menupopup>
More information about the Libreoffice-commits
mailing list