xref: /aoo41x/main/sw/source/filter/html/svxcss1.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <stdlib.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
31cdf0e10cSrcweir #include <svx/svxids.hrc>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
34cdf0e10cSrcweir #include <svtools/ctrltool.hxx>
35cdf0e10cSrcweir #include <svl/urihelper.hxx>
36cdf0e10cSrcweir #include <editeng/udlnitem.hxx>
37cdf0e10cSrcweir #include <editeng/adjitem.hxx>
38cdf0e10cSrcweir #include <editeng/blnkitem.hxx>
39cdf0e10cSrcweir #include <editeng/crsditem.hxx>
40cdf0e10cSrcweir #include <editeng/kernitem.hxx>
41cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
42cdf0e10cSrcweir #include <editeng/fontitem.hxx>
43cdf0e10cSrcweir #include <editeng/postitem.hxx>
44cdf0e10cSrcweir #include <editeng/colritem.hxx>
45cdf0e10cSrcweir #include <editeng/cmapitem.hxx>
46cdf0e10cSrcweir #include <editeng/brshitem.hxx>
47cdf0e10cSrcweir #include <editeng/wghtitem.hxx>
48cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
49cdf0e10cSrcweir #include <editeng/boxitem.hxx>
50cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
51cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
52cdf0e10cSrcweir #include <editeng/langitem.hxx>
53cdf0e10cSrcweir #include <svl/itempool.hxx>
54cdf0e10cSrcweir #include <editeng/spltitem.hxx>
55cdf0e10cSrcweir #include <editeng/widwitem.hxx>
56cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
57cdf0e10cSrcweir #include <editeng/orphitem.hxx>
58cdf0e10cSrcweir #include <svtools/svparser.hxx>
59cdf0e10cSrcweir #include <vcl/svapp.hxx>
60cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #include "css1kywd.hxx"
63cdf0e10cSrcweir #include "svxcss1.hxx"
64cdf0e10cSrcweir 
65cdf0e10cSrcweir // die Funktionen zum Parsen einer CSS1-Property sind von folgendem Typ:
66cdf0e10cSrcweir typedef void (*FnParseCSS1Prop)( const CSS1Expression *pExpr,
67cdf0e10cSrcweir 								 SfxItemSet& rItemSet,
68cdf0e10cSrcweir 								 SvxCSS1PropertyInfo& rPropInfo,
69cdf0e10cSrcweir 								 const SvxCSS1Parser& rParser );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir SV_IMPL_PTRARR( CSS1Selectors, CSS1Selector* )
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir /*  */
75cdf0e10cSrcweir 
76cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFontSizeTable[] =
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	{ sCSS1_PV_xx_small,   	0					},
79cdf0e10cSrcweir 	{ sCSS1_PV_x_small,   	1					},
80cdf0e10cSrcweir 	{ sCSS1_PV_small,   	2					},
81cdf0e10cSrcweir 	{ sCSS1_PV_medium,   	3					},
82cdf0e10cSrcweir 	{ sCSS1_PV_large,   	4					},
83cdf0e10cSrcweir 	{ sCSS1_PV_x_large,   	5					},
84cdf0e10cSrcweir 	{ sCSS1_PV_xx_large,   	6					},
85cdf0e10cSrcweir 	{ 0,					0					}
86cdf0e10cSrcweir };
87cdf0e10cSrcweir 
88cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFontFamilyTable[] =
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	{ sCSS1_PV_serif,   	FAMILY_ROMAN		},
91cdf0e10cSrcweir 	{ sCSS1_PV_sans_serif, 	FAMILY_SWISS		},
92cdf0e10cSrcweir 	{ sCSS1_PV_cursive,   	FAMILY_SCRIPT		},
93cdf0e10cSrcweir 	{ sCSS1_PV_fantasy,   	FAMILY_DECORATIVE	},
94cdf0e10cSrcweir 	{ sCSS1_PV_monospace,  	FAMILY_MODERN		},
95cdf0e10cSrcweir 	{ 0,					0					}
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFontWeightTable[] =
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	{ sCSS1_PV_extra_light,	WEIGHT_NORMAL		}, // WEIGHT_ULTRALIGHT (OBS)
101cdf0e10cSrcweir 	{ sCSS1_PV_light, 		WEIGHT_NORMAL		}, // WEIGHT_LIGHT (OBSOLETE)
102cdf0e10cSrcweir 	{ sCSS1_PV_demi_light, 	WEIGHT_NORMAL		}, // WEIGHT_SEMILIGHT (OBS)
103cdf0e10cSrcweir 	{ sCSS1_PV_medium, 		WEIGHT_NORMAL		}, // WEIGHT_MEDIUM (OBS)
104cdf0e10cSrcweir 	{ sCSS1_PV_normal, 		WEIGHT_NORMAL		}, // WEIGHT_MEDIUM
105cdf0e10cSrcweir 	{ sCSS1_PV_demi_bold,	WEIGHT_NORMAL 		}, // WEIGHT_SEMIBOLD (OBS)
106cdf0e10cSrcweir 	{ sCSS1_PV_bold, 		WEIGHT_BOLD			}, // WEIGHT_BOLD (OBSOLETE)
107cdf0e10cSrcweir 	{ sCSS1_PV_extra_bold, 	WEIGHT_BOLD			}, // WEIGHT_ULTRABOLD (OBS)
108cdf0e10cSrcweir 	{ sCSS1_PV_bolder, 		WEIGHT_BOLD			},
109cdf0e10cSrcweir 	{ sCSS1_PV_lighter, 	WEIGHT_NORMAL		},
110cdf0e10cSrcweir 	{ 0,					0					}
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
113cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFontStyleTable[] =
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	{ sCSS1_PV_normal,		ITALIC_NONE			},
116cdf0e10cSrcweir 	{ sCSS1_PV_italic, 		ITALIC_NORMAL		},
117cdf0e10cSrcweir 	{ sCSS1_PV_oblique, 	ITALIC_NORMAL		},
118cdf0e10cSrcweir 	{ 0,					0					}
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFontVariantTable[] =
122cdf0e10cSrcweir {
123cdf0e10cSrcweir 	{ sCSS1_PV_normal,		SVX_CASEMAP_NOT_MAPPED		},
124cdf0e10cSrcweir 	{ sCSS1_PV_small_caps, 	SVX_CASEMAP_KAPITAELCHEN	},
125cdf0e10cSrcweir 	{ 0,					0					}
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aDirectionTable[] =
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 	{ sCSS1_PV_ltr,			FRMDIR_HORI_LEFT_TOP		},
131cdf0e10cSrcweir 	{ sCSS1_PV_rtl, 		FRMDIR_HORI_RIGHT_TOP		},
132cdf0e10cSrcweir 	{ sCSS1_PV_inherit, 	FRMDIR_ENVIRONMENT			},
133cdf0e10cSrcweir 	{ 0,					0					}
134cdf0e10cSrcweir };
135cdf0e10cSrcweir 
136cdf0e10cSrcweir /*  */
137cdf0e10cSrcweir 
138cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aBGRepeatTable[] =
139cdf0e10cSrcweir {
140cdf0e10cSrcweir 	{ sCSS1_PV_repeat,   	GPOS_TILED					},
141cdf0e10cSrcweir 	{ sCSS1_PV_repeat_x,   	GPOS_TILED					},
142cdf0e10cSrcweir 	{ sCSS1_PV_repeat_y,   	GPOS_TILED					},
143cdf0e10cSrcweir 	{ sCSS1_PV_no_repeat,   GPOS_NONE  					},
144cdf0e10cSrcweir 	{ 0,					0							}
145cdf0e10cSrcweir };
146cdf0e10cSrcweir 
147cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aBGHoriPosTable[] =
148cdf0e10cSrcweir {
149cdf0e10cSrcweir 	{ sCSS1_PV_left,   		GPOS_LT					},
150cdf0e10cSrcweir 	{ sCSS1_PV_center,   	GPOS_MT					},
151cdf0e10cSrcweir 	{ sCSS1_PV_right,   	GPOS_RT					},
152cdf0e10cSrcweir 	{ 0,					0				   		}
153cdf0e10cSrcweir };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aBGVertPosTable[] =
156cdf0e10cSrcweir {
157cdf0e10cSrcweir 	{ sCSS1_PV_top,   		GPOS_LT					},
158cdf0e10cSrcweir 	{ sCSS1_PV_middle,   	GPOS_LM					},
159cdf0e10cSrcweir 	{ sCSS1_PV_bottom,   	GPOS_LB					},
160cdf0e10cSrcweir 	{ 0,					0				   		}
161cdf0e10cSrcweir };
162cdf0e10cSrcweir 
163cdf0e10cSrcweir /*  */
164cdf0e10cSrcweir 
165cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aTextAlignTable[] =
166cdf0e10cSrcweir {
167cdf0e10cSrcweir 	{ sCSS1_PV_left,		SVX_ADJUST_LEFT		},
168cdf0e10cSrcweir 	{ sCSS1_PV_center, 		SVX_ADJUST_CENTER	},
169cdf0e10cSrcweir 	{ sCSS1_PV_right, 		SVX_ADJUST_RIGHT	},
170cdf0e10cSrcweir 	{ sCSS1_PV_justify, 	SVX_ADJUST_BLOCK	},
171cdf0e10cSrcweir 	{ 0,					0					}
172cdf0e10cSrcweir };
173cdf0e10cSrcweir 
174cdf0e10cSrcweir /*  */
175cdf0e10cSrcweir 
176cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aBorderWidthTable[] =
177cdf0e10cSrcweir {
178cdf0e10cSrcweir 	{ sCSS1_PV_thin,		0	},	// DEF_LINE_WIDTH_0 / DEF_DOUBLE_LINE0
179cdf0e10cSrcweir 	{ sCSS1_PV_medium, 		1	},	// DEF_LINE_WIDTH_1 / DEF_DOUBLE_LINE1
180cdf0e10cSrcweir 	{ sCSS1_PV_thick, 		2	},	// DEF_LINE_WIDTH_2 / DEF_DOUBLE_LINE2
181cdf0e10cSrcweir 	{ 0,					0	}
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir enum CSS1BorderStyle { CSS1_BS_NONE, CSS1_BS_SINGLE, CSS1_BS_DOUBLE };
185cdf0e10cSrcweir 
186cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aBorderStyleTable[] =
187cdf0e10cSrcweir {
188cdf0e10cSrcweir 	{ sCSS1_PV_none,		CSS1_BS_NONE		},
189cdf0e10cSrcweir 	{ sCSS1_PV_dotted, 		CSS1_BS_SINGLE		},
190cdf0e10cSrcweir 	{ sCSS1_PV_dashed, 		CSS1_BS_SINGLE		},
191cdf0e10cSrcweir 	{ sCSS1_PV_solid, 		CSS1_BS_SINGLE		},
192cdf0e10cSrcweir 	{ sCSS1_PV_double, 		CSS1_BS_DOUBLE		},
193cdf0e10cSrcweir 	{ sCSS1_PV_groove, 		CSS1_BS_SINGLE		},
194cdf0e10cSrcweir 	{ sCSS1_PV_ridge, 		CSS1_BS_SINGLE		},
195cdf0e10cSrcweir 	{ sCSS1_PV_inset, 		CSS1_BS_SINGLE		},
196cdf0e10cSrcweir 	{ sCSS1_PV_outset, 		CSS1_BS_SINGLE		},
197cdf0e10cSrcweir 	{ 0,					0					}
198cdf0e10cSrcweir };
199cdf0e10cSrcweir 
200cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aFloatTable[] =
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	{ sCSS1_PV_left,	SVX_ADJUST_LEFT			},
203cdf0e10cSrcweir 	{ sCSS1_PV_right,   SVX_ADJUST_RIGHT		},
204cdf0e10cSrcweir 	{ sCSS1_PV_none,   	SVX_ADJUST_END			},
205cdf0e10cSrcweir 	{ 0,				0		  				}
206cdf0e10cSrcweir };
207cdf0e10cSrcweir 
208cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aPositionTable[] =
209cdf0e10cSrcweir {
210cdf0e10cSrcweir 	{ sCSS1_PV_absolute,	SVX_CSS1_POS_ABSOLUTE	},
211cdf0e10cSrcweir 	{ sCSS1_PV_relative,	SVX_CSS1_POS_RELATIVE	},
212cdf0e10cSrcweir 	{ sCSS1_PV_static,		SVX_CSS1_POS_STATIC		},
213cdf0e10cSrcweir 	{ 0,					0		  				}
214cdf0e10cSrcweir };
215cdf0e10cSrcweir 
216cdf0e10cSrcweir // Feature: PrintExt
217cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aSizeTable[] =
218cdf0e10cSrcweir {
219cdf0e10cSrcweir 	{ sCSS1_PV_auto,		SVX_CSS1_STYPE_AUTO			},
220cdf0e10cSrcweir 	{ sCSS1_PV_landscape,	SVX_CSS1_STYPE_LANDSCAPE	},
221cdf0e10cSrcweir 	{ sCSS1_PV_portrait,	SVX_CSS1_STYPE_PORTRAIT		},
222cdf0e10cSrcweir 	{ 0,					0		  					}
223cdf0e10cSrcweir };
224cdf0e10cSrcweir 
225cdf0e10cSrcweir static CSS1PropertyEnum __READONLY_DATA aPageBreakTable[] =
226cdf0e10cSrcweir {
227cdf0e10cSrcweir 	{ sCSS1_PV_auto,		SVX_CSS1_PBREAK_AUTO		},
228cdf0e10cSrcweir 	{ sCSS1_PV_always,		SVX_CSS1_PBREAK_ALWAYS		},
229cdf0e10cSrcweir 	{ sCSS1_PV_avoid,		SVX_CSS1_PBREAK_AVOID		},
230cdf0e10cSrcweir 	{ sCSS1_PV_left,		SVX_CSS1_PBREAK_LEFT		},
231cdf0e10cSrcweir 	{ sCSS1_PV_right,		SVX_CSS1_PBREAK_RIGHT		},
232cdf0e10cSrcweir 	{ 0,					0		  					}
233cdf0e10cSrcweir };
234cdf0e10cSrcweir 
235cdf0e10cSrcweir // /Feature: PrintExt
236cdf0e10cSrcweir 
237cdf0e10cSrcweir /*  */
238cdf0e10cSrcweir 
239cdf0e10cSrcweir // Ein Eintrag besteht aus vier USHORTs. Der erste ist die Gesamtbreite,
240cdf0e10cSrcweir // die anderen sind die 3 Einzelbreiten
241cdf0e10cSrcweir 
242cdf0e10cSrcweir #define SBORDER_ENTRY( n ) \
243cdf0e10cSrcweir 	DEF_LINE_WIDTH_##n, DEF_LINE_WIDTH_##n, 0, 0
244cdf0e10cSrcweir 
245cdf0e10cSrcweir #define DBORDER_ENTRY( n ) \
246cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_OUT + DEF_DOUBLE_LINE##n##_IN + \
247cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_DIST, \
248cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_OUT, \
249cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_IN, \
250cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_DIST
251cdf0e10cSrcweir 
252cdf0e10cSrcweir #define TDBORDER_ENTRY( n ) \
253cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_OUT, \
254cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_OUT, \
255cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_IN, \
256cdf0e10cSrcweir 	DEF_DOUBLE_LINE##n##_DIST
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 
259cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aSBorderWidths[] =
260cdf0e10cSrcweir {
261cdf0e10cSrcweir 	SBORDER_ENTRY( 0 ), SBORDER_ENTRY( 1 ), SBORDER_ENTRY( 2 ),
262cdf0e10cSrcweir 	SBORDER_ENTRY( 3 ), SBORDER_ENTRY( 4 )
263cdf0e10cSrcweir };
264cdf0e10cSrcweir 
265cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aDBorderWidths[] =
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	DBORDER_ENTRY( 0 ),
268cdf0e10cSrcweir 	DBORDER_ENTRY( 7 ),
269cdf0e10cSrcweir 	DBORDER_ENTRY( 1 ),
270cdf0e10cSrcweir 	DBORDER_ENTRY( 8 ),
271cdf0e10cSrcweir 	DBORDER_ENTRY( 4 ),
272cdf0e10cSrcweir 	DBORDER_ENTRY( 9 ),
273cdf0e10cSrcweir 	DBORDER_ENTRY( 3 ),
274cdf0e10cSrcweir 	DBORDER_ENTRY( 10 ),
275cdf0e10cSrcweir 	DBORDER_ENTRY( 2 ),
276cdf0e10cSrcweir 	DBORDER_ENTRY( 5 )
277cdf0e10cSrcweir };
278cdf0e10cSrcweir 
279cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aTDBorderWidths[] =
280cdf0e10cSrcweir {
281cdf0e10cSrcweir 	TDBORDER_ENTRY( 7 ), TDBORDER_ENTRY( 8 ), TDBORDER_ENTRY( 9 ),
282cdf0e10cSrcweir 	TDBORDER_ENTRY( 10 )
283cdf0e10cSrcweir };
284cdf0e10cSrcweir 
285cdf0e10cSrcweir #undef SBORDER_ENTRY
286cdf0e10cSrcweir #undef DBORDER_ENTRY
287cdf0e10cSrcweir 
288cdf0e10cSrcweir /*  */
289cdf0e10cSrcweir 
290cdf0e10cSrcweir struct SvxCSS1ItemIds
291cdf0e10cSrcweir {
292cdf0e10cSrcweir 	sal_uInt16 nFont;
293cdf0e10cSrcweir 	sal_uInt16 nFontCJK;
294cdf0e10cSrcweir 	sal_uInt16 nFontCTL;
295cdf0e10cSrcweir 	sal_uInt16 nPosture;
296cdf0e10cSrcweir 	sal_uInt16 nPostureCJK;
297cdf0e10cSrcweir 	sal_uInt16 nPostureCTL;
298cdf0e10cSrcweir 	sal_uInt16 nWeight;
299cdf0e10cSrcweir 	sal_uInt16 nWeightCJK;
300cdf0e10cSrcweir 	sal_uInt16 nWeightCTL;
301cdf0e10cSrcweir 	sal_uInt16 nFontHeight;
302cdf0e10cSrcweir 	sal_uInt16 nFontHeightCJK;
303cdf0e10cSrcweir 	sal_uInt16 nFontHeightCTL;
304cdf0e10cSrcweir 	sal_uInt16 nUnderline;
305cdf0e10cSrcweir 	sal_uInt16 nOverline;
306cdf0e10cSrcweir 	sal_uInt16 nCrossedOut;
307cdf0e10cSrcweir 	sal_uInt16 nColor;
308cdf0e10cSrcweir 	sal_uInt16 nKerning;
309cdf0e10cSrcweir 	sal_uInt16 nCaseMap;
310cdf0e10cSrcweir 	sal_uInt16 nBlink;
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	sal_uInt16 nLineSpacing;
313cdf0e10cSrcweir 	sal_uInt16 nAdjust;
314cdf0e10cSrcweir 	sal_uInt16 nWidows;
315cdf0e10cSrcweir 	sal_uInt16 nOrphans;
316cdf0e10cSrcweir 	sal_uInt16 nFmtSplit;
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 	sal_uInt16 nLRSpace;
319cdf0e10cSrcweir 	sal_uInt16 nULSpace;
320cdf0e10cSrcweir 	sal_uInt16 nBox;
321cdf0e10cSrcweir 	sal_uInt16 nBrush;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	sal_uInt16 nLanguage;
324cdf0e10cSrcweir 	sal_uInt16 nLanguageCJK;
325cdf0e10cSrcweir 	sal_uInt16 nLanguageCTL;
326cdf0e10cSrcweir 	sal_uInt16 nDirection;
327cdf0e10cSrcweir };
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 
330cdf0e10cSrcweir static SvxCSS1ItemIds aItemIds;
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 
333cdf0e10cSrcweir /*  */
334cdf0e10cSrcweir 
335cdf0e10cSrcweir struct SvxCSS1BorderInfo
336cdf0e10cSrcweir {
337cdf0e10cSrcweir 	Color aColor;
338cdf0e10cSrcweir 	sal_uInt16 nAbsWidth;
339cdf0e10cSrcweir 	sal_uInt16 nNamedWidth;
340cdf0e10cSrcweir 	CSS1BorderStyle eStyle;
341cdf0e10cSrcweir 
SvxCSS1BorderInfoSvxCSS1BorderInfo342cdf0e10cSrcweir 	SvxCSS1BorderInfo() :
343cdf0e10cSrcweir 		aColor( COL_BLACK ), nAbsWidth( USHRT_MAX ),
344cdf0e10cSrcweir 		nNamedWidth( USHRT_MAX ), eStyle( CSS1_BS_NONE )
345cdf0e10cSrcweir 	{}
346cdf0e10cSrcweir 
SvxCSS1BorderInfoSvxCSS1BorderInfo347cdf0e10cSrcweir 	SvxCSS1BorderInfo( const SvxCSS1BorderInfo& rInfo ) :
348cdf0e10cSrcweir 		aColor( rInfo.aColor ), nAbsWidth( rInfo.nAbsWidth ),
349cdf0e10cSrcweir 		nNamedWidth( rInfo.nNamedWidth ), eStyle( rInfo.eStyle )
350cdf0e10cSrcweir 	{}
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	void SetBorderLine( sal_uInt16 nLine, SvxBoxItem &rBoxItem ) const;
353cdf0e10cSrcweir };
354cdf0e10cSrcweir 
SetBorderLine(sal_uInt16 nLine,SvxBoxItem & rBoxItem) const355cdf0e10cSrcweir void SvxCSS1BorderInfo::SetBorderLine( sal_uInt16 nLine, SvxBoxItem &rBoxItem ) const
356cdf0e10cSrcweir {
357cdf0e10cSrcweir 	if( CSS1_BS_NONE==eStyle || nAbsWidth==0 ||
358cdf0e10cSrcweir 		(nAbsWidth==USHRT_MAX && nNamedWidth==USHRT_MAX) )
359cdf0e10cSrcweir 	{
360cdf0e10cSrcweir 		rBoxItem.SetLine( 0, nLine );
361cdf0e10cSrcweir 		return;
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 	SvxBorderLine aBorderLine( &aColor );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	// Linien-Stil doppelt oder einfach?
367cdf0e10cSrcweir 	sal_Bool bDouble = eStyle == CSS1_BS_DOUBLE;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 	// benannte Breite umrechnenen, wenn keine absolute gegeben ist
370cdf0e10cSrcweir 	if( nAbsWidth==USHRT_MAX )
371cdf0e10cSrcweir 	{
372cdf0e10cSrcweir 		const sal_uInt16 *aWidths = bDouble ? aDBorderWidths : aSBorderWidths;
373cdf0e10cSrcweir 		sal_uInt16 nNWidth = nNamedWidth * 4;
374cdf0e10cSrcweir 		aBorderLine.SetOutWidth( aWidths[nNWidth+1] );
375cdf0e10cSrcweir 		aBorderLine.SetInWidth( aWidths[nNWidth+2] );
376cdf0e10cSrcweir 		aBorderLine.SetDistance( aWidths[nNWidth+3] );
377cdf0e10cSrcweir 	}
378cdf0e10cSrcweir 	else
379cdf0e10cSrcweir 	{
380cdf0e10cSrcweir 		SvxCSS1Parser::SetBorderWidth( aBorderLine, nAbsWidth, bDouble );
381cdf0e10cSrcweir 	}
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 	rBoxItem.SetLine( &aBorderLine, nLine );
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 
387cdf0e10cSrcweir /*  */
388cdf0e10cSrcweir 
SvxCSS1PropertyInfo()389cdf0e10cSrcweir SvxCSS1PropertyInfo::SvxCSS1PropertyInfo()
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<4; i++ )
392cdf0e10cSrcweir 		aBorderInfos[i] = 0;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 	Clear();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir 
SvxCSS1PropertyInfo(const SvxCSS1PropertyInfo & rProp)397cdf0e10cSrcweir SvxCSS1PropertyInfo::SvxCSS1PropertyInfo( const SvxCSS1PropertyInfo& rProp ) :
398cdf0e10cSrcweir 	aId( rProp.aId ),
399cdf0e10cSrcweir 	bTopMargin( rProp.bTopMargin ),
400cdf0e10cSrcweir 	bBottomMargin( rProp.bBottomMargin ),
401cdf0e10cSrcweir 	bLeftMargin( rProp.bLeftMargin ),
402cdf0e10cSrcweir 	bRightMargin( rProp.bRightMargin ),
403cdf0e10cSrcweir 	bTextIndent( rProp.bTextIndent ),
404cdf0e10cSrcweir 	eFloat( rProp.eFloat ),
405cdf0e10cSrcweir 	ePosition( rProp.ePosition ),
406cdf0e10cSrcweir 	nTopBorderDistance( rProp.nTopBorderDistance ),
407cdf0e10cSrcweir 	nBottomBorderDistance( rProp.nBottomBorderDistance ),
408cdf0e10cSrcweir 	nLeftBorderDistance( rProp.nLeftBorderDistance ),
409cdf0e10cSrcweir 	nRightBorderDistance( rProp.nRightBorderDistance ),
410cdf0e10cSrcweir 	nLeft( rProp.nLeft ),
411cdf0e10cSrcweir 	nTop( rProp.nTop ),
412cdf0e10cSrcweir 	nWidth( rProp.nWidth ),
413cdf0e10cSrcweir 	nHeight( rProp.nHeight ),
414cdf0e10cSrcweir 	nLeftMargin( rProp.nLeftMargin ),
415cdf0e10cSrcweir 	nRightMargin( rProp.nRightMargin ),
416cdf0e10cSrcweir 	eLeftType( rProp.eLeftType ),
417cdf0e10cSrcweir 	eTopType( rProp.eTopType ),
418cdf0e10cSrcweir 	eWidthType( rProp.eWidthType ),
419cdf0e10cSrcweir 	eHeightType( rProp.eHeightType ),
420cdf0e10cSrcweir // Feature: PrintExt
421cdf0e10cSrcweir 	eSizeType( rProp.eSizeType ),
422cdf0e10cSrcweir 	ePageBreakBefore( rProp.ePageBreakBefore ),
423cdf0e10cSrcweir 	ePageBreakAfter( rProp.ePageBreakAfter )
424cdf0e10cSrcweir // /Feature: PrintExt
425cdf0e10cSrcweir {
426cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<4; i++ )
427cdf0e10cSrcweir 		aBorderInfos[i] = rProp.aBorderInfos[i]
428cdf0e10cSrcweir 							? new SvxCSS1BorderInfo( *rProp.aBorderInfos[i] )
429cdf0e10cSrcweir 							: 0;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir 
~SvxCSS1PropertyInfo()432cdf0e10cSrcweir SvxCSS1PropertyInfo::~SvxCSS1PropertyInfo()
433cdf0e10cSrcweir {
434cdf0e10cSrcweir 	DestroyBorderInfos();
435cdf0e10cSrcweir }
436cdf0e10cSrcweir 
DestroyBorderInfos()437cdf0e10cSrcweir void SvxCSS1PropertyInfo::DestroyBorderInfos()
438cdf0e10cSrcweir {
439cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<4; i++ )
440cdf0e10cSrcweir 	{
441cdf0e10cSrcweir 		delete aBorderInfos[i];
442cdf0e10cSrcweir 		aBorderInfos[i] = 0;
443cdf0e10cSrcweir 	}
444cdf0e10cSrcweir }
445cdf0e10cSrcweir 
Clear()446cdf0e10cSrcweir void SvxCSS1PropertyInfo::Clear()
447cdf0e10cSrcweir {
448cdf0e10cSrcweir 	aId.Erase();
449cdf0e10cSrcweir 	bTopMargin = bBottomMargin = sal_False;
450cdf0e10cSrcweir 	bLeftMargin = bRightMargin = bTextIndent = sal_False;
451cdf0e10cSrcweir 	nLeftMargin = nRightMargin = 0;
452cdf0e10cSrcweir 	eFloat = SVX_ADJUST_END;
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 	ePosition = SVX_CSS1_POS_NONE;
455cdf0e10cSrcweir 	nTopBorderDistance = nBottomBorderDistance =
456cdf0e10cSrcweir 	nLeftBorderDistance = nRightBorderDistance = USHRT_MAX;
457cdf0e10cSrcweir 	nLeft = nTop = nWidth = nHeight = 0;
458cdf0e10cSrcweir 	eLeftType = eTopType = eWidthType = eHeightType = SVX_CSS1_LTYPE_NONE;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir // Feature: PrintExt
461cdf0e10cSrcweir 	eSizeType = SVX_CSS1_STYPE_NONE;
462cdf0e10cSrcweir 	ePageBreakBefore = SVX_CSS1_PBREAK_NONE;
463cdf0e10cSrcweir 	ePageBreakAfter = SVX_CSS1_PBREAK_NONE;
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 	DestroyBorderInfos();
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
Merge(const SvxCSS1PropertyInfo & rProp)468cdf0e10cSrcweir void SvxCSS1PropertyInfo::Merge( const SvxCSS1PropertyInfo& rProp )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir 	if( rProp.bTopMargin )
471cdf0e10cSrcweir 		bTopMargin = sal_True;
472cdf0e10cSrcweir 	if( rProp.bBottomMargin )
473cdf0e10cSrcweir 		bBottomMargin = sal_True;
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	if( rProp.bLeftMargin )
476cdf0e10cSrcweir 	{
477cdf0e10cSrcweir 		bLeftMargin = sal_True;
478cdf0e10cSrcweir 		nLeftMargin = rProp.nLeftMargin;
479cdf0e10cSrcweir 	}
480cdf0e10cSrcweir 	if( rProp.bRightMargin )
481cdf0e10cSrcweir 	{
482cdf0e10cSrcweir 		bRightMargin = sal_True;
483cdf0e10cSrcweir 		nRightMargin = rProp.nRightMargin;
484cdf0e10cSrcweir 	}
485cdf0e10cSrcweir 	if( rProp.bTextIndent )
486cdf0e10cSrcweir 		bTextIndent = sal_True;
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<4; i++ )
489cdf0e10cSrcweir 	{
490cdf0e10cSrcweir 		if( rProp.aBorderInfos[i] )
491cdf0e10cSrcweir 		{
492cdf0e10cSrcweir 			if( aBorderInfos[i] )
493cdf0e10cSrcweir 				delete aBorderInfos[i];
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 			aBorderInfos[i] = new SvxCSS1BorderInfo( *rProp.aBorderInfos[i] );
496cdf0e10cSrcweir 		}
497cdf0e10cSrcweir 	}
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 	if( USHRT_MAX != rProp.nTopBorderDistance )
500cdf0e10cSrcweir 		nTopBorderDistance = rProp.nTopBorderDistance;
501cdf0e10cSrcweir 	if( USHRT_MAX != rProp.nBottomBorderDistance )
502cdf0e10cSrcweir 		nBottomBorderDistance = rProp.nBottomBorderDistance;
503cdf0e10cSrcweir 	if( USHRT_MAX != rProp.nLeftBorderDistance )
504cdf0e10cSrcweir 		nLeftBorderDistance = rProp.nLeftBorderDistance;
505cdf0e10cSrcweir 	if( USHRT_MAX != rProp.nRightBorderDistance )
506cdf0e10cSrcweir 		nRightBorderDistance = rProp.nRightBorderDistance;
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 	if( rProp.eFloat != SVX_ADJUST_END )
509cdf0e10cSrcweir 		eFloat = rProp.eFloat;
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 	if( rProp.ePosition != SVX_CSS1_POS_NONE )
512cdf0e10cSrcweir 		ePosition = rProp.ePosition;
513cdf0e10cSrcweir 
514cdf0e10cSrcweir // Feature: PrintExt
515cdf0e10cSrcweir 	if( rProp.eSizeType != SVX_CSS1_STYPE_NONE )
516cdf0e10cSrcweir 	{
517cdf0e10cSrcweir 		eSizeType = rProp.eSizeType;
518cdf0e10cSrcweir 		nWidth = rProp.nWidth;
519cdf0e10cSrcweir 		nHeight = rProp.nHeight;
520cdf0e10cSrcweir 	}
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	if( rProp.ePageBreakBefore != SVX_CSS1_PBREAK_NONE )
523cdf0e10cSrcweir 		ePageBreakBefore = rProp.ePageBreakBefore;
524cdf0e10cSrcweir 
525cdf0e10cSrcweir 	if( rProp.ePageBreakAfter != SVX_CSS1_PBREAK_NONE )
526cdf0e10cSrcweir 		ePageBreakAfter = rProp.ePageBreakAfter;
527cdf0e10cSrcweir 
528cdf0e10cSrcweir // /Feature: PrintExt
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 	if( rProp.eLeftType != SVX_CSS1_LTYPE_NONE )
531cdf0e10cSrcweir 	{
532cdf0e10cSrcweir 		eLeftType = rProp.eLeftType;
533cdf0e10cSrcweir 		nLeft = rProp.nLeft;
534cdf0e10cSrcweir 	}
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 	if( rProp.eTopType != SVX_CSS1_LTYPE_NONE )
537cdf0e10cSrcweir 	{
538cdf0e10cSrcweir 		eTopType = rProp.eTopType;
539cdf0e10cSrcweir 		nTop = rProp.nTop;
540cdf0e10cSrcweir 	}
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 	if( rProp.eWidthType != SVX_CSS1_LTYPE_NONE )
543cdf0e10cSrcweir 	{
544cdf0e10cSrcweir 		eWidthType = rProp.eWidthType;
545cdf0e10cSrcweir 		nWidth = rProp.nWidth;
546cdf0e10cSrcweir 	}
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	if( rProp.eHeightType != SVX_CSS1_LTYPE_NONE )
549cdf0e10cSrcweir 	{
550cdf0e10cSrcweir 		eHeightType = rProp.eHeightType;
551cdf0e10cSrcweir 		nHeight = rProp.nHeight;
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
GetBorderInfo(sal_uInt16 nLine,sal_Bool bCreate)555cdf0e10cSrcweir SvxCSS1BorderInfo *SvxCSS1PropertyInfo::GetBorderInfo( sal_uInt16 nLine, sal_Bool bCreate )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir 	sal_uInt16 nPos = 0;
558cdf0e10cSrcweir 	switch( nLine )
559cdf0e10cSrcweir 	{
560cdf0e10cSrcweir 	case BOX_LINE_TOP:		nPos = 0;	break;
561cdf0e10cSrcweir 	case BOX_LINE_BOTTOM:	nPos = 1;	break;
562cdf0e10cSrcweir 	case BOX_LINE_LEFT:		nPos = 2;	break;
563cdf0e10cSrcweir 	case BOX_LINE_RIGHT:	nPos = 3;	break;
564cdf0e10cSrcweir 	}
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	if( !aBorderInfos[nPos] && bCreate )
567cdf0e10cSrcweir 		aBorderInfos[nPos] = new SvxCSS1BorderInfo;
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	return aBorderInfos[nPos];
570cdf0e10cSrcweir }
571cdf0e10cSrcweir 
CopyBorderInfo(sal_uInt16 nSrcLine,sal_uInt16 nDstLine,sal_uInt16 nWhat)572cdf0e10cSrcweir void SvxCSS1PropertyInfo::CopyBorderInfo( sal_uInt16 nSrcLine, sal_uInt16 nDstLine,
573cdf0e10cSrcweir 										  sal_uInt16 nWhat )
574cdf0e10cSrcweir {
575cdf0e10cSrcweir 	SvxCSS1BorderInfo *pSrcInfo = GetBorderInfo( nSrcLine, sal_False );
576cdf0e10cSrcweir 	if( !pSrcInfo )
577cdf0e10cSrcweir 		return;
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	SvxCSS1BorderInfo *pDstInfo = GetBorderInfo( nDstLine );
580cdf0e10cSrcweir 	if( (nWhat & SVX_CSS1_BORDERINFO_WIDTH) != 0 )
581cdf0e10cSrcweir 	{
582cdf0e10cSrcweir 		pDstInfo->nAbsWidth = pSrcInfo->nAbsWidth;
583cdf0e10cSrcweir 		pDstInfo->nNamedWidth = pSrcInfo->nNamedWidth;
584cdf0e10cSrcweir 	}
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 	if( (nWhat & SVX_CSS1_BORDERINFO_COLOR) != 0 )
587cdf0e10cSrcweir 		pDstInfo->aColor = pSrcInfo->aColor;
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 	if( (nWhat & SVX_CSS1_BORDERINFO_STYLE) != 0 )
590cdf0e10cSrcweir 		pDstInfo->eStyle = pSrcInfo->eStyle;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir 
CopyBorderInfo(sal_uInt16 nCount,sal_uInt16 nWhat)593cdf0e10cSrcweir void SvxCSS1PropertyInfo::CopyBorderInfo( sal_uInt16 nCount, sal_uInt16 nWhat )
594cdf0e10cSrcweir {
595cdf0e10cSrcweir 	if( nCount==0 )
596cdf0e10cSrcweir 	{
597cdf0e10cSrcweir 		CopyBorderInfo( BOX_LINE_BOTTOM, BOX_LINE_TOP, nWhat );
598cdf0e10cSrcweir 		CopyBorderInfo( BOX_LINE_TOP, BOX_LINE_LEFT, nWhat );
599cdf0e10cSrcweir 	}
600cdf0e10cSrcweir 	if( nCount<=1 )
601cdf0e10cSrcweir 	{
602cdf0e10cSrcweir 		CopyBorderInfo( BOX_LINE_LEFT, BOX_LINE_RIGHT, nWhat );
603cdf0e10cSrcweir 	}
604cdf0e10cSrcweir }
605cdf0e10cSrcweir 
SetBoxItem(SfxItemSet & rItemSet,sal_uInt16 nMinBorderDist,const SvxBoxItem * pDfltItem,sal_Bool bTable)606cdf0e10cSrcweir void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet,
607cdf0e10cSrcweir 									  sal_uInt16 nMinBorderDist,
608cdf0e10cSrcweir 									  const SvxBoxItem *pDfltItem,
609cdf0e10cSrcweir 									  sal_Bool bTable )
610cdf0e10cSrcweir {
611cdf0e10cSrcweir 	sal_Bool bChg = nTopBorderDistance != USHRT_MAX ||
612cdf0e10cSrcweir 				nBottomBorderDistance != USHRT_MAX ||
613cdf0e10cSrcweir 				nLeftBorderDistance != USHRT_MAX ||
614cdf0e10cSrcweir 				nRightBorderDistance != USHRT_MAX;
615cdf0e10cSrcweir 	sal_uInt16 i;
616cdf0e10cSrcweir 
617cdf0e10cSrcweir 	for( i = 0; !bChg && i < 4; i++ )
618cdf0e10cSrcweir 		bChg = aBorderInfos[i]!=0;
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 	if( !bChg )
621cdf0e10cSrcweir 		return;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 	SvxBoxItem aBoxItem( aItemIds.nBox );
624cdf0e10cSrcweir 	if( pDfltItem )
625cdf0e10cSrcweir 		aBoxItem = *pDfltItem;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	SvxCSS1BorderInfo *pInfo = GetBorderInfo( BOX_LINE_TOP, sal_False );
628cdf0e10cSrcweir 	if( pInfo )
629cdf0e10cSrcweir 		pInfo->SetBorderLine( BOX_LINE_TOP, aBoxItem );
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 	pInfo = GetBorderInfo( BOX_LINE_BOTTOM, sal_False );
632cdf0e10cSrcweir 	if( pInfo )
633cdf0e10cSrcweir 		pInfo->SetBorderLine( BOX_LINE_BOTTOM, aBoxItem );
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 	pInfo = GetBorderInfo( BOX_LINE_LEFT, sal_False );
636cdf0e10cSrcweir 	if( pInfo )
637cdf0e10cSrcweir 		pInfo->SetBorderLine( BOX_LINE_LEFT, aBoxItem );
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 	pInfo = GetBorderInfo( BOX_LINE_RIGHT, sal_False );
640cdf0e10cSrcweir 	if( pInfo )
641cdf0e10cSrcweir 		pInfo->SetBorderLine( BOX_LINE_RIGHT, aBoxItem );
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 	for( i=0; i<4; i++ )
644cdf0e10cSrcweir 	{
645cdf0e10cSrcweir 		sal_uInt16 nLine = BOX_LINE_TOP, nDist = 0;
646cdf0e10cSrcweir 		switch( i )
647cdf0e10cSrcweir 		{
648cdf0e10cSrcweir 		case 0: nLine = BOX_LINE_TOP;
649cdf0e10cSrcweir 				nDist = nTopBorderDistance;
650cdf0e10cSrcweir 				nTopBorderDistance = USHRT_MAX;
651cdf0e10cSrcweir 				break;
652cdf0e10cSrcweir 		case 1: nLine = BOX_LINE_BOTTOM;
653cdf0e10cSrcweir 				nDist = nBottomBorderDistance;
654cdf0e10cSrcweir 				nBottomBorderDistance = USHRT_MAX;
655cdf0e10cSrcweir 				break;
656cdf0e10cSrcweir 		case 2: nLine = BOX_LINE_LEFT;
657cdf0e10cSrcweir 				nDist = nLeftBorderDistance;
658cdf0e10cSrcweir 				nLeftBorderDistance = USHRT_MAX;
659cdf0e10cSrcweir 				break;
660cdf0e10cSrcweir 		case 3: nLine = BOX_LINE_RIGHT;
661cdf0e10cSrcweir 				nDist = nRightBorderDistance;
662cdf0e10cSrcweir 				nRightBorderDistance = USHRT_MAX;
663cdf0e10cSrcweir 				break;
664cdf0e10cSrcweir 		}
665cdf0e10cSrcweir 
666cdf0e10cSrcweir 		if( aBoxItem.GetLine( nLine ) )
667cdf0e10cSrcweir 		{
668cdf0e10cSrcweir 			if( USHRT_MAX == nDist )
669cdf0e10cSrcweir 				nDist = aBoxItem.GetDistance( nLine );
670cdf0e10cSrcweir 
671cdf0e10cSrcweir 			if( nDist < nMinBorderDist )
672cdf0e10cSrcweir 				nDist = nMinBorderDist;
673cdf0e10cSrcweir 		}
674cdf0e10cSrcweir 		else
675cdf0e10cSrcweir 		{
676cdf0e10cSrcweir 			if( USHRT_MAX == nDist )
677cdf0e10cSrcweir 				nDist = aBoxItem.GetDistance( nLine );
678cdf0e10cSrcweir 
679cdf0e10cSrcweir 			if( !bTable )
680cdf0e10cSrcweir 				nDist = 0U;
681cdf0e10cSrcweir 			else if( nDist && nDist < nMinBorderDist )
682cdf0e10cSrcweir 				nDist = nMinBorderDist;
683cdf0e10cSrcweir 		}
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 		aBoxItem.SetDistance( nDist, nLine );
686cdf0e10cSrcweir 	}
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 	rItemSet.Put( aBoxItem );
689cdf0e10cSrcweir 
690cdf0e10cSrcweir 	DestroyBorderInfos();
691cdf0e10cSrcweir }
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 
694cdf0e10cSrcweir /*  */
695cdf0e10cSrcweir 
SvxCSS1MapEntry(const String & rKey,const SfxItemSet & rItemSet,const SvxCSS1PropertyInfo & rProp)696cdf0e10cSrcweir SvxCSS1MapEntry::SvxCSS1MapEntry( const String& rKey, const SfxItemSet& rItemSet,
697cdf0e10cSrcweir 								  const SvxCSS1PropertyInfo& rProp ) :
698cdf0e10cSrcweir 	aKey( rKey ),
699cdf0e10cSrcweir 	aItemSet( rItemSet ),
700cdf0e10cSrcweir 	aPropInfo( rProp )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir 	// TODO: ToUpperAscii
703cdf0e10cSrcweir 	aKey.ToUpperAscii();
704cdf0e10cSrcweir }
705cdf0e10cSrcweir 
706cdf0e10cSrcweir #if defined( ICC ) || defined( BLC )
operator ==(const SvxCSS1MapEntry & rE1,const SvxCSS1MapEntry & rE2)707cdf0e10cSrcweir sal_Bool operator==( const SvxCSS1MapEntry& rE1, const SvxCSS1MapEntry& rE2 )
708cdf0e10cSrcweir {
709cdf0e10cSrcweir 	return  rE1.aKey==rE2.aKey;
710cdf0e10cSrcweir }
711cdf0e10cSrcweir 
operator <(const SvxCSS1MapEntry & rE1,const SvxCSS1MapEntry & rE2)712cdf0e10cSrcweir sal_Bool operator<( const SvxCSS1MapEntry& rE1,	const SvxCSS1MapEntry& rE2 )
713cdf0e10cSrcweir {
714cdf0e10cSrcweir 	return  rE1.aKey<rE2.aKey;
715cdf0e10cSrcweir }
716cdf0e10cSrcweir #endif
717cdf0e10cSrcweir 
SV_IMPL_OP_PTRARR_SORT(SvxCSS1Map,SvxCSS1MapEntryPtr)718cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT( SvxCSS1Map, SvxCSS1MapEntryPtr )
719cdf0e10cSrcweir 
720cdf0e10cSrcweir /*  */
721cdf0e10cSrcweir 
722cdf0e10cSrcweir sal_Bool SvxCSS1Parser::StyleParsed( const CSS1Selector * /*pSelector*/,
723cdf0e10cSrcweir 								 SfxItemSet& /*rItemSet*/,
724cdf0e10cSrcweir 								 SvxCSS1PropertyInfo& /*rPropInfo*/ )
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	// wie man sieht passiert hier gar nichts
727cdf0e10cSrcweir 	return sal_True;
728cdf0e10cSrcweir }
729cdf0e10cSrcweir 
SelectorParsed(const CSS1Selector * pSelector,sal_Bool bFirst)730cdf0e10cSrcweir sal_Bool SvxCSS1Parser::SelectorParsed( const CSS1Selector *pSelector,
731cdf0e10cSrcweir 									sal_Bool bFirst )
732cdf0e10cSrcweir {
733cdf0e10cSrcweir 	if( bFirst )
734cdf0e10cSrcweir 	{
735cdf0e10cSrcweir 		DBG_ASSERT( pSheetItemSet, "Wo ist der Item-Set fuer Style-Sheets?" );
736cdf0e10cSrcweir 
737cdf0e10cSrcweir 		// Dieses ist der erste Selektor einer Rule, also muessen
738cdf0e10cSrcweir 		// die bisher geparsten Items auf die Styles verteilt werden
739cdf0e10cSrcweir //		pSheetPropInfo->CreateBoxItem( *pSheetItemSet, GetDfltBorderDist() );
740cdf0e10cSrcweir 		for( sal_uInt16 i=0; i<aSelectors.Count(); i++ )
741cdf0e10cSrcweir 		{
742cdf0e10cSrcweir 			StyleParsed( aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
743cdf0e10cSrcweir 		}
744cdf0e10cSrcweir 		pSheetItemSet->ClearItem();
745cdf0e10cSrcweir 		pSheetPropInfo->Clear();
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 		// und die naechste Rule vorbereiten
748cdf0e10cSrcweir 		if( aSelectors.Count() )
749cdf0e10cSrcweir 			aSelectors.DeleteAndDestroy( 0, aSelectors.Count() );
750cdf0e10cSrcweir 	}
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 	aSelectors.C40_INSERT( CSS1Selector, pSelector, aSelectors.Count() );
753cdf0e10cSrcweir 
754cdf0e10cSrcweir 	return sal_False; // den Selektor haben wir gespeichert. Loeschen toedlich!
755cdf0e10cSrcweir }
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 
DeclarationParsed(const String & rProperty,const CSS1Expression * pExpr)758cdf0e10cSrcweir sal_Bool SvxCSS1Parser::DeclarationParsed( const String& rProperty,
759cdf0e10cSrcweir 									   const CSS1Expression *pExpr )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "DeclarationParsed() ohne Expression" );
762cdf0e10cSrcweir 
763cdf0e10cSrcweir 	if( !pExpr )
764cdf0e10cSrcweir 		return sal_True;
765cdf0e10cSrcweir 
766cdf0e10cSrcweir 	ParseProperty( rProperty, pExpr );
767cdf0e10cSrcweir 
768cdf0e10cSrcweir 	return sal_True;	// die Deklaration brauchen wir nicht mehr. Loeschen!
769cdf0e10cSrcweir }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir /*  */
772cdf0e10cSrcweir 
SvxCSS1Parser(SfxItemPool & rPool,const String & rBaseURL,sal_uInt16 nMinFixLineSp,sal_uInt16 * pWhichIds,sal_uInt16 nWhichIds)773cdf0e10cSrcweir SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const String& rBaseURL, sal_uInt16 nMinFixLineSp,
774cdf0e10cSrcweir 							  sal_uInt16 *pWhichIds, sal_uInt16 nWhichIds ) :
775cdf0e10cSrcweir 	CSS1Parser(),
776cdf0e10cSrcweir     sBaseURL( rBaseURL ),
777cdf0e10cSrcweir 	pSheetItemSet(0),
778cdf0e10cSrcweir 	pItemSet(0),
779cdf0e10cSrcweir 	pSearchEntry( 0 ),
780cdf0e10cSrcweir 	nMinFixLineSpace( nMinFixLineSp ),
781cdf0e10cSrcweir 	eDfltEnc( RTL_TEXTENCODING_DONTKNOW ),
782cdf0e10cSrcweir 	nScriptFlags( CSS1_SCRIPT_ALL ),
783cdf0e10cSrcweir 	bIgnoreFontFamily( sal_False )
784cdf0e10cSrcweir {
785cdf0e10cSrcweir 	// Item-Ids auch initialisieren
786cdf0e10cSrcweir 	aItemIds.nFont = rPool.GetTrueWhich( SID_ATTR_CHAR_FONT, sal_False );
787cdf0e10cSrcweir 	aItemIds.nFontCJK = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONT, sal_False );
788cdf0e10cSrcweir 	aItemIds.nFontCTL = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONT, sal_False );
789cdf0e10cSrcweir 	aItemIds.nPosture = rPool.GetTrueWhich( SID_ATTR_CHAR_POSTURE, sal_False );
790cdf0e10cSrcweir 	aItemIds.nPostureCJK = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_POSTURE, sal_False );
791cdf0e10cSrcweir 	aItemIds.nPostureCTL = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_POSTURE, sal_False );
792cdf0e10cSrcweir 	aItemIds.nWeight = rPool.GetTrueWhich( SID_ATTR_CHAR_WEIGHT, sal_False );
793cdf0e10cSrcweir 	aItemIds.nWeightCJK = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_WEIGHT, sal_False );
794cdf0e10cSrcweir 	aItemIds.nWeightCTL = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_WEIGHT, sal_False );
795cdf0e10cSrcweir 	aItemIds.nFontHeight = rPool.GetTrueWhich( SID_ATTR_CHAR_FONTHEIGHT, sal_False );
796cdf0e10cSrcweir 	aItemIds.nFontHeightCJK = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT, sal_False );
797cdf0e10cSrcweir 	aItemIds.nFontHeightCTL = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT, sal_False );
798cdf0e10cSrcweir 	aItemIds.nUnderline = rPool.GetTrueWhich( SID_ATTR_CHAR_UNDERLINE, sal_False );
799cdf0e10cSrcweir 	aItemIds.nOverline = rPool.GetTrueWhich( SID_ATTR_CHAR_OVERLINE, sal_False );
800cdf0e10cSrcweir 	aItemIds.nCrossedOut = rPool.GetTrueWhich( SID_ATTR_CHAR_STRIKEOUT, sal_False );
801cdf0e10cSrcweir 	aItemIds.nColor = rPool.GetTrueWhich( SID_ATTR_CHAR_COLOR, sal_False );
802cdf0e10cSrcweir 	aItemIds.nKerning = rPool.GetTrueWhich( SID_ATTR_CHAR_KERNING, sal_False );
803cdf0e10cSrcweir 	aItemIds.nCaseMap = rPool.GetTrueWhich( SID_ATTR_CHAR_CASEMAP, sal_False );
804cdf0e10cSrcweir 	aItemIds.nBlink = rPool.GetTrueWhich( SID_ATTR_FLASH, sal_False );
805cdf0e10cSrcweir 
806cdf0e10cSrcweir 	aItemIds.nLineSpacing = rPool.GetTrueWhich( SID_ATTR_PARA_LINESPACE, sal_False );
807cdf0e10cSrcweir 	aItemIds.nAdjust = rPool.GetTrueWhich( SID_ATTR_PARA_ADJUST, sal_False );
808cdf0e10cSrcweir 	aItemIds.nWidows = rPool.GetTrueWhich( SID_ATTR_PARA_WIDOWS, sal_False );
809cdf0e10cSrcweir 	aItemIds.nOrphans = rPool.GetTrueWhich( SID_ATTR_PARA_ORPHANS, sal_False );
810cdf0e10cSrcweir 	aItemIds.nFmtSplit = rPool.GetTrueWhich( SID_ATTR_PARA_SPLIT, sal_False );
811cdf0e10cSrcweir 
812cdf0e10cSrcweir 	aItemIds.nLRSpace = rPool.GetTrueWhich( SID_ATTR_LRSPACE, sal_False );
813cdf0e10cSrcweir 	aItemIds.nULSpace = rPool.GetTrueWhich( SID_ATTR_ULSPACE, sal_False );
814cdf0e10cSrcweir 	aItemIds.nBox = rPool.GetTrueWhich( SID_ATTR_BORDER_OUTER, sal_False );
815cdf0e10cSrcweir 	aItemIds.nBrush = rPool.GetTrueWhich( SID_ATTR_BRUSH, sal_False );
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 	aItemIds.nLanguage = rPool.GetTrueWhich( SID_ATTR_CHAR_LANGUAGE, sal_False );
818cdf0e10cSrcweir 	aItemIds.nLanguageCJK = rPool.GetTrueWhich( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False );
819cdf0e10cSrcweir 	aItemIds.nLanguageCTL = rPool.GetTrueWhich( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False );
820cdf0e10cSrcweir 	aItemIds.nDirection = rPool.GetTrueWhich( SID_ATTR_FRAMEDIRECTION, sal_False );
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 	aWhichMap.Insert( (sal_uInt16)0, (sal_uInt16)0 );
823cdf0e10cSrcweir 	SvParser::BuildWhichTbl( aWhichMap, (sal_uInt16 *)&aItemIds,
824cdf0e10cSrcweir 							 sizeof(aItemIds) / sizeof(sal_uInt16) );
825cdf0e10cSrcweir 	if( pWhichIds && nWhichIds )
826cdf0e10cSrcweir 		SvParser::BuildWhichTbl( aWhichMap, pWhichIds, nWhichIds );
827cdf0e10cSrcweir 
828cdf0e10cSrcweir 	pSheetItemSet = new SfxItemSet( rPool, aWhichMap.GetData() );
829cdf0e10cSrcweir 	pSheetPropInfo = new SvxCSS1PropertyInfo;
830cdf0e10cSrcweir 	pSearchEntry = new SvxCSS1MapEntry( rPool, aWhichMap.GetData() );
831cdf0e10cSrcweir }
832cdf0e10cSrcweir 
~SvxCSS1Parser()833cdf0e10cSrcweir SvxCSS1Parser::~SvxCSS1Parser()
834cdf0e10cSrcweir {
835cdf0e10cSrcweir 	delete pSheetItemSet;
836cdf0e10cSrcweir 	delete pSheetPropInfo;
837cdf0e10cSrcweir 	delete pSearchEntry;
838cdf0e10cSrcweir }
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 
841cdf0e10cSrcweir /*  */
842cdf0e10cSrcweir 
ParseStyleSheet(const String & rIn)843cdf0e10cSrcweir sal_Bool SvxCSS1Parser::ParseStyleSheet( const String& rIn )
844cdf0e10cSrcweir {
845cdf0e10cSrcweir 	pItemSet = pSheetItemSet;
846cdf0e10cSrcweir 	pPropInfo = pSheetPropInfo;
847cdf0e10cSrcweir 
848cdf0e10cSrcweir 	sal_Bool bSuccess = CSS1Parser::ParseStyleSheet( rIn );
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 	// die bisher geparsten Items auf die Styles verteilt werden
851cdf0e10cSrcweir //	pSheetPropInfo->CreateBoxItem( *pSheetItemSet, GetDfltBorderDist() );
852cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<aSelectors.Count(); i++ )
853cdf0e10cSrcweir 	{
854cdf0e10cSrcweir 		StyleParsed( aSelectors[i], *pSheetItemSet, *pSheetPropInfo );
855cdf0e10cSrcweir 	}
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 	// und etwas aufrauemen
858cdf0e10cSrcweir 	if( aSelectors.Count() )
859cdf0e10cSrcweir 		aSelectors.DeleteAndDestroy( 0, aSelectors.Count() );
860cdf0e10cSrcweir 	pSheetItemSet->ClearItem();
861cdf0e10cSrcweir 	pSheetPropInfo->Clear();
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 	pItemSet = 0;
864cdf0e10cSrcweir 	pPropInfo = 0;
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 	return bSuccess;
867cdf0e10cSrcweir }
868cdf0e10cSrcweir 
ParseStyleOption(const String & rIn,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo)869cdf0e10cSrcweir sal_Bool SvxCSS1Parser::ParseStyleOption( const String& rIn,
870cdf0e10cSrcweir 									  SfxItemSet& rItemSet,
871cdf0e10cSrcweir 									  SvxCSS1PropertyInfo& rPropInfo )
872cdf0e10cSrcweir {
873cdf0e10cSrcweir 	pItemSet = &rItemSet;
874cdf0e10cSrcweir 	pPropInfo = &rPropInfo;
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 	sal_Bool bSuccess = CSS1Parser::ParseStyleOption( rIn );
877cdf0e10cSrcweir 	rItemSet.ClearItem( aItemIds.nDirection );
878cdf0e10cSrcweir //	pPropInfo->CreateBoxItem( *pItemSet, GetDfltBorderDist() );
879cdf0e10cSrcweir 
880cdf0e10cSrcweir 	pItemSet = 0;
881cdf0e10cSrcweir 	pPropInfo = 0;
882cdf0e10cSrcweir 
883cdf0e10cSrcweir 	return bSuccess;
884cdf0e10cSrcweir }
885cdf0e10cSrcweir 
886cdf0e10cSrcweir /*  */
887cdf0e10cSrcweir 
GetEnum(const CSS1PropertyEnum * pPropTable,const String & rValue,sal_uInt16 & rEnum)888cdf0e10cSrcweir sal_Bool SvxCSS1Parser::GetEnum( const CSS1PropertyEnum *pPropTable,
889cdf0e10cSrcweir 						  const String &rValue, sal_uInt16& rEnum )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir 	String aValue( rValue );
892cdf0e10cSrcweir 	aValue.ToLowerAscii();
893cdf0e10cSrcweir 	while( pPropTable->pName )
894cdf0e10cSrcweir 	{
895cdf0e10cSrcweir 		if( !rValue.EqualsIgnoreCaseAscii( pPropTable->pName ) )
896cdf0e10cSrcweir 			pPropTable++;
897cdf0e10cSrcweir 		else
898cdf0e10cSrcweir 			break;
899cdf0e10cSrcweir 	}
900cdf0e10cSrcweir 
901cdf0e10cSrcweir 	if( pPropTable->pName )
902cdf0e10cSrcweir 		rEnum = pPropTable->nEnum;
903cdf0e10cSrcweir 
904cdf0e10cSrcweir 	return (pPropTable->pName != 0);
905cdf0e10cSrcweir }
906cdf0e10cSrcweir 
PixelToTwip(long & rWidth,long & rHeight)907cdf0e10cSrcweir void SvxCSS1Parser::PixelToTwip( long &rWidth, long &rHeight )
908cdf0e10cSrcweir {
909cdf0e10cSrcweir 	if( Application::GetDefaultDevice() )
910cdf0e10cSrcweir 	{
911cdf0e10cSrcweir 		Size aTwipSz( rWidth, rHeight );
912cdf0e10cSrcweir 		aTwipSz = Application::GetDefaultDevice()->PixelToLogic( aTwipSz,
913cdf0e10cSrcweir 														  MapMode(MAP_TWIP) );
914cdf0e10cSrcweir 
915cdf0e10cSrcweir 		rWidth = aTwipSz.Width();
916cdf0e10cSrcweir 		rHeight = aTwipSz.Height();
917cdf0e10cSrcweir 	}
918cdf0e10cSrcweir }
919cdf0e10cSrcweir 
SetBorderWidth(SvxBorderLine & aBorderLine,sal_uInt16 nWidth,sal_Bool bDouble,sal_Bool bTable)920cdf0e10cSrcweir void SvxCSS1Parser::SetBorderWidth( SvxBorderLine& aBorderLine, sal_uInt16 nWidth,
921cdf0e10cSrcweir 									sal_Bool bDouble, sal_Bool bTable )
922cdf0e10cSrcweir {
923cdf0e10cSrcweir 	const sal_uInt16 *aWidths;
924cdf0e10cSrcweir 	sal_uInt16 nSize;
925cdf0e10cSrcweir 	if( !bDouble )
926cdf0e10cSrcweir 	{
927cdf0e10cSrcweir 		aWidths = aSBorderWidths;
928cdf0e10cSrcweir 		nSize = sizeof( aSBorderWidths );
929cdf0e10cSrcweir 	}
930cdf0e10cSrcweir 	else if( bTable )
931cdf0e10cSrcweir 	{
932cdf0e10cSrcweir 		aWidths = aTDBorderWidths;
933cdf0e10cSrcweir 		nSize = sizeof( aTDBorderWidths );
934cdf0e10cSrcweir 	}
935cdf0e10cSrcweir 	else
936cdf0e10cSrcweir 	{
937cdf0e10cSrcweir 		aWidths = aDBorderWidths;
938cdf0e10cSrcweir 		nSize = sizeof( aDBorderWidths );
939cdf0e10cSrcweir 	}
940cdf0e10cSrcweir 
941cdf0e10cSrcweir 	sal_uInt16 i = (nSize / sizeof(sal_uInt16)) - 4;
942cdf0e10cSrcweir 	while( i>0 &&
943cdf0e10cSrcweir 		   nWidth <= ((aWidths[i] + aWidths[i-4]) / 2)	)
944cdf0e10cSrcweir 	{
945cdf0e10cSrcweir 		DBG_ASSERT( aWidths[i] > aWidths[i-4],
946cdf0e10cSrcweir 				"Linienbreiten sind nicht sortiert!" );
947cdf0e10cSrcweir 		i -= 4;
948cdf0e10cSrcweir 	}
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 	aBorderLine.SetOutWidth( aWidths[i+1] );
951cdf0e10cSrcweir 	aBorderLine.SetInWidth( aWidths[i+2] );
952cdf0e10cSrcweir 	aBorderLine.SetDistance( aWidths[i+3] );
953cdf0e10cSrcweir }
954cdf0e10cSrcweir 
GetFontHeight(sal_uInt16 nSize) const955cdf0e10cSrcweir sal_uInt32 SvxCSS1Parser::GetFontHeight( sal_uInt16 nSize ) const
956cdf0e10cSrcweir {
957cdf0e10cSrcweir 	sal_uInt16 nHeight;
958cdf0e10cSrcweir 
959cdf0e10cSrcweir 	switch( nSize )
960cdf0e10cSrcweir 	{
961cdf0e10cSrcweir 	case 0:		nHeight =  8*20;	break;
962cdf0e10cSrcweir 	case 1:		nHeight = 10*20;	break;
963cdf0e10cSrcweir 	case 2:		nHeight = 11*20;	break;
964cdf0e10cSrcweir 	case 3:		nHeight = 12*20;	break;
965cdf0e10cSrcweir 	case 4:		nHeight = 17*20;	break;
966cdf0e10cSrcweir 	case 5:		nHeight = 20*20;	break;
967cdf0e10cSrcweir 	case 6:
968cdf0e10cSrcweir 	default:	nHeight = 32*20;	break;
969cdf0e10cSrcweir 	}
970cdf0e10cSrcweir 
971cdf0e10cSrcweir 	return nHeight;
972cdf0e10cSrcweir }
973cdf0e10cSrcweir 
GetFontList() const974cdf0e10cSrcweir const FontList *SvxCSS1Parser::GetFontList() const
975cdf0e10cSrcweir {
976cdf0e10cSrcweir 		return 0;
977cdf0e10cSrcweir }
978cdf0e10cSrcweir 
GetMapEntry(const String & rKey,const SvxCSS1Map & rMap) const979cdf0e10cSrcweir SvxCSS1MapEntry *SvxCSS1Parser::GetMapEntry( const String& rKey,
980cdf0e10cSrcweir 											 const SvxCSS1Map& rMap ) const
981cdf0e10cSrcweir {
982cdf0e10cSrcweir 	pSearchEntry->SetKey( rKey );
983cdf0e10cSrcweir 
984cdf0e10cSrcweir 	SvxCSS1MapEntry *pRet = 0;
985cdf0e10cSrcweir 	sal_uInt16 nPos;
986cdf0e10cSrcweir 	if( rMap.Seek_Entry( pSearchEntry, &nPos ) )
987cdf0e10cSrcweir 		pRet = rMap[nPos];
988cdf0e10cSrcweir 
989cdf0e10cSrcweir 	return pRet;
990cdf0e10cSrcweir }
991cdf0e10cSrcweir 
InsertMapEntry(const String & rKey,const SfxItemSet & rItemSet,const SvxCSS1PropertyInfo & rProp,SvxCSS1Map & rMap)992cdf0e10cSrcweir void SvxCSS1Parser::InsertMapEntry( const String& rKey,
993cdf0e10cSrcweir 									const SfxItemSet& rItemSet,
994cdf0e10cSrcweir 									const SvxCSS1PropertyInfo& rProp,
995cdf0e10cSrcweir 									SvxCSS1Map& rMap )
996cdf0e10cSrcweir {
997cdf0e10cSrcweir 	SvxCSS1MapEntry *pEntry = GetMapEntry( rKey, rMap );
998cdf0e10cSrcweir 	if( pEntry )
999cdf0e10cSrcweir 	{
1000cdf0e10cSrcweir 		MergeStyles( rItemSet, rProp,
1001cdf0e10cSrcweir 					 pEntry->GetItemSet(), pEntry->GetPropertyInfo(), sal_True );
1002cdf0e10cSrcweir 	}
1003cdf0e10cSrcweir 	else
1004cdf0e10cSrcweir 	{
1005cdf0e10cSrcweir 		rMap.Insert( new SvxCSS1MapEntry( rKey, rItemSet, rProp ) );
1006cdf0e10cSrcweir 	}
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir 
MergeStyles(const SfxItemSet & rSrcSet,const SvxCSS1PropertyInfo & rSrcInfo,SfxItemSet & rTargetSet,SvxCSS1PropertyInfo & rTargetInfo,sal_Bool bSmart)1010cdf0e10cSrcweir void SvxCSS1Parser::MergeStyles( const SfxItemSet& rSrcSet,
1011cdf0e10cSrcweir 								 const SvxCSS1PropertyInfo& rSrcInfo,
1012cdf0e10cSrcweir 								 SfxItemSet& rTargetSet,
1013cdf0e10cSrcweir 								 SvxCSS1PropertyInfo& rTargetInfo,
1014cdf0e10cSrcweir 								 sal_Bool bSmart )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir 	if( !bSmart )
1017cdf0e10cSrcweir 	{
1018cdf0e10cSrcweir 		rTargetSet.Put( rSrcSet );
1019cdf0e10cSrcweir 	}
1020cdf0e10cSrcweir 	else
1021cdf0e10cSrcweir 	{
1022cdf0e10cSrcweir 		SvxLRSpaceItem aLRSpace( (const SvxLRSpaceItem&)rTargetSet.Get(aItemIds.nLRSpace) );
1023cdf0e10cSrcweir 		SvxULSpaceItem aULSpace( (const SvxULSpaceItem&)rTargetSet.Get(aItemIds.nULSpace) );
1024cdf0e10cSrcweir 		SvxBoxItem aBox( (const SvxBoxItem&)rTargetSet.Get(aItemIds.nBox) );
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir 		rTargetSet.Put( rSrcSet );
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir 		if( rSrcInfo.bLeftMargin || rSrcInfo.bRightMargin ||
1029cdf0e10cSrcweir 			rSrcInfo.bTextIndent )
1030cdf0e10cSrcweir 		{
1031cdf0e10cSrcweir 			const SvxLRSpaceItem& rNewLRSpace =
1032cdf0e10cSrcweir 				(const SvxLRSpaceItem&)rSrcSet.Get( aItemIds.nLRSpace );
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir 			if( rSrcInfo.bLeftMargin )
1035cdf0e10cSrcweir 				aLRSpace.SetLeft( rNewLRSpace.GetLeft() );
1036cdf0e10cSrcweir 			if( rSrcInfo.bRightMargin )
1037cdf0e10cSrcweir 				aLRSpace.SetRight( rNewLRSpace.GetRight() );
1038cdf0e10cSrcweir 			if( rSrcInfo.bTextIndent )
1039cdf0e10cSrcweir 				aLRSpace.SetTxtFirstLineOfst( rNewLRSpace.GetTxtFirstLineOfst() );
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir 			rTargetSet.Put( aLRSpace );
1042cdf0e10cSrcweir 		}
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir 		if( rSrcInfo.bTopMargin || rSrcInfo.bBottomMargin )
1045cdf0e10cSrcweir 		{
1046cdf0e10cSrcweir 			const SvxULSpaceItem& rNewULSpace =
1047cdf0e10cSrcweir 				(const SvxULSpaceItem&)rSrcSet.Get( aItemIds.nULSpace );
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir 			if( rSrcInfo.bTopMargin )
1050cdf0e10cSrcweir 				aULSpace.SetUpper( rNewULSpace.GetUpper() );
1051cdf0e10cSrcweir 			if( rSrcInfo.bBottomMargin )
1052cdf0e10cSrcweir 				aULSpace.SetLower( rNewULSpace.GetLower() );
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir 			rTargetSet.Put( aULSpace );
1055cdf0e10cSrcweir 		}
1056cdf0e10cSrcweir 	}
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 	rTargetInfo.Merge( rSrcInfo );
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir 
SetDfltEncoding(rtl_TextEncoding eEnc)1061cdf0e10cSrcweir void SvxCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir 	eDfltEnc = eEnc;
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir /*  */
1067cdf0e10cSrcweir 
ParseCSS1_font_size(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1068cdf0e10cSrcweir static void ParseCSS1_font_size( const CSS1Expression *pExpr,
1069cdf0e10cSrcweir 								 SfxItemSet &rItemSet,
1070cdf0e10cSrcweir 								 SvxCSS1PropertyInfo& /*rPropInfo*/,
1071cdf0e10cSrcweir 								 const SvxCSS1Parser& rParser )
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1074cdf0e10cSrcweir 
1075cdf0e10cSrcweir 	sal_uLong nHeight = 0;
1076cdf0e10cSrcweir 	sal_uInt16 nPropHeight = 100;
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir 	switch( pExpr->GetType() )
1079cdf0e10cSrcweir 	{
1080cdf0e10cSrcweir 	case CSS1_LENGTH:
1081cdf0e10cSrcweir 		nHeight = pExpr->GetULength();
1082cdf0e10cSrcweir 		break;
1083cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
1084cdf0e10cSrcweir 		{
1085cdf0e10cSrcweir 			long nPWidth = 0;
1086cdf0e10cSrcweir 			long nPHeight = (long)pExpr->GetNumber();
1087cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1088cdf0e10cSrcweir 			nHeight = (sal_uLong)nPHeight;
1089cdf0e10cSrcweir 		}
1090cdf0e10cSrcweir 		break;
1091cdf0e10cSrcweir //#ifdef PERCENTAGE_POSSIBLE
1092cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
1093cdf0e10cSrcweir 		// nur fuer Drop-Caps!
1094cdf0e10cSrcweir 		nPropHeight = (sal_uInt16)pExpr->GetNumber();
1095cdf0e10cSrcweir 		break;
1096cdf0e10cSrcweir //#endif
1097cdf0e10cSrcweir 	case CSS1_IDENT:
1098cdf0e10cSrcweir 		{
1099cdf0e10cSrcweir 			sal_uInt16 nSize;
1100cdf0e10cSrcweir #ifdef PERCENTAGE_POSSIBLE
1101cdf0e10cSrcweir 			const String& rValue = pExpr->GetString();
1102cdf0e10cSrcweir #endif
1103cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aFontSizeTable, pExpr->GetString(),
1104cdf0e10cSrcweir 										nSize ) )
1105cdf0e10cSrcweir 			{
1106cdf0e10cSrcweir 				nHeight = rParser.GetFontHeight( nSize );
1107cdf0e10cSrcweir 			}
1108cdf0e10cSrcweir #ifdef PERCENTAGE_POSSIBLE
1109cdf0e10cSrcweir 			else if( rValue.EqualsIgnoreCaseAscii( sCSS1_PV_larger ) )
1110cdf0e10cSrcweir 			{
1111cdf0e10cSrcweir 				nPropHeight = 150;
1112cdf0e10cSrcweir 			}
1113cdf0e10cSrcweir 			else if( rValue.EqualsIgnoreCaseAscii( sCSS1_PV_smaller ) )
1114cdf0e10cSrcweir 			{
1115cdf0e10cSrcweir 				nPropHeight = 67;
1116cdf0e10cSrcweir 			}
1117cdf0e10cSrcweir #endif
1118cdf0e10cSrcweir 		}
1119cdf0e10cSrcweir 		break;
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir 	default:
1122cdf0e10cSrcweir 		;
1123cdf0e10cSrcweir 	}
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir 	if( nHeight || nPropHeight!=100 )
1126cdf0e10cSrcweir 	{
1127cdf0e10cSrcweir 		SvxFontHeightItem aFontHeight( nHeight, nPropHeight,
1128cdf0e10cSrcweir 									   aItemIds.nFontHeight );
1129cdf0e10cSrcweir 		if( rParser.IsSetWesternProps() )
1130cdf0e10cSrcweir 			rItemSet.Put( aFontHeight );
1131cdf0e10cSrcweir 		if( rParser.IsSetCJKProps() )
1132cdf0e10cSrcweir 		{
1133cdf0e10cSrcweir 			aFontHeight.SetWhich( aItemIds.nFontHeightCJK );
1134cdf0e10cSrcweir 			rItemSet.Put( aFontHeight );
1135cdf0e10cSrcweir 		}
1136cdf0e10cSrcweir 		if( rParser.IsSetCTLProps() )
1137cdf0e10cSrcweir 		{
1138cdf0e10cSrcweir 			aFontHeight.SetWhich( aItemIds.nFontHeightCTL );
1139cdf0e10cSrcweir 			rItemSet.Put( aFontHeight );
1140cdf0e10cSrcweir 		}
1141cdf0e10cSrcweir 	}
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir /*  */
1145cdf0e10cSrcweir 
1146cdf0e10cSrcweir 
ParseCSS1_font_family(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1147cdf0e10cSrcweir static void ParseCSS1_font_family( const CSS1Expression *pExpr,
1148cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
1149cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& /*rPropInfo*/,
1150cdf0e10cSrcweir 								   const SvxCSS1Parser& rParser )
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1153cdf0e10cSrcweir 
1154cdf0e10cSrcweir 	String aName, aStyleName, aDfltName;
1155cdf0e10cSrcweir 	FontFamily eFamily = FAMILY_DONTKNOW;
1156cdf0e10cSrcweir 	FontPitch ePitch = PITCH_DONTKNOW;
1157cdf0e10cSrcweir 	rtl_TextEncoding eEnc = rParser.GetDfltEncoding();
1158cdf0e10cSrcweir 	const FontList *pFList = rParser.GetFontList();
1159cdf0e10cSrcweir 	sal_Bool bFirst = sal_True;
1160cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1161cdf0e10cSrcweir 	while( pExpr && (bFirst || ','==pExpr->GetOp() || !pExpr->GetOp()) )
1162cdf0e10cSrcweir 	{
1163cdf0e10cSrcweir 		CSS1Token eType = pExpr->GetType();
1164cdf0e10cSrcweir 		if( CSS1_IDENT==eType || CSS1_STRING==eType )
1165cdf0e10cSrcweir 		{
1166cdf0e10cSrcweir 			String aIdent( pExpr->GetString() );
1167cdf0e10cSrcweir 
1168cdf0e10cSrcweir 			if( CSS1_IDENT==eType )
1169cdf0e10cSrcweir 			{
1170cdf0e10cSrcweir 				// Alle nachfolgenden id's sammeln und mit einem
1171cdf0e10cSrcweir 				// Space getrennt hintendranhaengen
1172cdf0e10cSrcweir 				const CSS1Expression *pNext = pExpr->GetNext();
1173cdf0e10cSrcweir 				while( pNext && !pNext->GetOp() &&
1174cdf0e10cSrcweir 					   CSS1_IDENT==pNext->GetType() )
1175cdf0e10cSrcweir 				{
1176cdf0e10cSrcweir 					(aIdent += ' ') += pNext->GetString();
1177cdf0e10cSrcweir 					pExpr = pNext;
1178cdf0e10cSrcweir 					pNext = pExpr->GetNext();
1179cdf0e10cSrcweir 				}
1180cdf0e10cSrcweir 			}
1181cdf0e10cSrcweir 			if( aIdent.Len() )
1182cdf0e10cSrcweir 			{
1183cdf0e10cSrcweir 				if( !bFound && pFList )
1184cdf0e10cSrcweir 				{
1185cdf0e10cSrcweir 					sal_Handle hFont = pFList->GetFirstFontInfo( aIdent );
1186cdf0e10cSrcweir 					if( 0 != hFont )
1187cdf0e10cSrcweir 					{
1188cdf0e10cSrcweir 						const FontInfo& rFInfo = pFList->GetFontInfo( hFont );
1189cdf0e10cSrcweir 						if( RTL_TEXTENCODING_DONTKNOW != rFInfo.GetCharSet() )
1190cdf0e10cSrcweir 						{
1191cdf0e10cSrcweir 							bFound = sal_True;
1192cdf0e10cSrcweir 							if( RTL_TEXTENCODING_SYMBOL == rFInfo.GetCharSet() )
1193cdf0e10cSrcweir 								eEnc = RTL_TEXTENCODING_SYMBOL;
1194cdf0e10cSrcweir 						}
1195cdf0e10cSrcweir 					}
1196cdf0e10cSrcweir 				}
1197cdf0e10cSrcweir 				if( !bFirst )
1198cdf0e10cSrcweir 					aName += ';';
1199cdf0e10cSrcweir 				aName += aIdent;
1200cdf0e10cSrcweir 			}
1201cdf0e10cSrcweir 		}
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
1204cdf0e10cSrcweir 		bFirst = sal_False;
1205cdf0e10cSrcweir 	}
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir 	if( aName.Len() && !rParser.IsIgnoreFontFamily() )
1208cdf0e10cSrcweir 	{
1209cdf0e10cSrcweir 		SvxFontItem aFont( eFamily, aName, aStyleName, ePitch,
1210cdf0e10cSrcweir 					 	   eEnc, aItemIds.nFont );
1211cdf0e10cSrcweir 		if( rParser.IsSetWesternProps() )
1212cdf0e10cSrcweir 			rItemSet.Put( aFont );
1213cdf0e10cSrcweir 		if( rParser.IsSetCJKProps() )
1214cdf0e10cSrcweir 		{
1215cdf0e10cSrcweir 			aFont.SetWhich( aItemIds.nFontCJK );
1216cdf0e10cSrcweir 			rItemSet.Put( aFont );
1217cdf0e10cSrcweir 		}
1218cdf0e10cSrcweir 		if( rParser.IsSetCTLProps() )
1219cdf0e10cSrcweir 		{
1220cdf0e10cSrcweir 			aFont.SetWhich( aItemIds.nFontCTL );
1221cdf0e10cSrcweir 			rItemSet.Put( aFont );
1222cdf0e10cSrcweir 		}
1223cdf0e10cSrcweir 	}
1224cdf0e10cSrcweir }
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir /*  */
1227cdf0e10cSrcweir 
ParseCSS1_font_weight(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1228cdf0e10cSrcweir static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
1229cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
1230cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& /*rPropInfo*/,
1231cdf0e10cSrcweir 								   const SvxCSS1Parser& rParser )
1232cdf0e10cSrcweir {
1233cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir 	switch( pExpr->GetType() )
1236cdf0e10cSrcweir 	{
1237cdf0e10cSrcweir 	case CSS1_IDENT:
1238cdf0e10cSrcweir 	case CSS1_STRING:	// MS-IE, was sonst
1239cdf0e10cSrcweir 		{
1240cdf0e10cSrcweir 			sal_uInt16 nWeight;
1241cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aFontWeightTable, pExpr->GetString(),
1242cdf0e10cSrcweir 										nWeight ) )
1243cdf0e10cSrcweir 			{
1244cdf0e10cSrcweir 				SvxWeightItem aWeight( (FontWeight)nWeight, aItemIds.nWeight );
1245cdf0e10cSrcweir 				if( rParser.IsSetWesternProps() )
1246cdf0e10cSrcweir 					rItemSet.Put( aWeight );
1247cdf0e10cSrcweir 				if( rParser.IsSetCJKProps() )
1248cdf0e10cSrcweir 				{
1249cdf0e10cSrcweir 					aWeight.SetWhich( aItemIds.nWeightCJK );
1250cdf0e10cSrcweir 					rItemSet.Put( aWeight );
1251cdf0e10cSrcweir 				}
1252cdf0e10cSrcweir 				if( rParser.IsSetCTLProps() )
1253cdf0e10cSrcweir 				{
1254cdf0e10cSrcweir 					aWeight.SetWhich( aItemIds.nWeightCTL );
1255cdf0e10cSrcweir 					rItemSet.Put( aWeight );
1256cdf0e10cSrcweir 				}
1257cdf0e10cSrcweir 			}
1258cdf0e10cSrcweir 		}
1259cdf0e10cSrcweir 		break;
1260cdf0e10cSrcweir 	case CSS1_NUMBER:
1261cdf0e10cSrcweir 		{
1262cdf0e10cSrcweir 			sal_uInt16 nWeight = (sal_uInt16)pExpr->GetNumber();
1263cdf0e10cSrcweir 			SvxWeightItem aWeight( nWeight>400 ? WEIGHT_BOLD : WEIGHT_NORMAL,
1264cdf0e10cSrcweir 								   aItemIds.nWeight );
1265cdf0e10cSrcweir 			if( rParser.IsSetWesternProps() )
1266cdf0e10cSrcweir 				rItemSet.Put( aWeight );
1267cdf0e10cSrcweir 			if( rParser.IsSetCJKProps() )
1268cdf0e10cSrcweir 			{
1269cdf0e10cSrcweir 				aWeight.SetWhich( aItemIds.nWeightCJK );
1270cdf0e10cSrcweir 				rItemSet.Put( aWeight );
1271cdf0e10cSrcweir 			}
1272cdf0e10cSrcweir 			if( rParser.IsSetCTLProps() )
1273cdf0e10cSrcweir 			{
1274cdf0e10cSrcweir 				aWeight.SetWhich( aItemIds.nWeightCTL );
1275cdf0e10cSrcweir 				rItemSet.Put( aWeight );
1276cdf0e10cSrcweir 			}
1277cdf0e10cSrcweir 		}
1278cdf0e10cSrcweir 		break;
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir 	default:
1281cdf0e10cSrcweir 		;
1282cdf0e10cSrcweir 	}
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir 
1285cdf0e10cSrcweir /*  */
1286cdf0e10cSrcweir 
ParseCSS1_font_style(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1287cdf0e10cSrcweir static void ParseCSS1_font_style( const CSS1Expression *pExpr,
1288cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
1289cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& /*rPropInfo*/,
1290cdf0e10cSrcweir 								  const SvxCSS1Parser& rParser )
1291cdf0e10cSrcweir {
1292cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir 	sal_Bool bPosture = sal_False;
1295cdf0e10cSrcweir 	sal_Bool bCaseMap = sal_False;
1296cdf0e10cSrcweir 	FontItalic eItalic = ITALIC_NONE;
1297cdf0e10cSrcweir 	SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED;
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir 	// normal | italic || small-caps | oblique || small-caps | small-caps
1300cdf0e10cSrcweir 	// (wobei nor noch normal | italic und oblique zulaessig sind
1301cdf0e10cSrcweir 
1302cdf0e10cSrcweir 	// der Wert kann zwei Werte enthalten!
1303cdf0e10cSrcweir 	for( sal_uInt16 i=0; pExpr && i<2; i++ )
1304cdf0e10cSrcweir 	{
1305cdf0e10cSrcweir 		// Auch hier hinterlaesst MS-IEs Parser seine Spuren
1306cdf0e10cSrcweir 		if( (CSS1_IDENT==pExpr->GetType() || CSS1_STRING==pExpr->GetType()) &&
1307cdf0e10cSrcweir 			!pExpr->GetOp() )
1308cdf0e10cSrcweir 		{
1309cdf0e10cSrcweir 			const String& rValue = pExpr->GetString();
1310cdf0e10cSrcweir 			// erstmal pruefen, ob es ein Italic-Wert oder 'normal' ist
1311cdf0e10cSrcweir 			sal_uInt16 nItalic;
1312cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nItalic ) )
1313cdf0e10cSrcweir 			{
1314cdf0e10cSrcweir 				eItalic = (FontItalic)nItalic;
1315cdf0e10cSrcweir 				if( !bCaseMap && ITALIC_NONE==eItalic )
1316cdf0e10cSrcweir 				{
1317cdf0e10cSrcweir 					// fuer 'normal' muessen wir auch die case-map aussch.
1318cdf0e10cSrcweir 					eCaseMap = SVX_CASEMAP_NOT_MAPPED;
1319cdf0e10cSrcweir 					bCaseMap = sal_True;
1320cdf0e10cSrcweir 				}
1321cdf0e10cSrcweir 				bPosture = sal_True;
1322cdf0e10cSrcweir 			}
1323cdf0e10cSrcweir 			else if( !bCaseMap &&
1324cdf0e10cSrcweir 					 rValue.EqualsIgnoreCaseAscii(sCSS1_PV_small_caps) )
1325cdf0e10cSrcweir 			{
1326cdf0e10cSrcweir 				eCaseMap = SVX_CASEMAP_KAPITAELCHEN;
1327cdf0e10cSrcweir 				bCaseMap = sal_True;
1328cdf0e10cSrcweir 			}
1329cdf0e10cSrcweir 		}
1330cdf0e10cSrcweir 
1331cdf0e10cSrcweir 		// den naechsten Ausdruck holen
1332cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
1333cdf0e10cSrcweir 	}
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir 	if( bPosture )
1336cdf0e10cSrcweir 	{
1337cdf0e10cSrcweir 		SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1338cdf0e10cSrcweir 		if( rParser.IsSetWesternProps() )
1339cdf0e10cSrcweir 			rItemSet.Put( aPosture );
1340cdf0e10cSrcweir 		if( rParser.IsSetCJKProps() )
1341cdf0e10cSrcweir 		{
1342cdf0e10cSrcweir 			aPosture.SetWhich( aItemIds.nPostureCJK );
1343cdf0e10cSrcweir 			rItemSet.Put( aPosture );
1344cdf0e10cSrcweir 		}
1345cdf0e10cSrcweir 		if( rParser.IsSetCTLProps() )
1346cdf0e10cSrcweir 		{
1347cdf0e10cSrcweir 			aPosture.SetWhich( aItemIds.nPostureCTL );
1348cdf0e10cSrcweir 			rItemSet.Put( aPosture );
1349cdf0e10cSrcweir 		}
1350cdf0e10cSrcweir 	}
1351cdf0e10cSrcweir 
1352cdf0e10cSrcweir 	if( bCaseMap )
1353cdf0e10cSrcweir 		rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir /*  */
1357cdf0e10cSrcweir 
ParseCSS1_font_variant(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1358cdf0e10cSrcweir static void ParseCSS1_font_variant( const CSS1Expression *pExpr,
1359cdf0e10cSrcweir 									SfxItemSet &rItemSet,
1360cdf0e10cSrcweir 									SvxCSS1PropertyInfo& /*rPropInfo*/,
1361cdf0e10cSrcweir 									const SvxCSS1Parser& /*rParser*/ )
1362cdf0e10cSrcweir {
1363cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1364cdf0e10cSrcweir 
1365cdf0e10cSrcweir 	// normal | small-caps
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir 	switch( pExpr->GetType() )
1368cdf0e10cSrcweir 	{
1369cdf0e10cSrcweir 	case CSS1_IDENT:
1370cdf0e10cSrcweir 		{
1371cdf0e10cSrcweir 			sal_uInt16 nCaseMap;
1372cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aFontVariantTable, pExpr->GetString(),
1373cdf0e10cSrcweir 										nCaseMap ) )
1374cdf0e10cSrcweir 			{
1375cdf0e10cSrcweir 				rItemSet.Put( SvxCaseMapItem( (SvxCaseMap)nCaseMap,
1376cdf0e10cSrcweir 												aItemIds.nCaseMap ) );
1377cdf0e10cSrcweir 			}
1378cdf0e10cSrcweir 		}
1379cdf0e10cSrcweir 	default:
1380cdf0e10cSrcweir 		;
1381cdf0e10cSrcweir 	}
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir 
1384cdf0e10cSrcweir /*  */
1385cdf0e10cSrcweir 
ParseCSS1_color(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1386cdf0e10cSrcweir static void ParseCSS1_color( const CSS1Expression *pExpr,
1387cdf0e10cSrcweir 							 SfxItemSet &rItemSet,
1388cdf0e10cSrcweir 							 SvxCSS1PropertyInfo& /*rPropInfo*/,
1389cdf0e10cSrcweir 							 const SvxCSS1Parser& /*rParser*/ )
1390cdf0e10cSrcweir {
1391cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir 	switch( pExpr->GetType() )
1394cdf0e10cSrcweir 	{
1395cdf0e10cSrcweir 	case CSS1_IDENT:
1396cdf0e10cSrcweir 	case CSS1_RGB:
1397cdf0e10cSrcweir 	case CSS1_HEXCOLOR:
1398cdf0e10cSrcweir 	case CSS1_STRING:		// Wegen MS-IE
1399cdf0e10cSrcweir 		{
1400cdf0e10cSrcweir 			Color aColor;
1401cdf0e10cSrcweir 			if( pExpr->GetColor( aColor ) )
1402cdf0e10cSrcweir 				rItemSet.Put( SvxColorItem( aColor, aItemIds.nColor ) );
1403cdf0e10cSrcweir 		}
1404cdf0e10cSrcweir 		break;
1405cdf0e10cSrcweir 	default:
1406cdf0e10cSrcweir 		;
1407cdf0e10cSrcweir 	}
1408cdf0e10cSrcweir }
1409cdf0e10cSrcweir 
ParseCSS1_direction(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1410cdf0e10cSrcweir static void ParseCSS1_direction( const CSS1Expression *pExpr,
1411cdf0e10cSrcweir 							 SfxItemSet &rItemSet,
1412cdf0e10cSrcweir 							 SvxCSS1PropertyInfo& /*rPropInfo*/,
1413cdf0e10cSrcweir 							 const SvxCSS1Parser& /*rParser*/ )
1414cdf0e10cSrcweir {
1415cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir 	sal_uInt16 nDir;
1418cdf0e10cSrcweir 	switch( pExpr->GetType() )
1419cdf0e10cSrcweir 	{
1420cdf0e10cSrcweir 	case CSS1_IDENT:
1421cdf0e10cSrcweir 	case CSS1_STRING:
1422cdf0e10cSrcweir 		if( SvxCSS1Parser::GetEnum( aDirectionTable, pExpr->GetString(),
1423cdf0e10cSrcweir 										nDir ) )
1424cdf0e10cSrcweir 		{
1425cdf0e10cSrcweir 			rItemSet.Put( SvxFrameDirectionItem(
1426cdf0e10cSrcweir 					   static_cast < SvxFrameDirection >( nDir ),
1427cdf0e10cSrcweir 					   aItemIds.nDirection ) );
1428cdf0e10cSrcweir 		}
1429cdf0e10cSrcweir 		break;
1430cdf0e10cSrcweir 	default:
1431cdf0e10cSrcweir 		;
1432cdf0e10cSrcweir 	}
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir 
1435cdf0e10cSrcweir /*  */
1436cdf0e10cSrcweir 
MergeHori(SvxGraphicPosition & ePos,SvxGraphicPosition eHori)1437cdf0e10cSrcweir static void MergeHori( SvxGraphicPosition& ePos, SvxGraphicPosition eHori )
1438cdf0e10cSrcweir {
1439cdf0e10cSrcweir 	DBG_ASSERT( GPOS_LT==eHori || GPOS_MT==eHori || GPOS_RT==eHori,
1440cdf0e10cSrcweir 				"vertikale Position nicht oben" );
1441cdf0e10cSrcweir 
1442cdf0e10cSrcweir 	switch( ePos )
1443cdf0e10cSrcweir 	{
1444cdf0e10cSrcweir 	case GPOS_LT:
1445cdf0e10cSrcweir 	case GPOS_MT:
1446cdf0e10cSrcweir 	case GPOS_RT:
1447cdf0e10cSrcweir 		ePos = eHori;
1448cdf0e10cSrcweir 		break;
1449cdf0e10cSrcweir 
1450cdf0e10cSrcweir 	case GPOS_LM:
1451cdf0e10cSrcweir 	case GPOS_MM:
1452cdf0e10cSrcweir 	case GPOS_RM:
1453cdf0e10cSrcweir 		ePos = GPOS_LT==eHori ? GPOS_LM : (GPOS_MT==eHori ? GPOS_MM : GPOS_RM);
1454cdf0e10cSrcweir 		break;
1455cdf0e10cSrcweir 
1456cdf0e10cSrcweir 	case GPOS_LB:
1457cdf0e10cSrcweir 	case GPOS_MB:
1458cdf0e10cSrcweir 	case GPOS_RB:
1459cdf0e10cSrcweir 		ePos = GPOS_LT==eHori ? GPOS_LB : (GPOS_MT==eHori ? GPOS_MB : GPOS_RB);
1460cdf0e10cSrcweir 		break;
1461cdf0e10cSrcweir 
1462cdf0e10cSrcweir 	default:
1463cdf0e10cSrcweir 		;
1464cdf0e10cSrcweir 	}
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir 
MergeVert(SvxGraphicPosition & ePos,SvxGraphicPosition eVert)1467cdf0e10cSrcweir static void MergeVert( SvxGraphicPosition& ePos, SvxGraphicPosition eVert )
1468cdf0e10cSrcweir {
1469cdf0e10cSrcweir 	DBG_ASSERT( GPOS_LT==eVert || GPOS_LM==eVert || GPOS_LB==eVert,
1470cdf0e10cSrcweir 				"horizontale Position nicht links" );
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir 	switch( ePos )
1473cdf0e10cSrcweir 	{
1474cdf0e10cSrcweir 	case GPOS_LT:
1475cdf0e10cSrcweir 	case GPOS_LM:
1476cdf0e10cSrcweir 	case GPOS_LB:
1477cdf0e10cSrcweir 		ePos = eVert;
1478cdf0e10cSrcweir 		break;
1479cdf0e10cSrcweir 
1480cdf0e10cSrcweir 	case GPOS_MT:
1481cdf0e10cSrcweir 	case GPOS_MM:
1482cdf0e10cSrcweir 	case GPOS_MB:
1483cdf0e10cSrcweir 		ePos = GPOS_LT==eVert ? GPOS_MT : (GPOS_LM==eVert ? GPOS_MM : GPOS_MB);
1484cdf0e10cSrcweir 		break;
1485cdf0e10cSrcweir 
1486cdf0e10cSrcweir 	case GPOS_RT:
1487cdf0e10cSrcweir 	case GPOS_RM:
1488cdf0e10cSrcweir 	case GPOS_RB:
1489cdf0e10cSrcweir 		ePos = GPOS_LT==eVert ? GPOS_RT : (GPOS_LM==eVert ? GPOS_RM : GPOS_RB);
1490cdf0e10cSrcweir 		break;
1491cdf0e10cSrcweir 
1492cdf0e10cSrcweir 	default:
1493cdf0e10cSrcweir 		;
1494cdf0e10cSrcweir 	}
1495cdf0e10cSrcweir }
1496cdf0e10cSrcweir 
ParseCSS1_background(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1497cdf0e10cSrcweir static void ParseCSS1_background( const CSS1Expression *pExpr,
1498cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
1499cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& /*rPropInfo*/,
1500cdf0e10cSrcweir 								  const SvxCSS1Parser& rParser )
1501cdf0e10cSrcweir {
1502cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1503cdf0e10cSrcweir 
1504cdf0e10cSrcweir 	Color aColor;
1505cdf0e10cSrcweir 	String aURL;
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 	sal_Bool bColor = sal_False, bTransparent = sal_False;
1508cdf0e10cSrcweir 	SvxGraphicPosition eRepeat = GPOS_TILED;
1509cdf0e10cSrcweir 	SvxGraphicPosition ePos = GPOS_LT;
1510cdf0e10cSrcweir 	sal_Bool bHori = sal_False, bVert = sal_False;
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir 	while( pExpr && !pExpr->GetOp() )
1513cdf0e10cSrcweir 	{
1514cdf0e10cSrcweir 		switch( pExpr->GetType() )
1515cdf0e10cSrcweir 		{
1516cdf0e10cSrcweir 		case CSS1_URL:
1517cdf0e10cSrcweir 			pExpr->GetURL( aURL );
1518cdf0e10cSrcweir 			break;
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir 		case CSS1_RGB:
1521cdf0e10cSrcweir 			bColor = pExpr->GetColor( aColor );
1522cdf0e10cSrcweir 			break;
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir 		case CSS1_LENGTH:
1525cdf0e10cSrcweir 		case CSS1_PIXLENGTH:
1526cdf0e10cSrcweir 			{
1527cdf0e10cSrcweir 				// da wir keine absolute Positionierung koennen,
1528cdf0e10cSrcweir 				// unterscheiden wir nur zwischen  0 und !0. Deshalb
1529cdf0e10cSrcweir 				// koennen Pixel auch wie alle anderen Einheiten behandelt
1530cdf0e10cSrcweir 				// werden.
1531cdf0e10cSrcweir 
1532cdf0e10cSrcweir 				sal_uLong nLength = (sal_uLong)pExpr->GetNumber();
1533cdf0e10cSrcweir 				if( !bHori )
1534cdf0e10cSrcweir 				{
1535cdf0e10cSrcweir 					ePos = nLength ? GPOS_MM : GPOS_LT;
1536cdf0e10cSrcweir 					bHori = sal_True;
1537cdf0e10cSrcweir 				}
1538cdf0e10cSrcweir 				else if( !bVert )
1539cdf0e10cSrcweir 				{
1540cdf0e10cSrcweir 					MergeVert( ePos, (nLength ? GPOS_LM : GPOS_LT) );
1541cdf0e10cSrcweir 					bVert = sal_True;
1542cdf0e10cSrcweir 				}
1543cdf0e10cSrcweir 			}
1544cdf0e10cSrcweir 			break;
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 		case CSS1_PERCENTAGE:
1547cdf0e10cSrcweir 			{
1548cdf0e10cSrcweir 				// die %-Angabe wird auf den enum abgebildet
1549cdf0e10cSrcweir 
1550cdf0e10cSrcweir 				sal_uInt16 nPerc = (sal_uInt16)pExpr->GetNumber();
1551cdf0e10cSrcweir 				if( !bHori )
1552cdf0e10cSrcweir 				{
1553cdf0e10cSrcweir 					ePos = nPerc < 25 ? GPOS_LT
1554cdf0e10cSrcweir 									  : (nPerc < 75 ? GPOS_MM
1555cdf0e10cSrcweir 													: GPOS_RB);
1556cdf0e10cSrcweir 				}
1557cdf0e10cSrcweir 				else if( !bVert )
1558cdf0e10cSrcweir 				{
1559cdf0e10cSrcweir 					SvxGraphicPosition eVert =
1560cdf0e10cSrcweir 						nPerc < 25 ? GPOS_LT: (nPerc < 75 ? GPOS_LM
1561cdf0e10cSrcweir 														  : GPOS_LB);
1562cdf0e10cSrcweir 					MergeVert( ePos, eVert );
1563cdf0e10cSrcweir 				}
1564cdf0e10cSrcweir 			}
1565cdf0e10cSrcweir 			break;
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir 		case CSS1_IDENT:
1568cdf0e10cSrcweir 		case CSS1_HEXCOLOR:
1569cdf0e10cSrcweir 		case CSS1_STRING:		// Wegen MS-IE
1570cdf0e10cSrcweir 			{
1571cdf0e10cSrcweir 				sal_uInt16 nEnum;
1572cdf0e10cSrcweir 				const String &rValue = pExpr->GetString();
1573cdf0e10cSrcweir 				if( rValue.EqualsIgnoreCaseAscii( sCSS1_PV_transparent ) )
1574cdf0e10cSrcweir 				{
1575cdf0e10cSrcweir 					bTransparent = sal_True;
1576cdf0e10cSrcweir 				}
1577cdf0e10cSrcweir 				if( SvxCSS1Parser::GetEnum( aBGRepeatTable, rValue, nEnum ) )
1578cdf0e10cSrcweir 				{
1579cdf0e10cSrcweir 					eRepeat = (SvxGraphicPosition)nEnum;
1580cdf0e10cSrcweir 				}
1581cdf0e10cSrcweir 				else if( SvxCSS1Parser::GetEnum( aBGHoriPosTable, rValue, nEnum ) )
1582cdf0e10cSrcweir 				{
1583cdf0e10cSrcweir 					// <position>, horizontal
1584cdf0e10cSrcweir 					MergeHori( ePos, (SvxGraphicPosition)nEnum );
1585cdf0e10cSrcweir 				}
1586cdf0e10cSrcweir 				else if( SvxCSS1Parser::GetEnum( aBGVertPosTable, rValue, nEnum ) )
1587cdf0e10cSrcweir 				{
1588cdf0e10cSrcweir 					// <position>, vertikal
1589cdf0e10cSrcweir 					MergeVert( ePos, (SvxGraphicPosition)nEnum );
1590cdf0e10cSrcweir 				}
1591cdf0e10cSrcweir 				else if( !bColor )
1592cdf0e10cSrcweir 				{
1593cdf0e10cSrcweir 					// <color>
1594cdf0e10cSrcweir 					bColor = pExpr->GetColor( aColor );
1595cdf0e10cSrcweir 				}
1596cdf0e10cSrcweir 				// <scroll> kennen wir nicht
1597cdf0e10cSrcweir 			}
1598cdf0e10cSrcweir 			break;
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir 		default:
1601cdf0e10cSrcweir 			;
1602cdf0e10cSrcweir 		}
1603cdf0e10cSrcweir 
1604cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
1605cdf0e10cSrcweir 	}
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 	// transparent schlaegt alles
1608cdf0e10cSrcweir 	if( bTransparent )
1609cdf0e10cSrcweir 	{
1610cdf0e10cSrcweir 		bColor = sal_False;
1611cdf0e10cSrcweir 		aURL.Erase();
1612cdf0e10cSrcweir 	}
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir 	// repeat hat prio gegenueber einer Position
1615cdf0e10cSrcweir 	if( GPOS_NONE == eRepeat )
1616cdf0e10cSrcweir 		eRepeat = ePos;
1617cdf0e10cSrcweir 
1618cdf0e10cSrcweir 	if( bTransparent || bColor || aURL.Len() )
1619cdf0e10cSrcweir 	{
1620cdf0e10cSrcweir 		SvxBrushItem aBrushItem( aItemIds.nBrush );
1621cdf0e10cSrcweir 
1622cdf0e10cSrcweir 		if( bTransparent )
1623cdf0e10cSrcweir 			aBrushItem.SetColor( Color(COL_TRANSPARENT));
1624cdf0e10cSrcweir 		else if( bColor )
1625cdf0e10cSrcweir 			aBrushItem.SetColor( aColor );
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir 		if( aURL.Len() )
1628cdf0e10cSrcweir 		{
1629cdf0e10cSrcweir             aBrushItem.SetGraphicLink( URIHelper::SmartRel2Abs( INetURLObject( rParser.GetBaseURL()), aURL, Link(), false ) );
1630cdf0e10cSrcweir 			aBrushItem.SetGraphicPos( eRepeat );
1631cdf0e10cSrcweir 		}
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir 		rItemSet.Put( aBrushItem );
1634cdf0e10cSrcweir 	}
1635cdf0e10cSrcweir }
1636cdf0e10cSrcweir 
ParseCSS1_background_color(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1637cdf0e10cSrcweir static void ParseCSS1_background_color( const CSS1Expression *pExpr,
1638cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
1639cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& /*rPropInfo*/,
1640cdf0e10cSrcweir 								  const SvxCSS1Parser& /*rParser*/ )
1641cdf0e10cSrcweir {
1642cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1643cdf0e10cSrcweir 
1644cdf0e10cSrcweir 	Color aColor;
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir 	sal_Bool bColor = sal_False, bTransparent = sal_False;
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir 	switch( pExpr->GetType() )
1649cdf0e10cSrcweir 	{
1650cdf0e10cSrcweir 	case CSS1_RGB:
1651cdf0e10cSrcweir 		bColor = pExpr->GetColor( aColor );
1652cdf0e10cSrcweir 		break;
1653cdf0e10cSrcweir 	case CSS1_IDENT:
1654cdf0e10cSrcweir 	case CSS1_HEXCOLOR:
1655cdf0e10cSrcweir 	case CSS1_STRING:		// Wegen MS-IE
1656cdf0e10cSrcweir 		if( pExpr->GetString().EqualsIgnoreCaseAscii( sCSS1_PV_transparent ) )
1657cdf0e10cSrcweir 		{
1658cdf0e10cSrcweir 			bTransparent = sal_True;
1659cdf0e10cSrcweir 		}
1660cdf0e10cSrcweir 		else
1661cdf0e10cSrcweir 		{
1662cdf0e10cSrcweir 			// <color>
1663cdf0e10cSrcweir 			bColor = pExpr->GetColor( aColor );
1664cdf0e10cSrcweir 		}
1665cdf0e10cSrcweir 		break;
1666cdf0e10cSrcweir 	default:
1667cdf0e10cSrcweir 		;
1668cdf0e10cSrcweir 	}
1669cdf0e10cSrcweir 
1670cdf0e10cSrcweir 	if( bTransparent || bColor )
1671cdf0e10cSrcweir 	{
1672cdf0e10cSrcweir 		SvxBrushItem aBrushItem( aItemIds.nBrush );
1673cdf0e10cSrcweir 
1674cdf0e10cSrcweir 		if( bTransparent )
1675cdf0e10cSrcweir 			aBrushItem.SetColor( Color(COL_TRANSPARENT) );
1676cdf0e10cSrcweir 		else if( bColor )
1677cdf0e10cSrcweir 			aBrushItem.SetColor( aColor);
1678cdf0e10cSrcweir 
1679cdf0e10cSrcweir 		rItemSet.Put( aBrushItem );
1680cdf0e10cSrcweir 	}
1681cdf0e10cSrcweir }
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir /*  */
1684cdf0e10cSrcweir 
ParseCSS1_line_height(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)1685cdf0e10cSrcweir static void ParseCSS1_line_height( const CSS1Expression *pExpr,
1686cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
1687cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& /*rPropInfo*/,
1688cdf0e10cSrcweir 								   const SvxCSS1Parser& rParser )
1689cdf0e10cSrcweir {
1690cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1691cdf0e10cSrcweir 
1692cdf0e10cSrcweir 	sal_uInt16 nHeight = 0;
1693cdf0e10cSrcweir 	sal_uInt8 nPropHeight = 0;
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir 	switch( pExpr->GetType() )
1696cdf0e10cSrcweir 	{
1697cdf0e10cSrcweir 	case CSS1_LENGTH:
1698cdf0e10cSrcweir 		nHeight = (sal_uInt16)pExpr->GetULength();
1699cdf0e10cSrcweir 		break;
1700cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
1701cdf0e10cSrcweir 		{
1702cdf0e10cSrcweir 			long nPWidth = 0;
1703cdf0e10cSrcweir 			long nPHeight = (long)pExpr->GetNumber();
1704cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1705cdf0e10cSrcweir 			nHeight = (sal_uInt16)nPHeight;
1706cdf0e10cSrcweir 		}
1707cdf0e10cSrcweir 		break;
1708cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
1709cdf0e10cSrcweir 		{
1710cdf0e10cSrcweir 			sal_uInt16 nPHeight = (sal_uInt16)pExpr->GetNumber();
1711cdf0e10cSrcweir 			nPropHeight = nPHeight <= 200 ? (sal_uInt8)nPHeight : 200;
1712cdf0e10cSrcweir 		}
1713cdf0e10cSrcweir 		break;
1714cdf0e10cSrcweir 	case CSS1_NUMBER:
1715cdf0e10cSrcweir 		{
1716cdf0e10cSrcweir 			sal_uInt16 nPHeight = (sal_uInt16)(pExpr->GetNumber() * 100);
1717cdf0e10cSrcweir 			nPropHeight = nPHeight <= 200 ? (sal_uInt8)nPHeight : 200;
1718cdf0e10cSrcweir 		}
1719cdf0e10cSrcweir 		break;
1720cdf0e10cSrcweir 	default:
1721cdf0e10cSrcweir 		;
1722cdf0e10cSrcweir 	}
1723cdf0e10cSrcweir 
1724cdf0e10cSrcweir 	if( nHeight )
1725cdf0e10cSrcweir 	{
1726cdf0e10cSrcweir 		if(	nHeight < rParser.GetMinFixLineSpace() )
1727cdf0e10cSrcweir 			nHeight = rParser.GetMinFixLineSpace();
1728cdf0e10cSrcweir 		SvxLineSpacingItem aLSItem( nHeight, aItemIds.nLineSpacing );
1729cdf0e10cSrcweir 		aLSItem.SetLineHeight( nHeight );
1730cdf0e10cSrcweir         // --> OD 2006-07-26 #138463#
1731cdf0e10cSrcweir         // interpret <line-height> attribute as minimum line height
1732cdf0e10cSrcweir         aLSItem.GetLineSpaceRule() = SVX_LINE_SPACE_MIN;
1733cdf0e10cSrcweir         // <--
1734cdf0e10cSrcweir 		aLSItem.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
1735cdf0e10cSrcweir 		rItemSet.Put( aLSItem );
1736cdf0e10cSrcweir 	}
1737cdf0e10cSrcweir 	else if( nPropHeight )
1738cdf0e10cSrcweir 	{
1739cdf0e10cSrcweir 		SvxLineSpacingItem aLSItem( nPropHeight, aItemIds.nLineSpacing );
1740cdf0e10cSrcweir 		aLSItem.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
1741cdf0e10cSrcweir 		if( 100 == nPropHeight )
1742cdf0e10cSrcweir 			aLSItem.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
1743cdf0e10cSrcweir 		else
1744cdf0e10cSrcweir 			aLSItem.SetPropLineSpace( nPropHeight );
1745cdf0e10cSrcweir 		rItemSet.Put( aLSItem );
1746cdf0e10cSrcweir 	}
1747cdf0e10cSrcweir 
1748cdf0e10cSrcweir }
1749cdf0e10cSrcweir 
1750cdf0e10cSrcweir /*  */
1751cdf0e10cSrcweir 
ParseCSS1_font(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)1752cdf0e10cSrcweir static void ParseCSS1_font( const CSS1Expression *pExpr,
1753cdf0e10cSrcweir 							SfxItemSet &rItemSet,
1754cdf0e10cSrcweir 							SvxCSS1PropertyInfo& rPropInfo,
1755cdf0e10cSrcweir 							const SvxCSS1Parser& rParser )
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1758cdf0e10cSrcweir 
1759cdf0e10cSrcweir 	FontItalic eItalic = ITALIC_NONE;
1760cdf0e10cSrcweir 	SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED;
1761cdf0e10cSrcweir 	FontWeight eWeight = WEIGHT_NORMAL;
1762cdf0e10cSrcweir 
1763cdf0e10cSrcweir 	// [ <font-style> || <font-variant> || <font-weight> ] ?
1764cdf0e10cSrcweir 	while( pExpr && !pExpr->GetOp() &&
1765cdf0e10cSrcweir 		   (CSS1_IDENT==pExpr->GetType() ||
1766cdf0e10cSrcweir 			CSS1_STRING==pExpr->GetType() ||
1767cdf0e10cSrcweir 			CSS1_NUMBER==pExpr->GetType()) )
1768cdf0e10cSrcweir 	{
1769cdf0e10cSrcweir 		if( CSS1_IDENT==pExpr->GetType() ||
1770cdf0e10cSrcweir 			CSS1_STRING==pExpr->GetType() )
1771cdf0e10cSrcweir 		{
1772cdf0e10cSrcweir 			const String& rValue = pExpr->GetString();
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir 			sal_uInt16 nEnum;
1775cdf0e10cSrcweir 
1776cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nEnum ) )
1777cdf0e10cSrcweir 			{
1778cdf0e10cSrcweir 				eItalic = (FontItalic)nEnum;
1779cdf0e10cSrcweir 			}
1780cdf0e10cSrcweir 			else if( SvxCSS1Parser::GetEnum( aFontVariantTable, rValue, nEnum ) )
1781cdf0e10cSrcweir 			{
1782cdf0e10cSrcweir 				eCaseMap = (SvxCaseMap)nEnum;
1783cdf0e10cSrcweir 			}
1784cdf0e10cSrcweir 			else if( SvxCSS1Parser::GetEnum( aFontWeightTable, rValue, nEnum ) )
1785cdf0e10cSrcweir 			{
1786cdf0e10cSrcweir 				eWeight = (FontWeight)nEnum;
1787cdf0e10cSrcweir 			}
1788cdf0e10cSrcweir 		}
1789cdf0e10cSrcweir 		else
1790cdf0e10cSrcweir 		{
1791cdf0e10cSrcweir 			eWeight = (sal_uInt16)pExpr->GetNumber() > 400 ? WEIGHT_BOLD
1792cdf0e10cSrcweir 													   : WEIGHT_NORMAL;
1793cdf0e10cSrcweir 		}
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
1796cdf0e10cSrcweir 	}
1797cdf0e10cSrcweir 
1798cdf0e10cSrcweir 	if( !pExpr || pExpr->GetOp() )
1799cdf0e10cSrcweir 		return;
1800cdf0e10cSrcweir 
1801cdf0e10cSrcweir 	// Da "font" alle Werte zurecksetzt, fuer die nichts angegeben ist,
1802cdf0e10cSrcweir 	// tun wir das hier.
1803cdf0e10cSrcweir 	SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
1804cdf0e10cSrcweir 	if( rParser.IsSetWesternProps() )
1805cdf0e10cSrcweir 		rItemSet.Put( aPosture );
1806cdf0e10cSrcweir 	if( rParser.IsSetCJKProps() )
1807cdf0e10cSrcweir 	{
1808cdf0e10cSrcweir 		aPosture.SetWhich( aItemIds.nPostureCJK );
1809cdf0e10cSrcweir 		rItemSet.Put( aPosture );
1810cdf0e10cSrcweir 	}
1811cdf0e10cSrcweir 	if( rParser.IsSetCTLProps() )
1812cdf0e10cSrcweir 	{
1813cdf0e10cSrcweir 		aPosture.SetWhich( aItemIds.nPostureCTL );
1814cdf0e10cSrcweir 		rItemSet.Put( aPosture );
1815cdf0e10cSrcweir 	}
1816cdf0e10cSrcweir 
1817cdf0e10cSrcweir 	rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
1818cdf0e10cSrcweir 
1819cdf0e10cSrcweir 	SvxWeightItem aWeight( eWeight, aItemIds.nWeight );
1820cdf0e10cSrcweir 	if( rParser.IsSetWesternProps() )
1821cdf0e10cSrcweir 		rItemSet.Put( aWeight );
1822cdf0e10cSrcweir 	if( rParser.IsSetCJKProps() )
1823cdf0e10cSrcweir 	{
1824cdf0e10cSrcweir 		aWeight.SetWhich( aItemIds.nWeightCJK );
1825cdf0e10cSrcweir 		rItemSet.Put( aWeight );
1826cdf0e10cSrcweir 	}
1827cdf0e10cSrcweir 	if( rParser.IsSetCTLProps() )
1828cdf0e10cSrcweir 	{
1829cdf0e10cSrcweir 		aWeight.SetWhich( aItemIds.nWeightCTL );
1830cdf0e10cSrcweir 		rItemSet.Put( aWeight );
1831cdf0e10cSrcweir 	}
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir 
1834cdf0e10cSrcweir 	// font-size
1835cdf0e10cSrcweir 	CSS1Expression aExpr( pExpr->GetType(), pExpr->GetString(),
1836cdf0e10cSrcweir 						  pExpr->GetNumber() );
1837cdf0e10cSrcweir 	ParseCSS1_font_size( &aExpr, rItemSet, rPropInfo, rParser );
1838cdf0e10cSrcweir 	pExpr = pExpr->GetNext();
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir 	if( !pExpr )
1841cdf0e10cSrcweir 		return;
1842cdf0e10cSrcweir 
1843cdf0e10cSrcweir 	// [ '/' line-height ]?
1844cdf0e10cSrcweir 	if( '/' == pExpr->GetOp() )
1845cdf0e10cSrcweir 	{
1846cdf0e10cSrcweir 		// '/' line-height
1847cdf0e10cSrcweir 		aExpr.Set( pExpr->GetType(), pExpr->GetString(), pExpr->GetNumber() );
1848cdf0e10cSrcweir 		ParseCSS1_line_height( &aExpr, rItemSet, rPropInfo, rParser );
1849cdf0e10cSrcweir 
1850cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
1851cdf0e10cSrcweir 	}
1852cdf0e10cSrcweir 
1853cdf0e10cSrcweir 	if( !pExpr || pExpr->GetOp() )
1854cdf0e10cSrcweir 		return;
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir 	// font-family
1857cdf0e10cSrcweir 	ParseCSS1_font_family( pExpr, rItemSet, rPropInfo, rParser );
1858cdf0e10cSrcweir }
1859cdf0e10cSrcweir 
1860cdf0e10cSrcweir /*  */
1861cdf0e10cSrcweir 
ParseCSS1_letter_spacing(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1862cdf0e10cSrcweir static void ParseCSS1_letter_spacing( const CSS1Expression *pExpr,
1863cdf0e10cSrcweir 									  SfxItemSet &rItemSet,
1864cdf0e10cSrcweir 									  SvxCSS1PropertyInfo& /*rPropInfo*/,
1865cdf0e10cSrcweir 									  const SvxCSS1Parser& /*rParser*/ )
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 	switch( pExpr->GetType() )
1870cdf0e10cSrcweir 	{
1871cdf0e10cSrcweir 	case CSS1_LENGTH:
1872cdf0e10cSrcweir 		rItemSet.Put( SvxKerningItem( (short)pExpr->GetSLength(),
1873cdf0e10cSrcweir 									  aItemIds.nKerning ) );
1874cdf0e10cSrcweir 		break;
1875cdf0e10cSrcweir 
1876cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
1877cdf0e10cSrcweir 		{
1878cdf0e10cSrcweir 			long nPWidth = (long)pExpr->GetNumber();
1879cdf0e10cSrcweir 			long nPHeight = 0;
1880cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
1881cdf0e10cSrcweir 			rItemSet.Put( SvxKerningItem( (short)nPWidth, aItemIds.nKerning ) );
1882cdf0e10cSrcweir 		}
1883cdf0e10cSrcweir 		break;
1884cdf0e10cSrcweir 
1885cdf0e10cSrcweir 	case CSS1_NUMBER:
1886cdf0e10cSrcweir 		if( pExpr->GetNumber() == 0 )
1887cdf0e10cSrcweir 		{
1888cdf0e10cSrcweir 			// eigentlich unnoetig, aber wir sind ja tollerant
1889cdf0e10cSrcweir 			rItemSet.Put( SvxKerningItem( (short)0, aItemIds.nKerning ) );
1890cdf0e10cSrcweir 		}
1891cdf0e10cSrcweir 		break;
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir 	case CSS1_IDENT:
1894cdf0e10cSrcweir 	case CSS1_STRING: // Vorschtshalber auch MS-IE
1895cdf0e10cSrcweir 		if( pExpr->GetString().EqualsIgnoreCaseAscii(sCSS1_PV_normal) )
1896cdf0e10cSrcweir 		{
1897cdf0e10cSrcweir 			rItemSet.Put( SvxKerningItem( (short)0, aItemIds.nKerning ) );
1898cdf0e10cSrcweir 		}
1899cdf0e10cSrcweir 		break;
1900cdf0e10cSrcweir 	default:
1901cdf0e10cSrcweir 		;
1902cdf0e10cSrcweir 	}
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir 
1905cdf0e10cSrcweir /*  */
1906cdf0e10cSrcweir 
ParseCSS1_text_decoration(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)1907cdf0e10cSrcweir static void ParseCSS1_text_decoration( const CSS1Expression *pExpr,
1908cdf0e10cSrcweir 									   SfxItemSet &rItemSet,
1909cdf0e10cSrcweir 									   SvxCSS1PropertyInfo& /*rPropInfo*/,
1910cdf0e10cSrcweir 									   const SvxCSS1Parser& /*rParser*/ )
1911cdf0e10cSrcweir {
1912cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
1913cdf0e10cSrcweir 
1914cdf0e10cSrcweir 	sal_Bool bUnderline = sal_False;
1915cdf0e10cSrcweir 	sal_Bool bOverline = sal_False;
1916cdf0e10cSrcweir 	sal_Bool bCrossedOut = sal_False;
1917cdf0e10cSrcweir 	sal_Bool bBlink = sal_False;
1918cdf0e10cSrcweir 	sal_Bool bBlinkOn = sal_False;
1919cdf0e10cSrcweir 	FontUnderline eUnderline  = UNDERLINE_NONE;
1920cdf0e10cSrcweir 	FontUnderline eOverline   = UNDERLINE_NONE;
1921cdf0e10cSrcweir 	FontStrikeout eCrossedOut = STRIKEOUT_NONE;
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir 	// der Wert kann zwei Werte enthalten! Und MS-IE auch Strings
1924cdf0e10cSrcweir 	while( pExpr && (pExpr->GetType() == CSS1_IDENT ||
1925cdf0e10cSrcweir 					 pExpr->GetType() == CSS1_STRING) && !pExpr->GetOp() )
1926cdf0e10cSrcweir 	{
1927cdf0e10cSrcweir 		String aValue = pExpr->GetString();
1928cdf0e10cSrcweir 		aValue.ToLowerAscii();
1929cdf0e10cSrcweir 		sal_Bool bKnown = sal_False;
1930cdf0e10cSrcweir 
1931cdf0e10cSrcweir 		switch( aValue.GetChar( 0 ) )
1932cdf0e10cSrcweir 		{
1933cdf0e10cSrcweir 		case 'n':
1934cdf0e10cSrcweir 			if( aValue.EqualsAscii( sCSS1_PV_none ) )
1935cdf0e10cSrcweir 			{
1936cdf0e10cSrcweir 				bUnderline = sal_True;
1937cdf0e10cSrcweir 				eUnderline = UNDERLINE_NONE;
1938cdf0e10cSrcweir 
1939cdf0e10cSrcweir 				bOverline = sal_True;
1940cdf0e10cSrcweir 				eOverline = UNDERLINE_NONE;
1941cdf0e10cSrcweir 
1942cdf0e10cSrcweir 				bCrossedOut = sal_True;
1943cdf0e10cSrcweir 				eCrossedOut = STRIKEOUT_NONE;
1944cdf0e10cSrcweir 
1945cdf0e10cSrcweir 				bBlink = sal_True;
1946cdf0e10cSrcweir 				bBlinkOn = sal_False;
1947cdf0e10cSrcweir 
1948cdf0e10cSrcweir 				bKnown = sal_True;
1949cdf0e10cSrcweir 			}
1950cdf0e10cSrcweir 			break;
1951cdf0e10cSrcweir 
1952cdf0e10cSrcweir 		case 'u':
1953cdf0e10cSrcweir 			if( aValue.EqualsAscii( sCSS1_PV_underline ) )
1954cdf0e10cSrcweir 			{
1955cdf0e10cSrcweir 				bUnderline = sal_True;
1956cdf0e10cSrcweir 				eUnderline = UNDERLINE_SINGLE;
1957cdf0e10cSrcweir 
1958cdf0e10cSrcweir 				bKnown = sal_True;
1959cdf0e10cSrcweir 			}
1960cdf0e10cSrcweir 			break;
1961cdf0e10cSrcweir 
1962cdf0e10cSrcweir 		case 'o':
1963cdf0e10cSrcweir 			if( aValue.EqualsAscii( sCSS1_PV_overline ) )
1964cdf0e10cSrcweir 			{
1965cdf0e10cSrcweir 				bOverline = sal_True;
1966cdf0e10cSrcweir 				eOverline = UNDERLINE_SINGLE;
1967cdf0e10cSrcweir 
1968cdf0e10cSrcweir 				bKnown = sal_True;
1969cdf0e10cSrcweir 			}
1970cdf0e10cSrcweir 			break;
1971cdf0e10cSrcweir 
1972cdf0e10cSrcweir 		case 'l':
1973cdf0e10cSrcweir 			if( aValue.EqualsAscii( sCSS1_PV_line_through ) )
1974cdf0e10cSrcweir 			{
1975cdf0e10cSrcweir 				bCrossedOut = sal_True;
1976cdf0e10cSrcweir 				eCrossedOut = STRIKEOUT_SINGLE;
1977cdf0e10cSrcweir 
1978cdf0e10cSrcweir 				bKnown = sal_True;
1979cdf0e10cSrcweir 			}
1980cdf0e10cSrcweir 			break;
1981cdf0e10cSrcweir 
1982cdf0e10cSrcweir 		case 'b':
1983cdf0e10cSrcweir 			if( aValue.EqualsAscii( sCSS1_PV_blink ) )
1984cdf0e10cSrcweir 			{
1985cdf0e10cSrcweir 				bBlink = sal_True;
1986cdf0e10cSrcweir 				bBlinkOn = sal_True;
1987cdf0e10cSrcweir 
1988cdf0e10cSrcweir 				bKnown = sal_True;
1989cdf0e10cSrcweir 			}
1990cdf0e10cSrcweir 			break;
1991cdf0e10cSrcweir 		}
1992cdf0e10cSrcweir 
1993cdf0e10cSrcweir 		if( !bKnown )
1994cdf0e10cSrcweir 		{
1995cdf0e10cSrcweir 			bUnderline = sal_True;
1996cdf0e10cSrcweir 			eUnderline = UNDERLINE_SINGLE;
1997cdf0e10cSrcweir 		}
1998cdf0e10cSrcweir 
1999cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2000cdf0e10cSrcweir 	}
2001cdf0e10cSrcweir 
2002cdf0e10cSrcweir 	if( bUnderline )
2003cdf0e10cSrcweir 		rItemSet.Put( SvxUnderlineItem( eUnderline, aItemIds.nUnderline ) );
2004cdf0e10cSrcweir 
2005cdf0e10cSrcweir 	if( bOverline )
2006cdf0e10cSrcweir 		rItemSet.Put( SvxOverlineItem( eOverline, aItemIds.nOverline ) );
2007cdf0e10cSrcweir 
2008cdf0e10cSrcweir 	if( bCrossedOut )
2009cdf0e10cSrcweir 		rItemSet.Put( SvxCrossedOutItem( eCrossedOut, aItemIds.nCrossedOut ) );
2010cdf0e10cSrcweir 
2011cdf0e10cSrcweir 	if( bBlink )
2012cdf0e10cSrcweir 		rItemSet.Put( SvxBlinkItem( bBlinkOn, aItemIds.nBlink ) );
2013cdf0e10cSrcweir }
2014cdf0e10cSrcweir 
2015cdf0e10cSrcweir /*  */
2016cdf0e10cSrcweir 
ParseCSS1_text_align(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)2017cdf0e10cSrcweir static void ParseCSS1_text_align( const CSS1Expression *pExpr,
2018cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
2019cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& /*rPropInfo*/,
2020cdf0e10cSrcweir 								  const SvxCSS1Parser& /*rParser*/ )
2021cdf0e10cSrcweir {
2022cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2023cdf0e10cSrcweir 
2024cdf0e10cSrcweir 	if( CSS1_IDENT==pExpr->GetType() ||
2025cdf0e10cSrcweir 		CSS1_STRING==pExpr->GetType() ) // MS-IE, mal wieder
2026cdf0e10cSrcweir 	{
2027cdf0e10cSrcweir 		sal_uInt16 nAdjust;
2028cdf0e10cSrcweir 		if( SvxCSS1Parser::GetEnum( aTextAlignTable, pExpr->GetString(),
2029cdf0e10cSrcweir 									nAdjust ) )
2030cdf0e10cSrcweir 		{
2031cdf0e10cSrcweir 			rItemSet.Put( SvxAdjustItem( (SvxAdjust)nAdjust,
2032cdf0e10cSrcweir 										 aItemIds.nAdjust ) );
2033cdf0e10cSrcweir 		}
2034cdf0e10cSrcweir 	}
2035cdf0e10cSrcweir }
2036cdf0e10cSrcweir 
2037cdf0e10cSrcweir /*  */
2038cdf0e10cSrcweir 
ParseCSS1_text_indent(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2039cdf0e10cSrcweir static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
2040cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
2041cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& rPropInfo,
2042cdf0e10cSrcweir 								   const SvxCSS1Parser& /*rParser*/ )
2043cdf0e10cSrcweir {
2044cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2045cdf0e10cSrcweir 
2046cdf0e10cSrcweir 	short nIndent = 0;
2047cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2048cdf0e10cSrcweir 	switch( pExpr->GetType() )
2049cdf0e10cSrcweir 	{
2050cdf0e10cSrcweir 	case CSS1_LENGTH:
2051cdf0e10cSrcweir 		nIndent = (short)pExpr->GetSLength();
2052cdf0e10cSrcweir 		bSet = sal_True;
2053cdf0e10cSrcweir 		break;
2054cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2055cdf0e10cSrcweir 		{
2056cdf0e10cSrcweir 			long nPWidth = (long)pExpr->GetNumber();
2057cdf0e10cSrcweir 			long nPHeight = 0;
2058cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2059cdf0e10cSrcweir 			nIndent = (short)nPWidth;
2060cdf0e10cSrcweir 			bSet = sal_True;
2061cdf0e10cSrcweir 		}
2062cdf0e10cSrcweir 		break;
2063cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2064cdf0e10cSrcweir 		// koennen wir nicht
2065cdf0e10cSrcweir 		break;
2066cdf0e10cSrcweir 	default:
2067cdf0e10cSrcweir 		;
2068cdf0e10cSrcweir 	}
2069cdf0e10cSrcweir 
2070cdf0e10cSrcweir 	if( bSet )
2071cdf0e10cSrcweir 	{
2072cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2073cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nLRSpace, sal_False,
2074cdf0e10cSrcweir 												   &pItem ) )
2075cdf0e10cSrcweir 		{
2076cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem*)pItem) );
2077cdf0e10cSrcweir 			aLRItem.SetTxtFirstLineOfst( nIndent );
2078cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2079cdf0e10cSrcweir 		}
2080cdf0e10cSrcweir 		else
2081cdf0e10cSrcweir 		{
2082cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2083cdf0e10cSrcweir 			aLRItem.SetTxtFirstLineOfst( nIndent );
2084cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2085cdf0e10cSrcweir 		}
2086cdf0e10cSrcweir 		rPropInfo.bTextIndent = sal_True;
2087cdf0e10cSrcweir 	}
2088cdf0e10cSrcweir }
2089cdf0e10cSrcweir 
2090cdf0e10cSrcweir /*  */
2091cdf0e10cSrcweir 
ParseCSS1_margin_left(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2092cdf0e10cSrcweir static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
2093cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
2094cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& rPropInfo,
2095cdf0e10cSrcweir 								   const SvxCSS1Parser& /*rParser*/ )
2096cdf0e10cSrcweir {
2097cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2098cdf0e10cSrcweir 
2099cdf0e10cSrcweir 	long nLeft = 0;
2100cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2101cdf0e10cSrcweir 	switch( pExpr->GetType() )
2102cdf0e10cSrcweir 	{
2103cdf0e10cSrcweir 	case CSS1_LENGTH:
2104cdf0e10cSrcweir 		{
2105cdf0e10cSrcweir 			nLeft = pExpr->GetSLength();
2106cdf0e10cSrcweir 			bSet = sal_True;
2107cdf0e10cSrcweir 		}
2108cdf0e10cSrcweir 		break;
2109cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2110cdf0e10cSrcweir 		{
2111cdf0e10cSrcweir 			nLeft = (long)pExpr->GetNumber();
2112cdf0e10cSrcweir 			long nPHeight = 0;
2113cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nLeft, nPHeight );
2114cdf0e10cSrcweir 			bSet = sal_True;
2115cdf0e10cSrcweir 		}
2116cdf0e10cSrcweir 		break;
2117cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2118cdf0e10cSrcweir 		// koennen wir nicht
2119cdf0e10cSrcweir 		break;
2120cdf0e10cSrcweir 	default:
2121cdf0e10cSrcweir 		;
2122cdf0e10cSrcweir 	}
2123cdf0e10cSrcweir 
2124cdf0e10cSrcweir 	if( bSet )
2125cdf0e10cSrcweir 	{
2126cdf0e10cSrcweir 		rPropInfo.nLeftMargin = nLeft;
2127cdf0e10cSrcweir 		if( nLeft < 0 )
2128cdf0e10cSrcweir 			nLeft = 0;
2129cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2130cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nLRSpace, sal_False,
2131cdf0e10cSrcweir 												   &pItem ) )
2132cdf0e10cSrcweir 		{
2133cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem*)pItem) );
2134cdf0e10cSrcweir 			aLRItem.SetTxtLeft( (sal_uInt16)nLeft );
2135cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2136cdf0e10cSrcweir 		}
2137cdf0e10cSrcweir 		else
2138cdf0e10cSrcweir 		{
2139cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2140cdf0e10cSrcweir 			aLRItem.SetTxtLeft( (sal_uInt16)nLeft );
2141cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2142cdf0e10cSrcweir 		}
2143cdf0e10cSrcweir 		rPropInfo.bLeftMargin = sal_True;
2144cdf0e10cSrcweir 	}
2145cdf0e10cSrcweir }
2146cdf0e10cSrcweir 
2147cdf0e10cSrcweir /*  */
2148cdf0e10cSrcweir 
ParseCSS1_margin_right(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2149cdf0e10cSrcweir static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
2150cdf0e10cSrcweir 									SfxItemSet &rItemSet,
2151cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2152cdf0e10cSrcweir 									const SvxCSS1Parser& /*rParser*/ )
2153cdf0e10cSrcweir {
2154cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2155cdf0e10cSrcweir 
2156cdf0e10cSrcweir 	long nRight = 0;
2157cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2158cdf0e10cSrcweir 	switch( pExpr->GetType() )
2159cdf0e10cSrcweir 	{
2160cdf0e10cSrcweir 	case CSS1_LENGTH:
2161cdf0e10cSrcweir 		{
2162cdf0e10cSrcweir 			nRight = pExpr->GetSLength();
2163cdf0e10cSrcweir 			bSet = sal_True;
2164cdf0e10cSrcweir 		}
2165cdf0e10cSrcweir 		break;
2166cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2167cdf0e10cSrcweir 		{
2168cdf0e10cSrcweir 			nRight = (long)pExpr->GetNumber();
2169cdf0e10cSrcweir 			long nPHeight = 0;
2170cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nRight, nPHeight );
2171cdf0e10cSrcweir 			bSet = sal_True;
2172cdf0e10cSrcweir 		}
2173cdf0e10cSrcweir 		break;
2174cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2175cdf0e10cSrcweir 		// koennen wir nicht
2176cdf0e10cSrcweir 		break;
2177cdf0e10cSrcweir 	default:
2178cdf0e10cSrcweir 		;
2179cdf0e10cSrcweir 	}
2180cdf0e10cSrcweir 
2181cdf0e10cSrcweir 	if( bSet )
2182cdf0e10cSrcweir 	{
2183cdf0e10cSrcweir 		rPropInfo.nRightMargin = nRight;
2184cdf0e10cSrcweir 		if( nRight < 0 )
2185cdf0e10cSrcweir 			nRight = 0;
2186cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2187cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nLRSpace, sal_False,
2188cdf0e10cSrcweir 												   &pItem ) )
2189cdf0e10cSrcweir 		{
2190cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem*)pItem) );
2191cdf0e10cSrcweir 			aLRItem.SetRight( (sal_uInt16)nRight );
2192cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2193cdf0e10cSrcweir 		}
2194cdf0e10cSrcweir 		else
2195cdf0e10cSrcweir 		{
2196cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2197cdf0e10cSrcweir 			aLRItem.SetRight( (sal_uInt16)nRight );
2198cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2199cdf0e10cSrcweir 		}
2200cdf0e10cSrcweir 		rPropInfo.bRightMargin = sal_True;
2201cdf0e10cSrcweir 	}
2202cdf0e10cSrcweir }
2203cdf0e10cSrcweir 
2204cdf0e10cSrcweir /*  */
2205cdf0e10cSrcweir 
ParseCSS1_margin_top(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2206cdf0e10cSrcweir static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
2207cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
2208cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& rPropInfo,
2209cdf0e10cSrcweir 								  const SvxCSS1Parser& /*rParser*/ )
2210cdf0e10cSrcweir {
2211cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2212cdf0e10cSrcweir 
2213cdf0e10cSrcweir 	sal_uInt16 nUpper = 0;
2214cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2215cdf0e10cSrcweir 	switch( pExpr->GetType() )
2216cdf0e10cSrcweir 	{
2217cdf0e10cSrcweir 	case CSS1_LENGTH:
2218cdf0e10cSrcweir 		{
2219cdf0e10cSrcweir 			long nTmp = pExpr->GetSLength();
2220cdf0e10cSrcweir 			if( nTmp < 0 )
2221cdf0e10cSrcweir 				nTmp = 0;
2222cdf0e10cSrcweir 			nUpper = (sal_uInt16)nTmp;
2223cdf0e10cSrcweir 			bSet = sal_True;
2224cdf0e10cSrcweir 		}
2225cdf0e10cSrcweir 		break;
2226cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2227cdf0e10cSrcweir 		{
2228cdf0e10cSrcweir 			long nPWidth = 0;
2229cdf0e10cSrcweir 			long nPHeight =  (long)pExpr->GetNumber();
2230cdf0e10cSrcweir 			if( nPHeight < 0 )
2231cdf0e10cSrcweir 				nPHeight = 0;
2232cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2233cdf0e10cSrcweir 			nUpper = (sal_uInt16)nPHeight;
2234cdf0e10cSrcweir 			bSet = sal_True;
2235cdf0e10cSrcweir 		}
2236cdf0e10cSrcweir 		break;
2237cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2238cdf0e10cSrcweir 		// koennen wir nicht
2239cdf0e10cSrcweir 		break;
2240cdf0e10cSrcweir 	default:
2241cdf0e10cSrcweir 		;
2242cdf0e10cSrcweir 	}
2243cdf0e10cSrcweir 
2244cdf0e10cSrcweir 	if( bSet )
2245cdf0e10cSrcweir 	{
2246cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2247cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nULSpace, sal_False,
2248cdf0e10cSrcweir 												   &pItem ) )
2249cdf0e10cSrcweir 		{
2250cdf0e10cSrcweir 			SvxULSpaceItem aULItem( *((const SvxULSpaceItem*)pItem) );
2251cdf0e10cSrcweir 			aULItem.SetUpper( nUpper );
2252cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2253cdf0e10cSrcweir 		}
2254cdf0e10cSrcweir 		else
2255cdf0e10cSrcweir 		{
2256cdf0e10cSrcweir 			SvxULSpaceItem aULItem( aItemIds.nULSpace );
2257cdf0e10cSrcweir 			aULItem.SetUpper( nUpper );
2258cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2259cdf0e10cSrcweir 		}
2260cdf0e10cSrcweir 		rPropInfo.bTopMargin = sal_True;
2261cdf0e10cSrcweir 	}
2262cdf0e10cSrcweir }
2263cdf0e10cSrcweir 
2264cdf0e10cSrcweir /*  */
2265cdf0e10cSrcweir 
ParseCSS1_margin_bottom(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2266cdf0e10cSrcweir static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
2267cdf0e10cSrcweir 									 SfxItemSet &rItemSet,
2268cdf0e10cSrcweir 									 SvxCSS1PropertyInfo& rPropInfo,
2269cdf0e10cSrcweir 									 const SvxCSS1Parser& /*rParser*/ )
2270cdf0e10cSrcweir {
2271cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2272cdf0e10cSrcweir 
2273cdf0e10cSrcweir 	sal_uInt16 nLower = 0;
2274cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2275cdf0e10cSrcweir 	switch( pExpr->GetType() )
2276cdf0e10cSrcweir 	{
2277cdf0e10cSrcweir 	case CSS1_LENGTH:
2278cdf0e10cSrcweir 		{
2279cdf0e10cSrcweir 			long nTmp = pExpr->GetSLength();
2280cdf0e10cSrcweir 			if( nTmp < 0 )
2281cdf0e10cSrcweir 				nTmp = 0;
2282cdf0e10cSrcweir 			nLower = (sal_uInt16)nTmp;
2283cdf0e10cSrcweir 			bSet = sal_True;
2284cdf0e10cSrcweir 		}
2285cdf0e10cSrcweir 		break;
2286cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2287cdf0e10cSrcweir 		{
2288cdf0e10cSrcweir 			long nPWidth = 0;
2289cdf0e10cSrcweir 			long nPHeight =  (long)pExpr->GetNumber();
2290cdf0e10cSrcweir 			if( nPHeight < 0 )
2291cdf0e10cSrcweir 				nPHeight = 0;
2292cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2293cdf0e10cSrcweir 			nLower = (sal_uInt16)nPHeight;
2294cdf0e10cSrcweir 			bSet = sal_True;
2295cdf0e10cSrcweir 		}
2296cdf0e10cSrcweir 		break;
2297cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2298cdf0e10cSrcweir 		// koennen wir nicht
2299cdf0e10cSrcweir 		break;
2300cdf0e10cSrcweir 	default:
2301cdf0e10cSrcweir 		;
2302cdf0e10cSrcweir 	}
2303cdf0e10cSrcweir 
2304cdf0e10cSrcweir 	if( bSet )
2305cdf0e10cSrcweir 	{
2306cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2307cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nULSpace, sal_False,
2308cdf0e10cSrcweir 												   &pItem ) )
2309cdf0e10cSrcweir 		{
2310cdf0e10cSrcweir 			SvxULSpaceItem aULItem( *((const SvxULSpaceItem*)pItem) );
2311cdf0e10cSrcweir 			aULItem.SetLower( nLower );
2312cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2313cdf0e10cSrcweir 		}
2314cdf0e10cSrcweir 		else
2315cdf0e10cSrcweir 		{
2316cdf0e10cSrcweir 			SvxULSpaceItem aULItem( aItemIds.nULSpace );
2317cdf0e10cSrcweir 			aULItem.SetLower( nLower );
2318cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2319cdf0e10cSrcweir 		}
2320cdf0e10cSrcweir 		rPropInfo.bBottomMargin = sal_True;
2321cdf0e10cSrcweir 	}
2322cdf0e10cSrcweir }
2323cdf0e10cSrcweir 
2324cdf0e10cSrcweir /*  */
2325cdf0e10cSrcweir 
ParseCSS1_margin(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2326cdf0e10cSrcweir static void ParseCSS1_margin( const CSS1Expression *pExpr,
2327cdf0e10cSrcweir 							  SfxItemSet &rItemSet,
2328cdf0e10cSrcweir 							  SvxCSS1PropertyInfo& rPropInfo,
2329cdf0e10cSrcweir 							  const SvxCSS1Parser& /*rParser*/ )
2330cdf0e10cSrcweir {
2331cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2332cdf0e10cSrcweir 
2333cdf0e10cSrcweir 	long nMargins[4] = { 0, 0, 0, 0 };
2334cdf0e10cSrcweir 	sal_Bool bSetMargins[4] = { sal_False, sal_False, sal_False, sal_False };
2335cdf0e10cSrcweir 
2336cdf0e10cSrcweir 	for( sal_uInt16 i=0; pExpr && i<4 && !pExpr->GetOp(); i++ )
2337cdf0e10cSrcweir 	{
2338cdf0e10cSrcweir 		sal_Bool bSetThis = sal_False;
2339cdf0e10cSrcweir         long nMargin = 0;
2340cdf0e10cSrcweir 
2341cdf0e10cSrcweir 		switch( pExpr->GetType() )
2342cdf0e10cSrcweir 		{
2343cdf0e10cSrcweir 		case CSS1_LENGTH:
2344cdf0e10cSrcweir 			{
2345cdf0e10cSrcweir 				nMargin = pExpr->GetSLength();
2346cdf0e10cSrcweir 				bSetThis = sal_True;
2347cdf0e10cSrcweir 			}
2348cdf0e10cSrcweir 			break;
2349cdf0e10cSrcweir 		case CSS1_PIXLENGTH:
2350cdf0e10cSrcweir 			{
2351cdf0e10cSrcweir 				long nPWidth = 0;
2352cdf0e10cSrcweir 				nMargin =  (long)pExpr->GetNumber();
2353cdf0e10cSrcweir 				SvxCSS1Parser::PixelToTwip( nPWidth, nMargin );
2354cdf0e10cSrcweir 				bSetThis = sal_True;
2355cdf0e10cSrcweir 			}
2356cdf0e10cSrcweir 			break;
2357cdf0e10cSrcweir 		case CSS1_PERCENTAGE:
2358cdf0e10cSrcweir 			// koennen wir nicht
2359cdf0e10cSrcweir 			break;
2360cdf0e10cSrcweir 		default:
2361cdf0e10cSrcweir 			;
2362cdf0e10cSrcweir 		}
2363cdf0e10cSrcweir 
2364cdf0e10cSrcweir 		if( bSetThis )
2365cdf0e10cSrcweir 		{
2366cdf0e10cSrcweir 			// 0 = top
2367cdf0e10cSrcweir 			// 1 = right
2368cdf0e10cSrcweir 			// 2 = bottom
2369cdf0e10cSrcweir 			// 3 = left
2370cdf0e10cSrcweir 			switch( i )
2371cdf0e10cSrcweir 			{
2372cdf0e10cSrcweir 			case 0:
2373cdf0e10cSrcweir 				nMargins[0] = nMargins[1] =nMargins[2] = nMargins[3] = nMargin;
2374cdf0e10cSrcweir 				bSetMargins[0] = bSetMargins[1] =
2375cdf0e10cSrcweir 				bSetMargins[2] = bSetMargins[3] = sal_True;
2376cdf0e10cSrcweir 				break;
2377cdf0e10cSrcweir 			case 1:
2378cdf0e10cSrcweir 				nMargins[1] = nMargins[3] = nMargin;	// right + left
2379cdf0e10cSrcweir 				bSetMargins[1] = bSetMargins[3] = sal_True;
2380cdf0e10cSrcweir 				break;
2381cdf0e10cSrcweir 			case 2:
2382cdf0e10cSrcweir 				nMargins[2] = nMargin;	// bottom
2383cdf0e10cSrcweir 				bSetMargins[2] = sal_True;
2384cdf0e10cSrcweir 				break;
2385cdf0e10cSrcweir 			case 3:
2386cdf0e10cSrcweir 				nMargins[3] = nMargin;	// left
2387cdf0e10cSrcweir 				bSetMargins[3] = sal_True;
2388cdf0e10cSrcweir 				break;
2389cdf0e10cSrcweir 			}
2390cdf0e10cSrcweir 		}
2391cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2392cdf0e10cSrcweir 	}
2393cdf0e10cSrcweir 
2394cdf0e10cSrcweir 	if( bSetMargins[3] || bSetMargins[1] )
2395cdf0e10cSrcweir 	{
2396cdf0e10cSrcweir 		if( bSetMargins[3] )
2397cdf0e10cSrcweir 		{
2398cdf0e10cSrcweir 			rPropInfo.bLeftMargin = sal_True;
2399cdf0e10cSrcweir 			rPropInfo.nLeftMargin = nMargins[3];
2400cdf0e10cSrcweir 			if( nMargins[3] < 0 )
2401cdf0e10cSrcweir 				nMargins[3] = 0;
2402cdf0e10cSrcweir 		}
2403cdf0e10cSrcweir 		if( bSetMargins[1] )
2404cdf0e10cSrcweir 		{
2405cdf0e10cSrcweir 			rPropInfo.bRightMargin = sal_True;
2406cdf0e10cSrcweir 			rPropInfo.nRightMargin = nMargins[1];
2407cdf0e10cSrcweir 			if( nMargins[1] < 0 )
2408cdf0e10cSrcweir 				nMargins[1] = 0;
2409cdf0e10cSrcweir 		}
2410cdf0e10cSrcweir 
2411cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2412cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nLRSpace, sal_False,
2413cdf0e10cSrcweir 												   &pItem ) )
2414cdf0e10cSrcweir 		{
2415cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem*)pItem) );
2416cdf0e10cSrcweir 			if( bSetMargins[3] )
2417cdf0e10cSrcweir 				aLRItem.SetLeft( (sal_uInt16)nMargins[3] );
2418cdf0e10cSrcweir 			if( bSetMargins[1] )
2419cdf0e10cSrcweir 				aLRItem.SetRight( (sal_uInt16)nMargins[1] );
2420cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2421cdf0e10cSrcweir 		}
2422cdf0e10cSrcweir 		else
2423cdf0e10cSrcweir 		{
2424cdf0e10cSrcweir 			SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
2425cdf0e10cSrcweir 			if( bSetMargins[3] )
2426cdf0e10cSrcweir 				aLRItem.SetLeft( (sal_uInt16)nMargins[3] );
2427cdf0e10cSrcweir 			if( bSetMargins[1] )
2428cdf0e10cSrcweir 				aLRItem.SetRight( (sal_uInt16)nMargins[1] );
2429cdf0e10cSrcweir 			rItemSet.Put( aLRItem );
2430cdf0e10cSrcweir 		}
2431cdf0e10cSrcweir 	}
2432cdf0e10cSrcweir 
2433cdf0e10cSrcweir 	if( bSetMargins[0] || bSetMargins[2] )
2434cdf0e10cSrcweir 	{
2435cdf0e10cSrcweir 		if( nMargins[0] < 0 )
2436cdf0e10cSrcweir 			nMargins[0] = 0;
2437cdf0e10cSrcweir 		if( nMargins[2] < 0 )
2438cdf0e10cSrcweir 			nMargins[2] = 0;
2439cdf0e10cSrcweir 
2440cdf0e10cSrcweir 		const SfxPoolItem* pItem;
2441cdf0e10cSrcweir 		if( SFX_ITEM_SET == rItemSet.GetItemState( aItemIds.nULSpace, sal_False,
2442cdf0e10cSrcweir 												   &pItem ) )
2443cdf0e10cSrcweir 		{
2444cdf0e10cSrcweir 			SvxULSpaceItem aULItem( *((const SvxULSpaceItem*)pItem) );
2445cdf0e10cSrcweir 			if( bSetMargins[0] )
2446cdf0e10cSrcweir 				aULItem.SetUpper( (sal_uInt16)nMargins[0] );
2447cdf0e10cSrcweir 			if( bSetMargins[2] )
2448cdf0e10cSrcweir 				aULItem.SetLower( (sal_uInt16)nMargins[2] );
2449cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2450cdf0e10cSrcweir 		}
2451cdf0e10cSrcweir 		else
2452cdf0e10cSrcweir 		{
2453cdf0e10cSrcweir 			SvxULSpaceItem aULItem( aItemIds.nULSpace );
2454cdf0e10cSrcweir 			if( bSetMargins[0] )
2455cdf0e10cSrcweir 				aULItem.SetUpper( (sal_uInt16)nMargins[0] );
2456cdf0e10cSrcweir 			if( bSetMargins[2] )
2457cdf0e10cSrcweir 				aULItem.SetLower( (sal_uInt16)nMargins[2] );
2458cdf0e10cSrcweir 			rItemSet.Put( aULItem );
2459cdf0e10cSrcweir 		}
2460cdf0e10cSrcweir 
2461cdf0e10cSrcweir 		rPropInfo.bTopMargin |= bSetMargins[0];
2462cdf0e10cSrcweir 		rPropInfo.bBottomMargin |= bSetMargins[2];
2463cdf0e10cSrcweir 	}
2464cdf0e10cSrcweir }
2465cdf0e10cSrcweir 
2466cdf0e10cSrcweir /*  */
2467cdf0e10cSrcweir 
ParseCSS1_padding_xxx(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &,sal_uInt16 nWhichLine)2468cdf0e10cSrcweir static sal_Bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr,
2469cdf0e10cSrcweir 								   SfxItemSet & /*rItemSet*/,
2470cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& rPropInfo,
2471cdf0e10cSrcweir 								   const SvxCSS1Parser& /*rParser*/,
2472cdf0e10cSrcweir 								   sal_uInt16 nWhichLine )
2473cdf0e10cSrcweir {
2474cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2475cdf0e10cSrcweir 
2476cdf0e10cSrcweir 	sal_Bool bSet = sal_False;
2477cdf0e10cSrcweir 	sal_uInt16 nDist = 0;
2478cdf0e10cSrcweir 
2479cdf0e10cSrcweir 	switch( pExpr->GetType() )
2480cdf0e10cSrcweir 	{
2481cdf0e10cSrcweir 	case CSS1_LENGTH:
2482cdf0e10cSrcweir 		{
2483cdf0e10cSrcweir 			long nTmp = pExpr->GetSLength();
2484cdf0e10cSrcweir 			if( nTmp < 0 )
2485cdf0e10cSrcweir 				nTmp = 0;
2486cdf0e10cSrcweir 			else if( nTmp > USHRT_MAX-1 )
2487cdf0e10cSrcweir 				nTmp = USHRT_MAX-1;
2488cdf0e10cSrcweir 			nDist = (sal_uInt16)nTmp;
2489cdf0e10cSrcweir 			bSet = sal_True;
2490cdf0e10cSrcweir 		}
2491cdf0e10cSrcweir 		break;
2492cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2493cdf0e10cSrcweir 		{
2494cdf0e10cSrcweir 			long nPWidth = (long)pExpr->GetNumber();
2495cdf0e10cSrcweir 			long nPHeight = 0;
2496cdf0e10cSrcweir 			if( nPWidth < 0 )
2497cdf0e10cSrcweir 				nPWidth = 0;
2498cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2499cdf0e10cSrcweir 			if( nPWidth > USHRT_MAX-1 )
2500cdf0e10cSrcweir 				nPWidth = USHRT_MAX-1;
2501cdf0e10cSrcweir 			nDist = (sal_uInt16)nPWidth;
2502cdf0e10cSrcweir 			bSet = sal_True;
2503cdf0e10cSrcweir 		}
2504cdf0e10cSrcweir 		break;
2505cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2506cdf0e10cSrcweir 		// koennen wir nicht
2507cdf0e10cSrcweir 		break;
2508cdf0e10cSrcweir 	default:
2509cdf0e10cSrcweir 		;
2510cdf0e10cSrcweir 	}
2511cdf0e10cSrcweir 
2512cdf0e10cSrcweir 	if( bSet )
2513cdf0e10cSrcweir 	{
2514cdf0e10cSrcweir 		switch( nWhichLine )
2515cdf0e10cSrcweir 		{
2516cdf0e10cSrcweir 		case BOX_LINE_TOP:		rPropInfo.nTopBorderDistance = nDist;	break;
2517cdf0e10cSrcweir 		case BOX_LINE_BOTTOM:	rPropInfo.nBottomBorderDistance = nDist;break;
2518cdf0e10cSrcweir 		case BOX_LINE_LEFT:		rPropInfo.nLeftBorderDistance = nDist;	break;
2519cdf0e10cSrcweir 		case BOX_LINE_RIGHT:	rPropInfo.nRightBorderDistance = nDist;	break;
2520cdf0e10cSrcweir 		}
2521cdf0e10cSrcweir 	}
2522cdf0e10cSrcweir 
2523cdf0e10cSrcweir 	return bSet;
2524cdf0e10cSrcweir }
2525cdf0e10cSrcweir 
2526cdf0e10cSrcweir /*  */
2527cdf0e10cSrcweir 
ParseCSS1_padding_top(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2528cdf0e10cSrcweir static void ParseCSS1_padding_top( const CSS1Expression *pExpr,
2529cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
2530cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& rPropInfo,
2531cdf0e10cSrcweir 								   const SvxCSS1Parser& rParser )
2532cdf0e10cSrcweir {
2533cdf0e10cSrcweir 	ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP );
2534cdf0e10cSrcweir }
2535cdf0e10cSrcweir 
ParseCSS1_padding_bottom(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2536cdf0e10cSrcweir static void ParseCSS1_padding_bottom( const CSS1Expression *pExpr,
2537cdf0e10cSrcweir 									  SfxItemSet &rItemSet,
2538cdf0e10cSrcweir 									  SvxCSS1PropertyInfo& rPropInfo,
2539cdf0e10cSrcweir 									  const SvxCSS1Parser& rParser )
2540cdf0e10cSrcweir {
2541cdf0e10cSrcweir 	ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser,
2542cdf0e10cSrcweir 						   BOX_LINE_BOTTOM );
2543cdf0e10cSrcweir }
2544cdf0e10cSrcweir 
ParseCSS1_padding_left(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2545cdf0e10cSrcweir static void ParseCSS1_padding_left( const CSS1Expression *pExpr,
2546cdf0e10cSrcweir 									SfxItemSet &rItemSet,
2547cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2548cdf0e10cSrcweir 									const SvxCSS1Parser& rParser )
2549cdf0e10cSrcweir {
2550cdf0e10cSrcweir 	ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT );
2551cdf0e10cSrcweir }
2552cdf0e10cSrcweir 
ParseCSS1_padding_right(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2553cdf0e10cSrcweir static void ParseCSS1_padding_right( const CSS1Expression *pExpr,
2554cdf0e10cSrcweir 									 SfxItemSet &rItemSet,
2555cdf0e10cSrcweir 									 SvxCSS1PropertyInfo& rPropInfo,
2556cdf0e10cSrcweir 									 const SvxCSS1Parser& rParser )
2557cdf0e10cSrcweir {
2558cdf0e10cSrcweir 	ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser,
2559cdf0e10cSrcweir 						   BOX_LINE_RIGHT );
2560cdf0e10cSrcweir }
2561cdf0e10cSrcweir 
ParseCSS1_padding(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2562cdf0e10cSrcweir static void ParseCSS1_padding( const CSS1Expression *pExpr,
2563cdf0e10cSrcweir 							   SfxItemSet &rItemSet,
2564cdf0e10cSrcweir 							   SvxCSS1PropertyInfo& rPropInfo,
2565cdf0e10cSrcweir 							   const SvxCSS1Parser& rParser )
2566cdf0e10cSrcweir {
2567cdf0e10cSrcweir 	sal_uInt16 n=0;
2568cdf0e10cSrcweir 	while( n<4 && pExpr && !pExpr->GetOp() )
2569cdf0e10cSrcweir 	{
2570cdf0e10cSrcweir 		sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT;
2571cdf0e10cSrcweir 		if( ParseCSS1_padding_xxx( pExpr, rItemSet, rPropInfo, rParser,
2572cdf0e10cSrcweir 								   nLine ) )
2573cdf0e10cSrcweir 		{
2574cdf0e10cSrcweir 			if( n==0 )
2575cdf0e10cSrcweir 			{
2576cdf0e10cSrcweir 				rPropInfo.nTopBorderDistance = rPropInfo.nBottomBorderDistance;
2577cdf0e10cSrcweir 				rPropInfo.nLeftBorderDistance = rPropInfo.nTopBorderDistance;
2578cdf0e10cSrcweir 			}
2579cdf0e10cSrcweir 			if( n <= 1 )
2580cdf0e10cSrcweir 				rPropInfo.nRightBorderDistance = rPropInfo.nLeftBorderDistance;
2581cdf0e10cSrcweir 		}
2582cdf0e10cSrcweir 
2583cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2584cdf0e10cSrcweir 		n++;
2585cdf0e10cSrcweir 	}
2586cdf0e10cSrcweir }
2587cdf0e10cSrcweir 
2588cdf0e10cSrcweir /*  */
2589cdf0e10cSrcweir 
ParseCSS1_border_xxx(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &,sal_uInt16 nWhichLine,sal_Bool bAll)2590cdf0e10cSrcweir static void ParseCSS1_border_xxx( const CSS1Expression *pExpr,
2591cdf0e10cSrcweir 								  SfxItemSet & /*rItemSet*/,
2592cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& rPropInfo,
2593cdf0e10cSrcweir 								  const SvxCSS1Parser& /*rParser*/,
2594cdf0e10cSrcweir 								  sal_uInt16 nWhichLine, sal_Bool bAll )
2595cdf0e10cSrcweir {
2596cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2597cdf0e10cSrcweir 
2598cdf0e10cSrcweir 	sal_uInt16 nWidth = USHRT_MAX;		// die Linien-Dicke
2599cdf0e10cSrcweir 	sal_uInt16 nNWidth = 1;    			// benannte Linien-Dicke (und default)
2600cdf0e10cSrcweir 	CSS1BorderStyle eStyle = CSS1_BS_NONE; // Linien-Style
2601cdf0e10cSrcweir 	Color aColor;
2602cdf0e10cSrcweir 	sal_Bool bColor = sal_False;
2603cdf0e10cSrcweir 
2604cdf0e10cSrcweir 	while( pExpr && !pExpr->GetOp() )
2605cdf0e10cSrcweir 	{
2606cdf0e10cSrcweir 		switch( pExpr->GetType() )
2607cdf0e10cSrcweir 		{
2608cdf0e10cSrcweir 		case CSS1_RGB:
2609cdf0e10cSrcweir 		case CSS1_HEXCOLOR:
2610cdf0e10cSrcweir 			if( pExpr->GetColor( aColor ) )
2611cdf0e10cSrcweir 				bColor = sal_True;
2612cdf0e10cSrcweir 			break;
2613cdf0e10cSrcweir 
2614cdf0e10cSrcweir 		case CSS1_IDENT:
2615cdf0e10cSrcweir 			{
2616cdf0e10cSrcweir 				const String& rValue = pExpr->GetString();
2617cdf0e10cSrcweir 				sal_uInt16 nValue;
2618cdf0e10cSrcweir 				if( SvxCSS1Parser::GetEnum( aBorderWidthTable, rValue, nValue ) )
2619cdf0e10cSrcweir 				{
2620cdf0e10cSrcweir 					nNWidth = nValue;
2621cdf0e10cSrcweir 				}
2622cdf0e10cSrcweir 				else if( SvxCSS1Parser::GetEnum( aBorderStyleTable, rValue, nValue ) )
2623cdf0e10cSrcweir 				{
2624cdf0e10cSrcweir 					eStyle = (CSS1BorderStyle)nValue;
2625cdf0e10cSrcweir 				}
2626cdf0e10cSrcweir 				else if( pExpr->GetColor( aColor ) )
2627cdf0e10cSrcweir 				{
2628cdf0e10cSrcweir 					bColor = sal_True;
2629cdf0e10cSrcweir 				}
2630cdf0e10cSrcweir 			}
2631cdf0e10cSrcweir 			break;
2632cdf0e10cSrcweir 
2633cdf0e10cSrcweir 		case CSS1_LENGTH:
2634cdf0e10cSrcweir 			nWidth = (sal_uInt16)pExpr->GetULength();
2635cdf0e10cSrcweir 			break;
2636cdf0e10cSrcweir 
2637cdf0e10cSrcweir 		case CSS1_PIXLENGTH:
2638cdf0e10cSrcweir 			{
2639cdf0e10cSrcweir 				sal_Bool bHori = nWhichLine == BOX_LINE_TOP ||
2640cdf0e10cSrcweir 							 nWhichLine == BOX_LINE_BOTTOM;
2641cdf0e10cSrcweir 				// Ein Pixel wird zur Haarlinie (ist huebscher)
2642cdf0e10cSrcweir 				long nWidthL = (long)pExpr->GetNumber();
2643cdf0e10cSrcweir 				if( nWidthL > 1 )
2644cdf0e10cSrcweir 				{
2645cdf0e10cSrcweir 					long nPWidth = bHori ? 0 : nWidthL;
2646cdf0e10cSrcweir 					long nPHeight = bHori ? nWidthL : 0;
2647cdf0e10cSrcweir 					SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2648cdf0e10cSrcweir 					nWidth = (sal_uInt16)(bHori ? nPHeight : nPWidth);
2649cdf0e10cSrcweir 				}
2650cdf0e10cSrcweir 				else
2651cdf0e10cSrcweir 					nWidth = 1;
2652cdf0e10cSrcweir 			}
2653cdf0e10cSrcweir 			break;
2654cdf0e10cSrcweir 
2655cdf0e10cSrcweir 		default:
2656cdf0e10cSrcweir 			;
2657cdf0e10cSrcweir 		}
2658cdf0e10cSrcweir 
2659cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2660cdf0e10cSrcweir 	}
2661cdf0e10cSrcweir 
2662cdf0e10cSrcweir 	for( sal_uInt16 i=0; i<4; i++ )
2663cdf0e10cSrcweir 	{
2664cdf0e10cSrcweir 		sal_uInt16 nLine = 0;
2665cdf0e10cSrcweir 		switch( i )
2666cdf0e10cSrcweir 		{
2667cdf0e10cSrcweir 		case 0: nLine = BOX_LINE_TOP; break;
2668cdf0e10cSrcweir 		case 1: nLine = BOX_LINE_BOTTOM; break;
2669cdf0e10cSrcweir 		case 2: nLine = BOX_LINE_LEFT; break;
2670cdf0e10cSrcweir 		case 3: nLine = BOX_LINE_RIGHT; break;
2671cdf0e10cSrcweir 		}
2672cdf0e10cSrcweir 
2673cdf0e10cSrcweir 		if( bAll || nLine == nWhichLine )
2674cdf0e10cSrcweir 		{
2675cdf0e10cSrcweir 			SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nLine );
2676cdf0e10cSrcweir 			pInfo->eStyle = eStyle;
2677cdf0e10cSrcweir 			pInfo->nAbsWidth = nWidth;
2678cdf0e10cSrcweir 			pInfo->nNamedWidth = nNWidth;
2679cdf0e10cSrcweir 			if( bColor )
2680cdf0e10cSrcweir 				pInfo->aColor = aColor;
2681cdf0e10cSrcweir 		}
2682cdf0e10cSrcweir 	}
2683cdf0e10cSrcweir }
2684cdf0e10cSrcweir 
ParseCSS1_border_xxx_width(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &,sal_uInt16 nWhichLine)2685cdf0e10cSrcweir static void ParseCSS1_border_xxx_width( const CSS1Expression *pExpr,
2686cdf0e10cSrcweir 										SfxItemSet & /*rItemSet*/,
2687cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
2688cdf0e10cSrcweir 										const SvxCSS1Parser& /*rParser*/,
2689cdf0e10cSrcweir 										sal_uInt16 nWhichLine )
2690cdf0e10cSrcweir {
2691cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2692cdf0e10cSrcweir 
2693cdf0e10cSrcweir 	sal_uInt16 nWidth = USHRT_MAX;		// die Linien-Dicke
2694cdf0e10cSrcweir 	sal_uInt16 nNWidth = 1;    			// benannte Linien-Dicke (und default)
2695cdf0e10cSrcweir 
2696cdf0e10cSrcweir 	switch( pExpr->GetType() )
2697cdf0e10cSrcweir 	{
2698cdf0e10cSrcweir 	case CSS1_IDENT:
2699cdf0e10cSrcweir 		{
2700cdf0e10cSrcweir 			sal_uInt16 nValue;
2701cdf0e10cSrcweir 			if( SvxCSS1Parser::GetEnum( aBorderWidthTable, pExpr->GetString(), nValue ) )
2702cdf0e10cSrcweir 			{
2703cdf0e10cSrcweir 				nNWidth = nValue;
2704cdf0e10cSrcweir 			}
2705cdf0e10cSrcweir 		}
2706cdf0e10cSrcweir 		break;
2707cdf0e10cSrcweir 
2708cdf0e10cSrcweir 	case CSS1_LENGTH:
2709cdf0e10cSrcweir 		nWidth = (sal_uInt16)pExpr->GetULength();
2710cdf0e10cSrcweir 		break;
2711cdf0e10cSrcweir 
2712cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2713cdf0e10cSrcweir 		{
2714cdf0e10cSrcweir 			sal_Bool bHori = nWhichLine == BOX_LINE_TOP ||
2715cdf0e10cSrcweir 						 nWhichLine == BOX_LINE_BOTTOM;
2716cdf0e10cSrcweir 			long nWidthL = (long)pExpr->GetNumber();
2717cdf0e10cSrcweir 			long nPWidth = bHori ? 0 : nWidthL;
2718cdf0e10cSrcweir 			long nPHeight = bHori ? nWidthL : 0;
2719cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2720cdf0e10cSrcweir 			nWidth = (sal_uInt16)(bHori ? nPHeight : nPWidth);
2721cdf0e10cSrcweir 		}
2722cdf0e10cSrcweir 		break;
2723cdf0e10cSrcweir 
2724cdf0e10cSrcweir 	default:
2725cdf0e10cSrcweir 		;
2726cdf0e10cSrcweir 	}
2727cdf0e10cSrcweir 
2728cdf0e10cSrcweir 	SvxCSS1BorderInfo *pInfo = rPropInfo.GetBorderInfo( nWhichLine );
2729cdf0e10cSrcweir 	pInfo->nAbsWidth = nWidth;
2730cdf0e10cSrcweir 	pInfo->nNamedWidth = nNWidth;
2731cdf0e10cSrcweir }
2732cdf0e10cSrcweir 
2733cdf0e10cSrcweir /*  */
2734cdf0e10cSrcweir 
ParseCSS1_border_top_width(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2735cdf0e10cSrcweir static void ParseCSS1_border_top_width( const CSS1Expression *pExpr,
2736cdf0e10cSrcweir 										SfxItemSet &rItemSet,
2737cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
2738cdf0e10cSrcweir 										const SvxCSS1Parser& rParser )
2739cdf0e10cSrcweir {
2740cdf0e10cSrcweir 	ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP );
2741cdf0e10cSrcweir }
2742cdf0e10cSrcweir 
ParseCSS1_border_right_width(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2743cdf0e10cSrcweir static void ParseCSS1_border_right_width( const CSS1Expression *pExpr,
2744cdf0e10cSrcweir 										SfxItemSet &rItemSet,
2745cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
2746cdf0e10cSrcweir 										const SvxCSS1Parser& rParser )
2747cdf0e10cSrcweir {
2748cdf0e10cSrcweir 	ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_RIGHT );
2749cdf0e10cSrcweir }
2750cdf0e10cSrcweir 
ParseCSS1_border_bottom_width(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2751cdf0e10cSrcweir static void ParseCSS1_border_bottom_width( const CSS1Expression *pExpr,
2752cdf0e10cSrcweir 										SfxItemSet &rItemSet,
2753cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
2754cdf0e10cSrcweir 										const SvxCSS1Parser& rParser )
2755cdf0e10cSrcweir {
2756cdf0e10cSrcweir 	ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_BOTTOM );
2757cdf0e10cSrcweir }
2758cdf0e10cSrcweir 
ParseCSS1_border_left_width(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2759cdf0e10cSrcweir static void ParseCSS1_border_left_width( const CSS1Expression *pExpr,
2760cdf0e10cSrcweir 										SfxItemSet &rItemSet,
2761cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
2762cdf0e10cSrcweir 										const SvxCSS1Parser& rParser )
2763cdf0e10cSrcweir {
2764cdf0e10cSrcweir 	ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT );
2765cdf0e10cSrcweir }
2766cdf0e10cSrcweir 
ParseCSS1_border_width(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2767cdf0e10cSrcweir static void ParseCSS1_border_width( const CSS1Expression *pExpr,
2768cdf0e10cSrcweir 									SfxItemSet &rItemSet,
2769cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2770cdf0e10cSrcweir 									const SvxCSS1Parser& rParser )
2771cdf0e10cSrcweir {
2772cdf0e10cSrcweir 	sal_uInt16 n=0;
2773cdf0e10cSrcweir 	while( n<4 && pExpr && !pExpr->GetOp() )
2774cdf0e10cSrcweir 	{
2775cdf0e10cSrcweir 		sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT;
2776cdf0e10cSrcweir 		ParseCSS1_border_xxx_width( pExpr, rItemSet, rPropInfo, rParser, nLine );
2777cdf0e10cSrcweir 		rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_WIDTH );
2778cdf0e10cSrcweir 
2779cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2780cdf0e10cSrcweir 		n++;
2781cdf0e10cSrcweir 	}
2782cdf0e10cSrcweir }
2783cdf0e10cSrcweir 
ParseCSS1_border_color(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2784cdf0e10cSrcweir static void ParseCSS1_border_color( const CSS1Expression *pExpr,
2785cdf0e10cSrcweir 									SfxItemSet & /*rItemSet*/,
2786cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2787cdf0e10cSrcweir 									const SvxCSS1Parser& /*rParser*/ )
2788cdf0e10cSrcweir {
2789cdf0e10cSrcweir 	sal_uInt16 n=0;
2790cdf0e10cSrcweir 	while( n<4 && pExpr && !pExpr->GetOp() )
2791cdf0e10cSrcweir 	{
2792cdf0e10cSrcweir 		sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT;
2793cdf0e10cSrcweir 		Color aColor;
2794cdf0e10cSrcweir 		switch( pExpr->GetType() )
2795cdf0e10cSrcweir 		{
2796cdf0e10cSrcweir 		case CSS1_RGB:
2797cdf0e10cSrcweir 		case CSS1_HEXCOLOR:
2798cdf0e10cSrcweir 		case CSS1_IDENT:
2799cdf0e10cSrcweir 			if( pExpr->GetColor( aColor ) )
2800cdf0e10cSrcweir 				rPropInfo.GetBorderInfo( nLine )->aColor = aColor;
2801cdf0e10cSrcweir 			break;
2802cdf0e10cSrcweir 		default:
2803cdf0e10cSrcweir 			;
2804cdf0e10cSrcweir 		}
2805cdf0e10cSrcweir 		rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_COLOR );
2806cdf0e10cSrcweir 
2807cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2808cdf0e10cSrcweir 		n++;
2809cdf0e10cSrcweir 	}
2810cdf0e10cSrcweir }
2811cdf0e10cSrcweir 
ParseCSS1_border_style(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2812cdf0e10cSrcweir static void ParseCSS1_border_style( const CSS1Expression *pExpr,
2813cdf0e10cSrcweir 									SfxItemSet & /*rItemSet*/,
2814cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2815cdf0e10cSrcweir 									const SvxCSS1Parser& /*rParser*/ )
2816cdf0e10cSrcweir {
2817cdf0e10cSrcweir 	sal_uInt16 n=0;
2818cdf0e10cSrcweir 	while( n<4 && pExpr && !pExpr->GetOp() )
2819cdf0e10cSrcweir 	{
2820cdf0e10cSrcweir 		sal_uInt16 nLine = n==0 || n==2 ? BOX_LINE_BOTTOM : BOX_LINE_LEFT;
2821cdf0e10cSrcweir 		sal_uInt16 nValue;
2822cdf0e10cSrcweir 		if( CSS1_IDENT==pExpr->GetType() &&
2823cdf0e10cSrcweir 			SvxCSS1Parser::GetEnum( aBorderStyleTable, pExpr->GetString(),
2824cdf0e10cSrcweir 									nValue ) )
2825cdf0e10cSrcweir 		{
2826cdf0e10cSrcweir 			rPropInfo.GetBorderInfo( nLine )->eStyle = (CSS1BorderStyle)nValue;
2827cdf0e10cSrcweir 		}
2828cdf0e10cSrcweir 		rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_STYLE );
2829cdf0e10cSrcweir 
2830cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
2831cdf0e10cSrcweir 		n++;
2832cdf0e10cSrcweir 	}
2833cdf0e10cSrcweir }
2834cdf0e10cSrcweir 
2835cdf0e10cSrcweir 
ParseCSS1_border_top(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2836cdf0e10cSrcweir static void ParseCSS1_border_top( const CSS1Expression *pExpr,
2837cdf0e10cSrcweir 								  SfxItemSet &rItemSet,
2838cdf0e10cSrcweir 								  SvxCSS1PropertyInfo& rPropInfo,
2839cdf0e10cSrcweir 								  const SvxCSS1Parser& rParser )
2840cdf0e10cSrcweir {
2841cdf0e10cSrcweir 	ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_TOP, sal_False );
2842cdf0e10cSrcweir }
2843cdf0e10cSrcweir 
ParseCSS1_border_right(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2844cdf0e10cSrcweir static void ParseCSS1_border_right( const CSS1Expression *pExpr,
2845cdf0e10cSrcweir 									SfxItemSet &rItemSet,
2846cdf0e10cSrcweir 									SvxCSS1PropertyInfo& rPropInfo,
2847cdf0e10cSrcweir 									const SvxCSS1Parser& rParser )
2848cdf0e10cSrcweir {
2849cdf0e10cSrcweir 	ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_RIGHT, sal_False );
2850cdf0e10cSrcweir }
2851cdf0e10cSrcweir 
ParseCSS1_border_bottom(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2852cdf0e10cSrcweir static void ParseCSS1_border_bottom( const CSS1Expression *pExpr,
2853cdf0e10cSrcweir 									 SfxItemSet &rItemSet,
2854cdf0e10cSrcweir 									 SvxCSS1PropertyInfo& rPropInfo,
2855cdf0e10cSrcweir 									 const SvxCSS1Parser& rParser )
2856cdf0e10cSrcweir {
2857cdf0e10cSrcweir 	ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_BOTTOM, sal_False );
2858cdf0e10cSrcweir }
2859cdf0e10cSrcweir 
ParseCSS1_border_left(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2860cdf0e10cSrcweir static void ParseCSS1_border_left( const CSS1Expression *pExpr,
2861cdf0e10cSrcweir 								   SfxItemSet &rItemSet,
2862cdf0e10cSrcweir 								   SvxCSS1PropertyInfo& rPropInfo,
2863cdf0e10cSrcweir 								   const SvxCSS1Parser& rParser )
2864cdf0e10cSrcweir {
2865cdf0e10cSrcweir 	ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, BOX_LINE_LEFT, sal_False );
2866cdf0e10cSrcweir }
2867cdf0e10cSrcweir 
ParseCSS1_border(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser & rParser)2868cdf0e10cSrcweir static void ParseCSS1_border( const CSS1Expression *pExpr,
2869cdf0e10cSrcweir 							  SfxItemSet &rItemSet,
2870cdf0e10cSrcweir 							  SvxCSS1PropertyInfo& rPropInfo,
2871cdf0e10cSrcweir 							  const SvxCSS1Parser& rParser )
2872cdf0e10cSrcweir {
2873cdf0e10cSrcweir 	ParseCSS1_border_xxx( pExpr, rItemSet, rPropInfo, rParser, 0, sal_True );
2874cdf0e10cSrcweir }
2875cdf0e10cSrcweir 
2876cdf0e10cSrcweir /*  */
2877cdf0e10cSrcweir 
ParseCSS1_float(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2878cdf0e10cSrcweir static void ParseCSS1_float( const CSS1Expression *pExpr,
2879cdf0e10cSrcweir 							 SfxItemSet & /*rItemSet*/,
2880cdf0e10cSrcweir 							 SvxCSS1PropertyInfo& rPropInfo,
2881cdf0e10cSrcweir 							 const SvxCSS1Parser& /*rParser*/ )
2882cdf0e10cSrcweir {
2883cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2884cdf0e10cSrcweir 
2885cdf0e10cSrcweir 	if( CSS1_IDENT==pExpr->GetType() )
2886cdf0e10cSrcweir 	{
2887cdf0e10cSrcweir 		sal_uInt16 nFloat;
2888cdf0e10cSrcweir 		if( SvxCSS1Parser::GetEnum( aFloatTable, pExpr->GetString(), nFloat ) )
2889cdf0e10cSrcweir 			rPropInfo.eFloat = (SvxAdjust)nFloat;
2890cdf0e10cSrcweir 	}
2891cdf0e10cSrcweir }
2892cdf0e10cSrcweir 
2893cdf0e10cSrcweir 
2894cdf0e10cSrcweir /*  */
2895cdf0e10cSrcweir 
ParseCSS1_position(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2896cdf0e10cSrcweir static void ParseCSS1_position( const CSS1Expression *pExpr,
2897cdf0e10cSrcweir 								SfxItemSet & /*rItemSet*/,
2898cdf0e10cSrcweir 								SvxCSS1PropertyInfo& rPropInfo,
2899cdf0e10cSrcweir 								const SvxCSS1Parser& /*rParser*/ )
2900cdf0e10cSrcweir {
2901cdf0e10cSrcweir 	DBG_ASSERT( pExpr, "kein Ausdruck" );
2902cdf0e10cSrcweir 
2903cdf0e10cSrcweir 	if( CSS1_IDENT==pExpr->GetType() )
2904cdf0e10cSrcweir 	{
2905cdf0e10cSrcweir 		sal_uInt16 nPos;
2906cdf0e10cSrcweir 		if( SvxCSS1Parser::GetEnum( aPositionTable, pExpr->GetString(), nPos ) )
2907cdf0e10cSrcweir 			rPropInfo.ePosition = (SvxCSS1Position)nPos;
2908cdf0e10cSrcweir 	}
2909cdf0e10cSrcweir }
2910cdf0e10cSrcweir 
2911cdf0e10cSrcweir /*  */
2912cdf0e10cSrcweir 
ParseCSS1_length(const CSS1Expression * pExpr,long & rLength,SvxCSS1LengthType & rLengthType,sal_Bool bHori)2913cdf0e10cSrcweir static void ParseCSS1_length( const CSS1Expression *pExpr,
2914cdf0e10cSrcweir 							  long& rLength,
2915cdf0e10cSrcweir 							  SvxCSS1LengthType& rLengthType,
2916cdf0e10cSrcweir 							  sal_Bool bHori )
2917cdf0e10cSrcweir {
2918cdf0e10cSrcweir 	switch( pExpr->GetType() )
2919cdf0e10cSrcweir 	{
2920cdf0e10cSrcweir 	case CSS1_IDENT:
2921cdf0e10cSrcweir 		if( pExpr->GetString().EqualsIgnoreCaseAscii( sCSS1_PV_auto ) )
2922cdf0e10cSrcweir 		{
2923cdf0e10cSrcweir 			rLength = 0;
2924cdf0e10cSrcweir 			rLengthType = SVX_CSS1_LTYPE_AUTO;
2925cdf0e10cSrcweir 		}
2926cdf0e10cSrcweir 		break;
2927cdf0e10cSrcweir 
2928cdf0e10cSrcweir 	case CSS1_LENGTH:
2929cdf0e10cSrcweir 		rLength = pExpr->GetSLength();
2930cdf0e10cSrcweir 		rLengthType = SVX_CSS1_LTYPE_TWIP;
2931cdf0e10cSrcweir 		break;
2932cdf0e10cSrcweir 
2933cdf0e10cSrcweir 	case CSS1_PIXLENGTH:
2934cdf0e10cSrcweir 	case CSS1_NUMBER:		// wegen Netscape und IE
2935cdf0e10cSrcweir 		{
2936cdf0e10cSrcweir 			long nWidthL = (long)pExpr->GetNumber();
2937cdf0e10cSrcweir 			long nPWidth = bHori ? 0 : nWidthL;
2938cdf0e10cSrcweir 			long nPHeight = bHori ? nWidthL : 0;
2939cdf0e10cSrcweir 			SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
2940cdf0e10cSrcweir 			rLength = (bHori ? nPHeight : nPWidth);
2941cdf0e10cSrcweir 			rLengthType = SVX_CSS1_LTYPE_TWIP;
2942cdf0e10cSrcweir 		}
2943cdf0e10cSrcweir 		break;
2944cdf0e10cSrcweir 
2945cdf0e10cSrcweir 	case CSS1_PERCENTAGE:
2946cdf0e10cSrcweir 		rLength = (long)pExpr->GetNumber();
2947cdf0e10cSrcweir 		if( rLength > 100 )
2948cdf0e10cSrcweir 			rLength = 100;
2949cdf0e10cSrcweir 		rLengthType = SVX_CSS1_LTYPE_PERCENTAGE;
2950cdf0e10cSrcweir 		break;
2951cdf0e10cSrcweir 
2952cdf0e10cSrcweir 	default:
2953cdf0e10cSrcweir 		;
2954cdf0e10cSrcweir 	}
2955cdf0e10cSrcweir }
2956cdf0e10cSrcweir 
2957cdf0e10cSrcweir /*  */
2958cdf0e10cSrcweir 
ParseCSS1_width(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2959cdf0e10cSrcweir static void ParseCSS1_width( const CSS1Expression *pExpr,
2960cdf0e10cSrcweir 							 SfxItemSet & /*rItemSet*/,
2961cdf0e10cSrcweir 							 SvxCSS1PropertyInfo& rPropInfo,
2962cdf0e10cSrcweir 							 const SvxCSS1Parser& /*rParser*/ )
2963cdf0e10cSrcweir {
2964cdf0e10cSrcweir 	ParseCSS1_length( pExpr, rPropInfo.nWidth, rPropInfo.eWidthType, sal_True );
2965cdf0e10cSrcweir }
2966cdf0e10cSrcweir 
ParseCSS1_height(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2967cdf0e10cSrcweir static void ParseCSS1_height( const CSS1Expression *pExpr,
2968cdf0e10cSrcweir 							  SfxItemSet & /*rItemSet*/,
2969cdf0e10cSrcweir 							  SvxCSS1PropertyInfo& rPropInfo,
2970cdf0e10cSrcweir 							  const SvxCSS1Parser& /*rParser*/ )
2971cdf0e10cSrcweir {
2972cdf0e10cSrcweir 	ParseCSS1_length( pExpr, rPropInfo.nHeight, rPropInfo.eHeightType, sal_False );
2973cdf0e10cSrcweir }
2974cdf0e10cSrcweir 
ParseCSS1_left(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2975cdf0e10cSrcweir static void ParseCSS1_left( const CSS1Expression *pExpr,
2976cdf0e10cSrcweir 							 SfxItemSet & /*rItemSet*/,
2977cdf0e10cSrcweir 							 SvxCSS1PropertyInfo& rPropInfo,
2978cdf0e10cSrcweir 							 const SvxCSS1Parser& /*rParser*/ )
2979cdf0e10cSrcweir {
2980cdf0e10cSrcweir 	ParseCSS1_length( pExpr, rPropInfo.nLeft, rPropInfo.eLeftType, sal_True );
2981cdf0e10cSrcweir }
2982cdf0e10cSrcweir 
ParseCSS1_top(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2983cdf0e10cSrcweir static void ParseCSS1_top( const CSS1Expression *pExpr,
2984cdf0e10cSrcweir 						   SfxItemSet & /*rItemSet*/,
2985cdf0e10cSrcweir 						   SvxCSS1PropertyInfo& rPropInfo,
2986cdf0e10cSrcweir 						   const SvxCSS1Parser& /*rParser*/ )
2987cdf0e10cSrcweir {
2988cdf0e10cSrcweir 	ParseCSS1_length( pExpr, rPropInfo.nTop, rPropInfo.eTopType, sal_False );
2989cdf0e10cSrcweir }
2990cdf0e10cSrcweir 
2991cdf0e10cSrcweir /*  */
2992cdf0e10cSrcweir 
2993cdf0e10cSrcweir // Feature: PrintExt
ParseCSS1_size(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)2994cdf0e10cSrcweir static void ParseCSS1_size( const CSS1Expression *pExpr,
2995cdf0e10cSrcweir 							SfxItemSet & /*rItemSet*/,
2996cdf0e10cSrcweir 							SvxCSS1PropertyInfo& rPropInfo,
2997cdf0e10cSrcweir 							const SvxCSS1Parser& /*rParser*/ )
2998cdf0e10cSrcweir {
2999cdf0e10cSrcweir 	sal_uInt16 n=0;
3000cdf0e10cSrcweir 	while( n<2 && pExpr && !pExpr->GetOp() )
3001cdf0e10cSrcweir 	{
3002cdf0e10cSrcweir 		switch( pExpr->GetType() )
3003cdf0e10cSrcweir 		{
3004cdf0e10cSrcweir 		case CSS1_IDENT:
3005cdf0e10cSrcweir 			{
3006cdf0e10cSrcweir 				sal_uInt16 nValue;
3007cdf0e10cSrcweir 				if( SvxCSS1Parser::GetEnum( aSizeTable, pExpr->GetString(),
3008cdf0e10cSrcweir 											nValue ) )
3009cdf0e10cSrcweir 				{
3010cdf0e10cSrcweir 					rPropInfo.eSizeType = (SvxCSS1SizeType)nValue;
3011cdf0e10cSrcweir 				}
3012cdf0e10cSrcweir 			}
3013cdf0e10cSrcweir 			break;
3014cdf0e10cSrcweir 
3015cdf0e10cSrcweir 		case CSS1_LENGTH:
3016cdf0e10cSrcweir 			rPropInfo.nHeight = pExpr->GetSLength();
3017cdf0e10cSrcweir 			if( n==0 )
3018cdf0e10cSrcweir 				rPropInfo.nWidth = rPropInfo.nHeight;
3019cdf0e10cSrcweir 			rPropInfo.eSizeType = SVX_CSS1_STYPE_TWIP;
3020cdf0e10cSrcweir 			break;
3021cdf0e10cSrcweir 
3022cdf0e10cSrcweir 		case CSS1_PIXLENGTH:
3023cdf0e10cSrcweir 			{
3024cdf0e10cSrcweir 				long nPHeight = (long)pExpr->GetNumber();
3025cdf0e10cSrcweir 				long nPWidth = n==0 ? nPHeight : 0;
3026cdf0e10cSrcweir 				SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
3027cdf0e10cSrcweir 				rPropInfo.nHeight = nPHeight;
3028cdf0e10cSrcweir 				if( n==0 )
3029cdf0e10cSrcweir 					rPropInfo.nWidth = nPWidth;
3030cdf0e10cSrcweir 				rPropInfo.eSizeType = SVX_CSS1_STYPE_TWIP;
3031cdf0e10cSrcweir 			}
3032cdf0e10cSrcweir 			break;
3033cdf0e10cSrcweir 
3034cdf0e10cSrcweir 		default:
3035cdf0e10cSrcweir 			;
3036cdf0e10cSrcweir 		}
3037cdf0e10cSrcweir 
3038cdf0e10cSrcweir 		pExpr = pExpr->GetNext();
3039cdf0e10cSrcweir 		n++;
3040cdf0e10cSrcweir 	}
3041cdf0e10cSrcweir }
3042cdf0e10cSrcweir 
3043cdf0e10cSrcweir // /Feature: PrintExt
3044cdf0e10cSrcweir 
3045cdf0e10cSrcweir /*  */
3046cdf0e10cSrcweir 
3047cdf0e10cSrcweir // Feature: PrintExt
3048cdf0e10cSrcweir 
ParseCSS1_page_break_xxx(const CSS1Expression * pExpr,SvxCSS1PageBreak & rPBreak)3049cdf0e10cSrcweir static void ParseCSS1_page_break_xxx( const CSS1Expression *pExpr,
3050cdf0e10cSrcweir 									  SvxCSS1PageBreak& rPBreak )
3051cdf0e10cSrcweir {
3052cdf0e10cSrcweir 	if( CSS1_IDENT == pExpr->GetType() )
3053cdf0e10cSrcweir 	{
3054cdf0e10cSrcweir 		sal_uInt16 nValue;
3055cdf0e10cSrcweir 		if( SvxCSS1Parser::GetEnum( aPageBreakTable, pExpr->GetString(),
3056cdf0e10cSrcweir 									nValue ) )
3057cdf0e10cSrcweir 		{
3058cdf0e10cSrcweir 			rPBreak = (SvxCSS1PageBreak)nValue;
3059cdf0e10cSrcweir 		}
3060cdf0e10cSrcweir 	}
3061cdf0e10cSrcweir }
3062cdf0e10cSrcweir 
ParseCSS1_page_break_before(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)3063cdf0e10cSrcweir static void ParseCSS1_page_break_before( const CSS1Expression *pExpr,
3064cdf0e10cSrcweir 										 SfxItemSet & /*rItemSet*/,
3065cdf0e10cSrcweir 										 SvxCSS1PropertyInfo& rPropInfo,
3066cdf0e10cSrcweir 										 const SvxCSS1Parser& /*rParser*/ )
3067cdf0e10cSrcweir {
3068cdf0e10cSrcweir 	ParseCSS1_page_break_xxx( pExpr, rPropInfo.ePageBreakBefore );
3069cdf0e10cSrcweir }
3070cdf0e10cSrcweir 
ParseCSS1_page_break_after(const CSS1Expression * pExpr,SfxItemSet &,SvxCSS1PropertyInfo & rPropInfo,const SvxCSS1Parser &)3071cdf0e10cSrcweir static void ParseCSS1_page_break_after( const CSS1Expression *pExpr,
3072cdf0e10cSrcweir 										SfxItemSet & /*rItemSet*/,
3073cdf0e10cSrcweir 										SvxCSS1PropertyInfo& rPropInfo,
3074cdf0e10cSrcweir 										const SvxCSS1Parser& /*rParser*/ )
3075cdf0e10cSrcweir {
3076cdf0e10cSrcweir 	ParseCSS1_page_break_xxx( pExpr, rPropInfo.ePageBreakAfter );
3077cdf0e10cSrcweir }
3078cdf0e10cSrcweir 
ParseCSS1_page_break_inside(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)3079cdf0e10cSrcweir static void ParseCSS1_page_break_inside( const CSS1Expression *pExpr,
3080cdf0e10cSrcweir 										 SfxItemSet &rItemSet,
3081cdf0e10cSrcweir 										 SvxCSS1PropertyInfo& /*rPropInfo*/,
3082cdf0e10cSrcweir 										 const SvxCSS1Parser& /*rParser*/ )
3083cdf0e10cSrcweir {
3084cdf0e10cSrcweir 	SvxCSS1PageBreak eBreak(SVX_CSS1_PBREAK_NONE);
3085cdf0e10cSrcweir 	ParseCSS1_page_break_xxx( pExpr, eBreak );
3086cdf0e10cSrcweir 
3087cdf0e10cSrcweir 	sal_Bool bSetSplit = sal_False, bSplit = sal_True;
3088cdf0e10cSrcweir 	switch( eBreak )
3089cdf0e10cSrcweir 	{
3090cdf0e10cSrcweir 	case SVX_CSS1_PBREAK_AUTO:
3091cdf0e10cSrcweir 		bSetSplit = sal_True;
3092cdf0e10cSrcweir 		break;
3093cdf0e10cSrcweir 	case SVX_CSS1_PBREAK_AVOID:
3094cdf0e10cSrcweir 		bSplit = sal_False;
3095cdf0e10cSrcweir 		bSetSplit = sal_True;
3096cdf0e10cSrcweir 		break;
3097cdf0e10cSrcweir 	default:
3098cdf0e10cSrcweir 		;
3099cdf0e10cSrcweir 	}
3100cdf0e10cSrcweir 
3101cdf0e10cSrcweir 	if( bSetSplit )
3102cdf0e10cSrcweir 		rItemSet.Put( SvxFmtSplitItem( bSplit, aItemIds.nFmtSplit ) );
3103cdf0e10cSrcweir }
3104cdf0e10cSrcweir 
ParseCSS1_widows(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)3105cdf0e10cSrcweir static void ParseCSS1_widows( const CSS1Expression *pExpr,
3106cdf0e10cSrcweir 							  SfxItemSet &rItemSet,
3107cdf0e10cSrcweir 							  SvxCSS1PropertyInfo& /*rPropInfo*/,
3108cdf0e10cSrcweir 							  const SvxCSS1Parser& /*rParser*/ )
3109cdf0e10cSrcweir {
3110cdf0e10cSrcweir 	if( CSS1_NUMBER == pExpr->GetType() )
3111cdf0e10cSrcweir 	{
3112cdf0e10cSrcweir 		sal_uInt8 nVal = pExpr->GetNumber() <= 255
3113cdf0e10cSrcweir 						? (sal_uInt8)pExpr->GetNumber()
3114cdf0e10cSrcweir 						: 255;
3115cdf0e10cSrcweir 		SvxWidowsItem aWidowsItem( nVal, aItemIds.nWidows );
3116cdf0e10cSrcweir 		rItemSet.Put( aWidowsItem );
3117cdf0e10cSrcweir 	}
3118cdf0e10cSrcweir }
3119cdf0e10cSrcweir 
ParseCSS1_orphans(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser &)3120cdf0e10cSrcweir static void ParseCSS1_orphans( const CSS1Expression *pExpr,
3121cdf0e10cSrcweir 							   SfxItemSet &rItemSet,
3122cdf0e10cSrcweir 							   SvxCSS1PropertyInfo& /*rPropInfo*/,
3123cdf0e10cSrcweir 							   const SvxCSS1Parser& /*rParser*/ )
3124cdf0e10cSrcweir {
3125cdf0e10cSrcweir 	if( CSS1_NUMBER == pExpr->GetType() )
3126cdf0e10cSrcweir 	{
3127cdf0e10cSrcweir 		sal_uInt8 nVal = pExpr->GetNumber() <= 255
3128cdf0e10cSrcweir 						? (sal_uInt8)pExpr->GetNumber()
3129cdf0e10cSrcweir 						: 255;
3130cdf0e10cSrcweir 		SvxOrphansItem aOrphansItem( nVal, aItemIds.nOrphans );
3131cdf0e10cSrcweir 		rItemSet.Put( aOrphansItem );
3132cdf0e10cSrcweir 	}
3133cdf0e10cSrcweir }
3134cdf0e10cSrcweir // /Feature: PrintExt
3135cdf0e10cSrcweir 
ParseCSS1_so_language(const CSS1Expression * pExpr,SfxItemSet & rItemSet,SvxCSS1PropertyInfo &,const SvxCSS1Parser & rParser)3136cdf0e10cSrcweir static void ParseCSS1_so_language( const CSS1Expression *pExpr,
3137cdf0e10cSrcweir 							   SfxItemSet &rItemSet,
3138cdf0e10cSrcweir 							   SvxCSS1PropertyInfo& /*rPropInfo*/,
3139cdf0e10cSrcweir 							   const SvxCSS1Parser& rParser )
3140cdf0e10cSrcweir {
3141cdf0e10cSrcweir 	if( CSS1_IDENT == pExpr->GetType() ||
3142cdf0e10cSrcweir 		CSS1_STRING == pExpr->GetType()	)
3143cdf0e10cSrcweir 	{
3144cdf0e10cSrcweir 		LanguageType eLang = MsLangId::convertIsoStringToLanguage( pExpr->GetString() );
3145cdf0e10cSrcweir 		if( LANGUAGE_DONTKNOW != eLang )
3146cdf0e10cSrcweir 		{
3147cdf0e10cSrcweir 			SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
3148cdf0e10cSrcweir 			if( rParser.IsSetWesternProps() )
3149cdf0e10cSrcweir 				rItemSet.Put( aLang );
3150cdf0e10cSrcweir 			if( rParser.IsSetCJKProps() )
3151cdf0e10cSrcweir 			{
3152cdf0e10cSrcweir 				aLang.SetWhich( aItemIds.nLanguageCJK );
3153cdf0e10cSrcweir 				rItemSet.Put( aLang );
3154cdf0e10cSrcweir 			}
3155cdf0e10cSrcweir 			if( rParser.IsSetCTLProps() )
3156cdf0e10cSrcweir 			{
3157cdf0e10cSrcweir 				aLang.SetWhich( aItemIds.nLanguageCTL );
3158cdf0e10cSrcweir 				rItemSet.Put( aLang );
3159cdf0e10cSrcweir 			}
3160cdf0e10cSrcweir 		}
3161cdf0e10cSrcweir 	}
3162cdf0e10cSrcweir }
3163cdf0e10cSrcweir 
3164cdf0e10cSrcweir /*  */
3165cdf0e10cSrcweir 
3166cdf0e10cSrcweir // die Zuordung Property zu parsender Funktion
3167cdf0e10cSrcweir struct CSS1PropEntry
3168cdf0e10cSrcweir {
3169cdf0e10cSrcweir 	union
3170cdf0e10cSrcweir 	{
3171cdf0e10cSrcweir 		const sal_Char	*sName;
3172cdf0e10cSrcweir 		String			*pName;
3173cdf0e10cSrcweir 	};
3174cdf0e10cSrcweir 	FnParseCSS1Prop pFunc;
3175cdf0e10cSrcweir };
3176cdf0e10cSrcweir 
3177cdf0e10cSrcweir #define CSS1_PROP_ENTRY(p) \
3178cdf0e10cSrcweir 	{	{ sCSS1_P_##p }, ParseCSS1_##p }
3179cdf0e10cSrcweir 
3180cdf0e10cSrcweir 
3181cdf0e10cSrcweir // die Tabelle mit den Zuordnungen
3182cdf0e10cSrcweir static CSS1PropEntry __FAR_DATA aCSS1PropFnTab[] =
3183cdf0e10cSrcweir {
3184cdf0e10cSrcweir 	CSS1_PROP_ENTRY(background),
3185cdf0e10cSrcweir 	CSS1_PROP_ENTRY(background_color),
3186cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_top_width),
3187cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_right_width),
3188cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_bottom_width),
3189cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_left_width),
3190cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_width),
3191cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_color),
3192cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_style),
3193cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_top),
3194cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_right),
3195cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_bottom),
3196cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border_left),
3197cdf0e10cSrcweir 	CSS1_PROP_ENTRY(border),
3198cdf0e10cSrcweir 	CSS1_PROP_ENTRY(color),
3199cdf0e10cSrcweir 	CSS1_PROP_ENTRY(direction),
3200cdf0e10cSrcweir 	CSS1_PROP_ENTRY(float),
3201cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font_size),
3202cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font_family),
3203cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font_style),
3204cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font_variant),
3205cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font_weight),
3206cdf0e10cSrcweir 	CSS1_PROP_ENTRY(letter_spacing),
3207cdf0e10cSrcweir 	CSS1_PROP_ENTRY(line_height),
3208cdf0e10cSrcweir 	CSS1_PROP_ENTRY(font),
3209cdf0e10cSrcweir 	CSS1_PROP_ENTRY(text_align),
3210cdf0e10cSrcweir 	CSS1_PROP_ENTRY(text_decoration),
3211cdf0e10cSrcweir 	CSS1_PROP_ENTRY(text_indent),
3212cdf0e10cSrcweir 	CSS1_PROP_ENTRY(margin_left),
3213cdf0e10cSrcweir 	CSS1_PROP_ENTRY(margin_right),
3214cdf0e10cSrcweir 	CSS1_PROP_ENTRY(margin_top),
3215cdf0e10cSrcweir 	CSS1_PROP_ENTRY(margin_bottom),
3216cdf0e10cSrcweir 	CSS1_PROP_ENTRY(margin),
3217cdf0e10cSrcweir 	CSS1_PROP_ENTRY(padding_top),
3218cdf0e10cSrcweir 	CSS1_PROP_ENTRY(padding_bottom),
3219cdf0e10cSrcweir 	CSS1_PROP_ENTRY(padding_left),
3220cdf0e10cSrcweir 	CSS1_PROP_ENTRY(padding_right),
3221cdf0e10cSrcweir 	CSS1_PROP_ENTRY(padding),
3222cdf0e10cSrcweir 	CSS1_PROP_ENTRY(position),
3223cdf0e10cSrcweir 	CSS1_PROP_ENTRY(left),
3224cdf0e10cSrcweir 	CSS1_PROP_ENTRY(top),
3225cdf0e10cSrcweir 	CSS1_PROP_ENTRY(width),
3226cdf0e10cSrcweir 	CSS1_PROP_ENTRY(height),
3227cdf0e10cSrcweir // Feature: PrintExt
3228cdf0e10cSrcweir 	CSS1_PROP_ENTRY(size),
3229cdf0e10cSrcweir 	CSS1_PROP_ENTRY(page_break_before),
3230cdf0e10cSrcweir 	CSS1_PROP_ENTRY(page_break_after),
3231cdf0e10cSrcweir 	CSS1_PROP_ENTRY(page_break_inside),
3232cdf0e10cSrcweir 	CSS1_PROP_ENTRY(widows),
3233cdf0e10cSrcweir 	CSS1_PROP_ENTRY(orphans),
3234cdf0e10cSrcweir // /Feature: PrintExt
3235cdf0e10cSrcweir 	CSS1_PROP_ENTRY(so_language)
3236cdf0e10cSrcweir };
3237cdf0e10cSrcweir 
3238cdf0e10cSrcweir /*  */
3239cdf0e10cSrcweir 
3240cdf0e10cSrcweir static int __FAR_DATA bSortedPropFns = sal_False;
3241cdf0e10cSrcweir 
3242cdf0e10cSrcweir extern "C"
3243cdf0e10cSrcweir {
3244cdf0e10cSrcweir static int
3245cdf0e10cSrcweir #if defined( WNT )
3246cdf0e10cSrcweir  __cdecl
3247cdf0e10cSrcweir #endif
3248cdf0e10cSrcweir #if defined( ICC )
3249cdf0e10cSrcweir  _Optlink
3250cdf0e10cSrcweir #endif
CSS1PropEntryCompare(const void * pFirst,const void * pSecond)3251cdf0e10cSrcweir 	CSS1PropEntryCompare( const void *pFirst, const void *pSecond)
3252cdf0e10cSrcweir {
3253cdf0e10cSrcweir 	int nRet;
3254cdf0e10cSrcweir 	if( ((CSS1PropEntry*)pFirst)->pFunc )
3255cdf0e10cSrcweir 	{
3256cdf0e10cSrcweir 		if( ((CSS1PropEntry*)pSecond)->pFunc )
3257cdf0e10cSrcweir 			nRet = strcmp( ((CSS1PropEntry*)pFirst)->sName ,
3258cdf0e10cSrcweir 					((CSS1PropEntry*)pSecond)->sName );
3259cdf0e10cSrcweir 		else
3260cdf0e10cSrcweir 			nRet = -1 * ((CSS1PropEntry*)pSecond)->pName->CompareToAscii(
3261cdf0e10cSrcweir 							((CSS1PropEntry*)pFirst)->sName );
3262cdf0e10cSrcweir 	}
3263cdf0e10cSrcweir 	else
3264cdf0e10cSrcweir 	{
3265cdf0e10cSrcweir 		if( ((CSS1PropEntry*)pSecond)->pFunc )
3266cdf0e10cSrcweir 			nRet = ((CSS1PropEntry*)pFirst)->pName->CompareToAscii(
3267cdf0e10cSrcweir 						((CSS1PropEntry*)pSecond)->sName );
3268cdf0e10cSrcweir 		else
3269cdf0e10cSrcweir 			nRet = ((CSS1PropEntry*)pFirst)->pName->CompareTo(
3270cdf0e10cSrcweir 						*((CSS1PropEntry*)pSecond)->pName );
3271cdf0e10cSrcweir 	}
3272cdf0e10cSrcweir 
3273cdf0e10cSrcweir 	return nRet;
3274cdf0e10cSrcweir }
3275cdf0e10cSrcweir }
3276cdf0e10cSrcweir 
ParseProperty(const String & rProperty,const CSS1Expression * pExpr)3277cdf0e10cSrcweir void SvxCSS1Parser::ParseProperty( const String& rProperty,
3278cdf0e10cSrcweir 								   const CSS1Expression *pExpr )
3279cdf0e10cSrcweir {
3280cdf0e10cSrcweir 	DBG_ASSERT( pItemSet, "DeclarationParsed() ohne ItemSet" );
3281cdf0e10cSrcweir 
3282cdf0e10cSrcweir 	if( !bSortedPropFns )
3283cdf0e10cSrcweir 	{
3284cdf0e10cSrcweir 		qsort( (void*) aCSS1PropFnTab,
3285cdf0e10cSrcweir 				sizeof( aCSS1PropFnTab ) / sizeof( CSS1PropEntry ),
3286cdf0e10cSrcweir 				sizeof( CSS1PropEntry ),
3287cdf0e10cSrcweir 				CSS1PropEntryCompare );
3288cdf0e10cSrcweir 		bSortedPropFns = sal_True;
3289cdf0e10cSrcweir 	}
3290cdf0e10cSrcweir 
3291cdf0e10cSrcweir 	String aTmp( rProperty );
3292cdf0e10cSrcweir 	aTmp.ToLowerAscii();
3293cdf0e10cSrcweir 
3294cdf0e10cSrcweir 	CSS1PropEntry aSrch;
3295cdf0e10cSrcweir 	aSrch.pName = &aTmp;
3296cdf0e10cSrcweir 	aSrch.pFunc = 0;
3297cdf0e10cSrcweir 
3298cdf0e10cSrcweir 	void* pFound;
3299cdf0e10cSrcweir 	if( 0 != ( pFound = bsearch( (char *) &aSrch,
3300cdf0e10cSrcweir 						(void*) aCSS1PropFnTab,
3301cdf0e10cSrcweir 						sizeof( aCSS1PropFnTab ) / sizeof( CSS1PropEntry ),
3302cdf0e10cSrcweir 						sizeof( CSS1PropEntry ),
3303cdf0e10cSrcweir 						CSS1PropEntryCompare )))
3304cdf0e10cSrcweir 	{
3305cdf0e10cSrcweir 		(((CSS1PropEntry*)pFound)->pFunc)( pExpr, *pItemSet, *pPropInfo, *this );
3306cdf0e10cSrcweir 	}
3307cdf0e10cSrcweir }
3308