[Libreoffice-commits] core.git: Branch 'feature/msforms' - 365 commits - accessibility/inc accessibility/source apple_remote/source avmedia/source basctl/inc basctl/source basctl/uiconfig basegfx/source basic/source bin/find-unneeded-includes bin/gbuild-to-ide bridges/source canvas/source canvas/workben chart2/inc chart2/qa chart2/source codemaker/source comphelper/source compilerplugins/clang configure.ac connectivity/Library_postgresql-sdbc-impl.mk connectivity/source cppcanvas/qa cppuhelper/IwyuFilter_cppuhelper.yaml cppuhelper/qa cppuhelper/source cppu/source cui/inc cui/source cui/uiconfig dbaccess/inc dbaccess/source desktop/inc desktop/source distro-configs/Jenkins download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source editeng/qa editeng/source embeddedobj/source emfio/qa emfio/source eventattacher/source extensions/inc extensions/Module_extensions.mk extensions/source external/libpng external/postgresql extras/source filter/sou rce forms/inc forms/source fpicker/source framework/inc framework/source .git-hooks/commit-msg helpcompiler/source helpcontent2 hwpfilter/source i18npool/source i18nutil/source icon-themes/elementary icon-themes/elementary_svg icon-themes/karasa_jaga icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg idlc/source idl/source include/avmedia include/basegfx include/com include/connectivity include/drawinglayer include/editeng include/IwyuFilter_include.yaml include/oox include/sfx2 include/svtools include/svx include/test include/toolkit include/tools include/unotools include/vbahelper include/vcl include/xmloff io/source jurt/source jvmfwk/distributions jvmfwk/inc jvmfwk/plugins jvmfwk/source l10ntools/source libreofficekit/qa lingucomponent/source linguistic/source lotuswordpro/source offapi/com officecfg/registry oovbaapi/ooo oox/source opencl/source package/source postprocess/Rdb_services.mk qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests registry/inc registry/Iwy uFilter_registry.yaml registry/source registry/tools reportdesign/inc reportdesign/source RepositoryExternal.mk Repository.mk sal/osl sal/qa sal/rtl sax/source sax/test scaddins/source sc/CppunitTest_sc_datapilotfieldgroupsobj.mk schema/libreoffice sc/inc sc/Module_sc.mk sc/qa sc/README scripting/source sc/source sc/uiconfig sdext/source sd/inc sd/qa sd/source sd/uiconfig sfx2/inc sfx2/source sfx2/uiconfig shell/source slideshow/inc slideshow/source solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/sanitizers soltools/cpp soltools/mkdepend sot/source starmath/source stoc/source svgio/qa svl/qa svl/source svtools/inc svtools/Library_svt.mk svtools/qa svtools/README svtools/source svtools/uiconfig svx/inc svx/source svx/uiconfig sw/inc sw/Library_swui.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk test/Library_test.mk test/source toolkit/source tools/qa tools/source ucbhelper/source ucb/Library_ucpfile1.mk ucb/s ource UnoControls/source unoidl/source unotools/Library_utl.mk unotools/source unoxml/source uui/source vbahelper/inc vbahelper/source vcl/android vcl/CppunitTest_vcl_png_test.mk vcl/headless vcl/inc vcl/ios vcl/Library_vcl.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/source vcl/uiconfig vcl/unx vcl/win wizards/com writerfilter/source writerperfect/qa writerperfect/source xmlhelp/source xmloff/inc xmloff/source xmloff/util xmlscript/source xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 15 16:54:38 UTC 2019


Rebased ref, commits from common ancestor:
commit 0815e9243a3900cbff3677d33583c383ccf8ca41
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Feb 15 17:50:18 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 17:50:18 2019 +0100

    MSForms: Rework the MS compatible Forms menu a bit
    
    * DateField is saved as a content control in MSO file formats
    so let have it under content controls submenu
    * The MS compatible forms menu is a Writer specific thing so better
    to have the related commands as Writer commands.
    
    Change-Id: I2d66130f54c055a422f56b18ff2c98667e4f6469

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 5e8709ba4938..ccaed35731b0 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6833,16 +6833,6 @@
           <value xml:lang="en-US">More Fields</value>
         </prop>
       </node>
-      <node oor:name=".uno:MSCompatActiveXControls" oor:op="replace">
-        <prop oor:name="Label" oor:type="xs:string">
-          <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/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index cc136f04a7c6..e88f44c8e6ce 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -3402,6 +3402,21 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:MSCompatActiveXControls" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <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 Form Fields</value>
+        </prop>
+      </node>
+      <node oor:name=".uno:MSCompatContentControls" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Content Controls</value>
+        </prop>
+      </node>
     </node>
   </node>
 </oor:component-data>
diff --git a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
index 4c8e34467d3e..4d157908dd71 100644
--- a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
+++ b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
@@ -21,7 +21,6 @@
           <menu:menuitem menu:id=".uno:RadioButton"/>
           <menu:menuitem menu:id=".uno:ListBox"/>
           <menu:menuitem menu:id=".uno:Pushbutton"/>
-          <menu:menuitem menu:id=".uno:DateField"/>
         </menu:menupopup>
       </menu:menu>
       <menu:menu menu:id=".uno:MSCompatLegacyControls">
@@ -31,6 +30,11 @@
           <menu:menuitem menu:id=".uno:DropDownFormField"/>
         </menu:menupopup>
       </menu:menu>
+      <menu:menu menu:id=".uno:MSCompatContentControls">
+        <menu:menupopup>
+          <menu:menuitem menu:id=".uno:DateField"/>
+        </menu:menupopup>
+      </menu:menu>
     </menu:menupopup>
   </menu:menu>
 </menu:menubar>
commit 1d1cd6cd5396b230994044271db06eaaf8889a10
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Feb 15 14:11:37 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 14:12:32 2019 +0100

    MSForms: Make Control Properties menu to work with drop-down form field
    
    Always forward the Execute and State method to the form shell,
    so if a form control is selected the Control Properites will
    work correctly.
    Otherwise we check whether there is any field next to the cursor.
    
    Change-Id: I25055c17d887a2f2a716d8325f46825cc408179e

diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index f8c2daee6d65..3724ee041ecc 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1694,5 +1694,11 @@ interface BaseText
         StateMethod = StateField ;
     ]
 
+    SID_FM_CTL_PROPERTIES
+    [
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
+    ]
+
 }  // end of interface text
 
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index fd759463b971..270fcabc08dc 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -119,6 +119,8 @@
 #include <svx/drawitem.hxx>
 #include <numrule.hxx>
 #include <memory>
