26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
28 #include <com/sun/star/document/XEmbeddedScripts.hpp>
29 #include <com/sun/star/xml/sax/SAXException.hpp>
49 const Reference<XFastAttributeList>& xAttributes)
51 OUString aValue = xAttributes->getOptionalValue(nToken);
52 if (!aValue.isEmpty())
59 else if (aValue ==
"false")
67 +
": no boolean value (true|false)!",
68 Reference<XInterface>(),
Any());
77 const css::uno::Reference<css::frame::XModel>& rxModel)
81 Reference<document::XEmbeddedScripts> xDocumentScripts(rxModel, UNO_QUERY_THROW);
93 "BasicImport::startRootElement: nowhere to import to!");
97 throw xml::sax::SAXException(
"nowhere to import to", Reference<XInterface>(),
Any());
103 Reference<XFastContextHandler>
105 const Reference<XFastAttributeList>& xAttributes)
109 throw xml::sax::SAXException(
"illegal namespace!", Reference<XInterface>(),
Any());
129 catch (
const container::ElementExistException&)
132 "BasicLibrariesElement::startChildElement");
134 catch (
const lang::IllegalArgumentException&)
137 "BasicLibrariesElement::startChildElement");
169 catch (
const lang::IllegalArgumentException&)
172 "BasicLibrariesElement::startChildElement");
178 throw xml::sax::SAXException(
"expected library-linked or library-embedded element!",
179 Reference<XInterface>(),
Any());
188 SvXMLImport& rImport,
const Reference<script::XLibraryContainer2>& rxLibContainer,
189 const OUString& rLibName,
bool bReadOnly)
191 , m_xLibContainer(rxLibContainer)
192 , m_aLibName(rLibName)
200 catch (
const lang::WrappedTargetException&)
207 sal_Int32 nElement,
const Reference<XFastAttributeList>& xAttributes)
211 throw xml::sax::SAXException(
"illegal namespace!", Reference<XInterface>(),
Any());
217 if (
m_xLib.is() && !aName.isEmpty())
222 throw xml::sax::SAXException(
"expected module element!", Reference<XInterface>(),
Any());
238 const OUString& rName)
245 Reference<XFastContextHandler>
247 const Reference<XFastAttributeList>& xAttributes)
253 throw xml::sax::SAXException(
"illegal namespace!", Reference<XInterface>(),
Any());
259 if (xAttributes.is())
267 throw xml::sax::SAXException(
"expected source-code element!", Reference<XInterface>(),
278 const OUString& rName)
296 aElement <<=
m_aBuffer.makeStringAndClear();
300 catch (
const container::ElementExistException&)
304 catch (
const lang::IllegalArgumentException&)
308 catch (
const lang::WrappedTargetException&)
BasicLibrariesElement(SvXMLImport &rImport, const css::uno::Reference< css::frame::XModel > &rxModel)
css::uno::Reference< css::script::XLibraryContainer2 > m_xLibContainer
SvXMLImport & GetImport()
constexpr sal_uInt16 XML_NAMESPACE_OOO
css::uno::Reference< css::container::XNameContainer > m_xLib
static bool getBoolAttr(bool *pRet, sal_Int32 nToken, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttributes)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
css::uno::Reference< css::container::XNameContainer > m_xLib
OUString const m_aLibName
BasicEmbeddedLibraryElement(SvXMLImport &rImport, const css::uno::Reference< css::script::XLibraryContainer2 > &rxLibContainer, const OUString &rLibName, bool bReadOnly)
BasicElementBase(SvXMLImport &rImport)
css::uno::Reference< css::script::XLibraryContainer2 > m_xLibContainer
css::uno::Reference< css::container::XNameContainer > m_xLib
static const OUString & getNameFromToken(sal_Int32 nToken)
This class deliberately does not support XWeak, to improve performance when loading large documents...
#define TOOLS_INFO_EXCEPTION(area, stream)
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
#define SAL_WARN_IF(condition, area, stream)
Handling of tokens in XML:
#define XML_ELEMENT(prefix, name)
constexpr sal_Int32 NAMESPACE_TOKEN(sal_uInt16 prefixToken)
BasicSourceCodeElement(SvXMLImport &rImport, const css::uno::Reference< css::container::XNameContainer > &rxLib, const OUString &rName)
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
constexpr sal_Int32 TOKEN_MASK
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
BasicModuleElement(SvXMLImport &rImport, const css::uno::Reference< css::container::XNameContainer > &rxLib, const OUString &rName)
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override