| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the LibreOffice project. |
| 4 |
* |
| 5 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 6 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 |
* |
| 9 |
* This file incorporates work covered by the following license notice: |
| 10 |
* |
| 11 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
| 12 |
* contributor license agreements. See the NOTICE file distributed |
| 13 |
* with this work for additional information regarding copyright |
| 14 |
* ownership. The ASF licenses this file to you under the Apache |
| 15 |
* License, Version 2.0 (the "License"); you may not use this file |
| 16 |
* except in compliance with the License. You may obtain a copy of |
| 17 |
* the License at http://www.apache.org/licenses/LICENSE-2.0 . |
| 18 |
*/ |
| 19 |
|
| 20 |
#pragma once |
| 21 |
|
| 22 |
#include <com/sun/star/frame/XModel.hpp> |
| 23 |
#include <com/sun/star/script/XLibraryContainer2.hpp> |
| 24 |
#include <rtl/ustrbuf.hxx> |
| 25 |
#include <xmloff/xmlimp.hxx> |
| 26 |
|
| 27 |
namespace xmloff |
| 28 |
{ |
| 29 |
class BasicElementBase : public SvXMLImportContext |
| 30 |
{ |
| 31 |
protected: |
| 32 |
static bool |
| 33 |
getBoolAttr(bool* pRet, sal_Int32 nToken, |
| 34 |
const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttributes); |
| 35 |
|
| 36 |
public: |
| 37 |
BasicElementBase(SvXMLImport& rImport); |
| 38 |
}; |
| 39 |
|
| 40 |
class BasicLibrariesElement : public BasicElementBase |
| 41 |
{ |
| 42 |
private: |
| 43 |
css::uno::Reference<css::script::XLibraryContainer2> m_xLibContainer; |
| 44 |
|
| 45 |
public: |
| 46 |
BasicLibrariesElement(SvXMLImport& rImport, |
| 47 |
const css::uno::Reference<css::frame::XModel>& rxModel); |
| 48 |
|
| 49 |
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext( |
| 50 |
sal_Int32 Element, |
| 51 |
const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) override; |
| 52 |
}; |
| 53 |
|
| 54 |
class BasicEmbeddedLibraryElement : public BasicElementBase |
| 55 |
{ |
| 56 |
private: |
| 57 |
css::uno::Reference<css::script::XLibraryContainer2> m_xLibContainer; |
| 58 |
css::uno::Reference<css::container::XNameContainer> m_xLib; |
| 59 |
OUString const m_aLibName; |
| 60 |
bool const m_bReadOnly; |
| 61 |
|
| 62 |
public: |
| 63 |
BasicEmbeddedLibraryElement( |
| 64 |
SvXMLImport& rImport, |
| 65 |
const css::uno::Reference<css::script::XLibraryContainer2>& rxLibContainer, |
| 66 |
OUString aLibName, bool bReadOnly); |
| 67 |
|
| 68 |
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext( |
| 69 |
sal_Int32 Element, |
| 70 |
const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) override; |
| 71 |
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
| 72 |
}; |
| 73 |
|
| 74 |
class BasicModuleElement : public BasicElementBase |
| 75 |
{ |
| 76 |
private: |
| 77 |
css::uno::Reference<css::container::XNameContainer> m_xLib; |
| 78 |
OUString const m_aName; |
| 79 |
|
| 80 |
public: |
| 81 |
BasicModuleElement(SvXMLImport& rImport, |
| 82 |
const css::uno::Reference<css::container::XNameContainer>& rxLib, |
| 83 |
OUString aName); |
| 84 |
|
| 85 |
virtual css::uno::Reference<XFastContextHandler> SAL_CALL createFastChildContext( |
| 86 |
sal_Int32 Element, |
| 87 |
const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) override; |
| 88 |
}; |
| 89 |
|
| 90 |
class BasicSourceCodeElement : public BasicElementBase |
| 91 |
{ |
| 92 |
private: |
| 93 |
css::uno::Reference<css::container::XNameContainer> m_xLib; |
| 94 |
OUString const m_aName; |
| 95 |
OUStringBuffer m_aBuffer; |
| 96 |
|
| 97 |
public: |
| 98 |
BasicSourceCodeElement(SvXMLImport& rImport, |
| 99 |
const css::uno::Reference<css::container::XNameContainer>& rxLib, |
| 100 |
OUString rName); |
| 101 |
|
| 102 |
virtual void SAL_CALL characters(const OUString& rChars) override; |
| 103 |
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
| 104 |
}; |
| 105 |
|
| 106 |
} // namespace xmloff |
| 107 |
|
| 108 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |