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 #include <PropertyIds.hxx>
24 #include <rtl/ustring.hxx>
25 #include <map>
26 #include <string>
27 #include <stdio.h>
28 
29 namespace writerfilter {
30 namespace dmapper{
31 
32 typedef ::std::map< PropertyIds, rtl::OUString> PropertyNameMap_t;
33 typedef ::std::map< rtl::OUString, PropertyIds> PropertyBackwardNameMap_t;
34 
35 struct PropertyNameSupplier_Impl
36 {
37     PropertyNameMap_t aNameMap;
38     PropertyBackwardNameMap_t aNameBackwardMap;
39 
40     void add(PropertyIds aId, const rtl::OUString & aStr);
41 
42     PropertyNameSupplier_Impl();
43 };
44 
PropertyNameSupplier_Impl()45 PropertyNameSupplier_Impl::PropertyNameSupplier_Impl()
46 {
47     add(PROP_CHAR_WEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeight")));
48     add(PROP_CHAR_POSTURE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPosture")));
49     add(PROP_CHAR_STRIKEOUT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharStrikeout")));
50     add(PROP_CHAR_CONTOURED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharContoured")));
51     add(PROP_CHAR_SHADOWED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharShadowed")));
52     add(PROP_CHAR_CASE_MAP, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharCaseMap")));
53     add(PROP_CHAR_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharColor")));
54     add(PROP_CHAR_RELIEF, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharRelief")));
55     add(PROP_CHAR_UNDERLINE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderline")));
56     add(PROP_CHAR_UNDERLINE_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderlineColor")));
57     add(PROP_CHAR_UNDERLINE_HAS_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharUnderlineHasColor")));
58     add(PROP_CHAR_WORD_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharWordMode")));
59     add(PROP_CHAR_ESCAPEMENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapement")));
60     add(PROP_CHAR_ESCAPEMENT_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEscapementHeight")));
61     add(PROP_CHAR_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharHeight")));
62     add(PROP_CHAR_HEIGHT_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharHeightComplex")));
63     add(PROP_CHAR_LOCALE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharLocale")));
64     add(PROP_CHAR_LOCALE_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharLocaleAsian")));
65     add(PROP_CHAR_LOCALE_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharLocaleComplex")));
66     add(PROP_CHAR_WEIGHT_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeightComplex")));
67     add(PROP_CHAR_POSTURE_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPostureComplex")));
68     add(PROP_CHAR_CHAR_KERNING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharKerning")));
69     add(PROP_CHAR_AUTO_KERNING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharAutoKerning")));
70     add(PROP_CHAR_SCALE_WIDTH, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharScaleWidth")));
71     add(PROP_CHAR_STYLE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharStyleName")));
72     add(PROP_CHAR_FONT_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontName")));
73     add(PROP_CHAR_FONT_STYLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontStyle")));
74     add(PROP_CHAR_FONT_FAMILY, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontFamily")));
75     add(PROP_CHAR_FONT_CHAR_SET, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontCharSet")));
76     add(PROP_CHAR_FONT_PITCH, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontPitch")));
77     add(PROP_CHAR_FONT_NAME_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontNameAsian")));
78     add(PROP_CHAR_HEIGHT_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharHeightAsian")));
79     add(PROP_CHAR_FONT_STYLE_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontStyleAsian")));
80     add(PROP_CHAR_FONT_FAMILY_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontFamilyAsian")));
81     add(PROP_CHAR_FONT_CHAR_SET_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontCharSetAsian")));
82     add(PROP_CHAR_FONT_PITCH_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontPitchAsian")));
83     add(PROP_CHAR_FONT_NAME_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontNameComplex")));
84     add(PROP_CHAR_FONT_STYLE_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontStyleComplex")));
85     add(PROP_CHAR_FONT_FAMILY_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontFamilyComplex")));
86     add(PROP_CHAR_FONT_CHAR_SET_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontCharSetComplex")));
87     add(PROP_CHAR_FONT_PITCH_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFontPitchComplex")));
88     add(PROP_CHAR_HIDDEN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharHidden")));
89     add(PROP_CHAR_WEIGHT_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharWeightAsian")));
90     add(PROP_CHAR_POSTURE_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPostureAsian")));
91     add(PROP_CHAR_BACK_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharBackColor")));
92     add(PROP_CHAR_EMPHASIS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharEmphasis")));
93     add(PROP_CHAR_COMBINE_IS_ON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharCombineIsOn")));
94     add(PROP_CHAR_COMBINE_PREFIX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharCombinePrefix")));
95     add(PROP_CHAR_COMBINE_SUFFIX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharCombineSuffix")));
96     add(PROP_CHAR_ROTATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharRotation")));
97     add(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharRotationIsFitToLine")));
98     add(PROP_CHAR_FLASH, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharFlash")));
99     add(PROP_PARA_STYLE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName")));
100     add(PROP_PARA_ADJUST, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaAdjust")));
101     add(PROP_PARA_LAST_LINE_ADJUST, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLastLineAdjust")));
102     add(PROP_PARA_RIGHT_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin")));
103     add(PROP_PARA_LEFT_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin")));
104     add(PROP_PARA_FIRST_LINE_INDENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent")));
105     add(PROP_PARA_KEEP_TOGETHER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether")));
106     add(PROP_PARA_TOP_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin")));
107     add(PROP_PARA_BOTTOM_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin")));
108     add(PROP_PARA_IS_HYPHENATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")));
109     add(PROP_PARA_LINE_NUMBER_COUNT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount")));
110     add(PROP_PARA_IS_HANGING_PUNCTUATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaIsHangingPunctuation")));
111     add(PROP_PARA_LINE_SPACING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing")));
112     add(PROP_PARA_TAB_STOPS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaTabStops")));
113     add(PROP_PARA_WIDOWS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaWidows")));
114     add(PROP_PARA_ORPHANS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaOrphans")));
115     add(PROP_PARA_LINE_NUMBER_START_VALUE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberStartValue")));
116     add(PROP_NUMBERING_LEVEL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingLevel")));
117     add(PROP_NUMBERING_RULES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingRules")));
118     add(PROP_NUMBERING_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType")));
119     add(PROP_START_WITH, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartWith")));
120     add(PROP_ADJUST, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Adjust")));
121     add(PROP_PARENT_NUMBERING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentNumbering")));
122     add(PROP_RIGHT_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RightMargin")));
123     add(PROP_LEFT_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftMargin")));
124     add(PROP_TOP_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopMargin")));
125     add(PROP_BOTTOM_MARGIN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BottomMargin")));
126     add(PROP_FIRST_LINE_OFFSET, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstLineOffset")));
127     add(PROP_LEFT_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftBorder")));
128     add(PROP_RIGHT_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RightBorder")));
129     add(PROP_TOP_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopBorder")));
130     add(PROP_BOTTOM_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BottomBorder")));
131     add(PROP_TABLE_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableBorder")));
132     add(PROP_LEFT_BORDER_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LeftBorderDistance")));
133     add(PROP_RIGHT_BORDER_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RightBorderDistance")));
134     add(PROP_TOP_BORDER_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopBorderDistance")));
135     add(PROP_BOTTOM_BORDER_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BottomBorderDistance")));
136     add(PROP_CURRENT_PRESENTATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentPresentation")));
137     add(PROP_IS_FIXED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsFixed")));
138     add(PROP_SUB_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SubType")));
139     add(PROP_FILE_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FileFormat")));
140     add(PROP_HYPER_LINK_U_R_L, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL")));
141     add(PROP_NUMBER_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")));
142     add(PROP_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")));
143     add(PROP_IS_INPUT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsInput")));
144     add(PROP_HINT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hint")));
145     add(PROP_FULL_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FullName")));
146     add(PROP_KEYWORDS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Keywords")));
147     add(PROP_DESCRIPTION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Description")));
148     add(PROP_MACRO_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MacroName")));
149     add(PROP_SUBJECT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subject")));
150     add(PROP_USER_DATA_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserDataType")));
151     add(PROP_TITLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")));
152     add(PROP_CONTENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Content")));
153     add(PROP_DATA_COLUMN_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataColumnName")));
154     add(PROP_INPUT_STREAM, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")));
155     add(PROP_GRAPHIC, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Graphic")));
156     add(PROP_ANCHOR_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType")));
157     add(PROP_SIZE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Size")));
158     add(PROP_HORI_ORIENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")));
159     add(PROP_HORI_ORIENT_POSITION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")));
160     add(PROP_HORI_ORIENT_RELATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation")));
161     add(PROP_VERT_ORIENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrient")));
162     add(PROP_VERT_ORIENT_POSITION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")));
163     add(PROP_VERT_ORIENT_RELATION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation")));
164     add(PROP_GRAPHIC_CROP, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicCrop")));
165     add(PROP_SIZE100th_M_M, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Size100thMM")));
166     add(PROP_SIZE_PIXEL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SizePixel")));
167     add(PROP_SURROUND, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Surround")));
168     add(PROP_SURROUND_CONTOUR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SurroundContour")));
169     add(PROP_ADJUST_CONTRAST, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustContrast")));
170     add(PROP_ADJUST_LUMINANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AdjustLuminance")));
171     add(PROP_GRAPHIC_COLOR_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicColorMode")));
172     add(PROP_GAMMA, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Gamma")));
173     add(PROP_HORI_MIRRORED_ON_EVEN_PAGES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriMirroredOnEvenPages")));
174     add(PROP_HORI_MIRRORED_ON_ODD_PAGES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HoriMirroredOnOddPages")));
175     add(PROP_VERT_MIRRORED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VertMirrored")));
176     add(PROP_CONTOUR_OUTSIDE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContourOutside")));
177     add(PROP_CONTOUR_POLY_POLYGON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")));
178     add(PROP_PAGE_TOGGLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageToggle")));
179     add(PROP_BACK_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColor")));
180     add(PROP_ALTERNATIVE_TEXT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")));
181     add(PROP_HEADER_TEXT_LEFT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft")));
182     add(PROP_HEADER_TEXT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderText")));
183     add(PROP_HEADER_IS_SHARED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared")));
184     add(PROP_HEADER_IS_ON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")));
185     add(PROP_FOOTER_TEXT_LEFT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft")));
186     add(PROP_FOOTER_TEXT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterText")));
187     add(PROP_FOOTER_IS_SHARED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterIsShared")));
188     add(PROP_FOOTER_IS_ON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")));
189     add(PROP_WIDTH, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
190     add(PROP_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
191     add(PROP_SEPARATOR_LINE_IS_ON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn")));
192     add(PROP_TEXT_COLUMNS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextColumns")));
193     add(PROP_AUTOMATIC_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance")));
194     add(PROP_IS_LANDSCAPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsLandscape")));
195     add(PROP_PRINTER_PAPER_TRAY_INDEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrinterPaperTrayIndex")));
196     add(PROP_FIRST_PAGE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First Page")));
197     add(PROP_DEFAULT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")));
198     add(PROP_PAGE_DESC_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageDescName")));
199     add(PROP_PAGE_NUMBER_OFFSET, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageNumberOffset")));
200     add(PROP_BREAK_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BreakType")));
201     add(PROP_FOOTER_IS_DYNAMIC_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterIsDynamicHeight")));
202     add(PROP_FOOTER_DYNAMIC_SPACING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterDynamicSpacing")));
203     add(PROP_FOOTER_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterHeight")));
204     add(PROP_FOOTER_BODY_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")));
205     add(PROP_HEADER_IS_DYNAMIC_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderIsDynamicHeight")));
206     add(PROP_HEADER_DYNAMIC_SPACING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderDynamicSpacing")));
207     add(PROP_HEADER_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")));
208     add(PROP_HEADER_BODY_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")));
209     add(PROP_WRITING_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WritingMode")));
210     add(PROP_GRID_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridMode")));
211     add(PROP_GRID_DISPLAY, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridDisplay")));
212     add(PROP_GRID_PRINT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridPrint")));
213     add(PROP_ADD_EXTERNAL_LEADING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AddExternalLeading")));
214     add(PROP_GRID_LINES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridLines")));
215     add(PROP_GRID_BASE_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridBaseHeight")));
216     add(PROP_GRID_RUBY_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GridRubyHeight")));
217     add(PROP_GRID_STANDARD_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StandardPageMode")));
218     add(PROP_IS_ON, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsOn")));
219     add(PROP_RESTART_AT_EACH_PAGE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RestartAtEachPage")));
220     add(PROP_COUNT_EMPTY_LINES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CountEmptyLines")));
221     add(PROP_COUNT_LINES_IN_FRAMES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CountLinesInFrames")));
222     add(PROP_INTERVAL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Interval")));
223     add(PROP_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Distance")));
224     add(PROP_NUMBER_POSITION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberPosition")));
225     add(PROP_LEVEL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Level")));
226     add(PROP_LEVEL_PARAGRAPH_STYLES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LevelParagraphStyles")));
227     add(PROP_LEVEL_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LevelFormat")));
228     add(PROP_TOKEN_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TokenType")));
229     add(PROP_TOKEN_HYPERLINK_START, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TokenHyperlinkStart")));
230     add(PROP_TOKEN_HYPERLINK_END, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TokenHyperlinkEnd")));
231     add(PROP_TOKEN_CHAPTER_INFO, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TokenChapterInfo")));
232     add(PROP_CHAPTER_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ChapterFormat")));
233     add(PROP_TOKEN_TEXT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TokenText")));
234     add(PROP_TEXT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text")));
235     add(PROP_CREATE_FROM_OUTLINE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateFromOutline")));
236     add(PROP_CREATE_FROM_MARKS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateFromMarks")));
237     add(PROP_STANDARD, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Standard")));
238     add(PROP_IS_SPLIT_ALLOWED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSplitAllowed")));
239     add(META_PROP_VERTICAL_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VerticalBorder")));
240     add(META_PROP_HORIZONTAL_BORDER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HorizontalBorder")));
241     add(PROP_HEADER_ROW_COUNT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderRowCount")));
242     add(PROP_IS_AUTO_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight")));
243     add(PROP_SIZE_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SizeType")));
244     add(PROP_TABLE_COLUMN_SEPARATORS, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableColumnSeparators")));
245     add(META_PROP_TABLE_STYLE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableStyleName")));
246     add(PROP_REDLINE_AUTHOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineAuthor")));
247     add(PROP_REDLINE_DATE_TIME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineDateTime")));
248     add(PROP_REDLINE_COMMENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineComment")));
249     add(PROP_REDLINE_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineType")));
250     add(PROP_REDLINE_SUCCESSOR_DATA, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineSuccessorData")));
251     add(PROP_REDLINE_IDENTIFIER, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RedlineIdentifier")));
252     add(PROP_SIZE_PROTECTED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SizeProtected")));
253     add(PROP_POSITION_PROTECTED, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionProtected")));
254     add(PROP_OPAQUE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Opaque")));
255     add(PROP_VERTICAL_MERGE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VerticalMerge")));
256     add(PROP_BULLET_CHAR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BulletChar")));
257     add(PROP_BULLET_FONT_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BulletFontName")));
258     add(PROP_PARA_BACK_COLOR, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor")));
259     add(PROP_TABS_RELATIVE_TO_INDENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabsRelativeToIndent")));
260     add(PROP_PREFIX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prefix")));
261     add(PROP_SUFFIX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Suffix")));
262     add(PROP_CREATE_FROM_LEVEL_PARAGRAPH_STYLES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateFromLevelParagraphStyles")));
263     add(PROP_DROP_CAP_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DropCapFormat")));
264     add(PROP_REFERENCE_FIELD_PART, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldPart")));
265     add(PROP_SOURCE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceName")));
266     add(PROP_REFERENCE_FIELD_SOURCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReferenceFieldSource")));
267     add(PROP_WIDTH_TYPE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WidthType")));
268     add( PROP_TEXT_RANGE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextRange")));
269     add(PROP_SERVICE_CHAR_STYLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle")));
270     add(PROP_SERVICE_PARA_STYLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.ParagraphStyle")));
271     add(PROP_CHARACTER_STYLES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharacterStyles")));
272     add(PROP_PARAGRAPH_STYLES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles")));
273     add(PROP_TABLE_BORDER_DISTANCES, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TableBorderDistances")));
274     add(META_PROP_CELL_MAR_TOP, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MetaPropCellMarTop")));
275     add(META_PROP_CELL_MAR_BOTTOM, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MetaPropCellMarBottom")));
276     add(META_PROP_CELL_MAR_LEFT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MetaPropCellMarLeft")));
277     add(META_PROP_CELL_MAR_RIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MetaPropCellMarRight")));
278     add(PROP_START_AT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartAt")));
279     add(PROP_ADD_PARA_TABLE_SPACING, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AddParaTableSpacing")));
280     add(PROP_CHAR_PROP_HEIGHT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeight")));
281     add(PROP_CHAR_PROP_HEIGHT_ASIAN, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightAsian")));
282     add(PROP_CHAR_PROP_HEIGHT_COMPLEX, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightComplex")));
283     add(PROP_FORMAT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Format")));
284     add(PROP_INSERT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Insert")));
285     add(PROP_DELETE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Delete")));
286     add(PROP_STREAM_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")));
287     add(PROP_BITMAP, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Bitmap")));
288     add(PROP_IS_DATE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsDate")));
289     add(PROP_TAB_STOP_DISTANCE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabStopDistance")));
290     add(PROP_CNF_STYLE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CnfStyle")));
291     add(PROP_INDENT_AT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IndentAt")));
292     add(PROP_FIRST_LINE_INDENT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent")));
293     add(PROP_NUMBERING_STYLE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName")));
294     add(PROP_OUTLINE_LEVEL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutlineLevel")));
295     add(PROP_LISTTAB_STOP_POSITION, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition")));
296     add(PROP_POSITION_AND_SPACE_MODE, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionAndSpaceMode")));
297     add(PROP_PARA_SPLIT, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaSplit")));
298     add(PROP_HELP, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Help")));
299     add(PROP_HEADING_STYLE_NAME, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName")));
300 }
301 
add(PropertyIds aId,const::rtl::OUString & aStr)302 void PropertyNameSupplier_Impl::add(PropertyIds aId, const ::rtl::OUString & aStr)
303 {
304     aNameMap[aId] = aStr;
305     aNameBackwardMap[aStr] = aId;
306 }
307 
308 /*-- 14.06.2006 11:01:31---------------------------------------------------
309 
310   -----------------------------------------------------------------------*/
PropertyNameSupplier()311 PropertyNameSupplier::PropertyNameSupplier() :
312     m_pImpl(new PropertyNameSupplier_Impl)
313 {
314 }
315 /*-- 14.06.2006 11:01:32---------------------------------------------------
316 
317   -----------------------------------------------------------------------*/
~PropertyNameSupplier()318 PropertyNameSupplier::~PropertyNameSupplier()
319 {
320     delete m_pImpl;
321 }
322 /*-- 14.06.2006 11:01:32---------------------------------------------------
323 
324   -----------------------------------------------------------------------*/
GetName(PropertyIds eId) const325 const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
326 {
327     PropertyNameMap_t::const_iterator aIt = m_pImpl->aNameMap.find(eId);
328 
329     return aIt->second;
330 }
331 
GetId(const::rtl::OUString & rStr) const332 PropertyIds PropertyNameSupplier::GetId(const ::rtl::OUString & rStr) const
333 {
334     PropertyBackwardNameMap_t::const_iterator aIt= m_pImpl->aNameBackwardMap.find(rStr);
335 
336     return aIt->second;
337 }
338 
GetPropertyNameSupplier()339 PropertyNameSupplier& PropertyNameSupplier::GetPropertyNameSupplier()
340 {
341     static PropertyNameSupplier aNameSupplier;
342     return aNameSupplier;
343 }
344 
PropertySequence()345 PropertySequence::PropertySequence()
346     : m_rPropNameSupplier(PropertyNameSupplier::GetPropertyNameSupplier())
347 {
348 }
349 
PropertySequence(const uno::Sequence<beans::PropertyValue> & rSeq)350 PropertySequence::PropertySequence(const uno::Sequence<beans::PropertyValue> & rSeq)
351     : m_sequence(rSeq), m_rPropNameSupplier(PropertyNameSupplier::GetPropertyNameSupplier())
352 {
353     sal_Int32 nLength = rSeq.getLength();
354 
355     for (sal_Int32 n = 0; n < nLength; n++)
356     {
357         PropertyIds aId = m_rPropNameSupplier.GetId(m_sequence[n].Name);
358         m_indexMap[aId] = n;
359     }
360 }
361 
~PropertySequence()362 PropertySequence::~PropertySequence()
363 {
364 }
365 
get(PropertyIds aPropId)366 uno::Any PropertySequence::get(PropertyIds aPropId)
367 {
368     Map_t::const_iterator aIt = m_indexMap.find(aPropId);
369 
370     if (aIt != m_indexMap.end())
371     {
372         return m_sequence[aIt->second].Value;
373     }
374 
375     return uno::Any();
376 }
377 
getOrCreateIndex(PropertyIds aPropId)378 int PropertySequence::getOrCreateIndex(PropertyIds aPropId)
379 {
380     Map_t::const_iterator aIt = m_indexMap.find(aPropId);
381 
382     sal_Int32 nIndex = 0;
383     if (aIt == m_indexMap.end())
384     {
385         sal_uInt32 nCount = m_sequence.getLength() + 1;
386         m_sequence.realloc(nCount);
387         nIndex = nCount - 1;
388         m_indexMap[aPropId] = nIndex;
389     }
390     else
391     {
392         nIndex = aIt->second;
393     }
394 
395     return nIndex;
396 }
397 
set(PropertyIds aPropId,const uno::Any & rValue)398 void PropertySequence::set(PropertyIds aPropId, const uno::Any & rValue)
399 {
400     sal_Int32 nIndex = getOrCreateIndex(aPropId);
401 
402     m_sequence[nIndex].Name = m_rPropNameSupplier.GetName(aPropId);
403     m_sequence[nIndex].Value = rValue;
404 }
405 
set(PropertyIds aPropId,sal_uInt32 nValue)406 void PropertySequence::set(PropertyIds aPropId, sal_uInt32 nValue)
407 {
408     uno::Any aAny;
409 
410     aAny <<= nValue;
411     set(aPropId, aAny);
412 }
413 
set(PropertyIds aPropId,sal_Int32 nValue)414 void PropertySequence::set(PropertyIds aPropId, sal_Int32 nValue)
415 {
416     uno::Any aAny;
417 
418     aAny <<= nValue;
419     set(aPropId, aAny);
420 }
421 
set(PropertyIds aPropId,sal_uInt16 nValue)422 void PropertySequence::set(PropertyIds aPropId, sal_uInt16 nValue)
423 {
424     uno::Any aAny;
425 
426     aAny <<= nValue;
427     set(aPropId, aAny);
428 }
429 
set(PropertyIds aPropId,sal_Int16 nValue)430 void PropertySequence::set(PropertyIds aPropId, sal_Int16 nValue)
431 {
432     uno::Any aAny;
433 
434     aAny <<= nValue;
435     set(aPropId, aAny);
436 }
437 
getSequence()438 uno::Sequence<beans::PropertyValue> & PropertySequence::getSequence()
439 {
440     return m_sequence;
441 }
442 
toString() const443 ::std::string PropertySequence::toString() const
444 {
445     ::std::string sResult = "";
446 
447     sal_Int32 nCount = m_sequence.getLength();
448 
449     for (sal_Int32 n = 0; n < nCount; n++)
450     {
451         if (n > 0)
452             sResult +=", ";
453 
454         ::std::string sTmp = ::rtl::OUStringToOString(m_sequence[n].Name, RTL_TEXTENCODING_ASCII_US).getStr();
455 
456         sResult += sTmp;
457 
458         if (m_sequence[n].Value.hasValue())
459         {
460             sal_Int32 nValue = 0;
461             m_sequence[n].Value >>= nValue;
462 
463             static char buffer[256];
464             snprintf(buffer, sizeof(buffer), " = %" SAL_PRIdINT32, nValue);
465             sResult += buffer;
466         }
467     }
468 
469     return sResult;
470 }
471 
472 } //namespace dmapper
473 } //namespace writerfilter
474