[Libreoffice-commits] core.git: include/xmloff officecfg/registry sw/inc sw/sdi sw/source sw/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Feb 16 16:17:33 UTC 2019
include/xmloff/odffields.hxx | 1
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 29 +++++
sw/inc/cmdid.h | 6 +
sw/sdi/_textsh.sdi | 18 +++
sw/sdi/swriter.sdi | 53 ++++++++++
sw/source/core/doc/docbm.cxx | 6 +
sw/source/uibase/shells/textfld.cxx | 45 ++++++++
sw/uiconfig/swriter/menubar/mscompatibleformsmenu.xml | 7 +
8 files changed, 165 insertions(+)
New commits:
commit 5a94be3e677e4b7ccb2990a3a79fbf2219322f80
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Feb 15 18:39:46 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Feb 16 17:17:11 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
fields 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
Reviewed-on: https://gerrit.libreoffice.org/67907
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
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>
More information about the Libreoffice-commits
mailing list