xref: /aoo42x/main/svx/source/dialog/fontwork.cxx (revision 1e9c32af)
1f6e50924SAndrew Rist /**************************************************************
2f6e50924SAndrew Rist  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <sfx2/module.hxx>
29cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
30cdf0e10cSrcweir #include <tools/shl.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #define _SVX_FONTWORK_CXX
33cdf0e10cSrcweir #include <svx/svdobj.hxx>
34cdf0e10cSrcweir #include <svx/svdopath.hxx>
35cdf0e10cSrcweir #include <svx/svdview.hxx>
36cdf0e10cSrcweir #include <svx/svdocirc.hxx>
37cdf0e10cSrcweir #include <svx/xtextit.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <svx/dialmgr.hxx>
40cdf0e10cSrcweir #include "svx/dlgutil.hxx"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <svx/dialogs.hrc>
43cdf0e10cSrcweir #include "fontwork.hrc"
44cdf0e10cSrcweir #include <svx/fontwork.hxx>
45cdf0e10cSrcweir #include <editeng/outlobj.hxx>
46cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
47cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir SFX_IMPL_DOCKINGWINDOW( SvxFontWorkChildWindow, SID_FONTWORK );
50cdf0e10cSrcweir 
51cdf0e10cSrcweir /*************************************************************************
52cdf0e10cSrcweir |*
53cdf0e10cSrcweir |* ControllerItem fuer Fontwork
54cdf0e10cSrcweir |*
55cdf0e10cSrcweir \************************************************************************/
56cdf0e10cSrcweir 
57cdf0e10cSrcweir SvxFontWorkControllerItem::SvxFontWorkControllerItem
58cdf0e10cSrcweir (
59cdf0e10cSrcweir     sal_uInt16 _nId,
60cdf0e10cSrcweir 	SvxFontWorkDialog& rDlg,
61cdf0e10cSrcweir 	SfxBindings& rBindings
62cdf0e10cSrcweir ) :
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     SfxControllerItem( _nId, rBindings ),
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	rFontWorkDlg( rDlg )
67cdf0e10cSrcweir {
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir /*************************************************************************
71cdf0e10cSrcweir |*
72cdf0e10cSrcweir |* StateChanged-Methode fuer FontWork-Items
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir \************************************************************************/
75cdf0e10cSrcweir 
76cdf0e10cSrcweir void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
77cdf0e10cSrcweir 											  const SfxPoolItem* pItem )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	switch ( GetId() )
80cdf0e10cSrcweir 	{
81cdf0e10cSrcweir 		case SID_FORMTEXT_STYLE:
82cdf0e10cSrcweir 		{
83cdf0e10cSrcweir 			const XFormTextStyleItem* pStateItem =
84cdf0e10cSrcweir 								PTR_CAST(XFormTextStyleItem, pItem);
85cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStyleItem erwartet");
86cdf0e10cSrcweir 			rFontWorkDlg.SetStyle_Impl(pStateItem);
87cdf0e10cSrcweir 			break;
88cdf0e10cSrcweir 		}
89cdf0e10cSrcweir 		case SID_FORMTEXT_ADJUST:
90cdf0e10cSrcweir 		{
91cdf0e10cSrcweir 			const XFormTextAdjustItem* pStateItem =
92cdf0e10cSrcweir 								PTR_CAST(XFormTextAdjustItem, pItem);
93cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextAdjustItem erwartet");
94cdf0e10cSrcweir 			rFontWorkDlg.SetAdjust_Impl(pStateItem);
95cdf0e10cSrcweir 			break;
96cdf0e10cSrcweir 		}
97cdf0e10cSrcweir 		case SID_FORMTEXT_DISTANCE:
98cdf0e10cSrcweir 		{
99cdf0e10cSrcweir 			const XFormTextDistanceItem* pStateItem =
100cdf0e10cSrcweir 								PTR_CAST(XFormTextDistanceItem, pItem);
101cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextDistanceItem erwartet");
102cdf0e10cSrcweir 			rFontWorkDlg.SetDistance_Impl(pStateItem);
103cdf0e10cSrcweir 			break;
104cdf0e10cSrcweir 		}
105cdf0e10cSrcweir 		case SID_FORMTEXT_START:
106cdf0e10cSrcweir 		{
107cdf0e10cSrcweir 			const XFormTextStartItem* pStateItem =
108cdf0e10cSrcweir 								PTR_CAST(XFormTextStartItem, pItem);
109cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStartItem erwartet");
110cdf0e10cSrcweir 			rFontWorkDlg.SetStart_Impl(pStateItem);
111cdf0e10cSrcweir 			break;
112cdf0e10cSrcweir 		}
113cdf0e10cSrcweir 		case SID_FORMTEXT_MIRROR:
114cdf0e10cSrcweir 		{
115cdf0e10cSrcweir 			const XFormTextMirrorItem* pStateItem =
116cdf0e10cSrcweir 								PTR_CAST(XFormTextMirrorItem, pItem);
117cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextMirrorItem erwartet");
118cdf0e10cSrcweir 			rFontWorkDlg.SetMirror_Impl(pStateItem);
119cdf0e10cSrcweir 			break;
120cdf0e10cSrcweir 		}
121cdf0e10cSrcweir 		case SID_FORMTEXT_HIDEFORM:
122cdf0e10cSrcweir 		{
123cdf0e10cSrcweir 			const XFormTextHideFormItem* pStateItem =
124cdf0e10cSrcweir 								PTR_CAST(XFormTextHideFormItem, pItem);
125cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextHideFormItem erwartet");
126cdf0e10cSrcweir 			rFontWorkDlg.SetShowForm_Impl(pStateItem);
127cdf0e10cSrcweir 			break;
128cdf0e10cSrcweir 		}
129cdf0e10cSrcweir 		case SID_FORMTEXT_OUTLINE:
130cdf0e10cSrcweir 		{
131cdf0e10cSrcweir 			const XFormTextOutlineItem* pStateItem =
132cdf0e10cSrcweir 								PTR_CAST(XFormTextOutlineItem, pItem);
133cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextOutlineItem erwartet");
134cdf0e10cSrcweir 			rFontWorkDlg.SetOutline_Impl(pStateItem);
135cdf0e10cSrcweir 			break;
136cdf0e10cSrcweir 		}
137cdf0e10cSrcweir 		case SID_FORMTEXT_SHADOW:
138cdf0e10cSrcweir 		{
139cdf0e10cSrcweir 			const XFormTextShadowItem* pStateItem =
140cdf0e10cSrcweir 								PTR_CAST(XFormTextShadowItem, pItem);
141cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowItem erwartet");
142cdf0e10cSrcweir 			rFontWorkDlg.SetShadow_Impl(pStateItem);
143cdf0e10cSrcweir 			break;
144cdf0e10cSrcweir 		}
145cdf0e10cSrcweir 		case SID_FORMTEXT_SHDWCOLOR:
146cdf0e10cSrcweir 		{
147cdf0e10cSrcweir 			const XFormTextShadowColorItem* pStateItem =
148cdf0e10cSrcweir 								PTR_CAST(XFormTextShadowColorItem, pItem);
149cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowColorItem erwartet");
150cdf0e10cSrcweir 			rFontWorkDlg.SetShadowColor_Impl(pStateItem);
151cdf0e10cSrcweir 			break;
152cdf0e10cSrcweir 		}
153cdf0e10cSrcweir 		case SID_FORMTEXT_SHDWXVAL:
154cdf0e10cSrcweir 		{
155cdf0e10cSrcweir 			const XFormTextShadowXValItem* pStateItem =
156cdf0e10cSrcweir 								PTR_CAST(XFormTextShadowXValItem, pItem);
157cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowXValItem erwartet");
158cdf0e10cSrcweir 			rFontWorkDlg.SetShadowXVal_Impl(pStateItem);
159cdf0e10cSrcweir 			break;
160cdf0e10cSrcweir 		}
161cdf0e10cSrcweir 		case SID_FORMTEXT_SHDWYVAL:
162cdf0e10cSrcweir 		{
163cdf0e10cSrcweir 			const XFormTextShadowYValItem* pStateItem =
164cdf0e10cSrcweir 								PTR_CAST(XFormTextShadowYValItem, pItem);
165cdf0e10cSrcweir 			DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowYValItem erwartet");
166cdf0e10cSrcweir 			rFontWorkDlg.SetShadowYVal_Impl(pStateItem);
167cdf0e10cSrcweir 			break;
168cdf0e10cSrcweir 		}
169cdf0e10cSrcweir 	}
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir /*************************************************************************
173cdf0e10cSrcweir |*
174cdf0e10cSrcweir |* Ableitung vom SfxChildWindow als "Behaelter" fuer Fontwork-Dialog
175cdf0e10cSrcweir |*
176cdf0e10cSrcweir \************************************************************************/
177cdf0e10cSrcweir 
178cdf0e10cSrcweir SvxFontWorkChildWindow::SvxFontWorkChildWindow
179cdf0e10cSrcweir (
180cdf0e10cSrcweir     Window* _pParent,
181cdf0e10cSrcweir 	sal_uInt16 nId,
182cdf0e10cSrcweir 	SfxBindings* pBindings,
183cdf0e10cSrcweir 	SfxChildWinInfo* pInfo
184cdf0e10cSrcweir ) :
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     SfxChildWindow( _pParent, nId )
187cdf0e10cSrcweir 
188cdf0e10cSrcweir {
189cdf0e10cSrcweir     pWindow = new SvxFontWorkDialog( pBindings, this, _pParent,
190cdf0e10cSrcweir 									 SVX_RES( RID_SVXDLG_FONTWORK ) );
191cdf0e10cSrcweir 	SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) pWindow;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	eChildAlignment = SFX_ALIGN_NOALIGNMENT;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	pDlg->Initialize( pInfo );
196cdf0e10cSrcweir }
197cdf0e10cSrcweir 
198cdf0e10cSrcweir /*************************************************************************
199cdf0e10cSrcweir |*
200cdf0e10cSrcweir |* Floating Window zur Attributierung von Texteffekten
201cdf0e10cSrcweir |*
202cdf0e10cSrcweir \************************************************************************/
203cdf0e10cSrcweir 
204cdf0e10cSrcweir SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
205cdf0e10cSrcweir 									  SfxChildWindow *pCW,
206cdf0e10cSrcweir                                       Window* _pParent,
207cdf0e10cSrcweir 									  const ResId& rResId ) :
208cdf0e10cSrcweir     SfxDockingWindow( pBindinx, pCW, _pParent, rResId ),
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	aTbxStyle		(this, ResId(TBX_STYLE,*rResId.GetResMgr())),
211cdf0e10cSrcweir 	aTbxAdjust		(this, ResId(TBX_ADJUST,*rResId.GetResMgr())),
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	aFbDistance 	(this, ResId(FB_DISTANCE,*rResId.GetResMgr())),
214cdf0e10cSrcweir 	aMtrFldDistance (this, ResId(MTR_FLD_DISTANCE,*rResId.GetResMgr())),
215cdf0e10cSrcweir 	aFbTextStart	(this, ResId(FB_TEXTSTART,*rResId.GetResMgr())),
216cdf0e10cSrcweir 	aMtrFldTextStart(this, ResId(MTR_FLD_TEXTSTART,*rResId.GetResMgr())),
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	aTbxShadow		(this, ResId(TBX_SHADOW,*rResId.GetResMgr())),
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	aFbShadowX		(this, ResId(FB_SHADOW_X,*rResId.GetResMgr())),
221cdf0e10cSrcweir 	aMtrFldShadowX	(this, ResId(MTR_FLD_SHADOW_X,*rResId.GetResMgr())),
222cdf0e10cSrcweir 	aFbShadowY		(this, ResId(FB_SHADOW_Y,*rResId.GetResMgr())),
223cdf0e10cSrcweir 	aMtrFldShadowY	(this, ResId(MTR_FLD_SHADOW_Y,*rResId.GetResMgr())),
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	aShadowColorLB	(this, ResId(CLB_SHADOW_COLOR,*rResId.GetResMgr())),
226cdf0e10cSrcweir     rBindings       (*pBindinx),
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	nLastStyleTbxId(0),
229cdf0e10cSrcweir 	nLastAdjustTbxId(0),
230cdf0e10cSrcweir 	nLastShadowTbxId(0),
231cdf0e10cSrcweir 	nSaveShadowX	(0),
232cdf0e10cSrcweir 	nSaveShadowY	(0),
233cdf0e10cSrcweir 	nSaveShadowAngle(450),
234cdf0e10cSrcweir 	nSaveShadowSize (100),
235cdf0e10cSrcweir 
236cdf0e10cSrcweir     maImageList     (ResId(IL_FONTWORK,*rResId.GetResMgr())),
237cdf0e10cSrcweir     maImageListH    (ResId(ILH_FONTWORK,*rResId.GetResMgr())),
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     pColorTable     (NULL)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir 	FreeResource();
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 	ApplyImageList();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	pCtrlItems[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE, *this, rBindings);
246cdf0e10cSrcweir 	pCtrlItems[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST, *this, rBindings);
247cdf0e10cSrcweir 	pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings);
248cdf0e10cSrcweir 	pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings);
249cdf0e10cSrcweir 	pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings);
250*1e9c32afSArmin Le Grand 	pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings);
251*1e9c32afSArmin Le Grand 	pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings);
252*1e9c32afSArmin Le Grand 	pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings);
253*1e9c32afSArmin Le Grand 	pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings);
254*1e9c32afSArmin Le Grand 	pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings);
255*1e9c32afSArmin Le Grand 	pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	Size aSize = aTbxStyle.CalcWindowSizePixel();
258cdf0e10cSrcweir 	aTbxStyle.SetSizePixel(aSize);
259cdf0e10cSrcweir 	aTbxStyle.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectStyleHdl_Impl) );
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 	aTbxAdjust.SetSizePixel(aSize);
262cdf0e10cSrcweir 	aTbxAdjust.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectAdjustHdl_Impl) );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	aTbxShadow.SetSizePixel(aSize);
265cdf0e10cSrcweir 	aTbxShadow.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectShadowHdl_Impl) );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 	Link aLink = LINK(this, SvxFontWorkDialog, ModifyInputHdl_Impl);
268cdf0e10cSrcweir 	aMtrFldDistance.SetModifyHdl( aLink );
269cdf0e10cSrcweir 	aMtrFldTextStart.SetModifyHdl( aLink );
270cdf0e10cSrcweir 	aMtrFldShadowX.SetModifyHdl( aLink );
271cdf0e10cSrcweir 	aMtrFldShadowY.SetModifyHdl( aLink );
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	// System-Metrik setzen
274cdf0e10cSrcweir 	const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
275cdf0e10cSrcweir 	SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
276cdf0e10cSrcweir 	SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
277cdf0e10cSrcweir 	SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
278cdf0e10cSrcweir 	SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
279cdf0e10cSrcweir 	if( eDlgUnit == FUNIT_MM )
280cdf0e10cSrcweir 	{
281cdf0e10cSrcweir 		aMtrFldDistance.SetSpinSize( 50 );
282cdf0e10cSrcweir 		aMtrFldTextStart.SetSpinSize( 50 );
283cdf0e10cSrcweir 		aMtrFldShadowX.SetSpinSize( 50 );
284cdf0e10cSrcweir 		aMtrFldShadowY.SetSpinSize( 50 );
285cdf0e10cSrcweir 	}
286cdf0e10cSrcweir 	else
287cdf0e10cSrcweir 	{
288cdf0e10cSrcweir 		aMtrFldDistance.SetSpinSize( 10 );
289cdf0e10cSrcweir 		aMtrFldTextStart.SetSpinSize( 10 );
290cdf0e10cSrcweir 		aMtrFldShadowX.SetSpinSize( 10 );
291cdf0e10cSrcweir 		aMtrFldShadowY.SetSpinSize( 10 );
292cdf0e10cSrcweir 	}
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	aShadowColorLB.SetSelectHdl( LINK(this, SvxFontWorkDialog, ColorSelectHdl_Impl) );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	aInputTimer.SetTimeout(500);
297cdf0e10cSrcweir 	aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl));
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir /*************************************************************************
301cdf0e10cSrcweir |*
302cdf0e10cSrcweir |* Destruktor
303cdf0e10cSrcweir |*
304cdf0e10cSrcweir \************************************************************************/
305cdf0e10cSrcweir 
306cdf0e10cSrcweir SvxFontWorkDialog::~SvxFontWorkDialog()
307cdf0e10cSrcweir {
308cdf0e10cSrcweir 	for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
309cdf0e10cSrcweir 		DELETEZ(pCtrlItems[i]);
310cdf0e10cSrcweir }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir /*************************************************************************
313cdf0e10cSrcweir |*
314cdf0e10cSrcweir \************************************************************************/
315cdf0e10cSrcweir 
316cdf0e10cSrcweir void SvxFontWorkDialog::Zoom()
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	SfxDockingWindow::Roll();
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 
322cdf0e10cSrcweir /*************************************************************************
323cdf0e10cSrcweir |*
324cdf0e10cSrcweir |*
325cdf0e10cSrcweir |*
326cdf0e10cSrcweir \************************************************************************/
327cdf0e10cSrcweir 
328cdf0e10cSrcweir SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
329cdf0e10cSrcweir 													 SfxChildAlignment eAlign )
330cdf0e10cSrcweir {
331cdf0e10cSrcweir 	SfxChildAlignment eAlignment;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	switch ( eAlign )
334cdf0e10cSrcweir 	{
335cdf0e10cSrcweir 		case SFX_ALIGN_TOP:
336cdf0e10cSrcweir 		case SFX_ALIGN_HIGHESTTOP:
337cdf0e10cSrcweir 		case SFX_ALIGN_LOWESTTOP:
338cdf0e10cSrcweir 		case SFX_ALIGN_BOTTOM:
339cdf0e10cSrcweir 		case SFX_ALIGN_LOWESTBOTTOM:
340cdf0e10cSrcweir 		case SFX_ALIGN_HIGHESTBOTTOM:
341cdf0e10cSrcweir 		{
342cdf0e10cSrcweir 			eAlignment = eActAlign;
343cdf0e10cSrcweir 		}
344cdf0e10cSrcweir 		break;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 		case SFX_ALIGN_LEFT:
347cdf0e10cSrcweir 		case SFX_ALIGN_RIGHT:
348cdf0e10cSrcweir 		case SFX_ALIGN_FIRSTLEFT:
349cdf0e10cSrcweir 		case SFX_ALIGN_LASTLEFT:
350cdf0e10cSrcweir 		case SFX_ALIGN_FIRSTRIGHT:
351cdf0e10cSrcweir 		case SFX_ALIGN_LASTRIGHT:
352cdf0e10cSrcweir 		{
353cdf0e10cSrcweir 			eAlignment = eAlign;
354cdf0e10cSrcweir 		}
355cdf0e10cSrcweir 		break;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		default:
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			eAlignment = eAlign;
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 		break;
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 	return eAlignment;
365cdf0e10cSrcweir }
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 
368cdf0e10cSrcweir /*************************************************************************
369cdf0e10cSrcweir |*
370cdf0e10cSrcweir |* Style-Buttons setzen
371cdf0e10cSrcweir |*
372cdf0e10cSrcweir \************************************************************************/
373cdf0e10cSrcweir 
374cdf0e10cSrcweir void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem* pItem)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     if ( pItem )
377cdf0e10cSrcweir 	{
378cdf0e10cSrcweir 		sal_uInt16 nId = TBI_STYLE_OFF;
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 		switch ( pItem->GetValue() )
381cdf0e10cSrcweir 		{
382cdf0e10cSrcweir 			case XFT_ROTATE : nId = TBI_STYLE_ROTATE;	break;
383cdf0e10cSrcweir 			case XFT_UPRIGHT: nId = TBI_STYLE_UPRIGHT;	break;
384cdf0e10cSrcweir 			case XFT_SLANTX : nId = TBI_STYLE_SLANTX;	break;
385cdf0e10cSrcweir 			case XFT_SLANTY : nId = TBI_STYLE_SLANTY;	break;
386cdf0e10cSrcweir             default: ;//prevent warning
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir 		aTbxStyle.Enable();
389cdf0e10cSrcweir 
390cdf0e10cSrcweir         // Make sure that there is allways exactly one checked toolbox item.
391cdf0e10cSrcweir 		if ( pItem->GetValue() == XFT_NONE )
392cdf0e10cSrcweir 		{
393cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_ROTATE, sal_False);
394cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_UPRIGHT, sal_False);
395cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_SLANTX, sal_False);
396cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_SLANTY, sal_False);
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_True);
399cdf0e10cSrcweir 		}
400cdf0e10cSrcweir 		else
401cdf0e10cSrcweir         {
402cdf0e10cSrcweir 			aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_False);
403cdf0e10cSrcweir             aTbxStyle.CheckItem(nId);
404cdf0e10cSrcweir         }
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 		nLastStyleTbxId = nId;
407cdf0e10cSrcweir 	}
408cdf0e10cSrcweir 	else
409cdf0e10cSrcweir 		aTbxStyle.Disable();
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir /*************************************************************************
413cdf0e10cSrcweir |*
414cdf0e10cSrcweir |* Adjust-Buttons setzen
415cdf0e10cSrcweir |*
416cdf0e10cSrcweir \************************************************************************/
417cdf0e10cSrcweir 
418cdf0e10cSrcweir void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir 	if ( pItem )
421cdf0e10cSrcweir 	{
422cdf0e10cSrcweir 		sal_uInt16 nId;
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 		aTbxAdjust.Enable();
425cdf0e10cSrcweir 		aMtrFldDistance.Enable();
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 		if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
428cdf0e10cSrcweir 		{
429cdf0e10cSrcweir 			if ( pItem->GetValue() == XFT_LEFT )	nId = TBI_ADJUST_LEFT;
430cdf0e10cSrcweir 			else									nId = TBI_ADJUST_RIGHT;
431cdf0e10cSrcweir 			aMtrFldTextStart.Enable();
432cdf0e10cSrcweir 		}
433cdf0e10cSrcweir 		else
434cdf0e10cSrcweir 		{
435cdf0e10cSrcweir 			if ( pItem->GetValue() == XFT_CENTER )	nId = TBI_ADJUST_CENTER;
436cdf0e10cSrcweir 			else									nId = TBI_ADJUST_AUTOSIZE;
437cdf0e10cSrcweir 			aMtrFldTextStart.Disable();
438cdf0e10cSrcweir 		}
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 		if ( !aTbxAdjust.IsItemChecked(nId) )
441cdf0e10cSrcweir 		{
442cdf0e10cSrcweir 			aTbxAdjust.CheckItem(nId);
443cdf0e10cSrcweir 		}
444cdf0e10cSrcweir 		nLastAdjustTbxId = nId;
445cdf0e10cSrcweir 	}
446cdf0e10cSrcweir 	else
447cdf0e10cSrcweir 	{
448cdf0e10cSrcweir 		aTbxAdjust.Disable();
449cdf0e10cSrcweir 		aMtrFldTextStart.Disable();
450cdf0e10cSrcweir 		aMtrFldDistance.Disable();
451cdf0e10cSrcweir 	}
452cdf0e10cSrcweir }
453cdf0e10cSrcweir 
454cdf0e10cSrcweir /*************************************************************************
455cdf0e10cSrcweir |*
456cdf0e10cSrcweir |* Abstand-Wert in Editfeld eintragen
457cdf0e10cSrcweir |*
458cdf0e10cSrcweir \************************************************************************/
459cdf0e10cSrcweir 
460cdf0e10cSrcweir void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem* pItem)
461cdf0e10cSrcweir {
462cdf0e10cSrcweir 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
463cdf0e10cSrcweir 	if ( pItem && !aMtrFldDistance.HasChildPathFocus() )
464cdf0e10cSrcweir 	{
465cdf0e10cSrcweir 		SetMetricValue( aMtrFldDistance, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
466cdf0e10cSrcweir 	}
467cdf0e10cSrcweir }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir /*************************************************************************
470cdf0e10cSrcweir |*
471cdf0e10cSrcweir |* Einzug-Wert in Editfeld eintragen
472cdf0e10cSrcweir |*
473cdf0e10cSrcweir \************************************************************************/
474cdf0e10cSrcweir 
475cdf0e10cSrcweir void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem* pItem)
476cdf0e10cSrcweir {
477cdf0e10cSrcweir 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
478cdf0e10cSrcweir 	if ( pItem && !aMtrFldTextStart.HasChildPathFocus() )
479cdf0e10cSrcweir 	{
480cdf0e10cSrcweir 		SetMetricValue( aMtrFldTextStart, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
481cdf0e10cSrcweir 	}
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir /*************************************************************************
485cdf0e10cSrcweir |*
486cdf0e10cSrcweir |* Button fuer Umkehrung der Textrichtung setzen
487cdf0e10cSrcweir |*
488cdf0e10cSrcweir \************************************************************************/
489cdf0e10cSrcweir 
490cdf0e10cSrcweir void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem)
491cdf0e10cSrcweir {
492cdf0e10cSrcweir 	if ( pItem )
493cdf0e10cSrcweir 		aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue());
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
496cdf0e10cSrcweir /*************************************************************************
497cdf0e10cSrcweir |*
498cdf0e10cSrcweir |* Button fuer Konturanzeige setzen
499cdf0e10cSrcweir |*
500cdf0e10cSrcweir \************************************************************************/
501cdf0e10cSrcweir 
502cdf0e10cSrcweir void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem)
503cdf0e10cSrcweir {
504cdf0e10cSrcweir 	if ( pItem )
505cdf0e10cSrcweir 		aTbxShadow.CheckItem(TBI_SHOWFORM, !pItem->GetValue());
506cdf0e10cSrcweir }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir /*************************************************************************
509cdf0e10cSrcweir |*
510cdf0e10cSrcweir |* Button fuer Zeichenumrandung setzen
511cdf0e10cSrcweir |*
512cdf0e10cSrcweir \************************************************************************/
513cdf0e10cSrcweir 
514cdf0e10cSrcweir void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem* pItem)
515cdf0e10cSrcweir {
516cdf0e10cSrcweir 	if ( pItem )
517cdf0e10cSrcweir 		aTbxShadow.CheckItem(TBI_OUTLINE, pItem->GetValue());
518cdf0e10cSrcweir }
519cdf0e10cSrcweir 
520cdf0e10cSrcweir /*************************************************************************
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir |* Shadow-Buttons setzen
523cdf0e10cSrcweir |*
524cdf0e10cSrcweir \************************************************************************/
525cdf0e10cSrcweir 
526cdf0e10cSrcweir void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
527cdf0e10cSrcweir 										sal_Bool bRestoreValues)
528cdf0e10cSrcweir {
529cdf0e10cSrcweir 	if ( pItem )
530cdf0e10cSrcweir 	{
531cdf0e10cSrcweir 		sal_uInt16 nId;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 		aTbxShadow.Enable();
534cdf0e10cSrcweir 
535cdf0e10cSrcweir 		if ( pItem->GetValue() == XFTSHADOW_NONE )
536cdf0e10cSrcweir 		{
537cdf0e10cSrcweir 			nId = TBI_SHADOW_OFF;
538cdf0e10cSrcweir 			aFbShadowX.Hide();
539cdf0e10cSrcweir 			aFbShadowY.Hide();
540cdf0e10cSrcweir 			aMtrFldShadowX.Disable();
541cdf0e10cSrcweir 			aMtrFldShadowY.Disable();
542cdf0e10cSrcweir 			aShadowColorLB.Disable();
543cdf0e10cSrcweir 		}
544cdf0e10cSrcweir 		else
545cdf0e10cSrcweir 		{
546cdf0e10cSrcweir 			aFbShadowX.Show();
547cdf0e10cSrcweir 			aFbShadowY.Show();
548cdf0e10cSrcweir 			aMtrFldShadowX.Enable();
549cdf0e10cSrcweir 			aMtrFldShadowY.Enable();
550cdf0e10cSrcweir 			aShadowColorLB.Enable();
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 			if ( pItem->GetValue() == XFTSHADOW_NORMAL )
553cdf0e10cSrcweir 			{
554cdf0e10cSrcweir 				nId = TBI_SHADOW_NORMAL;
555cdf0e10cSrcweir 				const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
556cdf0e10cSrcweir 
557cdf0e10cSrcweir //              aFbShadowX.SetBitmap( Bitmap( ResId(RID_SVXBMP_SHADOW_XDIST, _pMgr ) ) );
558cdf0e10cSrcweir 				//aMtrFldShadowX.SetUnit(FUNIT_MM);
559cdf0e10cSrcweir 				aMtrFldShadowX.SetUnit( eDlgUnit );
560cdf0e10cSrcweir 				aMtrFldShadowX.SetDecimalDigits(2);
561cdf0e10cSrcweir                 aMtrFldShadowX.SetMin(LONG_MIN);
562cdf0e10cSrcweir                 aMtrFldShadowX.SetMax(LONG_MAX);
563cdf0e10cSrcweir 				if( eDlgUnit == FUNIT_MM )
564cdf0e10cSrcweir 					aMtrFldShadowX.SetSpinSize( 50 );
565cdf0e10cSrcweir 				else
566cdf0e10cSrcweir 					aMtrFldShadowX.SetSpinSize( 10 );
567cdf0e10cSrcweir 
568cdf0e10cSrcweir //              aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_YDIST, _pMgr ) ) );
569cdf0e10cSrcweir 				//aMtrFldShadowY.SetUnit(FUNIT_MM);
570cdf0e10cSrcweir 				aMtrFldShadowY.SetUnit( eDlgUnit );
571cdf0e10cSrcweir 				aMtrFldShadowY.SetDecimalDigits(2);
572cdf0e10cSrcweir                 aMtrFldShadowY.SetMin(LONG_MIN);
573cdf0e10cSrcweir                 aMtrFldShadowY.SetMax(LONG_MAX);
574cdf0e10cSrcweir 				if( eDlgUnit == FUNIT_MM )
575cdf0e10cSrcweir 					aMtrFldShadowY.SetSpinSize( 50 );
576cdf0e10cSrcweir 				else
577cdf0e10cSrcweir 					aMtrFldShadowY.SetSpinSize( 10 );
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 				if ( bRestoreValues )
580cdf0e10cSrcweir 				{
581cdf0e10cSrcweir 					SetMetricValue( aMtrFldShadowX, nSaveShadowX, SFX_MAPUNIT_100TH_MM );
582cdf0e10cSrcweir 					SetMetricValue( aMtrFldShadowY, nSaveShadowY, SFX_MAPUNIT_100TH_MM );
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 					XFormTextShadowXValItem aXItem( nSaveShadowX );
585cdf0e10cSrcweir 					XFormTextShadowYValItem aYItem( nSaveShadowY );
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 					GetBindings().GetDispatcher()->Execute(
588cdf0e10cSrcweir 						SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
589cdf0e10cSrcweir 				}
590cdf0e10cSrcweir 			}
591cdf0e10cSrcweir 			else
592cdf0e10cSrcweir 			{
593cdf0e10cSrcweir 				nId = TBI_SHADOW_SLANT;
594cdf0e10cSrcweir 
595cdf0e10cSrcweir //              aFbShadowX.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_ANGLE, _pMgr ) ) );
596cdf0e10cSrcweir 				aMtrFldShadowX.SetUnit(FUNIT_CUSTOM);
597cdf0e10cSrcweir 				aMtrFldShadowX.SetDecimalDigits(1);
598cdf0e10cSrcweir                 aMtrFldShadowX.SetMin(-1800);
599cdf0e10cSrcweir                 aMtrFldShadowX.SetMax( 1800);
600cdf0e10cSrcweir 				aMtrFldShadowX.SetSpinSize(10);
601cdf0e10cSrcweir 
602cdf0e10cSrcweir //              aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_SIZE, _pMgr ) ) );
603cdf0e10cSrcweir 				aMtrFldShadowY.SetUnit(FUNIT_CUSTOM);
604cdf0e10cSrcweir 				aMtrFldShadowY.SetDecimalDigits(0);
605cdf0e10cSrcweir                 aMtrFldShadowY.SetMin(-999);
606cdf0e10cSrcweir                 aMtrFldShadowY.SetMax( 999);
607cdf0e10cSrcweir 				aMtrFldShadowY.SetSpinSize(10);
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 				if ( bRestoreValues )
610cdf0e10cSrcweir 				{
611cdf0e10cSrcweir 					aMtrFldShadowX.SetValue(nSaveShadowAngle);
612cdf0e10cSrcweir 					aMtrFldShadowY.SetValue(nSaveShadowSize);
613cdf0e10cSrcweir 					XFormTextShadowXValItem aXItem(nSaveShadowAngle);
614cdf0e10cSrcweir 					XFormTextShadowYValItem aYItem(nSaveShadowSize);
615cdf0e10cSrcweir 					GetBindings().GetDispatcher()->Execute(
616cdf0e10cSrcweir 						SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
617cdf0e10cSrcweir 				}
618cdf0e10cSrcweir 			}
619cdf0e10cSrcweir 		}
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 		if ( !aTbxShadow.IsItemChecked(nId) )
622cdf0e10cSrcweir 		{
623cdf0e10cSrcweir 			aTbxShadow.CheckItem(nId);
624cdf0e10cSrcweir 		}
625cdf0e10cSrcweir 		nLastShadowTbxId = nId;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 		ApplyImageList();
628cdf0e10cSrcweir 	}
629cdf0e10cSrcweir 	else
630cdf0e10cSrcweir 	{
631cdf0e10cSrcweir 		aTbxShadow.Disable();
632cdf0e10cSrcweir 		aMtrFldShadowX.Disable();
633cdf0e10cSrcweir 		aMtrFldShadowY.Disable();
634cdf0e10cSrcweir 		aShadowColorLB.Disable();
635cdf0e10cSrcweir 	}
636cdf0e10cSrcweir }
637cdf0e10cSrcweir 
638cdf0e10cSrcweir /*************************************************************************
639cdf0e10cSrcweir |*
640cdf0e10cSrcweir |* Schattenfarbe in Listbox eintragen
641cdf0e10cSrcweir |*
642cdf0e10cSrcweir \************************************************************************/
643cdf0e10cSrcweir 
644cdf0e10cSrcweir void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pItem)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir 	if ( pItem )
647cdf0e10cSrcweir         aShadowColorLB.SelectEntry(pItem->GetColorValue());
648cdf0e10cSrcweir }
649cdf0e10cSrcweir 
650cdf0e10cSrcweir /*************************************************************************
651cdf0e10cSrcweir |*
652cdf0e10cSrcweir |* X-Wert fuer Schatten in Editfeld eintragen
653cdf0e10cSrcweir |*
654cdf0e10cSrcweir \************************************************************************/
655cdf0e10cSrcweir 
656cdf0e10cSrcweir void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem)
657cdf0e10cSrcweir {
658cdf0e10cSrcweir 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
659cdf0e10cSrcweir 	if ( pItem && !aMtrFldShadowX.HasChildPathFocus() )
660cdf0e10cSrcweir 	{
661cdf0e10cSrcweir 		// #i19251#
662cdf0e10cSrcweir 		// sal_Int32 nValue = pItem->GetValue();
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 		// #i19251#
665cdf0e10cSrcweir 		// The two involved fields/items are used double and contain/give different
666cdf0e10cSrcweir 		// values regarding to the access method. Thus, here we need to separate the access
667cdf0e10cSrcweir 		// methos regarding to the kind of value accessed.
668cdf0e10cSrcweir 		if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
669cdf0e10cSrcweir 		{
670cdf0e10cSrcweir 			// #i19251#
671cdf0e10cSrcweir 			// There is no value correction necessary at all, i think this
672cdf0e10cSrcweir 			// was only tried to be done without understanding that the two
673cdf0e10cSrcweir 			// involved fields/items are used double and contain/give different
674cdf0e10cSrcweir 			// values regarding to the access method.
675cdf0e10cSrcweir 			// nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
676cdf0e10cSrcweir 			aMtrFldShadowX.SetValue(pItem->GetValue());
677cdf0e10cSrcweir 		}
678cdf0e10cSrcweir 		else
679cdf0e10cSrcweir 		{
680cdf0e10cSrcweir 			SetMetricValue( aMtrFldShadowX, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
681cdf0e10cSrcweir 		}
682cdf0e10cSrcweir 	}
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685cdf0e10cSrcweir /*************************************************************************
686cdf0e10cSrcweir |*
687cdf0e10cSrcweir |* Y-Wert fuer Schatten in Editfeld eintragen
688cdf0e10cSrcweir |*
689cdf0e10cSrcweir \************************************************************************/
690cdf0e10cSrcweir 
691cdf0e10cSrcweir void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem)
692cdf0e10cSrcweir {
693cdf0e10cSrcweir 	// #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
694cdf0e10cSrcweir 	if ( pItem && !aMtrFldShadowY.HasChildPathFocus() )
695cdf0e10cSrcweir 	{
696cdf0e10cSrcweir 		// #i19251#
697cdf0e10cSrcweir 		// The two involved fields/items are used double and contain/give different
698cdf0e10cSrcweir 		// values regarding to the access method. Thus, here we need to separate the access
699cdf0e10cSrcweir 		// methos regarding to the kind of value accessed.
700cdf0e10cSrcweir 		if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
701cdf0e10cSrcweir 		{
702cdf0e10cSrcweir 			aMtrFldShadowY.SetValue(pItem->GetValue());
703cdf0e10cSrcweir 		}
704cdf0e10cSrcweir 		else
705cdf0e10cSrcweir 		{
706cdf0e10cSrcweir 			SetMetricValue( aMtrFldShadowY, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
707cdf0e10cSrcweir 		}
708cdf0e10cSrcweir 	}
709cdf0e10cSrcweir }
710cdf0e10cSrcweir 
711cdf0e10cSrcweir /*************************************************************************
712cdf0e10cSrcweir |*
713cdf0e10cSrcweir \************************************************************************/
714cdf0e10cSrcweir 
715cdf0e10cSrcweir IMPL_LINK( SvxFontWorkDialog, SelectStyleHdl_Impl, void *, EMPTYARG )
716cdf0e10cSrcweir {
717cdf0e10cSrcweir 	sal_uInt16 nId = aTbxStyle.GetCurItemId();
718cdf0e10cSrcweir 
719cdf0e10cSrcweir     // Execute this block when a different toolbox item has been clicked or
720cdf0e10cSrcweir     // when the off item has been clicked.  The later is necessary to
721cdf0e10cSrcweir     // override the toolbox behaviour of unchecking the item after second
722cdf0e10cSrcweir     // click on it: One of the items has to be checked at all times (when
723cdf0e10cSrcweir     // enabled that is.)
724cdf0e10cSrcweir 	if (nId == TBI_STYLE_OFF || nId != nLastStyleTbxId )
725cdf0e10cSrcweir 	{
726cdf0e10cSrcweir 		XFormTextStyle eStyle = XFT_NONE;
727cdf0e10cSrcweir 
728cdf0e10cSrcweir 		switch ( nId )
729cdf0e10cSrcweir 		{
730cdf0e10cSrcweir 			case TBI_STYLE_ROTATE	: eStyle = XFT_ROTATE;	break;
731cdf0e10cSrcweir 			case TBI_STYLE_UPRIGHT	: eStyle = XFT_UPRIGHT; break;
732cdf0e10cSrcweir 			case TBI_STYLE_SLANTX	: eStyle = XFT_SLANTX;	break;
733cdf0e10cSrcweir 			case TBI_STYLE_SLANTY	: eStyle = XFT_SLANTY;	break;
734cdf0e10cSrcweir 		}
735cdf0e10cSrcweir 		XFormTextStyleItem aItem( eStyle );
736cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L );
737cdf0e10cSrcweir 		SetStyle_Impl( &aItem );
738cdf0e10cSrcweir 		nLastStyleTbxId = nId;
739cdf0e10cSrcweir 	}
740cdf0e10cSrcweir 	return 0;
741cdf0e10cSrcweir }
742cdf0e10cSrcweir 
743cdf0e10cSrcweir /*************************************************************************
744cdf0e10cSrcweir |*
745cdf0e10cSrcweir \************************************************************************/
746cdf0e10cSrcweir 
747cdf0e10cSrcweir IMPL_LINK( SvxFontWorkDialog, SelectAdjustHdl_Impl, void *, EMPTYARG )
748cdf0e10cSrcweir {
749cdf0e10cSrcweir 	sal_uInt16 nId = aTbxAdjust.GetCurItemId();
750cdf0e10cSrcweir 
751cdf0e10cSrcweir 	if ( nId == TBI_ADJUST_MIRROR )
752cdf0e10cSrcweir 	{
753cdf0e10cSrcweir 		XFormTextMirrorItem aItem(aTbxAdjust.IsItemChecked(nId));
754cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_MIRROR, SFX_CALLMODE_SLOT, &aItem, 0L );
755cdf0e10cSrcweir 	}
756cdf0e10cSrcweir 	else if ( nId != nLastAdjustTbxId )
757cdf0e10cSrcweir 	{
758cdf0e10cSrcweir 		XFormTextAdjust eAdjust = XFT_AUTOSIZE;
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 		switch ( nId )
761cdf0e10cSrcweir 		{
762cdf0e10cSrcweir 			case TBI_ADJUST_LEFT	: eAdjust = XFT_LEFT;	break;
763cdf0e10cSrcweir 			case TBI_ADJUST_CENTER	: eAdjust = XFT_CENTER; break;
764cdf0e10cSrcweir 			case TBI_ADJUST_RIGHT	: eAdjust = XFT_RIGHT;	break;
765cdf0e10cSrcweir 		}
766cdf0e10cSrcweir 		XFormTextAdjustItem aItem(eAdjust);
767cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_ADJUST, SFX_CALLMODE_RECORD, &aItem, 0L );
768cdf0e10cSrcweir 		SetAdjust_Impl(&aItem);
769cdf0e10cSrcweir 		nLastAdjustTbxId = nId;
770cdf0e10cSrcweir 	}
771cdf0e10cSrcweir 	return 0;
772cdf0e10cSrcweir }
773cdf0e10cSrcweir 
774cdf0e10cSrcweir /*************************************************************************
775cdf0e10cSrcweir |*
776cdf0e10cSrcweir \************************************************************************/
777cdf0e10cSrcweir 
778cdf0e10cSrcweir IMPL_LINK( SvxFontWorkDialog, SelectShadowHdl_Impl, void *, EMPTYARG )
779cdf0e10cSrcweir {
780cdf0e10cSrcweir 	sal_uInt16 nId = aTbxShadow.GetCurItemId();
781cdf0e10cSrcweir 
782cdf0e10cSrcweir 	if ( nId == TBI_SHOWFORM )
783cdf0e10cSrcweir 	{
784cdf0e10cSrcweir 		XFormTextHideFormItem aItem(!aTbxShadow.IsItemChecked(nId));
785cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_HIDEFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
786cdf0e10cSrcweir 	}
787cdf0e10cSrcweir 	else if ( nId == TBI_OUTLINE )
788cdf0e10cSrcweir 	{
789cdf0e10cSrcweir 		XFormTextOutlineItem aItem(aTbxShadow.IsItemChecked(nId));
790cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_OUTLINE, SFX_CALLMODE_RECORD, &aItem, 0L );
791cdf0e10cSrcweir 	}
792cdf0e10cSrcweir 	else if ( nId != nLastShadowTbxId )
793cdf0e10cSrcweir 	{
794cdf0e10cSrcweir 		XFormTextShadow eShadow = XFTSHADOW_NONE;
795cdf0e10cSrcweir 
796cdf0e10cSrcweir 		if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
797cdf0e10cSrcweir 		{
798cdf0e10cSrcweir 			nSaveShadowX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
799cdf0e10cSrcweir 			nSaveShadowY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
800cdf0e10cSrcweir 		}
801cdf0e10cSrcweir 		else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
802cdf0e10cSrcweir 		{
803cdf0e10cSrcweir 			nSaveShadowAngle = static_cast<long>(aMtrFldShadowX.GetValue());
804cdf0e10cSrcweir 			nSaveShadowSize  = static_cast<long>(aMtrFldShadowY.GetValue());
805cdf0e10cSrcweir 		}
806cdf0e10cSrcweir 		nLastShadowTbxId = nId;
807cdf0e10cSrcweir 
808cdf0e10cSrcweir 		if ( nId == TBI_SHADOW_NORMAL ) 	eShadow = XFTSHADOW_NORMAL;
809cdf0e10cSrcweir 		else if ( nId == TBI_SHADOW_SLANT ) eShadow = XFTSHADOW_SLANT;
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 		XFormTextShadowItem aItem(eShadow);
812cdf0e10cSrcweir 		GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHADOW, SFX_CALLMODE_RECORD, &aItem, 0L );
813cdf0e10cSrcweir 		SetShadow_Impl(&aItem, sal_True);
814cdf0e10cSrcweir 	}
815cdf0e10cSrcweir 	return 0;
816cdf0e10cSrcweir }
817cdf0e10cSrcweir 
818cdf0e10cSrcweir /*************************************************************************
819cdf0e10cSrcweir |*
820cdf0e10cSrcweir \************************************************************************/
821cdf0e10cSrcweir 
822cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
823cdf0e10cSrcweir {
824cdf0e10cSrcweir 	aInputTimer.Start();
825cdf0e10cSrcweir 	return 0;
826cdf0e10cSrcweir }
827cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
828cdf0e10cSrcweir 
829cdf0e10cSrcweir /*************************************************************************
830cdf0e10cSrcweir |*
831cdf0e10cSrcweir \************************************************************************/
832cdf0e10cSrcweir 
833cdf0e10cSrcweir IMPL_LINK( SvxFontWorkDialog, InputTimoutHdl_Impl, void *, EMPTYARG )
834cdf0e10cSrcweir {
835cdf0e10cSrcweir 	// System-Metrik evtl. neu setzen
836cdf0e10cSrcweir 	// Dieses sollte mal als Listener passieren, ist aber aus
837cdf0e10cSrcweir 	// inkompatibilitaetsgruenden z.Z. nicht moeglich
838cdf0e10cSrcweir 	const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
839cdf0e10cSrcweir 	if( eDlgUnit != aMtrFldDistance.GetUnit() )
840cdf0e10cSrcweir 	{
841cdf0e10cSrcweir 		SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
842cdf0e10cSrcweir 		SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
843cdf0e10cSrcweir 		aMtrFldDistance.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
844cdf0e10cSrcweir 		aMtrFldTextStart.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
845cdf0e10cSrcweir 	}
846cdf0e10cSrcweir 	if( eDlgUnit != aMtrFldShadowX.GetUnit() &&
847cdf0e10cSrcweir 		aTbxShadow.IsItemChecked( TBI_SHADOW_NORMAL ) )
848cdf0e10cSrcweir 	{
849cdf0e10cSrcweir 		SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
850cdf0e10cSrcweir 		SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
851cdf0e10cSrcweir 		aMtrFldShadowX.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
852cdf0e10cSrcweir 		aMtrFldShadowY.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
853cdf0e10cSrcweir 	}
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 	long nValue = GetCoreValue( aMtrFldDistance, SFX_MAPUNIT_100TH_MM );
856cdf0e10cSrcweir 	XFormTextDistanceItem aDistItem( nValue );
857cdf0e10cSrcweir 	nValue = GetCoreValue( aMtrFldTextStart, SFX_MAPUNIT_100TH_MM );
858cdf0e10cSrcweir 	XFormTextStartItem aStartItem( nValue );
859cdf0e10cSrcweir 
860cdf0e10cSrcweir 	sal_Int32 nValueX(0L);
861cdf0e10cSrcweir 	sal_Int32 nValueY(0L);
862cdf0e10cSrcweir 
863cdf0e10cSrcweir 	// #i19251#
864cdf0e10cSrcweir 	// The two involved fields/items are used double and contain/give different
865cdf0e10cSrcweir 	// values regarding to the access method. Thus, here we need to separate the access
866cdf0e10cSrcweir 	// methos regarding to the kind of value accessed.
867cdf0e10cSrcweir 	if(nLastShadowTbxId == TBI_SHADOW_NORMAL)
868cdf0e10cSrcweir 	{
869cdf0e10cSrcweir 		nValueX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
870cdf0e10cSrcweir 		nValueY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
871cdf0e10cSrcweir 	}
872cdf0e10cSrcweir 	else if(nLastShadowTbxId == TBI_SHADOW_SLANT)
873cdf0e10cSrcweir 	{
874cdf0e10cSrcweir 		nValueX = static_cast<long>(aMtrFldShadowX.GetValue());
875cdf0e10cSrcweir 		nValueY = static_cast<long>(aMtrFldShadowY.GetValue());
876cdf0e10cSrcweir 	}
877cdf0e10cSrcweir 
878cdf0e10cSrcweir 	XFormTextShadowXValItem aShadowXItem( nValueX );
879cdf0e10cSrcweir 	XFormTextShadowYValItem aShadowYItem( nValueY );
880cdf0e10cSrcweir 
881cdf0e10cSrcweir 	// Slot-ID ist egal, die Exec-Methode wertet das gesamte ItemSet aus
882cdf0e10cSrcweir 	GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_DISTANCE, SFX_CALLMODE_RECORD, &aDistItem,
883cdf0e10cSrcweir 											&aStartItem, &aShadowXItem, &aShadowYItem, 0L );
884cdf0e10cSrcweir 	return 0;
885cdf0e10cSrcweir }
886cdf0e10cSrcweir 
887cdf0e10cSrcweir /*************************************************************************
888cdf0e10cSrcweir |*
889cdf0e10cSrcweir \************************************************************************/
890cdf0e10cSrcweir 
891cdf0e10cSrcweir IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG )
892cdf0e10cSrcweir {
893cdf0e10cSrcweir // Changed by obo. Linux-Compiler can't parse commented lines
894cdf0e10cSrcweir 	XFormTextShadowColorItem aItem( (const String &) String(),
895cdf0e10cSrcweir 								    (const Color &) aShadowColorLB.GetSelectEntryColor() );
896cdf0e10cSrcweir //	XFormTextShadowColorItem aItem( String(),
897cdf0e10cSrcweir //								    aShadowColorLB.GetSelectEntryColor() );
898cdf0e10cSrcweir 	GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHDWCOLOR, SFX_CALLMODE_RECORD, &aItem, 0L );
899cdf0e10cSrcweir 	return 0;
900cdf0e10cSrcweir }
901cdf0e10cSrcweir 
902cdf0e10cSrcweir /*************************************************************************
903cdf0e10cSrcweir |*
904cdf0e10cSrcweir \************************************************************************/
905cdf0e10cSrcweir 
906cdf0e10cSrcweir void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable)
907cdf0e10cSrcweir {
908cdf0e10cSrcweir 	if ( pTable && pTable != pColorTable )
909cdf0e10cSrcweir 	{
910cdf0e10cSrcweir 		pColorTable = pTable;
911cdf0e10cSrcweir 		aShadowColorLB.Clear();
912cdf0e10cSrcweir 		aShadowColorLB.Fill(pColorTable);
913cdf0e10cSrcweir 	}
914cdf0e10cSrcweir }
915cdf0e10cSrcweir 
916cdf0e10cSrcweir /*************************************************************************
917cdf0e10cSrcweir |*
918cdf0e10cSrcweir \************************************************************************/
919cdf0e10cSrcweir 
920cdf0e10cSrcweir void SvxFontWorkDialog::SetActive(sal_Bool /*bActivate*/)
921cdf0e10cSrcweir {
922cdf0e10cSrcweir }
923cdf0e10cSrcweir 
924cdf0e10cSrcweir void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt )
925cdf0e10cSrcweir {
926cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
927cdf0e10cSrcweir             ApplyImageList();
928cdf0e10cSrcweir 
929cdf0e10cSrcweir     SfxDockingWindow::DataChanged( rDCEvt );
930cdf0e10cSrcweir }
931cdf0e10cSrcweir /* -----------------------------08.05.2002 14:28------------------------------
932cdf0e10cSrcweir 
933cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
934cdf0e10cSrcweir void SvxFontWorkDialog::ApplyImageList()
935cdf0e10cSrcweir {
936cdf0e10cSrcweir 	bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
937cdf0e10cSrcweir 
938cdf0e10cSrcweir     ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
939cdf0e10cSrcweir 
940cdf0e10cSrcweir 	aTbxStyle.SetImageList( rImgLst );
941cdf0e10cSrcweir 	aTbxAdjust.SetImageList( rImgLst );
942cdf0e10cSrcweir 	aTbxShadow.SetImageList( rImgLst );
943cdf0e10cSrcweir 
944cdf0e10cSrcweir 	switch( nLastShadowTbxId )
945cdf0e10cSrcweir 	{
946cdf0e10cSrcweir 	case TBI_SHADOW_SLANT:
947cdf0e10cSrcweir 		aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_ANGLE ) );
948cdf0e10cSrcweir 		aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_SIZE ) );
949cdf0e10cSrcweir 		break;
950cdf0e10cSrcweir //	case TBI_SHADOW_NORMAL:
951cdf0e10cSrcweir 	default:
952cdf0e10cSrcweir 		aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_XDIST ) );
953cdf0e10cSrcweir 		aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_YDIST ) );
954cdf0e10cSrcweir 		break;
955cdf0e10cSrcweir 	}
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 	aFbDistance.SetImage( rImgLst.GetImage( TBI_DISTANCE ) );
958cdf0e10cSrcweir 	aFbTextStart.SetImage( rImgLst.GetImage( TBI_TEXTSTART ) );
959cdf0e10cSrcweir 
960cdf0e10cSrcweir }
961