21#include <svx/svxids.hrc>
45 SDRATTR_SHADOWCOLOR, SDRATTR_SHADOWTRANSPARENCE,
46 SDRATTR_SHADOWBLUR, SDRATTR_SHADOWBLUR,
47 SID_ATTR_FILL_SHADOW, SID_ATTR_FILL_SHADOW,
48 SID_ATTR_SHADOW_BLUR, SID_ATTR_SHADOW_BLUR,
49 SID_ATTR_SHADOW_TRANSPARENCE, SID_ATTR_SHADOW_YDISTANCE
53 :
SvxTabPage(pPage, pController,
"cui/ui/shadowtabpage.ui",
"ShadowTabPage", rInAttrs)
54 , m_rOutAttrs(rInAttrs)
55 , m_pnColorListState(nullptr)
58 , m_aXFillAttr(rInAttrs.GetPool())
60 , m_aCtlPosition(this)
61 , m_xTsbShowShadow(m_xBuilder->weld_check_button(
"TSB_SHOW_SHADOW"))
62 , m_xGridShadow(m_xBuilder->weld_widget(
"gridSHADOW"))
63 , m_xMtrDistance(m_xBuilder->weld_metric_spin_button(
"MTR_FLD_DISTANCE",
FieldUnit::
CM))
64 , m_xLbShadowColor(new
ColorListBox(m_xBuilder->weld_menu_button(
"LB_SHADOW_COLOR"),
65 [this]{
return GetDialogController()->getDialog(); }))
66 , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button(
"MTR_SHADOW_TRANSPARENT", FieldUnit::PERCENT))
67 , m_xLbShadowBlurMetric(m_xBuilder->weld_metric_spin_button(
"LB_SHADOW_BLUR", FieldUnit::POINT))
68 , m_xCtlPosition(
new weld::CustomWeld(*m_xBuilder,
"CTL_POSITION", m_aCtlPosition))
69 , m_xCtlXRectPreview(
new weld::CustomWeld(*m_xBuilder,
"CTL_COLOR_PREVIEW", m_aCtlXRectPreview))
81 eFUnit = FieldUnit::MM;
90 m_ePoolUnit = pPool->
GetMetric( SDRATTR_SHADOWXDIST );
93 drawing::FillStyle eXFS = drawing::FillStyle_SOLID;
94 if( m_rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE )
96 eXFS = m_rOutAttrs.Get(
GetWhich( XATTR_FILLSTYLE ) ).GetValue();
99 case drawing::FillStyle_SOLID:
100 if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
102 m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLCOLOR ) );
106 case drawing::FillStyle_GRADIENT:
107 if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
109 m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLGRADIENT ) );
113 case drawing::FillStyle_HATCH:
114 if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
116 m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLHATCH ) );
120 case drawing::FillStyle_BITMAP:
122 if( SfxItemState::DONTCARE != m_rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
124 m_rXFSet.Put( m_rOutAttrs.Get( XATTR_FILLBITMAP ) );
128 case drawing::FillStyle_NONE :
break;
137 if(drawing::FillStyle_NONE == eXFS)
143 eXFS = drawing::FillStyle_SOLID;
147 m_aCtlXRectPreview.SetRectangleAttributes(m_aXFillAttr.GetItemSet());
152 m_xLbShadowBlurMetric->connect_value_changed(aLink);
153 m_xMtrTransparent->connect_value_changed(aLink);
154 m_xMtrDistance->connect_value_changed(aLink);
201 rAttribs.
Put( aItem );
215 return DeactivateRC::LeavePage;
221 bool bModified =
false;
234 if ( !pOld || !( *
static_cast<const SdrOnOffItem*
>(pOld) == aItem ) )
236 rAttrs->
Put( aItem );
244 sal_Int32 nX = 0, nY = 0;
249 case RectPoint::LT: nX = nY = -nXY;
break;
250 case RectPoint::MT: nY = -nXY;
break;
251 case RectPoint::RT: nX = nXY; nY = -nXY;
break;
252 case RectPoint::LM: nX = -nXY;
break;
253 case RectPoint::RM: nX = nXY;
break;
254 case RectPoint::LB: nX = -nXY; nY = nXY;
break;
255 case RectPoint::MB: nY = nXY;
break;
256 case RectPoint::RB: nX = nY = nXY;
break;
257 case RectPoint::MM:
break;
268 sal_Int32 nOldX = 9876543;
269 sal_Int32 nOldY = 9876543;
279 ( !pOld || !( *
static_cast<const SdrMetricItem*
>(pOld) == aXItem ) ) )
281 rAttrs->
Put( aXItem );
287 ( !pOld || !( *
static_cast<const SdrMetricItem*
>(pOld) == aYItem ) ) )
289 rAttrs->
Put( aYItem );
298 if ( !pOld || !( *
static_cast<const XColorItem*
>(pOld) == aItem ) )
300 rAttrs->
Put( aItem );
306 sal_uInt16 nVal =
static_cast<sal_uInt16
>(
m_xMtrTransparent->get_value(FieldUnit::PERCENT));
311 if ( !pOld || !( *
static_cast<const SdrPercentItem*
>(pOld) == aItem ) )
313 rAttrs->
Put( aItem );
322 if ( !pOld || !( *
static_cast<const SdrMetricItem*
>(pOld) == aItem ) )
324 rAttrs->
Put( aItem );
438 return std::make_unique<SvxShadowTabPage>(pPage, pController, *rAttrs);
445 m_xGridShadow->set_sensitive(
false);
446 m_xCtlPosition->set_sensitive(
false);
450 m_xGridShadow->set_sensitive(
true);
451 m_xCtlPosition->set_sensitive(
true);
453 m_aCtlPosition.Invalidate();
454 ModifyShadowHdl_Impl(*m_xMtrTransparent);
459 ModifyShadowHdl_Impl(*m_xMtrTransparent);
469 m_rXFSet.Put(
XFillColorItem( OUString(), m_xLbShadowColor->GetSelectEntryColor() ) );
470 sal_uInt16 nVal =
static_cast<sal_uInt16
>(m_xMtrTransparent->get_value(FieldUnit::PERCENT));
474 sal_Int32 nX = 0, nY = 0;
475 sal_Int32 nXY =
GetCoreValue( *m_xMtrDistance, m_ePoolUnit );
476 switch( m_aCtlPosition.GetActualRP() )
478 case RectPoint::LT: nX = nY = -nXY;
break;
479 case RectPoint::MT: nY = -nXY;
break;
480 case RectPoint::RT: nX = nXY; nY = -nXY;
break;
481 case RectPoint::LM: nX = -nXY;
break;
482 case RectPoint::RM: nX = nXY;
break;
483 case RectPoint::LB: nX = -nXY; nY = nXY;
break;
484 case RectPoint::MB: nY = nXY;
break;
485 case RectPoint::RB: nX = nY = nXY;
break;
486 case RectPoint::MM:
break;
489 m_aCtlXRectPreview.SetShadowPosition(
Point(nX, nY));
491 m_aCtlXRectPreview.SetShadowAttributes(m_aXFillAttr.GetItemSet());
492 m_aCtlXRectPreview.Invalidate();
sal_uInt16 GetValue() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const XColorListRef & GetNewColorList() const
const XColorListRef & GetColorList() const
const XColorListRef & GetNewColorList() const
void SetActualRP(RectPoint eNewRP)
RectPoint GetActualRP() const
std::unique_ptr< ColorListBox > m_xLbShadowColor
void SetPageType(PageType nInType)
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::CustomWeld > m_xCtlPosition
std::unique_ptr< weld::MetricSpinButton > m_xLbShadowBlurMetric
XColorListRef m_pColorList
void SetColorList(XColorListRef const &pColorList)
virtual void PageCreated(const SfxAllItemSet &aSet) override
SvxRectCtl m_aCtlPosition
std::unique_ptr< weld::MetricSpinButton > m_xMtrDistance
virtual ~SvxShadowTabPage() override
std::unique_ptr< weld::CustomWeld > m_xCtlXRectPreview
virtual bool FillItemSet(SfxItemSet *) override
const SfxItemSet & m_rOutAttrs
SvxShadowTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
std::unique_ptr< weld::MetricSpinButton > m_xMtrTransparent
void SetDlgType(sal_uInt16 nInType)
virtual void PointChanged(weld::DrawingArea *pWindow, RectPoint eRP) override
std::unique_ptr< weld::CheckButton > m_xTsbShowShadow
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
static const WhichRangesContainer pShadowRanges
virtual void Reset(const SfxItemSet *) override
SvxXShadowPreview m_aCtlXRectPreview
ChangeType * m_pnColorListState
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
void SetRectangleAttributes(const SfxItemSet &rItemSet)
#define DBG_ASSERT(sCon, aError)
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
#define LINK(Instance, Class, Member)
static constexpr auto Items
XColorItem makeSdrShadowColorItem(const Color &rTheColor)
SdrOnOffItem makeSdrShadowItem(bool bShadow)
SdrPercentItem makeSdrShadowTransparenceItem(sal_uInt16 nTransp)
SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist)
SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
constexpr TypedWhichId< SdrPercentItem > SDRATTR_SHADOWTRANSPARENCE(SDRATTR_SHADOW_FIRST+4)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_SHADOWYDIST(SDRATTR_SHADOW_FIRST+3)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_SHADOWBLUR(SDRATTR_SHADOW_FIRST+9)
constexpr TypedWhichId< XColorItem > SDRATTR_SHADOWCOLOR(SDRATTR_SHADOW_FIRST+1)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_SHADOWXDIST(SDRATTR_SHADOW_FIRST+2)
IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, weld::Toggleable &, void)
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)