chart2/source/controller/main/ShapeController.cxx | 4 cui/source/factory/dlgfact.cxx | 28 ++- cui/source/factory/dlgfact.hxx | 31 ++- cui/source/inc/cuitabarea.hxx | 38 ++-- cui/source/tabpages/tabarea.cxx | 65 +++---- cui/source/tabpages/tpshadow.cxx | 192 ++++++++++------------ cui/uiconfig/ui/areadialog.ui | 107 ++++++++++-- cui/uiconfig/ui/shadowtabpage.ui | 85 +++++++-- cui/uiconfig/ui/transparencytabpage.ui | 2 extras/source/glade/libreoffice-catalog.xml.in | 3 include/svx/dlgctrl.hxx | 14 - include/svx/svxdlg.hxx | 8 reportdesign/source/ui/misc/UITools.cxx | 4 sc/source/ui/drawfunc/drawsh.cxx | 3 sd/source/ui/func/fuarea.cxx | 4 solenv/sanitizers/ui/cui.suppr | 6 svx/source/dialog/dlgctrl.cxx | 62 +++---- sw/source/uibase/shells/drawdlg.cxx | 2 18 files changed, 383 insertions(+), 275 deletions(-)
New commits: commit 9ae23dfae84fa6d1e8fd6bfb4fe16ff1d47a1e97 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Sep 9 17:17:44 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Sep 9 22:27:55 2018 +0200 weld SvxAreaTabDialog Change-Id: Ia6ec954c6d0117fddc17432301ddeda3b26bbc8e Reviewed-on: https://gerrit.libreoffice.org/60222 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index 875ba6bcf947..f6e7c0db1106 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -292,7 +292,7 @@ void ShapeController::executeDispatch_FormatArea() } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr< AbstractSvxAreaTabDialog > pDlg( - pFact->CreateSvxAreaTabDialog( pChartWindow, &aAttr, &pDrawModelWrapper->getSdrModel(), true ) ); + pFact->CreateSvxAreaTabDialog(pChartWindow->GetFrameWeld(), &aAttr, &pDrawModelWrapper->getSdrModel(), true)); if ( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); @@ -326,7 +326,7 @@ void ShapeController::executeDispatch_TextAttributes() } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr< SfxAbstractTabDialog > pDlg( - pFact->CreateTextTabDialog( pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, &aAttr, pDrawViewWrapper ) ); + pFact->CreateTextTabDialog(pChartWindow->GetFrameWeld(), &aAttr, pDrawViewWrapper)); if ( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 973a5ed3b26c..acd14fa0dd6d 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -180,7 +180,16 @@ short AbstractSvxPathSelectDialog_Impl::Execute() IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl); IMPL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl); IMPL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl); + +short AbstractSvxAreaTabDialog_Impl::Execute() +{ + return m_xDlg->execute(); +} + +bool AbstractSvxAreaTabDialog_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} short AbstractPasteDialog_Impl::Execute() { @@ -798,27 +807,27 @@ Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic( const Graphic& rGr // AbstractSvxAreaTabDialog implementations just forwards everything to the dialog void AbstractSvxAreaTabDialog_Impl::SetCurPageId( const OString& rName ) { - pDlg->SetCurPageId( rName ); + m_xDlg->SetCurPageId( rName ); } const SfxItemSet* AbstractSvxAreaTabDialog_Impl::GetOutputItemSet() const { - return pDlg->GetOutputItemSet(); + return m_xDlg->GetOutputItemSet(); } const sal_uInt16* AbstractSvxAreaTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) { - return pDlg->GetInputRanges( pItem ); + return m_xDlg->GetInputRanges( pItem ); } void AbstractSvxAreaTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) { - pDlg->SetInputSet( pInSet ); + m_xDlg->SetInputSet( pInSet ); } -//From class Window. + void AbstractSvxAreaTabDialog_Impl::SetText( const OUString& rStr ) { - pDlg->SetText( rStr ); + m_xDlg->set_title(rStr); } void AbstractSvxPostItDialog_Impl::SetText( const OUString& rStr ) @@ -1293,13 +1302,12 @@ VclPtr<AbstractGraphicFilterDialog> AbstractDialogFactory_Impl::CreateGraphicFil return VclPtr<AbstractGraphicFilterDialog_Impl>::Create( pDlg ); } -VclPtr<AbstractSvxAreaTabDialog> AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( vcl::Window* pParent, +VclPtr<AbstractSvxAreaTabDialog> AbstractDialogFactory_Impl::CreateSvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow) { - VclPtrInstance<SvxAreaTabDialog> pDlg( pParent, pAttr, pModel, bShadow ); - return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create( pDlg ); + return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(o3tl::make_unique<SvxAreaTabDialog>(pParent, pAttr, pModel, bShadow)); } VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index bfe749ba4142..c7595fdf0566 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -468,15 +468,22 @@ class AbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog }; class SvxAreaTabDialog; -class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog +class AbstractSvxAreaTabDialog_Impl : public AbstractSvxAreaTabDialog { - DECL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl,SvxAreaTabDialog) - virtual void SetCurPageId( const OString& rName ) override; - virtual const SfxItemSet* GetOutputItemSet() const override; - virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override; - virtual void SetInputSet( const SfxItemSet* pInSet ) override; - // From class Window. - virtual void SetText( const OUString& rStr ) override; +protected: + std::shared_ptr<SvxAreaTabDialog> m_xDlg; +public: + explicit AbstractSvxAreaTabDialog_Impl(std::unique_ptr<SvxAreaTabDialog> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; + virtual void SetCurPageId(const OString& rName) override; + virtual const SfxItemSet* GetOutputItemSet() const override; + virtual const sal_uInt16* GetInputRanges(const SfxItemPool& pItem) override; + virtual void SetInputSet(const SfxItemSet* pInSet) override; + virtual void SetText(const OUString& rStr) override; }; class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog @@ -737,10 +744,10 @@ public: const Graphic& rGraphic) override; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterMosaic (vcl::Window* pParent, const Graphic& rGraphic) override; - virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog( vcl::Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - bool bShadow ) override; + virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog(weld::Window* pParent, + const SfxItemSet* pAttr, + SdrModel* pModel, + bool bShadow) override; virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj, diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 64fbb0316230..4681de332251 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -95,12 +95,8 @@ enum class PageType Transparence, }; -class SvxAreaTabDialog final : public SfxTabDialog +class SvxAreaTabDialog final : public SfxTabDialogController { - sal_uInt16 m_nAreaTabPage; - sal_uInt16 m_nShadowTabPage; - sal_uInt16 m_nTransparenceTabPage; - SdrModel* mpDrawModel; XColorListRef mpColorList; @@ -120,14 +116,14 @@ class SvxAreaTabDialog final : public SfxTabDialog ChangeType mnGradientListState; ChangeType mnHatchingListState; - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; virtual short Ok() override; - DECL_LINK( CancelHdlImpl, Button*, void ); + DECL_LINK(CancelHdlImpl, weld::Button&, void); void SavePalettes(); public: - SvxAreaTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow ); + SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow); void SetNewColorList( XColorListRef const & pColorList ) { mpNewColorList = pColorList; } diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index 6d6bbb8ded65..ea4dac6518c6 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -34,18 +34,12 @@ SvxAreaTabDialog::SvxAreaTabDialog ( - vcl::Window* pParent, + weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow ) - : SfxTabDialog( pParent, - "AreaDialog", - "cui/ui/areadialog.ui", - pAttr ) - , m_nAreaTabPage(0) - , m_nShadowTabPage(0) - , m_nTransparenceTabPage(0) + : SfxTabDialogController(pParent, "cui/ui/areadialog.ui", "AreaDialog", pAttr) , mpDrawModel ( pModel ), mpColorList ( pModel->GetColorList() ), mpNewColorList ( pModel->GetColorList() ), @@ -64,21 +58,21 @@ SvxAreaTabDialog::SvxAreaTabDialog mnGradientListState ( ChangeType::NONE ), mnHatchingListState ( ChangeType::NONE ) { - m_nAreaTabPage = AddTabPage( "RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr ); + AddTabPage("RID_SVXPAGE_AREA", SvxAreaTabPage::Create, nullptr); - if(bShadow) + if (bShadow) { - m_nShadowTabPage = AddTabPage( "RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, nullptr ); + AddTabPage("RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, nullptr); } else { RemoveTabPage( "RID_SVXPAGE_SHADOW" ); } - m_nTransparenceTabPage = AddTabPage( "RID_SVXPAGE_TRANSPARENCE", SvxTransparenceTabPage::Create, nullptr); + AddTabPage( "RID_SVXPAGE_TRANSPARENCE", SvxTransparenceTabPage::Create, nullptr); - CancelButton& rBtnCancel = GetCancelButton(); - rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) ); + weld::Button& rBtnCancel = GetCancelButton(); + rBtnCancel.connect_clicked(LINK(this, SvxAreaTabDialog, CancelHdlImpl)); } void SvxAreaTabDialog::SavePalettes() @@ -221,40 +215,39 @@ short SvxAreaTabDialog::Ok() // RET_OK is returned, if at least one // TabPage returns sal_True in FillItemSet(). // This happens by default at the moment. - return SfxTabDialog::Ok(); + return SfxTabDialogController::Ok(); } - -IMPL_LINK_NOARG(SvxAreaTabDialog, CancelHdlImpl, Button*, void) +IMPL_LINK_NOARG(SvxAreaTabDialog, CancelHdlImpl, weld::Button&, void) { SavePalettes(); - EndDialog(); + m_xDialog->response(RET_CANCEL); } -void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +void SvxAreaTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage) { - if (nId == m_nAreaTabPage ) + if (rId == "RID_SVXPAGE_AREA") { - static_cast<SvxAreaTabPage&>(rPage).SetColorList( mpColorList ); - static_cast<SvxAreaTabPage&>(rPage).SetGradientList( mpGradientList ); - static_cast<SvxAreaTabPage&>(rPage).SetHatchingList( mpHatchingList ); - static_cast<SvxAreaTabPage&>(rPage).SetBitmapList( mpBitmapList ); - static_cast<SvxAreaTabPage&>(rPage).SetPatternList( mpPatternList ); - static_cast<SvxAreaTabPage&>(rPage).SetGrdChgd( &mnGradientListState ); - static_cast<SvxAreaTabPage&>(rPage).SetHtchChgd( &mnHatchingListState ); - static_cast<SvxAreaTabPage&>(rPage).SetBmpChgd( &mnBitmapListState ); - static_cast<SvxAreaTabPage&>(rPage).SetPtrnChgd( &mnPatternListState ); - static_cast<SvxAreaTabPage&>(rPage).SetColorChgd( &mnColorListState ); + static_cast<SvxAreaTabPage&>(rPage).SetColorList( mpColorList ); + static_cast<SvxAreaTabPage&>(rPage).SetGradientList( mpGradientList ); + static_cast<SvxAreaTabPage&>(rPage).SetHatchingList( mpHatchingList ); + static_cast<SvxAreaTabPage&>(rPage).SetBitmapList( mpBitmapList ); + static_cast<SvxAreaTabPage&>(rPage).SetPatternList( mpPatternList ); + static_cast<SvxAreaTabPage&>(rPage).SetGrdChgd( &mnGradientListState ); + static_cast<SvxAreaTabPage&>(rPage).SetHtchChgd( &mnHatchingListState ); + static_cast<SvxAreaTabPage&>(rPage).SetBmpChgd( &mnBitmapListState ); + static_cast<SvxAreaTabPage&>(rPage).SetPtrnChgd( &mnPatternListState ); + static_cast<SvxAreaTabPage&>(rPage).SetColorChgd( &mnColorListState ); } - else if (nId == m_nShadowTabPage) + else if (rId == "RID_SVXPAGE_SHADOW") { - static_cast<SvxShadowTabPage&>(rPage).SetColorList( mpColorList ); - static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorListState ); + static_cast<SvxShadowTabPage&>(rPage).SetColorList( mpColorList ); + static_cast<SvxShadowTabPage&>(rPage).SetColorChgd( &mnColorListState ); } - else if (nId == m_nTransparenceTabPage) + else if (rId == "RID_SVXPAGE_TRANSPARENCE") { - static_cast<SvxTransparenceTabPage&>(rPage).SetPageType( PageType::Area ); - static_cast<SvxTransparenceTabPage&>(rPage).SetDlgType( 0 ); + static_cast<SvxTransparenceTabPage&>(rPage).SetPageType( PageType::Area ); + static_cast<SvxTransparenceTabPage&>(rPage).SetDlgType( 0 ); } } diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index 3b2ac0b04b64..ee81f915c2a8 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -416,7 +416,6 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs ) ModifyShadowHdl_Impl(*m_xMtrTransparent); } - VclPtr<SfxTabPage> SvxShadowTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrs ) { @@ -428,10 +427,12 @@ IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl, weld::ToggleButton&, void if (m_xTsbShowShadow->get_state() == TRISTATE_FALSE) { m_xGridShadow->set_sensitive(false); + m_xCtlPosition->set_sensitive(false); } else { m_xGridShadow->set_sensitive(true); + m_xCtlPosition->set_sensitive(true); } m_aCtlPosition.Invalidate(); ModifyShadowHdl_Impl(*m_xMtrTransparent); diff --git a/cui/uiconfig/ui/areadialog.ui b/cui/uiconfig/ui/areadialog.ui index a65b644e8efb..e768dd40ed62 100644 --- a/cui/uiconfig/ui/areadialog.ui +++ b/cui/uiconfig/ui/areadialog.ui @@ -1,13 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="AreaDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="areadialog|AreaDialog">Area</property> - <property name="resizable">False</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -18,12 +23,10 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -34,10 +37,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -48,8 +53,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -59,12 +64,11 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label">gtk-revert-to-saved</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -74,6 +78,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -87,7 +92,7 @@ <child> <object class="GtkNotebook" id="tabcontrol"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <child> @@ -97,6 +102,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -116,6 +145,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -139,6 +192,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">2</property> @@ -165,10 +242,10 @@ </object> </child> <action-widgets> + <action-widget response="0">reset</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="0">reset</action-widget> </action-widgets> </object> </interface> diff --git a/cui/uiconfig/ui/shadowtabpage.ui b/cui/uiconfig/ui/shadowtabpage.ui index 0cab81237044..1be868085bd6 100644 --- a/cui/uiconfig/ui/shadowtabpage.ui +++ b/cui/uiconfig/ui/shadowtabpage.ui @@ -2,7 +2,6 @@ <!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustmentDistance"> <property name="upper">999</property> <property name="step_increment">1</property> @@ -16,6 +15,9 @@ <object class="GtkFrame" id="ShadowTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> diff --git a/cui/uiconfig/ui/transparencytabpage.ui b/cui/uiconfig/ui/transparencytabpage.ui index 4961059ec762..491b2f9ac965 100644 --- a/cui/uiconfig/ui/transparencytabpage.ui +++ b/cui/uiconfig/ui/transparencytabpage.ui @@ -40,7 +40,9 @@ <object class="GtkFrame" id="TransparencyTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="valign">start</property> <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="border_width">6</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index c41d83e7a696..a5f62832db28 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -426,10 +426,10 @@ public: const Graphic& rGraphic)=0; virtual VclPtr<AbstractGraphicFilterDialog> CreateGraphicFilterMosaic (vcl::Window* pParent, const Graphic& rGraphic)=0; - virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog( vcl::Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - bool bShadow) = 0 ; + virtual VclPtr<AbstractSvxAreaTabDialog> CreateSvxAreaTabDialog(weld::Window* pParent, + const SfxItemSet* pAttr, + SdrModel* pModel, + bool bShadow) = 0 ; virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog SdrModel* pModel, const SdrObject* pObj, diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index f2ac0ebaf328..ee453e217c60 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -743,7 +743,7 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R std::shared_ptr<rptui::OReportModel> pModel = ::reportdesign::OReportDefinition::getSdrModel(_xShape->getSection()->getReportDefinition()); - VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( _rxParentWindow ); + weld::Window* pParent = Application::GetFrameWeld(_rxParentWindow); bool bSuccess = false; try @@ -754,7 +754,7 @@ bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::R { // want the dialog to be destroyed before our set SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog( pParent,pDescriptor.get(),pModel.get(), true )); + ScopedVclPtr<AbstractSvxAreaTabDialog> pDialog(pFact->CreateSvxAreaTabDialog(pParent, pDescriptor.get(), pModel.get(), true)); if ( RET_OK == pDialog->Execute() ) { bSuccess = true; diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 5a301f2efe7c..4e0a84375818 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -415,8 +415,9 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq ) pView->MergeAttrFromMarked( aNewAttr, false ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + vcl::Window* pWin = pViewData->GetDialogParent(); ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( - pViewData->GetDialogParent(), &aNewAttr, + pWin ? pWin->GetFrameWeld() : nullptr, &aNewAttr, pViewData->GetDocument()->GetDrawLayer(), true)); if ( pDlg->Execute() == RET_OK ) diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx index cb62202ea650..85eaef244991 100644 --- a/sd/source/ui/func/fuarea.cxx +++ b/sd/source/ui/func/fuarea.cxx @@ -61,7 +61,7 @@ void FuArea::DoExecute( SfxRequest& rReq ) mpView->GetAttributes( aNewAttr ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - VclPtr<AbstractSvxAreaTabDialog> pDlg( pFact->CreateSvxAreaTabDialog(mpViewShell->GetActiveWindow(), &aNewAttr, mpDoc, true) ); + VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(mpViewShell->GetFrameWeld(), &aNewAttr, mpDoc, true)); pDlg->StartExecuteAsync([=](sal_Int32 nResult){ if (nResult == RET_OK) @@ -84,6 +84,8 @@ void FuArea::DoExecute( SfxRequest& rReq ) // deferred until the dialog ends mpViewShell->Cancel(); + + pDlg->disposeOnce(); }); } diff --git a/sw/source/uibase/shells/drawdlg.cxx b/sw/source/uibase/shells/drawdlg.cxx index dc36accdc4b6..132568fc874e 100644 --- a/sw/source/uibase/shells/drawdlg.cxx +++ b/sw/source/uibase/shells/drawdlg.cxx @@ -92,7 +92,7 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) bool bHasMarked = pView->AreObjectsMarked(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( nullptr, + ScopedVclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(rReq.GetFrameWeld(), &aNewAttr, pDoc, true)); commit c8610e24baaa0788f74acadcf6db1a00856f0d3a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Sep 9 16:18:24 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Sep 9 22:27:44 2018 +0200 weld SvxShadowTabPage Change-Id: I5447641216c8cba3d275d76c00bf7306df8acf19 Reviewed-on: https://gerrit.libreoffice.org/60221 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits