1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef INCLUDED_DMAPPER_PROPERTYIDS_HXX
24 #define INCLUDED_DMAPPER_PROPERTYIDS_HXX
25 
26 #include <hash_map>
27 #include <boost/shared_ptr.hpp>
28 #include <com/sun/star/uno/Sequence.hxx>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 
31 namespace rtl{ class OUString;}
32 
33 namespace writerfilter {
34 namespace dmapper{
35 
36 using namespace ::com::sun::star;
37 
38 enum PropertyIds
39     {
40         PROP_ID_START = 1
41         ,META_PROP_CELL_MAR_BOTTOM = PROP_ID_START
42         ,META_PROP_CELL_MAR_LEFT
43         ,META_PROP_CELL_MAR_RIGHT
44         ,META_PROP_CELL_MAR_TOP
45         ,META_PROP_HORIZONTAL_BORDER
46         ,META_PROP_TABLE_STYLE_NAME
47         ,META_PROP_VERTICAL_BORDER
48         ,PROP_ADD_EXTERNAL_LEADING
49         ,PROP_ADD_PARA_TABLE_SPACING
50         ,PROP_ADJUST
51         ,PROP_ADJUST_CONTRAST
52         ,PROP_ADJUST_LUMINANCE
53         ,PROP_ALTERNATIVE_TEXT
54         ,PROP_ANCHOR_TYPE
55         ,PROP_AUTOMATIC_DISTANCE
56         ,PROP_BACK_COLOR
57         ,PROP_BITMAP
58         ,PROP_BOTTOM_BORDER
59         ,PROP_BOTTOM_BORDER_DISTANCE
60         ,PROP_BOTTOM_MARGIN
61         ,PROP_BREAK_TYPE
62         ,PROP_BULLET_CHAR
63         ,PROP_BULLET_FONT_NAME
64         ,PROP_CHAPTER_FORMAT
65         ,PROP_CHARACTER_STYLES
66         ,PROP_CHAR_AUTO_KERNING
67         ,PROP_CHAR_BACK_COLOR
68         ,PROP_CHAR_CASE_MAP
69         ,PROP_CHAR_CHAR_KERNING
70         ,PROP_CHAR_COLOR
71         ,PROP_CHAR_COMBINE_IS_ON
72         ,PROP_CHAR_COMBINE_PREFIX
73         ,PROP_CHAR_COMBINE_SUFFIX
74         ,PROP_CHAR_CONTOURED
75         ,PROP_CHAR_EMPHASIS
76         ,PROP_CHAR_ESCAPEMENT
77         ,PROP_CHAR_ESCAPEMENT_HEIGHT
78         ,PROP_CHAR_FLASH
79         ,PROP_CHAR_FONT_CHAR_SET
80         ,PROP_CHAR_FONT_CHAR_SET_ASIAN
81         ,PROP_CHAR_FONT_CHAR_SET_COMPLEX
82         ,PROP_CHAR_FONT_FAMILY
83         ,PROP_CHAR_FONT_FAMILY_ASIAN
84         ,PROP_CHAR_FONT_FAMILY_COMPLEX
85         ,PROP_CHAR_FONT_NAME
86         ,PROP_CHAR_FONT_NAME_ASIAN
87         ,PROP_CHAR_FONT_NAME_COMPLEX
88         ,PROP_CHAR_FONT_PITCH
89         ,PROP_CHAR_FONT_PITCH_ASIAN
90         ,PROP_CHAR_FONT_PITCH_COMPLEX
91         ,PROP_CHAR_FONT_STYLE
92         ,PROP_CHAR_FONT_STYLE_ASIAN
93         ,PROP_CHAR_FONT_STYLE_COMPLEX
94         ,PROP_CHAR_HEIGHT
95         ,PROP_CHAR_HEIGHT_ASIAN
96         ,PROP_CHAR_HEIGHT_COMPLEX
97         ,PROP_CHAR_HIDDEN
98         ,PROP_CHAR_LOCALE
99         ,PROP_CHAR_LOCALE_ASIAN
100         ,PROP_CHAR_LOCALE_COMPLEX
101         ,PROP_CHAR_POSTURE
102         ,PROP_CHAR_POSTURE_ASIAN
103         ,PROP_CHAR_POSTURE_COMPLEX
104         ,PROP_CHAR_PROP_HEIGHT
105         ,PROP_CHAR_PROP_HEIGHT_ASIAN
106         ,PROP_CHAR_PROP_HEIGHT_COMPLEX
107         ,PROP_CHAR_RELIEF
108         ,PROP_CHAR_ROTATION
109         ,PROP_CHAR_ROTATION_IS_FIT_TO_LINE
110         ,PROP_CHAR_SCALE_WIDTH
111         ,PROP_CHAR_SHADOWED
112         ,PROP_CHAR_STRIKEOUT
113         ,PROP_CHAR_STYLE_NAME
114         ,PROP_CHAR_UNDERLINE
115         ,PROP_CHAR_UNDERLINE_COLOR
116         ,PROP_CHAR_UNDERLINE_HAS_COLOR
117         ,PROP_CHAR_WEIGHT
118         ,PROP_CHAR_WEIGHT_ASIAN
119         ,PROP_CHAR_WEIGHT_COMPLEX
120         ,PROP_CHAR_WORD_MODE
121         ,PROP_CNF_STYLE
122         ,PROP_CONTENT
123         ,PROP_CONTOUR_OUTSIDE
124         ,PROP_CONTOUR_POLY_POLYGON
125         ,PROP_COUNT_EMPTY_LINES
126         ,PROP_COUNT_LINES_IN_FRAMES
127         ,PROP_CREATE_FROM_LEVEL_PARAGRAPH_STYLES
128         ,PROP_CREATE_FROM_MARKS
129         ,PROP_CREATE_FROM_OUTLINE
130         ,PROP_CURRENT_PRESENTATION
131         ,PROP_DATA_COLUMN_NAME
132         ,PROP_DEFAULT
133         ,PROP_DELETE
134         ,PROP_DESCRIPTION
135         ,PROP_DISTANCE
136         ,PROP_DROP_CAP_FORMAT
137         ,PROP_FILE_FORMAT
138         ,PROP_FIRST_LINE_INDENT
139         ,PROP_FIRST_LINE_OFFSET
140         ,PROP_FIRST_PAGE
141         ,PROP_FOOTER_BODY_DISTANCE
142         ,PROP_FOOTER_DYNAMIC_SPACING
143         ,PROP_FOOTER_HEIGHT
144         ,PROP_FOOTER_IS_DYNAMIC_HEIGHT
145         ,PROP_FOOTER_IS_ON
146         ,PROP_FOOTER_IS_SHARED
147         ,PROP_FOOTER_TEXT
148         ,PROP_FOOTER_TEXT_LEFT
149         ,PROP_FORMAT
150         ,PROP_FULL_NAME
151         ,PROP_GAMMA
152         ,PROP_GRAPHIC
153         ,PROP_GRAPHIC_COLOR_MODE
154         ,PROP_GRAPHIC_CROP
155         ,PROP_GRID_BASE_HEIGHT
156         ,PROP_GRID_DISPLAY
157         ,PROP_GRID_LINES
158         ,PROP_GRID_MODE
159         ,PROP_GRID_PRINT
160         ,PROP_GRID_RUBY_HEIGHT
161         ,PROP_HEADER_BODY_DISTANCE
162         ,PROP_HEADER_DYNAMIC_SPACING
163         ,PROP_HEADER_HEIGHT
164         ,PROP_HEADER_IS_DYNAMIC_HEIGHT
165         ,PROP_HEADER_IS_ON
166         ,PROP_HEADER_IS_SHARED
167         ,PROP_HEADER_ROW_COUNT
168         ,PROP_HEADER_TEXT
169         ,PROP_HEADER_TEXT_LEFT
170         ,PROP_HEADING_STYLE_NAME
171         ,PROP_HEIGHT
172         ,PROP_HELP
173         ,PROP_HINT
174         ,PROP_HORI_MIRRORED_ON_EVEN_PAGES
175         ,PROP_HORI_MIRRORED_ON_ODD_PAGES
176         ,PROP_HORI_ORIENT
177         ,PROP_HORI_ORIENT_POSITION
178         ,PROP_HORI_ORIENT_RELATION
179         ,PROP_HYPER_LINK_U_R_L
180         ,PROP_INDENT_AT
181         ,PROP_INPUT_STREAM
182         ,PROP_INSERT
183         ,PROP_INTERVAL
184         ,PROP_IS_AUTO_HEIGHT
185         ,PROP_IS_DATE
186         ,PROP_IS_FIXED
187         ,PROP_IS_INPUT
188         ,PROP_IS_LANDSCAPE
189         ,PROP_IS_ON
190         ,PROP_IS_SPLIT_ALLOWED
191         ,PROP_KEYWORDS
192         ,PROP_LEFT_BORDER
193         ,PROP_LEFT_BORDER_DISTANCE
194         ,PROP_LEFT_MARGIN
195         ,PROP_LEVEL
196         ,PROP_LEVEL_FORMAT
197         ,PROP_LEVEL_PARAGRAPH_STYLES
198         ,PROP_LISTTAB_STOP_POSITION
199         ,PROP_MACRO_NAME
200         ,PROP_NAME
201         ,PROP_NUMBERING_LEVEL
202         ,PROP_NUMBERING_RULES
203         ,PROP_NUMBERING_STYLE_NAME
204         ,PROP_NUMBERING_TYPE
205         ,PROP_NUMBER_FORMAT
206         ,PROP_NUMBER_POSITION
207         ,PROP_OPAQUE
208         ,PROP_OUTLINE_LEVEL
209         ,PROP_PAGE_DESC_NAME
210         ,PROP_PAGE_NUMBER_OFFSET
211         ,PROP_PAGE_TOGGLE
212         ,PROP_PARAGRAPH_STYLES
213         ,PROP_PARA_ADJUST
214         ,PROP_PARA_BACK_COLOR
215         ,PROP_PARA_BOTTOM_MARGIN
216         ,PROP_PARA_FIRST_LINE_INDENT
217         ,PROP_PARA_IS_HANGING_PUNCTUATION
218         ,PROP_PARA_IS_HYPHENATION
219         ,PROP_PARA_KEEP_TOGETHER
220         ,PROP_PARA_LAST_LINE_ADJUST
221         ,PROP_PARA_LEFT_MARGIN
222         ,PROP_PARA_LINE_NUMBER_COUNT
223         ,PROP_PARA_LINE_NUMBER_START_VALUE
224         ,PROP_PARA_LINE_SPACING
225         ,PROP_PARA_ORPHANS
226         ,PROP_PARA_RIGHT_MARGIN
227         ,PROP_PARA_SPLIT
228         ,PROP_PARA_STYLE_NAME
229         ,PROP_PARA_TAB_STOPS
230         ,PROP_PARA_TOP_MARGIN
231         ,PROP_PARA_WIDOWS
232         ,PROP_PARENT_NUMBERING
233         ,PROP_POSITION_AND_SPACE_MODE
234         ,PROP_POSITION_PROTECTED
235         ,PROP_PREFIX
236         ,PROP_PRINTER_PAPER_TRAY_INDEX
237         ,PROP_REDLINE_AUTHOR
238         ,PROP_REDLINE_COMMENT
239         ,PROP_REDLINE_DATE_TIME
240         ,PROP_REDLINE_IDENTIFIER
241         ,PROP_REDLINE_SUCCESSOR_DATA
242         ,PROP_REDLINE_TYPE
243         ,PROP_REFERENCE_FIELD_PART
244         ,PROP_REFERENCE_FIELD_SOURCE
245         ,PROP_RESTART_AT_EACH_PAGE
246         ,PROP_RIGHT_BORDER
247         ,PROP_RIGHT_BORDER_DISTANCE
248         ,PROP_RIGHT_MARGIN
249         ,PROP_SEPARATOR_LINE_IS_ON
250         ,PROP_SERVICE_CHAR_STYLE
251         ,PROP_SERVICE_PARA_STYLE
252         ,PROP_SIZE
253         ,PROP_SIZE100th_M_M
254         ,PROP_SIZE_PIXEL
255         ,PROP_SIZE_PROTECTED
256         ,PROP_SIZE_TYPE
257         ,PROP_SOURCE_NAME
258         ,PROP_STANDARD
259         ,PROP_START_AT
260         ,PROP_START_WITH
261         ,PROP_STREAM_NAME
262         ,PROP_SUBJECT
263         ,PROP_SUB_TYPE
264         ,PROP_SUFFIX
265         ,PROP_SURROUND
266         ,PROP_SURROUND_CONTOUR
267         ,PROP_TABLE_BORDER
268         ,PROP_TABLE_BORDER_DISTANCES
269         ,PROP_TABLE_COLUMN_SEPARATORS
270         ,PROP_TABS_RELATIVE_TO_INDENT
271         ,PROP_TAB_STOP_DISTANCE
272         ,PROP_TEXT
273         ,PROP_TEXT_COLUMNS
274         ,PROP_TEXT_RANGE
275         ,PROP_TITLE
276         ,PROP_TOKEN_CHAPTER_INFO
277         ,PROP_TOKEN_HYPERLINK_END
278         ,PROP_TOKEN_HYPERLINK_START
279         ,PROP_TOKEN_TEXT
280         ,PROP_TOKEN_TYPE
281         ,PROP_TOP_BORDER
282         ,PROP_TOP_BORDER_DISTANCE
283         ,PROP_TOP_MARGIN
284         ,PROP_USER_DATA_TYPE
285         ,PROP_VERTICAL_MERGE
286         ,PROP_VERT_MIRRORED
287 /*254*/ ,PROP_GRID_STANDARD_MODE
288         ,PROP_VERT_ORIENT
289         ,PROP_VERT_ORIENT_POSITION
290         ,PROP_VERT_ORIENT_RELATION
291         ,PROP_WIDTH
292         ,PROP_WIDTH_TYPE
293         ,PROP_WRITING_MODE
294     };
295 struct PropertyNameSupplier_Impl;
296 
297 struct PropertyIdsHash
298 {
operator ()writerfilter::dmapper::PropertyIdsHash299     size_t operator()(const PropertyIds a) const { return a; }
300 };
301 
302 class PropertyNameSupplier
303 {
304     PropertyNameSupplier_Impl* m_pImpl;
305     PropertyNameSupplier();
306 
307 public:
308     ~PropertyNameSupplier();
309     const rtl::OUString& GetName( PropertyIds eId ) const;
310     PropertyIds GetId(const ::rtl::OUString & rString) const;
311 
312     static PropertyNameSupplier& GetPropertyNameSupplier();
313 };
314 
315 class PropertySequence
316 {
317     typedef ::std::hash_map<PropertyIds, sal_Int32, PropertyIdsHash> Map_t;
318     Map_t m_indexMap;
319     uno::Sequence<beans::PropertyValue>m_sequence;
320     PropertyNameSupplier & m_rPropNameSupplier;
321 
322     int getOrCreateIndex(PropertyIds aId);
323 
324 public:
325     typedef boost::shared_ptr<PropertySequence> Pointer_t;
326 
327     PropertySequence();
328     PropertySequence(const uno::Sequence<beans::PropertyValue> & rSeq);
329     virtual ~PropertySequence();
330 
331     uno::Any get(PropertyIds aId);
332 
333     void set(PropertyIds aId, const uno::Any & rValue);
334     void set(PropertyIds aId, sal_uInt32 nValue);
335     void set(PropertyIds aId, sal_Int32 nValue);
336     void set(PropertyIds aId, sal_uInt16 nValue);
337     void set(PropertyIds aId, sal_Int16 nValue);
338 
339     uno::Sequence<beans::PropertyValue> & getSequence();
340 
341     ::std::string toString() const;
342 };
343 
344 } //namespace dmapper
345 } // namespace writerfilter
346 #endif
347