1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
31 #include <sfx2/sfxjs.hxx>
38 // Base class of all VCControl wrapper classes
39 // Keeps reference to the Control and handles some common properties
40 class ImpSjJScriptControlBase
46 // Methods from Java --> C++ (for properties)
47 //--------------------------------------------
48 String
ImpGetName() const;
49 void ImpSetName( const String
& aStrg
);
50 String
ImpGetValue() const;
51 void ImpSetValue( const String
& aStrg
);
52 String
ImpGetType() const;
55 ImpSjJScriptControlBase::ImpSjJScriptControlBase( VCControl
* _pControl
);
58 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61 class ImpSjJScriptButtonObject
: public SjJScriptButtonObject
, ImpSjJScriptControlBase
64 // Methods from Java --> C++ (for properties)
65 //--------------------------------------------
66 // Base class properties, are passed through to ImpSjJScriptControlBase
67 virtual String
getName() const;
68 virtual void setName( const String
& aStrg
);
69 virtual String
getValue() const;
70 virtual void setValue( const String
& aStrg
);
71 virtual String
getType() const;
73 // Methods of the object
76 // Events (C++ --> Java)
77 //----------------------
78 // New event interface with function objects
79 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
80 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
81 virtual String
getOnClick() const;
82 virtual void setOnClick( const String
& aSourceStrg
);
86 ImpSjJScriptButtonObject( VCControl
* _pControl
, SjJSbxObject
* p
);
89 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
91 // PasswordControl (edit control for entering password)
92 class ImpSjJScriptPasswordObject
: public SjJScriptPasswordObject
, ImpSjJScriptControlBase
95 // Methods from Java --> C++ (for properties)
96 //--------------------------------------------
97 // Base class properties, are passed through to ImpSjJScriptControlBase
98 virtual String
getName() const;
99 virtual void setName( const String
& aStrg
);
100 virtual String
getValue() const;
101 virtual String
getType() const;
103 virtual String
getDefaultValue() const;
104 virtual void setDefaultValue( const String
& aStrg
);
105 virtual void setValue( const String
& aStrg
);
107 // Methods of the object
108 virtual void focus();
110 virtual void select();
112 // Events (C++ --> Java)
113 //----------------------
117 ImpSjJScriptPasswordObject( VCControl
* _pControl
, SjJSbxObject
* p
);
120 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
122 class ImpSjJScriptCheckboxObject
: public SjJScriptCheckboxObject
, ImpSjJScriptControlBase
125 // Methods from Java --> C++ (for properties)
126 //--------------------------------------------
127 // Base class properties, are passed through to ImpSjJScriptControlBase
128 virtual String
getName() const;
129 virtual void setName( const String
& aStrg
);
130 virtual String
getValue() const;
131 virtual String
getType() const;
133 virtual sal_Bool
getChecked() const;
134 virtual void setChecked( sal_Bool bCheck
);
135 virtual sal_Bool
getDefaultChecked() const;
136 virtual void setDefaultChecked( sal_Bool bCheck
);
137 virtual void setValue( const String
& aStrg
);
139 // Methods of the object
140 virtual void click();
142 // Events (C++ --> Java)
143 //----------------------
144 // New event interface with function objects
145 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
146 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
147 virtual String
getOnClick() const;
148 virtual void setOnClick( const String
& aSourceStrg
);
152 ImpSjJScriptCheckboxObject( VCControl
* _pControl
, SjJSbxObject
* p
);
155 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
157 // Wrapper class for RadioArray
158 class ImpSjJScriptRadioArray
: public SjJSbxArrayObject
160 VCRadioManager
* pMgr
;
162 sal_Int32
ImpSjJScriptRadioArray::getLength() const;
163 SjJSbxObject
* ImpSjJScriptRadioArray::getElement( sal_Int32 nIndex
) const;
164 SjJSbxObject
* ImpSjJScriptRadioArray::getElement_String( const String
& aName
) const;
167 ImpSjJScriptRadioArray::ImpSjJScriptRadioArray( VCRadioManager
* _pMgr
, SjJSbxObject
* p
);
170 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
172 class ImpSjJScriptRadioObject
: public SjJScriptRadioObject
, ImpSjJScriptControlBase
175 // Methods from Java --> C++ (for properties)
176 //--------------------------------------------
177 // Base class properties, are passed through to ImpSjJScriptControlBase
178 virtual String
getName() const;
179 virtual void setName( const String
& aStrg
);
180 virtual String
getValue() const;
181 virtual String
getType() const;
183 // Properties of SjJScriptCheckboxObject
184 virtual sal_Bool
getChecked() const;
185 virtual void setChecked( sal_Bool bCheck
);
186 virtual sal_Bool
getDefaultChecked() const;
187 virtual void setDefaultChecked( sal_Bool bCheck
);
188 virtual void setValue( const String
& aStrg
);
190 // Methods of the object
191 virtual void click();
193 // Events (C++ --> Java)
194 // New event interface with function objects
195 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
196 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
197 virtual String
getOnClick() const;
198 virtual void setOnClick( const String
& aSourceStrg
);
202 ImpSjJScriptRadioObject( VCControl
* _pControl
, SjJSbxObject
* p
);
205 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
207 class ImpSjJScriptSelectObject
: public SjJScriptSelectObject
, ImpSjJScriptControlBase
210 // Methods from Java --> C++ (for properties)
211 //--------------------------------------------
212 // Base class properties, are passed through to ImpSjJScriptControlBase
213 virtual String
getName() const;
214 virtual void setName( const String
& aStrg
);
215 virtual String
getValue() const;
216 virtual String
getType() const;
218 virtual sal_Int32
getLength();
219 virtual sal_Int32
getSelectedIndex() const;
220 virtual void setSelectedIndex( sal_Int32 nNo
);
222 // Methods of the object
223 virtual void focus();
226 // Events (C++ --> Java)
227 //----------------------
228 // New event interface with function objects
229 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
230 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
231 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
232 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
233 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
234 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
235 virtual String
getOnBlur() const;
236 virtual void setOnBlur( const String
& aSourceStrg
);
238 virtual String
getOnChange() const;
239 virtual void setOnChange( const String
& aSourceStrg
);
241 virtual String
getOnFocus() const;
242 virtual void setOnFocus( const String
& aSourceStrg
);
245 // SjJSbxArrayObject methods
246 virtual sal_Int32
getLength() const;
247 // Access through the index
248 virtual SjJSbxObject
* getElement( sal_Int32 nIndex
) const;
251 ImpSjJScriptSelectObject( VCControl
* _pControl
, SjJSbxObject
* p
);
253 // for setting entries of the object (to be called from Java)
254 virtual void setOption( sal_Int32 nIndex
, const String
& aOptionText
,
255 const String
& aOptionValue
,
256 sal_Bool bDefaultSelected
, sal_Bool bSelected
);
258 // interface for the properties of the option objects
259 virtual sal_Bool
getOptionDefaultSelected( sal_Int32 nIndex
) const;
260 virtual void setOptionDefaultSelected( sal_Bool bSelected
, sal_Int32 nIndex
);
261 virtual sal_Bool
getOptionSelected( sal_Int32 nIndex
) const;
262 virtual void setOptionSelected( sal_Bool bSelected
, sal_Int32 nIndex
);
263 virtual String
getOptionText( sal_Int32 nIndex
) const;
264 virtual void setOptionText( const String
& sText
, sal_Int32 nIndex
);
265 virtual void setOptionValue( const String
& sText
, sal_Int32 nIndex
);
266 virtual String
getOptionValue( sal_Int32 nIndex
) const;
269 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
271 class ImpSjJScriptOptionObject
: public SjJScriptOptionObject
, ImpSjJScriptControlBase
273 sal_uInt16 nListBoxIndex
;
275 // Methods from Java --> C++ (for properties)
276 //--------------------------------------------
277 virtual sal_Bool
getdefaultSelected() const;
278 virtual void setdefaultSelected( sal_Bool bSelected
);
279 virtual sal_Int32
getIndex() const;
280 virtual sal_Bool
getSelected() const;
281 virtual void setSelected( sal_Bool bSelected
);
283 virtual String
getText() const;
284 virtual void setText( const String
& sText
);
285 virtual String
getValue() const;
286 virtual void setValue( const String
& aStrg
);
290 virtual String
getName() const { return "";}
291 virtual void setName( const String
&s
) { }
292 virtual String
getType() const { return "";}
293 // Methods of the object
296 // Events (C++ --> Java)
297 //----------------------
301 ImpSjJScriptOptionObject( VCControl
* _pControl
, SjJSbxObject
* p
, sal_uInt16 _nListBoxIndex
);
304 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
306 // Separate class for forms array
307 class SjJSbxFormsArray
: public SfxJSArray
312 // SjJSbxArrayObject methods
313 virtual sal_Int32
getLength() const;
314 // access through the index
315 virtual SjJSbxObject
* getElement( sal_Int32 nIndex
) const;
316 // access through the name
317 // cannot overload native java methods (yet)
318 virtual SjJSbxObject
* getElement_String( const String
& aName
) const;
321 SjJSbxFormsArray( VCManager
* _pManager
, SjJSbxObject
* p
);
324 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
326 class ImpSjJScriptTextObject
: public SjJScriptTextObject
, ImpSjJScriptControlBase
329 // Methods from Java --> C++ (for properties)
330 //--------------------------------------------
331 // Base class properties, are passed through to ImpSjJScriptControlBase
332 virtual String
getName() const;
333 virtual void setName( const String
& aStrg
);
334 virtual String
getValue() const;
335 virtual String
getType() const;
337 virtual String
getDefaultValue() const;
338 virtual void setDefaultValue( const String
& aStrg
);
339 virtual void setValue( const String
& aStrg
);
341 // Methods of the object
342 virtual void focus();
344 virtual void select();
346 // Events (C++ --> Java)
347 //----------------------
348 // New event interface with function objects
349 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
350 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
351 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
352 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
353 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
354 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
355 virtual SjJScriptFunctionObject
* getOnSelect_Fct() const;
356 virtual void setOnSelect_Fct( SjJScriptFunctionObject
* pFunctionObject
);
357 virtual String
getOnBlur() const;
358 virtual void setOnBlur( const String
& aSourceStrg
);
360 virtual String
getOnChange() const;
361 virtual void setOnChange( const String
& aSourceStrg
);
363 virtual String
getOnFocus() const;
364 virtual void setOnFocus( const String
& aSourceStrg
);
366 virtual String
getOnSelect() const;
367 virtual void setOnSelect( const String
& aSourceStrg
);
371 ImpSjJScriptTextObject( VCControl
* _pControl
, SjJSbxObject
* p
);
374 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
376 class ImpSjJScriptTextareaObject
: public SjJScriptTextareaObject
, ImpSjJScriptControlBase
379 // Methods from Java --> C++ (for properties)
380 //--------------------------------------------
381 // Base class properties, are passed through to ImpSjJScriptControlBase
382 virtual String
getName() const;
383 virtual void setName( const String
& aStrg
);
384 virtual String
getValue() const;
385 virtual String
getType() const;
387 virtual String
getDefaultValue() const;
388 virtual void setDefaultValue( const String
& aStrg
);
389 virtual void setValue( const String
& aStrg
);
391 // Methods of the object
392 virtual void focus();
394 virtual void select();
396 // Events (C++ --> Java)
397 //----------------------
398 // New event interface with function objects
399 virtual SjJScriptFunctionObject
* getOnBlur_Fct() const;
400 virtual void setOnBlur_Fct( SjJScriptFunctionObject
* pFunctionObject
);
401 virtual SjJScriptFunctionObject
* getOnChange_Fct() const;
402 virtual void setOnChange_Fct( SjJScriptFunctionObject
* pFunctionObject
);
403 virtual SjJScriptFunctionObject
* getOnFocus_Fct() const;
404 virtual void setOnFocus_Fct( SjJScriptFunctionObject
* pFunctionObject
);
405 virtual SjJScriptFunctionObject
* getOnSelect_Fct() const;
406 virtual void setOnSelect_Fct( SjJScriptFunctionObject
* pFunctionObject
);
407 virtual String
getOnBlur() const;
408 virtual void setOnBlur( const String
& aSourceStrg
);
410 virtual String
getOnChange() const;
411 virtual void setOnChange( const String
& aSourceStrg
);
413 virtual String
getOnFocus() const;
414 virtual void setOnFocus( const String
& aSourceStrg
);
416 virtual String
getOnSelect() const;
417 virtual void setOnSelect( const String
& aSourceStrg
);
421 ImpSjJScriptTextareaObject( VCControl
* _pControl
, SjJSbxObject
* p
);
424 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
426 class ImpSjJScriptSubmitObject
: public SjJScriptSubmitObject
, ImpSjJScriptControlBase
428 // identically equal to ButtonObject
430 // Methods from Java --> C++ (for properties)
431 //--------------------------------------------
432 // Base class properties, are passed through to ImpSjJScriptControlBase
433 virtual String
getName() const;
434 virtual void setName( const String
& aStrg
);
435 virtual String
getValue() const;
436 virtual void setValue( const String
& aStrg
);
437 virtual String
getType() const;
439 // Methods of the object
440 virtual void click();
442 // Events (C++ --> Java)
443 //----------------------
444 // New event interface with function objects
445 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
446 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
447 virtual String
getOnClick() const;
448 virtual void setOnClick( const String
& aSourceStrg
);
452 ImpSjJScriptSubmitObject( VCControl
* _pControl
, SjJSbxObject
* p
);
455 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
457 class ImpSjJScriptResetObject
: public SjJScriptResetObject
, ImpSjJScriptControlBase
459 // identically equal to ButtonObject
461 // Methods from Java --> C++ (for properties)
462 //--------------------------------------------
463 // Base class properties, are passed through to ImpSjJScriptControlBase
464 virtual String
getName() const;
465 virtual void setName( const String
& aStrg
);
466 virtual String
getValue() const;
467 virtual void setValue( const String
& aStrg
);
468 virtual String
getType() const;
470 // Methods of the object
471 virtual void click();
473 // Events (C++ --> Java)
474 //----------------------
475 // New event interface with function objects
476 virtual SjJScriptFunctionObject
* getOnClick_Fct() const;
477 virtual void setOnClick_Fct( SjJScriptFunctionObject
* pFunctionObject
);
478 virtual String
getOnClick() const;
479 virtual void setOnClick( const String
& aSourceStrg
);
483 ImpSjJScriptResetObject( VCControl
* _pControl
, SjJSbxObject
* p
);
486 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
488 class ImpSjJScriptHiddenObject
: public SjJScriptHiddenObject
, ImpSjJScriptControlBase
491 // Methods from Java --> C++ (for properties)
492 //--------------------------------------------
493 // Base class properties, are passed through to ImpSjJScriptControlBase
494 virtual String
getName() const;
495 virtual void setName( const String
& aStrg
);
496 virtual String
getValue() const;
497 virtual String
getType() const;
499 virtual void setValue( const String
& aStrg
);
501 // Methods of the object
504 // Events (C++ --> Java)
505 //----------------------
509 ImpSjJScriptHiddenObject( VCControl
* _pControl
, SjJSbxObject
* p
);
512 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
514 class ImpSjJScriptFileUploadObject
: public SjJScriptFileUploadObject
, ImpSjJScriptControlBase
517 // Methods from Java --> C++ (for properties)
518 //--------------------------------------------
519 // Base class properties, are passed through to ImpSjJScriptControlBase
520 virtual String
getName() const;
521 virtual void setName( const String
& aStrg
);
522 virtual String
getValue() const;
523 virtual String
getType() const;
525 // Methods of the object
528 // Events (C++ --> Java)
529 //----------------------
533 ImpSjJScriptFileUploadObject( VCControl
* _pControl
, SjJSbxObject
* p
);
536 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
538 class ImpSjJScriptFormObject
: public SjJScriptFormObject
543 // Methods from Java --> C++ (for properties)
544 //--------------------------------------------
545 virtual String
getName() const;
546 virtual void setName( const String
& aStrg
);
547 virtual String
getValue() const;
548 virtual String
getType() const;
550 virtual String
getAction() const;
551 virtual void setAction( const String
& sValue
);
552 virtual String
getEncoding() const;
553 virtual void setEncoding( const String
& sValue
);
554 virtual String
getMethod() const;
555 virtual void setMethod( const String
& sValue
);
556 virtual String
getTarget() const;
557 virtual void setTarget( const String
& sValue
);
559 // SjJSbxArrayObject methods
560 sal_Int32
getLength() const;
561 SjJSbxObject
* getElement( sal_Int32 nIndex
) const;
562 SjJSbxObject
* getElement_String( const String
& aName
) const;
564 // Methods of the object
565 virtual void submit();
566 virtual void reset();
568 // Events (C++ --> Java)
569 //----------------------
570 // New event interface with function objects
571 virtual SjJScriptFunctionObject
* getOnSubmit_Fct() const;
572 virtual void setOnSubmit_Fct( SjJScriptFunctionObject
* pFunctionObject
);
573 virtual SjJScriptFunctionObject
* getOnReset_Fct() const;
574 virtual void setOnReset_Fct( SjJScriptFunctionObject
* pFunctionObject
);
575 virtual String
getOnSubmit() const;
576 virtual void setOnSubmit( const String
& aSourceStrg
);
578 virtual String
getOnReset() const;
579 virtual void setOnReset( const String
& aSourceStrg
);
583 ImpSjJScriptFormObject( VCForm
* _pVCForm
, SjJSbxObject
* p
);
588 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */