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 <svx/svxids.hrc>
22 #include <svx/xfillit0.hxx>
23 #include <svx/xflclit.hxx>
24 #include <svx/xflftrit.hxx>
25 #include <svx/xflgrit.hxx>
26 #include <svx/xflhtit.hxx>
27 #include <svx/xbtmpit.hxx>
28 #include <svx/xflbckit.hxx>
29 #include <svx/sdshtitm.hxx>
30 #include <svx/xfltrit.hxx>
31 #include <cuitabarea.hxx>
32 #include <svl/intitem.hxx>
34 using namespace com::sun::star
;
36 const WhichRangesContainer
SvxTransparenceTabPage::pTransparenceRanges(svl::Items
<
37 XATTR_FILLTRANSPARENCE
, XATTR_FILLTRANSPARENCE
,
38 XATTR_FILLFLOATTRANSPARENCE
, XATTR_FILLFLOATTRANSPARENCE
,
39 SDRATTR_SHADOWTRANSPARENCE
, SDRATTR_SHADOWTRANSPARENCE
42 /*************************************************************************
44 |* Dialog for transparence
46 \************************************************************************/
48 IMPL_LINK_NOARG(SvxTransparenceTabPage
, ClickTransOffHdl_Impl
, weld::Toggleable
&, void)
50 // disable all other controls
51 ActivateLinear(false);
52 ActivateGradient(false);
55 rXFSet
.ClearItem(XATTR_FILLTRANSPARENCE
);
56 rXFSet
.ClearItem(XATTR_FILLFLOATTRANSPARENCE
);
57 m_aCtlXRectPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
58 m_aCtlBitmapPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
60 InvalidatePreview(false);
63 IMPL_LINK_NOARG(SvxTransparenceTabPage
, ClickTransLinearHdl_Impl
, weld::Toggleable
&, void)
65 // enable linear, disable other
67 ActivateGradient(false);
70 rXFSet
.ClearItem (XATTR_FILLFLOATTRANSPARENCE
);
71 ModifyTransparentHdl_Impl(*m_xMtrTransparent
);
74 IMPL_LINK_NOARG(SvxTransparenceTabPage
, ClickTransGradientHdl_Impl
, weld::Toggleable
&, void)
76 // enable gradient, disable other
77 ActivateLinear(false);
78 ActivateGradient(true);
81 rXFSet
.ClearItem (XATTR_FILLTRANSPARENCE
);
82 ModifiedTrgrHdl_Impl(nullptr);
85 SvxTransparenceTabPage::~SvxTransparenceTabPage()
89 void SvxTransparenceTabPage::ActivateLinear(bool bActivate
)
91 m_xMtrTransparent
->set_sensitive(bActivate
);
94 IMPL_LINK_NOARG(SvxTransparenceTabPage
, ModifyTransparentHdl_Impl
, weld::MetricSpinButton
&, void)
96 sal_uInt16 nPos
= m_xMtrTransparent
->get_value(FieldUnit::PERCENT
);
97 rXFSet
.Put(XFillTransparenceItem(nPos
));
103 IMPL_LINK(SvxTransparenceTabPage
, ModifiedTrgrListBoxHdl_Impl
, weld::ComboBox
&, rListBox
, void)
105 ModifiedTrgrHdl_Impl(&rListBox
);
108 IMPL_LINK_NOARG(SvxTransparenceTabPage
, ModifiedTrgrEditHdl_Impl
, weld::MetricSpinButton
&, void)
110 ModifiedTrgrHdl_Impl(nullptr);
113 void SvxTransparenceTabPage::ModifiedTrgrHdl_Impl(const weld::ComboBox
* pControl
)
115 if (pControl
== m_xLbTrgrGradientType
.get())
117 css::awt::GradientStyle eXGS
= static_cast<css::awt::GradientStyle
>(m_xLbTrgrGradientType
->get_active());
118 SetControlState_Impl( eXGS
);
122 basegfx::BGradient
aTmpGradient(
124 static_cast<css::awt::GradientStyle
>(m_xLbTrgrGradientType
->get_active()),
125 Degree10(static_cast<sal_Int16
>(m_xMtrTrgrAngle
->get_value(FieldUnit::DEGREE
)) * 10),
126 static_cast<sal_uInt16
>(m_xMtrTrgrCenterX
->get_value(FieldUnit::PERCENT
)),
127 static_cast<sal_uInt16
>(m_xMtrTrgrCenterY
->get_value(FieldUnit::PERCENT
)),
128 static_cast<sal_uInt16
>(m_xMtrTrgrBorder
->get_value(FieldUnit::PERCENT
)),
131 XFillFloatTransparenceItem
aItem( aTmpGradient
);
132 rXFSet
.Put ( aItem
);
137 void SvxTransparenceTabPage::ActivateGradient(bool bActivate
)
139 m_xGridGradient
->set_sensitive(bActivate
);
143 css::awt::GradientStyle eXGS
= static_cast<css::awt::GradientStyle
>(m_xLbTrgrGradientType
->get_active());
144 SetControlState_Impl( eXGS
);
148 void SvxTransparenceTabPage::SetControlState_Impl(css::awt::GradientStyle eXGS
)
152 case css::awt::GradientStyle_LINEAR
:
153 case css::awt::GradientStyle_AXIAL
:
154 m_xFtTrgrCenterX
->set_sensitive(false);
155 m_xMtrTrgrCenterX
->set_sensitive(false);
156 m_xFtTrgrCenterY
->set_sensitive(false);
157 m_xMtrTrgrCenterY
->set_sensitive(false);
158 m_xFtTrgrAngle
->set_sensitive(true);
159 m_xMtrTrgrAngle
->set_sensitive(true);
162 case css::awt::GradientStyle_RADIAL
:
163 m_xFtTrgrCenterX
->set_sensitive(true);
164 m_xMtrTrgrCenterX
->set_sensitive(true);
165 m_xFtTrgrCenterY
->set_sensitive(true);
166 m_xMtrTrgrCenterY
->set_sensitive(true);
167 m_xFtTrgrAngle
->set_sensitive(false);
168 m_xMtrTrgrAngle
->set_sensitive(false);
171 case css::awt::GradientStyle_ELLIPTICAL
:
172 case css::awt::GradientStyle_SQUARE
:
173 case css::awt::GradientStyle_RECT
:
174 m_xFtTrgrCenterX
->set_sensitive(true);
175 m_xMtrTrgrCenterX
->set_sensitive(true);
176 m_xFtTrgrCenterY
->set_sensitive(true);
177 m_xMtrTrgrCenterY
->set_sensitive(true);
178 m_xFtTrgrAngle
->set_sensitive(true);
179 m_xMtrTrgrAngle
->set_sensitive(true);
186 SvxTransparenceTabPage::SvxTransparenceTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
)
187 : SfxTabPage(pPage
, pController
, u
"cui/ui/transparencytabpage.ui"_ustr
, u
"TransparencyTabPage"_ustr
, &rInAttrs
)
188 , rOutAttrs(rInAttrs
)
189 , nPageType(PageType::Area
)
192 , aXFillAttr(rInAttrs
.GetPool())
193 , rXFSet(aXFillAttr
.GetItemSet())
194 , m_xRbtTransOff(m_xBuilder
->weld_radio_button(u
"RBT_TRANS_OFF"_ustr
))
195 , m_xRbtTransLinear(m_xBuilder
->weld_radio_button(u
"RBT_TRANS_LINEAR"_ustr
))
196 , m_xRbtTransGradient(m_xBuilder
->weld_radio_button(u
"RBT_TRANS_GRADIENT"_ustr
))
197 , m_xMtrTransparent(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRANSPARENT"_ustr
, FieldUnit::PERCENT
))
198 , m_xGridGradient(m_xBuilder
->weld_widget(u
"gridGradient"_ustr
))
199 , m_xLbTrgrGradientType(m_xBuilder
->weld_combo_box(u
"LB_TRGR_GRADIENT_TYPES"_ustr
))
200 , m_xFtTrgrCenterX(m_xBuilder
->weld_label(u
"FT_TRGR_CENTER_X"_ustr
))
201 , m_xMtrTrgrCenterX(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_CENTER_X"_ustr
, FieldUnit::PERCENT
))
202 , m_xFtTrgrCenterY(m_xBuilder
->weld_label(u
"FT_TRGR_CENTER_Y"_ustr
))
203 , m_xMtrTrgrCenterY(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_CENTER_Y"_ustr
, FieldUnit::PERCENT
))
204 , m_xFtTrgrAngle(m_xBuilder
->weld_label(u
"FT_TRGR_ANGLE"_ustr
))
205 , m_xMtrTrgrAngle(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_ANGLE"_ustr
, FieldUnit::DEGREE
))
206 , m_xMtrTrgrBorder(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_BORDER"_ustr
, FieldUnit::PERCENT
))
207 , m_xMtrTrgrStartValue(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_START_VALUE"_ustr
, FieldUnit::PERCENT
))
208 , m_xMtrTrgrEndValue(m_xBuilder
->weld_metric_spin_button(u
"MTR_TRGR_END_VALUE"_ustr
, FieldUnit::PERCENT
))
209 , m_xCtlBitmapBorder(m_xBuilder
->weld_widget(u
"bitmap_border"_ustr
))
210 , m_xCtlXRectBorder(m_xBuilder
->weld_widget(u
"trans_border"_ustr
))
211 , m_xCtlBitmapPreview(new weld::CustomWeld(*m_xBuilder
, u
"CTL_IMAGE_PREVIEW"_ustr
, m_aCtlBitmapPreview
))
212 , m_xCtlXRectPreview(new weld::CustomWeld(*m_xBuilder
, u
"CTL_TRANS_PREVIEW"_ustr
, m_aCtlXRectPreview
))
215 m_xRbtTransOff
->connect_toggled(LINK(this, SvxTransparenceTabPage
, ClickTransOffHdl_Impl
));
216 m_xRbtTransLinear
->connect_toggled(LINK(this, SvxTransparenceTabPage
, ClickTransLinearHdl_Impl
));
217 m_xRbtTransGradient
->connect_toggled(LINK(this, SvxTransparenceTabPage
, ClickTransGradientHdl_Impl
));
219 // linear transparency
220 m_xMtrTransparent
->set_value(50, FieldUnit::PERCENT
);
221 m_xMtrTransparent
->connect_value_changed(LINK(this, SvxTransparenceTabPage
, ModifyTransparentHdl_Impl
));
223 // gradient transparency
224 m_xMtrTrgrEndValue
->set_value(100, FieldUnit::PERCENT
);
225 m_xMtrTrgrStartValue
->set_value(0, FieldUnit::PERCENT
);
226 Link
<weld::MetricSpinButton
&,void> aLink
= LINK( this, SvxTransparenceTabPage
, ModifiedTrgrEditHdl_Impl
);
227 m_xLbTrgrGradientType
->connect_changed(LINK(this, SvxTransparenceTabPage
, ModifiedTrgrListBoxHdl_Impl
));
228 m_xMtrTrgrCenterX
->connect_value_changed( aLink
);
229 m_xMtrTrgrCenterY
->connect_value_changed( aLink
);
230 m_xMtrTrgrAngle
->connect_value_changed( aLink
);
231 m_xMtrTrgrBorder
->connect_value_changed( aLink
);
232 m_xMtrTrgrStartValue
->connect_value_changed( aLink
);
233 m_xMtrTrgrEndValue
->connect_value_changed( aLink
);
235 // this page needs ExchangeSupport
236 SetExchangeSupport();
239 std::unique_ptr
<SfxTabPage
> SvxTransparenceTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrs
)
241 return std::make_unique
<SvxTransparenceTabPage
>(pPage
, pController
, *rAttrs
);
244 bool SvxTransparenceTabPage::FillItemSet(SfxItemSet
* rAttrs
)
246 const SfxPoolItem
* pGradientItem
= nullptr;
247 const SfxPoolItem
* pLinearItem
= nullptr;
248 SfxItemState
eStateGradient(rOutAttrs
.GetItemState(XATTR_FILLFLOATTRANSPARENCE
, true, &pGradientItem
));
249 SfxItemState
eStateLinear(rOutAttrs
.GetItemState(XATTR_FILLTRANSPARENCE
, true, &pLinearItem
));
250 bool bGradActive
= (eStateGradient
== SfxItemState::SET
&& static_cast<const XFillFloatTransparenceItem
*>(pGradientItem
)->IsEnabled());
251 bool bLinearActive
= (eStateLinear
== SfxItemState::SET
&& static_cast<const XFillTransparenceItem
*>(pLinearItem
)->GetValue() != 0);
253 bool bGradUsed
= (eStateGradient
== SfxItemState::INVALID
);
254 bool bLinearUsed
= (eStateLinear
== SfxItemState::INVALID
);
256 bool bModified(false);
257 bool bSwitchOffLinear(false);
258 bool bSwitchOffGradient(false);
260 if (m_xMtrTransparent
->get_sensitive())
262 // linear transparence
263 sal_uInt16 nPos
= m_xMtrTransparent
->get_value(FieldUnit::PERCENT
);
264 if (m_xMtrTransparent
->get_value_changed_from_saved() || !bLinearActive
)
266 XFillTransparenceItem
aItem(nPos
);
267 SdrPercentItem
aShadowItem(makeSdrShadowTransparenceItem(nPos
));
268 const SfxPoolItem
* pOld
= GetOldItem(*rAttrs
, XATTR_FILLTRANSPARENCE
);
269 if(!pOld
|| !(*static_cast<const XFillTransparenceItem
*>(pOld
) == aItem
) || !bLinearActive
)
272 rAttrs
->Put(aShadowItem
);
274 bSwitchOffGradient
= true;
278 else if (m_xGridGradient
->get_sensitive())
280 // transparence gradient, fill ItemSet from values
282 || m_xLbTrgrGradientType
->get_value_changed_from_saved()
283 || m_xMtrTrgrAngle
->get_value_changed_from_saved()
284 || m_xMtrTrgrCenterX
->get_value_changed_from_saved()
285 || m_xMtrTrgrCenterY
->get_value_changed_from_saved()
286 || m_xMtrTrgrBorder
->get_value_changed_from_saved()
287 || m_xMtrTrgrStartValue
->get_value_changed_from_saved()
288 || m_xMtrTrgrEndValue
->get_value_changed_from_saved())
290 basegfx::BGradient
aTmpGradient(
292 static_cast<css::awt::GradientStyle
>(m_xLbTrgrGradientType
->get_active()),
293 Degree10(static_cast<sal_Int16
>(m_xMtrTrgrAngle
->get_value(FieldUnit::DEGREE
)) * 10),
294 static_cast<sal_uInt16
>(m_xMtrTrgrCenterX
->get_value(FieldUnit::PERCENT
)),
295 static_cast<sal_uInt16
>(m_xMtrTrgrCenterY
->get_value(FieldUnit::PERCENT
)),
296 static_cast<sal_uInt16
>(m_xMtrTrgrBorder
->get_value(FieldUnit::PERCENT
)),
299 XFillFloatTransparenceItem
aItem(aTmpGradient
);
300 const SfxPoolItem
* pOld
= GetOldItem(*rAttrs
, XATTR_FILLFLOATTRANSPARENCE
);
302 if(!pOld
|| !(*static_cast<const XFillFloatTransparenceItem
*>(pOld
) == aItem
) || !bGradActive
)
306 bSwitchOffLinear
= true;
313 bSwitchOffGradient
= true;
314 bSwitchOffLinear
= true;
317 // disable unused XFillFloatTransparenceItem
318 if(bSwitchOffGradient
&& (bGradActive
|| bGradUsed
))
320 // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] with same defaults
321 // basegfx::BGradient() default also sets the Start/EndIntensity to 100 already
322 basegfx::BGradient aGrad
;
324 XFillFloatTransparenceItem
aItem(aGrad
);
325 aItem
.SetEnabled(false);
330 // disable unused XFillFloatTransparenceItem
331 if(bSwitchOffLinear
&& (bLinearActive
|| bLinearUsed
))
333 XFillTransparenceItem
aItem(0);
334 SdrPercentItem
aShadowItem(makeSdrShadowTransparenceItem(0));
336 rAttrs
->Put(aShadowItem
);
339 rAttrs
->Put(CntUInt16Item(SID_PAGE_TYPE
, static_cast<sal_uInt16
>(nPageType
)));
343 void SvxTransparenceTabPage::Reset(const SfxItemSet
* rAttrs
)
345 const XFillFloatTransparenceItem
* pGradientItem
=
346 rAttrs
->GetItemIfSet(XATTR_FILLFLOATTRANSPARENCE
);
347 bool bGradActive
= (pGradientItem
&& pGradientItem
->IsEnabled());
349 pGradientItem
= &rAttrs
->Get(XATTR_FILLFLOATTRANSPARENCE
);
351 const XFillTransparenceItem
* pLinearItem
=
352 rAttrs
->GetItemIfSet(XATTR_FILLTRANSPARENCE
);
353 bool bLinearActive
= (pLinearItem
&& pLinearItem
->GetValue() != 0);
355 pLinearItem
= &rAttrs
->Get(XATTR_FILLTRANSPARENCE
);
357 // transparence gradient
358 const basegfx::BGradient
& rGradient
= pGradientItem
->GetGradientValue();
359 css::awt::GradientStyle
eXGS(rGradient
.GetGradientStyle());
360 m_xLbTrgrGradientType
->set_active(sal::static_int_cast
< sal_Int32
>(eXGS
));
361 m_xMtrTrgrAngle
->set_value(rGradient
.GetAngle().get() / 10, FieldUnit::DEGREE
);
362 m_xMtrTrgrBorder
->set_value(rGradient
.GetBorder(), FieldUnit::PERCENT
);
363 m_xMtrTrgrCenterX
->set_value(rGradient
.GetXOffset(), FieldUnit::PERCENT
);
364 m_xMtrTrgrCenterY
->set_value(rGradient
.GetYOffset(), FieldUnit::PERCENT
);
365 const Color
aStart(rGradient
.GetColorStops().front().getStopColor());
366 const Color
aEnd(rGradient
.GetColorStops().back().getStopColor());
367 m_xMtrTrgrStartValue
->set_value(static_cast<sal_uInt16
>(((static_cast<sal_uInt16
>(aStart
.GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT
);
368 m_xMtrTrgrEndValue
->set_value(static_cast<sal_uInt16
>(((static_cast<sal_uInt16
>(aEnd
.GetRed()) + 1) * 100) / 255), FieldUnit::PERCENT
);
370 // MCGR: preserve ColorStops if given
371 // tdf#155901 We need offset of first and last stop, so include them.
372 if (rGradient
.GetColorStops().size() >= 2)
373 maColorStops
= rGradient
.GetColorStops();
375 maColorStops
.clear();
377 // linear transparence
378 sal_uInt16 nTransp
= pLinearItem
->GetValue();
379 m_xMtrTransparent
->set_value(bLinearActive
? nTransp
: 50, FieldUnit::PERCENT
);
380 ModifyTransparentHdl_Impl(*m_xMtrTransparent
);
382 // select the correct radio button
385 // transparence gradient, set controls appropriate to item
386 m_xRbtTransGradient
->set_active(true);
387 ClickTransGradientHdl_Impl(*m_xRbtTransGradient
);
389 else if(bLinearActive
)
391 // linear transparence
392 m_xRbtTransLinear
->set_active(true);
393 ClickTransLinearHdl_Impl(*m_xRbtTransLinear
);
398 m_xRbtTransOff
->set_active(true);
399 ClickTransOffHdl_Impl(*m_xRbtTransOff
);
400 ModifiedTrgrHdl_Impl(nullptr);
405 bool bActive
= InitPreview ( *rAttrs
);
406 InvalidatePreview ( bActive
);
409 void SvxTransparenceTabPage::ChangesApplied()
411 m_xMtrTransparent
->save_value();
412 m_xLbTrgrGradientType
->save_value();
413 m_xMtrTrgrCenterX
->save_value();
414 m_xMtrTrgrCenterY
->save_value();
415 m_xMtrTrgrAngle
->save_value();
416 m_xMtrTrgrBorder
->save_value();
417 m_xMtrTrgrStartValue
->save_value();
418 m_xMtrTrgrEndValue
->save_value();
421 void SvxTransparenceTabPage::ActivatePage(const SfxItemSet
& rSet
)
423 const CntUInt16Item
* pPageTypeItem
= rSet
.GetItem
<SfxUInt16Item
>(SID_PAGE_TYPE
, false);
425 SetPageType(static_cast<PageType
>(pPageTypeItem
->GetValue()));
427 if(nDlgType
== 0) // area dialog
428 nPageType
= PageType::Transparence
;
430 InitPreview ( rSet
);
433 DeactivateRC
SvxTransparenceTabPage::DeactivatePage(SfxItemSet
* _pSet
)
436 FillItemSet( _pSet
);
437 return DeactivateRC::LeavePage
;
442 bool SvxTransparenceTabPage::InitPreview(const SfxItemSet
& rSet
)
444 // set transparencetype for preview
445 if (m_xRbtTransOff
->get_active())
447 ClickTransOffHdl_Impl(*m_xRbtTransOff
);
449 else if (m_xRbtTransLinear
->get_active())
451 ClickTransLinearHdl_Impl(*m_xRbtTransLinear
);
453 else if (m_xRbtTransGradient
->get_active())
455 ClickTransGradientHdl_Impl(*m_xRbtTransGradient
);
458 // Get fillstyle for preview
459 rXFSet
.Put ( rSet
.Get(XATTR_FILLSTYLE
) );
460 rXFSet
.Put ( rSet
.Get(XATTR_FILLCOLOR
) );
461 rXFSet
.Put ( rSet
.Get(XATTR_FILLGRADIENT
) );
462 rXFSet
.Put ( rSet
.Get(XATTR_FILLHATCH
) );
463 rXFSet
.Put ( rSet
.Get(XATTR_FILLBACKGROUND
) );
464 rXFSet
.Put ( rSet
.Get(XATTR_FILLBITMAP
) );
466 m_aCtlXRectPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
467 m_aCtlBitmapPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
469 bBitmap
= rSet
.Get(XATTR_FILLSTYLE
).GetValue() == drawing::FillStyle_BITMAP
;
471 // show the right preview window
474 m_xCtlBitmapBorder
->show();
475 m_xCtlXRectBorder
->hide();
479 m_xCtlBitmapBorder
->hide();
480 m_xCtlXRectBorder
->show();
483 return !m_xRbtTransOff
->get_active();
486 void SvxTransparenceTabPage::InvalidatePreview (bool bEnable
)
492 m_xCtlBitmapPreview
->set_sensitive(true);
493 m_aCtlBitmapPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
496 m_xCtlBitmapPreview
->set_sensitive(false);
497 m_xCtlBitmapPreview
->queue_draw();
503 m_xCtlXRectPreview
->set_sensitive(true);
504 m_aCtlXRectPreview
.SetAttributes( aXFillAttr
.GetItemSet() );
507 m_xCtlXRectPreview
->set_sensitive(false);
508 m_xCtlXRectPreview
->queue_draw();
512 basegfx::BColorStops
SvxTransparenceTabPage::createColorStops()
514 basegfx::BColorStops aColorStops
;
515 basegfx::BColor
aStartBColor(m_xMtrTrgrStartValue
->get_value(FieldUnit::PERCENT
) / 100.0);
516 aStartBColor
.clamp();
517 basegfx::BColor
aEndBColor(m_xMtrTrgrEndValue
->get_value(FieldUnit::PERCENT
) / 100.0);
520 if(maColorStops
.size() >= 2)
522 aColorStops
= maColorStops
;
523 aColorStops
.front() = basegfx::BColorStop(maColorStops
.front().getStopOffset(), aStartBColor
);
524 aColorStops
.back() = basegfx::BColorStop(maColorStops
.back().getStopOffset(), aEndBColor
);
528 aColorStops
.emplace_back(0.0, aStartBColor
);
529 aColorStops
.emplace_back(1.0, aEndBColor
);
535 void SvxTransparenceTabPage::PageCreated(const SfxAllItemSet
& aSet
)
537 const SfxUInt16Item
* pPageTypeItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_PAGE_TYPE
, false);
538 const SfxUInt16Item
* pDlgTypeItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_DLG_TYPE
, false);
541 SetPageType(static_cast<PageType
>(pPageTypeItem
->GetValue()));
543 SetDlgType(pDlgTypeItem
->GetValue());
546 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */