Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / xmloff / source / forms / property_description.hxx
blobd16e3b045294c5fd85e01eb6a27cb53886827274
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_DESCRIPTION_HXX
21 #define INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_DESCRIPTION_HXX
23 #include "forms/property_handler.hxx"
24 #include "property_group.hxx"
26 #include <xmloff/xmltoken.hxx>
28 #include <vector>
29 #include <list>
31 namespace xmloff
34 //= PropertyDescription
35 struct AttributeDescription
37 sal_uInt16 namespacePrefix; // usually XML_NAMESPACE_FORM
38 ::xmloff::token::XMLTokenEnum attributeToken;
40 AttributeDescription()
41 :namespacePrefix( 0 )
42 ,attributeToken( ::xmloff::token::XML_TOKEN_INVALID )
46 AttributeDescription(
47 const sal_uInt16 i_namespacePrefix,
48 const ::xmloff::token::XMLTokenEnum i_attributeToken
50 :namespacePrefix( i_namespacePrefix )
51 ,attributeToken( i_attributeToken )
56 inline bool operator==( const AttributeDescription& i_lhs, const AttributeDescription& i_rhs )
58 return ( i_lhs.namespacePrefix == i_rhs.namespacePrefix )
59 && ( i_lhs.attributeToken == i_rhs.attributeToken );
62 //= PropertyDescription
63 struct PropertyDescription
65 /// is the name of the property
66 const OUString propertyName;
67 /** denotes the attribute which represents the property. Note that multiple properties might comprise a single
68 attribute value.
70 const AttributeDescription attribute;
71 /// is the factory for creating a handler for reading and writing the property
72 const PropertyHandlerFactory factory;
73 /// the unique ID of the property. The property meta data table must not contain two entries with the same property ID
74 const PropertyId propertyId;
75 /** the group which the property belongs to. Multiple properties belonging to the same group will, all together,
76 define the attribute value to be written into the ODF file.
78 Consequently, properties which have the same |propertyGroup| value must also have the same |attribute|
79 and the same |factory| value, with the only exception being NO_GROUP properties.
81 Note that the other direction is not given: It is perfectly legitimate to map the same attribute to different
82 (disjunct) property groups.
84 const PropertyGroup propertyGroup;
86 PropertyDescription()
87 :propertyName()
88 ,attribute()
89 ,factory( nullptr )
90 ,propertyId( PID_INVALID )
91 ,propertyGroup( NO_GROUP )
95 PropertyDescription(
96 const OUString& i_propertyName,
97 const sal_uInt16 i_namespacePrefix,
98 const ::xmloff::token::XMLTokenEnum i_attributeToken,
99 const PropertyHandlerFactory i_factory,
100 const PropertyId i_propertyId,
101 const PropertyGroup i_propertyGroup
103 :propertyName( i_propertyName )
104 ,attribute( i_namespacePrefix, i_attributeToken )
105 ,factory( i_factory )
106 ,propertyId( i_propertyId )
107 ,propertyGroup( i_propertyGroup )
112 //= PropertyDescriptionList
113 typedef ::std::vector< const PropertyDescription* > PropertyDescriptionList;
115 //= PropertyGroups
116 typedef ::std::list< PropertyDescriptionList > PropertyGroups;
118 } // namespace xmloff
120 #endif // INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_DESCRIPTION_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */