1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svtools.hxx"
30 
31 
32 #ifndef GCC
33 #endif
34 
35 //------------------------------------------------------------------
36 
37 //#include "Svitems.hxx"
38 
39 #include "property.hxx"
40 /*
41 #include "property.hrc"
42 #include "Scresid.hxx"
43 */
44 #define FRAME_OFFSET 4
45 
46 
47 SvXPropertyControl::SvXPropertyControl( Window* pParent, WinBits nWinStyle)
48 			:	Control(pParent,nWinStyle)
49 {
50 }
51 
52 SvXPropertyControl::SvXPropertyControl( Window* pParent, const ResId& rResId )
53 			:	Control(pParent,rResId )
54 {
55 }
56 
57 //------------------------------------------------------------------
58 
59 SvXPropertyEdit::SvXPropertyEdit( Window* pParent, WinBits nWinStyle)
60 		:		SvXPropertyControl(pParent,nWinStyle),
61 				aEdit(this,WB_BORDER | WB_TABSTOP)
62 {
63 	pListener=NULL;
64 	aEdit.SetModifyHdl(
65 		LINK( this, SvXPropertyEdit, ModifiedHdl ));
66 	aEdit.SetGetFocusHdl(
67 		LINK( this, SvXPropertyEdit, GetFocusHdl));
68 	aEdit.SetLoseFocusHdl(
69 		LINK( this, SvXPropertyEdit, LoseFocusHdl));
70 
71 	aEdit.Show();
72 }
73 
74 SvXPropertyEdit::SvXPropertyEdit( Window* pParent, const ResId& rResId)
75 		:		SvXPropertyControl(pParent,rResId),
76 				aEdit(this,WB_BORDER | WB_TABSTOP)
77 {
78 	pListener=NULL;
79 	aEdit.SetModifyHdl(
80 		LINK( this, SvXPropertyEdit, ModifiedHdl ));
81 	aEdit.SetGetFocusHdl(
82 		LINK( this, SvXPropertyEdit, GetFocusHdl));
83 	aEdit.SetLoseFocusHdl(
84 		LINK( this, SvXPropertyEdit, LoseFocusHdl));
85 
86 	Size aSize=GetSizePixel();
87 	SetCtrSize(aSize);
88 	aEdit.Show();
89 }
90 
91 void SvXPropertyEdit::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
92 {
93 	pListener=pCtrListener;
94 }
95 
96 SvXPropertyCtrListener* SvXPropertyEdit::GetSvXPropertyCtrListener()
97 {
98 	return pListener;
99 }
100 
101 
102 void SvXPropertyEdit::SetCtrSize(const Size& rSize)
103 {
104 	SetSizePixel(rSize);
105 	Size aSize=GetOutputSizePixel();
106 	Point aPos(0,0);
107 	aEdit.SetPosPixel(aPos);
108 	aEdit.SetSizePixel(aSize);
109 }
110 
111 void SvXPropertyEdit::SetLocked(sal_Bool bLocked)
112 {
113 	if(bLocked)
114 		Disable();
115 	else
116 		Enable();
117 }
118 
119 void SvXPropertyEdit::SetProperty(const String &rString)
120 {
121 	aEdit.SetText(rString);
122 }
123 
124 String SvXPropertyEdit::GetProperty() const
125 {
126 	return aEdit.GetText();
127 }
128 
129 sal_Bool SvXPropertyEdit::HasList()
130 {
131 	return sal_False;
132 };
133 
134 
135 void SvXPropertyEdit::ClearList()
136 {
137 	return;
138 }
139 void SvXPropertyEdit::InsertEntry( const String&,sal_uInt16 )
140 {
141 	return;
142 }
143 
144 void SvXPropertyEdit::SetMyName(const String &rString)
145 {
146 	aName=rString;
147 }
148 
149 String SvXPropertyEdit::GetMyName()const
150 {
151 	return aName;
152 }
153 
154 void SvXPropertyEdit::SetMyData(void* pDat)
155 {
156 	pData=pDat;
157 }
158 
159 void* SvXPropertyEdit::GetMyData()
160 {
161 	return pData;
162 }
163 
164 
165 IMPL_LINK( SvXPropertyEdit, ModifiedHdl, Edit*, EMPTYARG )
166 {
167 	if(pListener!=NULL)
168 		pListener->Modified(this);
169 	return 0;
170 }
171 
172 IMPL_LINK( SvXPropertyEdit, GetFocusHdl, Edit*, EMPTYARG )
173 {
174 	if(pListener!=NULL)
175 		pListener->GetFocus(this);
176 	return 0;
177 }
178 
179 IMPL_LINK( SvXPropertyEdit, LoseFocusHdl, Edit*, EMPTYARG )
180 {
181 	if(pListener!=NULL)
182 		pListener->LoseFocus(this);
183 	return 0;
184 }
185 
186 //------------------------------------------------------------------
187 
188 SvXPropertyListBox::SvXPropertyListBox( Window* pParent, WinBits nWinStyle)
189 		:		SvXPropertyControl(pParent,nWinStyle),
190 				aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
191 {
192 	pListener=NULL;
193 	aListBox.SetSelectHdl(
194 		LINK( this, SvXPropertyListBox, ModifiedHdl ));
195 	aListBox.SetGetFocusHdl(
196 		LINK( this, SvXPropertyListBox, GetFocusHdl));
197 	aListBox.SetLoseFocusHdl(
198 		LINK( this, SvXPropertyListBox, LoseFocusHdl));
199 	aListBox.Show();
200 }
201 
202 SvXPropertyListBox::SvXPropertyListBox( Window* pParent, const ResId& rResId)
203 		:		SvXPropertyControl(pParent,rResId),
204 				aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
205 {
206 	pListener=NULL;
207 	aListBox.SetSelectHdl(
208 		LINK( this, SvXPropertyListBox, ModifiedHdl ));
209 	aListBox.SetGetFocusHdl(
210 		LINK( this, SvXPropertyListBox, GetFocusHdl));
211 	aListBox.SetLoseFocusHdl(
212 		LINK( this, SvXPropertyListBox, LoseFocusHdl));
213 
214 	Size aSize=GetSizePixel();
215 	SetCtrSize(aSize);
216 	aListBox.Show();
217 }
218 
219 void SvXPropertyListBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
220 {
221 	pListener=pCtrListener;
222 }
223 
224 SvXPropertyCtrListener* SvXPropertyListBox::GetSvXPropertyCtrListener()
225 {
226 	return pListener;
227 }
228 
229 
230 void SvXPropertyListBox::SetCtrSize(const Size& rSize)
231 {
232 	SetSizePixel(rSize);
233 	Size aSize=GetOutputSizePixel();
234 	Point aPos(0,0);
235 	aListBox.SetPosPixel(aPos);
236 	aListBox.SetSizePixel(aSize);
237 }
238 
239 void SvXPropertyListBox::SetLocked(sal_Bool bLocked)
240 {
241 	if(bLocked)
242 		Disable();
243 	else
244 		Enable();
245 }
246 
247 void SvXPropertyListBox::SetProperty(const String &rString)
248 {
249 	aListBox.SelectEntry(rString);
250 }
251 
252 String SvXPropertyListBox::GetProperty()const
253 {
254 	return aListBox.GetSelectEntry();
255 }
256 
257 sal_Bool SvXPropertyListBox::HasList()
258 {
259 	return sal_True;
260 }
261 
262 
263 void SvXPropertyListBox::ClearList()
264 {
265 	aListBox.Clear();
266 }
267 
268 void SvXPropertyListBox::InsertEntry( const String& rString,sal_uInt16 nPos)
269 {
270 	aListBox.InsertEntry(rString,nPos);
271 }
272 
273 void SvXPropertyListBox::SetMyName(const String &rString)
274 {
275 	aName=rString;
276 }
277 
278 String SvXPropertyListBox::GetMyName()const
279 {
280 	return aName;
281 }
282 
283 void SvXPropertyListBox::SetMyData(void* pDat)
284 {
285 	pData=pDat;
286 }
287 
288 void* SvXPropertyListBox::GetMyData()
289 {
290 	return pData;
291 }
292 
293 IMPL_LINK( SvXPropertyListBox, ModifiedHdl, ListBox*, EMPTYARG )
294 {
295 	if(pListener!=NULL)
296 		pListener->Modified(this);
297 	return 0;
298 }
299 
300 IMPL_LINK( SvXPropertyListBox, GetFocusHdl, ListBox*, EMPTYARG )
301 {
302 	if(pListener!=NULL)
303 		pListener->GetFocus(this);
304 	return 0;
305 }
306 
307 IMPL_LINK( SvXPropertyListBox, LoseFocusHdl, ListBox*, EMPTYARG )
308 {
309 	if(pListener!=NULL)
310 		pListener->LoseFocus(this);
311 	return 0;
312 }
313 
314 //------------------------------------------------------------------
315 
316 
317 SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, WinBits nWinStyle)
318 		:		SvXPropertyControl(pParent,nWinStyle),
319 				aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
320 {
321 	pListener=NULL;
322 	aComboBox.SetModifyHdl(
323 		LINK( this, SvXPropertyComboBox, ModifiedHdl ));
324 	aComboBox.SetGetFocusHdl(
325 		LINK( this, SvXPropertyComboBox, GetFocusHdl));
326 	aComboBox.SetLoseFocusHdl(
327 		LINK( this, SvXPropertyComboBox, LoseFocusHdl));
328 	aComboBox.Show();
329 }
330 
331 SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, const ResId& rResId)
332 		:		SvXPropertyControl(pParent,rResId),
333 				aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
334 {
335 	pListener=NULL;
336 	aComboBox.SetModifyHdl(
337 		LINK( this, SvXPropertyComboBox, ModifiedHdl ));
338 	aComboBox.SetGetFocusHdl(
339 		LINK( this, SvXPropertyComboBox, GetFocusHdl));
340 	aComboBox.SetLoseFocusHdl(
341 		LINK( this, SvXPropertyComboBox, LoseFocusHdl));
342 
343 	Size aSize=GetSizePixel();
344 	SetCtrSize(aSize);
345 	aComboBox.Show();
346 }
347 
348 void SvXPropertyComboBox::SetLocked(sal_Bool bLocked)
349 {
350 	if(bLocked)
351 		Disable();
352 	else
353 		Enable();
354 }
355 
356 void SvXPropertyComboBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
357 {
358 	pListener=pCtrListener;
359 }
360 
361 SvXPropertyCtrListener* SvXPropertyComboBox::GetSvXPropertyCtrListener()
362 {
363 	return pListener;
364 }
365 
366 
367 void SvXPropertyComboBox::SetCtrSize(const Size& rSize)
368 {
369 	SetSizePixel(rSize);
370 	Size aSize=GetOutputSizePixel();
371 	Point aPos(0,0);
372 	aComboBox.SetPosPixel(aPos);
373 	aComboBox.SetSizePixel(aSize);
374 }
375 
376 
377 void SvXPropertyComboBox::SetProperty(const String &rString)
378 {
379 	aComboBox.SetText(rString);
380 }
381 
382 String SvXPropertyComboBox::GetProperty()	const
383 {
384 	return aComboBox.GetText();
385 }
386 
387 sal_Bool SvXPropertyComboBox::HasList()
388 {
389 	return sal_True;
390 }
391 
392 void SvXPropertyComboBox::ClearList()
393 {
394 	aComboBox.Clear();
395 }
396 
397 void SvXPropertyComboBox::InsertEntry( const String& rString,sal_uInt16 nPos)
398 {
399 	aComboBox.InsertEntry(rString,nPos);
400 }
401 
402 void SvXPropertyComboBox::SetMyName(const String &rString)
403 {
404 	aName=rString;
405 }
406 
407 String SvXPropertyComboBox::GetMyName()const
408 {
409 	return aName;
410 }
411 
412 void SvXPropertyComboBox::SetMyData(void* pDat)
413 {
414 	pData=pDat;
415 }
416 
417 void* SvXPropertyComboBox::GetMyData()
418 {
419 	return pData;
420 }
421 
422 IMPL_LINK( SvXPropertyComboBox, ModifiedHdl, ComboBox*, EMPTYARG )
423 {
424 	if(pListener!=NULL)
425 		pListener->Modified(this);
426 	return 0;
427 }
428 
429 IMPL_LINK( SvXPropertyComboBox, GetFocusHdl, ComboBox*, EMPTYARG )
430 {
431 	if(pListener!=NULL)
432 		pListener->GetFocus(this);
433 	return 0;
434 }
435 
436 IMPL_LINK( SvXPropertyComboBox, LoseFocusHdl, ComboBox*, EMPTYARG )
437 {
438 	if(pListener!=NULL)
439 		pListener->LoseFocus(this);
440 	return 0;
441 }
442 //------------------------------------------------------------------
443 
444 SvPropertyLine::SvPropertyLine( Window* pParent,WinBits nWinStyle)
445 		:	Control(pParent,nWinStyle),
446 			aName(this,WB_BORDER),
447 			pSvXPropertyControl(NULL),
448 			aXButton(this,WB_BORDER),
449 			bIsLocked(sal_False),
450 			bIsHyperlink(sal_False)
451 {
452 	bNeedsRepaint = sal_True;
453 	bHasXButton = sal_False;
454 	aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) );
455 	aName.Show();
456 	aXButton.Show();
457 	eKindOfCtr = KOC_UNDEFINED;
458 	Wallpaper aWall = GetBackground();
459 	aWall.SetColor( Color( COL_TRANSPARENT ) );
460 	SetBackground( aWall );
461 }
462 
463 SvPropertyLine::SvPropertyLine( Window* pParent,const ResId& rResId )
464 		:	Control(pParent,rResId),
465 			aName		(this,WB_BORDER),
466 			pSvXPropertyControl(NULL),
467 			aXButton	(this,WB_BORDER),
468 			bIsLocked(sal_False),
469 			bIsHyperlink(sal_False)
470 {
471 	bNeedsRepaint = sal_True;
472 	bHasXButton = sal_False;
473 	eKindOfCtr = KOC_UNDEFINED;
474 	aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) );
475 	aName.Show();
476 	aXButton.Show();
477 	Wallpaper aWall = GetBackground();
478 	aWall.SetColor( Color( COL_TRANSPARENT ) );
479 	SetBackground( aWall );
480 	Resize();
481 }
482 
483 void SvPropertyLine::SetSvXPropertyControl(SvXPropertyControl* pXControl)
484 {
485 	pSvXPropertyControl=pXControl;
486 	pSvXPropertyControl->Show();
487 	Resize();
488 }
489 
490 SvXPropertyControl* SvPropertyLine::GetSvXPropertyControl()
491 {
492 	return pSvXPropertyControl;
493 }
494 
495 void SvPropertyLine::Resize()
496 {
497 	Size aSize=GetOutputSizePixel();
498 	Size a2Size=aSize;
499 
500 	aSize.Width()=nNameWidth;
501 	a2Size.Width()-=nNameWidth;
502 
503 	Point aPos(0,0);
504 	aName.SetPosPixel(aPos);
505 	aName.SetSizePixel(aSize);
506 
507 	sal_uInt16 nXButtonWidth=0;
508 
509 	if(bHasXButton)
510 	{
511 		nXButtonWidth=(sal_uInt16)aSize.Height();
512 	}
513 	a2Size.Width()=a2Size.Width()-nXButtonWidth;
514 
515 	aPos.X()+=aSize.Width();
516 
517 	if(pSvXPropertyControl!=NULL)
518 	{
519 		pSvXPropertyControl->SetPosPixel(aPos);
520 		pSvXPropertyControl->SetCtrSize(a2Size);
521 	}
522 
523 	if(bHasXButton)
524 	{
525 		aPos.X()=GetOutputSizePixel().Width()
526 					-nXButtonWidth;
527 		aSize.Width()=nXButtonWidth;
528 		aXButton	.SetSizePixel(aSize);
529 		aXButton	.SetPosPixel(aPos);
530 	}
531 }
532 
533 void SvPropertyLine::SetNeedsRepaint(sal_Bool bFlag)
534 {
535 	bNeedsRepaint=bFlag;
536 }
537 
538 sal_Bool SvPropertyLine::NeedsRepaint()
539 {
540 	return bNeedsRepaint;
541 }
542 
543 void SvPropertyLine::SetName(const String& rString )
544 {
545 	aName.SetText(rString);
546 	aName.Invalidate();
547 }
548 
549 String SvPropertyLine::GetName() const
550 {
551 	return aName.GetText();
552 }
553 
554 void SvPropertyLine::SetKindOfControl(eKindOfControl eKOC)
555 {
556 	eKindOfCtr=eKOC;
557 }
558 
559 eKindOfControl SvPropertyLine::GetKindOfControl()
560 {
561 	return eKindOfCtr;
562 }
563 
564 void SvPropertyLine::ShowXButton()
565 {
566 	bHasXButton=sal_True;
567 	aXButton.Show();
568 	Resize();
569 }
570 void SvPropertyLine::HideXButton()
571 {
572 	bHasXButton=sal_False;
573 	aXButton.Hide();
574 	Resize();
575 }
576 sal_Bool SvPropertyLine::IsVisibleXButton()
577 {
578 	return bHasXButton;
579 }
580 
581 void SvPropertyLine::ShowAsHyperLink(sal_Bool nFlag)
582 {
583 	bIsHyperlink=nFlag;
584 	if(nFlag)
585 	{
586 		Font aFont=GetFont();
587 		aFont.SetUnderline(UNDERLINE_SINGLE);
588 		aFont.SetColor(Color(COL_BLUE));
589 		aName.SetFont(aFont);
590 	}
591 	else
592 	{
593 		Font aFont=GetFont();
594 		aName.SetFont(aFont);
595 	}
596 }
597 
598 sal_Bool SvPropertyLine::IsShownAsHyperlink()
599 {
600 	return bIsHyperlink;
601 }
602 
603 void SvPropertyLine::Locked(sal_Bool nFlag)
604 {
605 	bIsLocked=nFlag;
606 	if(pSvXPropertyControl!=NULL)
607 		pSvXPropertyControl->SetLocked(nFlag);
608 }
609 
610 sal_Bool SvPropertyLine::IsLineLocked()
611 {
612 	return bIsLocked;
613 }
614 
615 void SvPropertyLine::SetNameWidth(sal_uInt16 nWidth)
616 {
617 	nNameWidth=nWidth;
618 	Resize();
619 }
620 
621 void SvPropertyLine::SetClickHdl(const Link& rLink)
622 {
623 	aXButton.SetClickHdl(rLink );
624 }
625 
626 //----------------------------------------------------------
627 
628 SvXPropEvListener::SvXPropEvListener()
629 {
630 	pTheActiveControl=NULL;
631 }
632 
633 SvXPropEvListener::~SvXPropEvListener()
634 {
635 }
636 
637 void SvXPropEvListener::Modified (SvXPropertyControl *pSvXPCtr)
638 {
639 	pTheActiveControl=pSvXPCtr;
640 	aModifyLink.Call(this);
641 }
642 
643 void SvXPropEvListener::GetFocus (SvXPropertyControl *pSvXPCtr)
644 {
645 	pTheActiveControl=pSvXPCtr;
646 	aGetFocusLink.Call(this);
647 }
648 
649 void SvXPropEvListener::LoseFocus (SvXPropertyControl *pSvXPCtr)
650 {
651 	pTheActiveControl=pSvXPCtr;
652 	aLoseFocusLink.Call(this);
653 }
654 
655 void SvXPropEvListener::KeyInput (SvXPropertyControl *pSvXPCtr,const KeyCode& theKeyCode)
656 {
657 	pTheActiveControl=pSvXPCtr;
658 	aKeyCode=theKeyCode;
659 	aKeyInputLink.Call(this);
660 }
661 
662 SvXPropertyControl *	SvXPropEvListener::GetPropertyControl()
663 {
664 	return pTheActiveControl;
665 }
666 
667 KeyCode SvXPropEvListener::GetKeyCode() const
668 {
669 	return aKeyCode;
670 }
671 
672 //------------------------------------------------------------------
673 
674 SvListBoxForProperties::SvListBoxForProperties( Window* pParent, WinBits nWinStyle)
675 		:	Control(pParent,nWinStyle),
676 			aPlayGround(this,WB_DIALOGCONTROL),
677 			aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG),
678 			pPropDataControl(NULL)
679 {
680 
681 	aListener.SetModifyHdl	 (LINK( this, SvListBoxForProperties,	ModifyHdl));
682 	aListener.SetGetFocusHdl (LINK( this, SvListBoxForProperties, GetFocusHdl));
683 	aListener.SetLoseFocusHdl(LINK( this, SvListBoxForProperties,LoseFocusHdl));
684 	aListener.SetKeyInputHdl (LINK( this, SvListBoxForProperties, KeyInputHdl));
685 
686 	nYOffset=0;
687 	nTheNameSize=0;
688 	ListBox aListBox(this,WB_DROPDOWN);
689 	aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
690 	nRowHeight=(sal_uInt16)aListBox.GetSizePixel().Height();
691 	Wallpaper aWall = aPlayGround.GetBackground();
692 	aWall.SetColor( Color( COL_TRANSPARENT ) );
693 	aPlayGround.SetBackground( aWall );
694 	aPlayGround.Show();
695 	aVScroll.Hide();
696 	aVScroll.SetScrollHdl(
697 		LINK( this, SvListBoxForProperties, ScrollHdl ));
698 
699 }
700 
701 
702 SvListBoxForProperties::SvListBoxForProperties( Window* pParent, const ResId& rResId )
703 			:		Control(pParent,rResId),
704 					aPlayGround(this,0),
705 					aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG),
706 					pPropDataControl(NULL)
707 {
708 	nTheNameSize=0;
709 	nYOffset=0;
710 	ListBox aListBox(this,WB_DROPDOWN);
711 	aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
712 	nRowHeight=(sal_uInt16)aListBox.GetSizePixel().Height();
713 	Wallpaper aWall = aPlayGround.GetBackground();
714 	aWall.SetColor( Color( COL_TRANSPARENT ) );
715 	aPlayGround.SetBackground( aWall );
716 	aPlayGround.Show();
717 	aVScroll.Hide();
718 	aVScroll.SetScrollHdl( LINK( this, SvListBoxForProperties, ScrollHdl ) );
719 	UpdateVScroll();
720 	Resize();
721 }
722 
723 SvListBoxForProperties::~SvListBoxForProperties()
724 {
725 	Clear();
726 }
727 
728 void SvListBoxForProperties::Clear()
729 {
730 	for(sal_uInt16 i=0;i<PLineArray.Count();i++)
731 	{
732 		SvPropertyLine* pPropLine=PLineArray[i];
733 
734 		switch(pPropLine->GetKindOfControl())
735 		{
736 			case	KOC_LISTBOX:
737 			case	KOC_COMBOBOX:
738 			case	KOC_EDIT:		delete pPropLine->GetSvXPropertyControl();
739 									break;
740 			default:
741 									break;
742 		}
743 		delete pPropLine;
744 	}
745 	PLineArray.Remove(0,PLineArray.Count());
746 }
747 
748 
749 void SvListBoxForProperties::Resize()
750 {
751 	Size aSize=GetOutputSizePixel();
752 	Size a2Size=aSize;
753 	Size aVScrollSize;
754 
755 	if(aVScroll.IsVisible())
756 	{
757 		Point aPos(0,0);
758 		aVScrollSize=aVScroll.GetSizePixel();
759 		aVScrollSize.Height()=aSize.Height();
760 		a2Size.Width()-=aVScrollSize.Width();
761 		aPos.X()=a2Size.Width();
762 		aVScroll.SetPosPixel(aPos);
763 		aVScroll.SetSizePixel(aVScrollSize);
764 	}
765 
766 	aPlayGround.SetPosPixel(Point(0,0));
767 	aPlayGround.SetSizePixel(a2Size);
768 	UpdatePosNSize();
769 }
770 
771 void SvListBoxForProperties::SetController( SvPropertyDataControl *pPDC)
772 {
773 	pPropDataControl=pPDC;
774 }
775 
776 sal_uInt16 SvListBoxForProperties::CalcVisibleLines()
777 {
778 	Size aSize=aPlayGround.GetOutputSizePixel();
779 	sal_uInt16 nResult=0;
780 	if(nRowHeight!=0)
781 		nResult=(sal_uInt16) aSize.Height()/nRowHeight;
782 
783 	return nResult;
784 }
785 
786 void SvListBoxForProperties::UpdateVScroll()
787 {
788 	sal_uInt16 nLines=CalcVisibleLines();
789 	aVScroll.SetPageSize(nLines-1);
790 	aVScroll.SetVisibleSize(nLines-1);
791 	aVScroll.SetRange(Range(0,PLineArray.Count()-1));
792 	if(PLineArray.Count()<=nLines)
793 	{
794 		aVScroll.Hide();
795 	}
796 	else
797 	{
798 		sal_Bool bFlag=aVScroll.IsVisible();
799 		aVScroll.Show();
800 		if(!bFlag)Resize();
801 	}
802 
803 
804 }
805 
806 void SvListBoxForProperties::UpdatePosNSize()
807 {
808 	Point aPos(0,nYOffset);
809 
810 	for(sal_uInt16 i=0; i<PLineArray.Count();i++)
811 	{
812 		if((PLineArray[i])->NeedsRepaint())
813 		{
814 			(PLineArray[i])->SetPosPixel(aPos);
815 			Size aSize=aPlayGround.GetOutputSizePixel();
816 			aSize.Height()=nRowHeight;
817 			(PLineArray[i])->SetSizePixel(aSize);
818 			(PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
819 			(PLineArray[i])->Invalidate();
820 			(PLineArray[i])->Update();
821 			(PLineArray[i])->Show();
822 			(PLineArray[i])->SetNeedsRepaint(sal_False);
823 		}
824 		else
825 		{
826 			if((PLineArray[i])->IsVisible())
827 			{
828 				Size aSize=aPlayGround.GetOutputSizePixel();
829 				aSize.Height()=nRowHeight;
830 				(PLineArray[i])->SetSizePixel(aSize);
831 				(PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
832 				(PLineArray[i])->Invalidate();
833 			}
834 		}
835 
836 		aPos.Y()+=nRowHeight;
837 	}
838 	aPlayGround.Invalidate();
839 	aPlayGround.Update();
840 }
841 
842 void SvListBoxForProperties::UpdatePlayGround()
843 {
844 	Point aPos(0,0);
845 	long nThumbPos=aVScroll.GetThumbPos();
846 	long nLines=aVScroll.GetPageSize();
847 	long nDelta=aVScroll.GetDelta();
848 
849 	sal_uInt16 nStart,nEnd;
850 	Size aSize=aPlayGround.GetOutputSizePixel();
851 	Point aPEnd;
852 	aPEnd.X()=aSize.Width();
853 
854 	if(nDelta>0)
855 	{
856 		nStart=(sal_uInt16)(nThumbPos+nLines+1-nDelta);
857 		nEnd=(sal_uInt16)(nThumbPos+nLines);
858 		aPos.Y()=(nLines+1-nDelta)*nRowHeight;
859 	}
860 	else
861 	{
862 		nStart=(sal_uInt16)nThumbPos;
863 		nEnd=(sal_uInt16)(nThumbPos-nDelta);
864 		aPEnd.Y()=(nThumbPos-nDelta)*nRowHeight;;
865 	}
866 
867 	aSize.Height()=nRowHeight;
868 
869 	nDelta=-nDelta*nRowHeight;
870 
871 	aPlayGround.Scroll(0,nDelta,SCROLL_CHILDREN);
872 
873 	for(sal_uInt16 i=nStart; i<=nEnd;i++)
874 	{
875 		(PLineArray[i])->SetPosSizePixel(aPos,aSize);
876 		(PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
877 		(PLineArray[i])->Show();
878 		aPos.Y()+=nRowHeight;
879 	}
880 	aPlayGround.Update();
881 }
882 
883 void SvListBoxForProperties::UpdateAll()
884 {
885 	UpdatePosNSize();
886 	UpdatePlayGround();
887 	//UpdateVScroll();
888 }
889 
890 void SvListBoxForProperties::DisableUpdate()
891 {
892 	bUpdate=sal_False;
893 }
894 
895 void SvListBoxForProperties::EnableUpdate()
896 {
897 	bUpdate=sal_True;
898 	UpdateAll();
899 }
900 
901 void SvListBoxForProperties::SetPropertyValue( const String & rEntryName, const String & rValue )
902 {
903 	sal_uInt16 i, iEnd = PLineArray.Count();
904 	for( i = 0 ; i < iEnd ; i++ )
905 	{
906 		SvPropertyLine* pPropLine = PLineArray[ i ];
907 		SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
908 		if( pSvXPCtr && pSvXPCtr->GetMyName() == rEntryName )
909 		{
910 			pSvXPCtr->SetProperty( rValue );
911 		}
912 	}
913 }
914 
915 sal_uInt16 SvListBoxForProperties::AppendEntry( const SvPropertyData& aPropData)
916 {
917 	return InsertEntry(aPropData);
918 }
919 
920 sal_uInt16 SvListBoxForProperties::InsertEntry( const SvPropertyData& aPropData, sal_uInt16 nPos)
921 {
922 	sal_uInt16 nInsPos=nPos;
923 	SvPropertyLine* pPropLine=new SvPropertyLine(&aPlayGround,WB_TABSTOP | WB_DIALOGCONTROL);
924 
925 	if(nPos==LISTBOX_APPEND)
926 	{
927 		nInsPos=PLineArray.Count();
928 		PLineArray.Insert(pPropLine,nInsPos);
929 	}
930 	else
931 	{
932 		PLineArray.Insert(pPropLine,nPos);
933 	}
934 	pPropLine->SetNameWidth(nTheNameSize);
935 	UpdateVScroll();
936 	UpdatePosNSize();
937 	ChangeEntry(aPropData,nInsPos);
938 	return nInsPos;
939 }
940 
941 void SvListBoxForProperties::ChangeEntry( const SvPropertyData& aPropData, sal_uInt16 nPos)
942 {
943 	if(nPos<PLineArray.Count())
944 	{
945 		SvPropertyLine* pPropLine=PLineArray[nPos];
946 
947 		switch(pPropLine->GetKindOfControl())
948 		{
949 			case	KOC_LISTBOX:
950 			case	KOC_COMBOBOX:
951 			case	KOC_EDIT:		delete pPropLine->GetSvXPropertyControl();
952 									break;
953 			default:
954 									break;
955 		}
956 
957 		switch(aPropData.eKind)
958 		{
959 			case	KOC_LISTBOX:
960 									pPropLine->SetSvXPropertyControl(
961 											new SvXPropertyComboBox(pPropLine,WB_TABSTOP));
962 									pPropLine->SetKindOfControl(aPropData.eKind);
963 									break;
964 			case	KOC_COMBOBOX:
965 									pPropLine->SetSvXPropertyControl(
966 											new SvXPropertyComboBox(pPropLine,WB_TABSTOP));
967 									pPropLine->SetKindOfControl(aPropData.eKind);
968 									break;
969 			case	KOC_EDIT:
970 									pPropLine->SetSvXPropertyControl(
971 											new SvXPropertyEdit(pPropLine,WB_TABSTOP));
972 									pPropLine->SetKindOfControl(aPropData.eKind);
973 									break;
974 			case	KOC_USERDEFINED:
975 									pPropLine->SetSvXPropertyControl(aPropData.pControl);
976 									aPropData.pControl->SetParent(pPropLine);
977 									pPropLine->SetKindOfControl(aPropData.eKind);
978 									break;
979 			default:
980 									pPropLine->SetSvXPropertyControl(NULL);
981 									pPropLine->SetKindOfControl(KOC_UNDEFINED);
982 									break;
983 		}
984 
985 		SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
986 
987 		if(pSvXPCtr!=NULL)
988 		{
989 			pSvXPCtr->SetSvXPropertyCtrListener(&aListener);
990 			pSvXPCtr->SetProperty(aPropData.aValue);
991 			pSvXPCtr->SetMyData(aPropData.pDataPtr);
992 			pSvXPCtr->SetMyName(aPropData.aName);
993 
994 			if(pSvXPCtr->HasList())
995 			{
996 				for(sal_uInt16 i=0;i<aPropData.theValues.Count();i++)
997 				{
998 					pSvXPCtr->InsertEntry(*(aPropData.theValues[i]));
999 				}
1000 			}
1001 		}
1002 
1003 		pPropLine->SetName(aPropData.aName);
1004 
1005 		sal_uInt16 nTextWidth=(sal_uInt16)aPlayGround.GetTextWidth(aPropData.aName);
1006 
1007 		if ( nTheNameSize < nTextWidth )
1008 			nTheNameSize = nTextWidth;
1009 
1010 		if ( aPropData.bHasVisibleXButton )
1011 		{
1012 			pPropLine->SetClickHdl(LINK( this, SvListBoxForProperties, ClickHdl ) );
1013 			pPropLine->ShowXButton();
1014 		}
1015 		else
1016 			pPropLine->HideXButton();
1017 
1018 		pPropLine->Locked(aPropData.bIsLocked);
1019 
1020 		pPropLine->ShowAsHyperLink(aPropData.bIsHyperLink);
1021 		pPropLine->SetData(aPropData.pDataPtr);
1022 	}
1023 }
1024 
1025 sal_uInt16 SvListBoxForProperties::GetFirstVisibleEntry()
1026 {
1027 	return 0;
1028 }
1029 void SvListBoxForProperties::SetFirstVisibleEntry(sal_uInt16)
1030 {
1031 	return;
1032 }
1033 
1034 void SvListBoxForProperties::SetSelectedEntry(sal_uInt16)
1035 {
1036 	return;
1037 }
1038 
1039 sal_uInt16 SvListBoxForProperties::GetSelectedEntry()
1040 {
1041 	return 0;
1042 }
1043 
1044 IMPL_LINK( SvListBoxForProperties, ScrollHdl, ScrollBar*, pSB )
1045 {
1046 	if(pSB!=NULL)
1047 	{
1048 		long nDelta=aVScroll.GetDelta();
1049 		nYOffset=-aVScroll.GetThumbPos()*nRowHeight;
1050 		//aPlayGround.SetUpdateMode(sal_False);
1051 
1052 		long nThumbPos=aVScroll.GetThumbPos();
1053 		long nLines=aVScroll.GetPageSize();
1054 
1055 		UpdatePlayGround();
1056 
1057 		for(long i=nThumbPos-nDelta; i<nThumbPos+nLines-nDelta;i++)
1058 		{
1059 			if(i>=nThumbPos && i<=nThumbPos+nLines)
1060 			{
1061 				(PLineArray[sal::static_int_cast< sal_uInt16 >(i)])->
1062                     SetNeedsRepaint(sal_True);
1063 			}
1064 			else
1065 			{
1066 				(PLineArray[sal::static_int_cast< sal_uInt16 >(i)])->Hide();
1067 				(PLineArray[sal::static_int_cast< sal_uInt16 >(i)])->
1068                     SetNeedsRepaint(sal_False);
1069 			}
1070 		}
1071 	}
1072 	return 0;
1073 }
1074 
1075 IMPL_LINK( SvListBoxForProperties, ClickHdl, PushButton*,pPB)
1076 {
1077 	if(pPB!=NULL)
1078 	{
1079 	   SvPropertyLine *pPropLine=(SvPropertyLine *)pPB->GetParent();
1080 	   SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
1081 	   pPropDataControl->Clicked(pSvXPCtr->GetMyName(),
1082 							pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
1083 	}
1084 	return 0;
1085 }
1086 
1087 IMPL_LINK( SvListBoxForProperties, ModifyHdl,SvXPropEvListener*, pSvXPEvL)
1088 {
1089 	if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
1090 	{
1091 
1092 		SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
1093 
1094 		pPropDataControl->Modified(pSvXPCtr->GetMyName(),
1095 							pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
1096 
1097 	}
1098 	return 0;
1099 }
1100 
1101 IMPL_LINK( SvListBoxForProperties, GetFocusHdl,SvXPropEvListener*, pSvXPEvL)
1102 {
1103 	if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
1104 	{
1105 		SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
1106 
1107 		pPropDataControl->Select(pSvXPCtr->GetMyName(),pSvXPCtr->GetMyData());
1108 	}
1109 	return 0;
1110 }
1111 
1112 IMPL_LINK( SvListBoxForProperties, LoseFocusHdl,SvXPropEvListener*, pSvXPEvL)
1113 {
1114 	if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
1115 	{
1116 		SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
1117 
1118 		pPropDataControl->Commit(pSvXPCtr->GetMyName(),
1119 					pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
1120 		/*
1121 		{
1122 			pSvXPCtr->SetProperty(
1123 				pPropDataControl->GetTheCorrectProperty());
1124 		}
1125 		*/
1126 	}
1127 	return 0;
1128 }
1129 
1130 IMPL_LINK( SvListBoxForProperties, KeyInputHdl,SvXPropEvListener*, pSvXPEvL)
1131 {
1132 		//  FIXME  - This code does not make a lot of sense.
1133 	if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
1134 	{
1135 		/*SvXPropertyControl* pSvXPCtr=*/aListener.GetPropertyControl();
1136 	}
1137 	return 0;
1138 }
1139 
1140 
1141 
1142 
1143 SvTabPageForProperties::SvTabPageForProperties(Window* pParent,WinBits nWinStyle)
1144 			:	TabPage(pParent,nWinStyle),
1145 				aLbProp(this)
1146 {
1147 	aLbProp.Show();
1148 }
1149 
1150 void SvTabPageForProperties::Resize()
1151 {
1152 	Point aPos(3,3);
1153 	Size aSize=GetOutputSizePixel();
1154 	aSize.Width()-=6;
1155 	aSize.Height()-=6;
1156 
1157 	aLbProp.SetPosSizePixel(aPos,aSize);
1158 }
1159 
1160 SvListBoxForProperties* SvTabPageForProperties::GetTheListBox()
1161 {
1162 	return &aLbProp;
1163 }
1164 
1165 
1166 SvPropertyBox::SvPropertyBox( Window* pParent, WinBits nWinStyle)
1167 			: Control(pParent,nWinStyle),
1168 			  aTabControl(this)
1169 {
1170 	aTabControl.Show();
1171 }
1172 
1173 SvPropertyBox::SvPropertyBox( Window* pParent, const ResId& rResId )
1174 			: Control(pParent,rResId),
1175 			  aTabControl(this)
1176 {
1177 	aTabControl.Show();
1178 	Resize();
1179 }
1180 
1181 SvPropertyBox::~SvPropertyBox()
1182 {
1183 	ClearAll();
1184 }
1185 
1186 
1187 void SvPropertyBox::ClearAll()
1188 {
1189 	sal_uInt16 nCount=aTabControl.GetPageCount();
1190 
1191 	for(sal_uInt16 i=nCount;i>=1;i--)
1192 	{
1193 		SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1194 									aTabControl.GetTabPage(i);
1195 		aTabControl.RemovePage(i);
1196 		delete pPage;
1197 	}
1198 }
1199 
1200 
1201 void SvPropertyBox::Resize()
1202 {
1203 	Point aPos(3,3);
1204 	Size aSize=GetOutputSizePixel();
1205 	aSize.Width()-=6;
1206 	aSize.Height()-=6;
1207 
1208 	aTabControl.SetPosSizePixel(aPos,aSize);
1209 
1210 	sal_uInt16 nCount=aTabControl.GetPageCount();
1211 
1212 	aSize=aTabControl.GetTabPageSizePixel();
1213 	for(sal_uInt16 i=1;i<=nCount;i++)
1214 	{
1215 		SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1216 									aTabControl.GetTabPage(i);
1217 		pPage->SetSizePixel(aSize);
1218 	}
1219 
1220 }
1221 
1222 
1223 sal_uInt16 SvPropertyBox::AppendPage( const String & rText )
1224 {
1225 	sal_uInt16 nId=aTabControl.GetPageCount()+1;
1226 	aTabControl.InsertPage( nId,rText);
1227 	SvTabPageForProperties* pPage=new SvTabPageForProperties(&aTabControl);
1228 	pPage->SetSizePixel(aTabControl.GetTabPageSizePixel());
1229 	pPage->GetTheListBox()->SetController(pThePropDataCtr);
1230 	aTabControl.SetTabPage( nId, pPage);
1231 	aTabControl.SetCurPageId(nId);
1232 	return nId;
1233 }
1234 
1235 void SvPropertyBox::SetPage( sal_uInt16 nId)
1236 {
1237 	aTabControl.SetCurPageId(nId);
1238 }
1239 
1240 sal_uInt16 SvPropertyBox::GetCurPage()
1241 {
1242 	return aTabControl.GetCurPageId();
1243 }
1244 
1245 sal_uInt16 SvPropertyBox::CalcVisibleLines()
1246 {
1247 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1248 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1249 	return pPage->GetTheListBox()->CalcVisibleLines();
1250 }
1251 void SvPropertyBox::EnableUpdate()
1252 {
1253 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1254 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1255 	pPage->GetTheListBox()->EnableUpdate();
1256 }
1257 
1258 void SvPropertyBox::DisableUpdate()
1259 {
1260 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1261 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1262 	pPage->GetTheListBox()->DisableUpdate();
1263 }
1264 
1265 void SvPropertyBox::SetController(SvPropertyDataControl *pDataCtr)
1266 {
1267 	pThePropDataCtr=pDataCtr;
1268 	sal_uInt16 nCount=aTabControl.GetPageCount();
1269 
1270 	for(sal_uInt16 i=1;i<=nCount;i++)
1271 	{
1272 		SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1273 									aTabControl.GetTabPage(i);
1274 
1275 		pPage->GetTheListBox()->SetController(pThePropDataCtr);
1276 	}
1277 
1278 }
1279 
1280 sal_uInt16 SvPropertyBox::InsertEntry( const SvPropertyData& rData, sal_uInt16 nPos)
1281 {
1282 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1283 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1284 	return pPage->GetTheListBox()->InsertEntry(rData,nPos);
1285 }
1286 
1287 void SvPropertyBox::ChangeEntry( const SvPropertyData& rData, sal_uInt16 nPos)
1288 {
1289 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1290 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1291 	pPage->GetTheListBox()->ChangeEntry(rData,nPos);
1292 }
1293 
1294 sal_uInt16 SvPropertyBox::AppendEntry( const SvPropertyData& rData)
1295 {
1296 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1297 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1298 	return pPage->GetTheListBox()->AppendEntry(rData);
1299 }
1300 
1301 void SvPropertyBox::SetPropertyValue( const String & rEntryName, const String & rValue )
1302 {
1303 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1304 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1305 	pPage->GetTheListBox()->SetPropertyValue( rEntryName, rValue );
1306 }
1307 
1308 void SvPropertyBox::SetFirstVisibleEntry(sal_uInt16 nPos)
1309 {
1310 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1311 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1312 	pPage->GetTheListBox()->SetFirstVisibleEntry(nPos);
1313 }
1314 sal_uInt16 SvPropertyBox::GetFirstVisibleEntry()
1315 {
1316 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1317 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1318 	return pPage->GetTheListBox()->GetFirstVisibleEntry();
1319 }
1320 
1321 void SvPropertyBox::SetSelectedEntry(sal_uInt16 nPos)
1322 {
1323 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1324 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1325 	pPage->GetTheListBox()->SetSelectedEntry(nPos);
1326 }
1327 sal_uInt16 SvPropertyBox::GetSelectedEntry()
1328 {
1329 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1330 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1331 	return pPage->GetTheListBox()->GetSelectedEntry();
1332 }
1333 
1334 void SvPropertyBox::ClearTable()
1335 {
1336 	SvTabPageForProperties* pPage=(SvTabPageForProperties*)
1337 				aTabControl.GetTabPage(aTabControl.GetCurPageId());
1338 	pPage->GetTheListBox()->Clear();
1339 }
1340 
1341 SvBasicPropertyDataControl::~SvBasicPropertyDataControl()
1342 {
1343 }
1344 
1345 void SvBasicPropertyDataControl::Modified(const String& aName,
1346 								const String& aVal,void* pData)
1347 {
1348 	aEntryName=aName;
1349 	aEntryProperty=aVal;
1350 	pTheData=pData;
1351 	aModifyLink.Call(this);
1352 }
1353 
1354 void SvBasicPropertyDataControl::Clicked(	const String& aName,
1355 									const String& aVal,
1356 									void* pData)		//Xtension-Button pressed
1357 {
1358 	aEntryName=aName;
1359 	aEntryProperty=aVal;
1360 	pTheData=pData;
1361 	aClickedLink.Call(this);
1362 }
1363 
1364 void SvBasicPropertyDataControl::Commit(		const String& aName,
1365 									const String& aVal,
1366 									void* pData)		//User accept changes
1367 {
1368 	aEntryName=aName;
1369 	aEntryProperty=aVal;
1370 	pTheData=pData;
1371 	aCommitLink.Call(this);
1372 }
1373 
1374 void SvBasicPropertyDataControl::Select(		const String& aName,
1375 									void* pData)		//User select new Row
1376 {
1377 	aEntryName=aName;
1378 	pTheData=pData;
1379 	aSelectLink.Call(this);
1380 }
1381 
1382 void SvBasicPropertyDataControl::LinkClicked(const String&, void*)
1383 {
1384 }
1385 
1386 
1387 String	SvBasicPropertyDataControl::GetName() const //Tell's the name of the Property
1388 {
1389 	return aEntryName;
1390 }
1391 
1392 String	SvBasicPropertyDataControl::GetProperty() const //Tell's the content of the Property
1393 {
1394 	return aEntryProperty;
1395 }
1396 
1397 void*	SvBasicPropertyDataControl::GetData() //Tell's the storage
1398 {
1399 	return pTheData;
1400 }
1401 
1402 /*
1403 String SvBasicPropertyDataControl::GetTheCorrectProperty() const
1404 {
1405 	return aCorrectProperty;
1406 }
1407 */
1408 
1409 void SvBasicPropertyDataControl::SetTheCorrectProperty(const String& aString)
1410 {
1411 	aCorrectProperty=aString;
1412 }
1413 
1414 void SvBasicPropertyDataControl::SetIsCorrect(sal_Bool nFlag)
1415 {
1416 	bCorrectness=nFlag;
1417 }
1418 
1419 
1420 
1421 //========================================================================
1422 // Property-Dialog:
1423 /* zum TESTEN im CALC*/
1424 //========================================================================
1425 /*
1426 ScPropertyDlg::ScPropertyDlg( Window* pParent) :
1427 	ModalDialog 	( pParent, ScResId( RID_SCDLG_PROPERTIES) ),
1428 	aPropListBox	( this, ResId( CTR_PROPLINE) ),
1429 	aKindOfListBox	(this,ResId( LB_KIND_OF_PROP)),
1430 	aModAnswer		(this,ResId(FT_ANSMOD	)),
1431 	aClickAnswer	(this,ResId(FT_ANSCLICK )),
1432 	aCommitAnswer	(this,ResId(FT_ANSCOMMIT)),
1433 	aSelectAnswer	(this,ResId(FT_ANSSELECT)),
1434 	anOk(this,ResId( BTN_OK)),
1435 	aCancel(this,ResId( BTN_CANCEL))
1436 {
1437 	FreeResource();
1438 
1439 	aKindOfListBox.SelectEntryPos(0);
1440 	aKindOfListBox.SetSelectHdl(
1441 		LINK( this, ScPropertyDlg, ModifiedHdl ));
1442 	nCount=0;
1443 	nClickCount=0;
1444 
1445 	String aString("Don't know ");
1446 
1447 	aBaProDatCtr.SetModifyHdl (LINK( this, ScPropertyDlg, RowModifiedHdl ));
1448 	aBaProDatCtr.SetClickedHdl(LINK( this, ScPropertyDlg, ClickHdl		 ));
1449 	aBaProDatCtr.SetCommitHdl (LINK( this, ScPropertyDlg, SelectHdl 	 ));
1450 	aBaProDatCtr.SetSelectHdl (LINK( this, ScPropertyDlg, CommitHdl 	 ));
1451 
1452 	aPropListBox.SetController(&aBaProDatCtr);
1453 
1454 	sal_uInt16 nPageId=aPropListBox.AppendPage("YabbaDabbaDo");
1455 	aPropListBox.SetPage(nPageId);
1456 	aProperty.eKind=KOC_EDIT;
1457 	aProperty.aName=aString;
1458 	aProperty.aName+=String((sal_uInt16)++nCount);
1459 	aProperty.aValue=sizeof ComboBox;
1460 	aProperty.bHasVisibleXButton=sal_False;
1461 	aProperty.bIsHyperLink=sal_False;
1462 	aProperty.bIsLocked=sal_False;
1463 	aProperty.pDataPtr=NULL;
1464 	aProperty.pControl=NULL;
1465 	aProperty.theValues.Insert(new String("1"),aProperty.theValues.Count());
1466 	aProperty.theValues.Insert(new String("2"),aProperty.theValues.Count());
1467 	aProperty.theValues.Insert(new String("3"),aProperty.theValues.Count());
1468 	aProperty.theValues.Insert(new String("4"),aProperty.theValues.Count());
1469 	aPropListBox.InsertEntry(aProperty);
1470 	aProperty.bHasVisibleXButton=sal_True;
1471 	aProperty.aName=aString;
1472 	aProperty.aName+=String((sal_uInt16)++nCount);
1473 	aProperty.aValue="42";
1474 	aProperty.eKind=KOC_LISTBOX;
1475 	aPropListBox.InsertEntry(aProperty);
1476 	aProperty.aName=aString;
1477 	aProperty.aName+=String((sal_uInt16)++nCount);
1478 	aProperty.eKind=KOC_COMBOBOX;
1479 	aProperty.bHasVisibleXButton=sal_False;
1480 	aPropListBox.InsertEntry(aProperty);
1481 }
1482 
1483 ScPropertyDlg::~ScPropertyDlg()
1484 {
1485 	delete aProperty.theValues[0];
1486 	delete aProperty.theValues[1];
1487 	delete aProperty.theValues[2];
1488 	delete aProperty.theValues[3];
1489 }
1490 
1491 IMPL_LINK( ScPropertyDlg, ModifiedHdl, ListBox*, pLB )
1492 {
1493 	if(pLB!=NULL)
1494 	{
1495 		String aString("Don't know ");
1496 		aProperty.aName=aString;
1497 		aProperty.aName+=String((sal_uInt16)++nCount);
1498 		if(nCount>20)
1499 		{
1500 			String aStr("Yabba ");
1501 			aStr+=aPropListBox.GetCurPage();
1502 			sal_uInt16 nPageId=aPropListBox.AppendPage(aStr);
1503 			aPropListBox.SetPage(nPageId);
1504 			nCount=0;
1505 		}
1506 
1507 		aProperty.eKind=(eKindOfControl)(aKindOfListBox.GetSelectEntryPos()+1);
1508 		aProperty.bHasVisibleXButton=sal_False;
1509 		if((nCount % 5)==0) aProperty.bHasVisibleXButton=sal_True;
1510 		aPropListBox.InsertEntry(aProperty);
1511 	}
1512 	return 0;
1513 }
1514 
1515 IMPL_LINK( ScPropertyDlg, RowModifiedHdl, SvBasicPropertyDataControl* ,pProCtr)
1516 {
1517 	if(pProCtr!=NULL)
1518 	{
1519 		aModAnswer.SetText(aBaProDatCtr.GetProperty());
1520 		aModAnswer.Invalidate();
1521 		aBaProDatCtr.SetIsCorrect(sal_True);
1522 	}
1523 	return 0;
1524 }
1525 
1526 IMPL_LINK( ScPropertyDlg, CommitHdl, SvBasicPropertyDataControl*,pProCtr)
1527 {
1528 	if(pProCtr!=NULL)
1529 	{
1530 		aCommitAnswer.SetText(aBaProDatCtr.GetProperty());
1531 		aCommitAnswer.Invalidate();
1532 		aBaProDatCtr.SetIsCorrect(sal_True);
1533 	}
1534 	return 0;
1535 }
1536 
1537 IMPL_LINK( ScPropertyDlg, ClickHdl, SvBasicPropertyDataControl*,pProCtr)
1538 {
1539 	if(pProCtr!=NULL)
1540 	{
1541 		aClickAnswer.SetText(aBaProDatCtr.GetName());
1542 		aClickAnswer.Invalidate();
1543 		aBaProDatCtr.SetIsCorrect(sal_True);
1544 	}
1545 	return 0;
1546 }
1547 
1548 IMPL_LINK( ScPropertyDlg, SelectHdl, SvBasicPropertyDataControl*,pProCtr)
1549 {
1550 	if(pProCtr!=NULL)
1551 	{
1552 		aSelectAnswer.SetText(aBaProDatCtr.GetName());
1553 		aSelectAnswer.Invalidate();
1554 		aBaProDatCtr.SetIsCorrect(sal_True);
1555 	}
1556 	return 0;
1557 }
1558 */
1559 
1560 
1561