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