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: property.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 ************************************************************************/
31 #ifndef SV_PROPERTY_HXX
32 #define SV_PROPERTY_HXX
34 #ifndef _VIRDEV_HXX //autogen
35 #include <vcl/virdev.hxx>
38 #include <vcl/fixed.hxx>
41 #include <vcl/lstbox.hxx>
44 #include <vcl/group.hxx>
47 #include <vcl/button.hxx>
49 #ifndef SV_MOREBTN_HXX
50 #include <vcl/morebtn.hxx>
52 #ifndef _DIALOG_HXX //autogen
53 #include <vcl/dialog.hxx>
55 #include <vcl/combobox.hxx>
56 #include <vcl/field.hxx>
57 #include <svtools/svarray.hxx>
59 #define _SVSTDARR_USHORTS
60 #include <svtools/svstdarr.hxx>
61 #include <vcl/virdev.hxx>
62 #include <vcl/scrbar.hxx>
63 #include <svtools/svarray.hxx>
65 #ifndef _SVSTDARR_STRINGS
66 #define _SVSTDARR_STRINGS
67 #include <svtools/svstdarr.hxx>
69 #include <vcl/tabpage.hxx>
70 #include <vcl/tabctrl.hxx>
72 //------------------------------------------------------------------------
74 //========================================================================
75 enum eKindOfControl
{ KOC_UNDEFINED
=0,KOC_LISTBOX
=1, KOC_COMBOBOX
=2,
76 KOC_EDIT
=3,KOC_USERDEFINED
=5};
78 class SvXPropertyCtrListener
;
80 class SvXPropertyControl
: public Control
83 SvXPropertyControl( Window
* pParent
, WinBits nWinStyle
= 0 );
84 SvXPropertyControl( Window
* pParent
, const ResId
& rResId
);
86 virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener
*)=0;
88 virtual SvXPropertyCtrListener
* GetSvXPropertyCtrListener()=0;
89 virtual void SetProperty(const String
&rString
)=0;
90 virtual String
GetProperty()const=0;
91 virtual BOOL
HasList()=0;
92 virtual void ClearList()=0;
93 virtual void InsertEntry( const String
& rString
,
94 USHORT nPos
= LISTBOX_APPEND
)=0;
96 virtual void SetCtrSize(const Size
& rSize
)=0;
97 virtual void SetLocked(BOOL bLocked
=TRUE
)=0;
99 virtual void SetMyName(const String
&rString
)=0;
100 virtual String
GetMyName()const=0;
102 virtual void SetMyData(void*)=0;
103 virtual void* GetMyData()=0;
106 class SvXPropertyCtrListener
110 virtual void Modified (SvXPropertyControl
*pSvXPCtr
)=0;
111 virtual void GetFocus (SvXPropertyControl
*pSvXPCtr
)=0;
112 virtual void LoseFocus(SvXPropertyControl
*pSvXPCtr
)=0;
113 virtual void KeyInput (SvXPropertyControl
*pSvXPCtr
,const KeyCode
&)=0;
117 class SvXPropertyEdit
: public SvXPropertyControl
122 SvXPropertyCtrListener
* pListener
;
126 DECL_LINK(ModifiedHdl
,Edit
*);
127 DECL_LINK(GetFocusHdl
,Edit
*);
128 DECL_LINK(LoseFocusHdl
,Edit
*);
131 SvXPropertyEdit( Window
* pParent
, WinBits nWinStyle
= 0 );
132 SvXPropertyEdit( Window
* pParent
, const ResId
& rResId
);
134 virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener
*);
136 virtual SvXPropertyCtrListener
* GetSvXPropertyCtrListener();
138 virtual void SetProperty(const String
&rString
);
139 virtual String
GetProperty()const;
141 virtual BOOL
HasList();
142 virtual void ClearList();
143 virtual void InsertEntry( const String
& rString
,
144 USHORT nPos
= LISTBOX_APPEND
);
146 virtual void SetCtrSize(const Size
& rSize
);
147 virtual void SetLocked(BOOL bLocked
=TRUE
);
149 virtual void SetMyName(const String
&rString
);
150 virtual String
GetMyName()const;
152 virtual void SetMyData(void*);
153 virtual void* GetMyData();
157 class SvXPropertyListBox
: public SvXPropertyControl
162 SvXPropertyCtrListener
* pListener
;
166 DECL_LINK(ModifiedHdl
,ListBox
*);
167 DECL_LINK(GetFocusHdl
,ListBox
*);
168 DECL_LINK(LoseFocusHdl
,ListBox
*);
172 SvXPropertyListBox( Window
* pParent
, WinBits nWinStyle
= 0 );
173 SvXPropertyListBox( Window
* pParent
, const ResId
& rResId
);
175 virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener
*);
177 virtual SvXPropertyCtrListener
* GetSvXPropertyCtrListener();
179 ListBox
* GetListBox();
181 virtual void SetProperty(const String
&rString
);
182 virtual String
GetProperty()const;
184 virtual BOOL
HasList();
185 virtual void ClearList();
186 virtual void InsertEntry( const String
& rString
,
187 USHORT nPos
= LISTBOX_APPEND
);
189 virtual void SetCtrSize(const Size
& rSize
);
190 virtual void SetLocked(BOOL bLocked
=TRUE
);
192 virtual void SetMyName(const String
&rString
);
193 virtual String
GetMyName()const;
195 virtual void SetMyData(void*);
196 virtual void* GetMyData();
199 class SvXPropertyComboBox
: public SvXPropertyControl
204 SvXPropertyCtrListener
* pListener
;
208 DECL_LINK(ModifiedHdl
,ComboBox
*);
209 DECL_LINK(GetFocusHdl
,ComboBox
*);
210 DECL_LINK(LoseFocusHdl
,ComboBox
*);
214 SvXPropertyComboBox( Window
* pParent
, WinBits nWinStyle
= 0 );
215 SvXPropertyComboBox( Window
* pParent
, const ResId
& rResId
);
217 virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener
*);
219 virtual SvXPropertyCtrListener
* GetSvXPropertyCtrListener();
221 ComboBox
* GetComboBox();
223 virtual void SetProperty(const String
&rString
);
224 virtual String
GetProperty()const;
226 virtual BOOL
HasList();
227 virtual void ClearList();
228 virtual void InsertEntry( const String
& rString
,
229 USHORT nPos
= LISTBOX_APPEND
);
231 virtual void SetCtrSize(const Size
& rSize
);
232 virtual void SetLocked(BOOL bLocked
=TRUE
);
234 virtual void SetMyName(const String
&rString
);
235 virtual String
GetMyName()const;
237 virtual void SetMyData(void*);
238 virtual void* GetMyData();
243 class SvPropertyLine
: public Control
249 SvXPropertyControl
* pSvXPropertyControl
;
255 eKindOfControl eKindOfCtr
;
258 virtual void Resize();
261 SvPropertyLine( Window
* pParent
,
262 WinBits nWinStyle
= 0 );
263 SvPropertyLine( Window
* pParent
,
264 const ResId
& rResId
);
267 void SetNeedsRepaint(BOOL bFlag
);
268 void SetSvXPropertyControl(SvXPropertyControl
*);
269 SvXPropertyControl
* GetSvXPropertyControl();
271 void SetKindOfControl(eKindOfControl
);
272 eKindOfControl
GetKindOfControl();
274 void SetName(const String
& rString
);
275 String
GetName() const;
276 void SetNameWidth(USHORT
);
280 BOOL
IsVisibleXButton();
281 void ShowAsHyperLink(BOOL nFlag
=TRUE
);
282 BOOL
IsShownAsHyperlink();
284 void Locked(BOOL nFlag
=TRUE
);
287 void SetClickHdl(const Link
&);
295 eKindOfControl eKind
;
298 SvStrings theValues
; // ???
300 BOOL bHasVisibleXButton
;
304 SvXPropertyControl
* pControl
;
307 class SvPropertyDataObjectControl
311 class SvPropertyDataControl
314 virtual void Modified( const String
& aName
,
318 virtual void Clicked( const String
& aName
,
322 virtual void Commit( const String
& aName
,
326 virtual void Select( const String
& aName
,
329 virtual void LinkClicked(const String
& aName
,
333 class SvXPropEvListener
: public SvXPropertyCtrListener
339 String aModifiedResult
;
341 SvXPropertyControl
* pTheActiveControl
;
346 virtual ~SvXPropEvListener();
348 virtual void Modified (SvXPropertyControl
*pSvXPCtr
);
349 virtual void GetFocus (SvXPropertyControl
*pSvXPCtr
);
350 virtual void LoseFocus(SvXPropertyControl
*pSvXPCtr
);
351 virtual void KeyInput(SvXPropertyControl
*pSvXPCtr
,const KeyCode
&);
353 SvXPropertyControl
* GetPropertyControl();
354 KeyCode
GetKeyCode() const;
356 void SetModifyHdl( const Link
& rLink
) { aModifyLink
= rLink
; }
357 const Link
& GetModifyHdl() const { return aModifyLink
; }
359 void SetGetFocusHdl( const Link
& rLink
) { aGetFocusLink
= rLink
; }
360 const Link
& GetGetFocusHdl() const { return aGetFocusLink
; }
362 void SetLoseFocusHdl( const Link
& rLink
) { aLoseFocusLink
= rLink
; }
363 const Link
& GetLoseFocusHdl() const { return aLoseFocusLink
; }
365 void SetKeyInputHdl( const Link
& rLink
) { aKeyInputLink
= rLink
; }
366 const Link
& GetKeyInputHdl() const { return aKeyInputLink
; }
371 typedef SvPropertyLine
* SvPropertyLinePtr
;
373 SV_DECL_PTRARR(SvPropLineArray
,SvPropertyLinePtr
,1,1)
375 class SvListBoxForProperties
: public Control
379 SvXPropEvListener aListener
;
382 SvPropLineArray PLineArray
;
383 SvPropertyDataControl
* pPropDataControl
;
389 DECL_LINK( ScrollHdl
,ScrollBar
*);
390 DECL_LINK( ClickHdl
,PushButton
*);
392 DECL_LINK( ModifyHdl
,SvXPropEvListener
*);
393 DECL_LINK( GetFocusHdl
,SvXPropEvListener
*);
394 DECL_LINK(LoseFocusHdl
,SvXPropEvListener
*);
395 DECL_LINK( KeyInputHdl
,SvXPropEvListener
*);
399 void UpdatePosNSize();
400 void UpdatePlayGround();
401 void UpdateVScroll();
406 SvListBoxForProperties( Window
* pParent
, WinBits nWinStyle
= 0 );
407 SvListBoxForProperties( Window
* pParent
, const ResId
& rResId
);
409 ~SvListBoxForProperties();
411 virtual USHORT
CalcVisibleLines();
412 virtual void EnableUpdate();
413 virtual void DisableUpdate();
415 virtual void SetController(SvPropertyDataControl
*);
417 virtual void Clear();
419 virtual USHORT
InsertEntry( const SvPropertyData
&, USHORT nPos
= LISTBOX_APPEND
);
421 virtual void ChangeEntry( const SvPropertyData
&, USHORT nPos
);
423 virtual USHORT
AppendEntry( const SvPropertyData
&);
425 virtual void SetPropertyValue( const String
& rEntryName
, const String
& rValue
);
427 virtual void SetFirstVisibleEntry(USHORT nPos
);
428 virtual USHORT
GetFirstVisibleEntry();
430 virtual void SetSelectedEntry(USHORT nPos
);
431 virtual USHORT
GetSelectedEntry();
434 class SvTabPageForProperties
: public TabPage
439 SvListBoxForProperties aLbProp
;
443 virtual void Resize();
446 SvTabPageForProperties(Window
* pParent
,WinBits nWinStyle
= 0 );
448 SvListBoxForProperties
* GetTheListBox();
452 class SvBasicPropertyDataControl
: public SvPropertyDataControl
458 String aEntryProperty
;
459 String aCorrectProperty
;
467 virtual ~SvBasicPropertyDataControl();
469 virtual void Modified( const String
& aName
,
471 void* pData
); //User has modified Property
473 virtual void Clicked( const String
& aName
,
475 void* pData
); //Xtension-Button pressed
477 virtual void Commit( const String
& aName
,
479 void* pData
); //User accept changes
481 virtual void Select( const String
& aName
,
482 void* pData
); //User select new Row
484 virtual void LinkClicked(const String
& aName
,
487 virtual void SetIsCorrect(BOOL nFlag
);
489 //virtual String GetTheCorrectProperty()const;
490 virtual void SetTheCorrectProperty(const String
& aName
);
492 String
GetName() const; //Tell's the name of the Property
493 String
GetProperty() const; //Tell's the content of the Property
494 void* GetData(); //Tell's the storage
497 void SetModifyHdl( const Link
& rLink
) { aModifyLink
= rLink
; }
498 const Link
& GetModifyHdl() const { return aModifyLink
; }
500 void SetClickedHdl( const Link
& rLink
) { aClickedLink
= rLink
; }
501 const Link
& GetClickedHdl() const { return aClickedLink
; }
503 void SetCommitHdl( const Link
& rLink
) { aCommitLink
= rLink
; }
504 const Link
& GetCommitHdl() const { return aCommitLink
; }
506 void SetSelectHdl( const Link
& rLink
) { aSelectLink
= rLink
; }
507 const Link
& GetSelectHdl() const { return aSelectLink
; }
512 class SvPropertyBox
: public Control
515 SvPropertyDataControl
* pThePropDataCtr
;
516 TabControl aTabControl
;
519 virtual void Resize();
522 SvPropertyBox ( Window
* pParent
, WinBits nWinStyle
= 0 );
523 SvPropertyBox ( Window
* pParent
, const ResId
& rResId
);
527 virtual USHORT
CalcVisibleLines();
528 virtual void EnableUpdate(); // auch IDL?
529 virtual void DisableUpdate(); // auch IDL?
531 // AB: Hier beginnt das 'offizielle' Interface, das in IDL uebernommen werden soll
532 virtual void SetController(SvPropertyDataControl
*);
534 virtual USHORT
AppendPage( const String
& r
);
535 virtual void SetPage( USHORT
);
536 virtual USHORT
GetCurPage();
537 virtual void ClearAll();
538 virtual void ClearTable();
540 virtual void SetPropertyValue( const String
& rEntryName
, const String
& rValue
);
542 virtual USHORT
InsertEntry( const SvPropertyData
&, USHORT nPos
= LISTBOX_APPEND
);
543 virtual void ChangeEntry( const SvPropertyData
&, USHORT nPos
);
544 virtual USHORT
AppendEntry( const SvPropertyData
&);
546 virtual void SetFirstVisibleEntry(USHORT nPos
);
547 virtual USHORT
GetFirstVisibleEntry();
549 virtual void SetSelectedEntry(USHORT nPos
);
550 virtual USHORT
GetSelectedEntry();
556 class ScPropertyDlg : public ModalDialog
559 SvBasicPropertyDataControl aBaProDatCtr;
561 CancelButton aCancel;
565 SvPropertyData aProperty;
566 SvPropertyBox aPropListBox;
568 ListBox aKindOfListBox;
569 FixedText aModAnswer;
570 FixedText aClickAnswer;
571 FixedText aCommitAnswer;
572 FixedText aSelectAnswer;
574 DECL_LINK( ModifiedHdl, ListBox*);
576 DECL_LINK( RowModifiedHdl, SvBasicPropertyDataControl*);
577 DECL_LINK( ClickHdl , SvBasicPropertyDataControl*);
578 DECL_LINK( SelectHdl , SvBasicPropertyDataControl*);
579 DECL_LINK( CommitHdl , SvBasicPropertyDataControl*);
582 ScPropertyDlg( Window* pParent);
586 #endif // SC_AUTOFMT_HXX