+#include <xmloff/odffields.hxx>
+#include <swabstdlg.hxx>
 
 using namespace ::com::sun::star;
 using namespace com::sun::star::beans;
@@ -1367,6 +1369,32 @@ void SwTextShell::Execute(SfxRequest &rReq)
         GetView().UpdateWordCount(this, nSlot);
     }
     break;
+    case SID_FM_CTL_PROPERTIES:
+    {
+        SwPosition aPos(*GetShell().GetCursor()->GetPoint());
+        sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+        if ( !pFieldBM )
+        {
+            --aPos.nContent;
+            pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+        }
+
+        if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN )
+        {
+            SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+            ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDropDownFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), pFieldBM));
+            pDlg->Execute();
+            pFieldBM->Invalidate();
+            rWrtSh.InvalidateWindows( rWrtSh.GetView().GetVisArea() );
+        }
+        else
+        {
+            SfxRequest aReq( GetView().GetViewFrame(), SID_FM_CTL_PROPERTIES );
+            aReq.AppendItem( SfxBoolItem( SID_FM_CTL_PROPERTIES, true ) );
+            rWrtSh.GetView().GetFormShell()->Execute( aReq );
+        }
+    }
+    break;
     default:
         OSL_ENSURE(false, "wrong dispatcher");
         return;
@@ -1906,6 +1934,37 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                     rSet.DisableItem(nWhich);
             }
             break;
+            case SID_FM_CTL_PROPERTIES:
+            {
+                bool bDisable = false;
+
+                // First get the state from the form shell
+                SfxItemSet aSet(GetShell().GetAttrPool(), svl::Items<SID_FM_CTL_PROPERTIES, SID_FM_CTL_PROPERTIES>{});
+                aSet.Put(SfxBoolItem( SID_FM_CTL_PROPERTIES, true ));
+                GetShell().GetView().GetFormShell()->GetState( aSet );
+
+                if(SfxItemState::DISABLED == aSet.GetItemState(SID_FM_CTL_PROPERTIES))
+                {
+                    bDisable = true;
+                }
+
+                // Enable it if we have a valid object other than what form shell knows
+                SwPosition aPos(*GetShell().GetCursor()->GetPoint());
+                sw::mark::IFieldmark* pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+                if ( !pFieldBM )
+                {
+                    --aPos.nContent;
+                    pFieldBM = GetShell().getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+                }
+                if ( pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN )
+                {
+                    bDisable = false;
+                }
+
+                if(bDisable)
+                    rSet.DisableItem(nWhich);
+            }
+            break;
         }
         nWhich = aIter.NextWhich();
     }
commit da6b5174901799082c08ab31f5fe937bd5b1fe09
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: Fri Feb 15 14:12:32 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 2ce99d340d99b6a732d34d4c9aae70acded9fb0e
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: Fri Feb 15 14:12:32 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 4fc4ec7f085d..00956ff68cd0 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(std::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 c03836d297e6bf27e246b2bf4b86a9cb6931fd8d
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: Fri Feb 15 14:12:31 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 1512d2991a32..631373f98d99 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 0e05aae0602d..dd34a47e16bd 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -725,8 +725,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 996f5fba2935ddbb4e06a5480a50018a59d872de
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: Fri Feb 15 14:12:31 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 200656e87d43..5e8709ba4938 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 ff1c3e59d0eb..bc429b9486d3 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -505,6 +505,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);
@@ -512,6 +515,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 5a278df6dd01..0e05aae0602d 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;
 
@@ -715,6 +718,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;
@@ -865,6 +907,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>
commit fe67ba6e9dc53502ddc325be97af8c080131e388
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Feb 5 12:15:31 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 14:12:31 2019 +0100

    MSForms: Show restart dialog when MS compatible Forms menu setting is changed
    
    Change-Id: Icb98dac73dea5f5cb18e1ca34e37e9d9bf84782e

diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
index a49289b5f8f7..2e7c481e1ef7 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -60,6 +60,9 @@ enum RestartReason {
     // For the OpenCL changes to take effect,
     // %PRODUCTNAME must be restarted:
     RESTART_REASON_OPENCL,
+    // For restructuring the Forms menu,
+    // %PRODUCTNAME must be restarted:
+    RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
     // No particular reason:
     RESTART_REASON_NONE
 };
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index 4ec3356276bb..3e665ede47c0 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -65,6 +65,9 @@ public:
         case svtools::RESTART_REASON_OPENCL:
             reason_ = m_xBuilder->weld_widget("reason_opencl");
             break;
+        case svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU:
+            reason_ = m_xBuilder->weld_widget("reason_mscompatible_formsmenu");
+            break;
         default:
             assert(false); // this cannot happen
         }
diff --git a/svtools/uiconfig/ui/restartdialog.ui b/svtools/uiconfig/ui/restartdialog.ui
index ab8dfa14f69e..5962da9940bc 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -244,6 +244,21 @@
               </packing>
             </child>
             <child>
+              <object class="GtkLabel" id="reason_mscompatible_formsmenu">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes" context="restartdialog|reason_mscompatible_formsmenu">For restructuring the Forms menu, %PRODUCTNAME must be restarted.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">50</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">12</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -254,7 +269,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">12</property>
+                <property name="position">13</property>
               </packing>
             </child>
           </object>
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index dbb622ece3ad..fa5d55497f8d 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -35,6 +35,8 @@
 #include <vcl/treelistentry.hxx>
 #include <IDocumentSettingAccess.hxx>
 #include <vector>
+#include <svtools/restartdialog.hxx>
+#include <comphelper/processfactory.hxx>
 
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::document;
@@ -452,6 +454,16 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet*  )
         m_aViewConfigItem.SetMSOCompatibleFormsMenu(bNewMSFormsMenuOption);
         m_bSavedMSFormsMenuOption = bNewMSFormsMenuOption;
         bModified = true;
+
+        // Show a message about that the option needs a restart to be applied
+        {
+            SolarMutexGuard aGuard;
+            if (svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
+                                              GetFrameWeld(), svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU))
+            {
+                GetParentDialog()->EndDialog(RET_OK);
+            }
+        }
     }
 
     return bModified;
commit 6c58e629ec5aeead0c7cb71882c020c7eb25ddbb
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Feb 5 12:12:08 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 14:12:31 2019 +0100

    MSForms: Introduce a new Forms menu which is compatible with MS Word
    
    * It's a Writer only menu by now
    * Displayed when the compatibility option is set
    * The menubar is changed during creation, so the option
    has an effect only after a restart.
    * MS compatible Forms menu contain only some ActiveX controls so far
    
    Change-Id: I459f489c15ea7a25514f379b1800b926cc2087ce

diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 1cd9f1d99ff7..6e15d58e2442 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -178,6 +178,7 @@ namespace framework
             void implts_reset( bool bAttach );
             void implts_updateMenuBarClose();
             bool implts_resetMenuBar();
+            void implts_createMSCompatibleMenuBar(const OUString& rName);
 
             //  locking
 
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index b48e69c3b9e6..5cb364df9285 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -74,6 +74,7 @@
 #include <comphelper/uno3.hxx>
 #include <rtl/instance.hxx>
 #include <unotools/cmdoptions.hxx>
+#include <unotools/compatibilityviewoptions.hxx>
 
 #include <rtl/ref.hxx>
 #include <rtl/strbuf.hxx>
@@ -157,6 +158,14 @@ void LayoutManager::implts_createMenuBar(const OUString& rMenuBarName)
 {
     SolarMutexClearableGuard aWriteLock;
 
+    // Create a customized menu if compatibility mode is on
+    SvtCompatibilityViewOptions aCompOptions;
+    if( aCompOptions.HasMSOCompatibleFormsMenu() && m_aModuleIdentifier == "com.sun.star.text.TextDocument" )
+    {
+        implts_createMSCompatibleMenuBar(rMenuBarName);
+    }
+
+    // Create the default menubar otherwise
     if (!m_bInplaceMenuSet && !m_xMenuBar.is())
     {
         m_xMenuBar = implts_createElement( rMenuBarName );
@@ -209,6 +218,8 @@ void LayoutManager::impl_clearUpMenuBar()
 {
     implts_lock();
 
+    implts_resetInplaceMenuBar();
+
     // Clear up VCL menu bar to prepare shutdown
     if ( m_xContainerWindow.is() )
     {
@@ -2524,6 +2535,60 @@ bool LayoutManager::implts_resetMenuBar()
     return false;
 }
 
+void LayoutManager::implts_createMSCompatibleMenuBar( const OUString& aName )
+{
+    SolarMutexClearableGuard aWriteLock;
+
+    // Find Forms menu in the original menubar
+    m_xMenuBar = implts_createElement( aName );
+    uno::Reference< XUIElementSettings > xMenuBarSettings(m_xMenuBar, UNO_QUERY);
+    uno::Reference< container::XIndexReplace > xMenuIndex(xMenuBarSettings->getSettings(true), UNO_QUERY);
+
+    sal_Int32 nFormsMenu = -1;
+    for (sal_Int32 nIndex = 0; nIndex < xMenuIndex->getCount(); ++nIndex)
+    {
+        uno::Sequence< beans::PropertyValue > aProps;
+        xMenuIndex->getByIndex( nIndex ) >>= aProps;
+        OUString aCommand;
+        for (sal_Int32 nSeqInd = 0; nSeqInd < aProps.getLength(); ++nSeqInd)
+        {
+            if (aProps[nSeqInd].Name == "CommandURL")
+            {
+                aProps[nSeqInd].Value >>= aCommand;
+                break;
+            }
+        }
+
+        if (aCommand == ".uno:FormatFormMenu")
+            nFormsMenu = nIndex;
+    }
+    assert(nFormsMenu != -1);
+
+    // Create the MS compatible Forms menu
+    css::uno::Reference< css::ui::XUIElement > xFormsMenu = implts_createElement( "private:resource/menubar/mscompatibleformsmenu" );
+    if(!xFormsMenu.is())
+        return;
+
+    // Merge the MS compatible Forms menu into the menubar
+    uno::Reference< XUIElementSettings > xFormsMenuSettings(xFormsMenu, UNO_QUERY);
+    uno::Reference< container::XIndexAccess > xFormsMenuIndex(xFormsMenuSettings->getSettings(true));
+
+    assert(xFormsMenuIndex->getCount() >= 1);
+    uno::Sequence< beans::PropertyValue > aNewFormsMenu;
+    xFormsMenuIndex->getByIndex( 0 ) >>= aNewFormsMenu;
+    xMenuIndex->replaceByIndex(nFormsMenu, uno::makeAny(aNewFormsMenu));
+
+    setMergedMenuBar( xMenuIndex );
+
+    // Clear up the temporal forms menubar
+    Reference< XComponent > xFormsMenuComp( xFormsMenu, UNO_QUERY );
+    if ( xFormsMenuComp.is() )
+        xFormsMenuComp->dispose();
+    xFormsMenu.clear();
+
+    aWriteLock.clear();
+}
+
 IMPL_LINK_NOARG(LayoutManager, MenuBarClose, void*, void)
 {
     SolarMutexClearableGuard aReadLock;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 5e0316d6795e..200656e87d43 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -6809,6 +6809,11 @@
           <value xml:lang="en-US">More Fields</value>
         </prop>
       </node>
+      <node oor:name=".uno:MSCompatActiveXControls" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">ActiveX Controls</value>
+        </prop>
+      </node>
     </node>
   </node>
 </oor:component-data>
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 4bb3adb83cee..5e03ab5d3d7f 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,modules/swriter))
 
 $(eval $(call gb_UIConfig_add_menubarfiles,modules/swriter,\
 	sw/uiconfig/swriter/menubar/menubar \
+	sw/uiconfig/swriter/menubar/mscompatibleformsmenu \
 ))
 
 $(eval $(call gb_UIConfig_add_popupmenufiles,modules/swriter,\
diff --git a/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
new file mode 100644
index 000000000000..4b8f5ea0e714
--- /dev/null
+++ b/sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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/.
+ *
+-->
+<menu:menubar xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menu menu:id=".uno:FormatFormMenu">
+    <menu:menupopup>
+      <menu:menuitem menu:id=".uno:SwitchControlDesignMode"/>
+      <menu:menuitem menu:id=".uno:ControlProperties"/>
+      <menu:menuseparator/>
+      <menu:menu menu:id=".uno:MSCompatActiveXControls">
+        <menu:menupopup>
+          <menu:menuitem menu:id=".uno:Label"/>
+          <menu:menuitem menu:id=".uno:Edit"/>
+          <menu:menuitem menu:id=".uno:CheckBox"/>
+          <menu:menuitem menu:id=".uno:RadioButton"/>
+          <menu:menuitem menu:id=".uno:ListBox"/>
+          <menu:menuitem menu:id=".uno:Pushbutton"/>
+          <menu:menuitem menu:id=".uno:DateField"/>
+        </menu:menupopup>
+      </menu:menu>
+    </menu:menupopup>
+  </menu:menu>
+</menu:menubar>
commit e99be652042ae23e78b143c1747333dd946daf71
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Feb 5 11:34:40 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 14:12:30 2019 +0100

    MSForms: Extract menu creation to a separate method
    
    Change-Id: Ieb88e746b08c6a6daac14c08a206db73cbeef8a9

diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index eaecc6fa8e87..1cd9f1d99ff7 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -173,6 +173,7 @@ namespace framework
 
             //  menu bar
 
+            void implts_createMenuBar( const OUString& rMenuBarName );
             void impl_clearUpMenuBar();
             void implts_reset( bool bAttach );
             void implts_updateMenuBarClose();
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index ae58c71deb72..b48e69c3b9e6 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -153,6 +153,57 @@ LayoutManager::~LayoutManager()
     m_pGlobalSettings.reset();
 }
 
+void LayoutManager::implts_createMenuBar(const OUString& rMenuBarName)
+{
+    SolarMutexClearableGuard aWriteLock;
+
+    if (!m_bInplaceMenuSet && !m_xMenuBar.is())
+    {
+        m_xMenuBar = implts_createElement( rMenuBarName );
+        if ( m_xMenuBar.is() )
+        {
+            SolarMutexGuard aGuard;
+
+            SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
+            if ( pSysWindow )
+            {
+                Reference< awt::XMenuBar > xMenuBar;
+
+                Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
+                if ( xPropSet.is() )
+                {
+                    try
+                    {
+                        xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
+                    }
+                    catch (const beans::UnknownPropertyException&)
+                    {
+                    }
+                    catch (const lang::WrappedTargetException&)
+                    {
+                    }
+                }
+
+                if ( xMenuBar.is() )
+                {
+                    VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar );
+                    if ( pAwtMenuBar )
+                    {
+                        MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
+                        if ( pMenuBar )
+                        {
+                            pSysWindow->SetMenuBar(pMenuBar);
+                            pMenuBar->SetDisplayable( m_bMenuVisible );
+                            implts_updateMenuBarClose();
+                        }
+                    }
+                }
+            }
+        }
+    }
+    aWriteLock.clear();
+}
+
 // Internal helper function
 void LayoutManager::impl_clearUpMenuBar()
 {
@@ -1379,7 +1430,6 @@ void SAL_CALL LayoutManager::createElement( const OUString& aName )
 
     SolarMutexClearableGuard aReadLock;
     Reference< XFrame > xFrame = m_xFrame;
-    bool    bInPlaceMenu = m_bInplaceMenuSet;
     aReadLock.clear();
 
     if ( !xFrame.is() )
@@ -1415,55 +1465,13 @@ void SAL_CALL LayoutManager::createElement( const OUString& aName )
             bMustBeLayouted = m_xToolbarManager->isLayoutDirty();
         }
         else if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
-                  aElementName.equalsIgnoreAsciiCase("menubar") )
+                  aElementName.equalsIgnoreAsciiCase("menubar") &&
+                  implts_isFrameOrWindowTop(xFrame) )
         {
-            // #i38743# don't create a menubar if frame isn't top
-            if ( !bInPlaceMenu && !m_xMenuBar.is() && implts_isFrameOrWindowTop( xFrame ))
-            {
-                m_xMenuBar = implts_createElement( aName );
-                if ( m_xMenuBar.is() )
-                {
-                    SolarMutexGuard aGuard;
+            implts_createMenuBar( aName );
+            if (m_bMenuVisible)
+                bNotify = true;
 
-                    SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
-                    if ( pSysWindow )
-                    {
-                        Reference< awt::XMenuBar > xMenuBar;
-
-                        Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
-                        if ( xPropSet.is() )
-                        {
-                            try
-                            {
-                                xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
-                            }
-                            catch (const beans::UnknownPropertyException&)
-                            {
-                            }
-                            catch (const lang::WrappedTargetException&)
-                            {
-                            }
-                        }
-
-                        if ( xMenuBar.is() )
-                        {
-                            VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar );
-                            if ( pAwtMenuBar )
-                            {
-                                MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
-                                if ( pMenuBar )
-                                {
-                                    pSysWindow->SetMenuBar(pMenuBar);
-                                    pMenuBar->SetDisplayable( m_bMenuVisible );
-                                    if ( m_bMenuVisible )
-                                        bNotify = true;
-                                    implts_updateMenuBarClose();
-                                }
-                            }
-                        }
-                    }
-                }
-            }
             aWriteLock.clear();
         }
         else if ( aElementType.equalsIgnoreAsciiCase("statusbar") &&
commit 7072991563e3bdd0f0a39f0d4d91035dfeb9a24a
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Feb 5 12:06:17 2019 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 15 14:12:30 2019 +0100

    MSForms: Introduce a new compatibility flag to enable MS compatible Forms menu
    
    * It's a global option not a document level setting (like other compatibility
    options -> so I created a separate section on the GUI for this option
    on the same tab page.
    * In the configuration the option is placed under Compatibility/View since
    the existing Compatibility/FormattingOptions seems related to document formating
    and not the GUI
    * Since it was added with a new configuration root I needed to add also a new
    ConfigItem derviative class to handle this option.
    
    Change-Id: I54668ae9808a1ca3c3b7fe81f2f201720257b3fb

diff --git a/include/unotools/compatibilityviewoptions.hxx b/include/unotools/compatibilityviewoptions.hxx
new file mode 100644
index 000000000000..573979714e7e
--- /dev/null
+++ b/include/unotools/compatibilityviewoptions.hxx
@@ -0,0 +1,40 @@
+/* -*- 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_SVTOOLS_COMPATIBILITYVIEWOPTIONS_HXX
+#define INCLUDED_SVTOOLS_COMPATIBILITYVIEWOPTIONS_HXX
+
+#include <svtools/svtdllapi.h>
+#include <unotools/options.hxx>
+#include <osl/mutex.hxx>
+
+class SvtCompatibilityViewOptions_Impl;
+
+/// Compatibility settings which affects the GUI. These are not document level settings
+/// (like SvtCompatibilityOptions), but global options affecting the application's
+/// behavior in general.
+class UNOTOOLS_DLLPUBLIC SvtCompatibilityViewOptions : public utl::detail::Options
+{
+public:
+    SvtCompatibilityViewOptions();
+    virtual ~SvtCompatibilityViewOptions() override;
+
+    bool HasMSOCompatibleFormsMenu() const;
+    void SetMSOCompatibleFormsMenu(bool bSet);
+
+private:
+    /// Return a reference to a static mutex
+    UNOTOOLS_DLLPRIVATE static osl::Mutex& GetOwnStaticMutex();
+
+    std::shared_ptr<SvtCompatibilityViewOptions_Impl> m_pImpl;
+};
+
+#endif // #ifndef INCLUDED_SVTOOLS_COMPATIBILITYVIEWOPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx
index 865d45e8b4d8..b401de3435c1 100644
--- a/include/unotools/itemholderbase.hxx
+++ b/include/unotools/itemholderbase.hxx
@@ -37,6 +37,7 @@ enum class EItem
     CmdOptions                    ,
     ColorConfig                   ,   // 2
     Compatibility                 ,
+    CompatibilityView             ,
     CTLOptions                    ,   // 2
 
     DefaultOptions                ,
diff --git a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
index a47d27074cba..7c587319beef 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Compatibility.xcs
@@ -151,5 +151,18 @@
         <value/>
       </prop>
     </group>
+    <group oor:name="View">
+      <info>
+        <desc>Compatibility options affecting GUI</desc>
+      </info>
+      <prop oor:name="MSCompatibleFormsMenu" oor:type="xs:boolean" oor:nillable="false">
+        <!-- UIHints: Tools - Options - Writer - Compatibility - Global Options -->
+        <info>
+          <desc>Specifies whether Forms menu should be customized for an MSO workflow. The MS compatible Forms menu contains only MS compatible form controls.</desc>
+          <label>Reorganize Forms menu to have it MS compatible.</label>
+        </info>
+        <value>false</value>
+      </prop>
+    </group>
   </component>
 </oor:component-schema>
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 1204eacc6314..dbb622ece3ad 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -51,10 +51,14 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt
     , m_pWrtShell(nullptr)
     , m_pImpl(new SwCompatibilityOptPage_Impl)
     , m_nSavedOptions(0)
+    , m_bSavedMSFormsMenuOption(false)
 {
     get(m_pMain, "compatframe");
+    get(m_pGlobalOptionsFrame, "globalcompatframe");
     get(m_pFormattingLB, "format");
+    get(m_pGlobalOptionsLB, "globaloptions");
     get(m_pOptionsLB, "options");
+    get(m_pGlobalOptionsCLB, "globaloptioncheckboxs");
     get(m_pDefaultPB, "default");
 
     for ( int i = static_cast<int>(SvtCompatibilityEntry::Index::Module) + 1; i < static_cast<int>(SvtCompatibilityEntry::Index::INVALID); ++i )
@@ -76,6 +80,16 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(vcl::Window* pParent, const SfxIt
     m_pOptionsLB->SetStyle( m_pOptionsLB->GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
     m_pOptionsLB->SetHighlightRange();
 
+    SvTreeListEntry* pEntry = m_pGlobalOptionsCLB->SvTreeListBox::InsertEntry( m_pGlobalOptionsLB->GetEntry( 0 ) );
+    if ( pEntry )
+    {
+        m_pGlobalOptionsCLB->SetCheckButtonState( pEntry, SvButtonState::Unchecked );
+    }
+    m_pGlobalOptionsLB->Clear();
+
+    m_pGlobalOptionsCLB->SetStyle( m_pGlobalOptionsCLB->GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
+    m_pGlobalOptionsCLB->SetHighlightRange();
+
     InitControls( rSet );
 
     // set handler
@@ -92,8 +106,11 @@ void SwCompatibilityOptPage::dispose()
 {
     m_pImpl.reset();
     m_pMain.clear();
+    m_pGlobalOptionsFrame.clear();
     m_pFormattingLB.clear();
+    m_pGlobalOptionsLB.clear();
     m_pOptionsLB.clear();
+    m_pGlobalOptionsCLB.clear();
     m_pDefaultPB.clear();
     SfxTabPage::dispose();
 }
@@ -185,6 +202,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
     else
     {
         m_pMain->Disable();
+        m_pGlobalOptionsFrame->Disable();
     }
     const OUString& rText = m_pMain->get_label();
     m_pMain->set_label(rText.replaceAll("%DOCNAME", sDocTitle));
@@ -428,6 +446,14 @@ bool SwCompatibilityOptPage::FillItemSet( SfxItemSet*  )
     if ( bModified )
         WriteOptions();
 
+    bool bNewMSFormsMenuOption = m_pGlobalOptionsCLB->IsChecked(0);
+    if (m_bSavedMSFormsMenuOption != bNewMSFormsMenuOption)
+    {
+        m_aViewConfigItem.SetMSOCompatibleFormsMenu(bNewMSFormsMenuOption);
+        m_bSavedMSFormsMenuOption = bNewMSFormsMenuOption;
+        bModified = true;
+    }
+
     return bModified;
 }
 
@@ -438,6 +464,9 @@ void SwCompatibilityOptPage::Reset( const SfxItemSet*  )
     sal_uLong nOptions = GetDocumentOptions();
     SetCurrentOptions( nOptions );
     m_nSavedOptions = nOptions;
+
+    m_pGlobalOptionsCLB->CheckEntryPos( 0, m_aViewConfigItem.HasMSOCompatibleFormsMenu() );
+    m_bSavedMSFormsMenuOption = m_aViewConfigItem.HasMSOCompatibleFormsMenu();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/inc/optcomp.hxx b/sw/source/uibase/inc/optcomp.hxx
index fe6c3eca0ee1..aa76d70bc09c 100644
--- a/sw/source/uibase/inc/optcomp.hxx
+++ b/sw/source/uibase/inc/optcomp.hxx
@@ -25,6 +25,7 @@
 #include <vcl/layout.hxx>
 #include <vcl/lstbox.hxx>
 #include <unotools/compatibility.hxx>
+#include <unotools/compatibilityviewoptions.hxx>
 #include <svx/checklbx.hxx>
 #include <rtl/ustring.hxx>
 
@@ -36,11 +37,16 @@ class SwCompatibilityOptPage : public SfxTabPage
 private:
     // controls
     VclPtr<VclFrame>               m_pMain;
+    VclPtr<VclFrame>               m_pGlobalOptionsFrame;
     VclPtr<ListBox>                m_pFormattingLB;
+    VclPtr<ListBox>                m_pGlobalOptionsLB;
     VclPtr<SvxCheckListBox>        m_pOptionsLB;
+    VclPtr<SvxCheckListBox>        m_pGlobalOptionsCLB;
     VclPtr<PushButton>             m_pDefaultPB;
     // config item
     SvtCompatibilityOptions m_aConfigItem;
+    // config item
+    SvtCompatibilityViewOptions m_aViewConfigItem;
     // text of the user entry
     OUString                m_sUserEntry;
     // shell of the current document
@@ -49,6 +55,7 @@ private:
     std::unique_ptr<SwCompatibilityOptPage_Impl> m_pImpl;
     // saved options after "Reset"; used in "FillItemSet" for comparison
     sal_uLong                   m_nSavedOptions;
+    bool                        m_bSavedMSFormsMenuOption;
 
     // handler
     DECL_LINK(SelectHdl, ListBox&, void);
diff --git a/sw/uiconfig/swriter/ui/optcompatpage.ui b/sw/uiconfig/swriter/ui/optcompatpage.ui
index b44020d57991..8f4a5342c75d 100644
--- a/sw/uiconfig/swriter/ui/optcompatpage.ui
+++ b/sw/uiconfig/swriter/ui/optcompatpage.ui
@@ -2,12 +2,14 @@
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <requires lib="LibreOffice" version="1.0"/>
-  <object class="GtkGrid" id="OptCompatPage">
+  <object class="GtkBox" id="OptCompatPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
     <property name="border_width">6</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">12</property>
     <child>
       <object class="GtkFrame" id="compatframe">
         <property name="visible">True</property>
@@ -116,5 +118,82 @@
         <property name="height">1</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkFrame" id="globalcompatframe">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">5</property>
+                <child>
+                  <object class="svxcorelo-SvxCheckListBox" id="globaloptioncheckboxs:border">
+                    <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="Check List Box-selection1"/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBoxText" id="globaloptions">
+                    <property name="can_focus">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="entry_text_column">0</property>
+                    <property name="id_column">1</property>
+                    <items>
+                      <item translatable="yes" context="optcompatpage|globalcompatoptions">Reorganize Forms menu to have it MS compatible</item>
+                    </items>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes" context="optcompatpage|label2">Global compatibility options</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
   </object>
 </interface>
diff --git a/unotools/Library_utl.mk b/unotools/Library_utl.mk
index 0bfcbad5e383..19fcd7cfce1c 100644
--- a/unotools/Library_utl.mk
+++ b/unotools/Library_utl.mk
@@ -59,6 +59,7 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
     unotools/source/config/bootstrap \
     unotools/source/config/cmdoptions \
     unotools/source/config/compatibility \
+    unotools/source/config/compatibilityviewoptions \
     unotools/source/config/configitem \
     unotools/source/config/configmgr \
     unotools/source/config/confignode \
diff --git a/unotools/source/config/compatibilityviewoptions.cxx b/unotools/source/config/compatibilityviewoptions.cxx
new file mode 100644
index 000000000000..52e02446608b
--- /dev/null
+++ b/unotools/source/config/compatibilityviewoptions.cxx
@@ -0,0 +1,171 @@
+/* -*- 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 <unotools/compatibilityviewoptions.hxx>
+#include <unotools/configmgr.hxx>
+#include <unotools/configitem.hxx>
+#include "itemholder1.hxx"
+
+#define ROOTNODE_COMPATIBILITY_VIEW "Office.Compatibility/View"
+
+#define PROPERTYNAME_MSCOMPATIBLEFORMSMENU "MSCompatibleFormsMenu"
+
+#define PROPERTYHANDLE_MSCOMPATIBLEFORMSMENU 0
+
+class SvtCompatibilityViewOptions_Impl : public utl::ConfigItem
+{
+private:
+    bool m_bShowMSCompatibleFormsMenu;
+
+public:
+    SvtCompatibilityViewOptions_Impl();
+    virtual ~SvtCompatibilityViewOptions_Impl() override;
+
+    /**
+            @short      Called for notify of configmanager.
+
+                        This method is called from the ConfigManager before application ends or from the
+                        PropertyChangeListener if the sub tree broadcasts changes. You must update your
+                        internal values.
+
+            @see        baseclass ConfigItem
+
+            @param      "seqPropertyNames" is the list of properties which should be updated.
+        */
+    virtual void Notify(const css::uno::Sequence<OUString>& seqPropertyNames) override;
+
+    bool HasMSOCompatibleFormsMenu() const { return m_bShowMSCompatibleFormsMenu; }
+    void SetMSOCompatibleFormsMenu(bool bSet)
+    {
+        bool bModified = (m_bShowMSCompatibleFormsMenu != bSet);
+        if (bModified)
+        {
+            m_bShowMSCompatibleFormsMenu = bSet;
+            SetModified();
+            Commit();
+        }
+    }
+
+private:
+    virtual void ImplCommit() override;
+
+    /**
+            @short      Return list of fix key names of our configuration management which represent our module tree.
+
+                        This method returns a static const list of key names. We need it to get needed values from our
+                        configuration management.
+
+            @return     A list of needed configuration keys is returned.
+        */
+    static css::uno::Sequence<OUString> const& impl_GetPropertyNames();
+};
+
+SvtCompatibilityViewOptions_Impl::SvtCompatibilityViewOptions_Impl()
+    : ConfigItem(ROOTNODE_COMPATIBILITY_VIEW)
+    , m_bShowMSCompatibleFormsMenu(false)
+{
+    // Use our static list of configuration keys to get his values.
+    css::uno::Sequence<OUString> seqNames = impl_GetPropertyNames();
+    css::uno::Sequence<css::uno::Any> seqValues = GetProperties(seqNames);
+    assert(seqNames.getLength() == seqValues.getLength());
+
+    if (seqValues[PROPERTYHANDLE_MSCOMPATIBLEFORMSMENU].hasValue())
+    {
+        assert(seqValues[PROPERTYHANDLE_MSCOMPATIBLEFORMSMENU].getValueTypeClass()
+               == css::uno::TypeClass_BOOLEAN);
+        seqValues[PROPERTYHANDLE_MSCOMPATIBLEFORMSMENU] >>= m_bShowMSCompatibleFormsMenu;
+    }
+
+    EnableNotification(seqNames);
+}
+
+SvtCompatibilityViewOptions_Impl::~SvtCompatibilityViewOptions_Impl()
+{
+    assert(!IsModified()); // should have been committed
+}
+
+void SvtCompatibilityViewOptions_Impl::Notify(const css::uno::Sequence<OUString>& seqPropertyNames)
+{
+    // Use given list of updated properties to get his values from configuration directly!
+    css::uno::Sequence<css::uno::Any> seqValues = GetProperties(seqPropertyNames);
+    assert(seqPropertyNames.getLength() == seqValues.getLength());
+
+    for (sal_Int32 nProperty = 0; nProperty < seqPropertyNames.getLength(); ++nProperty)
+    {
+        if (seqPropertyNames[nProperty] == PROPERTYNAME_MSCOMPATIBLEFORMSMENU)
+        {
+            assert(seqValues[nProperty].getValueTypeClass() == css::uno::TypeClass_BOOLEAN);
+            seqValues[nProperty] >>= m_bShowMSCompatibleFormsMenu;
+        }
+    }
+}
+
+void SvtCompatibilityViewOptions_Impl::ImplCommit()
+{
+    // Get names of supported properties, create a list for values and copy current values to it.
+    css::uno::Sequence<OUString> seqNames = impl_GetPropertyNames();
+    css::uno::Sequence<css::uno::Any> seqValues(seqNames.getLength());
+
+    seqValues[PROPERTYHANDLE_MSCOMPATIBLEFORMSMENU] <<= m_bShowMSCompatibleFormsMenu;
+
+    // Set properties in configuration.
+    PutProperties(seqNames, seqValues);
+}
+
+css::uno::Sequence<OUString> const& SvtCompatibilityViewOptions_Impl::impl_GetPropertyNames()
+{
+    static const css::uno::Sequence<OUString> seqPropertyNames{ OUString(
+        PROPERTYNAME_MSCOMPATIBLEFORMSMENU) };
+    return seqPropertyNames;
+}
+
+namespace
+{
+std::weak_ptr<SvtCompatibilityViewOptions_Impl> theOptions;
+}
+
+SvtCompatibilityViewOptions::SvtCompatibilityViewOptions()
+{
+    // Global access, must be guarded (multithreading!).
+    osl::MutexGuard aGuard(GetOwnStaticMutex());
+
+    m_pImpl = theOptions.lock();
+    if (!m_pImpl)
+    {
+        m_pImpl = std::make_shared<SvtCompatibilityViewOptions_Impl>();
+        theOptions = m_pImpl;
+        ItemHolder1::holdConfigItem(EItem::CompatibilityView);
+    }
+}
+
+SvtCompatibilityViewOptions::~SvtCompatibilityViewOptions()
+{
+    // Global access, must be guarded (multithreading!)
+    osl::MutexGuard aGuard(GetOwnStaticMutex());
+    m_pImpl.reset();
+}
+
+bool SvtCompatibilityViewOptions::HasMSOCompatibleFormsMenu() const
+{
+    return m_pImpl->HasMSOCompatibleFormsMenu();
+}
+
+void SvtCompatibilityViewOptions::SetMSOCompatibleFormsMenu(bool bSet)
+{
+    m_pImpl->SetMSOCompatibleFormsMenu(bSet);
+}
+
+osl::Mutex& SvtCompatibilityViewOptions::GetOwnStaticMutex()
+{
+    static osl::Mutex ourMutex;
+
+    return ourMutex;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index c0444dc9f1ec..70d1880ca6ca 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -27,6 +27,7 @@
 #include <unotools/useroptions.hxx>
 #include <unotools/cmdoptions.hxx>
 #include <unotools/compatibility.hxx>
+#include <unotools/compatibilityviewoptions.hxx>
 #include <unotools/defaultoptions.hxx>
 #include <unotools/dynamicmenuoptions.hxx>
 #include <unotools/eventcfg.hxx>
@@ -130,6 +131,10 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
             rItem.pItem.reset( new SvtCompatibilityOptions() );
             break;
 
+        case EItem::CompatibilityView :
+            rItem.pItem.reset( new SvtCompatibilityViewOptions() );
+            break;
+
         case EItem::DefaultOptions :
             rItem.pItem.reset( new SvtDefaultOptions() );
             break;
commit 74674905b77419620a79671942ecb44d3ba6b2a3
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Feb 15 14:50:34 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Feb 15 14:50:59 2019 +0200

    Fix build without HAVE_FEATURE_AVMEDIA
    
    Change-Id: I65d16c3561fa6fd83aa37cb12ae4fd931d03029f

diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 847bc39a3858..ffe73879d9c9 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -700,9 +700,9 @@ void FuInsertAVMedia::DoExecute( SfxRequest& rReq )
     bool bLink(true);
     if (!(bAPI
 #if HAVE_FEATURE_AVMEDIA
-        || ::avmedia::MediaWindow::executeMediaURLDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, aURL, & bLink))
+        || ::avmedia::MediaWindow::executeMediaURLDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, aURL, & bLink)
 #endif
-       )
+       ))
         return;
 
     Size aPrefSize;
commit e2d2a3386fe85b0fa11fd26c3f7ca4c651eb2818
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Feb 14 09:13:24 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Feb 15 13:48:25 2019 +0100

    loplugin:flatten in sd/source/core
    
    Change-Id: Ide9a83e5baaef24fcbd2b2fa8fb89abdf5f8ce77
    Reviewed-on: https://gerrit.libreoffice.org/67838
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index c9dda0acafad..4bda45524403 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -409,122 +409,122 @@ sal_Int32 CustomAnimationEffect::get_node_type( const Reference< XAnimationNode
 
 void CustomAnimationEffect::setPresetClass( sal_Int16 nPresetClass )
 {
-    if( mnPresetClass != nPresetClass )
+    if( mnPresetClass == nPresetClass )
+        return;
+
+    mnPresetClass = nPresetClass;
+    if( !mxNode.is() )
+        return;
+
+    // first try to find a "preset-class" entry in the user data
+    // and change it
+    Sequence< NamedValue > aUserData( mxNode->getUserData() );
+    sal_Int32 nLength = aUserData.getLength();
+    bool bFound = false;
+    if( nLength )
     {
-        mnPresetClass = nPresetClass;
-        if( mxNode.is() )
+        NamedValue* p = aUserData.getArray();
+        while( nLength-- )
         {
-            // first try to find a "preset-class" entry in the user data
-            // and change it
-            Sequence< NamedValue > aUserData( mxNode->getUserData() );
-            sal_Int32 nLength = aUserData.getLength();
-            bool bFound = false;
-            if( nLength )
+            if ( p->Name == "preset-class" )
             {
-                NamedValue* p = aUserData.getArray();
-                while( nLength-- )
-                {
-                    if ( p->Name == "preset-class" )
-                    {
-                        p->Value <<= mnPresetClass;
-                        bFound = true;
-                        break;
-                    }
-                    p++;
-                }
-            }
-
-            // no "node-type" entry inside user data, so add it
-            if( !bFound )
-            {
-                nLength = aUserData.getLength();
-                aUserData.realloc( nLength + 1);
-                aUserData[nLength].Name = "preset-class";
-                aUserData[nLength].Value <<= mnPresetClass;
+                p->Value <<= mnPresetClass;
+                bFound = true;
+                break;
             }
-
-            mxNode->setUserData( aUserData );
+            p++;
         }
     }
+
+    // no "node-type" entry inside user data, so add it
+    if( !bFound )
+    {
+        nLength = aUserData.getLength();
+        aUserData.realloc( nLength + 1);
+        aUserData[nLength].Name = "preset-class";
+        aUserData[nLength].Value <<= mnPresetClass;
+    }
+
+    mxNode->setUserData( aUserData );
 }
 
 void CustomAnimationEffect::setNodeType( sal_Int16 nNodeType )
 {
-    if( mnNodeType != nNodeType )
+    if( mnNodeType == nNodeType )
+        return;
+
+    mnNodeType = nNodeType;
+    if( !mxNode.is() )
+        return;
+
+    // first try to find a "node-type" entry in the user data
+    // and change it
+    Sequence< NamedValue > aUserData( mxNode->getUserData() );
+    sal_Int32 nLength = aUserData.getLength();
+    bool bFound = false;
+    if( nLength )
     {
-        mnNodeType = nNodeType;
-        if( mxNode.is() )
+        NamedValue* p = aUserData.getArray();
+        while( nLength-- )
         {
-            // first try to find a "node-type" entry in the user data
-            // and change it
-            Sequence< NamedValue > aUserData( mxNode->getUserData() );
-            sal_Int32 nLength = aUserData.getLength();
-            bool bFound = false;
-            if( nLength )
+            if ( p->Name == "node-type" )
             {
-                NamedValue* p = aUserData.getArray();
-                while( nLength-- )
-                {
-                    if ( p->Name == "node-type" )
-                    {
-                        p->Value <<= mnNodeType;
-                        bFound = true;
-                        break;
-                    }
-                    p++;
-                }
-            }
-
-            // no "node-type" entry inside user data, so add it
-            if( !bFound )
-            {
-                nLength = aUserData.getLength();
-                aUserData.realloc( nLength + 1);
-                aUserData[nLength].Name = "node-type";
-                aUserData[nLength].Value <<= mnNodeType;
+                p->Value <<= mnNodeType;
+                bFound = true;
+                break;
             }
-
-            mxNode->setUserData( aUserData );
+            p++;
         }
     }
+
+    // no "node-type" entry inside user data, so add it
+    if( !bFound )
+    {
+        nLength = aUserData.getLength();
+        aUserData.realloc( nLength + 1);
+        aUserData[nLength].Name = "node-type";
+        aUserData[nLength].Value <<= mnNodeType;
+    }
+
+    mxNode->setUserData( aUserData );
 }
 
 void CustomAnimationEffect::setGroupId( sal_Int32 nGroupId )
 {
     mnGroupId = nGroupId;
-    if( mxNode.is() )
+    if( !mxNode.is() )
+        return;
+
+    // first try to find a "group-id" entry in the user data
+    // and change it
+    Sequence< NamedValue > aUserData( mxNode->getUserData() );
+    sal_Int32 nLength = aUserData.getLength();
+    bool bFound = false;
+    if( nLength )
     {
-        // first try to find a "group-id" entry in the user data
-        // and change it
-        Sequence< NamedValue > aUserData( mxNode->getUserData() );
-        sal_Int32 nLength = aUserData.getLength();
-        bool bFound = false;
-        if( nLength )
+        NamedValue* p = aUserData.getArray();
+        while( nLength-- )
         {
-            NamedValue* p = aUserData.getArray();
-            while( nLength-- )
+            if ( p->Name == "group-id" )
             {
-                if ( p->Name == "group-id" )
-                {
-                    p->Value <<= mnGroupId;
-                    bFound = true;
-                    break;
-                }
-                p++;
+                p->Value <<= mnGroupId;
+                bFound = true;
+                break;
             }
+            p++;
         }
+    }
 
-        // no "node-type" entry inside user data, so add it
-        if( !bFound )
-        {
-            nLength = aUserData.getLength();
-            aUserData.realloc( nLength + 1);
-            aUserData[nLength].Name = "group-id";
-            aUserData[nLength].Value <<= mnGroupId;
-        }
-
-        mxNode->setUserData( aUserData );
+    // no "node-type" entry inside user data, so add it
+    if( !bFound )
+    {
+        nLength = aUserData.getLength();
+        aUserData.realloc( nLength + 1);
+        aUserData[nLength].Name = "group-id";
+        aUserData[nLength].Value <<= mnGroupId;
     }
+
+    mxNode->setUserData( aUserData );
 }
 
 /** checks if the text for this effect has changed and updates internal flags.
@@ -717,7 +717,10 @@ void CustomAnimationEffect::setTargetSubItem( sal_Int16 nSubItem )
 
 void CustomAnimationEffect::setDuration( double fDuration )
 {
-    if( (mfDuration != -1.0) && (mfDuration != fDuration) ) try
+    if( !((mfDuration != -1.0) && (mfDuration != fDuration)) )
+        return;
+
+    try
     {
         double fScale = fDuration / mfDuration;
         mfDuration = fDuration;
@@ -974,7 +977,10 @@ Reference< XAnimationNode > CustomAnimationEffect::createAfterEffectNode() const
 
 void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType )
 {
-    if( mnIterateType != nIterateType ) try
+    if( mnIterateType == nIterateType )
+        return;
+
+    try
     {
         // do we need to exchange the container node?
         if( (mnIterateType == 0) || (nIterateType == 0) )
@@ -1063,19 +1069,19 @@ void CustomAnimationEffect::setIterateType( sal_Int16 nIterateType )
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list