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