summaryrefslogtreecommitdiff
path: root/desktop/source/lib
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-11-29 16:18:16 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-11-30 08:13:28 +0100
commit5e8f6dcb8ce00d2d5e35b3cf5654187b3068276c (patch)
tree0d81eed04980c244163f064db63269f30dc077d3 /desktop/source/lib
parent1d9221ebc86f2696a65c12287ea19eea44d680cf (diff)
sw lok, .uno:SetDocumentProperties: expose value of custom document properties
LOK API clients currently have no knowledge about document properties. Clients like Zotero that want to store custom properties on documents need a way to read and write such properties. This commit focuses on the reading side. Add a getter for .uno:SetDocumentProperties that allows filtering for a certain prefix, this way the returned value can contain only the relevant information. Rework doc_getCommandValues() and SwXTextDocument::getCommandValues() a bit, so adding new getters require less duplication. Change-Id: I0c52cd2efcc8b1ea7307763c8252dd1e8ffdea2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143468 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'desktop/source/lib')
-rw-r--r--desktop/source/lib/init.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 15371581c818..734f76f76362 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5702,7 +5702,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
static constexpr OStringLiteral aSheetGeometryData(".uno:SheetGeometryData");
static constexpr OStringLiteral aCellCursor(".uno:CellCursor");
static constexpr OStringLiteral aFontSubset(".uno:FontSubset&name=");
- static constexpr OStringLiteral aTextFormFields(".uno:TextFormFields");
+ static const std::initializer_list<std::u16string_view> vForward = {
+ u"TextFormFields",
+ u"SetDocumentProperties"
+ };
if (!strcmp(pCommand, ".uno:LanguageStatus"))
{
@@ -5879,7 +5882,9 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
{
return getFontSubset(aCommand.substr(aFontSubset.getLength()));
}
- else if (o3tl::starts_with(aCommand, aTextFormFields))
+ else if (std::find(vForward.begin(), vForward.end(),
+ INetURLObject(OUString::fromUtf8(aCommand)).GetURLPath())
+ != vForward.end())
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)