summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-09 16:18:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-09 22:27:44 +0200
commitc8610e24baaa0788f74acadcf6db1a00856f0d3a (patch)
tree197c5e4849ed01e9f5593620a380a20638ead790
parentb90fa8698e1928b218cdbc07a7ca02b5a80eb406 (diff)
weld SvxShadowTabPage
Change-Id: I5447641216c8cba3d275d76c00bf7306df8acf19 Reviewed-on: https://gerrit.libreoffice.org/60221 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/inc/cuitabarea.hxx26
-rw-r--r--cui/source/tabpages/tpshadow.cxx189
-rw-r--r--cui/uiconfig/ui/shadowtabpage.ui81
-rw-r--r--extras/source/glade/libreoffice-catalog.xml.in3
-rw-r--r--include/svx/dlgctrl.hxx14
-rw-r--r--solenv/sanitizers/ui/cui.suppr6
-rw-r--r--svx/source/dialog/dlgctrl.cxx62
7 files changed, 200 insertions, 181 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index fc256c66312f..64fbb0316230 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -308,14 +308,6 @@ class SvxShadowTabPage : public SvxTabPage
static const sal_uInt16 pShadowRanges[];
private:
- VclPtr<TriStateBox> m_pTsbShowShadow;
- VclPtr<VclGrid> m_pGridShadow;
- VclPtr<SvxRectCtl> m_pCtlPosition;
- VclPtr<MetricField> m_pMtrDistance;
- VclPtr<SvxColorListBox> m_pLbShadowColor;
- VclPtr<MetricField> m_pMtrTransparent;
- VclPtr<SvxXShadowPreview> m_pCtlXRectPreview;
-
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
@@ -327,12 +319,22 @@ private:
SfxItemSet& m_rXFSet;
MapUnit m_ePoolUnit;
- DECL_LINK( ClickShadowHdl_Impl, Button*, void );
- DECL_LINK( ModifyShadowHdl_Impl, Edit&, void );
- DECL_LINK( SelectShadowHdl_Impl, SvxColorListBox&, void );
+ RectCtl m_aCtlPosition;
+ SvxXShadowPreview m_aCtlXRectPreview;
+ std::unique_ptr<weld::CheckButton> m_xTsbShowShadow;
+ std::unique_ptr<weld::Widget> m_xGridShadow;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
+ std::unique_ptr<ColorListBox> m_xLbShadowColor;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
+ std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
+ std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
+
+ DECL_LINK(ClickShadowHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
+ DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
public:
- SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ SvxShadowTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SvxShadowTabPage() override;
virtual void dispose() override;
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index d03a37a7d98f..3b2ac0b04b64 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -45,27 +45,23 @@ const sal_uInt16 SvxShadowTabPage::pShadowRanges[] =
0
};
-SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
-
- SvxTabPage ( pParent,
- "ShadowTabPage",
- "cui/ui/shadowtabpage.ui",
- rInAttrs ),
- m_rOutAttrs ( rInAttrs ),
- m_pnColorListState ( nullptr ),
- m_nPageType ( PageType::Area ),
- m_nDlgType ( 0 ),
- m_aXFillAttr ( rInAttrs.GetPool() ),
- m_rXFSet ( m_aXFillAttr.GetItemSet() )
+SvxShadowTabPage::SvxShadowTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
+ : SvxTabPage(pParent, "cui/ui/shadowtabpage.ui", "ShadowTabPage", rInAttrs)
+ , m_rOutAttrs(rInAttrs)
+ , m_pnColorListState(nullptr)
+ , m_nPageType(PageType::Area)
+ , m_nDlgType(0)
+ , m_aXFillAttr(rInAttrs.GetPool())
+ , m_rXFSet(m_aXFillAttr.GetItemSet())
+ , m_aCtlPosition(this)
+ , m_xTsbShowShadow(m_xBuilder->weld_check_button("TSB_SHOW_SHADOW"))
+ , m_xGridShadow(m_xBuilder->weld_widget("gridSHADOW"))
+ , m_xMtrDistance(m_xBuilder->weld_metric_spin_button("MTR_FLD_DISTANCE", FUNIT_CM))
+ , m_xLbShadowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_SHADOW_COLOR"), pParent.GetFrameWeld()))
+ , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_SHADOW_TRANSPARENT", FUNIT_PERCENT))
+ , m_xCtlPosition(new weld::CustomWeld(*m_xBuilder, "CTL_POSITION", m_aCtlPosition))
+ , m_xCtlXRectPreview(new weld::CustomWeld(*m_xBuilder, "CTL_COLOR_PREVIEW", m_aCtlXRectPreview))
{
- get(m_pTsbShowShadow,"TSB_SHOW_SHADOW");
- get(m_pGridShadow,"gridSHADOW");
- get(m_pCtlPosition,"CTL_POSITION");
- get(m_pMtrDistance,"MTR_FLD_DISTANCE");
- get(m_pLbShadowColor,"LB_SHADOW_COLOR");
- get(m_pMtrTransparent,"MTR_SHADOW_TRANSPARENT");
- get(m_pCtlXRectPreview,"CTL_COLOR_PREVIEW");
-
// this page needs ExchangeSupport
SetExchangeSupport();
@@ -80,7 +76,7 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA
break;
default: ;//prevent warning
}
- SetFieldUnit( *m_pMtrDistance, eFUnit );
+ SetFieldUnit( *m_xMtrDistance, eFUnit );
// determine PoolUnit
SfxItemPool* pPool = m_rOutAttrs.GetPool();
@@ -143,14 +139,13 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA
}
m_rXFSet.Put( XFillStyleItem( eXFS ) );
- m_pCtlXRectPreview->SetRectangleAttributes(m_aXFillAttr.GetItemSet());
- //aCtlXRectPreview.SetFillAttr( aXFillAttr );
-
- m_pTsbShowShadow->SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) );
- m_pLbShadowColor->SetSelectHdl( LINK( this, SvxShadowTabPage, SelectShadowHdl_Impl ) );
- Link<Edit&,void> aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
- m_pMtrTransparent->SetModifyHdl( aLink );
- m_pMtrDistance->SetModifyHdl( aLink );
+ m_aCtlXRectPreview.SetRectangleAttributes(m_aXFillAttr.GetItemSet());
+
+ m_xTsbShowShadow->connect_toggled(LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl));
+ m_xLbShadowColor->SetSelectHdl( LINK( this, SvxShadowTabPage, SelectShadowHdl_Impl ) );
+ Link<weld::MetricSpinButton&,void> aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
+ m_xMtrTransparent->connect_value_changed(aLink);
+ m_xMtrDistance->connect_value_changed(aLink);
}
SvxShadowTabPage::~SvxShadowTabPage()
@@ -160,13 +155,9 @@ SvxShadowTabPage::~SvxShadowTabPage()
void SvxShadowTabPage::dispose()
{
- m_pTsbShowShadow.clear();
- m_pGridShadow.clear();
- m_pCtlPosition.clear();
- m_pMtrDistance.clear();
- m_pLbShadowColor.clear();
- m_pMtrTransparent.clear();
- m_pCtlXRectPreview.clear();
+ m_xCtlXRectPreview.reset();
+ m_xLbShadowColor.reset();
+ m_xCtlPosition.reset();
SvxTabPage::dispose();
}
@@ -206,8 +197,8 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
SdrOnOffItem aItem( makeSdrShadowItem( false ));
rAttribs.Put( aItem );
- m_pCtlXRectPreview->SetRectangleAttributes( rAttribs );
- ModifyShadowHdl_Impl( *m_pMtrTransparent );
+ m_aCtlXRectPreview.SetRectangleAttributes( rAttribs );
+ ModifyShadowHdl_Impl( *m_xMtrTransparent );
}
m_nPageType = PageType::Shadow;
}
@@ -230,11 +221,11 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
const SfxPoolItem* pOld = nullptr;
- if( m_pTsbShowShadow->IsValueChangedFromSaved() )
+ if (m_xTsbShowShadow->get_state_changed_from_saved())
{
- TriState eState = m_pTsbShowShadow->GetState();
+ TriState eState = m_xTsbShowShadow->get_state();
assert(eState != TRISTATE_INDET);
- // given how m_pTsbShowShadow is set up and saved in Reset(),
+ // given how m_xTsbShowShadow is set up and saved in Reset(),
// eState == TRISTATE_INDET would imply
// !IsValueChangedFromSaved()
SdrOnOffItem aItem( makeSdrShadowItem(eState == TRISTATE_TRUE) );
@@ -250,9 +241,9 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
// a bit intricate inquiry whether there was something changed,
// as the items can't be displayed directly on controls
sal_Int32 nX = 0, nY = 0;
- sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, m_ePoolUnit );
+ sal_Int32 nXY = GetCoreValue( *m_xMtrDistance, m_ePoolUnit );
- switch( m_pCtlPosition->GetActualRP() )
+ switch (m_aCtlPosition.GetActualRP())
{
case RectPoint::LT: nX = nY = -nXY; break;
case RectPoint::MT: nY = -nXY; break;
@@ -269,7 +260,7 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
// string in the respective MetricField=="", then the comparison of the old
// and the new distance values would return a wrong result because in such a
// case the new distance values would match the default values of the MetricField !!!!
- if ( !m_pMtrDistance->IsEmptyFieldValue() ||
+ if ( !m_xMtrDistance->get_text().isEmpty() ||
m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
{
@@ -301,7 +292,7 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
// ShadowColor
{
- XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor()));
+ XColorItem aItem(makeSdrShadowColorItem(m_xLbShadowColor->GetSelectEntryColor()));
pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR );
if ( !pOld || !( *static_cast<const XColorItem*>(pOld) == aItem ) )
{
@@ -311,8 +302,8 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
}
// transparency
- sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue());
- if( m_pMtrTransparent->IsValueChangedFromSaved() )
+ sal_uInt16 nVal = static_cast<sal_uInt16>(m_xMtrTransparent->get_value(FUNIT_PERCENT));
+ if (m_xMtrTransparent->get_value_changed_from_saved())
{
SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) );
pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWTRANSPARENCE );
@@ -337,17 +328,15 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
// has a shadow been set?
if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
{
- m_pTsbShowShadow->EnableTriState( false );
-
if( rAttrs->Get( SDRATTR_SHADOW ).GetValue() )
- m_pTsbShowShadow->SetState( TRISTATE_TRUE );
+ m_xTsbShowShadow->set_state(TRISTATE_TRUE);
else
{
- m_pTsbShowShadow->SetState( TRISTATE_FALSE );
+ m_xTsbShowShadow->set_state(TRISTATE_FALSE);
}
}
else
- m_pTsbShowShadow->SetState( TRISTATE_INDET );
+ m_xTsbShowShadow->set_state(TRISTATE_INDET);
// distance (only 8 possible positions),
// so there is only one item evaluated
@@ -359,21 +348,21 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
sal_Int32 nY = rAttrs->Get( SDRATTR_SHADOWYDIST ).GetValue();
if( nX != 0 )
- SetMetricValue( *m_pMtrDistance, nX < 0 ? -nX : nX, m_ePoolUnit );
+ SetMetricValue( *m_xMtrDistance, nX < 0 ? -nX : nX, m_ePoolUnit );
else
- SetMetricValue( *m_pMtrDistance, nY < 0 ? -nY : nY, m_ePoolUnit );
+ SetMetricValue( *m_xMtrDistance, nY < 0 ? -nY : nY, m_ePoolUnit );
// setting the shadow control
- if ( nX < 0 && nY < 0 ) m_pCtlPosition->SetActualRP( RectPoint::LT );
- else if( nX == 0 && nY < 0 ) m_pCtlPosition->SetActualRP( RectPoint::MT );
- else if( nX > 0 && nY < 0 ) m_pCtlPosition->SetActualRP( RectPoint::RT );
- else if( nX < 0 && nY == 0 ) m_pCtlPosition->SetActualRP( RectPoint::LM );
+ if ( nX < 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::LT );
+ else if( nX == 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::MT );
+ else if( nX > 0 && nY < 0 ) m_aCtlPosition.SetActualRP( RectPoint::RT );
+ else if( nX < 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::LM );
// there's no center point anymore
- else if( nX == 0 && nY == 0 ) m_pCtlPosition->SetActualRP( RectPoint::RB );
- else if( nX > 0 && nY == 0 ) m_pCtlPosition->SetActualRP( RectPoint::RM );
- else if( nX < 0 && nY > 0 ) m_pCtlPosition->SetActualRP( RectPoint::LB );
- else if( nX == 0 && nY > 0 ) m_pCtlPosition->SetActualRP( RectPoint::MB );
- else if( nX > 0 && nY > 0 ) m_pCtlPosition->SetActualRP( RectPoint::RB );
+ else if( nX == 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::RB );
+ else if( nX > 0 && nY == 0 ) m_aCtlPosition.SetActualRP( RectPoint::RM );
+ else if( nX < 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::LB );
+ else if( nX == 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::MB );
+ else if( nX > 0 && nY > 0 ) m_aCtlPosition.SetActualRP( RectPoint::RB );
}
else
{
@@ -386,90 +375,88 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
sal_Int32 nX = pXDistItem->GetValue();
sal_Int32 nY = pYDistItem->GetValue();
if( nX != 0 )
- SetMetricValue( *m_pMtrDistance, nX < 0 ? -nX : nX, m_ePoolUnit );
+ SetMetricValue( *m_xMtrDistance, nX < 0 ? -nX : nX, m_ePoolUnit );
else
- SetMetricValue( *m_pMtrDistance, nY < 0 ? -nY : nY, m_ePoolUnit );
+ SetMetricValue( *m_xMtrDistance, nY < 0 ? -nY : nY, m_ePoolUnit );
}
// Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't.
// The text (which shall be displayed) of the MetricFields is set to "" and serves as an
// identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
- m_pMtrDistance->SetText( "" );
- m_pCtlPosition->SetActualRP( RectPoint::MM );
+ m_xMtrDistance->set_text( "" );
+ m_aCtlPosition.SetActualRP( RectPoint::MM );
}
if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
{
- m_pLbShadowColor->SelectEntry( rAttrs->Get( SDRATTR_SHADOWCOLOR ).GetColorValue() );
+ m_xLbShadowColor->SelectEntry( rAttrs->Get( SDRATTR_SHADOWCOLOR ).GetColorValue() );
}
else
- m_pLbShadowColor->SetNoSelection();
+ m_xLbShadowColor->SetNoSelection();
if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
{
sal_uInt16 nTransp = rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ).GetValue();
- m_pMtrTransparent->SetValue( nTransp );
+ m_xMtrTransparent->set_value(nTransp, FUNIT_PERCENT);
}
else
- m_pMtrTransparent->SetText( "" );
+ m_xMtrTransparent->set_text("");
//aCtlPosition
- m_pMtrDistance->SaveValue();
- m_pLbShadowColor->SaveValue();
- m_pTsbShowShadow->SaveValue();
+ m_xMtrDistance->save_value();
+ m_xLbShadowColor->SaveValue();
+ m_xTsbShowShadow->save_state();
// #66832# This field was not saved, but used to determine changes.
// Why? Seems to be the error.
// It IS the error.
- m_pMtrTransparent->SaveValue();
+ m_xMtrTransparent->save_value();
- ClickShadowHdl_Impl( nullptr );
- ModifyShadowHdl_Impl( *m_pMtrTransparent );
+ ClickShadowHdl_Impl(*m_xTsbShowShadow);
+ ModifyShadowHdl_Impl(*m_xMtrTransparent);
}
-VclPtr<SfxTabPage> SvxShadowTabPage::Create( TabPageParent pWindow,
+VclPtr<SfxTabPage> SvxShadowTabPage::Create( TabPageParent pParent,
const SfxItemSet* rAttrs )
{
- return VclPtr<SvxShadowTabPage>::Create( pWindow.pParent, *rAttrs );
+ return VclPtr<SvxShadowTabPage>::Create( pParent, *rAttrs );
}
-
-IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, weld::ToggleButton&, void)
{
- if( m_pTsbShowShadow->GetState() == TRISTATE_FALSE )
+ if (m_xTsbShowShadow->get_state() == TRISTATE_FALSE)
{
- m_pGridShadow->Disable();
+ m_xGridShadow->set_sensitive(false);
}
else
{
- m_pGridShadow->Enable();
+ m_xGridShadow->set_sensitive(true);
}
- m_pCtlPosition->Invalidate();
-
- ModifyShadowHdl_Impl( *m_pMtrTransparent );
+ m_aCtlPosition.Invalidate();
+ ModifyShadowHdl_Impl(*m_xMtrTransparent);
}
-IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, SvxColorListBox&, void)
+IMPL_LINK_NOARG(SvxShadowTabPage, SelectShadowHdl_Impl, ColorListBox&, void)
{
- ModifyShadowHdl_Impl(*m_pMtrTransparent);
+ ModifyShadowHdl_Impl(*m_xMtrTransparent);
}
-IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, weld::MetricSpinButton&, void)
{
- if( m_pTsbShowShadow->GetState() == TRISTATE_TRUE )
+ if (m_xTsbShowShadow->get_state() == TRISTATE_TRUE)
m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
else
m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
- m_rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) );
- sal_uInt16 nVal = static_cast<sal_uInt16>(m_pMtrTransparent->GetValue());
+ m_rXFSet.Put( XFillColorItem( OUString(), m_xLbShadowColor->GetSelectEntryColor() ) );
+ sal_uInt16 nVal = static_cast<sal_uInt16>(m_xMtrTransparent->get_value(FUNIT_PERCENT));
m_rXFSet.Put( XFillTransparenceItem( nVal ) );
// shadow removal
sal_Int32 nX = 0, nY = 0;
- sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, m_ePoolUnit );
- switch( m_pCtlPosition->GetActualRP() )
+ sal_Int32 nXY = GetCoreValue( *m_xMtrDistance, m_ePoolUnit );
+ switch( m_aCtlPosition.GetActualRP() )
{
case RectPoint::LT: nX = nY = -nXY; break;
case RectPoint::MT: nY = -nXY; break;
@@ -482,24 +469,22 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl, Edit&, void)
case RectPoint::MM: break;
}
- m_pCtlXRectPreview->SetShadowPosition(Point(nX, nY));
+ m_aCtlXRectPreview.SetShadowPosition(Point(nX, nY));
- m_pCtlXRectPreview->SetShadowAttributes(m_aXFillAttr.GetItemSet());
- //aCtlXRectPreview.SetFillAttr( aXFillAttr );
- m_pCtlXRectPreview->Invalidate();
+ m_aCtlXRectPreview.SetShadowAttributes(m_aXFillAttr.GetItemSet());
+ m_aCtlXRectPreview.Invalidate();
}
-
void SvxShadowTabPage::PointChanged( vcl::Window*, RectPoint )
{
// repaint shadow
- ModifyShadowHdl_Impl( *m_pMtrTransparent );
+ ModifyShadowHdl_Impl( *m_xMtrTransparent );
}
void SvxShadowTabPage::PointChanged( weld::DrawingArea*, RectPoint )
{
// repaint shadow
- ModifyShadowHdl_Impl( *m_pMtrTransparent );
+ ModifyShadowHdl_Impl( *m_xMtrTransparent );
}
void SvxShadowTabPage::PageCreated(const SfxAllItemSet& aSet)
diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui
index 1fba29ca3472..0cab81237044 100644
--- a/cui/uiconfig/ui/shadowtabpage.ui
+++ b/cui/uiconfig/ui/shadowtabpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
@@ -65,9 +65,10 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkSpinButton" id="MTR_SHADOW_TRANSPARENT:0%">
+ <object class="GtkSpinButton" id="MTR_SHADOW_TRANSPARENT">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustmentPercent</property>
</object>
<packing>
@@ -76,9 +77,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_DISTANCE:0cm">
+ <object class="GtkSpinButton" id="MTR_FLD_DISTANCE">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustmentDistance</property>
</object>
<packing>
@@ -87,9 +89,27 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxRectCtl" id="CTL_POSITION">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="CTL_POSITION">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -97,10 +117,14 @@
</packing>
</child>
<child>
- <object class="svxcorelo-SvxColorListBox" id="LB_SHADOW_COLOR">
+ <object class="GtkMenuButton" id="LB_SHADOW_COLOR">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
@@ -116,9 +140,10 @@
<object class="GtkLabel" id="FT_DISTANCE">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="shadowtabpage|FT_DISTANCE">_Distance:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">MTR_FLD_DISTANCE</property>
+ <property name="xalign">1</property>
</object>
</child>
</object>
@@ -136,9 +161,10 @@
<object class="GtkLabel" id="FT_TRANSPARENT">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="shadowtabpage|FT_TRANSPARENT">_Transparency:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">MTR_SHADOW_TRANSPARENT</property>
+ <property name="xalign">1</property>
</object>
</child>
</object>
@@ -156,9 +182,10 @@
<object class="GtkLabel" id="FT_SHADOW_COLOR">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">1</property>
<property name="label" translatable="yes" context="shadowtabpage|FT_SHADOW_COLOR">_Color:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">LB_SHADOW_COLOR</property>
+ <property name="xalign">1</property>
</object>
</child>
</object>
@@ -167,6 +194,9 @@
<property name="top_attach">2</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -193,14 +223,27 @@
<property name="spacing">6</property>
<property name="homogeneous">True</property>
<child>
- <object class="svxlo-SvxXShadowPreview" id="CTL_COLOR_PREVIEW">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="CTL_COLOR_PREVIEW-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="shadowtabpage|CTL_COLOR_PREVIEW-atkobject">Example</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="CTL_COLOR_PREVIEW">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="CTL_COLOR_PREVIEW-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="shadowtabpage|CTL_COLOR_PREVIEW-atkobject">Example</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -234,8 +277,8 @@
</object>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
- <widget name="MTR_SHADOW_TRANSPARENT:0%"/>
- <widget name="MTR_FLD_DISTANCE:0cm"/>
+ <widget name="MTR_SHADOW_TRANSPARENT"/>
+ <widget name="MTR_FLD_DISTANCE"/>
<widget name="LB_SHADOW_COLOR"/>
</widgets>
</object>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 808b2be3cef8..ac8078154069 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -236,9 +236,6 @@
<glade-widget-class title="SvxXConnectionPreview" name="svxlo-SvxXConnectionPreview"
generic-name="Connector Line Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
- <glade-widget-class title="Shadow Preview" name="svxlo-SvxXShadowPreview"
- generic-name="Shadow Preview Window" parent="GtkDrawingArea"
- icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Svx 3D Light Control" name="svxlo-SvxLightCtl3D"
generic-name="3D Light Control" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 467dc8af4961..0d25a336b4ef 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -153,7 +153,7 @@ private:
SVX_DLLPRIVATE void InitSettings(vcl::RenderContext& rRenderContext);
SVX_DLLPRIVATE void InitRectBitmap();
SVX_DLLPRIVATE BitmapEx& GetRectBitmap();
- SVX_DLLPRIVATE void Resize_Impl();
+ SVX_DLLPRIVATE void Resize_Impl(const Size& rSize);
RectCtl(const RectCtl&) = delete;
RectCtl& operator=(const RectCtl&) = delete;
@@ -404,6 +404,8 @@ private:
protected:
void InitSettings();
+ tools::Rectangle GetPreviewSize() const;
+
// prepare buffered paint
void LocalPrePaint(vcl::RenderContext const & rRenderContext);
@@ -495,7 +497,6 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC XRectPreview : public PreviewBase
private:
SdrObject* mpRectangleObject;
- tools::Rectangle GetPreviewSize() const;
public:
XRectPreview();
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
@@ -513,7 +514,7 @@ public:
|*
\************************************************************************/
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXShadowPreview : public PreviewBase
{
private:
Point maShadowOffset;
@@ -522,16 +523,15 @@ private:
SdrObject* mpRectangleShadow;
public:
- SvxXShadowPreview(vcl::Window *pParent);
-
+ SvxXShadowPreview();
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual ~SvxXShadowPreview() override;
- virtual void dispose() override;
void SetRectangleAttributes(const SfxItemSet& rItemSet);
void SetShadowAttributes(const SfxItemSet& rItemSet);
void SetShadowPosition(const Point& rPos);
- virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
};
#endif // INCLUDED_SVX_DLGCTRL_HXX
diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr
index e14c833fd97f..e14665466a7c 100644
--- a/solenv/sanitizers/ui/cui.suppr
+++ b/solenv/sanitizers/ui/cui.suppr
@@ -418,13 +418,7 @@ cui/uiconfig/ui/select_persona_dialog.ui://GtkButton[@id='result7'] button-no-la
cui/uiconfig/ui/select_persona_dialog.ui://GtkButton[@id='result8'] button-no-label
cui/uiconfig/ui/select_persona_dialog.ui://GtkButton[@id='result9'] button-no-label
cui/uiconfig/ui/select_persona_dialog.ui://GtkLabel[@id='progress_label'] orphan-label
-cui/uiconfig/ui/shadowtabpage.ui://GtkSpinButton[@id='MTR_SHADOW_TRANSPARENT:0%'] no-labelled-by
-cui/uiconfig/ui/shadowtabpage.ui://GtkSpinButton[@id='MTR_FLD_DISTANCE:0cm'] no-labelled-by
cui/uiconfig/ui/shadowtabpage.ui://svxlo-SvxRectCtl[@id='CTL_POSITION'] no-labelled-by
-cui/uiconfig/ui/shadowtabpage.ui://svxcorelo-SvxColorListBox[@id='LB_SHADOW_COLOR'] no-labelled-by
-cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_DISTANCE'] orphan-label
-cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_TRANSPARENT'] orphan-label
-cui/uiconfig/ui/shadowtabpage.ui://GtkLabel[@id='FT_SHADOW_COLOR'] orphan-label
cui/uiconfig/ui/signsignatureline.ui://GtkTextView[@id='edit_comment'] duplicate-mnemonic
cui/uiconfig/ui/specialcharacters.ui://GtkLabel[@id='hexulabel'] orphan-label
cui/uiconfig/ui/specialcharacters.ui://GtkDrawingArea[@id='viewchar2'] no-labelled-by
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 43432664296e..de20f8e1d05b 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -635,15 +635,17 @@ RectCtl::RectCtl(SvxTabPage* pPage, RectPoint eRpt, sal_uInt16 nBorder)
void RectCtl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
CustomWidgetController::SetDrawingArea(pDrawingArea);
- pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 25,
- pDrawingArea->get_text_height() * 5);
+ Size aSize(pDrawingArea->get_approximate_digit_width() * 25,
+ pDrawingArea->get_text_height() * 5);
+ pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
+ Resize_Impl(aSize);
}
void RectCtl::SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder)
{
nBorderWidth = Application::GetDefaultDevice()->LogicToPixel(Size(nBorder, 0), MapMode(MapUnit::Map100thMM)).Width();
eDefRP = eRpt;
- Resize_Impl();
+ Resize();
}
RectCtl::~RectCtl()
@@ -654,24 +656,22 @@ RectCtl::~RectCtl()
void RectCtl::Resize()
{
- Resize_Impl();
+ Resize_Impl(GetOutputSizePixel());
}
-void RectCtl::Resize_Impl()
+void RectCtl::Resize_Impl(const Size &rSize)
{
- Size aSize(GetOutputSizePixel());
-
aPtLT = Point( 0 + nBorderWidth, 0 + nBorderWidth );
- aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
- aPtRT = Point( aSize.Width() - nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( rSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( rSize.Width() - nBorderWidth, 0 + nBorderWidth );
- aPtLM = Point( 0 + nBorderWidth, aSize.Height() / 2 );
- aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
- aPtRM = Point( aSize.Width() - nBorderWidth, aSize.Height() / 2 );
+ aPtLM = Point( 0 + nBorderWidth, rSize.Height() / 2 );
+ aPtMM = Point( rSize.Width() / 2, rSize.Height() / 2 );
+ aPtRM = Point( rSize.Width() - nBorderWidth, rSize.Height() / 2 );
- aPtLB = Point( 0 + nBorderWidth, aSize.Height() - nBorderWidth );
- aPtMB = Point( aSize.Width() / 2, aSize.Height() - nBorderWidth );
- aPtRB = Point( aSize.Width() - nBorderWidth, aSize.Height() - nBorderWidth );
+ aPtLB = Point( 0 + nBorderWidth, rSize.Height() - nBorderWidth );
+ aPtMB = Point( rSize.Width() / 2, rSize.Height() - nBorderWidth );
+ aPtRB = Point( rSize.Width() - nBorderWidth, rSize.Height() - nBorderWidth );
Reset();
StyleUpdated();
@@ -2073,15 +2073,19 @@ void SvxXRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
LocalPostPaint(rRenderContext);
}
-SvxXShadowPreview::SvxXShadowPreview( vcl::Window* pParent )
- : SvxPreviewBase(pParent)
- , mpRectangleObject(nullptr)
+SvxXShadowPreview::SvxXShadowPreview()
+ : mpRectangleObject(nullptr)
, mpRectangleShadow(nullptr)
{
- InitSettings(true, true);
+}
+
+void SvxXShadowPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+ PreviewBase::SetDrawingArea(pDrawingArea);
+ InitSettings();
// prepare size
- Size aSize = GetOutputSize();
+ Size aSize = GetPreviewSize().GetSize();
aSize.setWidth( aSize.Width() / 3 );
aSize.setHeight( aSize.Height() / 3 );
@@ -2098,18 +2102,10 @@ SvxXShadowPreview::SvxXShadowPreview( vcl::Window* pParent )
aShadowSize);
}
-VCL_BUILDER_FACTORY(SvxXShadowPreview)
-
SvxXShadowPreview::~SvxXShadowPreview()
{
- disposeOnce();
-}
-
-void SvxXShadowPreview::dispose()
-{
SdrObject::Free(mpRectangleObject);
SdrObject::Free(mpRectangleShadow);
- SvxPreviewBase::dispose();
}
void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
@@ -2131,6 +2127,9 @@ void SvxXShadowPreview::SetShadowPosition(const Point& rPos)
void SvxXShadowPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
+ rRenderContext.Push(PushFlags::MAPMODE);
+ rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM));
+
LocalPrePaint(rRenderContext);
// prepare size
@@ -2154,6 +2153,8 @@ void SvxXShadowPreview::Paint(vcl::RenderContext& rRenderContext, const tools::R
aPainter.ProcessDisplay(aDisplayInfo);
LocalPostPaint(rRenderContext);
+
+ rRenderContext.Pop();
}
void PreviewBase::InitSettings()
@@ -2247,10 +2248,7 @@ XRectPreview::XRectPreview()
{
}
-// expand to avoid 1 pixel band to the right and bottom of previews
-// in color/gradient/bitmap/pattern/hatch subpages of area tab
-// in e.g. page dialog
-tools::Rectangle XRectPreview::GetPreviewSize() const
+tools::Rectangle PreviewBase::GetPreviewSize() const
{
tools::Rectangle aObjectSize(Point(), getBufferDevice().PixelToLogic(GetOutputSizePixel()));
return aObjectSize;