Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <sfx2/module.hxx>
30 : : #include <sfx2/dispatch.hxx>
31 : : #include <tools/shl.hxx>
32 : :
33 : : #define _SVX_FONTWORK_CXX
34 : : #include <svx/svdobj.hxx>
35 : : #include <svx/svdopath.hxx>
36 : : #include <svx/svdview.hxx>
37 : : #include <svx/svdocirc.hxx>
38 : : #include <svx/xtextit.hxx>
39 : :
40 : : #include <svx/dialmgr.hxx>
41 : : #include "svx/dlgutil.hxx"
42 : :
43 : : #include <svx/dialogs.hrc>
44 : : #include "fontwork.hrc"
45 : : #include <svx/fontwork.hxx>
46 : : #include <editeng/outlobj.hxx>
47 : : #include <basegfx/polygon/b2dpolygon.hxx>
48 : : #include <basegfx/point/b2dpoint.hxx>
49 : :
50 [ # # ][ + - ]: 447 : SFX_IMPL_DOCKINGWINDOW_WITHID( SvxFontWorkChildWindow, SID_FONTWORK );
[ # # ]
51 : :
52 : : // ControllerItem for Fontwork
53 : :
54 : 0 : SvxFontWorkControllerItem::SvxFontWorkControllerItem
55 : : (
56 : : sal_uInt16 _nId,
57 : : SvxFontWorkDialog& rDlg,
58 : : SfxBindings& rBindings
59 : : ) :
60 : :
61 : : SfxControllerItem( _nId, rBindings ),
62 : :
63 : 0 : rFontWorkDlg( rDlg )
64 : : {
65 : 0 : }
66 : :
67 : : // StateChanged method for FontWork items
68 : :
69 : 0 : void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
70 : : const SfxPoolItem* pItem )
71 : : {
72 [ # # # # : 0 : switch ( GetId() )
# # # # #
# # # # ]
73 : : {
74 : : case SID_FORMTEXT_STYLE:
75 : : {
76 : : const XFormTextStyleItem* pStateItem =
77 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextStyleItem, pItem);
78 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStyleItem expected");
79 : 0 : rFontWorkDlg.SetStyle_Impl(pStateItem);
80 : 0 : break;
81 : : }
82 : : case SID_FORMTEXT_ADJUST:
83 : : {
84 : : const XFormTextAdjustItem* pStateItem =
85 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextAdjustItem, pItem);
86 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextAdjustItem expected");
87 : 0 : rFontWorkDlg.SetAdjust_Impl(pStateItem);
88 : 0 : break;
89 : : }
90 : : case SID_FORMTEXT_DISTANCE:
91 : : {
92 : : const XFormTextDistanceItem* pStateItem =
93 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextDistanceItem, pItem);
94 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextDistanceItem erwartet");
95 : 0 : rFontWorkDlg.SetDistance_Impl(pStateItem);
96 : 0 : break;
97 : : }
98 : : case SID_FORMTEXT_START:
99 : : {
100 : : const XFormTextStartItem* pStateItem =
101 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextStartItem, pItem);
102 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStartItem expected");
103 : 0 : rFontWorkDlg.SetStart_Impl(pStateItem);
104 : 0 : break;
105 : : }
106 : : case SID_FORMTEXT_MIRROR:
107 : : {
108 : : const XFormTextMirrorItem* pStateItem =
109 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextMirrorItem, pItem);
110 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextMirrorItem expected");
111 : 0 : rFontWorkDlg.SetMirror_Impl(pStateItem);
112 : 0 : break;
113 : : }
114 : : case SID_FORMTEXT_STDFORM:
115 : : {
116 : : const XFormTextStdFormItem* pStateItem =
117 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextStdFormItem, pItem);
118 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStdFormItem expected");
119 : 0 : rFontWorkDlg.SetStdForm_Impl(pStateItem);
120 : 0 : break;
121 : : }
122 : : case SID_FORMTEXT_HIDEFORM:
123 : : {
124 : : const XFormTextHideFormItem* pStateItem =
125 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextHideFormItem, pItem);
126 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextHideFormItem expected");
127 : 0 : rFontWorkDlg.SetShowForm_Impl(pStateItem);
128 : 0 : break;
129 : : }
130 : : case SID_FORMTEXT_OUTLINE:
131 : : {
132 : : const XFormTextOutlineItem* pStateItem =
133 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextOutlineItem, pItem);
134 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextOutlineItem expected");
135 : 0 : rFontWorkDlg.SetOutline_Impl(pStateItem);
136 : 0 : break;
137 : : }
138 : : case SID_FORMTEXT_SHADOW:
139 : : {
140 : : const XFormTextShadowItem* pStateItem =
141 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextShadowItem, pItem);
142 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowItem expected");
143 : 0 : rFontWorkDlg.SetShadow_Impl(pStateItem);
144 : 0 : break;
145 : : }
146 : : case SID_FORMTEXT_SHDWCOLOR:
147 : : {
148 : : const XFormTextShadowColorItem* pStateItem =
149 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextShadowColorItem, pItem);
150 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowColorItem expected");
151 : 0 : rFontWorkDlg.SetShadowColor_Impl(pStateItem);
152 : 0 : break;
153 : : }
154 : : case SID_FORMTEXT_SHDWXVAL:
155 : : {
156 : : const XFormTextShadowXValItem* pStateItem =
157 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextShadowXValItem, pItem);
158 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowXValItem expected");
159 : 0 : rFontWorkDlg.SetShadowXVal_Impl(pStateItem);
160 : 0 : break;
161 : : }
162 : : case SID_FORMTEXT_SHDWYVAL:
163 : : {
164 : : const XFormTextShadowYValItem* pStateItem =
165 [ # # ][ # # ]: 0 : PTR_CAST(XFormTextShadowYValItem, pItem);
166 : : DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowYValItem expected");
167 : 0 : rFontWorkDlg.SetShadowYVal_Impl(pStateItem);
168 : 0 : break;
169 : : }
170 : : }
171 : 0 : }
172 : :
173 : : // Derivation from SfxChildWindow as "containers" for Fontwork dialog
174 : :
175 : 0 : SvxFontWorkChildWindow::SvxFontWorkChildWindow
176 : : (
177 : : Window* _pParent,
178 : : sal_uInt16 nId,
179 : : SfxBindings* pBindings,
180 : : SfxChildWinInfo* pInfo
181 : : ) :
182 : :
183 : 0 : SfxChildWindow( _pParent, nId )
184 : :
185 : : {
186 : : pWindow = new SvxFontWorkDialog( pBindings, this, _pParent,
187 [ # # ][ # # ]: 0 : SVX_RES( RID_SVXDLG_FONTWORK ) );
[ # # ]
188 : 0 : SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) pWindow;
189 : :
190 : 0 : eChildAlignment = SFX_ALIGN_NOALIGNMENT;
191 : :
192 [ # # ]: 0 : pDlg->Initialize( pInfo );
193 : 0 : }
194 : :
195 : : // Floating Window to the attribution of text effects
196 : :
197 : 0 : SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
198 : : SfxChildWindow *pCW,
199 : : Window* _pParent,
200 : : const ResId& rResId ) :
201 : : SfxDockingWindow( pBindinx, pCW, _pParent, rResId ),
202 : :
203 : 0 : aFormSet (this, ResId(VS_FORMS,*rResId.GetResMgr())),
204 : :
205 : 0 : aTbxStyle (this, ResId(TBX_STYLE,*rResId.GetResMgr())),
206 : 0 : aTbxAdjust (this, ResId(TBX_ADJUST,*rResId.GetResMgr())),
207 : :
208 : 0 : aFbDistance (this, ResId(FB_DISTANCE,*rResId.GetResMgr())),
209 : 0 : aMtrFldDistance (this, ResId(MTR_FLD_DISTANCE,*rResId.GetResMgr())),
210 : 0 : aFbTextStart (this, ResId(FB_TEXTSTART,*rResId.GetResMgr())),
211 : 0 : aMtrFldTextStart(this, ResId(MTR_FLD_TEXTSTART,*rResId.GetResMgr())),
212 : :
213 : 0 : aTbxShadow (this, ResId(TBX_SHADOW,*rResId.GetResMgr())),
214 : :
215 : 0 : aFbShadowX (this, ResId(FB_SHADOW_X,*rResId.GetResMgr())),
216 : 0 : aMtrFldShadowX (this, ResId(MTR_FLD_SHADOW_X,*rResId.GetResMgr())),
217 : 0 : aFbShadowY (this, ResId(FB_SHADOW_Y,*rResId.GetResMgr())),
218 : 0 : aMtrFldShadowY (this, ResId(MTR_FLD_SHADOW_Y,*rResId.GetResMgr())),
219 : :
220 : 0 : aShadowColorLB (this, ResId(CLB_SHADOW_COLOR,*rResId.GetResMgr())),
221 : : rBindings (*pBindinx),
222 : :
223 : : nLastStyleTbxId(0),
224 : : nLastAdjustTbxId(0),
225 : : nLastShadowTbxId(0),
226 : : nSaveShadowX (0),
227 : : nSaveShadowY (0),
228 : : nSaveShadowAngle(450),
229 : : nSaveShadowSize (100),
230 : :
231 [ # # # # : 0 : maImageList (ResId(IL_FONTWORK,*rResId.GetResMgr()))
# # # # #
# # # # #
# # # # #
# # # # #
# # ][ # # ]
[ # # ]
232 : : {
233 [ # # ]: 0 : FreeResource();
234 : :
235 [ # # ]: 0 : ApplyImageList();
236 : :
237 [ # # ][ # # ]: 0 : pCtrlItems[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE, *this, rBindings);
238 [ # # ][ # # ]: 0 : pCtrlItems[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST, *this, rBindings);
239 [ # # ][ # # ]: 0 : pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings);
240 [ # # ][ # # ]: 0 : pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings);
241 [ # # ][ # # ]: 0 : pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings);
242 [ # # ][ # # ]: 0 : pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_STDFORM, *this, rBindings);
243 [ # # ][ # # ]: 0 : pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings);
244 [ # # ][ # # ]: 0 : pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings);
245 [ # # ][ # # ]: 0 : pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings);
246 [ # # ][ # # ]: 0 : pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings);
247 [ # # ][ # # ]: 0 : pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings);
248 [ # # ][ # # ]: 0 : pCtrlItems[11] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings);
249 : :
250 [ # # ]: 0 : WinBits aNewStyle = ( aFormSet.GetStyle() | WB_VSCROLL | WB_ITEMBORDER | WB_DOUBLEBORDER );
251 [ # # ]: 0 : aFormSet.SetStyle( aNewStyle );
252 : :
253 [ # # ]: 0 : Size aSize = aTbxStyle.CalcWindowSizePixel();
254 [ # # ]: 0 : aTbxStyle.SetSizePixel(aSize);
255 [ # # ]: 0 : aTbxStyle.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectStyleHdl_Impl) );
256 : :
257 [ # # ]: 0 : aTbxAdjust.SetSizePixel(aSize);
258 [ # # ]: 0 : aTbxAdjust.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectAdjustHdl_Impl) );
259 : :
260 [ # # ]: 0 : aTbxShadow.SetSizePixel(aSize);
261 [ # # ]: 0 : aTbxShadow.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectShadowHdl_Impl) );
262 : :
263 [ # # ]: 0 : Link aLink = LINK(this, SvxFontWorkDialog, ModifyInputHdl_Impl);
264 : 0 : aMtrFldDistance.SetModifyHdl( aLink );
265 : 0 : aMtrFldTextStart.SetModifyHdl( aLink );
266 : 0 : aMtrFldShadowX.SetModifyHdl( aLink );
267 : 0 : aMtrFldShadowY.SetModifyHdl( aLink );
268 : :
269 : : // Set System metric
270 [ # # ][ # # ]: 0 : const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
271 [ # # ]: 0 : SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
272 [ # # ]: 0 : SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
273 [ # # ]: 0 : SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
274 [ # # ]: 0 : SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
275 [ # # ]: 0 : if( eDlgUnit == FUNIT_MM )
276 : : {
277 : 0 : aMtrFldDistance.SetSpinSize( 50 );
278 : 0 : aMtrFldTextStart.SetSpinSize( 50 );
279 : 0 : aMtrFldShadowX.SetSpinSize( 50 );
280 : 0 : aMtrFldShadowY.SetSpinSize( 50 );
281 : : }
282 : : else
283 : : {
284 : 0 : aMtrFldDistance.SetSpinSize( 10 );
285 : 0 : aMtrFldTextStart.SetSpinSize( 10 );
286 : 0 : aMtrFldShadowX.SetSpinSize( 10 );
287 : 0 : aMtrFldShadowY.SetSpinSize( 10 );
288 : : }
289 : :
290 [ # # ]: 0 : aShadowColorLB.SetSelectHdl( LINK(this, SvxFontWorkDialog, ColorSelectHdl_Impl) );
291 : :
292 [ # # ]: 0 : aInputTimer.SetTimeout(500);
293 [ # # ]: 0 : aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl));
294 : :
295 [ # # ]: 0 : aFormSet.SetSelectHdl( LINK(this, SvxFontWorkDialog, FormSelectHdl_Impl) );
296 [ # # ]: 0 : aFormSet.SetColCount(4);
297 [ # # ]: 0 : aFormSet.SetLineCount(2);
298 : :
299 [ # # ][ # # ]: 0 : Bitmap aBmp(SVX_RES(RID_SVXBMP_FONTWORK_FORM1));
300 [ # # ][ # # ]: 0 : aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
301 [ # # ][ # # ]: 0 : aFormSet.SetSizePixel(aSize);
302 : 0 : }
303 : :
304 [ # # ][ # # ]: 0 : SvxFontWorkDialog::~SvxFontWorkDialog()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
305 : : {
306 [ # # ]: 0 : for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
307 [ # # ][ # # ]: 0 : DELETEZ(pCtrlItems[i]);
308 [ # # ]: 0 : }
309 : :
310 : 0 : void SvxFontWorkDialog::Zoom()
311 : : {
312 : 0 : SfxDockingWindow::Roll();
313 : 0 : }
314 : :
315 : 0 : SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
316 : : SfxChildAlignment eAlign )
317 : : {
318 : : SfxChildAlignment eAlignment;
319 : :
320 [ # # # ]: 0 : switch ( eAlign )
321 : : {
322 : : case SFX_ALIGN_TOP:
323 : : case SFX_ALIGN_HIGHESTTOP:
324 : : case SFX_ALIGN_LOWESTTOP:
325 : : case SFX_ALIGN_BOTTOM:
326 : : case SFX_ALIGN_LOWESTBOTTOM:
327 : : case SFX_ALIGN_HIGHESTBOTTOM:
328 : : {
329 : 0 : eAlignment = eActAlign;
330 : : }
331 : 0 : break;
332 : :
333 : : case SFX_ALIGN_LEFT:
334 : : case SFX_ALIGN_RIGHT:
335 : : case SFX_ALIGN_FIRSTLEFT:
336 : : case SFX_ALIGN_LASTLEFT:
337 : : case SFX_ALIGN_FIRSTRIGHT:
338 : : case SFX_ALIGN_LASTRIGHT:
339 : : {
340 : 0 : eAlignment = eAlign;
341 : : }
342 : 0 : break;
343 : :
344 : : default:
345 : : {
346 : 0 : eAlignment = eAlign;
347 : : }
348 : 0 : break;
349 : : }
350 : :
351 : 0 : return eAlignment;
352 : : }
353 : :
354 : : // Set style buttons
355 : :
356 : 0 : void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem* pItem)
357 : : {
358 [ # # ]: 0 : if ( pItem )
359 : : {
360 : 0 : sal_uInt16 nId = TBI_STYLE_OFF;
361 : :
362 [ # # # # : 0 : switch ( pItem->GetValue() )
# ]
363 : : {
364 : 0 : case XFT_ROTATE : nId = TBI_STYLE_ROTATE; break;
365 : 0 : case XFT_UPRIGHT: nId = TBI_STYLE_UPRIGHT; break;
366 : 0 : case XFT_SLANTX : nId = TBI_STYLE_SLANTX; break;
367 : 0 : case XFT_SLANTY : nId = TBI_STYLE_SLANTY; break;
368 : : default: ;//prevent warning
369 : : }
370 : 0 : aTbxStyle.Enable();
371 : :
372 : : // Make sure that there is allways exactly one checked toolbox item.
373 [ # # ]: 0 : if ( pItem->GetValue() == XFT_NONE )
374 : : {
375 : 0 : aTbxStyle.CheckItem(TBI_STYLE_ROTATE, sal_False);
376 : 0 : aTbxStyle.CheckItem(TBI_STYLE_UPRIGHT, sal_False);
377 : 0 : aTbxStyle.CheckItem(TBI_STYLE_SLANTX, sal_False);
378 : 0 : aTbxStyle.CheckItem(TBI_STYLE_SLANTY, sal_False);
379 : :
380 : 0 : aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_True);
381 : : }
382 : : else
383 : : {
384 : 0 : aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_False);
385 : 0 : aTbxStyle.CheckItem(nId);
386 : : }
387 : :
388 : 0 : nLastStyleTbxId = nId;
389 : : }
390 : : else
391 : 0 : aTbxStyle.Disable();
392 : 0 : }
393 : :
394 : : // Set adjust buttons
395 : :
396 : 0 : void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
397 : : {
398 [ # # ]: 0 : if ( pItem )
399 : : {
400 : : sal_uInt16 nId;
401 : :
402 : 0 : aTbxAdjust.Enable();
403 : 0 : aMtrFldDistance.Enable();
404 : :
405 [ # # ][ # # ]: 0 : if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
[ # # ]
406 : : {
407 [ # # ]: 0 : if ( pItem->GetValue() == XFT_LEFT ) nId = TBI_ADJUST_LEFT;
408 : 0 : else nId = TBI_ADJUST_RIGHT;
409 : 0 : aMtrFldTextStart.Enable();
410 : : }
411 : : else
412 : : {
413 [ # # ]: 0 : if ( pItem->GetValue() == XFT_CENTER ) nId = TBI_ADJUST_CENTER;
414 : 0 : else nId = TBI_ADJUST_AUTOSIZE;
415 : 0 : aMtrFldTextStart.Disable();
416 : : }
417 : :
418 [ # # ]: 0 : if ( !aTbxAdjust.IsItemChecked(nId) )
419 : : {
420 : 0 : aTbxAdjust.CheckItem(nId);
421 : : }
422 : 0 : nLastAdjustTbxId = nId;
423 : : }
424 : : else
425 : : {
426 : 0 : aTbxAdjust.Disable();
427 : 0 : aMtrFldTextStart.Disable();
428 : 0 : aMtrFldDistance.Disable();
429 : : }
430 : 0 : }
431 : :
432 : : // Enter Distance value in the edit field
433 : :
434 : 0 : void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem* pItem)
435 : : {
436 : : // Use HasChildPathFocus() instead of HasFocus() at SpinFields
437 [ # # ][ # # ]: 0 : if ( pItem && !aMtrFldDistance.HasChildPathFocus() )
[ # # ]
438 : : {
439 : 0 : SetMetricValue( aMtrFldDistance, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
440 : : }
441 : 0 : }
442 : :
443 : : // Enter indent value in the edit field
444 : :
445 : 0 : void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem* pItem)
446 : : {
447 : : // Use HasChildPathFocus() instead of HasFocus() at SpinFields
448 [ # # ][ # # ]: 0 : if ( pItem && !aMtrFldTextStart.HasChildPathFocus() )
[ # # ]
449 : : {
450 : 0 : SetMetricValue( aMtrFldTextStart, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
451 : : }
452 : 0 : }
453 : :
454 : : // Set button for reversing the direction of text
455 : :
456 : 0 : void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem)
457 : : {
458 [ # # ]: 0 : if ( pItem )
459 : 0 : aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue());
460 : 0 : }
461 : :
462 : : // Standard form in ValueSet View
463 : :
464 : 0 : void SvxFontWorkDialog::SetStdForm_Impl(const XFormTextStdFormItem* pItem)
465 : : {
466 [ # # ]: 0 : if ( pItem )
467 : : {
468 : 0 : aFormSet.Enable();
469 : 0 : aFormSet.SetNoSelection();
470 : :
471 [ # # ]: 0 : if ( pItem->GetValue() != XFTFORM_NONE )
472 : : aFormSet.SelectItem(
473 : 0 : sal::static_int_cast< sal_uInt16 >(pItem->GetValue()));
474 : : }
475 : : else
476 : 0 : aFormSet.Disable();
477 : 0 : }
478 : :
479 : : // Set button for contour display
480 : :
481 : 0 : void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem)
482 : : {
483 [ # # ]: 0 : if ( pItem )
484 : 0 : aTbxShadow.CheckItem(TBI_SHOWFORM, !pItem->GetValue());
485 : 0 : }
486 : :
487 : : // Set button for text border
488 : :
489 : 0 : void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem* pItem)
490 : : {
491 [ # # ]: 0 : if ( pItem )
492 : 0 : aTbxShadow.CheckItem(TBI_OUTLINE, pItem->GetValue());
493 : 0 : }
494 : :
495 : : // Set shadow buttons
496 : :
497 : 0 : void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
498 : : sal_Bool bRestoreValues)
499 : : {
500 [ # # ]: 0 : if ( pItem )
501 : : {
502 : : sal_uInt16 nId;
503 : :
504 : 0 : aTbxShadow.Enable();
505 : :
506 [ # # ]: 0 : if ( pItem->GetValue() == XFTSHADOW_NONE )
507 : : {
508 : 0 : nId = TBI_SHADOW_OFF;
509 : 0 : aFbShadowX.Hide();
510 : 0 : aFbShadowY.Hide();
511 : 0 : aMtrFldShadowX.Disable();
512 : 0 : aMtrFldShadowY.Disable();
513 : 0 : aShadowColorLB.Disable();
514 : : }
515 : : else
516 : : {
517 : 0 : aFbShadowX.Show();
518 : 0 : aFbShadowY.Show();
519 : 0 : aMtrFldShadowX.Enable();
520 : 0 : aMtrFldShadowY.Enable();
521 : 0 : aShadowColorLB.Enable();
522 : :
523 [ # # ]: 0 : if ( pItem->GetValue() == XFTSHADOW_NORMAL )
524 : : {
525 : 0 : nId = TBI_SHADOW_NORMAL;
526 : 0 : const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
527 : :
528 : 0 : aMtrFldShadowX.SetUnit( eDlgUnit );
529 : 0 : aMtrFldShadowX.SetDecimalDigits(2);
530 : 0 : aMtrFldShadowX.SetMin(LONG_MIN);
531 : 0 : aMtrFldShadowX.SetMax(LONG_MAX);
532 [ # # ]: 0 : if( eDlgUnit == FUNIT_MM )
533 : 0 : aMtrFldShadowX.SetSpinSize( 50 );
534 : : else
535 : 0 : aMtrFldShadowX.SetSpinSize( 10 );
536 : :
537 : 0 : aMtrFldShadowY.SetUnit( eDlgUnit );
538 : 0 : aMtrFldShadowY.SetDecimalDigits(2);
539 : 0 : aMtrFldShadowY.SetMin(LONG_MIN);
540 : 0 : aMtrFldShadowY.SetMax(LONG_MAX);
541 [ # # ]: 0 : if( eDlgUnit == FUNIT_MM )
542 : 0 : aMtrFldShadowY.SetSpinSize( 50 );
543 : : else
544 : 0 : aMtrFldShadowY.SetSpinSize( 10 );
545 : :
546 [ # # ]: 0 : if ( bRestoreValues )
547 : : {
548 [ # # ]: 0 : SetMetricValue( aMtrFldShadowX, nSaveShadowX, SFX_MAPUNIT_100TH_MM );
549 [ # # ]: 0 : SetMetricValue( aMtrFldShadowY, nSaveShadowY, SFX_MAPUNIT_100TH_MM );
550 : :
551 [ # # ]: 0 : XFormTextShadowXValItem aXItem( nSaveShadowX );
552 [ # # ]: 0 : XFormTextShadowYValItem aYItem( nSaveShadowY );
553 : :
554 : 0 : GetBindings().GetDispatcher()->Execute(
555 [ # # ][ # # ]: 0 : SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
[ # # ]
556 : : }
557 : : }
558 : : else
559 : : {
560 : 0 : nId = TBI_SHADOW_SLANT;
561 : :
562 : 0 : aMtrFldShadowX.SetUnit(FUNIT_CUSTOM);
563 : 0 : aMtrFldShadowX.SetDecimalDigits(1);
564 : 0 : aMtrFldShadowX.SetMin(-1800);
565 : 0 : aMtrFldShadowX.SetMax( 1800);
566 : 0 : aMtrFldShadowX.SetSpinSize(10);
567 : :
568 : 0 : aMtrFldShadowY.SetUnit(FUNIT_CUSTOM);
569 : 0 : aMtrFldShadowY.SetDecimalDigits(0);
570 : 0 : aMtrFldShadowY.SetMin(-999);
571 : 0 : aMtrFldShadowY.SetMax( 999);
572 : 0 : aMtrFldShadowY.SetSpinSize(10);
573 : :
574 [ # # ]: 0 : if ( bRestoreValues )
575 : : {
576 [ # # ]: 0 : aMtrFldShadowX.SetValue(nSaveShadowAngle);
577 [ # # ]: 0 : aMtrFldShadowY.SetValue(nSaveShadowSize);
578 [ # # ]: 0 : XFormTextShadowXValItem aXItem(nSaveShadowAngle);
579 [ # # ]: 0 : XFormTextShadowYValItem aYItem(nSaveShadowSize);
580 : 0 : GetBindings().GetDispatcher()->Execute(
581 [ # # ][ # # ]: 0 : SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
[ # # ]
582 : : }
583 : : }
584 : : }
585 : :
586 [ # # ]: 0 : if ( !aTbxShadow.IsItemChecked(nId) )
587 : : {
588 : 0 : aTbxShadow.CheckItem(nId);
589 : : }
590 : 0 : nLastShadowTbxId = nId;
591 : :
592 : 0 : ApplyImageList();
593 : : }
594 : : else
595 : : {
596 : 0 : aTbxShadow.Disable();
597 : 0 : aMtrFldShadowX.Disable();
598 : 0 : aMtrFldShadowY.Disable();
599 : 0 : aShadowColorLB.Disable();
600 : : }
601 : 0 : }
602 : :
603 : : // Insert shadow color in listbox
604 : :
605 : 0 : void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pItem)
606 : : {
607 [ # # ]: 0 : if ( pItem )
608 : 0 : aShadowColorLB.SelectEntry(pItem->GetColorValue());
609 : 0 : }
610 : :
611 : : // Enter X-value for shadow in edit field
612 : :
613 : 0 : void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem)
614 : : {
615 : : // Use HasChildPathFocus() instead of HasFocus() at SpinFields
616 [ # # ][ # # ]: 0 : if ( pItem && !aMtrFldShadowX.HasChildPathFocus() )
[ # # ]
617 : : {
618 : : // #i19251#
619 : : // sal_Int32 nValue = pItem->GetValue();
620 : :
621 : : // #i19251#
622 : : // The two involved fields/items are used double and contain/give different
623 : : // values regarding to the access method. Thus, here we need to separate the access
624 : : // methos regarding to the kind of value accessed.
625 [ # # ]: 0 : if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
626 : : {
627 : : // #i19251#
628 : : // There is no value correction necessary at all, i think this
629 : : // was only tried to be done without understanding that the two
630 : : // involved fields/items are used double and contain/give different
631 : : // values regarding to the access method.
632 : : // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
633 : 0 : aMtrFldShadowX.SetValue(pItem->GetValue());
634 : : }
635 : : else
636 : : {
637 : 0 : SetMetricValue( aMtrFldShadowX, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
638 : : }
639 : : }
640 : 0 : }
641 : :
642 : : // Enter Y-value for shadow in edit field
643 : :
644 : 0 : void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem)
645 : : {
646 : : // Use HasChildPathFocus() instead of HasFocus() at SpinFields
647 [ # # ][ # # ]: 0 : if ( pItem && !aMtrFldShadowY.HasChildPathFocus() )
[ # # ]
648 : : {
649 : : // #i19251#
650 : : // The two involved fields/items are used double and contain/give different
651 : : // values regarding to the access method. Thus, here we need to separate the access
652 : : // methos regarding to the kind of value accessed.
653 [ # # ]: 0 : if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
654 : : {
655 : 0 : aMtrFldShadowY.SetValue(pItem->GetValue());
656 : : }
657 : : else
658 : : {
659 : 0 : SetMetricValue( aMtrFldShadowY, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
660 : : }
661 : : }
662 : 0 : }
663 : :
664 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, SelectStyleHdl_Impl)
665 : : {
666 : 0 : sal_uInt16 nId = aTbxStyle.GetCurItemId();
667 : :
668 : : // Execute this block when a different toolbox item has been clicked or
669 : : // when the off item has been clicked. The later is necessary to
670 : : // override the toolbox behaviour of unchecking the item after second
671 : : // click on it: One of the items has to be checked at all times (when
672 : : // enabled that is.)
673 [ # # ][ # # ]: 0 : if (nId == TBI_STYLE_OFF || nId != nLastStyleTbxId )
674 : : {
675 : 0 : XFormTextStyle eStyle = XFT_NONE;
676 : :
677 [ # # # # : 0 : switch ( nId )
# ]
678 : : {
679 : 0 : case TBI_STYLE_ROTATE : eStyle = XFT_ROTATE; break;
680 : 0 : case TBI_STYLE_UPRIGHT : eStyle = XFT_UPRIGHT; break;
681 : 0 : case TBI_STYLE_SLANTX : eStyle = XFT_SLANTX; break;
682 : 0 : case TBI_STYLE_SLANTY : eStyle = XFT_SLANTY; break;
683 : : }
684 [ # # ]: 0 : XFormTextStyleItem aItem( eStyle );
685 [ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L );
686 [ # # ]: 0 : SetStyle_Impl( &aItem );
687 [ # # ]: 0 : nLastStyleTbxId = nId;
688 : : }
689 : 0 : return 0;
690 : : }
691 : :
692 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, SelectAdjustHdl_Impl)
693 : : {
694 : 0 : sal_uInt16 nId = aTbxAdjust.GetCurItemId();
695 : :
696 [ # # ]: 0 : if ( nId == TBI_ADJUST_MIRROR )
697 : : {
698 [ # # ][ # # ]: 0 : XFormTextMirrorItem aItem(aTbxAdjust.IsItemChecked(nId));
699 [ # # ][ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_MIRROR, SFX_CALLMODE_SLOT, &aItem, 0L );
700 : : }
701 [ # # ]: 0 : else if ( nId != nLastAdjustTbxId )
702 : : {
703 : 0 : XFormTextAdjust eAdjust = XFT_AUTOSIZE;
704 : :
705 [ # # # # ]: 0 : switch ( nId )
706 : : {
707 : 0 : case TBI_ADJUST_LEFT : eAdjust = XFT_LEFT; break;
708 : 0 : case TBI_ADJUST_CENTER : eAdjust = XFT_CENTER; break;
709 : 0 : case TBI_ADJUST_RIGHT : eAdjust = XFT_RIGHT; break;
710 : : }
711 [ # # ]: 0 : XFormTextAdjustItem aItem(eAdjust);
712 [ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_ADJUST, SFX_CALLMODE_RECORD, &aItem, 0L );
713 [ # # ]: 0 : SetAdjust_Impl(&aItem);
714 [ # # ]: 0 : nLastAdjustTbxId = nId;
715 : : }
716 : 0 : return 0;
717 : : }
718 : :
719 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, SelectShadowHdl_Impl)
720 : : {
721 : 0 : sal_uInt16 nId = aTbxShadow.GetCurItemId();
722 : :
723 [ # # ]: 0 : if ( nId == TBI_SHOWFORM )
724 : : {
725 [ # # ][ # # ]: 0 : XFormTextHideFormItem aItem(!aTbxShadow.IsItemChecked(nId));
726 [ # # ][ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_HIDEFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
727 : : }
728 [ # # ]: 0 : else if ( nId == TBI_OUTLINE )
729 : : {
730 [ # # ][ # # ]: 0 : XFormTextOutlineItem aItem(aTbxShadow.IsItemChecked(nId));
731 [ # # ][ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_OUTLINE, SFX_CALLMODE_RECORD, &aItem, 0L );
732 : : }
733 [ # # ]: 0 : else if ( nId != nLastShadowTbxId )
734 : : {
735 : 0 : XFormTextShadow eShadow = XFTSHADOW_NONE;
736 : :
737 [ # # ]: 0 : if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
738 : : {
739 [ # # ]: 0 : nSaveShadowX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
740 [ # # ]: 0 : nSaveShadowY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
741 : : }
742 [ # # ]: 0 : else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
743 : : {
744 [ # # ]: 0 : nSaveShadowAngle = static_cast<long>(aMtrFldShadowX.GetValue());
745 [ # # ]: 0 : nSaveShadowSize = static_cast<long>(aMtrFldShadowY.GetValue());
746 : : }
747 : 0 : nLastShadowTbxId = nId;
748 : :
749 [ # # ]: 0 : if ( nId == TBI_SHADOW_NORMAL ) eShadow = XFTSHADOW_NORMAL;
750 [ # # ]: 0 : else if ( nId == TBI_SHADOW_SLANT ) eShadow = XFTSHADOW_SLANT;
751 : :
752 [ # # ]: 0 : XFormTextShadowItem aItem(eShadow);
753 [ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHADOW, SFX_CALLMODE_RECORD, &aItem, 0L );
754 [ # # ][ # # ]: 0 : SetShadow_Impl(&aItem, sal_True);
755 : : }
756 : 0 : return 0;
757 : : }
758 : :
759 : 0 : IMPL_LINK_NOARG_INLINE_START(SvxFontWorkDialog, ModifyInputHdl_Impl)
760 : : {
761 : 0 : aInputTimer.Start();
762 : 0 : return 0;
763 : : }
764 : 0 : IMPL_LINK_NOARG_INLINE_END(SvxFontWorkDialog, ModifyInputHdl_Impl)
765 : :
766 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl)
767 : : {
768 : : // Possibly set the Metric system again. This should be done with a
769 : : // listen, this is however not possible at the moment due to compabillity
770 : : // issues.
771 [ # # ][ # # ]: 0 : const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
772 [ # # ]: 0 : if( eDlgUnit != aMtrFldDistance.GetUnit() )
773 : : {
774 [ # # ]: 0 : SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
775 [ # # ]: 0 : SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
776 [ # # ]: 0 : aMtrFldDistance.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
777 [ # # ]: 0 : aMtrFldTextStart.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
778 : : }
779 [ # # ][ # # ]: 0 : if( eDlgUnit != aMtrFldShadowX.GetUnit() &&
[ # # ]
780 [ # # ]: 0 : aTbxShadow.IsItemChecked( TBI_SHADOW_NORMAL ) )
781 : : {
782 [ # # ]: 0 : SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
783 [ # # ]: 0 : SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
784 [ # # ]: 0 : aMtrFldShadowX.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
785 [ # # ]: 0 : aMtrFldShadowY.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
786 : : }
787 : :
788 [ # # ]: 0 : long nValue = GetCoreValue( aMtrFldDistance, SFX_MAPUNIT_100TH_MM );
789 [ # # ]: 0 : XFormTextDistanceItem aDistItem( nValue );
790 [ # # ]: 0 : nValue = GetCoreValue( aMtrFldTextStart, SFX_MAPUNIT_100TH_MM );
791 [ # # ]: 0 : XFormTextStartItem aStartItem( nValue );
792 : :
793 : 0 : sal_Int32 nValueX(0L);
794 : 0 : sal_Int32 nValueY(0L);
795 : :
796 : : // #i19251#
797 : : // The two involved fields/items are used double and contain/give different
798 : : // values regarding to the access method. Thus, here we need to separate the access
799 : : // methos regarding to the kind of value accessed.
800 [ # # ]: 0 : if(nLastShadowTbxId == TBI_SHADOW_NORMAL)
801 : : {
802 [ # # ]: 0 : nValueX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
803 [ # # ]: 0 : nValueY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
804 : : }
805 [ # # ]: 0 : else if(nLastShadowTbxId == TBI_SHADOW_SLANT)
806 : : {
807 [ # # ]: 0 : nValueX = static_cast<long>(aMtrFldShadowX.GetValue());
808 [ # # ]: 0 : nValueY = static_cast<long>(aMtrFldShadowY.GetValue());
809 : : }
810 : :
811 [ # # ]: 0 : XFormTextShadowXValItem aShadowXItem( nValueX );
812 [ # # ]: 0 : XFormTextShadowYValItem aShadowYItem( nValueY );
813 : :
814 : : // Slot-ID does not matter, the Exec method evaluates the entire item set
815 : 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_DISTANCE, SFX_CALLMODE_RECORD, &aDistItem,
816 [ # # ]: 0 : &aStartItem, &aShadowXItem, &aShadowYItem, 0L );
817 [ # # ][ # # ]: 0 : return 0;
[ # # ][ # # ]
818 : : }
819 : :
820 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, FormSelectHdl_Impl)
821 : : {
822 [ # # ]: 0 : XFormTextStdFormItem aItem;
823 : :
824 [ # # ]: 0 : if ( aFormSet.IsNoSelection() )
825 : 0 : aItem.SetValue(XFTFORM_NONE);
826 : : else
827 : 0 : aItem.SetValue(aFormSet.GetSelectItemId());
828 [ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STDFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
829 [ # # ]: 0 : aFormSet.SetNoSelection();
830 [ # # ]: 0 : return 0;
831 : : }
832 : :
833 : 0 : IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl)
834 : : {
835 : : XFormTextShadowColorItem aItem( (const String &) String(),
836 [ # # ][ # # ]: 0 : (const Color &) aShadowColorLB.GetSelectEntryColor() );
[ # # ][ # # ]
837 [ # # ]: 0 : GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHDWCOLOR, SFX_CALLMODE_RECORD, &aItem, 0L );
838 [ # # ]: 0 : return 0;
839 : : }
840 : :
841 : 0 : void SvxFontWorkDialog::SetColorList(const XColorListRef &pList)
842 : : {
843 [ # # ][ # # ]: 0 : if ( pList.is() && pList != pColorList )
[ # # ]
844 : : {
845 : 0 : pColorList = pList;
846 : 0 : aShadowColorLB.Clear();
847 : 0 : aShadowColorLB.Fill(pColorList);
848 : : }
849 : 0 : }
850 : :
851 : 0 : void SvxFontWorkDialog::SetActive(sal_Bool /*bActivate*/)
852 : : {
853 : 0 : }
854 : :
855 : : // Create standard fontWork Object
856 : :
857 : 0 : void SvxFontWorkDialog::CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
858 : : const SfxItemSet& rAttr,
859 : : SdrObject& rOldObj,
860 : : XFormTextStdForm eForm)
861 : : {
862 : 0 : SfxItemSet aAttr(*rAttr.GetPool(), XATTR_FORMTXTSTYLE,
863 [ # # ]: 0 : XATTR_FORMTXTHIDEFORM);
864 : 0 : SdrObject* pNewObj = NULL;
865 [ # # ]: 0 : Rectangle aRect;
866 : 0 : XFormTextAdjust eAdjust = XFT_AUTOSIZE;
867 : :
868 [ # # ][ # # ]: 0 : aAttr.Put(rOldObj.GetMergedItemSet());
869 : :
870 : : const XFormTextStdFormItem& rOldForm = (const XFormTextStdFormItem&)
871 [ # # ]: 0 : aAttr.Get(XATTR_FORMTXTSTDFORM);
872 : :
873 [ # # ]: 0 : aRect = rOldObj.GetSnapRect();
874 : :
875 [ # # ][ # # ]: 0 : if ( !rOldObj.ISA(SdrPathObj) )
[ # # ]
876 : : {
877 : 0 : Point aPos = aRect.TopLeft();
878 [ # # ]: 0 : aRect = rOldObj.GetLogicRect();
879 : 0 : aRect.SetPos(aPos);
880 : : }
881 : :
882 [ # # ]: 0 : aAttr.Put(rAttr);
883 : :
884 [ # # ]: 0 : if ( rOldForm.GetValue() == XFTFORM_NONE )
885 : : {
886 [ # # ]: 0 : long nW = aRect.GetWidth();
887 [ # # ]: 0 : aRect.SetSize(Size(nW, nW));
888 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextStyleItem(XFT_ROTATE));
[ # # ]
889 : : }
890 : :
891 [ # # ]: 0 : Point aCenter = aRect.Center();
892 : :
893 [ # # # # ]: 0 : switch ( eForm )
894 : : {
895 : : case XFTFORM_TOPCIRC:
896 : : case XFTFORM_BOTCIRC:
897 : : case XFTFORM_LFTCIRC:
898 : : case XFTFORM_RGTCIRC:
899 : : case XFTFORM_TOPARC:
900 : : case XFTFORM_BOTARC:
901 : : case XFTFORM_LFTARC:
902 : : case XFTFORM_RGTARC:
903 : : {
904 : : long nBeg, nEnd;
905 : :
906 [ # # # # : 0 : switch ( eForm )
# # # # ]
907 : : {
908 : : default: ; //prevent warning
909 : : case XFTFORM_TOPCIRC:
910 : 0 : nBeg = 0;
911 : 0 : nEnd = 18000;
912 : 0 : break;
913 : : case XFTFORM_BOTCIRC:
914 : 0 : nBeg = 18000;
915 : 0 : nEnd = 36000;
916 : 0 : break;
917 : : case XFTFORM_LFTCIRC:
918 : 0 : nBeg = 9000;
919 : 0 : nEnd = 27000;
920 : 0 : break;
921 : : case XFTFORM_RGTCIRC:
922 : 0 : nBeg = 27000;
923 : 0 : nEnd = 9000;
924 : 0 : break;
925 : : case XFTFORM_TOPARC:
926 : 0 : nBeg = 4500;
927 : 0 : nEnd = 13500;
928 : 0 : break;
929 : : case XFTFORM_BOTARC:
930 : 0 : nBeg = 22500;
931 : 0 : nEnd = 31500;
932 : 0 : break;
933 : : case XFTFORM_LFTARC:
934 : 0 : nBeg = 13500;
935 : 0 : nEnd = 22500;
936 : 0 : break;
937 : : case XFTFORM_RGTARC:
938 : 0 : nBeg = 31500;
939 : 0 : nEnd = 4500;
940 : 0 : break;
941 : : }
942 [ # # ][ # # ]: 0 : pNewObj = new SdrCircObj(OBJ_CARC, aRect, nBeg, nEnd);
943 : 0 : break;
944 : : }
945 : : case XFTFORM_BUTTON1:
946 : : {
947 [ # # ]: 0 : basegfx::B2DPolyPolygon aPolyPolygon;
948 [ # # ]: 0 : basegfx::B2DPolygon aLine;
949 [ # # ]: 0 : long nR = aRect.GetWidth() / 2;
950 [ # # ][ # # ]: 0 : basegfx::B2DPolygon aTopArc(XPolygon(aCenter, -nR, nR, 50, 1750, sal_False).getB2DPolygon());
[ # # ]
951 [ # # ][ # # ]: 0 : basegfx::B2DPolygon aBottomArc(XPolygon(aCenter, -nR, nR, 1850, 3550, sal_False).getB2DPolygon());
[ # # ]
952 : :
953 : : // Close Polygon
954 [ # # ]: 0 : aTopArc.setClosed(true);
955 [ # # ]: 0 : aBottomArc.setClosed(true);
956 [ # # ]: 0 : aPolyPolygon.append(aTopArc);
957 : :
958 [ # # ][ # # ]: 0 : aLine.append(aBottomArc.getB2DPoint(aBottomArc.count() - 1L));
[ # # ]
959 [ # # ][ # # ]: 0 : aLine.append(aBottomArc.getB2DPoint(0L));
960 [ # # ]: 0 : aLine.setClosed(true);
961 : :
962 [ # # ]: 0 : aPolyPolygon.append(aLine);
963 [ # # ]: 0 : aPolyPolygon.append(aBottomArc);
964 : :
965 [ # # ][ # # ]: 0 : pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
966 : 0 : eAdjust = XFT_CENTER;
967 [ # # ][ # # ]: 0 : break;
[ # # ][ # # ]
968 : : }
969 : : case XFTFORM_BUTTON2:
970 : : case XFTFORM_BUTTON3:
971 : : case XFTFORM_BUTTON4:
972 : : {
973 [ # # ]: 0 : basegfx::B2DPolyPolygon aPolyPolygon;
974 [ # # ]: 0 : basegfx::B2DPolygon aLine;
975 [ # # ]: 0 : long nR = aRect.GetWidth() / 2;
976 : 0 : long nWDiff = nR / 5;
977 : : long nHDiff;
978 : :
979 [ # # ]: 0 : if ( eForm == XFTFORM_BUTTON4 )
980 : : {
981 [ # # ][ # # ]: 0 : basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 950, 2650, sal_False).getB2DPolygon());
[ # # ]
982 [ # # ]: 0 : aNewArc.setClosed(true);
983 [ # # ]: 0 : aPolyPolygon.append(aNewArc);
984 [ # # ]: 0 : eAdjust = XFT_CENTER;
985 : : }
986 : : else
987 : : {
988 [ # # ][ # # ]: 0 : basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2700, 2700).getB2DPolygon());
[ # # ]
989 [ # # ][ # # ]: 0 : aPolyPolygon.append(aNewArc);
990 : : }
991 : :
992 [ # # ]: 0 : if ( eForm == XFTFORM_BUTTON3 )
993 [ # # ]: 0 : nHDiff = -aRect.GetHeight() / 10;
994 : : else
995 [ # # ]: 0 : nHDiff = aRect.GetHeight() / 20;
996 : :
997 [ # # ][ # # ]: 0 : aLine.append(basegfx::B2DPoint(aRect.Left() + nWDiff, aRect.Center().Y() + nHDiff));
998 [ # # ][ # # ]: 0 : aLine.append(basegfx::B2DPoint(aRect.Right() - nWDiff, aRect.Center().Y() + nHDiff));
999 [ # # ]: 0 : aLine.setClosed(true);
1000 [ # # ]: 0 : aPolyPolygon.append(aLine);
1001 : :
1002 [ # # ]: 0 : if ( eForm == XFTFORM_BUTTON4 )
1003 : : {
1004 [ # # ][ # # ]: 0 : basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2750, 850, sal_False).getB2DPolygon());
[ # # ]
1005 [ # # ]: 0 : aNewArc.setClosed(true);
1006 [ # # ][ # # ]: 0 : aPolyPolygon.append(aNewArc);
1007 : : }
1008 : :
1009 [ # # ]: 0 : if ( eForm == XFTFORM_BUTTON3 )
1010 : : {
1011 : 0 : nHDiff += nHDiff;
1012 [ # # ][ # # ]: 0 : aLine.setB2DPoint(0L, basegfx::B2DPoint(aLine.getB2DPoint(0L).getX(), aLine.getB2DPoint(0L).getY() - nHDiff));
[ # # ]
1013 [ # # ][ # # ]: 0 : aLine.setB2DPoint(1L, basegfx::B2DPoint(aLine.getB2DPoint(1L).getX(), aLine.getB2DPoint(1L).getY() - nHDiff));
[ # # ]
1014 [ # # ]: 0 : aPolyPolygon.append(aLine);
1015 : : }
1016 : :
1017 [ # # ][ # # ]: 0 : pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
1018 [ # # ][ # # ]: 0 : break;
1019 : : }
1020 : : default: ; //prevent warning
1021 : : }
1022 [ # # ]: 0 : if ( pNewObj )
1023 : : {
1024 : : // due to DLs changes in Outliner the object needs
1025 : : // a model to get an outliner for later calls to
1026 : : // pNewObj->SetOutlinerParaObject(pPara) (see below).
1027 [ # # ][ # # ]: 0 : pNewObj->SetModel(rOldObj.GetModel());
1028 : :
1029 : 0 : Size aSize;
1030 [ # # ]: 0 : Rectangle aSnap = pNewObj->GetSnapRect();
1031 : :
1032 : 0 : aSize.Width() = aRect.Left() - aSnap.Left();
1033 : 0 : aSize.Height() = aRect.Top() - aSnap.Top();
1034 [ # # ]: 0 : pNewObj->NbcMove(aSize);
1035 : :
1036 [ # # ][ # # ]: 0 : rView.BegUndo( SVX_RESSTR( RID_SVXSTR_FONTWORK_UNDOCREATE ) );
[ # # ][ # # ]
[ # # ]
1037 [ # # ]: 0 : OutlinerParaObject* pPara = rOldObj.GetOutlinerParaObject();
1038 : 0 : sal_Bool bHide = sal_True;
1039 : :
1040 [ # # ]: 0 : if ( pPara != NULL )
1041 : : {
1042 [ # # ][ # # ]: 0 : pPara = new OutlinerParaObject(*pPara);
1043 [ # # ]: 0 : pNewObj->SetOutlinerParaObject(pPara);
1044 : : }
1045 : : else
1046 : 0 : bHide = sal_False;
1047 : :
1048 [ # # ]: 0 : rView.ReplaceObjectAtView(&rOldObj, rPV, pNewObj, sal_True);
1049 [ # # ][ # # ]: 0 : pNewObj->SetLayer(rOldObj.GetLayer());
1050 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextHideFormItem(bHide));
[ # # ]
1051 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextAdjustItem(eAdjust));
[ # # ]
1052 : :
1053 : 0 : XFormTextShadow eShadow = XFTSHADOW_NONE;
1054 : :
1055 [ # # ]: 0 : if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
1056 : : {
1057 : 0 : eShadow = XFTSHADOW_NORMAL;
1058 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextShadowXValItem(nSaveShadowX));
[ # # ]
1059 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextShadowYValItem(nSaveShadowY));
[ # # ]
1060 : : }
1061 [ # # ]: 0 : else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
1062 : : {
1063 : 0 : eShadow = XFTSHADOW_SLANT;
1064 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextShadowXValItem(nSaveShadowAngle));
[ # # ]
1065 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextShadowYValItem(nSaveShadowSize));
[ # # ]
1066 : : }
1067 : :
1068 [ # # ][ # # ]: 0 : aAttr.Put(XFormTextShadowItem(eShadow));
[ # # ]
1069 : :
1070 [ # # ]: 0 : rView.SetAttributes(aAttr);
1071 [ # # ]: 0 : rView.EndUndo();
1072 [ # # ]: 0 : }
1073 : 0 : }
1074 : :
1075 : 0 : void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt )
1076 : : {
1077 [ # # ][ # # ]: 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
[ # # ]
1078 : 0 : ApplyImageList();
1079 : :
1080 : 0 : SfxDockingWindow::DataChanged( rDCEvt );
1081 : 0 : }
1082 : :
1083 : 0 : void SvxFontWorkDialog::ApplyImageList()
1084 : : {
1085 : 0 : ResMgr* _pMgr = &DIALOG_MGR();
1086 : :
1087 : 0 : sal_uInt16 nBitmapResId = RID_SVXBMP_FONTWORK_FORM1;
1088 : 0 : sal_uInt16 nTextResId = RID_SVXSTR_FONTWORK_FORM1;
1089 : :
1090 : 0 : bool bInit = aFormSet.GetItemCount() == 0;
1091 : :
1092 : : sal_uInt16 i;
1093 [ # # ]: 0 : for( i = 1; i < 13; i++, nTextResId++, nBitmapResId++ )
1094 : : {
1095 [ # # ]: 0 : if( bInit )
1096 : : {
1097 : : aFormSet.InsertItem( i, Bitmap(ResId(nBitmapResId,*_pMgr)),
1098 [ # # ][ # # ]: 0 : String(ResId(nTextResId,*_pMgr)));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1099 : : }
1100 : : else
1101 : : {
1102 [ # # ][ # # ]: 0 : aFormSet.SetItemImage( i, Bitmap(ResId(nBitmapResId,*_pMgr)) );
[ # # ][ # # ]
[ # # ]
1103 : : }
1104 : : }
1105 : :
1106 : 0 : ImageList& rImgLst = maImageList;
1107 : :
1108 : 0 : aTbxStyle.SetImageList( rImgLst );
1109 : 0 : aTbxAdjust.SetImageList( rImgLst );
1110 : 0 : aTbxShadow.SetImageList( rImgLst );
1111 : :
1112 [ # # ]: 0 : switch( nLastShadowTbxId )
1113 : : {
1114 : : case TBI_SHADOW_SLANT:
1115 [ # # ]: 0 : aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_ANGLE ) );
1116 [ # # ]: 0 : aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_SIZE ) );
1117 : 0 : break;
1118 : : default:
1119 [ # # ]: 0 : aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_XDIST ) );
1120 [ # # ]: 0 : aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_YDIST ) );
1121 : 0 : break;
1122 : : }
1123 : :
1124 [ # # ]: 0 : aFbDistance.SetImage( rImgLst.GetImage( TBI_DISTANCE ) );
1125 [ # # ]: 0 : aFbTextStart.SetImage( rImgLst.GetImage( TBI_TEXTSTART ) );
1126 : :
1127 : 0 : }
1128 : :
1129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|