xref: /aoo41x/main/svx/source/dialog/fontwork.cxx (revision cdf0e10c)
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_svx.hxx"
30 
31 // include ---------------------------------------------------------------
32 #include <sfx2/module.hxx>
33 #include <sfx2/dispatch.hxx>
34 #include <tools/shl.hxx>
35 
36 #define _SVX_FONTWORK_CXX
37 #include <svx/svdobj.hxx>
38 #include <svx/svdopath.hxx>
39 #include <svx/svdview.hxx>
40 #include <svx/svdocirc.hxx>
41 #include <svx/xtextit.hxx>
42 
43 #include <svx/dialmgr.hxx>
44 #include "svx/dlgutil.hxx"
45 
46 #include <svx/dialogs.hrc>
47 #include "fontwork.hrc"
48 #include <svx/fontwork.hxx>
49 #include <editeng/outlobj.hxx>
50 #include <basegfx/polygon/b2dpolygon.hxx>
51 #include <basegfx/point/b2dpoint.hxx>
52 
53 SFX_IMPL_DOCKINGWINDOW( SvxFontWorkChildWindow, SID_FONTWORK );
54 
55 /*************************************************************************
56 |*
57 |* ControllerItem fuer Fontwork
58 |*
59 \************************************************************************/
60 
61 SvxFontWorkControllerItem::SvxFontWorkControllerItem
62 (
63     sal_uInt16 _nId,
64 	SvxFontWorkDialog& rDlg,
65 	SfxBindings& rBindings
66 ) :
67 
68     SfxControllerItem( _nId, rBindings ),
69 
70 	rFontWorkDlg( rDlg )
71 {
72 }
73 
74 /*************************************************************************
75 |*
76 |* StateChanged-Methode fuer FontWork-Items
77 |*
78 \************************************************************************/
79 
80 void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
81 											  const SfxPoolItem* pItem )
82 {
83 	switch ( GetId() )
84 	{
85 		case SID_FORMTEXT_STYLE:
86 		{
87 			const XFormTextStyleItem* pStateItem =
88 								PTR_CAST(XFormTextStyleItem, pItem);
89 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStyleItem erwartet");
90 			rFontWorkDlg.SetStyle_Impl(pStateItem);
91 			break;
92 		}
93 		case SID_FORMTEXT_ADJUST:
94 		{
95 			const XFormTextAdjustItem* pStateItem =
96 								PTR_CAST(XFormTextAdjustItem, pItem);
97 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextAdjustItem erwartet");
98 			rFontWorkDlg.SetAdjust_Impl(pStateItem);
99 			break;
100 		}
101 		case SID_FORMTEXT_DISTANCE:
102 		{
103 			const XFormTextDistanceItem* pStateItem =
104 								PTR_CAST(XFormTextDistanceItem, pItem);
105 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextDistanceItem erwartet");
106 			rFontWorkDlg.SetDistance_Impl(pStateItem);
107 			break;
108 		}
109 		case SID_FORMTEXT_START:
110 		{
111 			const XFormTextStartItem* pStateItem =
112 								PTR_CAST(XFormTextStartItem, pItem);
113 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStartItem erwartet");
114 			rFontWorkDlg.SetStart_Impl(pStateItem);
115 			break;
116 		}
117 		case SID_FORMTEXT_MIRROR:
118 		{
119 			const XFormTextMirrorItem* pStateItem =
120 								PTR_CAST(XFormTextMirrorItem, pItem);
121 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextMirrorItem erwartet");
122 			rFontWorkDlg.SetMirror_Impl(pStateItem);
123 			break;
124 		}
125 		case SID_FORMTEXT_STDFORM:
126 		{
127 			const XFormTextStdFormItem* pStateItem =
128 								PTR_CAST(XFormTextStdFormItem, pItem);
129 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStdFormItem erwartet");
130 			rFontWorkDlg.SetStdForm_Impl(pStateItem);
131 			break;
132 		}
133 		case SID_FORMTEXT_HIDEFORM:
134 		{
135 			const XFormTextHideFormItem* pStateItem =
136 								PTR_CAST(XFormTextHideFormItem, pItem);
137 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextHideFormItem erwartet");
138 			rFontWorkDlg.SetShowForm_Impl(pStateItem);
139 			break;
140 		}
141 		case SID_FORMTEXT_OUTLINE:
142 		{
143 			const XFormTextOutlineItem* pStateItem =
144 								PTR_CAST(XFormTextOutlineItem, pItem);
145 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextOutlineItem erwartet");
146 			rFontWorkDlg.SetOutline_Impl(pStateItem);
147 			break;
148 		}
149 		case SID_FORMTEXT_SHADOW:
150 		{
151 			const XFormTextShadowItem* pStateItem =
152 								PTR_CAST(XFormTextShadowItem, pItem);
153 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowItem erwartet");
154 			rFontWorkDlg.SetShadow_Impl(pStateItem);
155 			break;
156 		}
157 		case SID_FORMTEXT_SHDWCOLOR:
158 		{
159 			const XFormTextShadowColorItem* pStateItem =
160 								PTR_CAST(XFormTextShadowColorItem, pItem);
161 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowColorItem erwartet");
162 			rFontWorkDlg.SetShadowColor_Impl(pStateItem);
163 			break;
164 		}
165 		case SID_FORMTEXT_SHDWXVAL:
166 		{
167 			const XFormTextShadowXValItem* pStateItem =
168 								PTR_CAST(XFormTextShadowXValItem, pItem);
169 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowXValItem erwartet");
170 			rFontWorkDlg.SetShadowXVal_Impl(pStateItem);
171 			break;
172 		}
173 		case SID_FORMTEXT_SHDWYVAL:
174 		{
175 			const XFormTextShadowYValItem* pStateItem =
176 								PTR_CAST(XFormTextShadowYValItem, pItem);
177 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowYValItem erwartet");
178 			rFontWorkDlg.SetShadowYVal_Impl(pStateItem);
179 			break;
180 		}
181 	}
182 }
183 
184 /*************************************************************************
185 |*
186 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Fontwork-Dialog
187 |*
188 \************************************************************************/
189 
190 SvxFontWorkChildWindow::SvxFontWorkChildWindow
191 (
192     Window* _pParent,
193 	sal_uInt16 nId,
194 	SfxBindings* pBindings,
195 	SfxChildWinInfo* pInfo
196 ) :
197 
198     SfxChildWindow( _pParent, nId )
199 
200 {
201     pWindow = new SvxFontWorkDialog( pBindings, this, _pParent,
202 									 SVX_RES( RID_SVXDLG_FONTWORK ) );
203 	SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) pWindow;
204 
205 	eChildAlignment = SFX_ALIGN_NOALIGNMENT;
206 
207 	pDlg->Initialize( pInfo );
208 }
209 
210 /*************************************************************************
211 |*
212 |* Floating Window zur Attributierung von Texteffekten
213 |*
214 \************************************************************************/
215 
216 SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
217 									  SfxChildWindow *pCW,
218                                       Window* _pParent,
219 									  const ResId& rResId ) :
220     SfxDockingWindow( pBindinx, pCW, _pParent, rResId ),
221 
222 	aFormSet		(this, ResId(VS_FORMS,*rResId.GetResMgr())),
223 
224 	aTbxStyle		(this, ResId(TBX_STYLE,*rResId.GetResMgr())),
225 	aTbxAdjust		(this, ResId(TBX_ADJUST,*rResId.GetResMgr())),
226 
227 	aFbDistance 	(this, ResId(FB_DISTANCE,*rResId.GetResMgr())),
228 	aMtrFldDistance (this, ResId(MTR_FLD_DISTANCE,*rResId.GetResMgr())),
229 	aFbTextStart	(this, ResId(FB_TEXTSTART,*rResId.GetResMgr())),
230 	aMtrFldTextStart(this, ResId(MTR_FLD_TEXTSTART,*rResId.GetResMgr())),
231 
232 	aTbxShadow		(this, ResId(TBX_SHADOW,*rResId.GetResMgr())),
233 
234 	aFbShadowX		(this, ResId(FB_SHADOW_X,*rResId.GetResMgr())),
235 	aMtrFldShadowX	(this, ResId(MTR_FLD_SHADOW_X,*rResId.GetResMgr())),
236 	aFbShadowY		(this, ResId(FB_SHADOW_Y,*rResId.GetResMgr())),
237 	aMtrFldShadowY	(this, ResId(MTR_FLD_SHADOW_Y,*rResId.GetResMgr())),
238 
239 	aShadowColorLB	(this, ResId(CLB_SHADOW_COLOR,*rResId.GetResMgr())),
240     rBindings       (*pBindinx),
241 
242 	nLastStyleTbxId(0),
243 	nLastAdjustTbxId(0),
244 	nLastShadowTbxId(0),
245 	nSaveShadowX	(0),
246 	nSaveShadowY	(0),
247 	nSaveShadowAngle(450),
248 	nSaveShadowSize (100),
249 
250     maImageList     (ResId(IL_FONTWORK,*rResId.GetResMgr())),
251     maImageListH    (ResId(ILH_FONTWORK,*rResId.GetResMgr())),
252 
253     pColorTable     (NULL)
254 {
255 	FreeResource();
256 
257 	ApplyImageList();
258 
259 	pCtrlItems[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE, *this, rBindings);
260 	pCtrlItems[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST, *this, rBindings);
261 	pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings);
262 	pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings);
263 	pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings);
264 	pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_STDFORM, *this, rBindings);
265 	pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings);
266 	pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings);
267 	pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings);
268 	pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings);
269 	pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings);
270 	pCtrlItems[11] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings);
271 
272 	WinBits aNewStyle = ( aFormSet.GetStyle() | WB_VSCROLL | WB_ITEMBORDER | WB_DOUBLEBORDER );
273 	aFormSet.SetStyle( aNewStyle );
274 
275 	Size aSize = aTbxStyle.CalcWindowSizePixel();
276 	aTbxStyle.SetSizePixel(aSize);
277 	aTbxStyle.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectStyleHdl_Impl) );
278 
279 	aTbxAdjust.SetSizePixel(aSize);
280 	aTbxAdjust.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectAdjustHdl_Impl) );
281 
282 	aTbxShadow.SetSizePixel(aSize);
283 	aTbxShadow.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectShadowHdl_Impl) );
284 
285 //	aFbShadowX.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_XDIST)));
286 //	aFbShadowY.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_YDIST)));
287 
288 	Link aLink = LINK(this, SvxFontWorkDialog, ModifyInputHdl_Impl);
289 	aMtrFldDistance.SetModifyHdl( aLink );
290 	aMtrFldTextStart.SetModifyHdl( aLink );
291 	aMtrFldShadowX.SetModifyHdl( aLink );
292 	aMtrFldShadowY.SetModifyHdl( aLink );
293 
294 	// System-Metrik setzen
295 	const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
296 	SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
297 	SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
298 	SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
299 	SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
300 	if( eDlgUnit == FUNIT_MM )
301 	{
302 		aMtrFldDistance.SetSpinSize( 50 );
303 		aMtrFldTextStart.SetSpinSize( 50 );
304 		aMtrFldShadowX.SetSpinSize( 50 );
305 		aMtrFldShadowY.SetSpinSize( 50 );
306 	}
307 	else
308 	{
309 		aMtrFldDistance.SetSpinSize( 10 );
310 		aMtrFldTextStart.SetSpinSize( 10 );
311 		aMtrFldShadowX.SetSpinSize( 10 );
312 		aMtrFldShadowY.SetSpinSize( 10 );
313 	}
314 
315 	aShadowColorLB.SetSelectHdl( LINK(this, SvxFontWorkDialog, ColorSelectHdl_Impl) );
316 
317 	aInputTimer.SetTimeout(500);
318 	aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl));
319 
320 	aFormSet.SetSelectHdl( LINK(this, SvxFontWorkDialog, FormSelectHdl_Impl) );
321 	aFormSet.SetColCount(4);
322 	aFormSet.SetLineCount(2);
323 
324     Bitmap aBmp(SVX_RES(RID_SVXBMP_FONTWORK_FORM1));
325 	aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
326 	aFormSet.SetSizePixel(aSize);
327 }
328 
329 /*************************************************************************
330 |*
331 |* Destruktor
332 |*
333 \************************************************************************/
334 
335 SvxFontWorkDialog::~SvxFontWorkDialog()
336 {
337 	for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
338 		DELETEZ(pCtrlItems[i]);
339 }
340 
341 /*************************************************************************
342 |*
343 \************************************************************************/
344 
345 void SvxFontWorkDialog::Zoom()
346 {
347 	SfxDockingWindow::Roll();
348 }
349 
350 
351 /*************************************************************************
352 |*
353 |*
354 |*
355 \************************************************************************/
356 
357 SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
358 													 SfxChildAlignment eAlign )
359 {
360 	SfxChildAlignment eAlignment;
361 
362 	switch ( eAlign )
363 	{
364 		case SFX_ALIGN_TOP:
365 		case SFX_ALIGN_HIGHESTTOP:
366 		case SFX_ALIGN_LOWESTTOP:
367 		case SFX_ALIGN_BOTTOM:
368 		case SFX_ALIGN_LOWESTBOTTOM:
369 		case SFX_ALIGN_HIGHESTBOTTOM:
370 		{
371 			eAlignment = eActAlign;
372 		}
373 		break;
374 
375 		case SFX_ALIGN_LEFT:
376 		case SFX_ALIGN_RIGHT:
377 		case SFX_ALIGN_FIRSTLEFT:
378 		case SFX_ALIGN_LASTLEFT:
379 		case SFX_ALIGN_FIRSTRIGHT:
380 		case SFX_ALIGN_LASTRIGHT:
381 		{
382 			eAlignment = eAlign;
383 		}
384 		break;
385 
386 		default:
387 		{
388 			eAlignment = eAlign;
389 		}
390 		break;
391 	}
392 
393 	return eAlignment;
394 }
395 
396 
397 /*************************************************************************
398 |*
399 |* Style-Buttons setzen
400 |*
401 \************************************************************************/
402 
403 void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem* pItem)
404 {
405     if ( pItem )
406 	{
407 		sal_uInt16 nId = TBI_STYLE_OFF;
408 
409 		switch ( pItem->GetValue() )
410 		{
411 			case XFT_ROTATE : nId = TBI_STYLE_ROTATE;	break;
412 			case XFT_UPRIGHT: nId = TBI_STYLE_UPRIGHT;	break;
413 			case XFT_SLANTX : nId = TBI_STYLE_SLANTX;	break;
414 			case XFT_SLANTY : nId = TBI_STYLE_SLANTY;	break;
415             default: ;//prevent warning
416 		}
417 		aTbxStyle.Enable();
418 
419         // Make sure that there is allways exactly one checked toolbox item.
420 		if ( pItem->GetValue() == XFT_NONE )
421 		{
422 			aTbxStyle.CheckItem(TBI_STYLE_ROTATE, sal_False);
423 			aTbxStyle.CheckItem(TBI_STYLE_UPRIGHT, sal_False);
424 			aTbxStyle.CheckItem(TBI_STYLE_SLANTX, sal_False);
425 			aTbxStyle.CheckItem(TBI_STYLE_SLANTY, sal_False);
426 
427 			aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_True);
428 		}
429 		else
430         {
431 			aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_False);
432             aTbxStyle.CheckItem(nId);
433         }
434 
435 		nLastStyleTbxId = nId;
436 	}
437 	else
438 		aTbxStyle.Disable();
439 }
440 
441 /*************************************************************************
442 |*
443 |* Adjust-Buttons setzen
444 |*
445 \************************************************************************/
446 
447 void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
448 {
449 	if ( pItem )
450 	{
451 		sal_uInt16 nId;
452 
453 		aTbxAdjust.Enable();
454 		aMtrFldDistance.Enable();
455 
456 		if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
457 		{
458 			if ( pItem->GetValue() == XFT_LEFT )	nId = TBI_ADJUST_LEFT;
459 			else									nId = TBI_ADJUST_RIGHT;
460 			aMtrFldTextStart.Enable();
461 		}
462 		else
463 		{
464 			if ( pItem->GetValue() == XFT_CENTER )	nId = TBI_ADJUST_CENTER;
465 			else									nId = TBI_ADJUST_AUTOSIZE;
466 			aMtrFldTextStart.Disable();
467 		}
468 
469 		if ( !aTbxAdjust.IsItemChecked(nId) )
470 		{
471 			aTbxAdjust.CheckItem(nId);
472 		}
473 		nLastAdjustTbxId = nId;
474 	}
475 	else
476 	{
477 		aTbxAdjust.Disable();
478 		aMtrFldTextStart.Disable();
479 		aMtrFldDistance.Disable();
480 	}
481 }
482 
483 /*************************************************************************
484 |*
485 |* Abstand-Wert in Editfeld eintragen
486 |*
487 \************************************************************************/
488 
489 void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem* pItem)
490 {
491 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
492 	if ( pItem && !aMtrFldDistance.HasChildPathFocus() )
493 	{
494 		SetMetricValue( aMtrFldDistance, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
495 	}
496 }
497 
498 /*************************************************************************
499 |*
500 |* Einzug-Wert in Editfeld eintragen
501 |*
502 \************************************************************************/
503 
504 void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem* pItem)
505 {
506 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
507 	if ( pItem && !aMtrFldTextStart.HasChildPathFocus() )
508 	{
509 		SetMetricValue( aMtrFldTextStart, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
510 	}
511 }
512 
513 /*************************************************************************
514 |*
515 |* Button fuer Umkehrung der Textrichtung setzen
516 |*
517 \************************************************************************/
518 
519 void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem)
520 {
521 	if ( pItem )
522 		aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue());
523 }
524 
525 /*************************************************************************
526 |*
527 |* Standardform im ValueSet anzeigen
528 |*
529 \************************************************************************/
530 
531 void SvxFontWorkDialog::SetStdForm_Impl(const XFormTextStdFormItem* pItem)
532 {
533 	if ( pItem )
534 	{
535 		aFormSet.Enable();
536 		aFormSet.SetNoSelection();
537 
538 		if ( pItem->GetValue() != XFTFORM_NONE )
539 			aFormSet.SelectItem(
540                 sal::static_int_cast< sal_uInt16 >(pItem->GetValue()));
541 	}
542 	else
543 		aFormSet.Disable();
544 }
545 
546 /*************************************************************************
547 |*
548 |* Button fuer Konturanzeige setzen
549 |*
550 \************************************************************************/
551 
552 void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem)
553 {
554 	if ( pItem )
555 		aTbxShadow.CheckItem(TBI_SHOWFORM, !pItem->GetValue());
556 }
557 
558 /*************************************************************************
559 |*
560 |* Button fuer Zeichenumrandung setzen
561 |*
562 \************************************************************************/
563 
564 void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem* pItem)
565 {
566 	if ( pItem )
567 		aTbxShadow.CheckItem(TBI_OUTLINE, pItem->GetValue());
568 }
569 
570 /*************************************************************************
571 |*
572 |* Shadow-Buttons setzen
573 |*
574 \************************************************************************/
575 
576 void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
577 										sal_Bool bRestoreValues)
578 {
579 	if ( pItem )
580 	{
581 		sal_uInt16 nId;
582 
583 		aTbxShadow.Enable();
584 
585 		if ( pItem->GetValue() == XFTSHADOW_NONE )
586 		{
587 			nId = TBI_SHADOW_OFF;
588 			aFbShadowX.Hide();
589 			aFbShadowY.Hide();
590 			aMtrFldShadowX.Disable();
591 			aMtrFldShadowY.Disable();
592 			aShadowColorLB.Disable();
593 		}
594 		else
595 		{
596 			aFbShadowX.Show();
597 			aFbShadowY.Show();
598 			aMtrFldShadowX.Enable();
599 			aMtrFldShadowY.Enable();
600 			aShadowColorLB.Enable();
601 
602 			if ( pItem->GetValue() == XFTSHADOW_NORMAL )
603 			{
604 				nId = TBI_SHADOW_NORMAL;
605 				const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
606 
607 //              aFbShadowX.SetBitmap( Bitmap( ResId(RID_SVXBMP_SHADOW_XDIST, _pMgr ) ) );
608 				//aMtrFldShadowX.SetUnit(FUNIT_MM);
609 				aMtrFldShadowX.SetUnit( eDlgUnit );
610 				aMtrFldShadowX.SetDecimalDigits(2);
611                 aMtrFldShadowX.SetMin(LONG_MIN);
612                 aMtrFldShadowX.SetMax(LONG_MAX);
613 				if( eDlgUnit == FUNIT_MM )
614 					aMtrFldShadowX.SetSpinSize( 50 );
615 				else
616 					aMtrFldShadowX.SetSpinSize( 10 );
617 
618 //              aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_YDIST, _pMgr ) ) );
619 				//aMtrFldShadowY.SetUnit(FUNIT_MM);
620 				aMtrFldShadowY.SetUnit( eDlgUnit );
621 				aMtrFldShadowY.SetDecimalDigits(2);
622                 aMtrFldShadowY.SetMin(LONG_MIN);
623                 aMtrFldShadowY.SetMax(LONG_MAX);
624 				if( eDlgUnit == FUNIT_MM )
625 					aMtrFldShadowY.SetSpinSize( 50 );
626 				else
627 					aMtrFldShadowY.SetSpinSize( 10 );
628 
629 				if ( bRestoreValues )
630 				{
631 					SetMetricValue( aMtrFldShadowX, nSaveShadowX, SFX_MAPUNIT_100TH_MM );
632 					SetMetricValue( aMtrFldShadowY, nSaveShadowY, SFX_MAPUNIT_100TH_MM );
633 
634 					XFormTextShadowXValItem aXItem( nSaveShadowX );
635 					XFormTextShadowYValItem aYItem( nSaveShadowY );
636 
637 					GetBindings().GetDispatcher()->Execute(
638 						SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
639 				}
640 			}
641 			else
642 			{
643 				nId = TBI_SHADOW_SLANT;
644 
645 //              aFbShadowX.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_ANGLE, _pMgr ) ) );
646 				aMtrFldShadowX.SetUnit(FUNIT_CUSTOM);
647 				aMtrFldShadowX.SetDecimalDigits(1);
648                 aMtrFldShadowX.SetMin(-1800);
649                 aMtrFldShadowX.SetMax( 1800);
650 				aMtrFldShadowX.SetSpinSize(10);
651 
652 //              aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_SIZE, _pMgr ) ) );
653 				aMtrFldShadowY.SetUnit(FUNIT_CUSTOM);
654 				aMtrFldShadowY.SetDecimalDigits(0);
655                 aMtrFldShadowY.SetMin(-999);
656                 aMtrFldShadowY.SetMax( 999);
657 				aMtrFldShadowY.SetSpinSize(10);
658 
659 				if ( bRestoreValues )
660 				{
661 					aMtrFldShadowX.SetValue(nSaveShadowAngle);
662 					aMtrFldShadowY.SetValue(nSaveShadowSize);
663 					XFormTextShadowXValItem aXItem(nSaveShadowAngle);
664 					XFormTextShadowYValItem aYItem(nSaveShadowSize);
665 					GetBindings().GetDispatcher()->Execute(
666 						SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
667 				}
668 			}
669 		}
670 
671 		if ( !aTbxShadow.IsItemChecked(nId) )
672 		{
673 			aTbxShadow.CheckItem(nId);
674 		}
675 		nLastShadowTbxId = nId;
676 
677 		ApplyImageList();
678 	}
679 	else
680 	{
681 		aTbxShadow.Disable();
682 		aMtrFldShadowX.Disable();
683 		aMtrFldShadowY.Disable();
684 		aShadowColorLB.Disable();
685 	}
686 }
687 
688 /*************************************************************************
689 |*
690 |* Schattenfarbe in Listbox eintragen
691 |*
692 \************************************************************************/
693 
694 void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pItem)
695 {
696 	if ( pItem )
697         aShadowColorLB.SelectEntry(pItem->GetColorValue());
698 }
699 
700 /*************************************************************************
701 |*
702 |* X-Wert fuer Schatten in Editfeld eintragen
703 |*
704 \************************************************************************/
705 
706 void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem)
707 {
708 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
709 	if ( pItem && !aMtrFldShadowX.HasChildPathFocus() )
710 	{
711 		// #i19251#
712 		// sal_Int32 nValue = pItem->GetValue();
713 
714 		// #i19251#
715 		// The two involved fields/items are used double and contain/give different
716 		// values regarding to the access method. Thus, here we need to separate the access
717 		// methos regarding to the kind of value accessed.
718 		if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
719 		{
720 			// #i19251#
721 			// There is no value correction necessary at all, i think this
722 			// was only tried to be done without understanding that the two
723 			// involved fields/items are used double and contain/give different
724 			// values regarding to the access method.
725 			// nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
726 			aMtrFldShadowX.SetValue(pItem->GetValue());
727 		}
728 		else
729 		{
730 			SetMetricValue( aMtrFldShadowX, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
731 		}
732 	}
733 }
734 
735 /*************************************************************************
736 |*
737 |* Y-Wert fuer Schatten in Editfeld eintragen
738 |*
739 \************************************************************************/
740 
741 void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem)
742 {
743 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
744 	if ( pItem && !aMtrFldShadowY.HasChildPathFocus() )
745 	{
746 		// #i19251#
747 		// The two involved fields/items are used double and contain/give different
748 		// values regarding to the access method. Thus, here we need to separate the access
749 		// methos regarding to the kind of value accessed.
750 		if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
751 		{
752 			aMtrFldShadowY.SetValue(pItem->GetValue());
753 		}
754 		else
755 		{
756 			SetMetricValue( aMtrFldShadowY, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
757 		}
758 	}
759 }
760 
761 /*************************************************************************
762 |*
763 \************************************************************************/
764 
765 IMPL_LINK( SvxFontWorkDialog, SelectStyleHdl_Impl, void *, EMPTYARG )
766 {
767 	sal_uInt16 nId = aTbxStyle.GetCurItemId();
768 
769     // Execute this block when a different toolbox item has been clicked or
770     // when the off item has been clicked.  The later is necessary to
771     // override the toolbox behaviour of unchecking the item after second
772     // click on it: One of the items has to be checked at all times (when
773     // enabled that is.)
774 	if (nId == TBI_STYLE_OFF || nId != nLastStyleTbxId )
775 	{
776 		XFormTextStyle eStyle = XFT_NONE;
777 
778 		switch ( nId )
779 		{
780 			case TBI_STYLE_ROTATE	: eStyle = XFT_ROTATE;	break;
781 			case TBI_STYLE_UPRIGHT	: eStyle = XFT_UPRIGHT; break;
782 			case TBI_STYLE_SLANTX	: eStyle = XFT_SLANTX;	break;
783 			case TBI_STYLE_SLANTY	: eStyle = XFT_SLANTY;	break;
784 		}
785 		XFormTextStyleItem aItem( eStyle );
786 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L );
787 		SetStyle_Impl( &aItem );
788 		nLastStyleTbxId = nId;
789 	}
790 	return 0;
791 }
792 
793 /*************************************************************************
794 |*
795 \************************************************************************/
796 
797 IMPL_LINK( SvxFontWorkDialog, SelectAdjustHdl_Impl, void *, EMPTYARG )
798 {
799 	sal_uInt16 nId = aTbxAdjust.GetCurItemId();
800 
801 	if ( nId == TBI_ADJUST_MIRROR )
802 	{
803 		XFormTextMirrorItem aItem(aTbxAdjust.IsItemChecked(nId));
804 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_MIRROR, SFX_CALLMODE_SLOT, &aItem, 0L );
805 	}
806 	else if ( nId != nLastAdjustTbxId )
807 	{
808 		XFormTextAdjust eAdjust = XFT_AUTOSIZE;
809 
810 		switch ( nId )
811 		{
812 			case TBI_ADJUST_LEFT	: eAdjust = XFT_LEFT;	break;
813 			case TBI_ADJUST_CENTER	: eAdjust = XFT_CENTER; break;
814 			case TBI_ADJUST_RIGHT	: eAdjust = XFT_RIGHT;	break;
815 		}
816 		XFormTextAdjustItem aItem(eAdjust);
817 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_ADJUST, SFX_CALLMODE_RECORD, &aItem, 0L );
818 		SetAdjust_Impl(&aItem);
819 		nLastAdjustTbxId = nId;
820 	}
821 	return 0;
822 }
823 
824 /*************************************************************************
825 |*
826 \************************************************************************/
827 
828 IMPL_LINK( SvxFontWorkDialog, SelectShadowHdl_Impl, void *, EMPTYARG )
829 {
830 	sal_uInt16 nId = aTbxShadow.GetCurItemId();
831 
832 	if ( nId == TBI_SHOWFORM )
833 	{
834 		XFormTextHideFormItem aItem(!aTbxShadow.IsItemChecked(nId));
835 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_HIDEFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
836 	}
837 	else if ( nId == TBI_OUTLINE )
838 	{
839 		XFormTextOutlineItem aItem(aTbxShadow.IsItemChecked(nId));
840 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_OUTLINE, SFX_CALLMODE_RECORD, &aItem, 0L );
841 	}
842 	else if ( nId != nLastShadowTbxId )
843 	{
844 		XFormTextShadow eShadow = XFTSHADOW_NONE;
845 
846 		if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
847 		{
848 			nSaveShadowX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
849 			nSaveShadowY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
850 		}
851 		else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
852 		{
853 			nSaveShadowAngle = static_cast<long>(aMtrFldShadowX.GetValue());
854 			nSaveShadowSize  = static_cast<long>(aMtrFldShadowY.GetValue());
855 		}
856 		nLastShadowTbxId = nId;
857 
858 		if ( nId == TBI_SHADOW_NORMAL ) 	eShadow = XFTSHADOW_NORMAL;
859 		else if ( nId == TBI_SHADOW_SLANT ) eShadow = XFTSHADOW_SLANT;
860 
861 		XFormTextShadowItem aItem(eShadow);
862 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHADOW, SFX_CALLMODE_RECORD, &aItem, 0L );
863 		SetShadow_Impl(&aItem, sal_True);
864 	}
865 	return 0;
866 }
867 
868 /*************************************************************************
869 |*
870 \************************************************************************/
871 
872 IMPL_LINK_INLINE_START( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
873 {
874 	aInputTimer.Start();
875 	return 0;
876 }
877 IMPL_LINK_INLINE_END( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
878 
879 /*************************************************************************
880 |*
881 \************************************************************************/
882 
883 IMPL_LINK( SvxFontWorkDialog, InputTimoutHdl_Impl, void *, EMPTYARG )
884 {
885 	// System-Metrik evtl. neu setzen
886 	// Dieses sollte mal als Listener passieren, ist aber aus
887 	// inkompatibilitaetsgruenden z.Z. nicht moeglich
888 	const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
889 	if( eDlgUnit != aMtrFldDistance.GetUnit() )
890 	{
891 		SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
892 		SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
893 		aMtrFldDistance.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
894 		aMtrFldTextStart.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
895 	}
896 	if( eDlgUnit != aMtrFldShadowX.GetUnit() &&
897 		aTbxShadow.IsItemChecked( TBI_SHADOW_NORMAL ) )
898 	{
899 		SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
900 		SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
901 		aMtrFldShadowX.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
902 		aMtrFldShadowY.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
903 	}
904 
905 	long nValue = GetCoreValue( aMtrFldDistance, SFX_MAPUNIT_100TH_MM );
906 	XFormTextDistanceItem aDistItem( nValue );
907 	nValue = GetCoreValue( aMtrFldTextStart, SFX_MAPUNIT_100TH_MM );
908 	XFormTextStartItem aStartItem( nValue );
909 
910 	sal_Int32 nValueX(0L);
911 	sal_Int32 nValueY(0L);
912 
913 	// #i19251#
914 	// The two involved fields/items are used double and contain/give different
915 	// values regarding to the access method. Thus, here we need to separate the access
916 	// methos regarding to the kind of value accessed.
917 	if(nLastShadowTbxId == TBI_SHADOW_NORMAL)
918 	{
919 		nValueX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
920 		nValueY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
921 	}
922 	else if(nLastShadowTbxId == TBI_SHADOW_SLANT)
923 	{
924 		nValueX = static_cast<long>(aMtrFldShadowX.GetValue());
925 		nValueY = static_cast<long>(aMtrFldShadowY.GetValue());
926 	}
927 
928 	XFormTextShadowXValItem aShadowXItem( nValueX );
929 	XFormTextShadowYValItem aShadowYItem( nValueY );
930 
931 	// Slot-ID ist egal, die Exec-Methode wertet das gesamte ItemSet aus
932 	GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_DISTANCE, SFX_CALLMODE_RECORD, &aDistItem,
933 											&aStartItem, &aShadowXItem, &aShadowYItem, 0L );
934 	return 0;
935 }
936 
937 /*************************************************************************
938 |*
939 \************************************************************************/
940 
941 IMPL_LINK( SvxFontWorkDialog, FormSelectHdl_Impl, void *, EMPTYARG )
942 {
943 	XFormTextStdFormItem aItem;
944 
945 	if ( aFormSet.IsNoSelection() )
946 		aItem.SetValue(XFTFORM_NONE);
947 	else
948 		aItem.SetValue(aFormSet.GetSelectItemId());
949 	GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STDFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
950 	aFormSet.SetNoSelection();
951 	return 0;
952 }
953 
954 /*************************************************************************
955 |*
956 \************************************************************************/
957 
958 IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG )
959 {
960 // Changed by obo. Linux-Compiler can't parse commented lines
961 	XFormTextShadowColorItem aItem( (const String &) String(),
962 								    (const Color &) aShadowColorLB.GetSelectEntryColor() );
963 //	XFormTextShadowColorItem aItem( String(),
964 //								    aShadowColorLB.GetSelectEntryColor() );
965 	GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHDWCOLOR, SFX_CALLMODE_RECORD, &aItem, 0L );
966 	return 0;
967 }
968 
969 /*************************************************************************
970 |*
971 \************************************************************************/
972 
973 void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable)
974 {
975 	if ( pTable && pTable != pColorTable )
976 	{
977 		pColorTable = pTable;
978 		aShadowColorLB.Clear();
979 		aShadowColorLB.Fill(pColorTable);
980 	}
981 }
982 
983 /*************************************************************************
984 |*
985 \************************************************************************/
986 
987 void SvxFontWorkDialog::SetActive(sal_Bool /*bActivate*/)
988 {
989 }
990 
991 /*************************************************************************
992 |*
993 |* Standard-FontWork-Objekt erzeugen
994 |*
995 \************************************************************************/
996 
997 void SvxFontWorkDialog::CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
998 										 const SfxItemSet& rAttr,
999 										 SdrObject& rOldObj,
1000 										 XFormTextStdForm eForm)
1001 {
1002 	SfxItemSet	aAttr(*rAttr.GetPool(), XATTR_FORMTXTSTYLE,
1003 										XATTR_FORMTXTHIDEFORM);
1004 	SdrObject*	pNewObj = NULL;
1005 	Rectangle	aRect;
1006 	XFormTextAdjust eAdjust = XFT_AUTOSIZE;
1007 
1008 //-/	rOldObj.TakeAttributes(aAttr, sal_True, sal_False);
1009 	aAttr.Put(rOldObj.GetMergedItemSet());
1010 
1011 	const XFormTextStdFormItem& rOldForm = (const XFormTextStdFormItem&)
1012 											aAttr.Get(XATTR_FORMTXTSTDFORM);
1013 
1014 	aRect = rOldObj.GetSnapRect();
1015 
1016 	if ( !rOldObj.ISA(SdrPathObj) )
1017 	{
1018 		Point aPos = aRect.TopLeft();
1019 		aRect = rOldObj.GetLogicRect();
1020 		aRect.SetPos(aPos);
1021 	}
1022 
1023 	aAttr.Put(rAttr);
1024 
1025 	if ( rOldForm.GetValue() == XFTFORM_NONE )
1026 	{
1027 		long nW = aRect.GetWidth();
1028 		aRect.SetSize(Size(nW, nW));
1029 		aAttr.Put(XFormTextStyleItem(XFT_ROTATE));
1030 	}
1031 
1032 	Point aCenter = aRect.Center();
1033 
1034 	switch ( eForm )
1035 	{
1036 		case XFTFORM_TOPCIRC:
1037 		case XFTFORM_BOTCIRC:
1038 		case XFTFORM_LFTCIRC:
1039 		case XFTFORM_RGTCIRC:
1040 		case XFTFORM_TOPARC:
1041 		case XFTFORM_BOTARC:
1042 		case XFTFORM_LFTARC:
1043 		case XFTFORM_RGTARC:
1044 		{
1045 			long nBeg, nEnd;
1046 
1047 			switch ( eForm )
1048 			{
1049 				default: ; //prevent warning
1050 				case XFTFORM_TOPCIRC:
1051 					nBeg = 0;
1052 					nEnd = 18000;
1053 					break;
1054 				case XFTFORM_BOTCIRC:
1055 					nBeg = 18000;
1056 					nEnd = 36000;
1057 					break;
1058 				case XFTFORM_LFTCIRC:
1059 					nBeg =	9000;
1060 					nEnd = 27000;
1061 					break;
1062 				case XFTFORM_RGTCIRC:
1063 					nBeg = 27000;
1064 					nEnd =	9000;
1065 					break;
1066 				case XFTFORM_TOPARC:
1067 					nBeg =	4500;
1068 					nEnd = 13500;
1069 					break;
1070 				case XFTFORM_BOTARC:
1071 					nBeg = 22500;
1072 					nEnd = 31500;
1073 					break;
1074 				case XFTFORM_LFTARC:
1075 					nBeg = 13500;
1076 					nEnd = 22500;
1077 					break;
1078 				case XFTFORM_RGTARC:
1079 					nBeg = 31500;
1080 					nEnd =	4500;
1081 					break;
1082 			}
1083 			pNewObj = new SdrCircObj(OBJ_CARC, aRect, nBeg, nEnd);
1084 			break;
1085 		}
1086 		case XFTFORM_BUTTON1:
1087 		{
1088 			basegfx::B2DPolyPolygon aPolyPolygon;
1089 			basegfx::B2DPolygon aLine;
1090 			long nR = aRect.GetWidth() / 2;
1091 			basegfx::B2DPolygon aTopArc(XPolygon(aCenter, -nR, nR, 50, 1750, sal_False).getB2DPolygon());
1092 			basegfx::B2DPolygon aBottomArc(XPolygon(aCenter, -nR, nR, 1850, 3550, sal_False).getB2DPolygon());
1093 
1094 			// Polygone schliessen
1095 			aTopArc.setClosed(true);
1096 			aBottomArc.setClosed(true);
1097 			aPolyPolygon.append(aTopArc);
1098 
1099 			aLine.append(aBottomArc.getB2DPoint(aBottomArc.count() - 1L));
1100 			aLine.append(aBottomArc.getB2DPoint(0L));
1101 			aLine.setClosed(true);
1102 
1103 			aPolyPolygon.append(aLine);
1104 			aPolyPolygon.append(aBottomArc);
1105 
1106 			pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
1107 			eAdjust = XFT_CENTER;
1108 			break;
1109 		}
1110 		case XFTFORM_BUTTON2:
1111 		case XFTFORM_BUTTON3:
1112 		case XFTFORM_BUTTON4:
1113 		{
1114 			basegfx::B2DPolyPolygon aPolyPolygon;
1115 			basegfx::B2DPolygon aLine;
1116 			long nR = aRect.GetWidth() / 2;
1117 			long nWDiff = nR / 5;
1118 			long nHDiff;
1119 
1120 			if ( eForm == XFTFORM_BUTTON4 )
1121 			{
1122 				basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 950, 2650, sal_False).getB2DPolygon());
1123 				aNewArc.setClosed(true);
1124 				aPolyPolygon.append(aNewArc);
1125 				eAdjust = XFT_CENTER;
1126 			}
1127 			else
1128 			{
1129 				basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2700, 2700).getB2DPolygon());
1130 				aPolyPolygon.append(aNewArc);
1131 			}
1132 
1133 			if ( eForm == XFTFORM_BUTTON3 )
1134 				nHDiff = -aRect.GetHeight() / 10;
1135 			else
1136 				nHDiff = aRect.GetHeight() / 20;
1137 
1138 			aLine.append(basegfx::B2DPoint(aRect.Left() + nWDiff, aRect.Center().Y() + nHDiff));
1139 			aLine.append(basegfx::B2DPoint(aRect.Right() - nWDiff, aRect.Center().Y() + nHDiff));
1140 			aLine.setClosed(true);
1141 			aPolyPolygon.append(aLine);
1142 
1143 			if ( eForm == XFTFORM_BUTTON4 )
1144 			{
1145 				basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2750, 850, sal_False).getB2DPolygon());
1146 				aNewArc.setClosed(true);
1147 				aPolyPolygon.append(aNewArc);
1148 			}
1149 
1150 			if ( eForm == XFTFORM_BUTTON3 )
1151 			{
1152 				nHDiff += nHDiff;
1153 				aLine.setB2DPoint(0L, basegfx::B2DPoint(aLine.getB2DPoint(0L).getX(), aLine.getB2DPoint(0L).getY() - nHDiff));
1154 				aLine.setB2DPoint(1L, basegfx::B2DPoint(aLine.getB2DPoint(1L).getX(), aLine.getB2DPoint(1L).getY() - nHDiff));
1155 				aPolyPolygon.append(aLine);
1156 			}
1157 
1158 			pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
1159 			break;
1160         }
1161         default: ; //prevent warning
1162     }
1163 	if ( pNewObj )
1164 	{
1165 		// #78478# due to DLs changes in Outliner the object needs
1166 		// a model to get an outliner for later calls to
1167 		// pNewObj->SetOutlinerParaObject(pPara) (see below).
1168 		pNewObj->SetModel(rOldObj.GetModel());
1169 
1170 		Size aSize;
1171 		Rectangle aSnap = pNewObj->GetSnapRect();
1172 
1173 		aSize.Width() = aRect.Left() - aSnap.Left();
1174 		aSize.Height() = aRect.Top() - aSnap.Top();
1175 		pNewObj->NbcMove(aSize);
1176 
1177 		rView.BegUndo( SVX_RESSTR( RID_SVXSTR_FONTWORK_UNDOCREATE ) );
1178 		OutlinerParaObject* pPara = rOldObj.GetOutlinerParaObject();
1179 		sal_Bool bHide = sal_True;
1180 
1181 		if ( pPara != NULL )
1182 		{
1183 			pPara = new OutlinerParaObject(*pPara);
1184 			pNewObj->SetOutlinerParaObject(pPara);
1185 		}
1186 		else
1187 			bHide = sal_False;
1188 
1189 		rView.ReplaceObjectAtView(&rOldObj, rPV, pNewObj, sal_True);
1190 		pNewObj->SetLayer(rOldObj.GetLayer());
1191 		aAttr.Put(XFormTextHideFormItem(bHide));
1192 		aAttr.Put(XFormTextAdjustItem(eAdjust));
1193 
1194 		XFormTextShadow eShadow = XFTSHADOW_NONE;
1195 
1196 		if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
1197 		{
1198 			eShadow = XFTSHADOW_NORMAL;
1199 			aAttr.Put(XFormTextShadowXValItem(nSaveShadowX));
1200 			aAttr.Put(XFormTextShadowYValItem(nSaveShadowY));
1201 		}
1202 		else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
1203 		{
1204 			eShadow = XFTSHADOW_SLANT;
1205 			aAttr.Put(XFormTextShadowXValItem(nSaveShadowAngle));
1206 			aAttr.Put(XFormTextShadowYValItem(nSaveShadowSize));
1207 		}
1208 
1209 		aAttr.Put(XFormTextShadowItem(eShadow));
1210 
1211 		rView.SetAttributes(aAttr);
1212 		rView.EndUndo();
1213 	}
1214 }
1215 
1216 void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt )
1217 {
1218 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1219             ApplyImageList();
1220 
1221     SfxDockingWindow::DataChanged( rDCEvt );
1222 }
1223 /* -----------------------------08.05.2002 14:28------------------------------
1224 
1225  ---------------------------------------------------------------------------*/
1226 void SvxFontWorkDialog::ApplyImageList()
1227 {
1228 	bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
1229 
1230     ResMgr* _pMgr = &DIALOG_MGR();
1231 
1232 	sal_uInt16 nBitmapResId = bHighContrast ? RID_SVXBMP_FONTWORK_FORM1_H : RID_SVXBMP_FONTWORK_FORM1;
1233 	sal_uInt16 nTextResId = RID_SVXSTR_FONTWORK_FORM1;
1234 
1235 	bool bInit = aFormSet.GetItemCount() == 0;
1236 
1237 	if( bInit )
1238 	{
1239 /*
1240 		Size aSize( aTbxStyle.CalcWindowSizePixel() );
1241         Bitmap aBmp(ResId(RID_SVXBMP_FONTWORK_FORM1,_pMgr));
1242 		aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
1243 		aFormSet.SetSizePixel(aSize);
1244 */
1245 	}
1246 
1247 	sal_uInt16 i;
1248 	for( i = 1; i < 13; i++, nTextResId++, nBitmapResId++ )
1249 	{
1250 		if( bInit )
1251 		{
1252             aFormSet.InsertItem( i, Bitmap(ResId(nBitmapResId,*_pMgr)),
1253                                     String(ResId(nTextResId,*_pMgr)));
1254 		}
1255 		else
1256 		{
1257             aFormSet.SetItemImage( i, Bitmap(ResId(nBitmapResId,*_pMgr)) );
1258 		}
1259 	}
1260 
1261     ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
1262 
1263 	aTbxStyle.SetImageList( rImgLst );
1264 	aTbxAdjust.SetImageList( rImgLst );
1265 	aTbxShadow.SetImageList( rImgLst );
1266 
1267 	switch( nLastShadowTbxId )
1268 	{
1269 	case TBI_SHADOW_SLANT:
1270 		aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_ANGLE ) );
1271 		aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_SIZE ) );
1272 		break;
1273 //	case TBI_SHADOW_NORMAL:
1274 	default:
1275 		aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_XDIST ) );
1276 		aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_YDIST ) );
1277 		break;
1278 	}
1279 
1280 	aFbDistance.SetImage( rImgLst.GetImage( TBI_DISTANCE ) );
1281 	aFbTextStart.SetImage( rImgLst.GetImage( TBI_TEXTSTART ) );
1282 
1283 }
1284