1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_XMLSCRIPT_XML_HELPER_HXX
20 #define INCLUDED_XMLSCRIPT_XML_HELPER_HXX
23 #include <rtl/byteseq.hxx>
24 #include <cppuhelper/implbase1.hxx>
25 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
26 #include <com/sun/star/io/XInputStream.hpp>
27 #include <com/sun/star/io/XOutputStream.hpp>
29 #include <xmlscript/xmlscriptdllapi.h>
34 /*##################################################################################################
38 ##################################################################################################*/
41 class XMLSCRIPT_DLLPUBLIC XMLElement
42 : public ::cppu::WeakImplHelper1
< ::com::sun::star::xml::sax::XAttributeList
>
45 inline XMLElement( OUString
const & name
)
49 /** Adds a sub element of element.
51 @param xElem element reference
53 void SAL_CALL
addSubElement(
54 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> const & xElem
);
56 /** Gets sub element of given index. The index follows order in which sub elements were added.
58 @param nIndex index of sub element
60 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> SAL_CALL
getSubElement( sal_Int32 nIndex
);
62 /** Adds an attribute to elements.
64 @param rAttrName qname of attribute
65 @param rValue value string of element
67 void SAL_CALL
addAttribute( OUString
const & rAttrName
, OUString
const & rValue
);
69 /** Gets the tag name (qname) of element.
74 inline OUString SAL_CALL
getName()
77 /** Dumps out element (and all sub elements).
79 @param xOut document handler to be written to
82 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> const & xOut
);
83 /** Dumps out sub elements (and all further sub elements).
85 @param xOut document handler to be written to
87 void SAL_CALL
dumpSubElements(
88 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> const & xOut
);
91 virtual sal_Int16 SAL_CALL
getLength()
92 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual OUString SAL_CALL
getNameByIndex( sal_Int16 nPos
)
94 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual OUString SAL_CALL
getTypeByIndex( sal_Int16 nPos
)
96 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual OUString SAL_CALL
getTypeByName( OUString
const & rName
)
98 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual OUString SAL_CALL
getValueByIndex( sal_Int16 nPos
)
100 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual OUString SAL_CALL
getValueByName( OUString
const & rName
)
102 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 ::std::vector
< OUString
> _attrNames
;
108 ::std::vector
< OUString
> _attrValues
;
110 ::std::vector
< ::com::sun::star::uno::Reference
<
111 ::com::sun::star::xml::sax::XAttributeList
> > _subElems
;
115 /*##################################################################################################
119 ##################################################################################################*/
121 XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>
122 SAL_CALL
createInputStream(
123 ::rtl::ByteSequence
const & rInData
);
125 XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>
126 SAL_CALL
createOutputStream(
127 ::rtl::ByteSequence
* pOutData
);
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */