1*e1d5bd03SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*e1d5bd03SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*e1d5bd03SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*e1d5bd03SAndrew Rist * distributed with this work for additional information
6*e1d5bd03SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*e1d5bd03SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*e1d5bd03SAndrew Rist * "License"); you may not use this file except in compliance
9*e1d5bd03SAndrew Rist * with the License. You may obtain a copy of the License at
10*e1d5bd03SAndrew Rist *
11*e1d5bd03SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*e1d5bd03SAndrew Rist *
13*e1d5bd03SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*e1d5bd03SAndrew Rist * software distributed under the License is distributed on an
15*e1d5bd03SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e1d5bd03SAndrew Rist * KIND, either express or implied. See the License for the
17*e1d5bd03SAndrew Rist * specific language governing permissions and limitations
18*e1d5bd03SAndrew Rist * under the License.
19*e1d5bd03SAndrew Rist *
20*e1d5bd03SAndrew Rist *************************************************************/
21*e1d5bd03SAndrew Rist
22*e1d5bd03SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmlscript.hxx"
26cdf0e10cSrcweir #include "exp_share.hxx"
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
29cdf0e10cSrcweir #include <tools/diagnose_ex.h>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <com/sun/star/awt/CharSet.hpp>
32cdf0e10cSrcweir #include <com/sun/star/awt/FontFamily.hpp>
33cdf0e10cSrcweir #include <com/sun/star/awt/FontPitch.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/FontStrikeout.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/FontType.hpp>
37cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
38cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
39cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/ImagePosition.hpp>
41cdf0e10cSrcweir #include <com/sun/star/awt/LineEndFormat.hpp>
42cdf0e10cSrcweir #include <com/sun/star/awt/PushButtonType.hpp>
43cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp>
44cdf0e10cSrcweir
45cdf0e10cSrcweir #include <com/sun/star/script/XScriptEventsSupplier.hpp>
46cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp>
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp>
49cdf0e10cSrcweir
50cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
51cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
52cdf0e10cSrcweir #include <com/sun/star/util/NumberFormat.hpp>
53cdf0e10cSrcweir
54cdf0e10cSrcweir #include <com/sun/star/view/SelectionType.hpp>
55cdf0e10cSrcweir
56cdf0e10cSrcweir
57cdf0e10cSrcweir using namespace ::com::sun::star;
58cdf0e10cSrcweir using namespace ::com::sun::star::uno;
59cdf0e10cSrcweir using ::rtl::OUString;
60cdf0e10cSrcweir using ::rtl::OUStringBuffer;
61cdf0e10cSrcweir
62cdf0e10cSrcweir namespace xmlscript
63cdf0e10cSrcweir {
64cdf0e10cSrcweir
65cdf0e10cSrcweir //__________________________________________________________________________________________________
createElement()66cdf0e10cSrcweir Reference< xml::sax::XAttributeList > Style::createElement()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir ElementDescriptor * pStyle = new ElementDescriptor(
69cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style") ) );
70cdf0e10cSrcweir
71cdf0e10cSrcweir // style-id
72cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), _id );
73cdf0e10cSrcweir
74cdf0e10cSrcweir // background-color
75cdf0e10cSrcweir if (_set & 0x1)
76cdf0e10cSrcweir {
77cdf0e10cSrcweir OUStringBuffer buf( 16 );
78cdf0e10cSrcweir buf.append( (sal_Unicode)'0' );
79cdf0e10cSrcweir buf.append( (sal_Unicode)'x' );
80cdf0e10cSrcweir buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_backgroundColor, 16 ) );
81cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":background-color") ),
82cdf0e10cSrcweir buf.makeStringAndClear() );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir // text-color
86cdf0e10cSrcweir if (_set & 0x2)
87cdf0e10cSrcweir {
88cdf0e10cSrcweir OUStringBuffer buf( 16 );
89cdf0e10cSrcweir buf.append( (sal_Unicode)'0' );
90cdf0e10cSrcweir buf.append( (sal_Unicode)'x' );
91cdf0e10cSrcweir buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textColor, 16 ) );
92cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text-color") ),
93cdf0e10cSrcweir buf.makeStringAndClear() );
94cdf0e10cSrcweir }
95cdf0e10cSrcweir
96cdf0e10cSrcweir // textline-color
97cdf0e10cSrcweir if (_set & 0x20)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir OUStringBuffer buf( 16 );
100cdf0e10cSrcweir buf.append( (sal_Unicode)'0' );
101cdf0e10cSrcweir buf.append( (sal_Unicode)'x' );
102cdf0e10cSrcweir buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_textLineColor, 16 ) );
103cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textline-color") ),
104cdf0e10cSrcweir buf.makeStringAndClear() );
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
107cdf0e10cSrcweir // fill-color
108cdf0e10cSrcweir if (_set & 0x10)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir OUStringBuffer buf( 16 );
111cdf0e10cSrcweir buf.append( (sal_Unicode)'0' );
112cdf0e10cSrcweir buf.append( (sal_Unicode)'x' );
113cdf0e10cSrcweir buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)_fillColor, 16 ) );
114cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fill-color") ),
115cdf0e10cSrcweir buf.makeStringAndClear() );
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir // border
119cdf0e10cSrcweir if (_set & 0x4)
120cdf0e10cSrcweir {
121cdf0e10cSrcweir switch (_border)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir case BORDER_NONE:
124cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
125cdf0e10cSrcweir OUSTR("none") );
126cdf0e10cSrcweir break;
127cdf0e10cSrcweir case BORDER_3D:
128cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
129cdf0e10cSrcweir OUSTR("3d") );
130cdf0e10cSrcweir break;
131cdf0e10cSrcweir case BORDER_SIMPLE:
132cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
133cdf0e10cSrcweir OUSTR("simple") );
134cdf0e10cSrcweir break;
135cdf0e10cSrcweir case BORDER_SIMPLE_COLOR: {
136cdf0e10cSrcweir OUStringBuffer buf;
137cdf0e10cSrcweir buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
138cdf0e10cSrcweir buf.append( OUString::valueOf(
139cdf0e10cSrcweir (sal_Int64)(sal_uInt64)_borderColor, 16 ) );
140cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":border"),
141cdf0e10cSrcweir buf.makeStringAndClear() );
142cdf0e10cSrcweir break;
143cdf0e10cSrcweir }
144cdf0e10cSrcweir default:
145cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected border value!" );
146cdf0e10cSrcweir break;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
150cdf0e10cSrcweir // visual effect (look)
151cdf0e10cSrcweir if (_set & 0x40)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir switch (_visualEffect)
154cdf0e10cSrcweir {
155cdf0e10cSrcweir case awt::VisualEffect::NONE:
156cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
157cdf0e10cSrcweir OUSTR("none") );
158cdf0e10cSrcweir break;
159cdf0e10cSrcweir case awt::VisualEffect::LOOK3D:
160cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
161cdf0e10cSrcweir OUSTR("3d") );
162cdf0e10cSrcweir break;
163cdf0e10cSrcweir case awt::VisualEffect::FLAT:
164cdf0e10cSrcweir pStyle->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":look"),
165cdf0e10cSrcweir OUSTR("simple") );
166cdf0e10cSrcweir break;
167cdf0e10cSrcweir default:
168cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected visual effect value!" );
169cdf0e10cSrcweir break;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir // font-
174cdf0e10cSrcweir if (_set & 0x8)
175cdf0e10cSrcweir {
176cdf0e10cSrcweir awt::FontDescriptor def_descr;
177cdf0e10cSrcweir
178cdf0e10cSrcweir // dialog:font-name CDATA #IMPLIED
179cdf0e10cSrcweir if (def_descr.Name != _descr.Name)
180cdf0e10cSrcweir {
181cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-name") ),
182cdf0e10cSrcweir _descr.Name );
183cdf0e10cSrcweir }
184cdf0e10cSrcweir // dialog:font-height %numeric; #IMPLIED
185cdf0e10cSrcweir if (def_descr.Height != _descr.Height)
186cdf0e10cSrcweir {
187cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-height") ),
188cdf0e10cSrcweir OUString::valueOf( (sal_Int32)_descr.Height ) );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir // dialog:font-width %numeric; #IMPLIED
191cdf0e10cSrcweir if (def_descr.Width != _descr.Width)
192cdf0e10cSrcweir {
193cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-width") ),
194cdf0e10cSrcweir OUString::valueOf( (sal_Int32)_descr.Width ) );
195cdf0e10cSrcweir }
196cdf0e10cSrcweir // dialog:font-stylename CDATA #IMPLIED
197cdf0e10cSrcweir if (def_descr.StyleName != _descr.StyleName)
198cdf0e10cSrcweir {
199cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-stylename") ),
200cdf0e10cSrcweir _descr.StyleName );
201cdf0e10cSrcweir }
202cdf0e10cSrcweir // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
203cdf0e10cSrcweir if (def_descr.Family != _descr.Family)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir switch (_descr.Family)
206cdf0e10cSrcweir {
207cdf0e10cSrcweir case awt::FontFamily::DECORATIVE:
208cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
209cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("decorative") ) );
210cdf0e10cSrcweir break;
211cdf0e10cSrcweir case awt::FontFamily::MODERN:
212cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
213cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("modern") ) );
214cdf0e10cSrcweir break;
215cdf0e10cSrcweir case awt::FontFamily::ROMAN:
216cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
217cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("roman") ) );
218cdf0e10cSrcweir break;
219cdf0e10cSrcweir case awt::FontFamily::SCRIPT:
220cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
221cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("script") ) );
222cdf0e10cSrcweir break;
223cdf0e10cSrcweir case awt::FontFamily::SWISS:
224cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
225cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("swiss") ) );
226cdf0e10cSrcweir break;
227cdf0e10cSrcweir case awt::FontFamily::SYSTEM:
228cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-family") ),
229cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
230cdf0e10cSrcweir break;
231cdf0e10cSrcweir default:
232cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-family!" );
233cdf0e10cSrcweir break;
234cdf0e10cSrcweir }
235cdf0e10cSrcweir }
236cdf0e10cSrcweir // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
237cdf0e10cSrcweir if (def_descr.CharSet != _descr.CharSet)
238cdf0e10cSrcweir {
239cdf0e10cSrcweir switch (_descr.CharSet)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir case awt::CharSet::ANSI:
242cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
243cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ansi") ) );
244cdf0e10cSrcweir break;
245cdf0e10cSrcweir case awt::CharSet::MAC:
246cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
247cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("mac") ) );
248cdf0e10cSrcweir break;
249cdf0e10cSrcweir case awt::CharSet::IBMPC_437:
250cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
251cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_437") ) );
252cdf0e10cSrcweir break;
253cdf0e10cSrcweir case awt::CharSet::IBMPC_850:
254cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
255cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_850") ) );
256cdf0e10cSrcweir break;
257cdf0e10cSrcweir case awt::CharSet::IBMPC_860:
258cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
259cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_860") ) );
260cdf0e10cSrcweir break;
261cdf0e10cSrcweir case awt::CharSet::IBMPC_861:
262cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
263cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_861") ) );
264cdf0e10cSrcweir break;
265cdf0e10cSrcweir case awt::CharSet::IBMPC_863:
266cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
267cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_863") ) );
268cdf0e10cSrcweir break;
269cdf0e10cSrcweir case awt::CharSet::IBMPC_865:
270cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
271cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_865") ) );
272cdf0e10cSrcweir break;
273cdf0e10cSrcweir case awt::CharSet::SYSTEM:
274cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
275cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
276cdf0e10cSrcweir break;
277cdf0e10cSrcweir case awt::CharSet::SYMBOL:
278cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charset") ),
279cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) );
280cdf0e10cSrcweir break;
281cdf0e10cSrcweir default:
282cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-charset!" );
283cdf0e10cSrcweir break;
284cdf0e10cSrcweir }
285cdf0e10cSrcweir }
286cdf0e10cSrcweir // dialog:font-pitch "(fixed|variable)" #IMPLIED
287cdf0e10cSrcweir if (def_descr.Pitch != _descr.Pitch)
288cdf0e10cSrcweir {
289cdf0e10cSrcweir switch (_descr.Pitch)
290cdf0e10cSrcweir {
291cdf0e10cSrcweir case awt::FontPitch::FIXED:
292cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
293cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("fixed") ) );
294cdf0e10cSrcweir break;
295cdf0e10cSrcweir case awt::FontPitch::VARIABLE:
296cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-pitch") ),
297cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) );
298cdf0e10cSrcweir break;
299cdf0e10cSrcweir default:
300cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-pitch!" );
301cdf0e10cSrcweir break;
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir // dialog:font-charwidth CDATA #IMPLIED
305cdf0e10cSrcweir if (def_descr.CharacterWidth != _descr.CharacterWidth)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-charwidth") ),
308cdf0e10cSrcweir OUString::valueOf( (float)_descr.CharacterWidth ) );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir // dialog:font-weight CDATA #IMPLIED
311cdf0e10cSrcweir if (def_descr.Weight != _descr.Weight)
312cdf0e10cSrcweir {
313cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-weight") ),
314cdf0e10cSrcweir OUString::valueOf( (float)_descr.Weight ) );
315cdf0e10cSrcweir }
316cdf0e10cSrcweir // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
317cdf0e10cSrcweir if (def_descr.Slant != _descr.Slant)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir switch (_descr.Slant)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir case awt::FontSlant_OBLIQUE:
322cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
323cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("oblique") ) );
324cdf0e10cSrcweir break;
325cdf0e10cSrcweir case awt::FontSlant_ITALIC:
326cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
327cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("italic") ) );
328cdf0e10cSrcweir break;
329cdf0e10cSrcweir case awt::FontSlant_REVERSE_OBLIQUE:
330cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
331cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_oblique") ) );
332cdf0e10cSrcweir break;
333cdf0e10cSrcweir case awt::FontSlant_REVERSE_ITALIC:
334cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-slant") ),
335cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) );
336cdf0e10cSrcweir break;
337cdf0e10cSrcweir default:
338cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-slant!" );
339cdf0e10cSrcweir break;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir }
342cdf0e10cSrcweir // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
343cdf0e10cSrcweir if (def_descr.Underline != _descr.Underline)
344cdf0e10cSrcweir {
345cdf0e10cSrcweir switch (_descr.Underline)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir case awt::FontUnderline::SINGLE:
348cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
349cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
350cdf0e10cSrcweir break;
351cdf0e10cSrcweir case awt::FontUnderline::DOUBLE:
352cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
353cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
354cdf0e10cSrcweir break;
355cdf0e10cSrcweir case awt::FontUnderline::DOTTED:
356cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
357cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("dotted") ) );
358cdf0e10cSrcweir break;
359cdf0e10cSrcweir case awt::FontUnderline::DASH:
360cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
361cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("dash") ) );
362cdf0e10cSrcweir break;
363cdf0e10cSrcweir case awt::FontUnderline::LONGDASH:
364cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
365cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("longdash") ) );
366cdf0e10cSrcweir break;
367cdf0e10cSrcweir case awt::FontUnderline::DASHDOT:
368cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
369cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("dashdot") ) );
370cdf0e10cSrcweir break;
371cdf0e10cSrcweir case awt::FontUnderline::DASHDOTDOT:
372cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
373cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("dashdotdot") ) );
374cdf0e10cSrcweir break;
375cdf0e10cSrcweir case awt::FontUnderline::SMALLWAVE:
376cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
377cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("smallwave") ) );
378cdf0e10cSrcweir break;
379cdf0e10cSrcweir case awt::FontUnderline::WAVE:
380cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
381cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("wave") ) );
382cdf0e10cSrcweir break;
383cdf0e10cSrcweir case awt::FontUnderline::DOUBLEWAVE:
384cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
385cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("doublewave") ) );
386cdf0e10cSrcweir break;
387cdf0e10cSrcweir case awt::FontUnderline::BOLD:
388cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
389cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
390cdf0e10cSrcweir break;
391cdf0e10cSrcweir case awt::FontUnderline::BOLDDOTTED:
392cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
393cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bolddotted") ) );
394cdf0e10cSrcweir break;
395cdf0e10cSrcweir case awt::FontUnderline::BOLDDASH:
396cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
397cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bolddash") ) );
398cdf0e10cSrcweir break;
399cdf0e10cSrcweir case awt::FontUnderline::BOLDLONGDASH:
400cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
401cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("boldlongdash") ) );
402cdf0e10cSrcweir break;
403cdf0e10cSrcweir case awt::FontUnderline::BOLDDASHDOT:
404cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
405cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdot") ) );
406cdf0e10cSrcweir break;
407cdf0e10cSrcweir case awt::FontUnderline::BOLDDASHDOTDOT:
408cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
409cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdotdot") ) );
410cdf0e10cSrcweir break;
411cdf0e10cSrcweir case awt::FontUnderline::BOLDWAVE:
412cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-underline") ),
413cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) );
414cdf0e10cSrcweir break;
415cdf0e10cSrcweir default:
416cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-underline!" );
417cdf0e10cSrcweir break;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir }
420cdf0e10cSrcweir // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
421cdf0e10cSrcweir if (def_descr.Strikeout != _descr.Strikeout)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir switch (_descr.Strikeout)
424cdf0e10cSrcweir {
425cdf0e10cSrcweir case awt::FontStrikeout::SINGLE:
426cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
427cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
428cdf0e10cSrcweir break;
429cdf0e10cSrcweir case awt::FontStrikeout::DOUBLE:
430cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
431cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
432cdf0e10cSrcweir break;
433cdf0e10cSrcweir case awt::FontStrikeout::BOLD:
434cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
435cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
436cdf0e10cSrcweir break;
437cdf0e10cSrcweir case awt::FontStrikeout::SLASH:
438cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
439cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("slash") ) );
440cdf0e10cSrcweir break;
441cdf0e10cSrcweir case awt::FontStrikeout::X:
442cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-strikeout") ),
443cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) );
444cdf0e10cSrcweir break;
445cdf0e10cSrcweir default:
446cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-strikeout!" );
447cdf0e10cSrcweir break;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir }
450cdf0e10cSrcweir // dialog:font-orientation CDATA #IMPLIED
451cdf0e10cSrcweir if (def_descr.Orientation != _descr.Orientation)
452cdf0e10cSrcweir {
453cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-orientation") ),
454cdf0e10cSrcweir OUString::valueOf( (float)_descr.Orientation ) );
455cdf0e10cSrcweir }
456cdf0e10cSrcweir // dialog:font-kerning %boolean; #IMPLIED
457cdf0e10cSrcweir if ((def_descr.Kerning != sal_False) != (_descr.Kerning != sal_False))
458cdf0e10cSrcweir {
459cdf0e10cSrcweir pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-kerning") ),
460cdf0e10cSrcweir _descr.Kerning );
461cdf0e10cSrcweir }
462cdf0e10cSrcweir // dialog:font-wordlinemode %boolean; #IMPLIED
463cdf0e10cSrcweir if ((def_descr.WordLineMode != sal_False) != (_descr.WordLineMode != sal_False))
464cdf0e10cSrcweir {
465cdf0e10cSrcweir pStyle->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-wordlinemode") ),
466cdf0e10cSrcweir _descr.WordLineMode );
467cdf0e10cSrcweir }
468cdf0e10cSrcweir // dialog:font-type "(raster|device|scalable)" #IMPLIED
469cdf0e10cSrcweir if (def_descr.Type != _descr.Type)
470cdf0e10cSrcweir {
471cdf0e10cSrcweir switch (_descr.Type)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir case awt::FontType::RASTER:
474cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
475cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("raster") ) );
476cdf0e10cSrcweir break;
477cdf0e10cSrcweir case awt::FontType::DEVICE:
478cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
479cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("device") ) );
480cdf0e10cSrcweir break;
481cdf0e10cSrcweir case awt::FontType::SCALABLE:
482cdf0e10cSrcweir pStyle->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-type") ),
483cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) );
484cdf0e10cSrcweir break;
485cdf0e10cSrcweir default:
486cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-type!" );
487cdf0e10cSrcweir break;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir }
490cdf0e10cSrcweir
491cdf0e10cSrcweir // additional attributes not in FontDescriptor struct
492cdf0e10cSrcweir // dialog:font-relief (none|embossed|engraved) #IMPLIED
493cdf0e10cSrcweir switch (_fontRelief)
494cdf0e10cSrcweir {
495cdf0e10cSrcweir case awt::FontRelief::NONE: // dont export default
496cdf0e10cSrcweir break;
497cdf0e10cSrcweir case awt::FontRelief::EMBOSSED:
498cdf0e10cSrcweir pStyle->addAttribute(
499cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
500cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("embossed") ) );
501cdf0e10cSrcweir break;
502cdf0e10cSrcweir case awt::FontRelief::ENGRAVED:
503cdf0e10cSrcweir pStyle->addAttribute(
504cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-relief") ),
505cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) );
506cdf0e10cSrcweir break;
507cdf0e10cSrcweir default:
508cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-relief!" );
509cdf0e10cSrcweir break;
510cdf0e10cSrcweir }
511cdf0e10cSrcweir // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
512cdf0e10cSrcweir switch (_fontEmphasisMark)
513cdf0e10cSrcweir {
514cdf0e10cSrcweir case awt::FontEmphasisMark::NONE: // dont export default
515cdf0e10cSrcweir break;
516cdf0e10cSrcweir case awt::FontEmphasisMark::DOT:
517cdf0e10cSrcweir pStyle->addAttribute(
518cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
519cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("dot") ) );
520cdf0e10cSrcweir break;
521cdf0e10cSrcweir case awt::FontEmphasisMark::CIRCLE:
522cdf0e10cSrcweir pStyle->addAttribute(
523cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
524cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("circle") ) );
525cdf0e10cSrcweir break;
526cdf0e10cSrcweir case awt::FontEmphasisMark::DISC:
527cdf0e10cSrcweir pStyle->addAttribute(
528cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
529cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("disc") ) );
530cdf0e10cSrcweir break;
531cdf0e10cSrcweir case awt::FontEmphasisMark::ACCENT:
532cdf0e10cSrcweir pStyle->addAttribute(
533cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
534cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("accent") ) );
535cdf0e10cSrcweir break;
536cdf0e10cSrcweir case awt::FontEmphasisMark::ABOVE:
537cdf0e10cSrcweir pStyle->addAttribute(
538cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
539cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("above") ) );
540cdf0e10cSrcweir break;
541cdf0e10cSrcweir case awt::FontEmphasisMark::BELOW:
542cdf0e10cSrcweir pStyle->addAttribute(
543cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":font-emphasismark") ),
544cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) );
545cdf0e10cSrcweir break;
546cdf0e10cSrcweir default:
547cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected font-emphasismark!" );
548cdf0e10cSrcweir break;
549cdf0e10cSrcweir }
550cdf0e10cSrcweir }
551cdf0e10cSrcweir
552cdf0e10cSrcweir return pStyle;
553cdf0e10cSrcweir }
554cdf0e10cSrcweir
555cdf0e10cSrcweir //##################################################################################################
556cdf0e10cSrcweir
557cdf0e10cSrcweir //__________________________________________________________________________________________________
addNumberFormatAttr(Reference<beans::XPropertySet> const & xFormatProperties,OUString const &)558cdf0e10cSrcweir void ElementDescriptor::addNumberFormatAttr(
559cdf0e10cSrcweir Reference< beans::XPropertySet > const & xFormatProperties,
560cdf0e10cSrcweir OUString const & /*rAttrName*/ )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir Reference< beans::XPropertyState > xState( xFormatProperties, UNO_QUERY );
563cdf0e10cSrcweir OUString sFormat;
564cdf0e10cSrcweir lang::Locale locale;
565cdf0e10cSrcweir OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString") ) ) >>= sFormat );
566cdf0e10cSrcweir OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Locale") ) ) >>= locale );
567cdf0e10cSrcweir
568cdf0e10cSrcweir addAttribute(
569cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-code") ),
570cdf0e10cSrcweir sFormat );
571cdf0e10cSrcweir
572cdf0e10cSrcweir // format-locale
573cdf0e10cSrcweir OUStringBuffer buf( 48 );
574cdf0e10cSrcweir buf.append( locale.Language );
575cdf0e10cSrcweir if (locale.Country.getLength())
576cdf0e10cSrcweir {
577cdf0e10cSrcweir buf.append( (sal_Unicode)';' );
578cdf0e10cSrcweir buf.append( locale.Country );
579cdf0e10cSrcweir if (locale.Variant.getLength())
580cdf0e10cSrcweir {
581cdf0e10cSrcweir buf.append( (sal_Unicode)';' );
582cdf0e10cSrcweir buf.append( locale.Variant );
583cdf0e10cSrcweir }
584cdf0e10cSrcweir }
585cdf0e10cSrcweir addAttribute(
586cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-locale") ),
587cdf0e10cSrcweir buf.makeStringAndClear() );
588cdf0e10cSrcweir }
589cdf0e10cSrcweir //__________________________________________________________________________________________________
readProp(OUString const & rPropName)590cdf0e10cSrcweir Any ElementDescriptor::readProp( OUString const & rPropName )
591cdf0e10cSrcweir {
592cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
593cdf0e10cSrcweir {
594cdf0e10cSrcweir return _xProps->getPropertyValue( rPropName );
595cdf0e10cSrcweir }
596cdf0e10cSrcweir return Any();
597cdf0e10cSrcweir }
598cdf0e10cSrcweir
599cdf0e10cSrcweir //______________________________________________________________________________
readStringAttr(OUString const & rPropName,OUString const & rAttrName)600cdf0e10cSrcweir void ElementDescriptor::readStringAttr(
601cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName )
602cdf0e10cSrcweir {
603cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE !=
604cdf0e10cSrcweir _xPropState->getPropertyState( rPropName ))
605cdf0e10cSrcweir {
606cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
607cdf0e10cSrcweir OUString v;
608cdf0e10cSrcweir if (a >>= v)
609cdf0e10cSrcweir addAttribute( rAttrName, v );
610cdf0e10cSrcweir else
611cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected property type!" );
612cdf0e10cSrcweir }
613cdf0e10cSrcweir }
614cdf0e10cSrcweir
615cdf0e10cSrcweir //__________________________________________________________________________________________________
readHexLongAttr(OUString const & rPropName,OUString const & rAttrName)616cdf0e10cSrcweir void ElementDescriptor::readHexLongAttr( OUString const & rPropName, OUString const & rAttrName )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
619cdf0e10cSrcweir {
620cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
621cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
622cdf0e10cSrcweir {
623cdf0e10cSrcweir OUStringBuffer buf( 16 );
624cdf0e10cSrcweir buf.append( (sal_Unicode)'0' );
625cdf0e10cSrcweir buf.append( (sal_Unicode)'x' );
626cdf0e10cSrcweir buf.append( OUString::valueOf( (sal_Int64)(sal_uInt64)*(sal_uInt32 *)a.getValue(), 16 ) );
627cdf0e10cSrcweir addAttribute( rAttrName, buf.makeStringAndClear() );
628cdf0e10cSrcweir }
629cdf0e10cSrcweir }
630cdf0e10cSrcweir }
631cdf0e10cSrcweir
632cdf0e10cSrcweir //__________________________________________________________________________________________________
readDateFormatAttr(OUString const & rPropName,OUString const & rAttrName)633cdf0e10cSrcweir void ElementDescriptor::readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName )
634cdf0e10cSrcweir {
635cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
636cdf0e10cSrcweir {
637cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
638cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
639cdf0e10cSrcweir {
640cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
641cdf0e10cSrcweir {
642cdf0e10cSrcweir case 0:
643cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short") ) );
644cdf0e10cSrcweir break;
645cdf0e10cSrcweir case 1:
646cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YY") ) );
647cdf0e10cSrcweir break;
648cdf0e10cSrcweir case 2:
649cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YYYY") ) );
650cdf0e10cSrcweir break;
651cdf0e10cSrcweir case 3:
652cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("system_long") ) );
653cdf0e10cSrcweir break;
654cdf0e10cSrcweir case 4:
655cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYY") ) );
656cdf0e10cSrcweir break;
657cdf0e10cSrcweir case 5:
658cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYY") ) );
659cdf0e10cSrcweir break;
660cdf0e10cSrcweir case 6:
661cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD") ) );
662cdf0e10cSrcweir break;
663cdf0e10cSrcweir case 7:
664cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYYYY") ) );
665cdf0e10cSrcweir break;
666cdf0e10cSrcweir case 8:
667cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYYYY") ) );
668cdf0e10cSrcweir break;
669cdf0e10cSrcweir case 9:
670cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD") ) );
671cdf0e10cSrcweir break;
672cdf0e10cSrcweir case 10:
673cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD_DIN5008") ) );
674cdf0e10cSrcweir break;
675cdf0e10cSrcweir case 11:
676cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) );
677cdf0e10cSrcweir break;
678cdf0e10cSrcweir default:
679cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected date format!" );
680cdf0e10cSrcweir break;
681cdf0e10cSrcweir }
682cdf0e10cSrcweir }
683cdf0e10cSrcweir }
684cdf0e10cSrcweir }
685cdf0e10cSrcweir //__________________________________________________________________________________________________
readTimeFormatAttr(OUString const & rPropName,OUString const & rAttrName)686cdf0e10cSrcweir void ElementDescriptor::readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName )
687cdf0e10cSrcweir {
688cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
689cdf0e10cSrcweir {
690cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
691cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
692cdf0e10cSrcweir {
693cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
694cdf0e10cSrcweir {
695cdf0e10cSrcweir case 0:
696cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_short") ) );
697cdf0e10cSrcweir break;
698cdf0e10cSrcweir case 1:
699cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_long") ) );
700cdf0e10cSrcweir break;
701cdf0e10cSrcweir case 2:
702cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_short") ) );
703cdf0e10cSrcweir break;
704cdf0e10cSrcweir case 3:
705cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_long") ) );
706cdf0e10cSrcweir break;
707cdf0e10cSrcweir case 4:
708cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_short") ) );
709cdf0e10cSrcweir break;
710cdf0e10cSrcweir case 5:
711cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) );
712cdf0e10cSrcweir break;
713cdf0e10cSrcweir default:
714cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected time format!" );
715cdf0e10cSrcweir break;
716cdf0e10cSrcweir }
717cdf0e10cSrcweir }
718cdf0e10cSrcweir }
719cdf0e10cSrcweir }
720cdf0e10cSrcweir //__________________________________________________________________________________________________
readAlignAttr(OUString const & rPropName,OUString const & rAttrName)721cdf0e10cSrcweir void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString const & rAttrName )
722cdf0e10cSrcweir {
723cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
724cdf0e10cSrcweir {
725cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
726cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
727cdf0e10cSrcweir {
728cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
729cdf0e10cSrcweir {
730cdf0e10cSrcweir case 0:
731cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
732cdf0e10cSrcweir break;
733cdf0e10cSrcweir case 1:
734cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
735cdf0e10cSrcweir break;
736cdf0e10cSrcweir case 2:
737cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
738cdf0e10cSrcweir break;
739cdf0e10cSrcweir default:
740cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal alignment value!" );
741cdf0e10cSrcweir break;
742cdf0e10cSrcweir }
743cdf0e10cSrcweir }
744cdf0e10cSrcweir }
745cdf0e10cSrcweir }
746cdf0e10cSrcweir //__________________________________________________________________________________________________
readVerticalAlignAttr(OUString const & rPropName,OUString const & rAttrName)747cdf0e10cSrcweir void ElementDescriptor::readVerticalAlignAttr( OUString const & rPropName, OUString const & rAttrName )
748cdf0e10cSrcweir {
749cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
750cdf0e10cSrcweir {
751cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
752cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_ENUM && a.getValueType() == ::getCppuType( (style::VerticalAlignment*)0 ))
753cdf0e10cSrcweir {
754cdf0e10cSrcweir style::VerticalAlignment eAlign;
755cdf0e10cSrcweir a >>= eAlign;
756cdf0e10cSrcweir switch (eAlign)
757cdf0e10cSrcweir {
758cdf0e10cSrcweir case style::VerticalAlignment_TOP:
759cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
760cdf0e10cSrcweir break;
761cdf0e10cSrcweir case style::VerticalAlignment_MIDDLE:
762cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
763cdf0e10cSrcweir break;
764cdf0e10cSrcweir case style::VerticalAlignment_BOTTOM:
765cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
766cdf0e10cSrcweir break;
767cdf0e10cSrcweir default:
768cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal vertical alignment value!" );
769cdf0e10cSrcweir break;
770cdf0e10cSrcweir }
771cdf0e10cSrcweir }
772cdf0e10cSrcweir }
773cdf0e10cSrcweir }
774cdf0e10cSrcweir //__________________________________________________________________________________________________
readImageAlignAttr(OUString const & rPropName,OUString const & rAttrName)775cdf0e10cSrcweir void ElementDescriptor::readImageAlignAttr( OUString const & rPropName, OUString const & rAttrName )
776cdf0e10cSrcweir {
777cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
778cdf0e10cSrcweir {
779cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
780cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
781cdf0e10cSrcweir {
782cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
783cdf0e10cSrcweir {
784cdf0e10cSrcweir case 0:
785cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
786cdf0e10cSrcweir break;
787cdf0e10cSrcweir case 1:
788cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
789cdf0e10cSrcweir break;
790cdf0e10cSrcweir case 2:
791cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
792cdf0e10cSrcweir break;
793cdf0e10cSrcweir case 3:
794cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
795cdf0e10cSrcweir break;
796cdf0e10cSrcweir default:
797cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal image alignment value!" );
798cdf0e10cSrcweir break;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir }
801cdf0e10cSrcweir }
802cdf0e10cSrcweir }
803cdf0e10cSrcweir //__________________________________________________________________________________________________
readImagePositionAttr(OUString const & rPropName,OUString const & rAttrName)804cdf0e10cSrcweir void ElementDescriptor::readImagePositionAttr( OUString const & rPropName, OUString const & rAttrName )
805cdf0e10cSrcweir {
806cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
807cdf0e10cSrcweir {
808cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
809cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
810cdf0e10cSrcweir {
811cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
812cdf0e10cSrcweir {
813cdf0e10cSrcweir case awt::ImagePosition::LeftTop:
814cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-top") ) );
815cdf0e10cSrcweir break;
816cdf0e10cSrcweir case awt::ImagePosition::LeftCenter:
817cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-center") ) );
818cdf0e10cSrcweir break;
819cdf0e10cSrcweir case awt::ImagePosition::LeftBottom:
820cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("left-bottom") ) );
821cdf0e10cSrcweir break;
822cdf0e10cSrcweir case awt::ImagePosition::RightTop:
823cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-top") ) );
824cdf0e10cSrcweir break;
825cdf0e10cSrcweir case awt::ImagePosition::RightCenter:
826cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-center") ) );
827cdf0e10cSrcweir break;
828cdf0e10cSrcweir case awt::ImagePosition::RightBottom:
829cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("right-bottom") ) );
830cdf0e10cSrcweir break;
831cdf0e10cSrcweir case awt::ImagePosition::AboveLeft:
832cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-left") ) );
833cdf0e10cSrcweir break;
834cdf0e10cSrcweir case awt::ImagePosition::AboveCenter:
835cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-center") ) );
836cdf0e10cSrcweir break;
837cdf0e10cSrcweir case awt::ImagePosition::AboveRight:
838cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("top-right") ) );
839cdf0e10cSrcweir break;
840cdf0e10cSrcweir case awt::ImagePosition::BelowLeft:
841cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-left") ) );
842cdf0e10cSrcweir break;
843cdf0e10cSrcweir case awt::ImagePosition::BelowCenter:
844cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-center") ) );
845cdf0e10cSrcweir break;
846cdf0e10cSrcweir case awt::ImagePosition::BelowRight:
847cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-right") ) );
848cdf0e10cSrcweir break;
849cdf0e10cSrcweir case awt::ImagePosition::Centered:
850cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
851cdf0e10cSrcweir break;
852cdf0e10cSrcweir default:
853cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal image position value!" );
854cdf0e10cSrcweir break;
855cdf0e10cSrcweir }
856cdf0e10cSrcweir }
857cdf0e10cSrcweir }
858cdf0e10cSrcweir }
859cdf0e10cSrcweir //__________________________________________________________________________________________________
readButtonTypeAttr(OUString const & rPropName,OUString const & rAttrName)860cdf0e10cSrcweir void ElementDescriptor::readButtonTypeAttr( OUString const & rPropName, OUString const & rAttrName )
861cdf0e10cSrcweir {
862cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
863cdf0e10cSrcweir {
864cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
865cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
866cdf0e10cSrcweir {
867cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
868cdf0e10cSrcweir {
869cdf0e10cSrcweir case awt::PushButtonType_STANDARD:
870cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("standard") ) );
871cdf0e10cSrcweir break;
872cdf0e10cSrcweir case awt::PushButtonType_OK:
873cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("ok") ) );
874cdf0e10cSrcweir break;
875cdf0e10cSrcweir case awt::PushButtonType_CANCEL:
876cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("cancel") ) );
877cdf0e10cSrcweir break;
878cdf0e10cSrcweir case awt::PushButtonType_HELP:
879cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) );
880cdf0e10cSrcweir break;
881cdf0e10cSrcweir default:
882cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal button-type value!" );
883cdf0e10cSrcweir break;
884cdf0e10cSrcweir }
885cdf0e10cSrcweir }
886cdf0e10cSrcweir }
887cdf0e10cSrcweir }
888cdf0e10cSrcweir //__________________________________________________________________________________________________
readOrientationAttr(OUString const & rPropName,OUString const & rAttrName)889cdf0e10cSrcweir void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
892cdf0e10cSrcweir {
893cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
894cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
895cdf0e10cSrcweir {
896cdf0e10cSrcweir switch (*(sal_Int32 const *)a.getValue())
897cdf0e10cSrcweir {
898cdf0e10cSrcweir case 0:
899cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("horizontal") ) );
900cdf0e10cSrcweir break;
901cdf0e10cSrcweir case 1:
902cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) );
903cdf0e10cSrcweir break;
904cdf0e10cSrcweir default:
905cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal orientation value!" );
906cdf0e10cSrcweir break;
907cdf0e10cSrcweir }
908cdf0e10cSrcweir }
909cdf0e10cSrcweir }
910cdf0e10cSrcweir }
911cdf0e10cSrcweir //__________________________________________________________________________________________________
readLineEndFormatAttr(OUString const & rPropName,OUString const & rAttrName)912cdf0e10cSrcweir void ElementDescriptor::readLineEndFormatAttr( OUString const & rPropName, OUString const & rAttrName )
913cdf0e10cSrcweir {
914cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
915cdf0e10cSrcweir {
916cdf0e10cSrcweir Any a( _xProps->getPropertyValue( rPropName ) );
917cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_SHORT)
918cdf0e10cSrcweir {
919cdf0e10cSrcweir switch (*(sal_Int16 const *)a.getValue())
920cdf0e10cSrcweir {
921cdf0e10cSrcweir case awt::LineEndFormat::CARRIAGE_RETURN:
922cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return") ) );
923cdf0e10cSrcweir break;
924cdf0e10cSrcweir case awt::LineEndFormat::LINE_FEED:
925cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("line-feed") ) );
926cdf0e10cSrcweir break;
927cdf0e10cSrcweir case awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED:
928cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return-line-feed") ) );
929cdf0e10cSrcweir break;
930cdf0e10cSrcweir default:
931cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal line end format value!" );
932cdf0e10cSrcweir break;
933cdf0e10cSrcweir }
934cdf0e10cSrcweir }
935cdf0e10cSrcweir }
936cdf0e10cSrcweir }
937cdf0e10cSrcweir //__________________________________________________________________________________________________
readSelectionTypeAttr(OUString const & rPropName,OUString const & rAttrName)938cdf0e10cSrcweir void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUString const & rAttrName )
939cdf0e10cSrcweir {
940cdf0e10cSrcweir if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
941cdf0e10cSrcweir {
942cdf0e10cSrcweir Any aSelectionType ( _xProps->getPropertyValue( rPropName ) );
943cdf0e10cSrcweir
944cdf0e10cSrcweir if (aSelectionType.getValueTypeClass() == TypeClass_ENUM && aSelectionType.getValueType() == ::getCppuType( (::view::SelectionType*)0 ))
945cdf0e10cSrcweir {
946cdf0e10cSrcweir ::view::SelectionType eSelectionType;
947cdf0e10cSrcweir aSelectionType >>= eSelectionType;
948cdf0e10cSrcweir
949cdf0e10cSrcweir switch (eSelectionType)
950cdf0e10cSrcweir {
951cdf0e10cSrcweir case ::view::SelectionType_NONE:
952cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("none") ) );
953cdf0e10cSrcweir break;
954cdf0e10cSrcweir case ::view::SelectionType_SINGLE:
955cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
956cdf0e10cSrcweir break;
957cdf0e10cSrcweir case ::view::SelectionType_MULTI:
958cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("multi") ) );
959cdf0e10cSrcweir break;
960cdf0e10cSrcweir case ::view::SelectionType_RANGE:
961cdf0e10cSrcweir addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("range") ) );
962cdf0e10cSrcweir break;
963cdf0e10cSrcweir default:
964cdf0e10cSrcweir OSL_ENSURE( 0, "### illegal selection type value!" );
965cdf0e10cSrcweir break;
966cdf0e10cSrcweir }
967cdf0e10cSrcweir }
968cdf0e10cSrcweir }
969cdf0e10cSrcweir }
970cdf0e10cSrcweir //__________________________________________________________________________________________________
readDefaults(bool supportPrintable,bool supportVisible)971cdf0e10cSrcweir void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir Any a( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
974cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":id") ),
975cdf0e10cSrcweir * reinterpret_cast< const OUString * >( a.getValue() ) );
976cdf0e10cSrcweir readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
977cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tab-index") ) );
978cdf0e10cSrcweir
979cdf0e10cSrcweir sal_Bool bEnabled = sal_False;
980cdf0e10cSrcweir if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ) ) >>= bEnabled)
981cdf0e10cSrcweir {
982cdf0e10cSrcweir if (! bEnabled)
983cdf0e10cSrcweir {
984cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":disabled") ),
985cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
986cdf0e10cSrcweir }
987cdf0e10cSrcweir }
988cdf0e10cSrcweir else
989cdf0e10cSrcweir {
990cdf0e10cSrcweir OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" );
991cdf0e10cSrcweir }
992cdf0e10cSrcweir
993cdf0e10cSrcweir sal_Bool bVisible = sal_True;
994cdf0e10cSrcweir if (supportVisible) try
995cdf0e10cSrcweir {
996cdf0e10cSrcweir if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible)
997cdf0e10cSrcweir {
998cdf0e10cSrcweir
999cdf0e10cSrcweir // only write out the non default case
1000cdf0e10cSrcweir if (! bVisible)
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible") ),
1003cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir catch( Exception& )
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir // force writing of pos/size
1012cdf0e10cSrcweir a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) );
1013cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
1014cdf0e10cSrcweir {
1015cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":left") ),
1016cdf0e10cSrcweir OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ) );
1019cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
1020cdf0e10cSrcweir {
1021cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":top") ),
1022cdf0e10cSrcweir OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) );
1025cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
1026cdf0e10cSrcweir {
1027cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":width") ),
1028cdf0e10cSrcweir OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir a = _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) );
1031cdf0e10cSrcweir if (a.getValueTypeClass() == TypeClass_LONG)
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":height") ),
1034cdf0e10cSrcweir OUString::valueOf( *(sal_Int32 const *)a.getValue() ) );
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir if (supportPrintable)
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir readBoolAttr(
1040cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
1041cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":printable") ) );
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
1044cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ) );
1045cdf0e10cSrcweir readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
1046cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tag") ) );
1047cdf0e10cSrcweir readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
1048cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-text") ) );
1049cdf0e10cSrcweir readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
1050cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":help-url") ) );
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir
1053cdf0e10cSrcweir struct StringTriple
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir char const * first;
1056cdf0e10cSrcweir char const * second;
1057cdf0e10cSrcweir char const * third;
1058cdf0e10cSrcweir };
1059cdf0e10cSrcweir extern StringTriple const * const g_pEventTranslations;
1060cdf0e10cSrcweir
1061cdf0e10cSrcweir //__________________________________________________________________________________________________
readEvents()1062cdf0e10cSrcweir void ElementDescriptor::readEvents()
1063cdf0e10cSrcweir SAL_THROW( (Exception) )
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir Reference< script::XScriptEventsSupplier > xSupplier( _xProps, UNO_QUERY );
1066cdf0e10cSrcweir if (xSupplier.is())
1067cdf0e10cSrcweir {
1068cdf0e10cSrcweir Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
1069cdf0e10cSrcweir if (xEvents.is())
1070cdf0e10cSrcweir {
1071cdf0e10cSrcweir Sequence< OUString > aNames( xEvents->getElementNames() );
1072cdf0e10cSrcweir OUString const * pNames = aNames.getConstArray();
1073cdf0e10cSrcweir for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); ++nPos )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir script::ScriptEventDescriptor descr;
1076cdf0e10cSrcweir if (xEvents->getByName( pNames[ nPos ] ) >>= descr)
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir OSL_ENSURE( descr.ListenerType.getLength() > 0 &&
1079cdf0e10cSrcweir descr.EventMethod.getLength() > 0 &&
1080cdf0e10cSrcweir descr.ScriptCode.getLength() > 0 &&
1081cdf0e10cSrcweir descr.ScriptType.getLength() > 0,
1082cdf0e10cSrcweir "### invalid event descr!" );
1083cdf0e10cSrcweir
1084cdf0e10cSrcweir OUString aEventName;
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir if (! descr.AddListenerParam.getLength())
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir // detection of event-name
1089cdf0e10cSrcweir ::rtl::OString listenerType(
1090cdf0e10cSrcweir ::rtl::OUStringToOString(
1091cdf0e10cSrcweir descr.ListenerType,
1092cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US ) );
1093cdf0e10cSrcweir ::rtl::OString eventMethod(
1094cdf0e10cSrcweir ::rtl::OUStringToOString(
1095cdf0e10cSrcweir descr.EventMethod,
1096cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US ) );
1097cdf0e10cSrcweir StringTriple const * p = g_pEventTranslations;
1098cdf0e10cSrcweir while (p->first)
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir if (0 == ::rtl_str_compare( p->second, eventMethod.getStr() ) &&
1101cdf0e10cSrcweir 0 == ::rtl_str_compare( p->first, listenerType.getStr() ))
1102cdf0e10cSrcweir {
1103cdf0e10cSrcweir aEventName = OUString( p->third, ::rtl_str_getLength( p->third ), RTL_TEXTENCODING_ASCII_US );
1104cdf0e10cSrcweir break;
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir ++p;
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir
1110cdf0e10cSrcweir ElementDescriptor * pElem;
1111cdf0e10cSrcweir Reference< xml::sax::XAttributeList > xElem;
1112cdf0e10cSrcweir
1113cdf0e10cSrcweir if (aEventName.getLength()) // script:event
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir pElem = new ElementDescriptor(
1116cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event") ) );
1117cdf0e10cSrcweir xElem = pElem;
1118cdf0e10cSrcweir
1119cdf0e10cSrcweir pElem->addAttribute(
1120cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":event-name") ),
1121cdf0e10cSrcweir aEventName );
1122cdf0e10cSrcweir }
1123cdf0e10cSrcweir else // script:listener-event
1124cdf0e10cSrcweir {
1125cdf0e10cSrcweir pElem = new ElementDescriptor(
1126cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-event") ) );
1127cdf0e10cSrcweir xElem = pElem;
1128cdf0e10cSrcweir
1129cdf0e10cSrcweir pElem->addAttribute(
1130cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-type") ),
1131cdf0e10cSrcweir descr.ListenerType );
1132cdf0e10cSrcweir pElem->addAttribute(
1133cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-method") ),
1134cdf0e10cSrcweir descr.EventMethod );
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir if (descr.AddListenerParam.getLength())
1137cdf0e10cSrcweir {
1138cdf0e10cSrcweir pElem->addAttribute(
1139cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":listener-param") ),
1140cdf0e10cSrcweir descr.AddListenerParam );
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir // separate optional location
1146cdf0e10cSrcweir sal_Int32 nIndex = descr.ScriptCode.indexOf( (sal_Unicode)':' );
1147cdf0e10cSrcweir if (nIndex >= 0)
1148cdf0e10cSrcweir {
1149cdf0e10cSrcweir pElem->addAttribute(
1150cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":location") ),
1151cdf0e10cSrcweir descr.ScriptCode.copy( 0, nIndex ) );
1152cdf0e10cSrcweir pElem->addAttribute(
1153cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
1154cdf0e10cSrcweir descr.ScriptCode.copy( nIndex +1 ) );
1155cdf0e10cSrcweir }
1156cdf0e10cSrcweir else
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir pElem->addAttribute(
1159cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
1160cdf0e10cSrcweir descr.ScriptCode );
1161cdf0e10cSrcweir }
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir else
1164cdf0e10cSrcweir {
1165cdf0e10cSrcweir pElem->addAttribute(
1166cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":macro-name") ),
1167cdf0e10cSrcweir descr.ScriptCode );
1168cdf0e10cSrcweir }
1169cdf0e10cSrcweir
1170cdf0e10cSrcweir // language
1171cdf0e10cSrcweir pElem->addAttribute(
1172cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX ":language") ),
1173cdf0e10cSrcweir descr.ScriptType );
1174cdf0e10cSrcweir
1175cdf0e10cSrcweir addSubElement( xElem );
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir else
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir OSL_ENSURE( 0, "### unexpected event type in container!" );
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir }
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir }
1185cdf0e10cSrcweir
1186cdf0e10cSrcweir //##################################################################################################
1187cdf0e10cSrcweir
equalFont(Style const & style1,Style const & style2)1188cdf0e10cSrcweir inline bool equalFont( Style const & style1, Style const & style2 )
1189cdf0e10cSrcweir {
1190cdf0e10cSrcweir awt::FontDescriptor const & f1 = style1._descr;
1191cdf0e10cSrcweir awt::FontDescriptor const & f2 = style2._descr;
1192cdf0e10cSrcweir return (
1193cdf0e10cSrcweir f1.Name == f2.Name &&
1194cdf0e10cSrcweir f1.Height == f2.Height &&
1195cdf0e10cSrcweir f1.Width == f2.Width &&
1196cdf0e10cSrcweir f1.StyleName == f2.StyleName &&
1197cdf0e10cSrcweir f1.Family == f2.Family &&
1198cdf0e10cSrcweir f1.CharSet == f2.CharSet &&
1199cdf0e10cSrcweir f1.Pitch == f2.CharSet &&
1200cdf0e10cSrcweir f1.CharacterWidth == f2.CharacterWidth &&
1201cdf0e10cSrcweir f1.Weight == f2.Weight &&
1202cdf0e10cSrcweir f1.Slant == f2.Slant &&
1203cdf0e10cSrcweir f1.Underline == f2.Underline &&
1204cdf0e10cSrcweir f1.Strikeout == f2.Strikeout &&
1205cdf0e10cSrcweir f1.Orientation == f2.Orientation &&
1206cdf0e10cSrcweir (f1.Kerning != sal_False) == (f2.Kerning != sal_False) &&
1207cdf0e10cSrcweir (f1.WordLineMode != sal_False) == (f2.WordLineMode != sal_False) &&
1208cdf0e10cSrcweir f1.Type == f2.Type &&
1209cdf0e10cSrcweir style1._fontRelief == style2._fontRelief &&
1210cdf0e10cSrcweir style1._fontEmphasisMark == style2._fontEmphasisMark
1211cdf0e10cSrcweir );
1212cdf0e10cSrcweir }
1213cdf0e10cSrcweir //__________________________________________________________________________________________________
getStyleId(Style const & rStyle)1214cdf0e10cSrcweir OUString StyleBag::getStyleId( Style const & rStyle )
1215cdf0e10cSrcweir SAL_THROW( () )
1216cdf0e10cSrcweir {
1217cdf0e10cSrcweir if (! rStyle._set) // nothin set
1218cdf0e10cSrcweir {
1219cdf0e10cSrcweir return OUString(); // everything default: no need to export a specific style
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir
1222cdf0e10cSrcweir // lookup existing style
1223cdf0e10cSrcweir for ( size_t nStylesPos = 0; nStylesPos < _styles.size(); ++nStylesPos )
1224cdf0e10cSrcweir {
1225cdf0e10cSrcweir Style * pStyle = _styles[ nStylesPos ];
1226cdf0e10cSrcweir
1227cdf0e10cSrcweir short demanded_defaults = ~rStyle._set & rStyle._all;
1228cdf0e10cSrcweir // test, if defaults are not set
1229cdf0e10cSrcweir if ((~pStyle->_set & demanded_defaults) == demanded_defaults &&
1230cdf0e10cSrcweir (rStyle._set & (pStyle->_all & ~pStyle->_set)) == 0)
1231cdf0e10cSrcweir {
1232cdf0e10cSrcweir short bset = rStyle._set & pStyle->_set;
1233cdf0e10cSrcweir if ((bset & 0x1) &&
1234cdf0e10cSrcweir rStyle._backgroundColor != pStyle->_backgroundColor)
1235cdf0e10cSrcweir continue;
1236cdf0e10cSrcweir if ((bset & 0x2) &&
1237cdf0e10cSrcweir rStyle._textColor != pStyle->_textColor)
1238cdf0e10cSrcweir continue;
1239cdf0e10cSrcweir if ((bset & 0x20) &&
1240cdf0e10cSrcweir rStyle._textLineColor != pStyle->_textLineColor)
1241cdf0e10cSrcweir continue;
1242cdf0e10cSrcweir if ((bset & 0x10) &&
1243cdf0e10cSrcweir rStyle._fillColor != pStyle->_fillColor)
1244cdf0e10cSrcweir continue;
1245cdf0e10cSrcweir if ((bset & 0x4) &&
1246cdf0e10cSrcweir (rStyle._border != pStyle->_border ||
1247cdf0e10cSrcweir (rStyle._border == BORDER_SIMPLE_COLOR &&
1248cdf0e10cSrcweir rStyle._borderColor != pStyle->_borderColor)))
1249cdf0e10cSrcweir continue;
1250cdf0e10cSrcweir if ((bset & 0x8) &&
1251cdf0e10cSrcweir !equalFont( rStyle, *pStyle ))
1252cdf0e10cSrcweir continue;
1253cdf0e10cSrcweir if ((bset & 0x40) &&
1254cdf0e10cSrcweir rStyle._visualEffect != pStyle->_visualEffect)
1255cdf0e10cSrcweir continue;
1256cdf0e10cSrcweir
1257cdf0e10cSrcweir // merge in
1258cdf0e10cSrcweir short bnset = rStyle._set & ~pStyle->_set;
1259cdf0e10cSrcweir if (bnset & 0x1)
1260cdf0e10cSrcweir pStyle->_backgroundColor = rStyle._backgroundColor;
1261cdf0e10cSrcweir if (bnset & 0x2)
1262cdf0e10cSrcweir pStyle->_textColor = rStyle._textColor;
1263cdf0e10cSrcweir if (bnset & 0x20)
1264cdf0e10cSrcweir pStyle->_textLineColor = rStyle._textLineColor;
1265cdf0e10cSrcweir if (bnset & 0x10)
1266cdf0e10cSrcweir pStyle->_fillColor = rStyle._fillColor;
1267cdf0e10cSrcweir if (bnset & 0x4) {
1268cdf0e10cSrcweir pStyle->_border = rStyle._border;
1269cdf0e10cSrcweir pStyle->_borderColor = rStyle._borderColor;
1270cdf0e10cSrcweir }
1271cdf0e10cSrcweir if (bnset & 0x8) {
1272cdf0e10cSrcweir pStyle->_descr = rStyle._descr;
1273cdf0e10cSrcweir pStyle->_fontRelief = rStyle._fontRelief;
1274cdf0e10cSrcweir pStyle->_fontEmphasisMark = rStyle._fontEmphasisMark;
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir if (bnset & 0x40)
1277cdf0e10cSrcweir pStyle->_visualEffect = rStyle._visualEffect;
1278cdf0e10cSrcweir
1279cdf0e10cSrcweir pStyle->_all |= rStyle._all;
1280cdf0e10cSrcweir pStyle->_set |= rStyle._set;
1281cdf0e10cSrcweir
1282cdf0e10cSrcweir return pStyle->_id;
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir }
1285cdf0e10cSrcweir
1286cdf0e10cSrcweir // no appr style found, append new
1287cdf0e10cSrcweir Style * pStyle = new Style( rStyle );
1288cdf0e10cSrcweir pStyle->_id = OUString::valueOf( (sal_Int32)_styles.size() );
1289cdf0e10cSrcweir _styles.push_back( pStyle );
1290cdf0e10cSrcweir return pStyle->_id;
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir //__________________________________________________________________________________________________
~StyleBag()1293cdf0e10cSrcweir StyleBag::~StyleBag() SAL_THROW( () )
1294cdf0e10cSrcweir {
1295cdf0e10cSrcweir for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
1296cdf0e10cSrcweir {
1297cdf0e10cSrcweir delete _styles[ nPos ];
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir //__________________________________________________________________________________________________
dump(Reference<xml::sax::XExtendedDocumentHandler> const & xOut)1301cdf0e10cSrcweir void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOut )
1302cdf0e10cSrcweir {
1303cdf0e10cSrcweir if (! _styles.empty())
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir OUString aStylesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":styles") );
1306cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1307cdf0e10cSrcweir xOut->startElement( aStylesName, Reference< xml::sax::XAttributeList >() );
1308cdf0e10cSrcweir // export styles
1309cdf0e10cSrcweir for ( size_t nPos = 0; nPos < _styles.size(); ++nPos )
1310cdf0e10cSrcweir {
1311cdf0e10cSrcweir Reference< xml::sax::XAttributeList > xAttr( _styles[ nPos ]->createElement() );
1312cdf0e10cSrcweir static_cast< ElementDescriptor * >( xAttr.get() )->dump( xOut.get() );
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1315cdf0e10cSrcweir xOut->endElement( aStylesName );
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir }
1318cdf0e10cSrcweir
1319cdf0e10cSrcweir //##################################################################################################
1320cdf0e10cSrcweir
1321cdf0e10cSrcweir //==================================================================================================
exportDialogModel(Reference<xml::sax::XExtendedDocumentHandler> const & xOut,Reference<container::XNameContainer> const & xDialogModel)1322cdf0e10cSrcweir void SAL_CALL exportDialogModel(
1323cdf0e10cSrcweir Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
1324cdf0e10cSrcweir Reference< container::XNameContainer > const & xDialogModel )
1325cdf0e10cSrcweir SAL_THROW( (Exception) )
1326cdf0e10cSrcweir {
1327cdf0e10cSrcweir StyleBag all_styles;
1328cdf0e10cSrcweir ::std::vector< Reference< xml::sax::XAttributeList > > all_elements;
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir // read out all props
1331cdf0e10cSrcweir
1332cdf0e10cSrcweir Sequence< OUString > aElements( xDialogModel->getElementNames() );
1333cdf0e10cSrcweir OUString const * pElements = aElements.getConstArray();
1334cdf0e10cSrcweir
1335cdf0e10cSrcweir ElementDescriptor * pRadioGroup = 0;
1336cdf0e10cSrcweir
1337cdf0e10cSrcweir sal_Int32 nPos;
1338cdf0e10cSrcweir for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
1341cdf0e10cSrcweir Reference< beans::XPropertySet > xProps;
1342cdf0e10cSrcweir OSL_VERIFY( aControlModel >>= xProps );
1343cdf0e10cSrcweir if (! xProps.is())
1344cdf0e10cSrcweir continue;
1345cdf0e10cSrcweir Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1346cdf0e10cSrcweir OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1347cdf0e10cSrcweir if (! xPropState.is())
1348cdf0e10cSrcweir continue;
1349cdf0e10cSrcweir Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1350cdf0e10cSrcweir OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1351cdf0e10cSrcweir if (! xServiceInfo.is())
1352cdf0e10cSrcweir continue;
1353cdf0e10cSrcweir
1354cdf0e10cSrcweir ElementDescriptor * pElem = 0;
1355cdf0e10cSrcweir Reference< xml::sax::XAttributeList > xElem;
1356cdf0e10cSrcweir
1357cdf0e10cSrcweir // group up radio buttons
1358cdf0e10cSrcweir if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir if (! pRadioGroup) // open radiogroup
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir pRadioGroup = new ElementDescriptor(
1363cdf0e10cSrcweir xProps, xPropState,
1364cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ) );
1365cdf0e10cSrcweir all_elements.push_back( pRadioGroup );
1366cdf0e10cSrcweir }
1367cdf0e10cSrcweir
1368cdf0e10cSrcweir pElem = new ElementDescriptor(
1369cdf0e10cSrcweir xProps, xPropState,
1370cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
1371cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1372cdf0e10cSrcweir pElem->readRadioButtonModel( &all_styles );
1373cdf0e10cSrcweir pRadioGroup->addSubElement( xElem );
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir else // no radio
1376cdf0e10cSrcweir {
1377cdf0e10cSrcweir pRadioGroup = 0; // close radiogroup
1378cdf0e10cSrcweir
1379cdf0e10cSrcweir if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
1380cdf0e10cSrcweir {
1381cdf0e10cSrcweir pElem = new ElementDescriptor(
1382cdf0e10cSrcweir xProps, xPropState,
1383cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ) );
1384cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1385cdf0e10cSrcweir pElem->readButtonModel( &all_styles );
1386cdf0e10cSrcweir }
1387cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
1388cdf0e10cSrcweir {
1389cdf0e10cSrcweir pElem = new ElementDescriptor(
1390cdf0e10cSrcweir xProps, xPropState,
1391cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ) );
1392cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1393cdf0e10cSrcweir pElem->readCheckBoxModel( &all_styles );
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
1396cdf0e10cSrcweir {
1397cdf0e10cSrcweir pElem = new ElementDescriptor(
1398cdf0e10cSrcweir xProps, xPropState,
1399cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
1400cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1401cdf0e10cSrcweir pElem->readComboBoxModel( &all_styles );
1402cdf0e10cSrcweir }
1403cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
1404cdf0e10cSrcweir {
1405cdf0e10cSrcweir pElem = new ElementDescriptor(
1406cdf0e10cSrcweir xProps, xPropState,
1407cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
1408cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1409cdf0e10cSrcweir pElem->readListBoxModel( &all_styles );
1410cdf0e10cSrcweir }
1411cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
1412cdf0e10cSrcweir {
1413cdf0e10cSrcweir pElem = new ElementDescriptor(
1414cdf0e10cSrcweir xProps, xPropState,
1415cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ) );
1416cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1417cdf0e10cSrcweir pElem->readGroupBoxModel( &all_styles );
1418cdf0e10cSrcweir }
1419cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir pElem = new ElementDescriptor(
1422cdf0e10cSrcweir xProps, xPropState,
1423cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
1424cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1425cdf0e10cSrcweir pElem->readFixedTextModel( &all_styles );
1426cdf0e10cSrcweir }
1427cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
1428cdf0e10cSrcweir {
1429cdf0e10cSrcweir pElem = new ElementDescriptor(
1430cdf0e10cSrcweir xProps, xPropState,
1431cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ) );
1432cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1433cdf0e10cSrcweir pElem->readEditModel( &all_styles );
1434cdf0e10cSrcweir }
1435cdf0e10cSrcweir // FixedHyperLink
1436cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir pElem = new ElementDescriptor(
1439cdf0e10cSrcweir xProps, xPropState,
1440cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ) );
1441cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1442cdf0e10cSrcweir pElem->readFixedHyperLinkModel( &all_styles );
1443cdf0e10cSrcweir }
1444cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
1445cdf0e10cSrcweir {
1446cdf0e10cSrcweir pElem = new ElementDescriptor(
1447cdf0e10cSrcweir xProps, xPropState,
1448cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
1449cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1450cdf0e10cSrcweir pElem->readImageControlModel( &all_styles );
1451cdf0e10cSrcweir }
1452cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
1453cdf0e10cSrcweir {
1454cdf0e10cSrcweir pElem = new ElementDescriptor(
1455cdf0e10cSrcweir xProps, xPropState,
1456cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ) );
1457cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1458cdf0e10cSrcweir pElem->readFileControlModel( &all_styles );
1459cdf0e10cSrcweir }
1460cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
1461cdf0e10cSrcweir {
1462cdf0e10cSrcweir pElem = new ElementDescriptor(
1463cdf0e10cSrcweir xProps, xPropState,
1464cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ) );
1465cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1466cdf0e10cSrcweir pElem->readTreeControlModel( &all_styles );
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
1469cdf0e10cSrcweir {
1470cdf0e10cSrcweir pElem = new ElementDescriptor(
1471cdf0e10cSrcweir xProps, xPropState,
1472cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ) );
1473cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1474cdf0e10cSrcweir pElem->readCurrencyFieldModel( &all_styles );
1475cdf0e10cSrcweir }
1476cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir pElem = new ElementDescriptor(
1479cdf0e10cSrcweir xProps, xPropState,
1480cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ) );
1481cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1482cdf0e10cSrcweir pElem->readDateFieldModel( &all_styles );
1483cdf0e10cSrcweir }
1484cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
1485cdf0e10cSrcweir {
1486cdf0e10cSrcweir pElem = new ElementDescriptor(
1487cdf0e10cSrcweir xProps, xPropState,
1488cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ) );
1489cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1490cdf0e10cSrcweir pElem->readNumericFieldModel( &all_styles );
1491cdf0e10cSrcweir }
1492cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
1493cdf0e10cSrcweir {
1494cdf0e10cSrcweir pElem = new ElementDescriptor(
1495cdf0e10cSrcweir xProps, xPropState,
1496cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) );
1497cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1498cdf0e10cSrcweir pElem->readTimeFieldModel( &all_styles );
1499cdf0e10cSrcweir }
1500cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
1501cdf0e10cSrcweir {
1502cdf0e10cSrcweir pElem = new ElementDescriptor(
1503cdf0e10cSrcweir xProps, xPropState,
1504cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ) );
1505cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1506cdf0e10cSrcweir pElem->readPatternFieldModel( &all_styles );
1507cdf0e10cSrcweir }
1508cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
1509cdf0e10cSrcweir {
1510cdf0e10cSrcweir pElem = new ElementDescriptor(
1511cdf0e10cSrcweir xProps, xPropState,
1512cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) );
1513cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1514cdf0e10cSrcweir pElem->readFormattedFieldModel( &all_styles );
1515cdf0e10cSrcweir }
1516cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir pElem = new ElementDescriptor(
1519cdf0e10cSrcweir xProps, xPropState,
1520cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ) );
1521cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1522cdf0e10cSrcweir pElem->readFixedLineModel( &all_styles );
1523cdf0e10cSrcweir }
1524cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir pElem = new ElementDescriptor(
1527cdf0e10cSrcweir xProps, xPropState,
1528cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
1529cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1530cdf0e10cSrcweir pElem->readScrollBarModel( &all_styles );
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
1533cdf0e10cSrcweir {
1534cdf0e10cSrcweir pElem = new ElementDescriptor(
1535cdf0e10cSrcweir xProps, xPropState,
1536cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ) );
1537cdf0e10cSrcweir xElem = static_cast< xml::sax::XAttributeList * >( pElem );
1538cdf0e10cSrcweir pElem->readProgressBarModel( &all_styles );
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir //
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir OSL_ASSERT( xElem.is() );
1543cdf0e10cSrcweir if (xElem.is())
1544cdf0e10cSrcweir {
1545cdf0e10cSrcweir all_elements.push_back( xElem );
1546cdf0e10cSrcweir }
1547cdf0e10cSrcweir else
1548cdf0e10cSrcweir {
1549cdf0e10cSrcweir OSL_ENSURE( sal_False, "unknown control type!" );
1550cdf0e10cSrcweir continue;
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir }
1553cdf0e10cSrcweir }
1554cdf0e10cSrcweir
1555cdf0e10cSrcweir xOut->startDocument();
1556cdf0e10cSrcweir
1557cdf0e10cSrcweir OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
1558cdf0e10cSrcweir "<!DOCTYPE dlg:window PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
1559cdf0e10cSrcweir " \"dialog.dtd\">" ) );
1560cdf0e10cSrcweir xOut->unknown( aDocTypeStr );
1561cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1562cdf0e10cSrcweir
1563cdf0e10cSrcweir // window
1564cdf0e10cSrcweir Reference< beans::XPropertySet > xProps( xDialogModel, UNO_QUERY );
1565cdf0e10cSrcweir OSL_ASSERT( xProps.is() );
1566cdf0e10cSrcweir Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1567cdf0e10cSrcweir OSL_ASSERT( xPropState.is() );
1568cdf0e10cSrcweir
1569cdf0e10cSrcweir OUString aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":window") );
1570cdf0e10cSrcweir ElementDescriptor * pWindow = new ElementDescriptor( xProps, xPropState, aWindowName );
1571cdf0e10cSrcweir Reference< xml::sax::XAttributeList > xWindow( pWindow );
1572cdf0e10cSrcweir pWindow->readDialogModel( &all_styles );
1573cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1574cdf0e10cSrcweir xOut->startElement( aWindowName, xWindow );
1575cdf0e10cSrcweir // dump out events
1576cdf0e10cSrcweir pWindow->dumpSubElements( xOut.get() );
1577cdf0e10cSrcweir // dump out stylebag
1578cdf0e10cSrcweir all_styles.dump( xOut );
1579cdf0e10cSrcweir
1580cdf0e10cSrcweir if (! all_elements.empty())
1581cdf0e10cSrcweir {
1582cdf0e10cSrcweir // open up bulletinboard
1583cdf0e10cSrcweir OUString aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") );
1584cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1585cdf0e10cSrcweir xOut->startElement( aBBoardName, Reference< xml::sax::XAttributeList >() );
1586cdf0e10cSrcweir
1587cdf0e10cSrcweir // export control elements
1588cdf0e10cSrcweir for ( std::size_t n = 0; n < all_elements.size(); ++n )
1589cdf0e10cSrcweir {
1590cdf0e10cSrcweir ElementDescriptor * pElem = static_cast< ElementDescriptor * >( all_elements[ n ].get() );
1591cdf0e10cSrcweir pElem->dump( xOut.get() );
1592cdf0e10cSrcweir }
1593cdf0e10cSrcweir
1594cdf0e10cSrcweir // end bulletinboard
1595cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1596cdf0e10cSrcweir xOut->endElement( aBBoardName );
1597cdf0e10cSrcweir }
1598cdf0e10cSrcweir
1599cdf0e10cSrcweir // end window
1600cdf0e10cSrcweir xOut->ignorableWhitespace( OUString() );
1601cdf0e10cSrcweir xOut->endElement( aWindowName );
1602cdf0e10cSrcweir
1603cdf0e10cSrcweir xOut->endDocument();
1604cdf0e10cSrcweir }
1605cdf0e10cSrcweir
1606cdf0e10cSrcweir }
1607