merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / xml / elementformatter.hxx
blob930aaaeb1c5dc499758a6babb6364458c0fcbad3
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: elementformatter.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 ************************************************************************/
31 #ifndef CONFIGMGR_XML_ELEMENTFORMATTER_HXX
32 #define CONFIGMGR_XML_ELEMENTFORMATTER_HXX
34 #include "elementinfo.hxx"
35 #include <com/sun/star/xml/sax/XAttributeList.hpp>
37 #include <rtl/ref.hxx>
39 namespace comphelper {
40 class AttributeList;
43 namespace configmgr
45 // -----------------------------------------------------------------------------
46 namespace xml
48 // -----------------------------------------------------------------------------
49 namespace uno = ::com::sun::star::uno;
50 namespace sax = ::com::sun::star::xml::sax;
52 // -----------------------------------------------------------------------------
53 class ElementFormatter
55 public:
56 ElementFormatter();
57 ~ElementFormatter();
59 /// reset the formatter for a new document
60 void reset();
62 /// resets the formatter for a new element type
63 void prepareElement(ElementInfo const& _aInfo);
65 /// resets the formatter for a new element type
66 void prepareSimpleElement(ElementType::Enum _eType);
68 /// sets the instantiated type of a set item,
69 void addInstanceType(rtl::OUString const & _aElementType, rtl::OUString const & _aElementTypeModule);
71 /// retrieve element type and associated module name of a set,
72 void addPropertyValueType(uno::Type const& _aType);
74 /// add a language for the current element
75 void addLanguage(rtl::OUString const & _sLanguage);
77 /// adds a value attribute to the attribute list
78 void addIsNull(bool _bIsNull = true);
80 /// adds a value attribute to the attribute list
81 void addSeparator(rtl::OUString const& _sSeparator);
83 /// retrieve the tag to use for the current element
84 rtl::OUString getElementTag() const;
86 /// retrieve the attributes to use for the current element
87 uno::Reference< sax::XAttributeList > getElementAttributes() const;
89 /// retrieve the attributes to use for an element with associated component
90 private:
91 void addNamespaces();
92 /// sets an attributes for a node
93 void addName(rtl::OUString const & _aName);
94 /// sets attributes for nodes from the flags
95 void addNodeFlags(sal_Int16 _eFlags);
96 /// sets attributes for nodes from the flags
97 void addOperation(Operation::Enum _eOp);
98 /// sets attributes for nodes from the flags
99 void maybeAddFlag(sal_Int16 _eFlags, sal_Int16 _eSelect,
100 rtl::OUString const & _anAttributeName, bool _bValue = true);
102 /// sets attributes for nodes
103 void addAttribute(rtl::OUString const & _anAttributeName, rtl::OUString const & _aValue);
104 void addAttribute(rtl::OUString const & _anAttributeName, bool _bValue);
106 private:
107 ElementType::Enum m_aElementType;
108 rtl::Reference< ::comphelper::AttributeList> m_xAttributes;
110 // -----------------------------------------------------------------------------
112 // -----------------------------------------------------------------------------
113 } // namespace xml
114 // -----------------------------------------------------------------------------
115 } // namespace configmgr
117 #endif