/src/libreoffice/xmloff/source/forms/property_description.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <forms/property_handler.hxx> |
23 | | #include <utility> |
24 | | #include <xmloff/xmltoken.hxx> |
25 | | |
26 | | #include <vector> |
27 | | |
28 | | namespace xmloff |
29 | | { |
30 | | |
31 | | //= PropertyDescription |
32 | | struct AttributeDescription |
33 | | { |
34 | | sal_uInt16 namespacePrefix; // usually XML_NAMESPACE_FORM |
35 | | ::xmloff::token::XMLTokenEnum attributeToken; |
36 | | |
37 | | AttributeDescription() |
38 | 0 | :namespacePrefix( 0 ) |
39 | 0 | ,attributeToken( ::xmloff::token::XML_TOKEN_INVALID ) |
40 | 0 | { |
41 | 0 | } |
42 | | |
43 | | AttributeDescription( |
44 | | const sal_uInt16 i_namespacePrefix, |
45 | | const ::xmloff::token::XMLTokenEnum i_attributeToken |
46 | | ) |
47 | 0 | :namespacePrefix( i_namespacePrefix ) |
48 | 0 | ,attributeToken( i_attributeToken ) |
49 | 0 | { |
50 | 0 | } |
51 | | }; |
52 | | |
53 | | inline bool operator==( const AttributeDescription& i_lhs, const AttributeDescription& i_rhs ) |
54 | 0 | { |
55 | 0 | return ( i_lhs.namespacePrefix == i_rhs.namespacePrefix ) |
56 | 0 | && ( i_lhs.attributeToken == i_rhs.attributeToken ); |
57 | 0 | } |
58 | | |
59 | | //= PropertyDescription |
60 | | struct PropertyDescription |
61 | | { |
62 | | /// is the name of the property |
63 | | const OUString propertyName; |
64 | | /** denotes the attribute which represents the property. Note that multiple properties might comprise a single |
65 | | attribute value. |
66 | | */ |
67 | | /// is the factory for creating a handler for reading and writing the property |
68 | | const PropertyHandlerFactory factory; |
69 | | /// the unique ID of the property. The property meta data table must not contain two entries with the same property ID |
70 | | const PropertyId propertyId; |
71 | | const AttributeDescription attribute; |
72 | | |
73 | | PropertyDescription() |
74 | 0 | :propertyName() |
75 | 0 | ,factory( nullptr ) |
76 | 0 | ,propertyId( PID_INVALID ) |
77 | 0 | ,attribute() |
78 | 0 | { |
79 | 0 | } |
80 | | |
81 | | PropertyDescription( |
82 | | OUString i_propertyName, |
83 | | const sal_uInt16 i_namespacePrefix, |
84 | | const ::xmloff::token::XMLTokenEnum i_attributeToken, |
85 | | const PropertyHandlerFactory i_factory, |
86 | | const PropertyId i_propertyId |
87 | | ) |
88 | 0 | :propertyName(std::move( i_propertyName )) |
89 | 0 | ,factory( i_factory ) |
90 | 0 | ,propertyId( i_propertyId ) |
91 | 0 | ,attribute( i_namespacePrefix, i_attributeToken ) |
92 | 0 | { |
93 | 0 | } |
94 | | }; |
95 | | |
96 | | //= PropertyDescriptionList |
97 | | typedef ::std::vector< const PropertyDescription* > PropertyDescriptionList; |
98 | | |
99 | | //= PropertyGroups |
100 | | typedef ::std::vector< PropertyDescriptionList > PropertyGroups; |
101 | | |
102 | | } // namespace xmloff |
103 | | |
104 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |