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 _XMLSCRIPT_XML_HELPER_HXX_
20 #define _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 ##################################################################################################*/
40 //==================================================================================================
41 class XMLSCRIPT_DLLPUBLIC XMLElement
42 : public ::cppu::WeakImplHelper1
< ::com::sun::star::xml::sax::XAttributeList
>
45 inline XMLElement( OUString
const & name
)
50 /** Adds a sub element of element.
52 @param xElem element reference
54 void SAL_CALL
addSubElement(
55 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> const & xElem
)
58 /** Gets sub element of given index. The index follows order in which sub elements were added.
60 @param nIndex index of sub element
62 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> SAL_CALL
getSubElement( sal_Int32 nIndex
)
65 /** Adds an attribute to elements.
67 @param rAttrName qname of attribute
68 @param rValue value string of element
70 void SAL_CALL
addAttribute( OUString
const & rAttrName
, OUString
const & rValue
)
73 /** Gets the tag name (qname) of element.
78 inline OUString SAL_CALL
getName() SAL_THROW(())
81 /** Dumps out element (and all sub elements).
83 @param xOut document handler to be written to
86 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> const & xOut
);
87 /** Dumps out sub elements (and all further sub elements).
89 @param xOut document handler to be written to
91 void SAL_CALL
dumpSubElements(
92 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> const & xOut
);
95 virtual sal_Int16 SAL_CALL
getLength()
96 throw (::com::sun::star::uno::RuntimeException
);
97 virtual OUString SAL_CALL
getNameByIndex( sal_Int16 nPos
)
98 throw (::com::sun::star::uno::RuntimeException
);
99 virtual OUString SAL_CALL
getTypeByIndex( sal_Int16 nPos
)
100 throw (::com::sun::star::uno::RuntimeException
);
101 virtual OUString SAL_CALL
getTypeByName( OUString
const & rName
)
102 throw (::com::sun::star::uno::RuntimeException
);
103 virtual OUString SAL_CALL
getValueByIndex( sal_Int16 nPos
)
104 throw (::com::sun::star::uno::RuntimeException
);
105 virtual OUString SAL_CALL
getValueByName( OUString
const & rName
)
106 throw (::com::sun::star::uno::RuntimeException
);
111 ::std::vector
< OUString
> _attrNames
;
112 ::std::vector
< OUString
> _attrValues
;
114 ::std::vector
< ::com::sun::star::uno::Reference
<
115 ::com::sun::star::xml::sax::XAttributeList
> > _subElems
;
119 /*##################################################################################################
123 ##################################################################################################*/
125 XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>
126 SAL_CALL
createInputStream(
127 ::rtl::ByteSequence
const & rInData
)
130 XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>
131 SAL_CALL
createOutputStream(
132 ::rtl::ByteSequence
* pOutData
)
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */