summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-05-06 14:33:10 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-05-08 22:42:35 +0200
commit36508d0110248f6683757602cd1668547dbfb253 (patch)
tree778f624fa5dbab2da79d9762b3f6895024a76a1a /sw/source
parent4259509aa4f11cbcd63299bd17a4503ebdc22fc0 (diff)
lok: MSForms: Handle event about item selection of a drop-down field.
Change-Id: I095013097348c98361b6614e4ddf1e9029923c7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93659 Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 063af2f70ccd..7c18ed5de296 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -160,6 +160,7 @@
#include <memory>
#include <redline.hxx>
#include <DocumentRedlineManager.hxx>
+#include <xmloff/odffields.hxx>
#define TWIPS_PER_PIXEL 15
@@ -3374,6 +3375,41 @@ OUString SwXTextDocument::getPostIts()
return OUString::fromUtf8(aStream.str().c_str());
}
+void SwXTextDocument::executeFromFieldEvent(const StringMap& aArguments)
+{
+ auto aIter = aArguments.find("type");
+ if (aIter != aArguments.end() && aIter->second == "drop-down")
+ {
+ aIter = aArguments.find("cmd");
+ if (aIter != aArguments.end() && aIter->second == "selected")
+ {
+ aIter = aArguments.find("data");
+ if (aIter != aArguments.end())
+ {
+ sal_Int32 nSelection = aIter->second.toInt32();
+ SwPosition aPos(*pDocShell->GetWrtShell()->GetCursor()->GetPoint());
+ sw::mark::IFieldmark* pFieldBM = pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ if ( !pFieldBM )
+ {
+ --aPos.nContent;
+ pFieldBM = pDocShell->GetWrtShell()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+ if (pFieldBM && pFieldBM->GetFieldname() == ODF_FORMDROPDOWN)
+ {
+ if (nSelection >= 0)
+ {
+ OUString sKey = ODF_FORMDROPDOWN_RESULT;
+ (*pFieldBM->GetParameters())[sKey] <<= nSelection;
+ pFieldBM->Invalidate();
+ pDocShell->GetWrtShell()->SetModified();
+ pDocShell->GetView()->GetEditWin().LogicInvalidate(nullptr);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
int SwXTextDocument::getPart()
{
SolarMutexGuard aGuard;