23#include <com/sun/star/uri/UriReferenceFactory.hpp>
24#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
27#include <osl/diagnose.h>
39 return std::make_unique<SwMacroFieldType>(
m_rDoc);
43 OUString aLibAndName, OUString aText) :
44 SwField(pInitType), m_aMacro(
std::move(aLibAndName)), m_aText(
std::move(aText)), m_bIsScriptURL(false)
76 for (sal_Int32
i = 0; i < 3 && nPos > 0;
i++)
82 OSL_FAIL(
"No LibName");
98 for (sal_Int32
i = 0; i < 3 && nPos > 0;
i++)
105 OSL_FAIL(
"No MacroName");
198 std::u16string_view rMacroName,
199 const OUString& rLibraryName )
202 rMacro = rLibraryName;
203 if ( !rLibraryName.isEmpty() && !rMacroName.empty() )
205 rMacro += rMacroName;
212 uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
213 uno::Reference<uri::XUriReferenceFactory>
xFactory = uri::UriReferenceFactory::create(xContext);
214 uno::Reference<uri::XVndSunStarScriptUrl> xUrl(
xFactory->parse(str), uno::UNO_QUERY);
Instances of SwFields and those derived from it occur 0 to n times.
virtual OUString GetName() const
Only in derived classes.
Base class of all fields.
SwFieldType * GetTyp() const
SwMacroFieldType(SwDoc &)
virtual std::unique_ptr< SwFieldType > Copy() const override
OUString GetMacroName() const
SvxMacro GetSvxMacro() const
virtual OUString GetPar2() const override
Macrotext.
virtual std::unique_ptr< SwField > Copy() const override
virtual OUString GetPar1() const override
Library and FileName.
static bool isScriptURL(const OUString &str)
virtual void SetPar1(const OUString &rStr) override
LibName and MacroName.
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt16 nWhich) override
virtual OUString GetFieldName() const override
get name or content
OUString GetLibName() const
static void CreateMacroString(OUString &rMacro, std::u16string_view rMacroName, const OUString &rLibraryName)
create an internally used macro name from the library and macro name parts
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt16 nWhich) const override
virtual void SetPar2(const OUString &rStr) override
set macro text
SwMacroField(SwMacroFieldType *, OUString aLibAndName, OUString aText)
Direct input, delete old value.
virtual OUString ExpandImpl(SwRootFrame const *pLayout) const override
The root element of a Writer document layout.
Reference< XSingleServiceFactory > xFactory