merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / scripting / source / storage / XMLElement.hxx
blobaae705d9b2eaab97eb3aedf34870b4026e8a1f67
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _SCRIPTING_XML_ELEMENT_HXX_
29 #define _SCRIPTING_XML_ELEMENT_HXX_
31 #include <vector>
33 #include <cppuhelper/implbase1.hxx>
35 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
37 namespace scripting_impl
39 // for simplification
40 #define css ::com::sun::star
41 #define dcsssf ::drafts::com::sun::star::script::framework
43 /*##################################################################################################
45 EXPORTING
47 ##################################################################################################*/
49 //==================================================================================================
50 class XMLElement : public ::cppu::WeakImplHelper1< css::xml::sax::XAttributeList >
52 public:
53 inline XMLElement( ::rtl::OUString const & name, ::rtl::OUString const & chars )
54 SAL_THROW( () )
55 : _name( name ), _chars( chars )
59 inline XMLElement( ::rtl::OUString const & name )
60 SAL_THROW( () )
61 : _name( name )
65 /** Adds a sub element of element.
67 @param xElem element reference
69 void SAL_CALL addSubElement(
70 css::uno::Reference< css::xml::sax::XAttributeList > const & xElem )
71 SAL_THROW( () );
73 /** Gets sub element of given index. The index follows order in which sub elements were added.
75 @param nIndex index of sub element
77 css::uno::Reference< css::xml::sax::XAttributeList > SAL_CALL getSubElement(
78 sal_Int32 nIndex )
79 SAL_THROW( () );
81 /** Adds an attribute to elements.
83 @param rAttrName qname of attribute
84 @param rValue value string of element
86 void SAL_CALL addAttribute( ::rtl::OUString const & rAttrName,
87 ::rtl::OUString const & rValue )
88 SAL_THROW( () );
90 /** Gets the tag name (qname) of element.
92 @return
93 qname of element
95 inline ::rtl::OUString SAL_CALL getName() SAL_THROW( () )
97 return _name;
100 /** Dumps out element (and all sub elements).
102 @param xOut document handler to be written to
104 void SAL_CALL dump(
105 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
106 /** Dumps out sub elements (and all further sub elements).
108 @param xOut document handler to be written to
110 void SAL_CALL dumpSubElements(
111 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
113 // XAttributeList
114 virtual sal_Int16 SAL_CALL getLength()
115 throw ( css::uno::RuntimeException );
116 virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
117 throw ( css::uno::RuntimeException );
118 virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
119 throw ( css::uno::RuntimeException );
120 virtual ::rtl::OUString SAL_CALL getTypeByName( ::rtl::OUString const & rName )
121 throw ( css::uno::RuntimeException );
122 virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
123 throw ( css::uno::RuntimeException );
124 virtual ::rtl::OUString SAL_CALL getValueByName( ::rtl::OUString const & rName )
125 throw ( css::uno::RuntimeException );
127 protected:
128 ::rtl::OUString _name;
130 ::rtl::OUString _chars;
132 ::std::vector< ::rtl::OUString > _attrNames;
133 ::std::vector< ::rtl::OUString > _attrValues;
135 ::std::vector< css::uno::Reference<
136 css::xml::sax::XAttributeList > > _subElems;
141 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */