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