Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <hintids.hxx>
30 : : #include <comphelper/string.hxx>
31 : : #include <vcl/svapp.hxx>
32 : : #include <vcl/wrkwin.hxx>
33 : :
34 : : #include <toolkit/helper/vclunohelper.hxx>
35 : : #include <svtools/htmlkywd.hxx>
36 : : #include <svtools/htmltokn.h>
37 : : #include <svl/urihelper.hxx>
38 : : #include <sfx2/request.hxx>
39 : : #include <sfx2/docfile.hxx>
40 : : #include <sfx2/viewfrm.hxx>
41 : : #include <editeng/lrspitem.hxx>
42 : : #include <editeng/ulspitem.hxx>
43 : : #include <editeng/brshitem.hxx>
44 : : #include <editeng/colritem.hxx>
45 : : #include <editeng/fontitem.hxx>
46 : : #include <editeng/fhgtitem.hxx>
47 : : #include <editeng/wghtitem.hxx>
48 : : #include <editeng/postitem.hxx>
49 : : #include <editeng/udlnitem.hxx>
50 : : #include <editeng/crsditem.hxx>
51 : : #include <svx/svdouno.hxx>
52 : : #include <svx/fmglob.hxx>
53 : : #include <com/sun/star/form/ListSourceType.hpp>
54 : : #include <com/sun/star/form/FormButtonType.hpp>
55 : : #include <com/sun/star/form/FormSubmitEncoding.hpp>
56 : : #include <com/sun/star/form/FormSubmitMethod.hpp>
57 : : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
58 : : #include <com/sun/star/script/XEventAttacherManager.hpp>
59 : : #include <com/sun/star/text/WrapTextMode.hpp>
60 : : #include <com/sun/star/text/HoriOrientation.hpp>
61 : : #include <com/sun/star/text/VertOrientation.hpp>
62 : : #include <com/sun/star/text/TextContentAnchorType.hpp>
63 : : #include <com/sun/star/container/XIndexContainer.hpp>
64 : : #include <com/sun/star/drawing/XControlShape.hpp>
65 : : #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
66 : : #include <com/sun/star/awt/XLayoutConstrains.hpp>
67 : : #include <com/sun/star/awt/XImageConsumer.hpp>
68 : : #include <com/sun/star/awt/ImageStatus.hpp>
69 : : #include <com/sun/star/form/XImageProducerSupplier.hpp>
70 : : #include <com/sun/star/form/XForm.hpp>
71 : : #include <doc.hxx>
72 : : #include <pam.hxx>
73 : : #include <swtable.hxx>
74 : : #include <fmtanchr.hxx>
75 : : #include <htmltbl.hxx>
76 : : #include <docsh.hxx>
77 : : #include <viewsh.hxx>
78 : : #include <unodraw.hxx>
79 : : #include <unotextrange.hxx>
80 : : #include "dcontact.hxx"
81 : :
82 : : #include "swcss1.hxx"
83 : : #include "swhtml.hxx"
84 : : #include "htmlform.hxx"
85 : :
86 : :
87 : : using namespace ::com::sun::star;
88 : : using namespace ::com::sun::star::uno;
89 : : using namespace ::com::sun::star::lang;
90 : : using namespace ::com::sun::star::form;
91 : : using ::rtl::OUString;
92 : :
93 : : const sal_uInt16 TABINDEX_MIN = 0;
94 : : const sal_uInt16 TABINDEX_MAX = 32767;
95 : :
96 : : static HTMLOptionEnum aHTMLFormMethodTable[] =
97 : : {
98 : : { OOO_STRING_SVTOOLS_HTML_METHOD_get, FormSubmitMethod_GET },
99 : : { OOO_STRING_SVTOOLS_HTML_METHOD_post, FormSubmitMethod_POST },
100 : : { 0, 0 }
101 : : };
102 : :
103 : : static HTMLOptionEnum aHTMLFormEncTypeTable[] =
104 : : {
105 : : { OOO_STRING_SVTOOLS_HTML_ET_url, FormSubmitEncoding_URL },
106 : : { OOO_STRING_SVTOOLS_HTML_ET_multipart, FormSubmitEncoding_MULTIPART },
107 : : { OOO_STRING_SVTOOLS_HTML_ET_text, FormSubmitEncoding_TEXT },
108 : : { 0, 0 }
109 : : };
110 : :
111 : : enum HTMLWordWrapMode { HTML_WM_OFF, HTML_WM_HARD, HTML_WM_SOFT };
112 : :
113 : : static HTMLOptionEnum aHTMLTextAreaWrapTable[] =
114 : : {
115 : : { OOO_STRING_SVTOOLS_HTML_WW_off, HTML_WM_OFF },
116 : : { OOO_STRING_SVTOOLS_HTML_WW_hard, HTML_WM_HARD },
117 : : { OOO_STRING_SVTOOLS_HTML_WW_soft, HTML_WM_SOFT },
118 : : { OOO_STRING_SVTOOLS_HTML_WW_physical,HTML_WM_HARD },
119 : : { OOO_STRING_SVTOOLS_HTML_WW_virtual, HTML_WM_SOFT },
120 : : { 0, 0 }
121 : : };
122 : :
123 : : HTMLEventType aEventTypeTable[] =
124 : : {
125 : : HTML_ET_ONSUBMITFORM,
126 : : HTML_ET_ONRESETFORM,
127 : : HTML_ET_ONGETFOCUS,
128 : : HTML_ET_ONLOSEFOCUS,
129 : : HTML_ET_ONCLICK,
130 : : HTML_ET_ONCLICK_ITEM,
131 : : HTML_ET_ONCHANGE,
132 : : HTML_ET_ONSELECT,
133 : : HTML_ET_END
134 : : };
135 : :
136 : : const sal_Char * aEventListenerTable[] =
137 : : {
138 : : "XSubmitListener",
139 : : "XResetListener",
140 : : "XFocusListener",
141 : : "XFocusListener",
142 : : "XApproveActionListener",
143 : : "XItemListener",
144 : : "XChangeListener",
145 : : ""
146 : : };
147 : :
148 : : const sal_Char * aEventMethodTable[] =
149 : : {
150 : : "approveSubmit",
151 : : "approveReset",
152 : : "focusGained",
153 : : "focusLost",
154 : : "approveAction",
155 : : "itemStateChanged",
156 : : "changed",
157 : : ""
158 : : };
159 : :
160 : : const sal_Char * aEventSDOptionTable[] =
161 : : {
162 : : OOO_STRING_SVTOOLS_HTML_O_SDonsubmit,
163 : : OOO_STRING_SVTOOLS_HTML_O_SDonreset,
164 : : OOO_STRING_SVTOOLS_HTML_O_SDonfocus,
165 : : OOO_STRING_SVTOOLS_HTML_O_SDonblur,
166 : : OOO_STRING_SVTOOLS_HTML_O_SDonclick,
167 : : OOO_STRING_SVTOOLS_HTML_O_SDonclick,
168 : : OOO_STRING_SVTOOLS_HTML_O_SDonchange,
169 : : 0
170 : : };
171 : :
172 : : const sal_Char * aEventOptionTable[] =
173 : : {
174 : : OOO_STRING_SVTOOLS_HTML_O_onsubmit,
175 : : OOO_STRING_SVTOOLS_HTML_O_onreset,
176 : : OOO_STRING_SVTOOLS_HTML_O_onfocus,
177 : : OOO_STRING_SVTOOLS_HTML_O_onblur,
178 : : OOO_STRING_SVTOOLS_HTML_O_onclick,
179 : : OOO_STRING_SVTOOLS_HTML_O_onclick,
180 : : OOO_STRING_SVTOOLS_HTML_O_onchange,
181 : : 0
182 : : };
183 : :
184 : :
185 [ # # ]: 0 : class SwHTMLForm_Impl
186 : : {
187 : : SwDocShell *pDocSh;
188 : :
189 : : SvKeyValueIterator *pHeaderAttrs;
190 : :
191 : : // gecachte Interfaces
192 : : uno::Reference< drawing::XDrawPage > xDrawPage;
193 : : uno::Reference< container::XIndexContainer > xForms;
194 : : uno::Reference< drawing::XShapes > xShapes;
195 : : uno::Reference< XMultiServiceFactory > xServiceFactory;
196 : :
197 : : uno::Reference< script::XEventAttacherManager > xControlEventManager;
198 : : uno::Reference< script::XEventAttacherManager > xFormEventManager;
199 : :
200 : : // Kontext-Informationen
201 : : uno::Reference< container::XIndexContainer > xFormComps;
202 : : uno::Reference< beans::XPropertySet > xFCompPropSet;
203 : : uno::Reference< drawing::XShape > xShape;
204 : :
205 : : String sText;
206 : : std::vector<String> aStringList;
207 : : std::vector<String> aValueList;
208 : : std::vector<sal_uInt16> aSelectedList;
209 : :
210 : : public:
211 : :
212 : 0 : SwHTMLForm_Impl( SwDocShell *pDSh ) :
213 : : pDocSh( pDSh ),
214 [ # # ][ # # ]: 0 : pHeaderAttrs( pDSh ? pDSh->GetHeaderAttributes() : 0 )
[ # # ][ # # ]
[ # # ]
215 : : {
216 : : OSL_ENSURE( pDocSh, "Keine DocShell, keine Controls" );
217 : 0 : }
218 : :
219 : : const uno::Reference< XMultiServiceFactory >& GetServiceFactory();
220 : : const uno::Reference< drawing::XDrawPage >& GetDrawPage();
221 : : const uno::Reference< drawing::XShapes >& GetShapes();
222 : : const uno::Reference< script::XEventAttacherManager >& GetControlEventManager();
223 : : const uno::Reference< script::XEventAttacherManager >& GetFormEventManager();
224 : : const uno::Reference< container::XIndexContainer >& GetForms();
225 : :
226 : 0 : const uno::Reference< container::XIndexContainer >& GetFormComps() const
227 : : {
228 : 0 : return xFormComps;
229 : : }
230 : :
231 : 0 : void SetFormComps( const uno::Reference< container::XIndexContainer >& r )
232 : : {
233 : 0 : xFormComps = r;
234 : 0 : }
235 : :
236 : 0 : void ReleaseFormComps() { xFormComps = 0; xControlEventManager = 0; }
237 : :
238 : 0 : const uno::Reference< beans::XPropertySet >& GetFCompPropSet() const
239 : : {
240 : 0 : return xFCompPropSet;
241 : : }
242 : :
243 : 0 : void SetFCompPropSet( const uno::Reference< beans::XPropertySet >& r )
244 : : {
245 : 0 : xFCompPropSet = r;
246 : 0 : }
247 : :
248 : 0 : void ReleaseFCompPropSet() { xFCompPropSet = 0; }
249 : :
250 : 0 : const uno::Reference< drawing::XShape >& GetShape() const { return xShape; }
251 : 0 : void SetShape( const uno::Reference< drawing::XShape >& r ) { xShape = r; }
252 : : void ReleaseShape() { xShape = 0; }
253 : :
254 : 0 : String& GetText() { return sText; }
255 : 0 : void EraseText() { sText = aEmptyStr; }
256 : :
257 : 0 : std::vector<String>& GetStringList() { return aStringList; }
258 : 0 : void EraseStringList()
259 : : {
260 : 0 : aStringList.clear();
261 : 0 : }
262 : :
263 : 0 : std::vector<String>& GetValueList() { return aValueList; }
264 : 0 : void EraseValueList()
265 : : {
266 : 0 : aValueList.clear();
267 : 0 : }
268 : :
269 : 0 : std::vector<sal_uInt16>& GetSelectedList() { return aSelectedList; }
270 : 0 : void EraseSelectedList()
271 : : {
272 : 0 : aSelectedList.clear();
273 : 0 : }
274 : :
275 : 0 : SvKeyValueIterator *GetHeaderAttrs() const { return pHeaderAttrs; }
276 : : };
277 : :
278 : 0 : const uno::Reference< XMultiServiceFactory >& SwHTMLForm_Impl::GetServiceFactory()
279 : : {
280 [ # # ][ # # ]: 0 : if( !xServiceFactory.is() && pDocSh )
[ # # ]
281 : : {
282 : : xServiceFactory =
283 : : uno::Reference< XMultiServiceFactory >( pDocSh->GetBaseModel(),
284 [ # # ][ # # ]: 0 : UNO_QUERY );
285 : : OSL_ENSURE( xServiceFactory.is(),
286 : : "XServiceFactory nicht vom Model erhalten" );
287 : : }
288 : 0 : return xServiceFactory;
289 : : }
290 : :
291 : :
292 : 0 : const uno::Reference< drawing::XDrawPage >& SwHTMLForm_Impl::GetDrawPage()
293 : : {
294 [ # # ][ # # ]: 0 : if( !xDrawPage.is() && pDocSh )
[ # # ]
295 : : {
296 : : uno::Reference< drawing::XDrawPageSupplier > xTxtDoc( pDocSh->GetBaseModel(),
297 [ # # ][ # # ]: 0 : UNO_QUERY );
298 : : OSL_ENSURE( xTxtDoc.is(),
299 : : "drawing::XDrawPageSupplier nicht vom XModel erhalten" );
300 [ # # ][ # # ]: 0 : xDrawPage = xTxtDoc->getDrawPage();
[ # # ]
301 : 0 : OSL_ENSURE( xDrawPage.is(), "drawing::XDrawPage nicht erhalten" );
302 : : }
303 : 0 : return xDrawPage;
304 : : }
305 : :
306 : 0 : const uno::Reference< container::XIndexContainer >& SwHTMLForm_Impl::GetForms()
307 : : {
308 [ # # ]: 0 : if( !xForms.is() )
309 : : {
310 : 0 : GetDrawPage();
311 [ # # ]: 0 : if( xDrawPage.is() )
312 : : {
313 [ # # ]: 0 : uno::Reference< XFormsSupplier > xFormsSupplier( xDrawPage, UNO_QUERY );
314 : : OSL_ENSURE( xFormsSupplier.is(),
315 : : "XFormsSupplier nicht vom drawing::XDrawPage erhalten" );
316 : :
317 : : uno::Reference< container::XNameContainer > xNameCont =
318 [ # # ][ # # ]: 0 : xFormsSupplier->getForms();
319 : : xForms = uno::Reference< container::XIndexContainer >( xNameCont,
320 [ # # ][ # # ]: 0 : UNO_QUERY );
321 : :
322 : 0 : OSL_ENSURE( xForms.is(), "XForms nicht erhalten" );
323 : : }
324 : : }
325 : 0 : return xForms;
326 : : }
327 : :
328 : :
329 : 0 : const uno::Reference< drawing::XShapes > & SwHTMLForm_Impl::GetShapes()
330 : : {
331 [ # # ]: 0 : if( !xShapes.is() )
332 : : {
333 : 0 : GetDrawPage();
334 [ # # ]: 0 : if( xDrawPage.is() )
335 : : {
336 [ # # ]: 0 : xShapes = uno::Reference< drawing::XShapes >( xDrawPage, UNO_QUERY );
337 : : OSL_ENSURE( xShapes.is(),
338 : : "XShapes nicht vom drawing::XDrawPage erhalten" );
339 : : }
340 : : }
341 : 0 : return xShapes;
342 : : }
343 : :
344 : : const uno::Reference< script::XEventAttacherManager >&
345 : 0 : SwHTMLForm_Impl::GetControlEventManager()
346 : : {
347 [ # # ][ # # ]: 0 : if( !xControlEventManager.is() && xFormComps.is() )
[ # # ]
348 : : {
349 : : xControlEventManager =
350 [ # # ]: 0 : uno::Reference< script::XEventAttacherManager >( xFormComps, UNO_QUERY );
351 : : OSL_ENSURE( xControlEventManager.is(),
352 : : "uno::Reference< XEventAttacherManager > nicht von xFormComps erhalten" );
353 : : }
354 : :
355 : 0 : return xControlEventManager;
356 : : }
357 : :
358 : : const uno::Reference< script::XEventAttacherManager >&
359 : 0 : SwHTMLForm_Impl::GetFormEventManager()
360 : : {
361 [ # # ]: 0 : if( !xFormEventManager.is() )
362 : : {
363 : 0 : GetForms();
364 [ # # ]: 0 : if( xForms.is() )
365 : : {
366 : : xFormEventManager =
367 [ # # ]: 0 : uno::Reference< script::XEventAttacherManager >( xForms, UNO_QUERY );
368 : : OSL_ENSURE( xFormEventManager.is(),
369 : : "uno::Reference< XEventAttacherManager > nicht von xForms erhalten" );
370 : : }
371 : : }
372 : :
373 : 0 : return xFormEventManager;
374 : : }
375 : :
376 : : class SwHTMLImageWatcher :
377 : : public cppu::WeakImplHelper2< awt::XImageConsumer, XEventListener >
378 : : {
379 : : uno::Reference< drawing::XShape > xShape; // das control
380 : : uno::Reference< XImageProducerSupplier > xSrc;
381 : : uno::Reference< awt::XImageConsumer > xThis; // man selbst
382 : : sal_Bool bSetWidth;
383 : : sal_Bool bSetHeight;
384 : :
385 : : void clear();
386 : :
387 : : public:
388 : :
389 : : SwHTMLImageWatcher( const uno::Reference< drawing::XShape > & rShape,
390 : : sal_Bool bWidth, sal_Bool bHeight );
391 : : ~SwHTMLImageWatcher();
392 : :
393 : : // startProduction darf nicht im Konstruktor gerufen werden, weil
394 : : // wir und ggf. selbst zerstoeren ... Deshlab eine eigene Methode.
395 [ # # ][ # # ]: 0 : void start() { xSrc->getImageProducer()->startProduction(); }
396 : :
397 : : // UNO Anbindung
398 : :
399 : : // XImageConsumer
400 : : virtual void SAL_CALL init( sal_Int32 Width, sal_Int32 Height)
401 : : throw( uno::RuntimeException );
402 : : virtual void SAL_CALL setColorModel(
403 : : sal_Int16 BitCount, const uno::Sequence< sal_Int32 >& RGBAPal,
404 : : sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask,
405 : : sal_Int32 AlphaMask)
406 : : throw( uno::RuntimeException );
407 : : virtual void SAL_CALL setPixelsByBytes(
408 : : sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height,
409 : : const uno::Sequence< sal_Int8 >& ProducerData,
410 : : sal_Int32 Offset, sal_Int32 Scansize)
411 : : throw( uno::RuntimeException );
412 : : virtual void SAL_CALL setPixelsByLongs(
413 : : sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height,
414 : : const uno::Sequence< sal_Int32 >& ProducerData,
415 : : sal_Int32 Offset, sal_Int32 Scansize)
416 : : throw( uno::RuntimeException );
417 : : virtual void SAL_CALL complete(
418 : : sal_Int32 Status,
419 : : const uno::Reference< awt::XImageProducer > & Producer)
420 : : throw( uno::RuntimeException );
421 : :
422 : : // XEventListener
423 : : virtual void SAL_CALL disposing( const EventObject& Source ) throw ( uno::RuntimeException);
424 : : };
425 : :
426 : 0 : SwHTMLImageWatcher::SwHTMLImageWatcher(
427 : : const uno::Reference< drawing::XShape >& rShape,
428 : : sal_Bool bWidth, sal_Bool bHeight ) :
429 : : xShape( rShape ),
430 : 0 : bSetWidth( bWidth ), bSetHeight( bHeight )
431 : : {
432 : : // Die Quelle des Images merken
433 [ # # ]: 0 : uno::Reference< drawing::XControlShape > xControlShape( xShape, UNO_QUERY );
434 : : uno::Reference< awt::XControlModel > xControlModel(
435 [ # # ][ # # ]: 0 : xControlShape->getControl() );
436 [ # # ][ # # ]: 0 : xSrc = uno::Reference< XImageProducerSupplier >( xControlModel, UNO_QUERY );
437 : : OSL_ENSURE( xSrc.is(), "Kein XImageProducerSupplier" );
438 : :
439 : : // Als Event-Listener am Shape anmelden, damit wir es beim dispose
440 : : // loslassen konnen ...
441 [ # # ]: 0 : uno::Reference< XEventListener > xEvtLstnr = (XEventListener *)this;
442 [ # # ]: 0 : uno::Reference< XComponent > xComp( xShape, UNO_QUERY );
443 [ # # ][ # # ]: 0 : xComp->addEventListener( xEvtLstnr );
444 : :
445 : : // Zum Schluss halten wir noch eine Referenz auf uns selbst, damit
446 : : // wir am Leben bleiben ... (eigentlich sollte das nicht neotig sein,
447 : : // weil wir ja noch an diversen anderen Stellen angemeldet sind)
448 [ # # ]: 0 : xThis = (awt::XImageConsumer *)this;
449 : :
450 : : // und am ImageProducer anmelden, um die Groesse zu erehalten ...
451 [ # # ][ # # ]: 0 : xSrc->getImageProducer()->addConsumer( xThis );
[ # # ][ # # ]
452 : 0 : }
453 : :
454 : 0 : SwHTMLImageWatcher::~SwHTMLImageWatcher()
455 : : {
456 [ # # ]: 0 : }
457 : :
458 : 0 : void SwHTMLImageWatcher::clear()
459 : : {
460 : : // Am Shape als Event-Listener abmelden
461 [ # # ]: 0 : uno::Reference< XEventListener > xEvtLstnr = (XEventListener *)this;
462 [ # # ]: 0 : uno::Reference< XComponent > xComp( xShape, UNO_QUERY );
463 [ # # ][ # # ]: 0 : xComp->removeEventListener( xEvtLstnr );
464 : :
465 : : // Am ImageProducer abmelden
466 [ # # ][ # # ]: 0 : uno::Reference<awt::XImageProducer> xProd = xSrc->getImageProducer();
467 [ # # ]: 0 : if( xProd.is() )
468 [ # # ][ # # ]: 0 : xProd->removeConsumer( xThis );
469 : 0 : }
470 : :
471 : : //------------------------------------------------------------------------------
472 : :
473 : 0 : void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height )
474 : : throw( uno::RuntimeException )
475 : : {
476 : : OSL_ENSURE( bSetWidth || bSetHeight,
477 : : "Breite oder Hoehe muss angepasst werden" );
478 : :
479 : : // Wenn keine Breite oder Hoehe angegeben ist, ist das das init von
480 : : // der leeren Grafik, die angezeigt wird, bevor der Stream einer
481 : : // asynchron anzuzeigenden Grfik verfuegbar ist.
482 [ # # ][ # # ]: 0 : if( !Width && !Height )
483 : 0 : return;
484 : :
485 : 0 : awt::Size aNewSz;
486 : 0 : aNewSz.Width = Width;
487 : 0 : aNewSz.Height = Height;
488 [ # # ][ # # ]: 0 : if( Application::GetDefaultDevice() )
489 : : {
490 : 0 : Size aTmp(aNewSz.Width, aNewSz.Height);
491 : : aTmp = Application::GetDefaultDevice()
492 [ # # ][ # # ]: 0 : ->PixelToLogic( aTmp, MapMode( MAP_100TH_MM ) );
[ # # ][ # # ]
493 : 0 : aNewSz.Width = aTmp.Width();
494 : 0 : aNewSz.Height = aTmp.Height();
495 : : }
496 : :
497 [ # # ][ # # ]: 0 : if( !bSetWidth || !bSetHeight )
498 : : {
499 [ # # ][ # # ]: 0 : awt::Size aSz( xShape->getSize() );
500 [ # # ][ # # ]: 0 : if( bSetWidth && aNewSz.Height )
501 : : {
502 : 0 : aNewSz.Width *= aSz.Height;
503 : 0 : aNewSz.Width /= aNewSz.Height;
504 : 0 : aNewSz.Height = aSz.Height;
505 : : }
506 [ # # ][ # # ]: 0 : if( bSetHeight && aNewSz.Width )
507 : : {
508 : 0 : aNewSz.Height *= aSz.Width;
509 : 0 : aNewSz.Height /= aNewSz.Width;
510 : 0 : aNewSz.Width = aSz.Width;
511 : : }
512 : : }
513 [ # # ]: 0 : if( aNewSz.Width < MINFLY )
514 : 0 : aNewSz.Width = MINFLY;
515 [ # # ]: 0 : if( aNewSz.Height < MINFLY )
516 : 0 : aNewSz.Height = MINFLY;
517 : :
518 [ # # ][ # # ]: 0 : xShape->setSize( aNewSz );
519 [ # # ]: 0 : if( bSetWidth )
520 : : {
521 : : // Wenn das Control in einer Tabelle verankert ist, muesen
522 : : // die Tabellen-Spalten neu berechnet werden
523 : :
524 : : // Um an den SwXShape* zu gelangen, brauchen wir ein Interface,
525 : : // das auch vom SwXShape implementiert wird.
526 : :
527 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet( xShape, UNO_QUERY );
528 [ # # ]: 0 : uno::Reference< XUnoTunnel> xTunnel( xPropSet, UNO_QUERY );
529 : 0 : SwXShape *pSwShape = xTunnel.is() ?
530 : : reinterpret_cast< SwXShape * >( sal::static_int_cast< sal_IntPtr>(
531 [ # # ][ # # ]: 0 : xTunnel->getSomething(SwXShape::getUnoTunnelId()) ))
[ # # ]
532 [ # # ]: 0 : : 0;
533 : :
534 : : OSL_ENSURE( pSwShape, "Wo ist das SW-Shape?" );
535 [ # # ]: 0 : if( pSwShape )
536 : : {
537 : 0 : SwFrmFmt *pFrmFmt = pSwShape->GetFrmFmt();
538 : :
539 : 0 : const SwDoc *pDoc = pFrmFmt->GetDoc();
540 [ # # ][ # # ]: 0 : const SwPosition* pAPos = pFrmFmt->GetAnchor().GetCntntAnchor();
541 : : SwNode *pANd;
542 : : SwTableNode *pTblNd;
543 [ # # ][ # # ]: 0 : if( pAPos &&
[ # # ][ # # ]
[ # # ]
544 : 0 : 0 != (pANd = & pAPos->nNode.GetNode()) &&
545 : : 0 != (pTblNd = pANd->FindTableNode()) )
546 : : {
547 : 0 : const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize();
548 : : SwHTMLTableLayout *pLayout =
549 : 0 : pTblNd->GetTable().GetHTMLTableLayout();
550 [ # # ]: 0 : if( pLayout )
551 : : {
552 : : const sal_uInt16 nBrowseWidth =
553 [ # # ]: 0 : pLayout->GetBrowseWidthByTable( *pDoc );
554 : :
555 [ # # ]: 0 : if ( nBrowseWidth )
556 : : {
557 : : pLayout->Resize( nBrowseWidth, sal_True, sal_True,
558 : : bLastGrf ? HTMLTABLE_RESIZE_NOW
559 [ # # ][ # # ]: 0 : : 500 );
560 : : }
561 : : }
562 : : }
563 : 0 : }
564 : : }
565 : :
566 : : // uns selbst abmelden und loeschen
567 [ # # ]: 0 : clear();
568 [ # # ]: 0 : uno::Reference< awt::XImageConsumer > xTmp = (awt::XImageConsumer*)this;
569 [ # # ]: 0 : xThis = 0;
570 : : }
571 : :
572 : 0 : void SwHTMLImageWatcher::setColorModel(
573 : : sal_Int16, const Sequence< sal_Int32 >&, sal_Int32, sal_Int32,
574 : : sal_Int32, sal_Int32 )
575 : : throw( uno::RuntimeException )
576 : : {
577 : 0 : }
578 : :
579 : 0 : void SwHTMLImageWatcher::setPixelsByBytes(
580 : : sal_Int32, sal_Int32, sal_Int32, sal_Int32,
581 : : const Sequence< sal_Int8 >&, sal_Int32, sal_Int32 )
582 : : throw( uno::RuntimeException )
583 : : {
584 : 0 : }
585 : :
586 : :
587 : 0 : void SwHTMLImageWatcher::setPixelsByLongs(
588 : : sal_Int32, sal_Int32, sal_Int32, sal_Int32,
589 : : const Sequence< sal_Int32 >&, sal_Int32, sal_Int32 )
590 : : throw( uno::RuntimeException )
591 : : {
592 : 0 : }
593 : :
594 : :
595 : 0 : void SwHTMLImageWatcher::complete( sal_Int32 Status,
596 : : const uno::Reference< awt::XImageProducer >& )
597 : : throw( uno::RuntimeException )
598 : : {
599 [ # # ][ # # ]: 0 : if( awt::ImageStatus::IMAGESTATUS_ERROR == Status || awt::ImageStatus::IMAGESTATUS_ABORTED == Status )
600 : : {
601 : : // uns selbst abmelden und loeschen
602 [ # # ]: 0 : clear();
603 [ # # ]: 0 : uno::Reference< awt::XImageConsumer > xTmp = (awt::XImageConsumer*)this;
604 [ # # ]: 0 : xThis = 0;
605 : : }
606 : 0 : }
607 : :
608 : 0 : void SwHTMLImageWatcher::disposing(const lang::EventObject& evt) throw ( uno::RuntimeException)
609 : : {
610 : 0 : uno::Reference< awt::XImageConsumer > xTmp;
611 : :
612 : : // Wenn das Shape verschwindet soll muessen wir es loslassen
613 : 0 : uno::Reference< drawing::XShape > xTmpShape;
614 [ # # ][ # # ]: 0 : if( evt.Source == xShape )
615 : : {
616 [ # # ]: 0 : clear();
617 [ # # ]: 0 : xTmp = (awt::XImageConsumer*)this;
618 [ # # ]: 0 : xThis = 0;
619 : 0 : }
620 : 0 : }
621 : :
622 : 2 : void SwHTMLParser::DeleteFormImpl()
623 : : {
624 [ - + ]: 2 : delete pFormImpl;
625 : 2 : pFormImpl = 0;
626 : 2 : }
627 : :
628 : 0 : static void lcl_html_setFixedFontProperty(
629 : : const uno::Reference< beans::XPropertySet >& rPropSet )
630 : : {
631 : : Font aFixedFont( OutputDevice::GetDefaultFont(
632 : : DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US,
633 [ # # ]: 0 : DEFAULTFONT_FLAGS_ONLYONE ) );
634 : 0 : Any aTmp;
635 [ # # ][ # # ]: 0 : aTmp <<= OUString( aFixedFont.GetName() );
[ # # ]
636 [ # # ][ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontName"), aTmp );
637 : :
638 [ # # ][ # # ]: 0 : aTmp <<= OUString( aFixedFont.GetStyleName() );
[ # # ]
639 [ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontStyleName"),
640 [ # # ]: 0 : aTmp );
641 : :
642 [ # # ][ # # ]: 0 : aTmp <<= (sal_Int16) aFixedFont.GetFamily();
643 [ # # ][ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontFamily"), aTmp );
644 : :
645 [ # # ][ # # ]: 0 : aTmp <<= (sal_Int16) aFixedFont.GetCharSet();
646 [ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontCharset"),
647 [ # # ]: 0 : aTmp );
648 : :
649 [ # # ][ # # ]: 0 : aTmp <<= (sal_Int16) aFixedFont.GetPitch();
650 [ # # ][ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontPitch"), aTmp );
651 : :
652 : 0 : float fVal(10.);
653 [ # # ]: 0 : aTmp.setValue( &fVal, ::getCppuType(&fVal ));
654 [ # # ][ # # ]: 0 : rPropSet->setPropertyValue( OUString("FontHeight"), aTmp );
[ # # ]
655 : 0 : }
656 : :
657 [ # # ]: 0 : class SwHTMLFormPendingStackData_Impl: public SwPendingStackData
658 : : {
659 : : uno::Reference< drawing::XShape > xShape;
660 : : Size aTextSz;
661 : : sal_Bool bMinWidth;
662 : : sal_Bool bMinHeight;
663 : :
664 : : public:
665 : :
666 : : SwHTMLFormPendingStackData_Impl(
667 : : const uno::Reference< drawing::XShape > & rShape, const Size& rTextSz,
668 : : sal_Bool bMinW, sal_Bool bMinH ) :
669 : : xShape( rShape ),
670 : : aTextSz( rTextSz ),
671 : : bMinWidth( bMinW ),
672 : : bMinHeight( bMinH )
673 : : {}
674 : :
675 : 0 : const uno::Reference< drawing::XShape >& GetShape() const { return xShape; }
676 : 0 : const Size& GetTextSize() const { return aTextSz; }
677 : 0 : sal_Bool IsMinWidth() const { return bMinWidth; }
678 : 0 : sal_Bool IsMinHeight() const { return bMinHeight; }
679 : : };
680 : :
681 : 0 : void SwHTMLParser::SetPendingControlSize()
682 : : {
683 : : OSL_ENSURE( pPendStack, "Wo ist der Pending Stack?" );
684 : : SwHTMLFormPendingStackData_Impl *pData =
685 : 0 : (SwHTMLFormPendingStackData_Impl *)pPendStack->pData;
686 : :
687 : 0 : SwPendingStack* pTmp = pPendStack->pNext;
688 : 0 : delete pPendStack;
689 : 0 : pPendStack = pTmp;
690 : : OSL_ENSURE( !pPendStack, "Wo kommt der Pending-Stack her?" );
691 : :
692 : 0 : SetControlSize( pData->GetShape(), pData->GetTextSize(),
693 : 0 : pData->IsMinWidth(), pData->IsMinHeight() );
694 [ # # ]: 0 : delete pData;
695 : 0 : }
696 : :
697 : 0 : void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rShape,
698 : : const Size& rTextSz,
699 : : sal_Bool bMinWidth,
700 : : sal_Bool bMinHeight )
701 : : {
702 [ # # ][ # # ]: 0 : if( !rTextSz.Width() && !rTextSz.Height() && !bMinWidth && !bMinHeight )
[ # # ][ # # ]
[ # # ]
703 : 0 : return;
704 : :
705 : : // Um an den SwXShape* zu gelangen, brauchen wir ein Interface,
706 : : // das auch vom SwXShape implementiert wird.
707 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet( rShape, UNO_QUERY );
708 : :
709 : : ViewShell *pVSh;
710 [ # # ]: 0 : pDoc->GetEditShell( &pVSh );
711 [ # # ][ # # ]: 0 : if( !pVSh && !nEventId )
712 : : {
713 : : // If there is no view shell by now and the doc shell is an internal
714 : : // one, no view shell will be created. That for, we have to do that of
715 : : // our own. This happens if a linked section is inserted or refreshed.
716 : 0 : SwDocShell *pDocSh = pDoc->GetDocShell();
717 [ # # ]: 0 : if( pDocSh )
718 : : {
719 [ # # ]: 0 : if ( pDocSh->GetMedium() )
720 : : {
721 : : // if there is no hidden property in the MediaDescriptor it should be removed after loading
722 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False );
[ # # ]
723 [ # # ][ # # ]: 0 : bRemoveHidden = ( pHiddenItem == NULL || !pHiddenItem->GetValue() );
724 : : }
725 : :
726 [ # # ]: 0 : pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, 0 );
727 [ # # ]: 0 : CallStartAction();
728 [ # # ]: 0 : pDoc->GetEditShell( &pVSh );
729 : : }
730 : : }
731 : :
732 [ # # ]: 0 : uno::Reference< XUnoTunnel> xTunnel( xPropSet, UNO_QUERY );
733 : 0 : SwXShape *pSwShape = xTunnel.is() ?
734 : : reinterpret_cast< SwXShape *>( sal::static_int_cast< sal_IntPtr >(
735 [ # # ][ # # ]: 0 : xTunnel->getSomething(SwXShape::getUnoTunnelId()) ))
[ # # ]
736 [ # # ]: 0 : : 0;
737 : :
738 : : OSL_ENSURE( pSwShape, "Wo ist das SW-Shape?" );
739 : :
740 : : // es muss ein Draw-Format sein
741 : 0 : SwFrmFmt *pFrmFmt = pSwShape->GetFrmFmt();
742 : : OSL_ENSURE( RES_DRAWFRMFMT == pFrmFmt->Which(), "Kein DrawFrmFmt" );
743 : :
744 : : // Schauen, ob es ein SdrObject dafuer gibt
745 [ # # ]: 0 : const SdrObject *pObj = pFrmFmt->FindSdrObject();
746 : : OSL_ENSURE( pObj, "SdrObject nicht gefunden" );
747 : : OSL_ENSURE( FmFormInventor == pObj->GetObjInventor(), "falscher Inventor" );
748 : :
749 [ # # ][ # # ]: 0 : const SdrView* pDrawView = pVSh ? pVSh->GetDrawView() : 0;
750 : :
751 [ # # ][ # # ]: 0 : SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
[ # # ][ # # ]
752 : 0 : uno::Reference< awt::XControl > xControl;
753 [ # # ][ # # ]: 0 : if ( pDrawView && pVSh->GetWin() )
[ # # ]
754 [ # # ][ # # ]: 0 : xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() );
755 : :
756 [ # # ][ # # ]: 0 : awt::Size aSz( rShape->getSize() );
757 : 0 : awt::Size aNewSz( 0, 0 );
758 : :
759 : : // #i71248# ensure we got a XControl before apllying corrections
760 [ # # ]: 0 : if(xControl.is())
761 : : {
762 [ # # ][ # # ]: 0 : if( bMinWidth || bMinHeight )
763 : : {
764 [ # # ]: 0 : uno::Reference< awt::XLayoutConstrains > xLC( xControl, UNO_QUERY );
765 [ # # ][ # # ]: 0 : awt::Size aTmpSz( xLC->getPreferredSize() );
766 [ # # ]: 0 : if( bMinWidth )
767 : 0 : aNewSz.Width = aTmpSz.Width;
768 [ # # ]: 0 : if( bMinHeight )
769 : 0 : aNewSz.Height = aTmpSz.Height;
770 : : }
771 [ # # ][ # # ]: 0 : if( rTextSz.Width() || rTextSz.Height())
[ # # ]
772 : : {
773 [ # # ]: 0 : uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, UNO_QUERY );
774 : : OSL_ENSURE( xLC.is(), "kein XTextLayoutConstrains" );
775 [ # # ]: 0 : if( xLC.is() )
776 : : {
777 : 0 : awt::Size aTmpSz( rTextSz.Width(), rTextSz.Height() );
778 [ # # ]: 0 : if( -1 == rTextSz.Width() )
779 : : {
780 : 0 : aTmpSz.Width = 0;
781 : 0 : aTmpSz.Height = nSelectEntryCnt;
782 : : }
783 [ # # ][ # # ]: 0 : aTmpSz = xLC->getMinimumSize( static_cast< sal_Int16 >(aTmpSz.Width), static_cast< sal_Int16 >(aTmpSz.Height) );
784 [ # # ]: 0 : if( rTextSz.Width() )
785 : 0 : aNewSz.Width = aTmpSz.Width;
786 [ # # ]: 0 : if( rTextSz.Height() )
787 : 0 : aNewSz.Height = aTmpSz.Height;
788 : 0 : }
789 : : }
790 : : }
791 : :
792 [ # # ][ # # ]: 0 : if( Application::GetDefaultDevice() )
793 : : {
794 : 0 : Size aTmpSz( aNewSz.Width, aNewSz.Height );
795 : : aTmpSz = Application::GetDefaultDevice()
796 [ # # ][ # # ]: 0 : ->PixelToLogic( aTmpSz, MapMode( MAP_100TH_MM ) );
[ # # ][ # # ]
797 : 0 : aNewSz.Width = aTmpSz.Width();
798 : 0 : aNewSz.Height = aTmpSz.Height();
799 : : }
800 [ # # ]: 0 : if( aNewSz.Width )
801 : : {
802 [ # # ]: 0 : if( aNewSz.Width < MINLAY )
803 : 0 : aNewSz.Width = MINLAY;
804 : 0 : aSz.Width = aNewSz.Width;
805 : : }
806 [ # # ]: 0 : if( aNewSz.Height )
807 : : {
808 [ # # ]: 0 : if( aNewSz.Height < MINLAY )
809 : 0 : aNewSz.Height = MINLAY;
810 : 0 : aSz.Height = aNewSz.Height;
811 : : }
812 : :
813 [ # # ][ # # ]: 0 : rShape->setSize( aSz );
814 : : }
815 : :
816 : 0 : static void lcl_html_setEvents(
817 : : const uno::Reference< script::XEventAttacherManager > & rEvtMn,
818 : : sal_uInt32 nPos, const SvxMacroTableDtor& rMacroTbl,
819 : : const std::vector<String>& rUnoMacroTbl,
820 : : const std::vector<String>& rUnoMacroParamTbl,
821 : : const String& rType )
822 : : {
823 : : // Erstmal muss die Anzahl der Events ermittelt werden ...
824 : 0 : sal_Int32 nEvents = 0;
825 : : sal_uInt16 i;
826 : :
827 [ # # ]: 0 : for( i = 0; HTML_ET_END != aEventTypeTable[i]; i++ )
828 : : {
829 [ # # ]: 0 : const SvxMacro *pMacro = rMacroTbl.Get( aEventTypeTable[i] );
830 : : // Solange nicht alle Events implementiert sind, enthaelt die
831 : : // Tabelle auch Leerstrings!
832 [ # # ][ # # ]: 0 : if( pMacro && aEventListenerTable[i] )
833 : 0 : nEvents++;
834 : : }
835 [ # # ]: 0 : for( i=0; i< rUnoMacroTbl.size(); i++ )
836 : : {
837 [ # # ]: 0 : const String& rStr(rUnoMacroTbl[i]);
838 : 0 : xub_StrLen nIndex = 0;
839 [ # # ][ # # ]: 0 : if( !rStr.GetToken( 0, '-', nIndex ).Len() || STRING_NOTFOUND == nIndex )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
840 : 0 : continue;
841 [ # # ][ # # ]: 0 : if( !rStr.GetToken( 0, '-', nIndex ).Len() || STRING_NOTFOUND == nIndex )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
842 : 0 : continue;
843 [ # # ]: 0 : if( nIndex < rStr.Len() )
844 : 0 : nEvents++;
845 : : }
846 : :
847 [ # # ]: 0 : if( 0==nEvents )
848 : 0 : return;
849 : :
850 [ # # ]: 0 : Sequence<script::ScriptEventDescriptor> aDescs( nEvents );
851 [ # # ]: 0 : script::ScriptEventDescriptor* pDescs = aDescs.getArray();
852 : 0 : sal_Int32 nEvent = 0;
853 : :
854 [ # # ]: 0 : for( i=0; HTML_ET_END != aEventTypeTable[i]; i++ )
855 : : {
856 [ # # ]: 0 : const SvxMacro *pMacro = rMacroTbl.Get( aEventTypeTable[i] );
857 [ # # ][ # # ]: 0 : if( pMacro && aEventListenerTable[i] )
858 : : {
859 : 0 : script::ScriptEventDescriptor& rDesc = pDescs[nEvent++];
860 : : rDesc.ListenerType =
861 : 0 : OUString::createFromAscii(aEventListenerTable[i]);
862 : 0 : rDesc.EventMethod = OUString::createFromAscii(aEventMethodTable[i]);
863 [ # # ]: 0 : rDesc.ScriptType = pMacro->GetLanguage();
864 : 0 : rDesc.ScriptCode = pMacro->GetMacName();
865 : : }
866 : : }
867 : :
868 [ # # ]: 0 : for( i=0; i< rUnoMacroTbl.size(); ++i )
869 : : {
870 [ # # ]: 0 : const String& rStr = rUnoMacroTbl[i];
871 : 0 : xub_StrLen nIndex = 0;
872 [ # # ]: 0 : String sListener( rStr.GetToken( 0, '-', nIndex ) );
873 [ # # ][ # # ]: 0 : if( !sListener.Len() || STRING_NOTFOUND == nIndex )
[ # # ]
874 : 0 : continue;
875 : :
876 [ # # ]: 0 : String sMethod( rStr.GetToken( 0, '-', nIndex ) );
877 [ # # ][ # # ]: 0 : if( !sMethod.Len() || STRING_NOTFOUND == nIndex )
[ # # ]
878 : 0 : continue;
879 : :
880 [ # # ]: 0 : String sCode( rStr.Copy( nIndex ) );
881 [ # # ]: 0 : if( !sCode.Len() )
882 : 0 : continue;
883 : :
884 : 0 : script::ScriptEventDescriptor& rDesc = pDescs[nEvent++];
885 [ # # ]: 0 : rDesc.ListenerType = sListener;
886 [ # # ]: 0 : rDesc.EventMethod = sMethod;
887 [ # # ]: 0 : rDesc.ScriptType = rType;
888 [ # # ]: 0 : rDesc.ScriptCode = sCode;
889 : 0 : rDesc.AddListenerParam = OUString();
890 : :
891 [ # # ]: 0 : if(!rUnoMacroParamTbl.empty())
892 : : {
893 [ # # ]: 0 : String sSearch( sListener );
894 [ # # ]: 0 : sSearch += '-';
895 [ # # ]: 0 : sSearch += sMethod;
896 [ # # ]: 0 : sSearch += '-';
897 : 0 : xub_StrLen nLen = sSearch.Len();
898 [ # # ]: 0 : for(size_t j = 0; j < rUnoMacroParamTbl.size(); ++j)
899 : : {
900 [ # # ]: 0 : const String& rParam = rUnoMacroParamTbl[j];
901 [ # # ]: 0 : if( rParam.CompareTo( sSearch, nLen ) == COMPARE_EQUAL &&
[ # # # # ]
[ # # ]
902 : 0 : rParam.Len() > nLen )
903 : : {
904 [ # # ][ # # ]: 0 : rDesc.AddListenerParam = rParam.Copy(nLen);
[ # # ]
905 : 0 : break;
906 : : }
907 [ # # ]: 0 : }
908 : : }
909 [ # # ][ # # ]: 0 : }
[ # # ][ # # ]
[ # # ][ # # ]
910 [ # # ][ # # ]: 0 : rEvtMn->registerScriptEvents( nPos, aDescs );
[ # # ]
911 : : }
912 : :
913 : 0 : static void lcl_html_getEvents( const String& rOption, const String& rValue,
914 : : std::vector<String>& rUnoMacroTbl,
915 : : std::vector<String>& rUnoMacroParamTbl )
916 : : {
917 [ # # ]: 0 : if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdevent,
918 : 0 : sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1 ) == COMPARE_EQUAL )
919 : : {
920 [ # # ]: 0 : String aEvent(rOption.Copy(sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1));
921 [ # # ]: 0 : aEvent += '-';
922 [ # # ]: 0 : aEvent += rValue;
923 [ # # ][ # # ]: 0 : rUnoMacroTbl.push_back(aEvent);
924 : : }
925 [ # # ]: 0 : else if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdaddparam,
926 : 0 : sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) == COMPARE_EQUAL )
927 : : {
928 [ # # ]: 0 : String aParam(rOption.Copy( sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) );
929 [ # # ]: 0 : aParam += '-';
930 [ # # ]: 0 : aParam += rValue;
931 [ # # ][ # # ]: 0 : rUnoMacroParamTbl.push_back(aParam);
932 : : }
933 : 0 : }
934 : :
935 : 0 : uno::Reference< drawing::XShape > SwHTMLParser::InsertControl(
936 : : const uno::Reference< XFormComponent > & rFComp,
937 : : const uno::Reference< beans::XPropertySet > & rFCompPropSet,
938 : : const Size& rSize, sal_Int16 eVertOri, sal_Int16 eHoriOri,
939 : : SfxItemSet& rCSS1ItemSet, SvxCSS1PropertyInfo& rCSS1PropInfo,
940 : : const SvxMacroTableDtor& rMacroTbl, const std::vector<String>& rUnoMacroTbl,
941 : : const std::vector<String>& rUnoMacroParamTbl, sal_Bool bSetFCompPropSet,
942 : : sal_Bool bHidden )
943 : : {
944 : 0 : uno::Reference< drawing::XShape > xShape;
945 : :
946 : : const uno::Reference< container::XIndexContainer > & rFormComps =
947 : 0 : pFormImpl->GetFormComps();
948 [ # # ]: 0 : Any aAny( &rFComp, ::getCppuType( (uno::Reference< XFormComponent>*)0 ) );
949 [ # # ][ # # ]: 0 : rFormComps->insertByIndex( rFormComps->getCount(), aAny );
[ # # ][ # # ]
950 : :
951 [ # # ]: 0 : if( !bHidden )
952 : : {
953 : 0 : Any aTmp;
954 : 0 : sal_uInt16 nLeftSpace = 0, nRightSpace = 0,
955 : 0 : nUpperSpace = 0, nLowerSpace = 0;
956 : :
957 : : const uno::Reference< XMultiServiceFactory > & rServiceFactory =
958 [ # # ]: 0 : pFormImpl->GetServiceFactory();
959 [ # # ]: 0 : if( !rServiceFactory.is() )
960 : : return xShape;
961 : :
962 : : uno::Reference< XInterface > xCreate =
963 [ # # ]: 0 : rServiceFactory ->createInstance(
964 [ # # ]: 0 : OUString("com.sun.star.drawing.ControlShape"));
965 [ # # ]: 0 : if( !xCreate.is() )
966 : : return xShape;
967 : :
968 [ # # ][ # # ]: 0 : xShape = uno::Reference< drawing::XShape >( xCreate, UNO_QUERY );
969 : :
970 : : OSL_ENSURE( xShape.is(), "XShape nicht erhalten" );
971 : 0 : awt::Size aTmpSz;
972 : 0 : aTmpSz.Width = rSize.Width();
973 : 0 : aTmpSz.Height = rSize.Height();
974 [ # # ][ # # ]: 0 : xShape->setSize( aTmpSz );
975 : :
976 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xShapePropSet( xCreate, UNO_QUERY );
977 : :
978 : : // linken/rechten Rand setzen
979 : : const SfxPoolItem *pItem;
980 [ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_LR_SPACE, sal_True,
981 [ # # ]: 0 : &pItem ) )
982 : : {
983 : : // Ggf. den Erstzeilen-Einzug noch plaetten
984 : 0 : const SvxLRSpaceItem *pLRItem = (const SvxLRSpaceItem *)pItem;
985 [ # # ]: 0 : SvxLRSpaceItem aLRItem( *pLRItem );
986 [ # # ]: 0 : aLRItem.SetTxtFirstLineOfst( 0 );
987 [ # # ]: 0 : if( rCSS1PropInfo.bLeftMargin )
988 : : {
989 [ # # ]: 0 : nLeftSpace = static_cast< sal_uInt16 >(TWIP_TO_MM100( aLRItem.GetLeft() ));
990 : 0 : rCSS1PropInfo.bLeftMargin = sal_False;
991 : : }
992 [ # # ]: 0 : if( rCSS1PropInfo.bRightMargin )
993 : : {
994 [ # # ]: 0 : nRightSpace = static_cast< sal_uInt16 >(TWIP_TO_MM100( aLRItem.GetRight() ));
995 : 0 : rCSS1PropInfo.bRightMargin = sal_False;
996 : : }
997 [ # # ][ # # ]: 0 : rCSS1ItemSet.ClearItem( RES_LR_SPACE );
998 : : }
999 [ # # ][ # # ]: 0 : if( nLeftSpace || nRightSpace )
1000 : : {
1001 : 0 : Any aAny2;
1002 [ # # ]: 0 : aAny2 <<= (sal_Int32)nLeftSpace;
1003 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1004 [ # # ]: 0 : OUString("LeftMargin"), aAny2 );
1005 : :
1006 [ # # ]: 0 : aAny2 <<= (sal_Int32)nRightSpace;
1007 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1008 [ # # ]: 0 : OUString("RightMargin"), aAny2 );
1009 : : }
1010 : :
1011 : : // oberen/unteren Rand setzen
1012 [ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_UL_SPACE, sal_True,
1013 [ # # ]: 0 : &pItem ) )
1014 : : {
1015 : : // Ggf. den Erstzeilen-Einzug noch plaetten
1016 : 0 : const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem;
1017 [ # # ]: 0 : if( rCSS1PropInfo.bTopMargin )
1018 : : {
1019 : 0 : nUpperSpace = TWIP_TO_MM100_UNSIGNED( pULItem->GetUpper() );
1020 : 0 : rCSS1PropInfo.bTopMargin = sal_False;
1021 : : }
1022 [ # # ]: 0 : if( rCSS1PropInfo.bBottomMargin )
1023 : : {
1024 : 0 : nLowerSpace = TWIP_TO_MM100_UNSIGNED( pULItem->GetLower() );
1025 : 0 : rCSS1PropInfo.bBottomMargin = sal_False;
1026 : : }
1027 : :
1028 [ # # ]: 0 : rCSS1ItemSet.ClearItem( RES_UL_SPACE );
1029 : : }
1030 [ # # ][ # # ]: 0 : if( nUpperSpace || nLowerSpace )
1031 : : {
1032 : 0 : uno::Any aAny2;
1033 [ # # ]: 0 : aAny2 <<= (sal_Int32)nUpperSpace;
1034 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1035 [ # # ]: 0 : OUString("TopMargin"), aAny2 );
1036 : :
1037 [ # # ]: 0 : aAny2 <<= (sal_Int32)nLowerSpace;
1038 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1039 [ # # ]: 0 : OUString("BottomMargin"), aAny2 );
1040 : : }
1041 : :
1042 : : uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
1043 [ # # ][ # # ]: 0 : rFCompPropSet->getPropertySetInfo();
1044 : 0 : OUString sPropName = OUString("BackgroundColor");
1045 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_BACKGROUND, sal_True,
[ # # ]
1046 [ # # ]: 0 : &pItem ) &&
1047 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1048 : : {
1049 : 0 : const Color &rColor = ((const SvxBrushItem *)pItem)->GetColor();
1050 : : /// copy color, if color is not "no fill"/"auto fill"
1051 [ # # ]: 0 : if( rColor.GetColor() != COL_TRANSPARENT )
1052 : : {
1053 : : /// copy complete color with transparency
1054 [ # # ]: 0 : aTmp <<= static_cast<sal_Int32>(rColor.GetColor());
1055 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1056 : : }
1057 : :
1058 : : }
1059 : :
1060 : 0 : sPropName = OUString("TextColor");
1061 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_COLOR, sal_True,
[ # # ]
1062 [ # # ]: 0 : &pItem ) &&
1063 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1064 : : {
1065 : 0 : aTmp <<= (sal_Int32)((const SvxColorItem *)pItem)->GetValue()
1066 [ # # ]: 0 : .GetRGBColor();
1067 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1068 : : }
1069 : :
1070 : 0 : sPropName = OUString("FontHeight");
1071 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_FONTSIZE,
[ # # ]
1072 [ # # ]: 0 : sal_True, &pItem ) &&
1073 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1074 : : {
1075 : : float fVal = static_cast< float >(
1076 : 0 : (((SvxFontHeightItem *)pItem)->GetHeight()) / 20.0 );
1077 [ # # ]: 0 : aTmp.setValue( &fVal, ::getCppuType(&fVal));
1078 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1079 : : }
1080 : :
1081 [ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_FONT, sal_True,
1082 [ # # ]: 0 : &pItem ) )
1083 : : {
1084 : 0 : const SvxFontItem *pFontItem = (SvxFontItem *)pItem;
1085 : 0 : sPropName = OUString("FontName");
1086 [ # # ][ # # ]: 0 : if( xPropSetInfo->hasPropertyByName( sPropName ) )
[ # # ]
1087 : : {
1088 [ # # ][ # # ]: 0 : aTmp <<= OUString( pFontItem->GetFamilyName() );
1089 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1090 : : }
1091 : 0 : sPropName = OUString("FontStyleName");
1092 [ # # ][ # # ]: 0 : if( xPropSetInfo->hasPropertyByName( sPropName ) )
[ # # ]
1093 : : {
1094 [ # # ][ # # ]: 0 : aTmp <<= OUString( pFontItem->GetStyleName() );
1095 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1096 : : }
1097 : 0 : sPropName = OUString("FontFamily");
1098 [ # # ][ # # ]: 0 : if( xPropSetInfo->hasPropertyByName( sPropName ) )
[ # # ]
1099 : : {
1100 [ # # ]: 0 : aTmp <<= (sal_Int16)pFontItem->GetFamily() ;
1101 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1102 : : }
1103 : 0 : sPropName = OUString("FontCharset");
1104 [ # # ][ # # ]: 0 : if( xPropSetInfo->hasPropertyByName( sPropName ) )
[ # # ]
1105 : : {
1106 [ # # ]: 0 : aTmp <<= (sal_Int16)pFontItem->GetCharSet() ;
1107 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1108 : : }
1109 : 0 : sPropName = OUString("FontPitch");
1110 [ # # ][ # # ]: 0 : if( xPropSetInfo->hasPropertyByName( sPropName ) )
[ # # ]
1111 : : {
1112 [ # # ]: 0 : aTmp <<= (sal_Int16)pFontItem->GetPitch() ;
1113 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1114 : : }
1115 : : }
1116 : :
1117 : 0 : sPropName = OUString("FontWeight");
1118 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_WEIGHT,
[ # # ]
1119 [ # # ]: 0 : sal_True, &pItem ) &&
1120 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1121 : : {
1122 : : float fVal = VCLUnoHelper::ConvertFontWeight(
1123 [ # # ]: 0 : ((SvxWeightItem *)pItem)->GetWeight() );
1124 [ # # ]: 0 : aTmp.setValue( &fVal, ::getCppuType(&fVal));
1125 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1126 : : }
1127 : :
1128 : 0 : sPropName = OUString("FontSlant");
1129 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_POSTURE,
[ # # ]
1130 [ # # ]: 0 : sal_True, &pItem ) &&
1131 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1132 : : {
1133 [ # # ]: 0 : aTmp <<= (sal_Int16)((SvxPostureItem *)pItem)->GetPosture();
1134 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1135 : : }
1136 : :
1137 : 0 : sPropName = OUString("FontUnderline");
1138 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_UNDERLINE,
[ # # ]
1139 [ # # ]: 0 : sal_True, &pItem ) &&
1140 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1141 : : {
1142 [ # # ]: 0 : aTmp <<= (sal_Int16)((SvxUnderlineItem *)pItem)->GetLineStyle();
1143 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1144 : : }
1145 : :
1146 : 0 : sPropName = OUString("FontStrikeout");
1147 [ # # ][ # # ]: 0 : if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_CHRATR_CROSSEDOUT,
[ # # ]
1148 [ # # ]: 0 : sal_True, &pItem ) &&
1149 [ # # ][ # # ]: 0 : xPropSetInfo->hasPropertyByName( sPropName ) )
1150 : : {
1151 [ # # ]: 0 : aTmp <<= (sal_Int16)((SvxCrossedOutItem *)pItem)->GetStrikeout();
1152 [ # # ][ # # ]: 0 : rFCompPropSet->setPropertyValue( sPropName, aTmp );
1153 : : }
1154 : :
1155 : 0 : uno::Reference< text::XTextRange > xTxtRg;
1156 : 0 : sal_Int16 nAnchorType = text::TextContentAnchorType_AS_CHARACTER;
1157 : 0 : sal_Bool bSetPos = sal_False, bSetSurround = sal_False;
1158 : 0 : sal_Int32 nXPos = 0, nYPos = 0;
1159 : 0 : sal_Int16 nSurround = text::WrapTextMode_NONE;
1160 [ # # ][ # # ]: 0 : if( SVX_CSS1_POS_ABSOLUTE == rCSS1PropInfo.ePosition &&
[ # # ]
1161 : : SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.eLeftType &&
1162 : : SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.eTopType )
1163 : : {
1164 : : const SwStartNode *pFlySttNd =
1165 [ # # ]: 0 : pPam->GetPoint()->nNode.GetNode().FindFlyStartNode();
1166 : :
1167 [ # # ]: 0 : if( pFlySttNd )
1168 : : {
1169 : 0 : nAnchorType = text::TextContentAnchorType_AT_FRAME;
1170 [ # # ]: 0 : SwPaM aPaM( *pFlySttNd );
1171 : :
1172 : 0 : uno::Reference< text::XText > xDummyTxtRef; // unsauber, aber laut OS geht das ...
1173 [ # # ][ # # ]: 0 : xTxtRg = new SwXTextRange( aPaM, xDummyTxtRef );
[ # # ][ # # ]
1174 : : }
1175 : : else
1176 : : {
1177 : 0 : nAnchorType = text::TextContentAnchorType_AT_PAGE;
1178 : : }
1179 [ # # ]: 0 : nXPos = TWIP_TO_MM100( rCSS1PropInfo.nLeft ) + nLeftSpace;
1180 [ # # ]: 0 : nYPos = TWIP_TO_MM100( rCSS1PropInfo.nTop ) + nUpperSpace;
1181 : 0 : bSetPos = sal_True;
1182 : :
1183 : 0 : nSurround = text::WrapTextMode_THROUGHT;
1184 : 0 : bSetSurround = sal_True;
1185 : : }
1186 [ # # ][ # # ]: 0 : else if( SVX_ADJUST_LEFT == rCSS1PropInfo.eFloat ||
1187 : : text::HoriOrientation::LEFT == eHoriOri )
1188 : : {
1189 : 0 : nAnchorType = text::TextContentAnchorType_AT_PARAGRAPH;
1190 : 0 : nXPos = nLeftSpace;
1191 : 0 : nYPos = nUpperSpace;
1192 : 0 : bSetPos = sal_True;
1193 : 0 : nSurround = text::WrapTextMode_RIGHT;
1194 : 0 : bSetSurround = sal_True;
1195 : : }
1196 [ # # ]: 0 : else if( text::VertOrientation::NONE != eVertOri )
1197 : : {
1198 : 0 : sal_Int16 nVertOri = text::VertOrientation::NONE;
1199 [ # # # # : 0 : switch( eVertOri )
# # # # #
# # ]
1200 : : {
1201 : : case text::VertOrientation::NONE:
1202 : 0 : nVertOri = text::VertOrientation::NONE;
1203 : 0 : break;
1204 : : case text::VertOrientation::TOP:
1205 : 0 : nVertOri = text::VertOrientation::TOP;
1206 : 0 : break;
1207 : : case text::VertOrientation::CENTER:
1208 : 0 : nVertOri = text::VertOrientation::CENTER;
1209 : 0 : break;
1210 : : case text::VertOrientation::BOTTOM:
1211 : 0 : nVertOri = text::VertOrientation::BOTTOM;
1212 : 0 : break;
1213 : : case text::VertOrientation::CHAR_TOP:
1214 : 0 : nVertOri = text::VertOrientation::CHAR_TOP;
1215 : 0 : break;
1216 : : case text::VertOrientation::CHAR_CENTER:
1217 : 0 : nVertOri = text::VertOrientation::CHAR_CENTER;
1218 : 0 : break;
1219 : : case text::VertOrientation::CHAR_BOTTOM:
1220 : 0 : nVertOri = text::VertOrientation::CHAR_BOTTOM;
1221 : 0 : break;
1222 : : case text::VertOrientation::LINE_TOP:
1223 : 0 : nVertOri = text::VertOrientation::LINE_TOP;
1224 : 0 : break;
1225 : : case text::VertOrientation::LINE_CENTER:
1226 : 0 : nVertOri = text::VertOrientation::LINE_CENTER;
1227 : 0 : break;
1228 : : case text::VertOrientation::LINE_BOTTOM:
1229 : 0 : nVertOri = text::VertOrientation::LINE_BOTTOM;
1230 : 0 : break;
1231 : : }
1232 [ # # ]: 0 : aTmp <<= (sal_Int16)nVertOri ;
1233 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1234 [ # # ]: 0 : OUString("VertOrient"), aTmp );
1235 : : }
1236 : :
1237 [ # # ]: 0 : aTmp <<= (sal_Int16)nAnchorType ;
1238 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1239 [ # # ]: 0 : OUString("AnchorType"), aTmp );
1240 : :
1241 [ # # ]: 0 : if( text::TextContentAnchorType_AT_PAGE == nAnchorType )
1242 : : {
1243 [ # # ]: 0 : aTmp <<= (sal_Int16) 1 ;
1244 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1245 [ # # ]: 0 : OUString("AnchorPageNo"), aTmp );
1246 : : }
1247 : : else
1248 : : {
1249 [ # # ]: 0 : if( !xTxtRg.is() )
1250 : : {
1251 : 0 : uno::Reference< text::XText > xDummyTxtRef; // unsauber, aber laut OS geht das ...
1252 [ # # ][ # # ]: 0 : xTxtRg = new SwXTextRange( *pPam, xDummyTxtRef );
[ # # ]
1253 : : }
1254 : :
1255 : : aTmp.setValue( &xTxtRg,
1256 [ # # ]: 0 : ::getCppuType((uno::Reference< text::XTextRange>*)0));
1257 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1258 [ # # ]: 0 : OUString("TextRange"), aTmp );
1259 : : }
1260 : :
1261 [ # # ]: 0 : if( bSetPos )
1262 : : {
1263 [ # # ]: 0 : aTmp <<= (sal_Int16)text::HoriOrientation::NONE;
1264 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1265 [ # # ]: 0 : OUString("HoriOrient"), aTmp );
1266 [ # # ]: 0 : aTmp <<= (sal_Int32)nXPos ;
1267 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1268 [ # # ]: 0 : OUString("HoriOrientPosition"), aTmp );
1269 : :
1270 [ # # ]: 0 : aTmp <<= (sal_Int16)text::VertOrientation::NONE;
1271 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1272 [ # # ]: 0 : OUString("VertOrient"), aTmp );
1273 [ # # ]: 0 : aTmp <<= (sal_Int32)nYPos ;
1274 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1275 [ # # ]: 0 : OUString("VertOrientPosition"), aTmp );
1276 : : }
1277 [ # # ]: 0 : if( bSetSurround )
1278 : : {
1279 [ # # ]: 0 : aTmp <<= (sal_Int16)nSurround ;
1280 [ # # ]: 0 : xShapePropSet->setPropertyValue(
1281 [ # # ]: 0 : OUString("Surround"), aTmp );
1282 : : }
1283 : :
1284 [ # # ][ # # ]: 0 : pFormImpl->GetShapes()->add(xShape);
[ # # ]
1285 : :
1286 : : // Das Control-Model am Control-Shape setzen
1287 [ # # ]: 0 : uno::Reference< drawing::XControlShape > xControlShape( xShape, UNO_QUERY );
1288 [ # # ]: 0 : uno::Reference< awt::XControlModel > xControlModel( rFComp, UNO_QUERY );
1289 [ # # ][ # # ]: 0 : xControlShape->setControl( xControlModel );
[ # # ][ # # ]
1290 : : }
1291 : :
1292 : : // Da beim Einfuegen der Controls der Fokus gesetzt wird, werden
1293 : : // auch schon Fokus-Events verschickt. Damit die nicht evtl. schon
1294 : : // vorhendene JavaSCript-Eents rufen, werden die Events nachtraeglich
1295 : : // gesetzt.
1296 [ # # ][ # # ]: 0 : if( !rMacroTbl.empty() || !rUnoMacroTbl.empty() )
[ # # ]
1297 : : {
1298 [ # # ]: 0 : lcl_html_setEvents( pFormImpl->GetControlEventManager(),
1299 [ # # ][ # # ]: 0 : rFormComps->getCount() - 1,
1300 : : rMacroTbl, rUnoMacroTbl, rUnoMacroParamTbl,
1301 [ # # ][ # # ]: 0 : GetScriptTypeString(pFormImpl->GetHeaderAttrs()) );
1302 : : }
1303 : :
1304 [ # # ]: 0 : if( bSetFCompPropSet )
1305 : : {
1306 [ # # ]: 0 : pFormImpl->SetFCompPropSet( rFCompPropSet );
1307 : : }
1308 : :
1309 : 0 : return xShape;
1310 : : }
1311 : :
1312 : 0 : void SwHTMLParser::NewForm( sal_Bool bAppend )
1313 : : {
1314 : : // Gibt es schon eine Form?
1315 [ # # ][ # # ]: 0 : if( pFormImpl && pFormImpl->GetFormComps().is() )
[ # # ]
1316 : : return;
1317 : :
1318 [ # # ]: 0 : if( bAppend )
1319 : : {
1320 [ # # ]: 0 : if( pPam->GetPoint()->nContent.GetIndex() )
1321 [ # # ]: 0 : AppendTxtNode( AM_SPACE );
1322 : : else
1323 [ # # ]: 0 : AddParSpace();
1324 : : }
1325 : :
1326 [ # # ]: 0 : if( !pFormImpl )
1327 [ # # ][ # # ]: 0 : pFormImpl = new SwHTMLForm_Impl( pDoc->GetDocShell() );
1328 : :
1329 [ # # ]: 0 : String aAction( sBaseURL );
1330 [ # # ][ # # ]: 0 : String sName, sTarget;
1331 : 0 : sal_uInt16 nEncType = FormSubmitEncoding_URL;
1332 : 0 : sal_uInt16 nMethod = FormSubmitMethod_GET;
1333 [ # # ]: 0 : SvxMacroTableDtor aMacroTbl;
1334 [ # # ]: 0 : std::vector<String> aUnoMacroTbl;
1335 [ # # ]: 0 : std::vector<String> aUnoMacroParamTbl;
1336 : 0 : SvKeyValueIterator *pHeaderAttrs = pFormImpl->GetHeaderAttrs();
1337 [ # # ]: 0 : ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs );
1338 [ # # ]: 0 : const String& rDfltScriptType = GetScriptTypeString( pHeaderAttrs );
1339 : :
1340 [ # # ]: 0 : const HTMLOptions& rHTMLOptions = GetOptions();
1341 [ # # ]: 0 : for (size_t i = rHTMLOptions.size(); i; )
1342 : : {
1343 [ # # ]: 0 : const HTMLOption& rOption = rHTMLOptions[--i];
1344 : 0 : ScriptType eScriptType2 = eDfltScriptType;
1345 : 0 : sal_uInt16 nEvent = 0;
1346 : 0 : sal_Bool bSetEvent = sal_False;
1347 : :
1348 [ # # # # : 0 : switch( rOption.GetToken() )
# # # # #
# ]
1349 : : {
1350 : : case HTML_O_ACTION:
1351 [ # # ]: 0 : aAction = rOption.GetString();
1352 : 0 : break;
1353 : : case HTML_O_METHOD:
1354 [ # # ]: 0 : nMethod = rOption.GetEnum( aHTMLFormMethodTable, nMethod );
1355 : 0 : break;
1356 : : case HTML_O_ENCTYPE:
1357 [ # # ]: 0 : nEncType = rOption.GetEnum( aHTMLFormEncTypeTable, nEncType );
1358 : 0 : break;
1359 : : case HTML_O_TARGET:
1360 [ # # ]: 0 : sTarget = rOption.GetString();
1361 : 0 : break;
1362 : : case HTML_O_NAME:
1363 [ # # ]: 0 : sName = rOption.GetString();
1364 : 0 : break;
1365 : :
1366 : : case HTML_O_SDONSUBMIT:
1367 : 0 : eScriptType2 = STARBASIC;
1368 : : case HTML_O_ONSUBMIT:
1369 : 0 : nEvent = HTML_ET_ONSUBMITFORM;
1370 : 0 : bSetEvent = sal_True;
1371 : 0 : break;
1372 : :
1373 : : case HTML_O_SDONRESET:
1374 : 0 : eScriptType2 = STARBASIC;
1375 : : case HTML_O_ONRESET:
1376 : 0 : nEvent = HTML_ET_ONRESETFORM;
1377 : 0 : bSetEvent = sal_True;
1378 : 0 : break;
1379 : :
1380 : : default:
1381 : 0 : lcl_html_getEvents( rOption.GetTokenString(),
1382 : 0 : rOption.GetString(),
1383 [ # # ]: 0 : aUnoMacroTbl, aUnoMacroParamTbl );
1384 : 0 : break;
1385 : : }
1386 : :
1387 [ # # ]: 0 : if( bSetEvent )
1388 : : {
1389 [ # # ]: 0 : String sEvent( rOption.GetString() );
1390 [ # # ]: 0 : if( sEvent.Len() )
1391 : : {
1392 [ # # ][ # # ]: 0 : sEvent = convertLineEnd(sEvent, GetSystemLineEnd());
[ # # ]
1393 [ # # ]: 0 : String aScriptType2;
1394 [ # # ]: 0 : if( EXTENDED_STYPE==eScriptType2 )
1395 [ # # ]: 0 : aScriptType2 = rDfltScriptType;
1396 [ # # ][ # # ]: 0 : aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType2, eScriptType2 ) );
[ # # ][ # # ]
[ # # ][ # # ]
1397 [ # # ]: 0 : }
1398 : : }
1399 : : }
1400 : :
1401 : : const uno::Reference< XMultiServiceFactory > & rSrvcMgr =
1402 [ # # ]: 0 : pFormImpl->GetServiceFactory();
1403 [ # # ]: 0 : if( !rSrvcMgr.is() )
1404 : : return;
1405 : :
1406 [ # # ]: 0 : uno::Reference< XInterface > xInt = rSrvcMgr->createInstance(
1407 [ # # ]: 0 : OUString("com.sun.star.form.component.Form") );
1408 [ # # ]: 0 : if( !xInt.is() )
1409 : : return;
1410 : :
1411 [ # # ]: 0 : uno::Reference< XForm > xForm( xInt, UNO_QUERY );
1412 : : OSL_ENSURE( xForm.is(), "keine Form?" );
1413 : :
1414 [ # # ]: 0 : uno::Reference< container::XIndexContainer > xFormComps( xForm, UNO_QUERY );
1415 [ # # ]: 0 : pFormImpl->SetFormComps( xFormComps );
1416 : :
1417 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xFormPropSet( xForm, UNO_QUERY );
1418 : :
1419 : 0 : Any aTmp;
1420 [ # # ][ # # ]: 0 : aTmp <<= OUString(sName);
1421 [ # # ][ # # ]: 0 : xFormPropSet->setPropertyValue( OUString("Name"), aTmp );
1422 : :
1423 [ # # ]: 0 : if( aAction.Len() )
1424 : : {
1425 [ # # ][ # # ]: 0 : aAction = URIHelper::SmartRel2Abs(INetURLObject(sBaseURL), aAction, Link(), false);
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1426 : : }
1427 : : else
1428 : : {
1429 : : // Bei leerer URL das Directory nehmen
1430 [ # # ][ # # ]: 0 : INetURLObject aURLObj( aPathToFile );
1431 [ # # ][ # # ]: 0 : aAction = aURLObj.GetPartBeforeLastName();
[ # # ]
1432 : : }
1433 [ # # ][ # # ]: 0 : aTmp <<= OUString(aAction);
1434 [ # # ]: 0 : xFormPropSet->setPropertyValue( OUString("TargetURL"),
1435 [ # # ]: 0 : aTmp );
1436 : :
1437 : 0 : FormSubmitMethod eMethod = (FormSubmitMethod)nMethod;
1438 [ # # ]: 0 : aTmp.setValue( &eMethod, ::getCppuType((const FormSubmitMethod*)0) );
1439 [ # # ]: 0 : xFormPropSet->setPropertyValue( OUString("SubmitMethod"),
1440 [ # # ]: 0 : aTmp );
1441 : :
1442 : 0 : FormSubmitEncoding eEncType = (FormSubmitEncoding)nEncType;
1443 [ # # ]: 0 : aTmp.setValue( &eEncType, ::getCppuType((const FormSubmitEncoding*)0) );
1444 [ # # ]: 0 : xFormPropSet->setPropertyValue(
1445 [ # # ]: 0 : OUString("SubmitEncoding"), aTmp );
1446 : :
1447 [ # # ]: 0 : if( sTarget.Len() )
1448 : : {
1449 [ # # ][ # # ]: 0 : aTmp <<= OUString(sTarget);
1450 [ # # ]: 0 : xFormPropSet->setPropertyValue(
1451 [ # # ]: 0 : OUString("TargetFrame"), aTmp );
1452 : : }
1453 : :
1454 : : const uno::Reference< container::XIndexContainer > & rForms =
1455 [ # # ]: 0 : pFormImpl->GetForms();
1456 [ # # ]: 0 : Any aAny( &xForm, ::getCppuType((uno::Reference< XForm>*)0) );
1457 [ # # ][ # # ]: 0 : rForms->insertByIndex( rForms->getCount(), aAny );
[ # # ][ # # ]
1458 [ # # ]: 0 : if( !aMacroTbl.empty() )
1459 [ # # ]: 0 : lcl_html_setEvents( pFormImpl->GetFormEventManager(),
1460 [ # # ][ # # ]: 0 : rForms->getCount() - 1,
1461 : : aMacroTbl, aUnoMacroTbl, aUnoMacroParamTbl,
1462 [ # # ][ # # ]: 0 : rDfltScriptType );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1463 : : }
1464 : :
1465 : 0 : void SwHTMLParser::EndForm( sal_Bool bAppend )
1466 : : {
1467 [ # # ][ # # ]: 0 : if( pFormImpl && pFormImpl->GetFormComps().is() )
[ # # ]
1468 : : {
1469 [ # # ]: 0 : if( bAppend )
1470 : : {
1471 [ # # ]: 0 : if( pPam->GetPoint()->nContent.GetIndex() )
1472 : 0 : AppendTxtNode( AM_SPACE );
1473 : : else
1474 : 0 : AddParSpace();
1475 : : }
1476 : :
1477 : 0 : pFormImpl->ReleaseFormComps();
1478 : : }
1479 : 0 : }
1480 : :
1481 : 0 : void SwHTMLParser::InsertInput()
1482 : : {
1483 [ # # ]: 0 : if( pPendStack )
1484 : : {
1485 [ # # ]: 0 : SetPendingControlSize();
1486 : : return;
1487 : : }
1488 : :
1489 [ # # ][ # # ]: 0 : if( !pFormImpl || !pFormImpl->GetFormComps().is() )
[ # # ]
1490 : : return;
1491 : :
1492 [ # # ][ # # ]: 0 : String sImgSrc, aId, aClass, aStyle, sText;
[ # # ][ # # ]
[ # # ]
1493 [ # # ]: 0 : String sName;
1494 [ # # ]: 0 : SvxMacroTableDtor aMacroTbl;
1495 [ # # ]: 0 : std::vector<String> aUnoMacroTbl;
1496 [ # # ]: 0 : std::vector<String> aUnoMacroParamTbl;
1497 : 0 : sal_uInt16 nSize = 0;
1498 : 0 : sal_Int16 nMaxLen = 0;
1499 : 0 : sal_Int16 nChecked = STATE_NOCHECK;
1500 : 0 : sal_Int32 nTabIndex = TABINDEX_MAX + 1;
1501 : 0 : HTMLInputType eType = HTML_IT_TEXT;
1502 : 0 : sal_Bool bDisabled = sal_False, bValue = sal_False;
1503 : 0 : sal_Bool bSetGrfWidth = sal_False, bSetGrfHeight = sal_False;
1504 : 0 : sal_Bool bHidden = sal_False;
1505 : 0 : long nWidth=0, nHeight=0;
1506 : 0 : sal_Int16 eVertOri = text::VertOrientation::TOP;
1507 : 0 : sal_Int16 eHoriOri = text::HoriOrientation::NONE;
1508 : 0 : SvKeyValueIterator *pHeaderAttrs = pFormImpl->GetHeaderAttrs();
1509 [ # # ]: 0 : ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs );
1510 [ # # ]: 0 : const String& rDfltScriptType = GetScriptTypeString( pHeaderAttrs );
1511 : :
1512 : 0 : sal_uInt16 nKeepCRLFToken = HTML_O_VALUE;
1513 [ # # ]: 0 : const HTMLOptions& rHTMLOptions = GetOptions( &nKeepCRLFToken );
1514 [ # # ]: 0 : for (size_t i = rHTMLOptions.size(); i; )
1515 : : {
1516 [ # # ]: 0 : const HTMLOption& rOption = rHTMLOptions[--i];
1517 : 0 : ScriptType eScriptType2 = eDfltScriptType;
1518 : 0 : sal_uInt16 nEvent = 0;
1519 : 0 : sal_Bool bSetEvent = sal_False;
1520 : :
1521 [ # # # # : 0 : switch( rOption.GetToken() )
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
1522 : : {
1523 : : case HTML_O_ID:
1524 [ # # ]: 0 : aId = rOption.GetString();
1525 : 0 : break;
1526 : : case HTML_O_STYLE:
1527 [ # # ]: 0 : aStyle = rOption.GetString();
1528 : 0 : break;
1529 : : case HTML_O_CLASS:
1530 [ # # ]: 0 : aClass = rOption.GetString();
1531 : 0 : break;
1532 : : case HTML_O_TYPE:
1533 [ # # ]: 0 : eType = rOption.GetInputType();
1534 : 0 : break;
1535 : : case HTML_O_NAME:
1536 [ # # ]: 0 : sName = rOption.GetString();
1537 : 0 : break;
1538 : : case HTML_O_VALUE:
1539 [ # # ]: 0 : sText = rOption.GetString();
1540 : 0 : bValue = sal_True;
1541 : 0 : break;
1542 : : case HTML_O_CHECKED:
1543 : 0 : nChecked = STATE_CHECK;
1544 : 0 : break;
1545 : : case HTML_O_DISABLED:
1546 : 0 : bDisabled = sal_True;
1547 : 0 : break;
1548 : : case HTML_O_MAXLENGTH:
1549 [ # # ]: 0 : nMaxLen = (sal_Int16)rOption.GetNumber();
1550 : 0 : break;
1551 : : case HTML_O_SIZE:
1552 [ # # ]: 0 : nSize = (sal_uInt16)rOption.GetNumber();
1553 : 0 : break;
1554 : : case HTML_O_SRC:
1555 [ # # ]: 0 : sImgSrc = rOption.GetString();
1556 : 0 : break;
1557 : : case HTML_O_WIDTH:
1558 : : // erstmal nur als Pixelwerte merken!
1559 [ # # ]: 0 : nWidth = rOption.GetNumber();
1560 : 0 : break;
1561 : : case HTML_O_HEIGHT:
1562 : : // erstmal nur als Pixelwerte merken!
1563 [ # # ]: 0 : nHeight = rOption.GetNumber();
1564 : 0 : break;
1565 : : case HTML_O_ALIGN:
1566 : : eVertOri =
1567 [ # # ]: 0 : rOption.GetEnum( aHTMLImgVAlignTable, eVertOri );
1568 : : eHoriOri =
1569 [ # # ]: 0 : rOption.GetEnum( aHTMLImgHAlignTable, eHoriOri );
1570 : 0 : break;
1571 : : case HTML_O_TABINDEX:
1572 : : // erstmal nur als Pixelwerte merken!
1573 [ # # ]: 0 : nTabIndex = rOption.GetNumber();
1574 : 0 : break;
1575 : :
1576 : : case HTML_O_SDONFOCUS:
1577 : 0 : eScriptType2 = STARBASIC;
1578 : : case HTML_O_ONFOCUS:
1579 : 0 : nEvent = HTML_ET_ONGETFOCUS;
1580 : 0 : bSetEvent = sal_True;
1581 : 0 : break;
1582 : :
1583 : : case HTML_O_SDONBLUR: // eigtl. nur EDIT
1584 : 0 : eScriptType2 = STARBASIC;
1585 : : case HTML_O_ONBLUR:
1586 : 0 : nEvent = HTML_ET_ONLOSEFOCUS;
1587 : 0 : bSetEvent = sal_True;
1588 : 0 : break;
1589 : :
1590 : : case HTML_O_SDONCLICK:
1591 : 0 : eScriptType2 = STARBASIC;
1592 : : case HTML_O_ONCLICK:
1593 : 0 : nEvent = HTML_ET_ONCLICK;
1594 : 0 : bSetEvent = sal_True;
1595 : 0 : break;
1596 : :
1597 : : case HTML_O_SDONCHANGE: // eigtl. nur EDIT
1598 : 0 : eScriptType2 = STARBASIC;
1599 : : case HTML_O_ONCHANGE:
1600 : 0 : nEvent = HTML_ET_ONCHANGE;
1601 : 0 : bSetEvent = sal_True;
1602 : 0 : break;
1603 : :
1604 : : case HTML_O_SDONSELECT: // eigtl. nur EDIT
1605 : 0 : eScriptType2 = STARBASIC;
1606 : : case HTML_O_ONSELECT:
1607 : 0 : nEvent = HTML_ET_ONSELECT;
1608 : 0 : bSetEvent = sal_True;
1609 : 0 : break;
1610 : :
1611 : : default:
1612 : 0 : lcl_html_getEvents( rOption.GetTokenString(),
1613 : 0 : rOption.GetString(),
1614 [ # # ]: 0 : aUnoMacroTbl, aUnoMacroParamTbl );
1615 : 0 : break;
1616 : : }
1617 : :
1618 [ # # ]: 0 : if( bSetEvent )
1619 : : {
1620 [ # # ]: 0 : String sEvent( rOption.GetString() );
1621 [ # # ]: 0 : if( sEvent.Len() )
1622 : : {
1623 [ # # ][ # # ]: 0 : sEvent = convertLineEnd(sEvent, GetSystemLineEnd());
[ # # ]
1624 [ # # ]: 0 : String aScriptType2;
1625 [ # # ]: 0 : if( EXTENDED_STYPE==eScriptType2 )
1626 [ # # ]: 0 : aScriptType2 = rDfltScriptType;
1627 [ # # ][ # # ]: 0 : aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType2, eScriptType2 ) );
[ # # ][ # # ]
[ # # ][ # # ]
1628 [ # # ]: 0 : }
1629 : : }
1630 : : }
1631 : :
1632 [ # # ]: 0 : if( HTML_IT_IMAGE==eType )
1633 : : {
1634 : : // Image-Controls ohne Image-URL werden ignoriert (wie bei MS)
1635 [ # # ]: 0 : if( !sImgSrc.Len() )
1636 : : return;
1637 : : }
1638 : : else
1639 : : {
1640 : : // ALIGN fuer alle Controls auszuwerten ist keine so gute Idee,
1641 : : // solange Absatz-gebundene Controls die Hoehe von Tabellen-Zellen
1642 : : // nicht beeinflussen
1643 : 0 : eVertOri = text::VertOrientation::TOP;
1644 : 0 : eHoriOri = text::HoriOrientation::NONE;
1645 : : }
1646 : :
1647 : : // Defaults entsprechen HTML_IT_TEXT
1648 : 0 : const sal_Char *pType = "TextField";
1649 : 0 : sal_Bool bKeepCRLFInValue = sal_False;
1650 [ # # # # : 0 : switch( eType )
# # # #
# ]
1651 : : {
1652 : : case HTML_IT_CHECKBOX:
1653 : 0 : pType = "CheckBox";
1654 : 0 : bKeepCRLFInValue = sal_True;
1655 : 0 : break;
1656 : :
1657 : : case HTML_IT_RADIO:
1658 : 0 : pType = "RadioButton";
1659 : 0 : bKeepCRLFInValue = sal_True;
1660 : 0 : break;
1661 : :
1662 : : case HTML_IT_PASSWORD:
1663 : 0 : bKeepCRLFInValue = sal_True;
1664 : 0 : break;
1665 : :
1666 : : case HTML_IT_BUTTON:
1667 : 0 : bKeepCRLFInValue = sal_True;
1668 : : case HTML_IT_SUBMIT:
1669 : : case HTML_IT_RESET:
1670 : 0 : pType = "CommandButton";
1671 : 0 : break;
1672 : :
1673 : : case HTML_IT_IMAGE:
1674 : 0 : pType = "ImageButton";
1675 : 0 : break;
1676 : :
1677 : : case HTML_IT_FILE:
1678 : 0 : pType = "FileControl";
1679 : 0 : break;
1680 : :
1681 : : case HTML_IT_HIDDEN:
1682 : 0 : pType = "HiddenControl";
1683 : 0 : bKeepCRLFInValue = sal_True;
1684 : 0 : break;
1685 : : default:
1686 : : ;
1687 : : }
1688 : :
1689 : : // Fuer ein par Controls mussen CR/LF noch aus dem VALUE
1690 : : // geloescht werden.
1691 [ # # ]: 0 : if( !bKeepCRLFInValue )
1692 : : {
1693 [ # # ][ # # ]: 0 : sText = comphelper::string::remove(sText, _CR);
1694 [ # # ][ # # ]: 0 : sText = comphelper::string::remove(sText, _LF);
1695 : : }
1696 : :
1697 : : const uno::Reference< XMultiServiceFactory > & rServiceFactory =
1698 [ # # ]: 0 : pFormImpl->GetServiceFactory();
1699 [ # # ]: 0 : if( !rServiceFactory.is() )
1700 : : return;
1701 : :
1702 : : String sServiceName(
1703 [ # # ]: 0 : OUString("com.sun.star.form.component.") );
1704 [ # # ]: 0 : sServiceName.AppendAscii( pType );
1705 : : uno::Reference< XInterface > xInt =
1706 [ # # ][ # # ]: 0 : rServiceFactory->createInstance( sServiceName );
[ # # ]
1707 [ # # ]: 0 : if( !xInt.is() )
1708 : : return;
1709 : :
1710 [ # # ]: 0 : uno::Reference< XFormComponent > xFComp( xInt, UNO_QUERY );
1711 [ # # ]: 0 : if( !xFComp.is() )
1712 : : return;
1713 : :
1714 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet( xFComp, UNO_QUERY );
1715 : :
1716 : 0 : Any aTmp;
1717 [ # # ][ # # ]: 0 : aTmp <<= OUString(sName);
1718 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("Name"), aTmp );
1719 : :
1720 [ # # ]: 0 : if( HTML_IT_HIDDEN != eType )
1721 : : {
1722 [ # # ][ # # ]: 0 : if( nTabIndex >= TABINDEX_MIN && nTabIndex <= TABINDEX_MAX )
1723 : : {
1724 [ # # ]: 0 : aTmp <<= (sal_Int16) (sal_Int16)nTabIndex ;
1725 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("TabIndex"), aTmp );
1726 : : }
1727 : :
1728 [ # # ]: 0 : if( bDisabled )
1729 : : {
1730 : 0 : sal_Bool bFalse = sal_False;
1731 [ # # ]: 0 : aTmp.setValue(&bFalse, ::getBooleanCppuType() );
1732 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("Enabled"), aTmp );
1733 : : }
1734 : : }
1735 : :
1736 [ # # ][ # # ]: 0 : aTmp <<= OUString(sText);
1737 : :
1738 : 0 : Size aSz( 0, 0 ); // defaults
1739 : 0 : Size aTextSz( 0, 0 ); // Text-Size
1740 : 0 : sal_Bool bMinWidth = sal_False, bMinHeight = sal_False;
1741 : 0 : sal_Bool bUseSize = sal_False;
1742 [ # # # # : 0 : switch( eType )
# # ]
1743 : : {
1744 : : case HTML_IT_CHECKBOX:
1745 : : case HTML_IT_RADIO:
1746 : : {
1747 [ # # ]: 0 : if( !bValue )
1748 [ # # ]: 0 : aTmp <<= OUString( OOO_STRING_SVTOOLS_HTML_on );
1749 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("RefValue"),
1750 [ # # ]: 0 : aTmp );
1751 [ # # ]: 0 : aTmp <<= OUString();
1752 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Label"),
1753 [ # # ]: 0 : aTmp );
1754 : : // Beim RadioButton darf die DefaultChecked-Property
1755 : : // erst gesetzt werden, wenn das Control angelegt und ein
1756 : : // activateTabOrder gerufen wurde, weil es sonst noch zu der
1757 : : // vorhergehenden Gruppe gehoert.
1758 [ # # ]: 0 : if( HTML_IT_CHECKBOX == eType )
1759 : : {
1760 [ # # ]: 0 : aTmp <<= (sal_Int16) nChecked ;
1761 [ # # ]: 0 : xPropSet->setPropertyValue(
1762 [ # # ]: 0 : OUString("DefaultState"), aTmp );
1763 : : }
1764 : :
1765 [ # # ]: 0 : const SvxMacro* pMacro = aMacroTbl.Get( HTML_ET_ONCLICK );
1766 [ # # ]: 0 : if( pMacro )
1767 : : {
1768 [ # # ]: 0 : aMacroTbl.Insert( HTML_ET_ONCLICK_ITEM, *pMacro );
1769 [ # # ]: 0 : aMacroTbl.Erase( HTML_ET_ONCLICK );
1770 : : }
1771 : : // SIZE auszuwerten duerfte hier keinen Sinn machen???
1772 : 0 : bMinWidth = bMinHeight = sal_True;
1773 : : }
1774 : 0 : break;
1775 : :
1776 : : case HTML_IT_IMAGE:
1777 : : {
1778 : : // SIZE = WIDTH
1779 [ # # ]: 0 : aSz.Width() = nSize ? nSize : nWidth;
1780 : 0 : aSz.Width() = nWidth;
1781 : 0 : aSz.Height() = nHeight;
1782 [ # # ][ # # ]: 0 : if( (aSz.Width() || aSz.Height()) && Application::GetDefaultDevice() )
[ # # ][ # # ]
[ # # ]
1783 : : {
1784 : : aSz = Application::GetDefaultDevice()
1785 [ # # ][ # # ]: 0 : ->PixelToLogic( aSz, MapMode( MAP_100TH_MM ) );
[ # # ][ # # ]
1786 : : }
1787 : 0 : FormButtonType eButtonType = FormButtonType_SUBMIT;
1788 : : aTmp.setValue( &eButtonType,
1789 [ # # ]: 0 : ::getCppuType((const FormButtonType*)0));
1790 [ # # ]: 0 : xPropSet->setPropertyValue(
1791 [ # # ]: 0 : OUString("ButtonType"), aTmp );
1792 : :
1793 [ # # ]: 0 : aTmp <<= (sal_Int16) 0 ;
1794 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Border"),
1795 [ # # ]: 0 : aTmp );
1796 : : }
1797 : 0 : break;
1798 : :
1799 : : case HTML_IT_BUTTON:
1800 : : case HTML_IT_SUBMIT:
1801 : : case HTML_IT_RESET:
1802 : : {
1803 : : FormButtonType eButtonType;
1804 [ # # # # ]: 0 : switch( eType )
1805 : : {
1806 : : case HTML_IT_BUTTON:
1807 : 0 : eButtonType = FormButtonType_PUSH;
1808 : 0 : break;
1809 : : case HTML_IT_SUBMIT:
1810 : 0 : eButtonType = FormButtonType_SUBMIT;
1811 [ # # ]: 0 : if( !sText.Len() )
1812 [ # # ]: 0 : sText.AssignAscii( OOO_STRING_SVTOOLS_HTML_IT_submit );
1813 : 0 : break;
1814 : : case HTML_IT_RESET:
1815 : 0 : eButtonType = FormButtonType_RESET;
1816 [ # # ]: 0 : if( !sText.Len() )
1817 [ # # ]: 0 : sText.AssignAscii( OOO_STRING_SVTOOLS_HTML_IT_reset );
1818 : 0 : break;
1819 : : default:
1820 : : ;
1821 : : }
1822 [ # # ][ # # ]: 0 : aTmp <<= OUString(sText);
1823 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Label"),
1824 [ # # ]: 0 : aTmp );
1825 : :
1826 : : aTmp.setValue( &eButtonType,
1827 [ # # ]: 0 : ::getCppuType((const FormButtonType*)0));
1828 [ # # ]: 0 : xPropSet->setPropertyValue(
1829 [ # # ]: 0 : OUString("ButtonType"), aTmp );
1830 : :
1831 : 0 : bMinWidth = bMinHeight = sal_True;
1832 : 0 : bUseSize = sal_True;
1833 : : }
1834 : 0 : break;
1835 : :
1836 : : case HTML_IT_PASSWORD:
1837 : : case HTML_IT_TEXT:
1838 : : case HTML_IT_FILE:
1839 [ # # ]: 0 : if( HTML_IT_FILE != eType )
1840 : : {
1841 : : // Beim File-Control wird der VALUE aus Sicherheitsgruenden ignoriert.
1842 [ # # ]: 0 : xPropSet->setPropertyValue(
1843 [ # # ]: 0 : OUString("DefaultText"), aTmp );
1844 [ # # ]: 0 : if( nMaxLen != 0 )
1845 : : {
1846 [ # # ]: 0 : aTmp <<= (sal_Int16) nMaxLen ;
1847 [ # # ]: 0 : xPropSet->setPropertyValue(
1848 [ # # ]: 0 : OUString("MaxTextLen"), aTmp );
1849 : : }
1850 : : }
1851 : :
1852 [ # # ]: 0 : if( HTML_IT_PASSWORD == eType )
1853 : : {
1854 [ # # ]: 0 : aTmp <<= (sal_Int16)'*' ;
1855 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("EchoChar"),
1856 [ # # ]: 0 : aTmp );
1857 : : }
1858 : :
1859 [ # # ]: 0 : lcl_html_setFixedFontProperty( xPropSet );
1860 : :
1861 [ # # ]: 0 : if( !nSize )
1862 : 0 : nSize = 20;
1863 : 0 : aTextSz.Width() = nSize;
1864 : 0 : bMinHeight = sal_True;
1865 : 0 : break;
1866 : :
1867 : : case HTML_IT_HIDDEN:
1868 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("HiddenValue"),
1869 [ # # ]: 0 : aTmp );
1870 : 0 : bHidden = sal_True;
1871 : 0 : break;
1872 : : default:
1873 : : ;
1874 : : }
1875 : :
1876 [ # # ][ # # ]: 0 : if( bUseSize && nSize>0 )
1877 : : {
1878 [ # # ][ # # ]: 0 : if( Application::GetDefaultDevice() )
1879 : : {
1880 : 0 : Size aNewSz( nSize, 0 );
1881 : : aNewSz = Application::GetDefaultDevice()
1882 [ # # ][ # # ]: 0 : ->PixelToLogic( aNewSz, MapMode( MAP_100TH_MM ) );
[ # # ][ # # ]
1883 : 0 : aSz.Width() = aNewSz.Width();
1884 : : OSL_ENSURE( !aTextSz.Width(), "Text-Breite ist gegeben" );
1885 : 0 : bMinWidth = sal_False;
1886 : : }
1887 : : }
1888 : :
1889 [ # # ][ # # ]: 0 : SfxItemSet aCSS1ItemSet( pDoc->GetAttrPool(), pCSS1Parser->GetWhichMap() );
1890 [ # # ]: 0 : SvxCSS1PropertyInfo aCSS1PropInfo;
1891 [ # # ]: 0 : if( HasStyleOptions( aStyle, aId, aClass ) )
1892 : : {
1893 [ # # ]: 0 : ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo );
1894 [ # # ]: 0 : if( aId.Len() )
1895 [ # # ]: 0 : InsertBookmark( aId );
1896 : : }
1897 : :
1898 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType )
1899 : : {
1900 [ # # ]: 0 : aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth );
1901 : 0 : aTextSz.Width() = 0;
1902 : 0 : bMinWidth = sal_False;
1903 : : }
1904 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType )
1905 : : {
1906 [ # # ]: 0 : aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight );
1907 : 0 : aTextSz.Height() = 0;
1908 : 0 : bMinHeight = sal_False;
1909 : : }
1910 : :
1911 : : // Beim Image-Button bei nicht gegebern Groesse einen sinnvollen Default
1912 : : // setzen
1913 [ # # ]: 0 : if( HTML_IT_IMAGE== eType )
1914 : : {
1915 [ # # ]: 0 : if( !aSz.Width() )
1916 : : {
1917 : 0 : aSz.Width() = HTML_DFLT_IMG_WIDTH;
1918 : 0 : bSetGrfWidth = sal_True;
1919 [ # # ]: 0 : if( pTable != 0 )
1920 [ # # ]: 0 : IncGrfsThatResizeTable();
1921 : : }
1922 [ # # ]: 0 : if( !aSz.Height() )
1923 : : {
1924 : 0 : aSz.Height() = HTML_DFLT_IMG_HEIGHT;
1925 : 0 : bSetGrfHeight = sal_True;
1926 : : }
1927 : : }
1928 [ # # ]: 0 : if( aSz.Width() < MINFLY )
1929 : 0 : aSz.Width() = MINFLY;
1930 [ # # ]: 0 : if( aSz.Height() < MINFLY )
1931 : 0 : aSz.Height() = MINFLY;
1932 : :
1933 : : uno::Reference< drawing::XShape > xShape = InsertControl(
1934 : : xFComp, xPropSet, aSz,
1935 : : eVertOri, eHoriOri,
1936 : : aCSS1ItemSet, aCSS1PropInfo,
1937 : : aMacroTbl, aUnoMacroTbl,
1938 : : aUnoMacroParamTbl, sal_False,
1939 [ # # ]: 0 : bHidden );
1940 [ # # ][ # # ]: 0 : if( aTextSz.Width() || aTextSz.Height() || bMinWidth || bMinHeight )
[ # # ][ # # ]
[ # # ]
1941 : : {
1942 : : OSL_ENSURE( !(bSetGrfWidth || bSetGrfHeight), "Grafikgroesse anpassen???" );
1943 [ # # ]: 0 : SetControlSize( xShape, aTextSz, bMinWidth, bMinHeight );
1944 : : }
1945 : :
1946 [ # # ]: 0 : if( HTML_IT_RADIO == eType )
1947 : : {
1948 [ # # ]: 0 : aTmp <<= (sal_Int16) nChecked ;
1949 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("DefaultState"), aTmp );
1950 : : }
1951 : :
1952 [ # # ]: 0 : if( HTML_IT_IMAGE == eType )
1953 : : {
1954 : : // Die URL erst nach dem Einfuegen setzen, weil sich der
1955 : : // Download der Grafik erst dann am XModel anmelden kann,
1956 : : // wenn das Control eingefuegt ist.
1957 [ # # ][ # # ]: 0 : aTmp <<= OUString( URIHelper::SmartRel2Abs(INetURLObject(sBaseURL), sImgSrc, Link(), false));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1958 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("ImageURL"),
1959 [ # # ]: 0 : aTmp );
1960 : : }
1961 : :
1962 [ # # ][ # # ]: 0 : if( bSetGrfWidth || bSetGrfHeight )
1963 : : {
1964 : : SwHTMLImageWatcher* pWatcher =
1965 [ # # ]: 0 : new SwHTMLImageWatcher( xShape, bSetGrfWidth, bSetGrfHeight );
1966 [ # # ][ # # ]: 0 : uno::Reference< awt::XImageConsumer > xCons = pWatcher;
1967 [ # # ]: 0 : pWatcher->start();
1968 [ # # ][ # # ]: 0 : }
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1969 : : }
1970 : :
1971 : 0 : void SwHTMLParser::NewTextArea()
1972 : : {
1973 [ # # ]: 0 : if( pPendStack )
1974 : : {
1975 [ # # ]: 0 : SetPendingControlSize();
1976 : : return;
1977 : : }
1978 : :
1979 : : OSL_ENSURE( !bTextArea, "TextArea in TextArea???" );
1980 : : OSL_ENSURE( !pFormImpl || !pFormImpl->GetFCompPropSet().is(),
1981 : : "TextArea in Control???" );
1982 : :
1983 [ # # ][ # # ]: 0 : if( !pFormImpl || !pFormImpl->GetFormComps().is() )
[ # # ]
1984 : : {
1985 : : // Spezialbehandlung fuer TextArea auch untem im Parser beenden
1986 : 0 : FinishTextArea();
1987 : : return;
1988 : : }
1989 : :
1990 [ # # ][ # # ]: 0 : String aId, aClass, aStyle;
[ # # ]
1991 [ # # ]: 0 : String sName;
1992 : 0 : sal_Int32 nTabIndex = TABINDEX_MAX + 1;
1993 [ # # ]: 0 : SvxMacroTableDtor aMacroTbl;
1994 [ # # ]: 0 : std::vector<String> aUnoMacroTbl;
1995 [ # # ]: 0 : std::vector<String> aUnoMacroParamTbl;
1996 : 0 : sal_uInt16 nRows = 0, nCols = 0;
1997 : 0 : sal_uInt16 nWrap = HTML_WM_OFF;
1998 : 0 : sal_Bool bDisabled = sal_False;
1999 : 0 : SvKeyValueIterator *pHeaderAttrs = pFormImpl->GetHeaderAttrs();
2000 [ # # ]: 0 : ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs );
2001 [ # # ]: 0 : const String& rDfltScriptType = GetScriptTypeString( pHeaderAttrs );
2002 : :
2003 [ # # ]: 0 : const HTMLOptions& rHTMLOptions = GetOptions();
2004 [ # # ]: 0 : for (size_t i = rHTMLOptions.size(); i; )
2005 : : {
2006 [ # # ]: 0 : const HTMLOption& rOption = rHTMLOptions[--i];
2007 : 0 : ScriptType eScriptType2 = eDfltScriptType;
2008 : 0 : sal_uInt16 nEvent = 0;
2009 : 0 : sal_Bool bSetEvent = sal_False;
2010 : :
2011 [ # # # # : 0 : switch( rOption.GetToken() )
# # # # #
# # # # #
# # # # #
# ]
2012 : : {
2013 : : case HTML_O_ID:
2014 [ # # ]: 0 : aId = rOption.GetString();
2015 : 0 : break;
2016 : : case HTML_O_STYLE:
2017 [ # # ]: 0 : aStyle = rOption.GetString();
2018 : 0 : break;
2019 : : case HTML_O_CLASS:
2020 [ # # ]: 0 : aClass = rOption.GetString();
2021 : 0 : break;
2022 : : case HTML_O_NAME:
2023 [ # # ]: 0 : sName = rOption.GetString();
2024 : 0 : break;
2025 : : case HTML_O_DISABLED:
2026 : 0 : bDisabled = sal_True;
2027 : 0 : break;
2028 : : case HTML_O_ROWS:
2029 [ # # ]: 0 : nRows = (sal_uInt16)rOption.GetNumber();
2030 : 0 : break;
2031 : : case HTML_O_COLS:
2032 [ # # ]: 0 : nCols = (sal_uInt16)rOption.GetNumber();
2033 : 0 : break;
2034 : : case HTML_O_WRAP:
2035 [ # # ]: 0 : nWrap = rOption.GetEnum( aHTMLTextAreaWrapTable, nWrap );
2036 : 0 : break;
2037 : :
2038 : : case HTML_O_TABINDEX:
2039 [ # # ]: 0 : nTabIndex = rOption.GetSNumber();
2040 : 0 : break;
2041 : :
2042 : : case HTML_O_SDONFOCUS:
2043 : 0 : eScriptType2 = STARBASIC;
2044 : : case HTML_O_ONFOCUS:
2045 : 0 : nEvent = HTML_ET_ONGETFOCUS;
2046 : 0 : bSetEvent = sal_True;
2047 : 0 : break;
2048 : :
2049 : : case HTML_O_SDONBLUR:
2050 : 0 : eScriptType2 = STARBASIC;
2051 : : case HTML_O_ONBLUR:
2052 : 0 : nEvent = HTML_ET_ONLOSEFOCUS;
2053 : 0 : bSetEvent = sal_True;
2054 : 0 : break;
2055 : :
2056 : : case HTML_O_SDONCLICK:
2057 : 0 : eScriptType2 = STARBASIC;
2058 : : case HTML_O_ONCLICK:
2059 : 0 : nEvent = HTML_ET_ONCLICK;
2060 : 0 : bSetEvent = sal_True;
2061 : 0 : break;
2062 : :
2063 : : case HTML_O_SDONCHANGE:
2064 : 0 : eScriptType2 = STARBASIC;
2065 : : case HTML_O_ONCHANGE:
2066 : 0 : nEvent = HTML_ET_ONCHANGE;
2067 : 0 : bSetEvent = sal_True;
2068 : 0 : break;
2069 : :
2070 : : case HTML_O_SDONSELECT:
2071 : 0 : eScriptType2 = STARBASIC;
2072 : : case HTML_O_ONSELECT:
2073 : 0 : nEvent = HTML_ET_ONSELECT;
2074 : 0 : bSetEvent = sal_True;
2075 : 0 : break;
2076 : :
2077 : : default:
2078 : 0 : lcl_html_getEvents( rOption.GetTokenString(),
2079 : 0 : rOption.GetString(),
2080 [ # # ]: 0 : aUnoMacroTbl, aUnoMacroParamTbl );
2081 : 0 : break;
2082 : : }
2083 : :
2084 [ # # ]: 0 : if( bSetEvent )
2085 : : {
2086 [ # # ]: 0 : String sEvent( rOption.GetString() );
2087 [ # # ]: 0 : if( sEvent.Len() )
2088 : : {
2089 [ # # ][ # # ]: 0 : sEvent = convertLineEnd(sEvent, GetSystemLineEnd());
[ # # ]
2090 [ # # ]: 0 : if( EXTENDED_STYPE==eScriptType2 )
2091 [ # # ]: 0 : aScriptType = rDfltScriptType;
2092 [ # # ][ # # ]: 0 : aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType, eScriptType2 ) );
[ # # ][ # # ]
[ # # ]
2093 [ # # ]: 0 : }
2094 : : }
2095 : : }
2096 : :
2097 : :
2098 : : const uno::Reference< lang::XMultiServiceFactory > & rSrvcMgr =
2099 [ # # ]: 0 : pFormImpl->GetServiceFactory();
2100 [ # # ]: 0 : if( !rSrvcMgr.is() )
2101 : : {
2102 : 0 : FinishTextArea();
2103 : : return;
2104 : : }
2105 [ # # ]: 0 : uno::Reference< uno::XInterface > xInt = rSrvcMgr->createInstance(
2106 [ # # ]: 0 : OUString("com.sun.star.form.component.TextField") );
2107 [ # # ]: 0 : if( !xInt.is() )
2108 : : {
2109 : 0 : FinishTextArea();
2110 : : return;
2111 : : }
2112 : :
2113 [ # # ]: 0 : uno::Reference< XFormComponent > xFComp( xInt, UNO_QUERY );
2114 : : OSL_ENSURE( xFComp.is(), "keine FormComponent?" );
2115 : :
2116 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet( xFComp, UNO_QUERY );
2117 : :
2118 : 0 : Any aTmp;
2119 [ # # ][ # # ]: 0 : aTmp <<= OUString(sName);
2120 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("Name"), aTmp );
2121 : :
2122 : 0 : sal_Bool bTrue = sal_True;
2123 [ # # ]: 0 : aTmp.setValue( &bTrue, ::getBooleanCppuType() );
2124 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("MultiLine"),
2125 [ # # ]: 0 : aTmp );
2126 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("VScroll"), aTmp );
2127 [ # # ]: 0 : if( HTML_WM_OFF == nWrap )
2128 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("HScroll"),
2129 [ # # ]: 0 : aTmp );
2130 [ # # ]: 0 : if( HTML_WM_HARD == nWrap )
2131 [ # # ]: 0 : xPropSet->setPropertyValue(
2132 [ # # ]: 0 : OUString("HardLineBreaks"), aTmp );
2133 : :
2134 [ # # ][ # # ]: 0 : if( nTabIndex >= TABINDEX_MIN && nTabIndex <= TABINDEX_MAX )
2135 : : {
2136 [ # # ]: 0 : aTmp <<= (sal_Int16)nTabIndex ;
2137 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("TabIndex"),
2138 [ # # ]: 0 : aTmp );
2139 : : }
2140 : :
2141 [ # # ]: 0 : lcl_html_setFixedFontProperty( xPropSet );
2142 : :
2143 [ # # ]: 0 : if( bDisabled )
2144 : : {
2145 : 0 : sal_Bool bFalse = sal_False;
2146 [ # # ]: 0 : aTmp.setValue( &bFalse, ::getBooleanCppuType() );
2147 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Enabled"),
2148 [ # # ]: 0 : aTmp );
2149 : : }
2150 : :
2151 : : OSL_ENSURE( !pFormImpl->GetText().Len(), "Text ist nicht leer!" );
2152 : :
2153 [ # # ]: 0 : if( !nCols )
2154 : 0 : nCols = 20;
2155 [ # # ]: 0 : if( !nRows )
2156 : 0 : nRows = 1;
2157 : :
2158 : 0 : Size aTextSz( nCols, nRows );
2159 : :
2160 [ # # ][ # # ]: 0 : SfxItemSet aCSS1ItemSet( pDoc->GetAttrPool(), pCSS1Parser->GetWhichMap() );
2161 [ # # ]: 0 : SvxCSS1PropertyInfo aCSS1PropInfo;
2162 [ # # ]: 0 : if( HasStyleOptions( aStyle, aId, aClass ) )
2163 : : {
2164 [ # # ]: 0 : ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo );
2165 [ # # ]: 0 : if( aId.Len() )
2166 [ # # ]: 0 : InsertBookmark( aId );
2167 : : }
2168 : :
2169 : 0 : Size aSz( MINFLY, MINFLY );
2170 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType )
2171 : : {
2172 [ # # ]: 0 : aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth );
2173 : 0 : aTextSz.Width() = 0;
2174 : : }
2175 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType )
2176 : : {
2177 [ # # ]: 0 : aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight );
2178 : 0 : aTextSz.Height() = 0;
2179 : : }
2180 [ # # ]: 0 : if( aSz.Width() < MINFLY )
2181 : 0 : aSz.Width() = MINFLY;
2182 [ # # ]: 0 : if( aSz.Height() < MINFLY )
2183 : 0 : aSz.Height() = MINFLY;
2184 : :
2185 : : uno::Reference< drawing::XShape > xShape = InsertControl( xFComp, xPropSet, aSz,
2186 : : text::VertOrientation::TOP, text::HoriOrientation::NONE,
2187 : : aCSS1ItemSet, aCSS1PropInfo,
2188 : : aMacroTbl, aUnoMacroTbl,
2189 [ # # ]: 0 : aUnoMacroParamTbl );
2190 [ # # ][ # # ]: 0 : if( aTextSz.Width() || aTextSz.Height() )
[ # # ]
2191 [ # # ]: 0 : SetControlSize( xShape, aTextSz, sal_False, sal_False );
2192 : :
2193 : : // einen neuen Kontext anlegen
2194 [ # # ][ # # ]: 0 : _HTMLAttrContext *pCntxt = new _HTMLAttrContext( HTML_TEXTAREA_ON );
2195 : :
2196 : : // und PRE/Listing/XMP voruebergehend aussetzen
2197 [ # # ]: 0 : SplitPREListingXMP( pCntxt );
2198 [ # # ]: 0 : PushContext( pCntxt );
2199 : :
2200 : 0 : bTextArea = sal_True;
2201 [ # # ][ # # ]: 0 : bTAIgnoreNewPara = sal_True;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2202 : : }
2203 : :
2204 : 0 : void SwHTMLParser::EndTextArea()
2205 : : {
2206 : : OSL_ENSURE( bTextArea, "keine TextArea oder falscher Typ" );
2207 : : OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
2208 : : "TextArea fehlt" );
2209 : :
2210 : : const uno::Reference< beans::XPropertySet > & rPropSet =
2211 : 0 : pFormImpl->GetFCompPropSet();
2212 : :
2213 : 0 : Any aTmp;
2214 [ # # ][ # # ]: 0 : aTmp <<= OUString(pFormImpl->GetText());
2215 [ # # ]: 0 : rPropSet->setPropertyValue( OUString("DefaultText"),
2216 [ # # ]: 0 : aTmp );
2217 [ # # ]: 0 : pFormImpl->EraseText();
2218 : :
2219 [ # # ]: 0 : pFormImpl->ReleaseFCompPropSet();
2220 : :
2221 : : // den Kontext holen
2222 [ # # ]: 0 : _HTMLAttrContext *pCntxt = PopContext( HTML_TEXTAREA_ON );
2223 [ # # ]: 0 : if( pCntxt )
2224 : : {
2225 : : // und ggf. die Attribute beenden
2226 [ # # ]: 0 : EndContext( pCntxt );
2227 [ # # ][ # # ]: 0 : delete pCntxt;
2228 : : }
2229 : :
2230 : 0 : bTextArea = sal_False;
2231 : 0 : }
2232 : :
2233 : :
2234 : 0 : void SwHTMLParser::InsertTextAreaText( sal_uInt16 nToken )
2235 : : {
2236 : : OSL_ENSURE( bTextArea, "keine TextArea oder falscher Typ" );
2237 : : OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
2238 : : "TextArea fehlt" );
2239 : :
2240 : 0 : String& rText = pFormImpl->GetText();
2241 [ # # # ]: 0 : switch( nToken)
2242 : : {
2243 : : case HTML_TEXTTOKEN:
2244 : 0 : rText += aToken;
2245 : 0 : break;
2246 : : case HTML_NEWPARA:
2247 [ # # ]: 0 : if( !bTAIgnoreNewPara )
2248 : 0 : rText += '\n'; // das ist hier richtig!!!
2249 : 0 : break;
2250 : : default:
2251 : 0 : rText += '<';
2252 : 0 : rText += sSaveToken;
2253 [ # # ]: 0 : if( aToken.Len() )
2254 : : {
2255 : 0 : rText += ' ';
2256 : 0 : rText += aToken;
2257 : : }
2258 : 0 : rText += '>';
2259 : : }
2260 : :
2261 : 0 : bTAIgnoreNewPara = sal_False;
2262 : 0 : }
2263 : :
2264 : 0 : void SwHTMLParser::NewSelect()
2265 : : {
2266 [ # # ]: 0 : if( pPendStack )
2267 : : {
2268 [ # # ]: 0 : SetPendingControlSize();
2269 : : return;
2270 : : }
2271 : :
2272 : : OSL_ENSURE( !bSelect, "Select in Select???" );
2273 : : OSL_ENSURE( !pFormImpl || !pFormImpl->GetFCompPropSet().is(),
2274 : : "Select in Control???" );
2275 : :
2276 [ # # ][ # # ]: 0 : if( !pFormImpl || !pFormImpl->GetFormComps().is() )
[ # # ]
2277 : : return;
2278 : :
2279 [ # # ][ # # ]: 0 : String aId, aClass, aStyle;
[ # # ]
2280 [ # # ]: 0 : String sName;
2281 : 0 : sal_Int32 nTabIndex = TABINDEX_MAX + 1;
2282 [ # # ]: 0 : SvxMacroTableDtor aMacroTbl;
2283 [ # # ]: 0 : std::vector<String> aUnoMacroTbl;
2284 [ # # ]: 0 : std::vector<String> aUnoMacroParamTbl;
2285 : 0 : sal_Bool bMultiple = sal_False;
2286 : 0 : sal_Bool bDisabled = sal_False;
2287 : 0 : nSelectEntryCnt = 1;
2288 : 0 : SvKeyValueIterator *pHeaderAttrs = pFormImpl->GetHeaderAttrs();
2289 [ # # ]: 0 : ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs );
2290 [ # # ]: 0 : const String& rDfltScriptType = GetScriptTypeString( pHeaderAttrs );
2291 : :
2292 [ # # ]: 0 : const HTMLOptions& rHTMLOptions = GetOptions();
2293 [ # # ]: 0 : for (size_t i = rHTMLOptions.size(); i; )
2294 : : {
2295 [ # # ]: 0 : const HTMLOption& rOption = rHTMLOptions[--i];
2296 : 0 : ScriptType eScriptType2 = eDfltScriptType;
2297 : 0 : sal_uInt16 nEvent = 0;
2298 : 0 : sal_Bool bSetEvent = sal_False;
2299 : :
2300 [ # # # # : 0 : switch( rOption.GetToken() )
# # # # #
# # # # #
# # # ]
2301 : : {
2302 : : case HTML_O_ID:
2303 [ # # ]: 0 : aId = rOption.GetString();
2304 : 0 : break;
2305 : : case HTML_O_STYLE:
2306 [ # # ]: 0 : aStyle = rOption.GetString();
2307 : 0 : break;
2308 : : case HTML_O_CLASS:
2309 [ # # ]: 0 : aClass = rOption.GetString();
2310 : 0 : break;
2311 : : case HTML_O_NAME:
2312 [ # # ]: 0 : sName = rOption.GetString();
2313 : 0 : break;
2314 : : case HTML_O_MULTIPLE:
2315 : 0 : bMultiple = sal_True;
2316 : 0 : break;
2317 : : case HTML_O_DISABLED:
2318 : 0 : bDisabled = sal_True;
2319 : 0 : break;
2320 : : case HTML_O_SIZE:
2321 [ # # ]: 0 : nSelectEntryCnt = (sal_uInt16)rOption.GetNumber();
2322 : 0 : break;
2323 : :
2324 : : case HTML_O_TABINDEX:
2325 [ # # ]: 0 : nTabIndex = rOption.GetSNumber();
2326 : 0 : break;
2327 : :
2328 : : case HTML_O_SDONFOCUS:
2329 : 0 : eScriptType2 = STARBASIC;
2330 : : case HTML_O_ONFOCUS:
2331 : 0 : nEvent = HTML_ET_ONGETFOCUS;
2332 : 0 : bSetEvent = sal_True;
2333 : 0 : break;
2334 : :
2335 : : case HTML_O_SDONBLUR:
2336 : 0 : eScriptType2 = STARBASIC;
2337 : : case HTML_O_ONBLUR:
2338 : 0 : nEvent = HTML_ET_ONLOSEFOCUS;
2339 : 0 : bSetEvent = sal_True;
2340 : 0 : break;
2341 : :
2342 : : case HTML_O_SDONCLICK:
2343 : 0 : eScriptType2 = STARBASIC;
2344 : : case HTML_O_ONCLICK:
2345 : 0 : nEvent = HTML_ET_ONCLICK;
2346 : 0 : bSetEvent = sal_True;
2347 : 0 : break;
2348 : :
2349 : : case HTML_O_SDONCHANGE:
2350 : 0 : eScriptType2 = STARBASIC;
2351 : : case HTML_O_ONCHANGE:
2352 : 0 : nEvent = HTML_ET_ONCHANGE;
2353 : 0 : bSetEvent = sal_True;
2354 : 0 : break;
2355 : :
2356 : : default:
2357 : 0 : lcl_html_getEvents( rOption.GetTokenString(),
2358 : 0 : rOption.GetString(),
2359 [ # # ]: 0 : aUnoMacroTbl, aUnoMacroParamTbl );
2360 : 0 : break;
2361 : : }
2362 : :
2363 [ # # ]: 0 : if( bSetEvent )
2364 : : {
2365 [ # # ]: 0 : String sEvent( rOption.GetString() );
2366 [ # # ]: 0 : if( sEvent.Len() )
2367 : : {
2368 [ # # ][ # # ]: 0 : sEvent = convertLineEnd(sEvent, GetSystemLineEnd());
[ # # ]
2369 [ # # ]: 0 : if( EXTENDED_STYPE==eScriptType2 )
2370 [ # # ]: 0 : aScriptType = rDfltScriptType;
2371 [ # # ][ # # ]: 0 : aMacroTbl.Insert( nEvent, SvxMacro( sEvent, aScriptType, eScriptType2 ) );
[ # # ][ # # ]
[ # # ]
2372 [ # # ]: 0 : }
2373 : : }
2374 : : }
2375 : :
2376 : : const uno::Reference< lang::XMultiServiceFactory > & rSrvcMgr =
2377 [ # # ]: 0 : pFormImpl->GetServiceFactory();
2378 [ # # ]: 0 : if( !rSrvcMgr.is() )
2379 : : {
2380 : 0 : FinishTextArea();
2381 : : return;
2382 : : }
2383 [ # # ]: 0 : uno::Reference< uno::XInterface > xInt = rSrvcMgr->createInstance(
2384 [ # # ]: 0 : OUString("com.sun.star.form.component.ListBox") );
2385 [ # # ]: 0 : if( !xInt.is() )
2386 : : {
2387 : 0 : FinishTextArea();
2388 : : return;
2389 : : }
2390 : :
2391 [ # # ]: 0 : uno::Reference< XFormComponent > xFComp( xInt, UNO_QUERY );
2392 : : OSL_ENSURE(xFComp.is(), "keine FormComponent?");
2393 : :
2394 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet( xFComp, UNO_QUERY );
2395 : :
2396 : 0 : Any aTmp;
2397 [ # # ][ # # ]: 0 : aTmp <<= OUString(sName);
2398 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( OUString("Name"), aTmp );
2399 : :
2400 [ # # ][ # # ]: 0 : if( nTabIndex >= TABINDEX_MIN && nTabIndex <= TABINDEX_MAX )
2401 : : {
2402 [ # # ]: 0 : aTmp <<= (sal_Int16)nTabIndex ;
2403 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("TabIndex"),
2404 [ # # ]: 0 : aTmp );
2405 : : }
2406 : :
2407 [ # # ]: 0 : if( bDisabled )
2408 : : {
2409 : 0 : sal_Bool bFalse = sal_False;
2410 [ # # ]: 0 : aTmp.setValue( &bFalse, ::getBooleanCppuType() );
2411 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Enabled"),
2412 [ # # ]: 0 : aTmp );
2413 : : }
2414 : :
2415 : 0 : Size aTextSz( 0, 0 );
2416 : 0 : sal_Bool bMinWidth = sal_True, bMinHeight = sal_True;
2417 [ # # ][ # # ]: 0 : if( !bMultiple && 1==nSelectEntryCnt )
2418 : : {
2419 : 0 : sal_Bool bTrue = sal_True;
2420 [ # # ]: 0 : aTmp.setValue( &bTrue, ::getBooleanCppuType() );
2421 [ # # ]: 0 : xPropSet->setPropertyValue( OUString("Dropdown"),
2422 [ # # ]: 0 : aTmp );
2423 : : }
2424 : : else
2425 : : {
2426 [ # # ]: 0 : if( nSelectEntryCnt <= 1 ) // 4 Zeilen als default
2427 : 0 : nSelectEntryCnt = 4;
2428 : :
2429 [ # # ]: 0 : if( bMultiple )
2430 : : {
2431 : 0 : sal_Bool bTrue = sal_True;
2432 [ # # ]: 0 : aTmp.setValue( &bTrue, ::getBooleanCppuType() );
2433 [ # # ]: 0 : xPropSet->setPropertyValue(
2434 [ # # ]: 0 : OUString("MultiSelection"), aTmp );
2435 : : }
2436 : 0 : aTextSz.Height() = nSelectEntryCnt;
2437 : 0 : bMinHeight = sal_False;
2438 : : }
2439 : :
2440 [ # # ][ # # ]: 0 : SfxItemSet aCSS1ItemSet( pDoc->GetAttrPool(), pCSS1Parser->GetWhichMap() );
2441 [ # # ]: 0 : SvxCSS1PropertyInfo aCSS1PropInfo;
2442 [ # # ]: 0 : if( HasStyleOptions( aStyle, aId, aClass ) )
2443 : : {
2444 [ # # ]: 0 : ParseStyleOptions( aStyle, aId, aClass, aCSS1ItemSet, aCSS1PropInfo );
2445 [ # # ]: 0 : if( aId.Len() )
2446 [ # # ]: 0 : InsertBookmark( aId );
2447 : : }
2448 : :
2449 : 0 : Size aSz( MINFLY, MINFLY );
2450 : 0 : bFixSelectWidth = bFixSelectHeight = sal_True;
2451 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eWidthType )
2452 : : {
2453 [ # # ]: 0 : aSz.Width() = TWIP_TO_MM100( aCSS1PropInfo.nWidth );
2454 : 0 : bFixSelectWidth = sal_False;
2455 : 0 : bMinWidth = sal_False;
2456 : : }
2457 [ # # ]: 0 : if( SVX_CSS1_LTYPE_TWIP== aCSS1PropInfo.eHeightType )
2458 : : {
2459 [ # # ]: 0 : aSz.Height() = TWIP_TO_MM100( aCSS1PropInfo.nHeight );
2460 : 0 : aTextSz.Height() = sal_False;
2461 : 0 : bMinHeight = sal_False;
2462 : : }
2463 [ # # ]: 0 : if( aSz.Width() < MINFLY )
2464 : 0 : aSz.Width() = MINFLY;
2465 [ # # ]: 0 : if( aSz.Height() < MINFLY )
2466 : 0 : aSz.Height() = MINFLY;
2467 : :
2468 : : uno::Reference< drawing::XShape > xShape = InsertControl( xFComp, xPropSet, aSz,
2469 : : text::VertOrientation::TOP, text::HoriOrientation::NONE,
2470 : : aCSS1ItemSet, aCSS1PropInfo,
2471 : : aMacroTbl, aUnoMacroTbl,
2472 [ # # ]: 0 : aUnoMacroParamTbl );
2473 [ # # ]: 0 : if( bFixSelectWidth )
2474 [ # # ]: 0 : pFormImpl->SetShape( xShape );
2475 [ # # ][ # # ]: 0 : if( aTextSz.Height() || bMinWidth || bMinHeight )
[ # # ][ # # ]
2476 [ # # ]: 0 : SetControlSize( xShape, aTextSz, bMinWidth, bMinHeight );
2477 : :
2478 : : // einen neuen Kontext anlegen
2479 [ # # ][ # # ]: 0 : _HTMLAttrContext *pCntxt = new _HTMLAttrContext( HTML_SELECT_ON );
2480 : :
2481 : : // und PRE/Listing/XMP voruebergehend aussetzen
2482 [ # # ]: 0 : SplitPREListingXMP( pCntxt );
2483 [ # # ]: 0 : PushContext( pCntxt );
2484 : :
2485 [ # # ][ # # ]: 0 : bSelect = sal_True;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2486 : : }
2487 : :
2488 : 0 : void SwHTMLParser::EndSelect()
2489 : : {
2490 [ # # ]: 0 : if( pPendStack )
2491 : : {
2492 [ # # ]: 0 : SetPendingControlSize();
2493 : 0 : return;
2494 : : }
2495 : :
2496 : : OSL_ENSURE( bSelect, "keine Select" );
2497 : : OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
2498 : : "kein Select-Control" );
2499 : :
2500 : : const uno::Reference< beans::XPropertySet > & rPropSet =
2501 : 0 : pFormImpl->GetFCompPropSet();
2502 : :
2503 : : // die Groesse anpassen
2504 : 0 : Size aNewSz( MINFLY, MINFLY );
2505 : :
2506 : 0 : size_t nEntryCnt = pFormImpl->GetStringList().size();
2507 [ # # ]: 0 : if(!pFormImpl->GetStringList().empty())
2508 : : {
2509 [ # # ]: 0 : Sequence<OUString> aList( (sal_Int32)nEntryCnt );
2510 [ # # ]: 0 : Sequence<OUString> aValueList( (sal_Int32)nEntryCnt );
2511 [ # # ]: 0 : OUString *pStrings = aList.getArray();
2512 [ # # ]: 0 : OUString *pValues = aValueList.getArray();
2513 : :
2514 [ # # ]: 0 : for(size_t i = 0; i < nEntryCnt; ++i)
2515 : : {
2516 [ # # ][ # # ]: 0 : rtl::OUString sText(pFormImpl->GetStringList()[i]);
2517 [ # # ]: 0 : sText = comphelper::string::stripEnd(sText, ' ');
2518 : 0 : pStrings[i] = sText;
2519 : :
2520 [ # # ][ # # ]: 0 : sText = pFormImpl->GetValueList()[i];
2521 : 0 : pValues[i] = sText;
2522 : 0 : }
2523 : :
2524 [ # # ]: 0 : Any aAny( &aList, ::getCppuType((uno::Sequence<OUString>*)0) );
2525 : :
2526 [ # # ]: 0 : rPropSet->setPropertyValue(
2527 [ # # ]: 0 : OUString("StringItemList"), aAny );
2528 : :
2529 [ # # ]: 0 : aAny <<= ListSourceType_VALUELIST;
2530 [ # # ]: 0 : rPropSet->setPropertyValue(
2531 [ # # ]: 0 : OUString("ListSourceType"), aAny );
2532 : :
2533 [ # # ]: 0 : aAny.setValue( &aValueList, ::getCppuType((uno::Sequence<OUString>*)0) );
2534 : :
2535 [ # # ]: 0 : rPropSet->setPropertyValue( OUString("ListSource"),
2536 [ # # ]: 0 : aAny );
2537 : :
2538 : 0 : size_t nSelCnt = pFormImpl->GetSelectedList().size();
2539 [ # # ][ # # ]: 0 : if( !nSelCnt && 1 == nSelectEntryCnt && nEntryCnt )
[ # # ]
2540 : : {
2541 : : // In einer DropDown-Listbox sollte immer ein Eintrag selektiert
2542 : : // sein.
2543 [ # # ]: 0 : pFormImpl->GetSelectedList().insert( pFormImpl->GetSelectedList().begin(), 0 );
2544 : 0 : nSelCnt = 1;
2545 : : }
2546 [ # # ]: 0 : Sequence<sal_Int16> aSelList( (sal_Int32)nSelCnt );
2547 [ # # ]: 0 : sal_Int16 *pSels = aSelList.getArray();
2548 [ # # ]: 0 : for(size_t i = 0; i < nSelCnt; ++i)
2549 : : {
2550 [ # # ]: 0 : pSels[i] = (sal_Int16)pFormImpl->GetSelectedList()[i];
2551 : : }
2552 : : aAny.setValue( &aSelList,
2553 [ # # ]: 0 : ::getCppuType((uno::Sequence<sal_Int16>*)0) );
2554 : :
2555 [ # # ]: 0 : rPropSet->setPropertyValue(
2556 [ # # ]: 0 : OUString("DefaultSelection"), aAny );
2557 : :
2558 : 0 : pFormImpl->EraseStringList();
2559 [ # # ][ # # ]: 0 : pFormImpl->EraseValueList();
[ # # ]
2560 : : }
2561 : :
2562 : 0 : pFormImpl->EraseSelectedList();
2563 : :
2564 [ # # ]: 0 : if( bFixSelectWidth )
2565 : : {
2566 : : OSL_ENSURE( pFormImpl->GetShape().is(), "Kein Shape gemerkt" );
2567 : 0 : Size aTextSz( -1, 0 );
2568 [ # # ]: 0 : SetControlSize( pFormImpl->GetShape(), aTextSz, sal_False, sal_False );
2569 : : }
2570 : :
2571 [ # # ]: 0 : pFormImpl->ReleaseFCompPropSet();
2572 : :
2573 : : // den Kontext holen
2574 [ # # ]: 0 : _HTMLAttrContext *pCntxt = PopContext( HTML_SELECT_ON );
2575 [ # # ]: 0 : if( pCntxt )
2576 : : {
2577 : : // und ggf. die Attribute beenden
2578 [ # # ]: 0 : EndContext( pCntxt );
2579 [ # # ][ # # ]: 0 : delete pCntxt;
2580 : : }
2581 : :
2582 : 0 : bSelect = sal_False;
2583 : : }
2584 : :
2585 : 0 : void SwHTMLParser::InsertSelectOption()
2586 : : {
2587 : : OSL_ENSURE( bSelect, "keine Select" );
2588 : : OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
2589 : : "kein Select-Control" );
2590 : :
2591 : 0 : bLBEntrySelected = sal_False;
2592 [ # # ]: 0 : String aValue;
2593 : :
2594 [ # # ]: 0 : const HTMLOptions& rHTMLOptions = GetOptions();
2595 [ # # ]: 0 : for (size_t i = rHTMLOptions.size(); i; )
2596 : : {
2597 [ # # ]: 0 : const HTMLOption& rOption = rHTMLOptions[--i];
2598 [ # # # # ]: 0 : switch( rOption.GetToken() )
2599 : : {
2600 : : case HTML_O_ID:
2601 : : // erstmal weglassen!!!
2602 : 0 : break;
2603 : : case HTML_O_SELECTED:
2604 : 0 : bLBEntrySelected = sal_True;
2605 : 0 : break;
2606 : : case HTML_O_VALUE:
2607 [ # # ]: 0 : aValue = rOption.GetString();
2608 [ # # ]: 0 : if( !aValue.Len() )
2609 [ # # ]: 0 : aValue.AssignAscii( "$$$empty$$$" );
2610 : 0 : break;
2611 : : }
2612 : : }
2613 : :
2614 : 0 : sal_uInt16 nEntryCnt = pFormImpl->GetStringList().size();
2615 [ # # ]: 0 : pFormImpl->GetStringList().push_back(aEmptyStr);
2616 [ # # ]: 0 : pFormImpl->GetValueList().push_back(aValue);
2617 [ # # ]: 0 : if( bLBEntrySelected )
2618 : : {
2619 [ # # ]: 0 : pFormImpl->GetSelectedList().push_back( nEntryCnt );
2620 [ # # ]: 0 : }
2621 : 0 : }
2622 : :
2623 : 0 : void SwHTMLParser::InsertSelectText()
2624 : : {
2625 : : OSL_ENSURE( bSelect, "keine Select" );
2626 : : OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
2627 : : "kein Select-Control" );
2628 : :
2629 [ # # ]: 0 : if(!pFormImpl->GetStringList().empty())
2630 : : {
2631 : 0 : String& rText = pFormImpl->GetStringList().back();
2632 : :
2633 [ # # ][ # # ]: 0 : if( aToken.Len() && ' '==aToken.GetChar( 0 ) )
[ # # ]
2634 : : {
2635 : 0 : xub_StrLen nLen = rText.Len();
2636 [ # # ][ # # ]: 0 : if( !nLen || ' '==rText.GetChar( nLen-1 ))
[ # # ]
2637 : 0 : aToken.Erase( 0, 1 );
2638 : : }
2639 [ # # ]: 0 : if( aToken.Len() )
2640 : 0 : rText += aToken;
2641 : : }
2642 : 0 : }
2643 : :
2644 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|