merge the formfield patch from ooo-build
[ooovba.git] / scripting / source / storage / XMLElement.hxx
blob375912c2f6cac646537210a1df99e6ef788fa28b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLElement.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SCRIPTING_XML_ELEMENT_HXX_
31 #define _SCRIPTING_XML_ELEMENT_HXX_
33 #include <vector>
35 #include <cppuhelper/implbase1.hxx>
37 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
39 namespace scripting_impl
41 // for simplification
42 #define css ::com::sun::star
43 #define dcsssf ::drafts::com::sun::star::script::framework
45 /*##################################################################################################
47 EXPORTING
49 ##################################################################################################*/
51 //==================================================================================================
52 class XMLElement : public ::cppu::WeakImplHelper1< css::xml::sax::XAttributeList >
54 public:
55 inline XMLElement( ::rtl::OUString const & name, ::rtl::OUString const & chars )
56 SAL_THROW( () )
57 : _name( name ), _chars( chars )
61 inline XMLElement( ::rtl::OUString const & name )
62 SAL_THROW( () )
63 : _name( name )
67 /** Adds a sub element of element.
69 @param xElem element reference
71 void SAL_CALL addSubElement(
72 css::uno::Reference< css::xml::sax::XAttributeList > const & xElem )
73 SAL_THROW( () );
75 /** Gets sub element of given index. The index follows order in which sub elements were added.
77 @param nIndex index of sub element
79 css::uno::Reference< css::xml::sax::XAttributeList > SAL_CALL getSubElement(
80 sal_Int32 nIndex )
81 SAL_THROW( () );
83 /** Adds an attribute to elements.
85 @param rAttrName qname of attribute
86 @param rValue value string of element
88 void SAL_CALL addAttribute( ::rtl::OUString const & rAttrName,
89 ::rtl::OUString const & rValue )
90 SAL_THROW( () );
92 /** Gets the tag name (qname) of element.
94 @return
95 qname of element
97 inline ::rtl::OUString SAL_CALL getName() SAL_THROW( () )
99 return _name;
102 /** Dumps out element (and all sub elements).
104 @param xOut document handler to be written to
106 void SAL_CALL dump(
107 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
108 /** Dumps out sub elements (and all further sub elements).
110 @param xOut document handler to be written to
112 void SAL_CALL dumpSubElements(
113 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
115 // XAttributeList
116 virtual sal_Int16 SAL_CALL getLength()
117 throw ( css::uno::RuntimeException );
118 virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
119 throw ( css::uno::RuntimeException );
120 virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
121 throw ( css::uno::RuntimeException );
122 virtual ::rtl::OUString SAL_CALL getTypeByName( ::rtl::OUString const & rName )
123 throw ( css::uno::RuntimeException );
124 virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
125 throw ( css::uno::RuntimeException );
126 virtual ::rtl::OUString SAL_CALL getValueByName( ::rtl::OUString const & rName )
127 throw ( css::uno::RuntimeException );
129 protected:
130 ::rtl::OUString _name;
132 ::rtl::OUString _chars;
134 ::std::vector< ::rtl::OUString > _attrNames;
135 ::std::vector< ::rtl::OUString > _attrValues;
137 ::std::vector< css::uno::Reference<
138 css::xml::sax::XAttributeList > > _subElems;
143 #endif