1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/module.hxx>
21 #include <sfx2/dispatch.hxx>
23 #include <svx/colorbox.hxx>
24 #include <svx/dialmgr.hxx>
25 #include <svx/strings.hrc>
26 #include <svx/xftadit.hxx>
27 #include <svx/xftdiit.hxx>
28 #include <svx/xftstit.hxx>
29 #include <svx/xftmrit.hxx>
30 #include <svx/xftouit.hxx>
31 #include <svx/xftshit.hxx>
32 #include <svx/xftshcit.hxx>
33 #include <svx/xftshxy.hxx>
34 #include <svx/xtextit0.hxx>
36 #include <svtools/unitconv.hxx>
37 #include <svx/svxids.hrc>
38 #include <bitmaps.hlst>
39 #include <svx/fontwork.hxx>
41 #define WIDTH_CHARS 10
43 SFX_IMPL_DOCKINGWINDOW_WITHID( SvxFontWorkChildWindow
, SID_FONTWORK
);
45 // ControllerItem for Fontwork
47 SvxFontWorkControllerItem::SvxFontWorkControllerItem
50 SvxFontWorkDialog
& rDlg
,
51 SfxBindings
& rBindings
54 SfxControllerItem( _nId
, rBindings
),
60 // StateChanged method for FontWork items
62 void SvxFontWorkControllerItem::StateChanged( sal_uInt16
/*nSID*/, SfxItemState
/*eState*/,
63 const SfxPoolItem
* pItem
)
67 case SID_FORMTEXT_STYLE
:
69 const XFormTextStyleItem
* pStateItem
=
70 dynamic_cast<const XFormTextStyleItem
*>( pItem
);
71 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextStyleItem expected");
72 rFontWorkDlg
.SetStyle_Impl(pStateItem
);
75 case SID_FORMTEXT_ADJUST
:
77 const XFormTextAdjustItem
* pStateItem
=
78 dynamic_cast<const XFormTextAdjustItem
*>( pItem
);
79 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextAdjustItem expected");
80 rFontWorkDlg
.SetAdjust_Impl(pStateItem
);
83 case SID_FORMTEXT_DISTANCE
:
85 const XFormTextDistanceItem
* pStateItem
=
86 dynamic_cast<const XFormTextDistanceItem
*>( pItem
);
87 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextDistanceItem expected");
88 rFontWorkDlg
.SetDistance_Impl(pStateItem
);
91 case SID_FORMTEXT_START
:
93 const XFormTextStartItem
* pStateItem
=
94 dynamic_cast<const XFormTextStartItem
*>( pItem
);
95 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextStartItem expected");
96 rFontWorkDlg
.SetStart_Impl(pStateItem
);
99 case SID_FORMTEXT_MIRROR
:
101 const XFormTextMirrorItem
* pStateItem
=
102 dynamic_cast<const XFormTextMirrorItem
*>( pItem
);
103 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextMirrorItem expected");
104 rFontWorkDlg
.SetMirror_Impl(pStateItem
);
107 case SID_FORMTEXT_HIDEFORM
:
109 const XFormTextHideFormItem
* pStateItem
=
110 dynamic_cast<const XFormTextHideFormItem
*>( pItem
);
111 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextHideFormItem expected");
112 rFontWorkDlg
.SetShowForm_Impl(pStateItem
);
115 case SID_FORMTEXT_OUTLINE
:
117 const XFormTextOutlineItem
* pStateItem
=
118 dynamic_cast<const XFormTextOutlineItem
*>( pItem
);
119 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextOutlineItem expected");
120 rFontWorkDlg
.SetOutline_Impl(pStateItem
);
123 case SID_FORMTEXT_SHADOW
:
125 const XFormTextShadowItem
* pStateItem
=
126 dynamic_cast<const XFormTextShadowItem
*>( pItem
);
127 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextShadowItem expected");
128 rFontWorkDlg
.SetShadow_Impl(pStateItem
);
131 case SID_FORMTEXT_SHDWCOLOR
:
133 const XFormTextShadowColorItem
* pStateItem
=
134 dynamic_cast<const XFormTextShadowColorItem
*>( pItem
);
135 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextShadowColorItem expected");
136 rFontWorkDlg
.SetShadowColor_Impl(pStateItem
);
139 case SID_FORMTEXT_SHDWXVAL
:
141 const XFormTextShadowXValItem
* pStateItem
=
142 dynamic_cast<const XFormTextShadowXValItem
*>( pItem
);
143 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextShadowXValItem expected");
144 rFontWorkDlg
.SetShadowXVal_Impl(pStateItem
);
147 case SID_FORMTEXT_SHDWYVAL
:
149 const XFormTextShadowYValItem
* pStateItem
=
150 dynamic_cast<const XFormTextShadowYValItem
*>( pItem
);
151 DBG_ASSERT(pStateItem
|| pItem
== nullptr, "XFormTextShadowYValItem expected");
152 rFontWorkDlg
.SetShadowYVal_Impl(pStateItem
);
158 // Derivation from SfxChildWindow as "containers" for Fontwork dialog
160 SvxFontWorkChildWindow::SvxFontWorkChildWindow
162 vcl::Window
* _pParent
,
164 SfxBindings
* pBindings
,
165 SfxChildWinInfo
* pInfo
167 SfxChildWindow( _pParent
, nId
)
169 VclPtrInstance
<SvxFontWorkDialog
> pDlg(pBindings
, this, _pParent
);
172 pDlg
->Initialize( pInfo
);
175 // Floating Window to the attribution of text effects
176 SvxFontWorkDialog::SvxFontWorkDialog(SfxBindings
*pBindinx
,
178 vcl::Window
* _pParent
)
179 : SfxDockingWindow(pBindinx
, pCW
, _pParent
, "DockingFontwork", "svx/ui/dockingfontwork.ui")
180 , rBindings(*pBindinx
)
181 , aInputIdle("SvxFontWorkDialog Input")
184 , nSaveShadowAngle(450)
185 , nSaveShadowSize (100)
186 , m_xTbxStyle(m_xBuilder
->weld_toolbar("style"))
187 , m_xTbxAdjust(m_xBuilder
->weld_toolbar("adjust"))
188 , m_xMtrFldDistance(m_xBuilder
->weld_metric_spin_button("distance", FieldUnit::CM
))
189 , m_xMtrFldTextStart(m_xBuilder
->weld_metric_spin_button("indent", FieldUnit::CM
))
190 , m_xTbxShadow(m_xBuilder
->weld_toolbar("shadow"))
191 , m_xFbShadowX(m_xBuilder
->weld_image("shadowx"))
192 , m_xMtrFldShadowX(m_xBuilder
->weld_metric_spin_button("distancex", FieldUnit::CM
))
193 , m_xFbShadowY(m_xBuilder
->weld_image("shadowy"))
194 , m_xMtrFldShadowY(m_xBuilder
->weld_metric_spin_button("distancey", FieldUnit::CM
))
195 , m_xShadowColorLB(new ColorListBox(m_xBuilder
->weld_menu_button("color"), GetFrameWeld()))
197 SetText(SvxResId(RID_SVXSTR_FONTWORK
));
201 pCtrlItems
[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE
, *this, rBindings
);
202 pCtrlItems
[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST
, *this, rBindings
);
203 pCtrlItems
[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE
, *this, rBindings
);
204 pCtrlItems
[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START
, *this, rBindings
);
205 pCtrlItems
[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR
, *this, rBindings
);
206 pCtrlItems
[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM
, *this, rBindings
);
207 pCtrlItems
[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE
, *this, rBindings
);
208 pCtrlItems
[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW
, *this, rBindings
);
209 pCtrlItems
[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR
, *this, rBindings
);
210 pCtrlItems
[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL
, *this, rBindings
);
211 pCtrlItems
[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL
, *this, rBindings
);
213 m_xTbxStyle
->connect_clicked(LINK(this, SvxFontWorkDialog
, SelectStyleHdl_Impl
));
214 m_xTbxAdjust
->connect_clicked(LINK(this, SvxFontWorkDialog
, SelectAdjustHdl_Impl
));
215 m_xTbxShadow
->connect_clicked(LINK(this, SvxFontWorkDialog
, SelectShadowHdl_Impl
));
217 Link
<weld::MetricSpinButton
&,void> aLink
= LINK(this, SvxFontWorkDialog
, ModifyInputHdl_Impl
);
218 m_xMtrFldDistance
->connect_value_changed( aLink
);
219 m_xMtrFldTextStart
->connect_value_changed( aLink
);
220 m_xMtrFldShadowX
->connect_value_changed( aLink
);
221 m_xMtrFldShadowY
->connect_value_changed( aLink
);
224 const FieldUnit eDlgUnit
= rBindings
.GetDispatcher()->GetModule()->GetFieldUnit();
225 SetFieldUnit(*m_xMtrFldDistance
, eDlgUnit
, true);
226 SetFieldUnit(*m_xMtrFldTextStart
, eDlgUnit
, true);
227 SetFieldUnit(*m_xMtrFldShadowX
, eDlgUnit
, true);
228 SetFieldUnit(*m_xMtrFldShadowY
, eDlgUnit
, true);
229 if( eDlgUnit
== FieldUnit::MM
)
231 m_xMtrFldDistance
->set_increments(50, 500, FieldUnit::NONE
);
232 m_xMtrFldTextStart
->set_increments(50, 500, FieldUnit::NONE
);
233 m_xMtrFldShadowX
->set_increments(50, 500, FieldUnit::NONE
);
234 m_xMtrFldShadowY
->set_increments(50, 500, FieldUnit::NONE
);
238 m_xMtrFldDistance
->set_increments(10, 100, FieldUnit::NONE
);
239 m_xMtrFldTextStart
->set_increments(10, 100, FieldUnit::NONE
);
240 m_xMtrFldShadowX
->set_increments(10, 100, FieldUnit::NONE
);
241 m_xMtrFldShadowY
->set_increments(10, 100, FieldUnit::NONE
);
243 m_xMtrFldShadowX
->set_width_chars(WIDTH_CHARS
);
244 m_xMtrFldShadowY
->set_width_chars(WIDTH_CHARS
);
246 m_xShadowColorLB
->SetSelectHdl( LINK(this, SvxFontWorkDialog
, ColorSelectHdl_Impl
) );
248 aInputIdle
.SetPriority(TaskPriority::LOWEST
);
249 aInputIdle
.SetInvokeHandler(LINK(this, SvxFontWorkDialog
, InputTimeoutHdl_Impl
));
252 SvxFontWorkDialog::~SvxFontWorkDialog()
257 void SvxFontWorkDialog::dispose()
259 for (SvxFontWorkControllerItem
* pCtrlItem
: pCtrlItems
)
260 pCtrlItem
->dispose();
262 m_xTbxAdjust
.reset();
263 m_xMtrFldDistance
.reset();
264 m_xMtrFldTextStart
.reset();
265 m_xTbxShadow
.reset();
266 m_xFbShadowX
.reset();
267 m_xMtrFldShadowX
.reset();
268 m_xFbShadowY
.reset();
269 m_xMtrFldShadowY
.reset();
270 m_xShadowColorLB
.reset();
271 SfxDockingWindow::dispose();
274 SfxChildAlignment
SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign
,
275 SfxChildAlignment eAlign
)
277 SfxChildAlignment eAlignment
;
281 case SfxChildAlignment::TOP
:
282 case SfxChildAlignment::HIGHESTTOP
:
283 case SfxChildAlignment::LOWESTTOP
:
284 case SfxChildAlignment::BOTTOM
:
285 case SfxChildAlignment::LOWESTBOTTOM
:
286 case SfxChildAlignment::HIGHESTBOTTOM
:
288 eAlignment
= eActAlign
;
292 case SfxChildAlignment::LEFT
:
293 case SfxChildAlignment::RIGHT
:
294 case SfxChildAlignment::FIRSTLEFT
:
295 case SfxChildAlignment::LASTLEFT
:
296 case SfxChildAlignment::FIRSTRIGHT
:
297 case SfxChildAlignment::LASTRIGHT
:
314 void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem
* pItem
)
320 switch ( pItem
->GetValue() )
322 case XFormTextStyle::Rotate
: sId
= "rotate"; break;
323 case XFormTextStyle::Upright
: sId
= "upright"; break;
324 case XFormTextStyle::SlantX
: sId
= "hori"; break;
325 case XFormTextStyle::SlantY
: sId
= "vert"; break;
326 default: ;//prevent warning
328 m_xTbxStyle
->set_sensitive(true);
330 // Make sure that there is always exactly one checked toolbox item.
331 if ( pItem
->GetValue() == XFormTextStyle::NONE
)
333 m_xTbxStyle
->set_item_active("rotate", false);
334 m_xTbxStyle
->set_item_active("upright", false);
335 m_xTbxStyle
->set_item_active("hori", false);
336 m_xTbxStyle
->set_item_active("vert", false);
338 m_xTbxStyle
->set_item_active("off", true);
342 m_xTbxStyle
->set_item_active("off", false);
343 m_xTbxStyle
->set_item_active(sId
, true);
346 m_sLastStyleTbxId
= sId
;
349 m_xTbxStyle
->set_sensitive(false);
352 // Set adjust buttons
354 void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem
* pItem
)
360 m_xTbxAdjust
->set_sensitive(true);
361 m_xMtrFldDistance
->set_sensitive(true);
363 if ( pItem
->GetValue() == XFormTextAdjust::Left
|| pItem
->GetValue() == XFormTextAdjust::Right
)
365 if (pItem
->GetValue() == XFormTextAdjust::Left
)
369 m_xMtrFldTextStart
->set_sensitive(true);
373 if (pItem
->GetValue() == XFormTextAdjust::Center
)
377 m_xMtrFldTextStart
->set_sensitive(false);
380 if (!m_xTbxAdjust
->get_item_active(sId
))
381 m_xTbxAdjust
->set_item_active(sId
, true);
383 m_sLastAdjustTbxId
= sId
;
387 m_xTbxAdjust
->set_sensitive(false);
388 m_xMtrFldTextStart
->set_sensitive(false);
389 m_xMtrFldDistance
->set_sensitive(false);
393 // Enter Distance value in the edit field
395 void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem
* pItem
)
397 if (pItem
&& !m_xMtrFldDistance
->has_focus())
399 SetMetricValue(*m_xMtrFldDistance
, pItem
->GetValue(), MapUnit::Map100thMM
);
403 // Enter indent value in the edit field
405 void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem
* pItem
)
407 if (pItem
&& !m_xMtrFldTextStart
->has_focus())
409 SetMetricValue(*m_xMtrFldTextStart
, pItem
->GetValue(), MapUnit::Map100thMM
);
413 // Set button for reversing the direction of text
415 void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem
* pItem
)
418 m_xTbxAdjust
->set_item_active("orientation", pItem
->GetValue());
421 // Set button for contour display
423 void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem
* pItem
)
426 m_xTbxShadow
->set_item_active("contour", !pItem
->GetValue());
429 // Set button for text border
431 void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem
* pItem
)
434 m_xTbxShadow
->set_item_active("textcontour", pItem
->GetValue());
437 // Set shadow buttons
439 void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem
* pItem
,
446 m_xTbxShadow
->set_sensitive(true);
448 if ( pItem
->GetValue() == XFormTextShadow::NONE
)
451 m_xFbShadowX
->hide();
452 m_xFbShadowY
->hide();
453 m_xMtrFldShadowX
->set_sensitive(false);
454 m_xMtrFldShadowY
->set_sensitive(false);
455 m_xShadowColorLB
->set_sensitive(false);
459 m_xFbShadowX
->show();
460 m_xFbShadowY
->show();
461 m_xMtrFldShadowX
->set_sensitive(true);
462 m_xMtrFldShadowY
->set_sensitive(true);
463 m_xShadowColorLB
->set_sensitive(true);
465 if ( pItem
->GetValue() == XFormTextShadow::Normal
)
468 const FieldUnit eDlgUnit
= rBindings
.GetDispatcher()->GetModule()->GetFieldUnit();
470 m_xMtrFldShadowX
->set_unit( eDlgUnit
);
471 m_xMtrFldShadowX
->set_digits(2);
472 m_xMtrFldShadowX
->set_range(INT_MIN
, INT_MAX
, FieldUnit::NONE
);
473 if( eDlgUnit
== FieldUnit::MM
)
474 m_xMtrFldShadowX
->set_increments(50, 500, FieldUnit::NONE
);
476 m_xMtrFldShadowX
->set_increments(10, 100, FieldUnit::NONE
);
477 m_xMtrFldShadowX
->set_width_chars(WIDTH_CHARS
);
479 m_xMtrFldShadowY
->set_unit( eDlgUnit
);
480 m_xMtrFldShadowY
->set_digits(2);
481 m_xMtrFldShadowY
->set_range(INT_MIN
, INT_MAX
, FieldUnit::NONE
);
482 if( eDlgUnit
== FieldUnit::MM
)
483 m_xMtrFldShadowY
->set_increments(50, 500, FieldUnit::NONE
);
485 m_xMtrFldShadowY
->set_increments(10, 100, FieldUnit::NONE
);
486 m_xMtrFldShadowY
->set_width_chars(WIDTH_CHARS
);
488 if ( bRestoreValues
)
490 SetMetricValue(*m_xMtrFldShadowX
, nSaveShadowX
, MapUnit::Map100thMM
);
491 SetMetricValue(*m_xMtrFldShadowY
, nSaveShadowY
, MapUnit::Map100thMM
);
493 XFormTextShadowXValItem
aXItem( nSaveShadowX
);
494 XFormTextShadowYValItem
aYItem( nSaveShadowY
);
496 GetBindings().GetDispatcher()->ExecuteList(
497 SID_FORMTEXT_SHDWXVAL
, SfxCallMode::RECORD
,
498 { &aXItem
, &aYItem
});
505 m_xMtrFldShadowX
->set_unit(FieldUnit::DEGREE
);
506 m_xMtrFldShadowX
->set_digits(1);
507 m_xMtrFldShadowX
->set_range(-1800, 1800, FieldUnit::NONE
);
508 m_xMtrFldShadowX
->set_increments(10, 100, FieldUnit::NONE
);
509 m_xMtrFldShadowX
->set_width_chars(WIDTH_CHARS
);
511 m_xMtrFldShadowY
->set_unit(FieldUnit::PERCENT
);
512 m_xMtrFldShadowY
->set_digits(0);
513 m_xMtrFldShadowY
->set_range(-999, 999, FieldUnit::NONE
);
514 m_xMtrFldShadowY
->set_increments(10, 100, FieldUnit::NONE
);
515 m_xMtrFldShadowY
->set_width_chars(WIDTH_CHARS
);
517 if ( bRestoreValues
)
519 m_xMtrFldShadowX
->set_value(nSaveShadowAngle
, FieldUnit::NONE
);
520 m_xMtrFldShadowY
->set_value(nSaveShadowSize
, FieldUnit::NONE
);
521 XFormTextShadowXValItem
aXItem(nSaveShadowAngle
);
522 XFormTextShadowYValItem
aYItem(nSaveShadowSize
);
523 GetBindings().GetDispatcher()->ExecuteList(
524 SID_FORMTEXT_SHDWXVAL
, SfxCallMode::RECORD
,
525 { &aXItem
, &aYItem
});
530 if (!m_xTbxShadow
->get_item_active(sId
))
531 m_xTbxShadow
->set_item_active(sId
, true);
532 m_sLastShadowTbxId
= sId
;
538 m_xTbxShadow
->set_sensitive(false);
539 m_xMtrFldShadowX
->set_sensitive(false);
540 m_xMtrFldShadowY
->set_sensitive(false);
541 m_xShadowColorLB
->set_sensitive(false);
545 // Insert shadow color in listbox
547 void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem
* pItem
)
550 m_xShadowColorLB
->SelectEntry(pItem
->GetColorValue());
553 // Enter X-value for shadow in edit field
554 void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem
* pItem
)
556 if (!pItem
|| m_xMtrFldShadowX
->has_focus())
560 // sal_Int32 nValue = pItem->GetValue();
563 // The two involved fields/items are used double and contain/give different
564 // values regarding to the access method. Thus, here we need to separate the access
565 // methods regarding to the kind of value accessed.
566 if (m_xTbxShadow
->get_item_active("slant"))
569 // There is no value correction necessary at all, i think this
570 // was only tried to be done without understanding that the two
571 // involved fields/items are used double and contain/give different
572 // values regarding to the access method.
573 // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
574 m_xMtrFldShadowX
->set_value(pItem
->GetValue(), FieldUnit::NONE
);
578 SetMetricValue(*m_xMtrFldShadowX
, pItem
->GetValue(), MapUnit::Map100thMM
);
582 // Enter Y-value for shadow in edit field
583 void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem
* pItem
)
585 if (!pItem
|| m_xMtrFldShadowY
->has_focus())
589 // The two involved fields/items are used double and contain/give different
590 // values regarding to the access method. Thus, here we need to separate the access
591 // methods regarding to the kind of value accessed.
592 if (m_xTbxShadow
->get_item_active("slant"))
594 m_xMtrFldShadowY
->set_value(pItem
->GetValue(), FieldUnit::NONE
);
598 SetMetricValue(*m_xMtrFldShadowY
, pItem
->GetValue(), MapUnit::Map100thMM
);
602 IMPL_LINK(SvxFontWorkDialog
, SelectStyleHdl_Impl
, const OString
&, rId
, void)
604 // Execute this block when a different toolbox item has been clicked or
605 // when the off item has been clicked. The later is necessary to
606 // override the toolbox behaviour of unchecking the item after second
607 // click on it: One of the items has to be checked at all times (when
609 if (rId
!= "off" && rId
== m_sLastStyleTbxId
)
612 XFormTextStyle eStyle
= XFormTextStyle::NONE
;
615 eStyle
= XFormTextStyle::Rotate
;
616 else if (rId
== "upright")
617 eStyle
= XFormTextStyle::Upright
;
618 else if (rId
== "hori")
619 eStyle
= XFormTextStyle::SlantX
;
620 else if (rId
== "vert")
621 eStyle
= XFormTextStyle::SlantY
;
623 XFormTextStyleItem
aItem( eStyle
);
624 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_STYLE
,
625 SfxCallMode::RECORD
, { &aItem
});
626 SetStyle_Impl( &aItem
);
627 m_sLastStyleTbxId
= rId
;
630 IMPL_LINK(SvxFontWorkDialog
, SelectAdjustHdl_Impl
, const OString
&, rId
, void)
632 if (rId
== "orientation")
634 XFormTextMirrorItem
aItem(m_xTbxAdjust
->get_item_active(rId
));
635 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_MIRROR
,
636 SfxCallMode::SLOT
, { &aItem
});
638 else if (rId
!= m_sLastAdjustTbxId
)
640 XFormTextAdjust eAdjust
= XFormTextAdjust::AutoSize
;
643 eAdjust
= XFormTextAdjust::Left
;
644 else if (rId
== "center")
645 eAdjust
= XFormTextAdjust::Center
;
646 else if (rId
== "right")
647 eAdjust
= XFormTextAdjust::Right
;
649 XFormTextAdjustItem
aItem(eAdjust
);
650 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_ADJUST
,
651 SfxCallMode::RECORD
, { &aItem
});
652 SetAdjust_Impl(&aItem
);
653 m_sLastAdjustTbxId
= rId
;
657 IMPL_LINK(SvxFontWorkDialog
, SelectShadowHdl_Impl
, const OString
&, rId
, void)
659 if (rId
== "contour")
661 XFormTextHideFormItem
aItem(!m_xTbxShadow
->get_item_active(rId
));
662 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_HIDEFORM
,
663 SfxCallMode::RECORD
, { &aItem
});
665 else if (rId
== "textcontour")
667 XFormTextOutlineItem
aItem(m_xTbxShadow
->get_item_active(rId
));
668 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_OUTLINE
,
669 SfxCallMode::RECORD
, { &aItem
});
671 else if (rId
!= m_sLastShadowTbxId
)
673 XFormTextShadow eShadow
= XFormTextShadow::NONE
;
675 if (m_sLastShadowTbxId
== "vertical")
677 nSaveShadowX
= GetCoreValue(*m_xMtrFldShadowX
, MapUnit::Map100thMM
);
678 nSaveShadowY
= GetCoreValue(*m_xMtrFldShadowY
, MapUnit::Map100thMM
);
680 else if (m_sLastShadowTbxId
== "slant")
682 nSaveShadowAngle
= m_xMtrFldShadowX
->get_value(FieldUnit::NONE
);
683 nSaveShadowSize
= m_xMtrFldShadowY
->get_value(FieldUnit::NONE
);
685 m_sLastShadowTbxId
= rId
;
687 if ( rId
== "vertical") eShadow
= XFormTextShadow::Normal
;
688 else if (rId
== "slant") eShadow
= XFormTextShadow::Slant
;
690 XFormTextShadowItem
aItem(eShadow
);
691 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_SHADOW
,
692 SfxCallMode::RECORD
, { &aItem
});
693 SetShadow_Impl(&aItem
, true);
697 IMPL_LINK_NOARG(SvxFontWorkDialog
, ModifyInputHdl_Impl
, weld::MetricSpinButton
&, void)
702 IMPL_LINK_NOARG(SvxFontWorkDialog
, InputTimeoutHdl_Impl
, Timer
*, void)
704 // Possibly set the Metric system again. This should be done with a
705 // listen, this is however not possible at the moment due to compatibility
707 const FieldUnit eDlgUnit
= rBindings
.GetDispatcher()->GetModule()->GetFieldUnit();
708 if( eDlgUnit
!= m_xMtrFldDistance
->get_unit() )
710 SetFieldUnit(*m_xMtrFldDistance
, eDlgUnit
, true);
711 SetFieldUnit(*m_xMtrFldTextStart
, eDlgUnit
, true);
712 if (eDlgUnit
== FieldUnit::MM
)
714 m_xMtrFldDistance
->set_increments(50, 500, FieldUnit::NONE
);
715 m_xMtrFldTextStart
->set_increments(50, 500, FieldUnit::NONE
);
719 m_xMtrFldDistance
->set_increments(10, 100, FieldUnit::NONE
);
720 m_xMtrFldTextStart
->set_increments(10, 100, FieldUnit::NONE
);
723 if( eDlgUnit
!= m_xMtrFldShadowX
->get_unit() &&
724 m_xTbxShadow
->get_item_active("vertical") )
726 SetFieldUnit(*m_xMtrFldShadowX
, eDlgUnit
, true);
727 SetFieldUnit(*m_xMtrFldShadowY
, eDlgUnit
, true);
729 if (eDlgUnit
== FieldUnit::MM
)
731 m_xMtrFldShadowX
->set_increments(50, 500, FieldUnit::NONE
);
732 m_xMtrFldShadowY
->set_increments(50, 500, FieldUnit::NONE
);
736 m_xMtrFldShadowX
->set_increments(10, 100, FieldUnit::NONE
);
737 m_xMtrFldShadowY
->set_increments(10, 100, FieldUnit::NONE
);
741 tools::Long nValue
= GetCoreValue(*m_xMtrFldDistance
, MapUnit::Map100thMM
);
742 XFormTextDistanceItem
aDistItem( nValue
);
743 nValue
= GetCoreValue(*m_xMtrFldTextStart
, MapUnit::Map100thMM
);
744 XFormTextStartItem
aStartItem( nValue
);
746 sal_Int32
nValueX(0);
747 sal_Int32
nValueY(0);
750 // The two involved fields/items are used double and contain/give different
751 // values regarding to the access method. Thus, here we need to separate the access
752 // method regarding to the kind of value accessed.
753 if (m_sLastShadowTbxId
== "vertical")
755 nValueX
= GetCoreValue(*m_xMtrFldShadowX
, MapUnit::Map100thMM
);
756 nValueY
= GetCoreValue(*m_xMtrFldShadowY
, MapUnit::Map100thMM
);
758 else if (m_sLastShadowTbxId
== "slant")
760 nValueX
= m_xMtrFldShadowX
->get_value(FieldUnit::NONE
);
761 nValueY
= m_xMtrFldShadowY
->get_value(FieldUnit::NONE
);
764 XFormTextShadowXValItem
aShadowXItem( nValueX
);
765 XFormTextShadowYValItem
aShadowYItem( nValueY
);
767 // Slot-ID does not matter, the Exec method evaluates the entire item set
768 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_DISTANCE
,
770 { &aDistItem
, &aStartItem
, &aShadowXItem
, &aShadowYItem
});
773 IMPL_LINK_NOARG(SvxFontWorkDialog
, ColorSelectHdl_Impl
, ColorListBox
&, void)
775 XFormTextShadowColorItem
aItem( "", m_xShadowColorLB
->GetSelectEntryColor() );
776 GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_SHDWCOLOR
,
777 SfxCallMode::RECORD
, { &aItem
});
780 void SvxFontWorkDialog::ApplyImageList()
782 if (m_sLastShadowTbxId
== "slant")
784 m_xFbShadowX
->set_from_icon_name(RID_SVXBMP_SHADOW_ANGLE
);
785 m_xFbShadowY
->set_from_icon_name(RID_SVXBMP_SHADOW_SIZE
);
789 m_xFbShadowX
->set_from_icon_name(RID_SVXBMP_SHADOW_XDIST
);
790 m_xFbShadowY
->set_from_icon_name(RID_SVXBMP_SHADOW_YDIST
);
794 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */