Files
Neil Roberts be90e52d93 singleprov: Implement the “Creatable” action
This makes the create button enabled for script providers based on
SingleScriptProvider. When the button is pressed the SingleScriptFactory
is queried to get an example script to fill the new macro with and then
the file is created.

This is based on the code for the Python script provider in tdf#56289.

Change-Id: I11a6782e55ba775afed6b62f24ae0d11c347e529
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203283
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
2026-04-30 10:38:18 +02:00

47 lines
1.7 KiB
C++

/* -*- 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/.
*/
#pragma once
#include "scriptbrowser.hxx"
namespace singleprovider
{
class ScriptDir : public ScriptBrowser
{
public:
ScriptDir(const std::shared_ptr<ProviderContext>& pProviderContext);
ScriptDir(const std::shared_ptr<ProviderContext>& pProviderContext, const OUString& sName,
const OUString& sBaseUri);
// XBrowseNode
css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>>
SAL_CALL getChildNodes() override;
sal_Bool SAL_CALL hasChildNodes() override;
sal_Int16 SAL_CALL getType() override;
// XPropertySet
css::uno::Any SAL_CALL getPropertyValue(const OUString& sPropertyName) override;
// XInvocation
css::uno::Any SAL_CALL invoke(const OUString& sFunctionName,
const css::uno::Sequence<css::uno::Any>& aParams,
css::uno::Sequence<sal_Int16>& aOutParamIndex,
css::uno::Sequence<css::uno::Any>& aOutParam) override;
sal_Bool SAL_CALL hasMethod(const OUString& sFunctionName) override;
private:
css::uno::Reference<css::script::browse::XBrowseNode> createMacro(const OUString& sMacroName);
OUString nameFromUrl(const OUString& sUrl);
};
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */