1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sjctrl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <sfx2/sfxjs.hxx>
43 // Basis-Klasse aller VCControl-Wrapper-Klassen
44 // Haelt Verweis auf das Control und handelt einige gemeinsame Properties
45 class ImpSjJScriptControlBase
51 // Beibehalten bis zum Vollupdate
53 String getName() const;
54 void setName( const String & aStrg );
55 String getValue() const;
56 String getType() const;
59 // Methoden von Java --> C++ (f"ur Properties)
60 //--------------------------------------------
61 String
ImpGetName() const;
62 void ImpSetName( const String
& aStrg
);
63 String
ImpGetValue() const;
64 void ImpSetValue( const String
& aStrg
);
65 String
ImpGetType() const;
68 ImpSjJScriptControlBase::ImpSjJScriptControlBase( VCControl
* _pControl
);
71 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74 class ImpSjJScriptButtonObject
: public SjJScriptButtonObject
, ImpSjJScriptControlBase
77 // Methoden von Java --> C++ (f"ur Properties)
78 //--------------------------------------------
79 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
80 virtual String
getName() const;
81 virtual void setName( const String
& aStrg
);
82 virtual String
getValue() const;
83 virtual void setValue( const String
& aStrg
);
84 virtual String
getType() const;
86 // Methoden des Objektes
89 // Events (C++ --> Java)
90 //----------------------
91 // Neue Event-Schnittstelle mit Function-Objekten
92 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
93 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
94 virtual String
getOnClick() const;
95 virtual void setOnClick( const String
& aSourceStrg
);
99 ImpSjJScriptButtonObject( VCControl
* _pControl
, SjJSbxObject
* p
);
102 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
104 // PasswordControl (Edit-Control zur Password-Eingabe)
105 class ImpSjJScriptPasswordObject
: public SjJScriptPasswordObject
, ImpSjJScriptControlBase
108 // Methoden von Java --> C++ (f"ur Properties)
109 //--------------------------------------------
110 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
111 virtual String
getName() const;
112 virtual void setName( const String
& aStrg
);
113 virtual String
getValue() const;
114 virtual String
getType() const;
116 virtual String
getDefaultValue() const;
117 virtual void setDefaultValue( const String
& aStrg
);
118 virtual void setValue( const String
& aStrg
);
120 // Methoden des Objektes
121 virtual void focus();
123 virtual void select();
125 // Events (C++ --> Java)
126 //----------------------
130 ImpSjJScriptPasswordObject( VCControl
* _pControl
, SjJSbxObject
* p
);
133 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135 class ImpSjJScriptCheckboxObject
: public SjJScriptCheckboxObject
, ImpSjJScriptControlBase
138 // Methoden von Java --> C++ (f"ur Properties)
139 //--------------------------------------------
140 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
141 virtual String
getName() const;
142 virtual void setName( const String
& aStrg
);
143 virtual String
getValue() const;
144 virtual String
getType() const;
146 virtual BOOL
getChecked() const;
147 virtual void setChecked( BOOL bCheck
);
148 virtual BOOL
getDefaultChecked() const;
149 virtual void setDefaultChecked( BOOL bCheck
);
150 // getValue() wird in der Basisklasse definiert
151 virtual void setValue( const String
& aStrg
);
153 // Methoden des Objektes
154 virtual void click();
156 // Events (C++ --> Java)
157 //----------------------
158 // Neue Event-Schnittstelle mit Function-Objekten
159 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
160 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
161 virtual String
getOnClick() const;
162 virtual void setOnClick( const String
& aSourceStrg
);
166 ImpSjJScriptCheckboxObject( VCControl
* _pControl
, SjJSbxObject
* p
);
169 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
171 // Wrapper-Klasse fuer RadioArray
172 class ImpSjJScriptRadioArray
: public SjJSbxArrayObject
174 VCRadioManager
* pMgr
;
176 INT32
ImpSjJScriptRadioArray::getLength() const;
177 SjJSbxObject
* ImpSjJScriptRadioArray::getElement( INT32 nIndex
) const;
178 SjJSbxObject
* ImpSjJScriptRadioArray::getElement_String( const String
& aName
) const;
181 ImpSjJScriptRadioArray::ImpSjJScriptRadioArray( VCRadioManager
* _pMgr
, SjJSbxObject
* p
);
184 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
186 class ImpSjJScriptRadioObject
: public SjJScriptRadioObject
, ImpSjJScriptControlBase
189 // Methoden von Java --> C++ (f"ur Properties)
190 //--------------------------------------------
191 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
192 virtual String
getName() const;
193 virtual void setName( const String
& aStrg
);
194 virtual String
getValue() const;
195 virtual String
getType() const;
197 // Properties von SjJScriptCheckboxObject
198 virtual BOOL
getChecked() const;
199 virtual void setChecked( BOOL bCheck
);
200 virtual BOOL
getDefaultChecked() const;
201 virtual void setDefaultChecked( BOOL bCheck
);
202 // getValue() wird in der Basisklasse definiert
203 virtual void setValue( const String
& aStrg
);
205 // yyy Raus zum inkompatiblen
206 //virtual INT32 getLength();
208 // Methoden des Objektes
209 virtual void click();
211 // Events (C++ --> Java)
212 // Neue Event-Schnittstelle mit Function-Objekten
213 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
214 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
215 virtual String
getOnClick() const;
216 virtual void setOnClick( const String
& aSourceStrg
);
220 ImpSjJScriptRadioObject( VCControl
* _pControl
, SjJSbxObject
* p
);
223 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
225 class ImpSjJScriptSelectObject
: public SjJScriptSelectObject
, ImpSjJScriptControlBase
228 // Methoden von Java --> C++ (f"ur Properties)
229 //--------------------------------------------
230 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
231 virtual String
getName() const;
232 virtual void setName( const String
& aStrg
);
233 virtual String
getValue() const;
234 virtual String
getType() const;
236 virtual INT32
getLength();
237 virtual INT32
getSelectedIndex() const;
238 virtual void setSelectedIndex( INT32 nNo
);
240 // liefert eine Array von Option-Objekten
241 //yyy Raus zum inkompatiblen
242 //virtual SjJSbxArrayObject * getOptions();
244 // Methoden des Objektes
245 virtual void focus();
248 // Events (C++ --> Java)
249 //----------------------
250 // Neue Event-Schnittstelle mit Function-Objekten
251 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
252 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
253 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
254 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
255 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
256 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
257 virtual String
getOnBlur() const;
258 virtual void setOnBlur( const String
& aSourceStrg
);
260 virtual String
getOnChange() const;
261 virtual void setOnChange( const String
& aSourceStrg
);
263 virtual String
getOnFocus() const;
264 virtual void setOnFocus( const String
& aSourceStrg
);
267 // SjJSbxArrayObject-Methoden
268 virtual INT32
getLength() const;
269 // Zugriff "uber den Index
270 virtual SjJSbxObject
* getElement( INT32 nIndex
) const;
271 // Zugriff "uber den Namen
272 // native Java-Methoden k"onnen (noch) nicht "uberladen werden
273 //virtual SjJSbxObject * getElement_String( const String & aName ) const;
276 ImpSjJScriptSelectObject( VCControl
* _pControl
, SjJSbxObject
* p
);
278 // zum Setzen von Eintr"agen am Objket (zum Aufruf von Java aus) 15.1.1997
279 virtual void setOption( INT32 nIndex
, const String
& aOptionText
,
280 const String
& aOptionValue
,
281 BOOL bDefaultSelected
, BOOL bSelected
);
283 // Schnittstelle fuer die Properties der Option-Objekte
284 virtual BOOL
getOptionDefaultSelected( INT32 nIndex
) const;
285 virtual void setOptionDefaultSelected( BOOL bSelected
, INT32 nIndex
);
286 virtual BOOL
getOptionSelected( INT32 nIndex
) const;
287 virtual void setOptionSelected( BOOL bSelected
, INT32 nIndex
);
288 virtual String
getOptionText( INT32 nIndex
) const;
289 virtual void setOptionText( const String
& sText
, INT32 nIndex
);
290 virtual void setOptionValue( const String
& sText
, INT32 nIndex
);
291 virtual String
getOptionValue( INT32 nIndex
) const;
294 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
296 // Wieso von Controlbase abgeleitet?
298 class ImpSjJScriptOptionObject
: public SjJScriptOptionObject
, ImpSjJScriptControlBase
300 USHORT nListBoxIndex
;
302 // Methoden von Java --> C++ (f"ur Properties)
303 //--------------------------------------------
304 virtual BOOL
getdefaultSelected() const;
305 virtual void setdefaultSelected( BOOL bSelected
);
306 virtual INT32
getIndex() const;
307 virtual BOOL
getSelected() const;
308 virtual void setSelected( BOOL bSelected
);
311 //yyy Zum Vollupdate raus:
313 virtual INT32 getSelectedIndex() const;
314 virtual void setSelectedIndex( INT32 nNo );
318 virtual String
getText() const;
319 virtual void setText( const String
& sText
);
320 // getValue() wird in der Basisklasse definiert
321 virtual String
getValue() const;
322 virtual void setValue( const String
& aStrg
);
326 virtual String
getName() const { return "";}
327 virtual void setName( const String
&s
) { }
328 virtual String
getType() const { return "";}
329 // Methoden des Objektes
332 // Events (C++ --> Java)
333 //----------------------
337 ImpSjJScriptOptionObject( VCControl
* _pControl
, SjJSbxObject
* p
, USHORT _nListBoxIndex
);
340 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
342 // Eigene Klasse fuer forms-Array anlegen
343 class SjJSbxFormsArray
: public SfxJSArray
348 // SjJSbxArrayObject-Methoden
349 virtual INT32
getLength() const;
350 // Zugriff "uber den Index
351 virtual SjJSbxObject
* getElement( INT32 nIndex
) const;
352 // Zugriff "uber den Namen
353 // native Java-Methoden k"onnen (noch) nicht "uberladen werden
354 virtual SjJSbxObject
* getElement_String( const String
& aName
) const;
357 SjJSbxFormsArray( VCManager
* _pManager
, SjJSbxObject
* p
);
360 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
362 class ImpSjJScriptTextObject
: public SjJScriptTextObject
, ImpSjJScriptControlBase
365 // Methoden von Java --> C++ (f"ur Properties)
366 //--------------------------------------------
367 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
368 virtual String
getName() const;
369 virtual void setName( const String
& aStrg
);
370 virtual String
getValue() const;
371 virtual String
getType() const;
373 virtual String
getDefaultValue() const;
374 virtual void setDefaultValue( const String
& aStrg
);
375 // getValue() wird in der Basisklasse definiert
376 virtual void setValue( const String
& aStrg
);
378 // Methoden des Objektes
379 virtual void focus();
381 virtual void select();
383 // Events (C++ --> Java)
384 //----------------------
385 // Neue Event-Schnittstelle mit Function-Objekten
386 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
387 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
388 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
389 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
390 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
391 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
392 virtual SjJScriptFunctionObject
* getOnSelect_Fct() const;
393 virtual void setOnSelect_Fct( SjJScriptFunctionObject
* pFunctionObject
);
394 virtual String
getOnBlur() const;
395 virtual void setOnBlur( const String
& aSourceStrg
);
397 virtual String
getOnChange() const;
398 virtual void setOnChange( const String
& aSourceStrg
);
400 virtual String
getOnFocus() const;
401 virtual void setOnFocus( const String
& aSourceStrg
);
403 virtual String
getOnSelect() const;
404 virtual void setOnSelect( const String
& aSourceStrg
);
408 ImpSjJScriptTextObject( VCControl
* _pControl
, SjJSbxObject
* p
);
411 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
413 class ImpSjJScriptTextareaObject
: public SjJScriptTextareaObject
, ImpSjJScriptControlBase
416 // Methoden von Java --> C++ (f"ur Properties)
417 //--------------------------------------------
418 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
419 virtual String
getName() const;
420 virtual void setName( const String
& aStrg
);
421 virtual String
getValue() const;
422 virtual String
getType() const;
424 virtual String
getDefaultValue() const;
425 virtual void setDefaultValue( const String
& aStrg
);
426 // getValue() wird in der Basisklasse definiert
427 virtual void setValue( const String
& aStrg
);
429 // Methoden des Objektes
430 virtual void focus();
432 virtual void select();
434 // Events (C++ --> Java)
435 //----------------------
436 // Neue Event-Schnittstelle mit Function-Objekten
437 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
438 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
439 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
440 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
441 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
442 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
443 virtual SjJScriptFunctionObject
* getOnSelect_Fct() const;
444 virtual void setOnSelect_Fct( SjJScriptFunctionObject
* pFunctionObject
);
445 virtual String
getOnBlur() const;
446 virtual void setOnBlur( const String
& aSourceStrg
);
448 virtual String
getOnChange() const;
449 virtual void setOnChange( const String
& aSourceStrg
);
451 virtual String
getOnFocus() const;
452 virtual void setOnFocus( const String
& aSourceStrg
);
454 virtual String
getOnSelect() const;
455 virtual void setOnSelect( const String
& aSourceStrg
);
459 ImpSjJScriptTextareaObject( VCControl
* _pControl
, SjJSbxObject
* p
);
462 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
464 class ImpSjJScriptSubmitObject
: public SjJScriptSubmitObject
, ImpSjJScriptControlBase
466 // Identisch mit ButtonObject
468 // Methoden von Java --> C++ (f"ur Properties)
469 //--------------------------------------------
470 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
471 virtual String
getName() const;
472 virtual void setName( const String
& aStrg
);
473 virtual String
getValue() const;
474 virtual void setValue( const String
& aStrg
);
475 virtual String
getType() const;
477 // Methoden des Objektes
478 virtual void click();
480 // Events (C++ --> Java)
481 //----------------------
482 // Neue Event-Schnittstelle mit Function-Objekten
483 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
484 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
485 virtual String
getOnClick() const;
486 virtual void setOnClick( const String
& aSourceStrg
);
490 ImpSjJScriptSubmitObject( VCControl
* _pControl
, SjJSbxObject
* p
);
493 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
495 class ImpSjJScriptResetObject
: public SjJScriptResetObject
, ImpSjJScriptControlBase
497 // Identisch mit ButtonObject
499 // Methoden von Java --> C++ (f"ur Properties)
500 //--------------------------------------------
501 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
502 virtual String
getName() const;
503 virtual void setName( const String
& aStrg
);
504 virtual String
getValue() const;
505 virtual void setValue( const String
& aStrg
);
506 virtual String
getType() const;
508 // Methoden des Objektes
509 virtual void click();
511 // Events (C++ --> Java)
512 //----------------------
513 // Neue Event-Schnittstelle mit Function-Objekten
514 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
515 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
516 virtual String
getOnClick() const;
517 virtual void setOnClick( const String
& aSourceStrg
);
521 ImpSjJScriptResetObject( VCControl
* _pControl
, SjJSbxObject
* p
);
524 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
526 class ImpSjJScriptHiddenObject
: public SjJScriptHiddenObject
, ImpSjJScriptControlBase
529 // Methoden von Java --> C++ (f"ur Properties)
530 //--------------------------------------------
531 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
532 virtual String
getName() const;
533 virtual void setName( const String
& aStrg
);
534 virtual String
getValue() const;
535 virtual String
getType() const;
537 // getValue() wird in der Basisklasse definiert
538 virtual void setValue( const String
& aStrg
);
540 // Methoden des Objektes
543 // Events (C++ --> Java)
544 //----------------------
548 ImpSjJScriptHiddenObject( VCControl
* _pControl
, SjJSbxObject
* p
);
551 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
553 class ImpSjJScriptFileUploadObject
: public SjJScriptFileUploadObject
, ImpSjJScriptControlBase
556 // Methoden von Java --> C++ (f"ur Properties)
557 //--------------------------------------------
558 // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
559 virtual String
getName() const;
560 virtual void setName( const String
& aStrg
);
561 virtual String
getValue() const;
562 virtual String
getType() const;
564 // Methoden des Objektes
567 // Events (C++ --> Java)
568 //----------------------
572 ImpSjJScriptFileUploadObject( VCControl
* _pControl
, SjJSbxObject
* p
);
575 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
577 class ImpSjJScriptFormObject
: public SjJScriptFormObject
582 // Methoden von Java --> C++ (f"ur Properties)
583 //--------------------------------------------
584 virtual String
getName() const;
585 virtual void setName( const String
& aStrg
);
586 virtual String
getValue() const;
587 virtual String
getType() const;
589 virtual String
getAction() const;
590 virtual void setAction( const String
& sValue
);
591 virtual String
getEncoding() const;
592 virtual void setEncoding( const String
& sValue
);
593 virtual String
getMethod() const;
594 virtual void setMethod( const String
& sValue
);
595 virtual String
getTarget() const;
596 virtual void setTarget( const String
& sValue
);
598 // SjJSbxArrayObject-Methoden
599 INT32
getLength() const;
600 SjJSbxObject
* getElement( INT32 nIndex
) const;
601 SjJSbxObject
* getElement_String( const String
& aName
) const;
603 // liefert ein Array-Objekt mit Elementen vom Typ JScriptAbstractControlsObject
604 // yyy Raus zum inkompatiblen
605 //virtual SjJSbxArrayObject * getElements();
607 // Zugriff ueber den Namen eines Controls (falls ein Name zugeordnet ist)
608 // yyy Raus zum inkompatiblen
609 //virtual SjJSbxObject * getElement( const String & aName );
611 // Methoden des Objektes
612 virtual void submit();
613 virtual void reset();
615 // Events (C++ --> Java)
616 //----------------------
617 // Neue Event-Schnittstelle mit Function-Objekten
618 virtual SjJScriptFunctionObject
* getOnSubmit_Fct() const;
619 virtual void setOnSubmit_Fct( SjJScriptFunctionObject
* pFunctionObject
);
620 virtual SjJScriptFunctionObject
* getOnReset_Fct() const;
621 virtual void setOnReset_Fct( SjJScriptFunctionObject
* pFunctionObject
);
622 virtual String
getOnSubmit() const;
623 virtual void setOnSubmit( const String
& aSourceStrg
);
625 virtual String
getOnReset() const;
626 virtual void setOnReset( const String
& aSourceStrg
);
630 ImpSjJScriptFormObject( VCForm
* _pVCForm
, SjJSbxObject
* p
);