diff options
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 62 | ||||
-rw-r--r-- | cui/source/tabpages/tplnedef.cxx | 506 | ||||
-rw-r--r-- | cui/uiconfig/ui/lineendstabpage.ui | 8 | ||||
-rw-r--r-- | cui/uiconfig/ui/linestyletabpage.ui | 139 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 29 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 5 | ||||
-rw-r--r-- | solenv/sanitizers/ui/cui.suppr | 4 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 99 |
8 files changed, 466 insertions, 386 deletions
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index c7e2431830e6..13e15ff5d388 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -242,22 +242,6 @@ class SvxLineDefTabPage : public SfxTabPage using TabPage::ActivatePage; using TabPage::DeactivatePage; private: - VclPtr<LineLB> m_pLbLineStyles; - VclPtr<ListBox> m_pLbType1; - VclPtr<ListBox> m_pLbType2; - VclPtr<NumericField> m_pNumFldNumber1; - VclPtr<NumericField> m_pNumFldNumber2; - VclPtr<MetricField> m_pMtrLength1; - VclPtr<MetricField> m_pMtrLength2; - VclPtr<MetricField> m_pMtrDistance; - VclPtr<CheckBox> m_pCbxSynchronize; - VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnModify; - VclPtr<PushButton> m_pBtnDelete; - VclPtr<PushButton> m_pBtnLoad; - VclPtr<PushButton> m_pBtnSave; - VclPtr<SvxXLinePreview> m_pCtlPreview; - const SfxItemSet& rOutAttrs; XDash aDash; @@ -274,27 +258,45 @@ private: MapUnit ePoolUnit; FieldUnit eFUnit; + XLinePreview m_aCtlPreview; + std::unique_ptr<SvxLineLB> m_xLbLineStyles; + std::unique_ptr<weld::ComboBox> m_xLbType1; + std::unique_ptr<weld::ComboBox> m_xLbType2; + std::unique_ptr<weld::SpinButton> m_xNumFldNumber1; + std::unique_ptr<weld::SpinButton> m_xNumFldNumber2; + std::unique_ptr<weld::MetricSpinButton> m_xMtrLength1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrLength2; + std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance; + std::unique_ptr<weld::CheckButton> m_xCbxSynchronize; + std::unique_ptr<weld::Button> m_xBtnAdd; + std::unique_ptr<weld::Button> m_xBtnModify; + std::unique_ptr<weld::Button> m_xBtnDelete; + std::unique_ptr<weld::Button> m_xBtnLoad; + std::unique_ptr<weld::Button> m_xBtnSave; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + void FillDash_Impl(); void FillDialog_Impl(); - DECL_LINK( ClickAddHdl_Impl, Button*, void ); - DECL_LINK( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK( ClickDeleteHdl_Impl, Button*, void ); - DECL_LINK( SelectLinestyleListBoxHdl_Impl, ListBox&, void ); - void SelectLinestyleHdl_Impl(ListBox const *); - DECL_LINK( ChangePreviewHdl_Impl, Edit&, void ); - DECL_LINK( ChangeNumber1Hdl_Impl, Edit&, void ); - DECL_LINK( ChangeNumber2Hdl_Impl, Edit&, void ); - DECL_LINK( ClickLoadHdl_Impl, Button*, void ); - DECL_LINK( ClickSaveHdl_Impl, Button*, void ); - DECL_LINK( ChangeMetricHdl_Impl, Button*, void ); - DECL_LINK( SelectTypeListBoxHdl_Impl, ListBox&, void ); - void SelectTypeHdl_Impl(ListBox*); + DECL_LINK(ClickAddHdl_Impl, weld::Button&, void); + DECL_LINK(ClickModifyHdl_Impl, weld::Button&, void); + DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void); + DECL_LINK(SelectLinestyleListBoxHdl_Impl, weld::ComboBox&, void); + void SelectLinestyleHdl_Impl(const weld::ComboBox*); + DECL_LINK(ChangePreviewHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ChangeNumber1Hdl_Impl, weld::SpinButton&, void); + DECL_LINK(ChangeNumber2Hdl_Impl, weld::SpinButton&, void); + DECL_LINK(ClickLoadHdl_Impl, weld::Button&, void); + DECL_LINK(ClickSaveHdl_Impl, weld::Button&, void); + DECL_LINK(ChangeMetricHdl_Impl, weld::ToggleButton&, void); + DECL_LINK(SelectTypeListBoxHdl_Impl, weld::ComboBox&, void); + void SelectTypeHdl_Impl(weld::ComboBox*); + void ChangeMetricHdl_Impl(weld::ToggleButton*); void CheckChanges_Impl(); public: - SvxLineDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); + SvxLineDefTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs); virtual ~SvxLineDefTabPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 16e76024714a..bdc61de0d594 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -50,45 +50,31 @@ using namespace com::sun::star; -SvxLineDefTabPage::SvxLineDefTabPage -( - vcl::Window* pParent, - const SfxItemSet& rInAttrs -) : - - SfxTabPage( pParent - , "LineStylePage" - , "cui/ui/linestyletabpage.ui" - , &rInAttrs ), - rOutAttrs ( rInAttrs ), - - aXLineAttr ( rInAttrs.GetPool() ), - rXLSet ( aXLineAttr.GetItemSet() ), - pnDashListState(nullptr), - pPageType(nullptr), - nDlgType(0), - pPosDashLb(nullptr) +SvxLineDefTabPage::SvxLineDefTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) + : SfxTabPage(pParent, "cui/ui/linestyletabpage.ui", "LineStylePage", &rInAttrs) + , rOutAttrs(rInAttrs) + , aXLineAttr(rInAttrs.GetPool()) + , rXLSet(aXLineAttr.GetItemSet()) + , pnDashListState(nullptr) + , pPageType(nullptr) + , nDlgType(0) + , pPosDashLb(nullptr) + , m_xLbLineStyles(new SvxLineLB(m_xBuilder->weld_combo_box("LB_LINESTYLES"))) + , m_xLbType1(m_xBuilder->weld_combo_box("LB_TYPE_1")) + , m_xLbType2(m_xBuilder->weld_combo_box("LB_TYPE_2")) + , m_xNumFldNumber1(m_xBuilder->weld_spin_button("NUM_FLD_1")) + , m_xNumFldNumber2(m_xBuilder->weld_spin_button("NUM_FLD_2")) + , m_xMtrLength1(m_xBuilder->weld_metric_spin_button("MTR_FLD_LENGTH_1", FUNIT_CM)) + , m_xMtrLength2(m_xBuilder->weld_metric_spin_button("MTR_FLD_LENGTH_2", FUNIT_CM)) + , m_xMtrDistance(m_xBuilder->weld_metric_spin_button("MTR_FLD_DISTANCE", FUNIT_CM)) + , m_xCbxSynchronize(m_xBuilder->weld_check_button("CBX_SYNCHRONIZE")) + , m_xBtnAdd(m_xBuilder->weld_button("BTN_ADD")) + , m_xBtnModify(m_xBuilder->weld_button("BTN_MODIFY")) + , m_xBtnDelete(m_xBuilder->weld_button("BTN_DELETE")) + , m_xBtnLoad(m_xBuilder->weld_button("BTN_LOAD")) + , m_xBtnSave(m_xBuilder->weld_button("BTN_SAVE")) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) { - - get(m_pLbLineStyles ,"LB_LINESTYLES"); - get(m_pLbType1 ,"LB_TYPE_1"); - get(m_pLbType2 ,"LB_TYPE_2"); - get(m_pNumFldNumber1 ,"NUM_FLD_1"); - get(m_pNumFldNumber2 ,"NUM_FLD_2"); - get(m_pMtrLength1 ,"MTR_FLD_LENGTH_1"); - m_pMtrLength1->SetCustomUnitText("%"); - get(m_pMtrLength2 ,"MTR_FLD_LENGTH_2"); - m_pMtrLength2->SetCustomUnitText("%"); - get(m_pMtrDistance ,"MTR_FLD_DISTANCE"); - m_pMtrDistance->SetCustomUnitText("%"); - get(m_pCbxSynchronize ,"CBX_SYNCHRONIZE"); - get(m_pBtnAdd ,"BTN_ADD"); - get(m_pBtnModify ,"BTN_MODIFY"); - get(m_pBtnDelete ,"BTN_DELETE"); - get(m_pBtnLoad ,"BTN_LOAD"); - get(m_pBtnSave ,"BTN_SAVE"); - get(m_pCtlPreview ,"CTL_PREVIEW"); - // this page needs ExchangeSupport SetExchangeSupport(); @@ -103,9 +89,9 @@ SvxLineDefTabPage::SvxLineDefTabPage break; default: ; //prevent warning } - SetFieldUnit( *m_pMtrDistance, eFUnit ); - SetFieldUnit( *m_pMtrLength1, eFUnit ); - SetFieldUnit( *m_pMtrLength2, eFUnit ); + SetFieldUnit(*m_xMtrDistance, eFUnit); + SetFieldUnit(*m_xMtrLength1, eFUnit); + SetFieldUnit(*m_xMtrLength2, eFUnit); // determine PoolUnit SfxItemPool* pPool = rOutAttrs.GetPool(); @@ -118,33 +104,33 @@ SvxLineDefTabPage::SvxLineDefTabPage rXLSet.Put( XLineColorItem(OUString(), COL_BLACK) ); // #i34740# - m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - m_pBtnAdd->SetClickHdl( LINK( this, SvxLineDefTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( LINK( this, SvxLineDefTabPage, ClickModifyHdl_Impl ) ); - m_pBtnDelete->SetClickHdl( LINK( this, SvxLineDefTabPage, ClickDeleteHdl_Impl ) ); - m_pBtnLoad->SetClickHdl( LINK( this, SvxLineDefTabPage, ClickLoadHdl_Impl ) ); - m_pBtnSave->SetClickHdl( LINK( this, SvxLineDefTabPage, ClickSaveHdl_Impl ) ); + m_xBtnAdd->connect_clicked(LINK(this, SvxLineDefTabPage, ClickAddHdl_Impl)); + m_xBtnModify->connect_clicked(LINK(this, SvxLineDefTabPage, ClickModifyHdl_Impl)); + m_xBtnDelete->connect_clicked(LINK(this, SvxLineDefTabPage, ClickDeleteHdl_Impl)); + m_xBtnLoad->connect_clicked(LINK(this, SvxLineDefTabPage, ClickLoadHdl_Impl)); + m_xBtnSave->connect_clicked(LINK(this, SvxLineDefTabPage, ClickSaveHdl_Impl)); - m_pNumFldNumber1->SetModifyHdl( LINK( this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl ) ); - m_pNumFldNumber2->SetModifyHdl( LINK( this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl ) ); - m_pLbLineStyles->SetSelectHdl( LINK( this, SvxLineDefTabPage, SelectLinestyleListBoxHdl_Impl ) ); + m_xNumFldNumber1->connect_value_changed(LINK(this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl)); + m_xNumFldNumber2->connect_value_changed(LINK(this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl)); + m_xLbLineStyles->connect_changed(LINK(this, SvxLineDefTabPage, SelectLinestyleListBoxHdl_Impl)); // #i122042# switch off default adding of 'none' and 'solid' entries // for this ListBox; we want to select only editable/dashed styles - m_pLbLineStyles->setAddStandardFields(false); + m_xLbLineStyles->setAddStandardFields(false); // absolute (in mm) or relative (in %) - m_pCbxSynchronize->SetClickHdl( LINK( this, SvxLineDefTabPage, ChangeMetricHdl_Impl ) ); + m_xCbxSynchronize->connect_toggled(LINK(this, SvxLineDefTabPage, ChangeMetricHdl_Impl)); // preview must be updated when there's something changed - Link<ListBox&, void> aLink = LINK( this, SvxLineDefTabPage, SelectTypeListBoxHdl_Impl ); - m_pLbType1->SetSelectHdl( aLink ); - m_pLbType2->SetSelectHdl( aLink ); - Link<Edit&,void> aLink2 = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl ); - m_pMtrLength1->SetModifyHdl( aLink2 ); - m_pMtrLength2->SetModifyHdl( aLink2 ); - m_pMtrDistance->SetModifyHdl( aLink2 ); + Link<weld::ComboBox&, void> aLink = LINK(this, SvxLineDefTabPage, SelectTypeListBoxHdl_Impl); + m_xLbType1->connect_changed(aLink); + m_xLbType2->connect_changed(aLink); + Link<weld::MetricSpinButton&,void> aLink2 = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl ); + m_xMtrLength1->connect_value_changed(aLink2); + m_xMtrLength2->connect_value_changed(aLink2); + m_xMtrDistance->connect_value_changed(aLink2); pDashList = nullptr; } @@ -156,31 +142,17 @@ SvxLineDefTabPage::~SvxLineDefTabPage() void SvxLineDefTabPage::dispose() { - m_pLbLineStyles.clear(); - m_pLbType1.clear(); - m_pLbType2.clear(); - m_pNumFldNumber1.clear(); - m_pNumFldNumber2.clear(); - m_pMtrLength1.clear(); - m_pMtrLength2.clear(); - m_pMtrDistance.clear(); - m_pCbxSynchronize.clear(); - m_pBtnAdd.clear(); - m_pBtnModify.clear(); - m_pBtnDelete.clear(); - m_pBtnLoad.clear(); - m_pBtnSave.clear(); - m_pCtlPreview.clear(); + m_xCtlPreview.reset(); + m_xLbLineStyles.reset(); SfxTabPage::dispose(); } void SvxLineDefTabPage::Construct() { // Line style fill; do *not* add default fields here - m_pLbLineStyles->Fill( pDashList ); + m_xLbLineStyles->Fill( pDashList ); } - void SvxLineDefTabPage::ActivatePage( const SfxItemSet& ) { if( nDlgType == 0 ) // area dialog @@ -188,10 +160,10 @@ void SvxLineDefTabPage::ActivatePage( const SfxItemSet& ) // ActivatePage() is called before the dialog receives PageCreated() !!! if( pDashList.is() ) { - if( *pPageType == PageType::Gradient && - *pPosDashLb != LISTBOX_ENTRY_NOTFOUND ) + if (*pPageType == PageType::Gradient && + *pPosDashLb != -1) { - m_pLbLineStyles->SelectEntryPos( *pPosDashLb ); + m_xLbLineStyles->set_active(*pPosDashLb); } // so that a possibly existing line style is discarded SelectLinestyleHdl_Impl( nullptr ); @@ -222,21 +194,20 @@ DeactivateRC SvxLineDefTabPage::DeactivatePage( SfxItemSet* _pSet ) return DeactivateRC::LeavePage; } - void SvxLineDefTabPage::CheckChanges_Impl() { // is here used to NOT lose changes //css::drawing::DashStyle eXDS; - if( m_pNumFldNumber1->IsValueChangedFromSaved() || - m_pMtrLength1->IsValueChangedFromSaved() || - m_pLbType1->IsValueChangedFromSaved() || - m_pNumFldNumber2->IsValueChangedFromSaved() || - m_pMtrLength2->IsValueChangedFromSaved() || - m_pLbType2->IsValueChangedFromSaved() || - m_pMtrDistance->IsValueChangedFromSaved() ) + if( m_xNumFldNumber1->get_value_changed_from_saved() || + m_xMtrLength1->get_value_changed_from_saved() || + m_xLbType1->get_value_changed_from_saved() || + m_xNumFldNumber2->get_value_changed_from_saved() || + m_xMtrLength2->get_value_changed_from_saved() || + m_xLbType2->get_value_changed_from_saved() || + m_xMtrDistance->get_value_changed_from_saved() ) { - std::unique_ptr<weld::MessageDialog> xMessDlg(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xMessDlg(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Warning, VclButtonsType::Cancel, CuiResId(RID_SVXSTR_ASK_CHANGE_LINESTYLE))); xMessDlg->set_title(SvxResId(RID_SVXSTR_LINESTYLE)); @@ -249,13 +220,13 @@ void SvxLineDefTabPage::CheckChanges_Impl() { case RET_BTN_1: { - ClickModifyHdl_Impl( nullptr ); + ClickModifyHdl_Impl(*m_xBtnModify); } break; case RET_BTN_2: { - ClickAddHdl_Impl( nullptr ); + ClickAddHdl_Impl(*m_xBtnAdd); } break; @@ -264,9 +235,8 @@ void SvxLineDefTabPage::CheckChanges_Impl() } } - - sal_Int32 nPos = m_pLbLineStyles->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + int nPos = m_xLbLineStyles->get_active(); + if (nPos != -1) { *pPosDashLb = nPos; } @@ -281,7 +251,7 @@ bool SvxLineDefTabPage::FillItemSet( SfxItemSet* rAttrs ) { FillDash_Impl(); - OUString aString( m_pLbLineStyles->GetSelectedEntry() ); + OUString aString(m_xLbLineStyles->get_active_text()); rAttrs->Put( XLineStyleItem( drawing::LineStyle_DASH ) ); rAttrs->Put( XLineDashItem( aString, aDash ) ); } @@ -300,19 +270,17 @@ void SvxLineDefTabPage::Reset( const SfxItemSet* rAttrs ) { case drawing::LineStyle_NONE: case drawing::LineStyle_SOLID: - m_pLbLineStyles->SelectEntryPos( 0 ); + m_xLbLineStyles->set_active(0); break; - case drawing::LineStyle_DASH: { const XLineDashItem& rDashItem = rAttrs->Get( XATTR_LINEDASH ); aDash = rDashItem.GetDashValue(); - m_pLbLineStyles->SetNoSelection(); - m_pLbLineStyles->SelectEntry( rDashItem.GetName() ); - } + m_xLbLineStyles->set_active(-1); + m_xLbLineStyles->set_active_text(rDashItem.GetName()); break; - + } default: break; } @@ -322,37 +290,34 @@ void SvxLineDefTabPage::Reset( const SfxItemSet* rAttrs ) // determine button state if( pDashList->Count() ) { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); + m_xBtnModify->set_sensitive(true); + m_xBtnDelete->set_sensitive(true); + m_xBtnSave->set_sensitive(true); } else { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); + m_xBtnModify->set_sensitive(false); + m_xBtnDelete->set_sensitive(false); + m_xBtnSave->set_sensitive(false); } } - -VclPtr<SfxTabPage> SvxLineDefTabPage::Create( TabPageParent pWindow, const SfxItemSet* rOutAttrs ) +VclPtr<SfxTabPage> SvxLineDefTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs ) { - return VclPtr<SvxLineDefTabPage>::Create( pWindow.pParent, *rOutAttrs ); + return VclPtr<SvxLineDefTabPage>::Create(pParent, *rOutAttrs); } - -IMPL_LINK( SvxLineDefTabPage, SelectLinestyleListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK(SvxLineDefTabPage, SelectLinestyleListBoxHdl_Impl, weld::ComboBox&, rListBox, void) { SelectLinestyleHdl_Impl(&rListBox); } -void SvxLineDefTabPage::SelectLinestyleHdl_Impl(ListBox const * p) +void SvxLineDefTabPage::SelectLinestyleHdl_Impl(const weld::ComboBox* p) { if(pDashList->Count()) { - int nTmp = m_pLbLineStyles->GetSelectedEntryPos(); - - if(LISTBOX_ENTRY_NOTFOUND == nTmp) + int nTmp = m_xLbLineStyles->get_active(); + if (nTmp == -1) { OSL_ENSURE(false, "OOps, non-existent LineDash selected (!)"); nTmp = 1; @@ -365,9 +330,8 @@ void SvxLineDefTabPage::SelectLinestyleHdl_Impl(ListBox const * p) rXLSet.Put( XLineDashItem( OUString(), aDash ) ); // #i34740# - m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet()); - - m_pCtlPreview->Invalidate(); + m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.Invalidate(); // Is not set before, in order to take the new style // only if there was an entry selected in the ListBox. @@ -377,153 +341,149 @@ void SvxLineDefTabPage::SelectLinestyleHdl_Impl(ListBox const * p) } } - -IMPL_LINK_NOARG(SvxLineDefTabPage, ChangePreviewHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ChangePreviewHdl_Impl, weld::MetricSpinButton&, void) { FillDash_Impl(); - m_pCtlPreview->Invalidate(); + m_aCtlPreview.Invalidate(); } -IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber1Hdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber1Hdl_Impl, weld::SpinButton&, void) { - if( m_pNumFldNumber1->GetValue() == 0 ) + if (m_xNumFldNumber1->get_value() == 0) { - m_pNumFldNumber2->SetMin( 1 ); - m_pNumFldNumber2->SetFirst( 1 ); + m_xNumFldNumber2->set_min(1); } else { - m_pNumFldNumber2->SetMin( 0 ); - m_pNumFldNumber2->SetFirst( 0 ); + m_xNumFldNumber2->set_min(0); } - ChangePreviewHdl_Impl( *m_pMtrLength1 ); + ChangePreviewHdl_Impl(*m_xMtrLength1); } - -IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber2Hdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber2Hdl_Impl, weld::SpinButton&, void) { - if( m_pNumFldNumber2->GetValue() == 0 ) + if (m_xNumFldNumber2->get_value() == 0) { - m_pNumFldNumber1->SetMin( 1 ); - m_pNumFldNumber1->SetFirst( 1 ); + m_xNumFldNumber1->set_min(1); } else { - m_pNumFldNumber1->SetMin( 0 ); - m_pNumFldNumber1->SetFirst( 0 ); + m_xNumFldNumber1->set_min(0); } - ChangePreviewHdl_Impl( *m_pMtrLength1 ); + ChangePreviewHdl_Impl(*m_xMtrLength1); } +IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, weld::ToggleButton&, r, void) +{ + ChangeMetricHdl_Impl(&r); +} -IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, Button*, p, void ) +void SvxLineDefTabPage::ChangeMetricHdl_Impl(weld::ToggleButton* p) { - if( !m_pCbxSynchronize->IsChecked() && m_pMtrLength1->GetUnit() != eFUnit ) + if( !m_xCbxSynchronize->get_active() && m_xMtrLength1->get_unit() != eFUnit ) { long nTmp1, nTmp2, nTmp3; // was changed with Control if( p ) { - nTmp1 = GetCoreValue( *m_pMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100; - nTmp2 = GetCoreValue( *m_pMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100; - nTmp3 = GetCoreValue( *m_pMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100; + nTmp1 = GetCoreValue( *m_xMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100; + nTmp2 = GetCoreValue( *m_xMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100; + nTmp3 = GetCoreValue( *m_xMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100; } else { - nTmp1 = GetCoreValue( *m_pMtrLength1, ePoolUnit ); - nTmp2 = GetCoreValue( *m_pMtrLength2, ePoolUnit ); - nTmp3 = GetCoreValue( *m_pMtrDistance, ePoolUnit ); + nTmp1 = GetCoreValue( *m_xMtrLength1, ePoolUnit ); + nTmp2 = GetCoreValue( *m_xMtrLength2, ePoolUnit ); + nTmp3 = GetCoreValue( *m_xMtrDistance, ePoolUnit ); } - m_pMtrLength1->SetDecimalDigits( 2 ); - m_pMtrLength2->SetDecimalDigits( 2 ); - m_pMtrDistance->SetDecimalDigits( 2 ); + m_xMtrLength1->set_digits(2); + m_xMtrLength2->set_digits(2); + m_xMtrDistance->set_digits(2); // adjust metric - m_pMtrLength1->SetUnit( eFUnit ); - m_pMtrLength2->SetUnit( eFUnit ); - m_pMtrDistance->SetUnit( eFUnit ); + m_xMtrLength1->set_unit(eFUnit); + m_xMtrLength2->set_unit(eFUnit); + m_xMtrDistance->set_unit(eFUnit); - SetMetricValue( *m_pMtrLength1, nTmp1, ePoolUnit ); - SetMetricValue( *m_pMtrLength2, nTmp2, ePoolUnit ); - SetMetricValue( *m_pMtrDistance, nTmp3, ePoolUnit ); + SetMetricValue( *m_xMtrLength1, nTmp1, ePoolUnit ); + SetMetricValue( *m_xMtrLength2, nTmp2, ePoolUnit ); + SetMetricValue( *m_xMtrDistance, nTmp3, ePoolUnit ); } - else if( m_pCbxSynchronize->IsChecked() && m_pMtrLength1->GetUnit() != FUNIT_PERCENT ) + else if( m_xCbxSynchronize->get_active() && m_xMtrLength1->get_unit() != FUNIT_PERCENT ) { long nTmp1, nTmp2, nTmp3; // was changed with Control if( p ) { - nTmp1 = GetCoreValue( *m_pMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH; - nTmp2 = GetCoreValue( *m_pMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH; - nTmp3 = GetCoreValue( *m_pMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH; + nTmp1 = GetCoreValue( *m_xMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH; + nTmp2 = GetCoreValue( *m_xMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH; + nTmp3 = GetCoreValue( *m_xMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH; } else { - nTmp1 = GetCoreValue( *m_pMtrLength1, ePoolUnit ); - nTmp2 = GetCoreValue( *m_pMtrLength2, ePoolUnit ); - nTmp3 = GetCoreValue( *m_pMtrDistance, ePoolUnit ); + nTmp1 = GetCoreValue( *m_xMtrLength1, ePoolUnit ); + nTmp2 = GetCoreValue( *m_xMtrLength2, ePoolUnit ); + nTmp3 = GetCoreValue( *m_xMtrDistance, ePoolUnit ); } - m_pMtrLength1->SetDecimalDigits( 0 ); - m_pMtrLength2->SetDecimalDigits( 0 ); - m_pMtrDistance->SetDecimalDigits( 0 ); + m_xMtrLength1->set_digits(0); + m_xMtrLength2->set_digits(0); + m_xMtrDistance->set_digits(0); - m_pMtrLength1->SetUnit( FUNIT_PERCENT ); - m_pMtrLength2->SetUnit( FUNIT_PERCENT ); - m_pMtrDistance->SetUnit( FUNIT_PERCENT ); + m_xMtrLength1->set_unit(FUNIT_PERCENT); + m_xMtrLength2->set_unit(FUNIT_PERCENT); + m_xMtrDistance->set_unit(FUNIT_PERCENT); - SetMetricValue( *m_pMtrLength1, nTmp1, ePoolUnit ); - SetMetricValue( *m_pMtrLength2, nTmp2, ePoolUnit ); - SetMetricValue( *m_pMtrDistance, nTmp3, ePoolUnit ); + SetMetricValue( *m_xMtrLength1, nTmp1, ePoolUnit ); + SetMetricValue( *m_xMtrLength2, nTmp2, ePoolUnit ); + SetMetricValue( *m_xMtrDistance, nTmp3, ePoolUnit ); } SelectTypeHdl_Impl( nullptr ); } - -IMPL_LINK( SvxLineDefTabPage, SelectTypeListBoxHdl_Impl, ListBox&, rListBox, void ) +IMPL_LINK( SvxLineDefTabPage, SelectTypeListBoxHdl_Impl, weld::ComboBox&, rListBox, void ) { SelectTypeHdl_Impl(&rListBox); } -void SvxLineDefTabPage::SelectTypeHdl_Impl(ListBox* p) +void SvxLineDefTabPage::SelectTypeHdl_Impl(weld::ComboBox* p) { - if ( p == m_pLbType1 || !p ) + if (p == m_xLbType1.get() || !p) { - if ( m_pLbType1->GetSelectedEntryPos() == 0 ) + if (m_xLbType1->get_active() == 0) { - m_pMtrLength1->Disable(); - m_pMtrLength1->SetText( "" ); + m_xMtrLength1->set_sensitive(false); + m_xMtrLength1->set_text(""); } - else if ( !m_pMtrLength1->IsEnabled() ) + else if (!m_xMtrLength1->get_sensitive()) { - m_pMtrLength1->Enable(); - m_pMtrLength1->Reformat(); + m_xMtrLength1->set_sensitive(true); + m_xMtrLength1->reformat(); } } - if ( p == m_pLbType2 || !p ) + if (p == m_xLbType2.get() || !p) { - if ( m_pLbType2->GetSelectedEntryPos() == 0 ) + if (m_xLbType2->get_active() == 0) { - m_pMtrLength2->Disable(); - m_pMtrLength2->SetText( "" ); + m_xMtrLength2->set_sensitive(false); + m_xMtrLength2->set_text(""); } - else if ( !m_pMtrLength2->IsEnabled() ) + else if (!m_xMtrLength2->get_sensitive()) { - m_pMtrLength2->Enable(); - m_pMtrLength2->Reformat(); + m_xMtrLength2->set_sensitive(true); + m_xMtrLength2->reformat(); } } - ChangePreviewHdl_Impl( *m_pMtrLength1 ); + ChangePreviewHdl_Impl(*m_xMtrLength1); } - -IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, weld::Button&, void) { OUString aNewName(SvxResId(RID_SVXSTR_LINESTYLE)); OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINESTYLE)); @@ -544,7 +504,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) } SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetDialogFrameWeld(), aName, aDesc)); bool bLoop = true; while ( bLoop && pDlg->Execute() == RET_OK ) @@ -565,26 +525,26 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) long nDashCount = pDashList->Count(); pDashList->Insert( o3tl::make_unique<XDashEntry>(aDash, aName), nDashCount ); - m_pLbLineStyles->Append( *pDashList->GetDash(nDashCount), pDashList->GetUiBitmap(nDashCount) ); + m_xLbLineStyles->Append( *pDashList->GetDash(nDashCount), pDashList->GetUiBitmap(nDashCount) ); - m_pLbLineStyles->SelectEntryPos( m_pLbLineStyles->GetEntryCount() - 1 ); + m_xLbLineStyles->set_active(m_xLbLineStyles->get_count() - 1); *pnDashListState |= ChangeType::MODIFIED; *pPageType = PageType::Hatch; // save values for changes recognition (-> method) - m_pNumFldNumber1->SaveValue(); - m_pMtrLength1->SaveValue(); - m_pLbType1->SaveValue(); - m_pNumFldNumber2->SaveValue(); - m_pMtrLength2->SaveValue(); - m_pLbType2->SaveValue(); - m_pMtrDistance->SaveValue(); + m_xNumFldNumber1->save_value(); + m_xMtrLength1->save_value(); + m_xLbType1->save_value(); + m_xNumFldNumber2->save_value(); + m_xMtrLength2->save_value(); + m_xLbType2->save_value(); + m_xMtrDistance->save_value(); } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xBox->run(); } @@ -594,25 +554,23 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void) // determine button state if ( pDashList->Count() ) { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); + m_xBtnModify->set_sensitive(true); + m_xBtnDelete->set_sensitive(true); + m_xBtnSave->set_sensitive(true); } } - -IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, weld::Button&, void) { - sal_Int32 nPos = m_pLbLineStyles->GetSelectedEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + int nPos = m_xLbLineStyles->get_active(); + if (nPos != -1) { OUString aDesc(CuiResId(RID_SVXSTR_DESC_LINESTYLE)); OUString aName( pDashList->GetDash( nPos )->GetName() ); OUString aOldName = aName; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetFrameWeld(), aName, aDesc)); + ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog(GetDialogFrameWeld(), aName, aDesc)); long nCount = pDashList->Count(); bool bLoop = true; @@ -635,26 +593,26 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void) FillDash_Impl(); pDashList->Replace(o3tl::make_unique<XDashEntry>(aDash, aName), nPos); - m_pLbLineStyles->Modify(*pDashList->GetDash(nPos), nPos, pDashList->GetUiBitmap(nPos)); + m_xLbLineStyles->Modify(*pDashList->GetDash(nPos), nPos, pDashList->GetUiBitmap(nPos)); - m_pLbLineStyles->SelectEntryPos( nPos ); + m_xLbLineStyles->set_active(nPos); *pnDashListState |= ChangeType::MODIFIED; *pPageType = PageType::Hatch; // save values for changes recognition (-> method) - m_pNumFldNumber1->SaveValue(); - m_pMtrLength1->SaveValue(); - m_pLbType1->SaveValue(); - m_pNumFldNumber2->SaveValue(); - m_pMtrLength2->SaveValue(); - m_pLbType2->SaveValue(); - m_pMtrDistance->SaveValue(); + m_xNumFldNumber1->save_value(); + m_xMtrLength1->save_value(); + m_xLbType1->save_value(); + m_xNumFldNumber2->save_value(); + m_xMtrLength2->save_value(); + m_xLbType2->save_value(); + m_xMtrDistance->save_value(); } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryduplicatedialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/queryduplicatedialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("DuplicateNameDialog")); xBox->run(); } @@ -662,46 +620,44 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void) } } - -IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl, weld::Button&, void) { - sal_Int32 nPos = m_pLbLineStyles->GetSelectedEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + int nPos = m_xLbLineStyles->get_active(); + if (nPos != -1) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletelinestyledialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querydeletelinestyledialog.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelLineStyleDialog")); if (xQueryBox->run() == RET_YES) { pDashList->Remove(nPos); - m_pLbLineStyles->RemoveEntry( nPos ); - m_pLbLineStyles->SelectEntryPos( 0 ); + m_xLbLineStyles->remove(nPos); + m_xLbLineStyles->set_active(0); SelectLinestyleHdl_Impl( nullptr ); *pPageType = PageType::Area; // style should not be taken *pnDashListState |= ChangeType::MODIFIED; - ChangePreviewHdl_Impl( *m_pMtrLength1 ); + ChangePreviewHdl_Impl( *m_xMtrLength1 ); } } // determine button state if ( !pDashList->Count() ) { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); + m_xBtnModify->set_sensitive(false); + m_xBtnDelete->set_sensitive(false); + m_xBtnSave->set_sensitive(false); } } -IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, weld::Button&, void) { sal_uInt16 nReturn = RET_YES; if ( *pnDashListState & ChangeType::MODIFIED ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querysavelistdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querysavelistdialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("AskSaveList")); nReturn = xBox->run(); @@ -713,7 +669,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) if ( nReturn != RET_CANCEL ) { ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, GetDialogFrameWeld()); OUString aStrFilterType( "*.sod" ); aDlg.AddFilter( aStrFilterType, aStrFilterType ); OUString aPalettePath(SvtPathOptions().GetPalettePath()); @@ -744,8 +700,8 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) pDashList = pDshLst; static_cast<SvxLineTabDialog*>( GetParentDialog() )->SetNewDashList( pDashList ); - m_pLbLineStyles->Clear(); - m_pLbLineStyles->Fill( pDashList ); + m_xLbLineStyles->clear(); + m_xLbLineStyles->Fill( pDashList ); Reset( &rOutAttrs ); pDashList->SetName( aURL.getName() ); @@ -755,7 +711,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querynoloadedfiledialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoLoadedFileDialog")); xBox->run(); } @@ -765,21 +721,21 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, Button*, void) // determine button state if ( pDashList->Count() ) { - m_pBtnModify->Enable(); - m_pBtnDelete->Enable(); - m_pBtnSave->Enable(); + m_xBtnModify->set_sensitive(true); + m_xBtnDelete->set_sensitive(true); + m_xBtnSave->set_sensitive(true); } else { - m_pBtnModify->Disable(); - m_pBtnDelete->Disable(); - m_pBtnSave->Disable(); + m_xBtnModify->set_sensitive(false); + m_xBtnDelete->set_sensitive(false); + m_xBtnSave->set_sensitive(false); } } -IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl, weld::Button&, void) { - ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); + ::sfx2::FileDialogHelper aDlg(css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, GetDialogFrameWeld()); OUString aStrFilterType( "*.sod" ); aDlg.AddFilter( aStrFilterType, aStrFilterType ); @@ -822,7 +778,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl, Button*, void) } else { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querynosavefiledialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/querynosavefiledialog.ui")); std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("NoSaveFileDialog")); xBox->run(); } @@ -833,64 +789,62 @@ void SvxLineDefTabPage::FillDash_Impl() { css::drawing::DashStyle eXDS; - if( m_pCbxSynchronize->IsChecked() ) + if (m_xCbxSynchronize->get_active()) eXDS = css::drawing::DashStyle_RECTRELATIVE; else eXDS = css::drawing::DashStyle_RECT; aDash.SetDashStyle( eXDS ); - aDash.SetDots( static_cast<sal_uInt8>(m_pNumFldNumber1->GetValue()) ); - aDash.SetDotLen( m_pLbType1->GetSelectedEntryPos() == 0 ? 0 : GetCoreValue( *m_pMtrLength1, ePoolUnit ) ); - aDash.SetDashes( static_cast<sal_uInt8>(m_pNumFldNumber2->GetValue()) ); - aDash.SetDashLen( m_pLbType2->GetSelectedEntryPos() == 0 ? 0 : GetCoreValue( *m_pMtrLength2, ePoolUnit ) ); - aDash.SetDistance( GetCoreValue( *m_pMtrDistance, ePoolUnit ) ); + aDash.SetDots( static_cast<sal_uInt8>(m_xNumFldNumber1->get_value()) ); + aDash.SetDotLen( m_xLbType1->get_active() == 0 ? 0 : GetCoreValue( *m_xMtrLength1, ePoolUnit ) ); + aDash.SetDashes( static_cast<sal_uInt8>(m_xNumFldNumber2->get_value()) ); + aDash.SetDashLen( m_xLbType2->get_active() == 0 ? 0 : GetCoreValue( *m_xMtrLength2, ePoolUnit ) ); + aDash.SetDistance( GetCoreValue( *m_xMtrDistance, ePoolUnit ) ); rXLSet.Put( XLineDashItem( OUString(), aDash ) ); // #i34740# - m_pCtlPreview->SetLineAttributes(aXLineAttr.GetItemSet()); + m_aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); } - void SvxLineDefTabPage::FillDialog_Impl() { css::drawing::DashStyle eXDS = aDash.GetDashStyle(); // css::drawing::DashStyle_RECT, css::drawing::DashStyle_ROUND if( eXDS == css::drawing::DashStyle_RECTRELATIVE ) - m_pCbxSynchronize->Check(); + m_xCbxSynchronize->set_active(true); else - m_pCbxSynchronize->Check( false ); + m_xCbxSynchronize->set_active(false); - m_pNumFldNumber1->SetValue( aDash.GetDots() ); - SetMetricValue( *m_pMtrLength1, aDash.GetDotLen(), ePoolUnit ); - m_pLbType1->SelectEntryPos( aDash.GetDotLen() == 0 ? 0 : 1 ); - m_pNumFldNumber2->SetValue( aDash.GetDashes() ); - SetMetricValue( *m_pMtrLength2, aDash.GetDashLen(), ePoolUnit ); - m_pLbType2->SelectEntryPos( aDash.GetDashLen() == 0 ? 0 : 1 ); - SetMetricValue( *m_pMtrDistance, aDash.GetDistance(), ePoolUnit ); + m_xNumFldNumber1->set_value(aDash.GetDots()); + SetMetricValue( *m_xMtrLength1, aDash.GetDotLen(), ePoolUnit ); + m_xLbType1->set_active(aDash.GetDotLen() == 0 ? 0 : 1); + m_xNumFldNumber2->set_value(aDash.GetDashes()); + SetMetricValue( *m_xMtrLength2, aDash.GetDashLen(), ePoolUnit ); + m_xLbType2->set_active(aDash.GetDashLen() == 0 ? 0 : 1); + SetMetricValue( *m_xMtrDistance, aDash.GetDistance(), ePoolUnit ); - ChangeMetricHdl_Impl( nullptr ); + ChangeMetricHdl_Impl(nullptr); // save values for changes recognition (-> method) - m_pNumFldNumber1->SaveValue(); - m_pMtrLength1->SaveValue(); - m_pLbType1->SaveValue(); - m_pNumFldNumber2->SaveValue(); - m_pMtrLength2->SaveValue(); - m_pLbType2->SaveValue(); - m_pMtrDistance->SaveValue(); + m_xNumFldNumber1->save_value(); + m_xMtrLength1->save_value(); + m_xLbType1->save_value(); + m_xNumFldNumber2->save_value(); + m_xMtrLength2->save_value(); + m_xLbType2->save_value(); + m_xMtrDistance->save_value(); } - void SvxLineDefTabPage::DataChanged( const DataChangedEvent& rDCEvt ) { SfxTabPage::DataChanged( rDCEvt ); if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - sal_Int32 nOldSelect = m_pLbLineStyles->GetSelectedEntryPos(); - m_pLbLineStyles->Clear(); - m_pLbLineStyles->Fill( pDashList ); - m_pLbLineStyles->SelectEntryPos( nOldSelect ); + auto nOldSelect = m_xLbLineStyles->get_active(); + m_xLbLineStyles->clear(); + m_xLbLineStyles->Fill(pDashList); + m_xLbLineStyles->set_active(nOldSelect); } } diff --git a/cui/uiconfig/ui/lineendstabpage.ui b/cui/uiconfig/ui/lineendstabpage.ui index 81145b0285e3..8423d30df951 100644 --- a/cui/uiconfig/ui/lineendstabpage.ui +++ b/cui/uiconfig/ui/lineendstabpage.ui @@ -91,7 +91,7 @@ <child> <object class="GtkEntry" id="EDT_NAME"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="halign">start</property> <property name="hexpand">True</property> <property name="width_chars">30</property> @@ -148,7 +148,7 @@ <object class="GtkButton" id="BTN_ADD"> <property name="label">gtk-add</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> <property name="use_stock">True</property> @@ -163,7 +163,7 @@ <object class="GtkButton" id="BTN_MODIFY"> <property name="label" translatable="yes" context="lineendstabpage|BTN_MODIFY">_Modify</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> </object> @@ -177,7 +177,7 @@ <object class="GtkButton" id="BTN_DELETE"> <property name="label">gtk-delete</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/cui/uiconfig/ui/linestyletabpage.ui b/cui/uiconfig/ui/linestyletabpage.ui index 6ecc1adfdfb0..39537e1dac69 100644 --- a/cui/uiconfig/ui/linestyletabpage.ui +++ b/cui/uiconfig/ui/linestyletabpage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> - <!-- interface-requires gtk+ 3.0 --> - <!-- interface-requires LibreOffice 1.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="adjustmentDIST"> <property name="upper">5</property> <property name="step_increment">0.10000000000000001</property> @@ -15,30 +15,22 @@ <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="pixbuf">res/sc05501.png</property> + <property name="icon_name">res/sc05501.png</property> </object> <object class="GtkImage" id="image2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="pixbuf">res/sc05502.png</property> + <property name="icon_name">res/sc05502.png</property> </object> - <object class="GtkListStore" id="liststoreTYPE"> + <object class="GtkListStore" id="liststore4"> <columns> - <!-- column-name gchararray1 --> + <!-- column-name text --> <column type="gchararray"/> - <!-- column-name guint1 --> - <column type="guint"/> + <!-- column-name id --> + <column type="gchararray"/> + <!-- column-name image --> + <column type="GdkPixbuf"/> </columns> - <data> - <row> - <col id="0" translatable="yes" context="linestyletabpage|liststoreTYPE">Dots</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="linestyletabpage|liststoreTYPE">Dash</col> - <col id="1">0</col> - </row> - </data> </object> <object class="GtkFrame" id="LineStylePage"> <property name="visible">True</property> @@ -88,9 +80,10 @@ <object class="GtkLabel" id="FT_LINESTYLE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|FT_LINESTYLE">Line _style:</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_LINESTYLES</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -99,9 +92,12 @@ </packing> </child> <child> - <object class="svxlo-LineLB" id="LB_LINESTYLES"> + <object class="GtkComboBox" id="LB_LINESTYLES"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="model">liststore4</property> + <property name="id_column">1</property> </object> <packing> <property name="expand">False</property> @@ -126,71 +122,63 @@ <object class="GtkLabel" id="FT_TYPE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|FT_TYPE">_Type:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_TYPE_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="FT_NUMBER"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|FT_NUMBER">_Number:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">NUM_FLD_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="FT_LENGTH"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|FT_LENGTH">_Length:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_LENGTH_1:0.00cm</property> + <property name="mnemonic_widget">MTR_FLD_LENGTH_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="FT_DISTANCE"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|FT_DISTANCE">_Spacing:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_DISTANCE:0.00cm</property> + <property name="mnemonic_widget">MTR_FLD_DISTANCE</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkCheckButton" id="CBX_SYNCHRONIZE"> <property name="label" translatable="yes" context="linestyletabpage|CBX_SYNCHRONIZE">_Fit to line width</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> @@ -199,102 +187,97 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkComboBox" id="LB_TYPE_1"> + <object class="GtkComboBoxText" id="LB_TYPE_1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststoreTYPE</property> + <items> + <item translatable="yes" context="linestyletabpage|liststoreTYPE">Dots</item> + <item translatable="yes" context="linestyletabpage|liststoreTYPE">Dash</item> + </items> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkComboBox" id="LB_TYPE_2"> + <object class="GtkComboBoxText" id="LB_TYPE_2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststoreTYPE</property> + <items> + <item translatable="yes" context="linestyletabpage|liststoreTYPE">Dots</item> + <item translatable="yes" context="linestyletabpage|liststoreTYPE">Dash</item> + </items> </object> <packing> <property name="left_attach">2</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="NUM_FLD_1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentNUM</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkSpinButton" id="NUM_FLD_2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentNUM</property> </object> <packing> <property name="left_attach">2</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LENGTH_1:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_LENGTH_1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentDIST</property> <property name="digits">2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LENGTH_2:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_LENGTH_2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentDIST</property> <property name="digits">2</property> </object> <packing> <property name="left_attach">2</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_DISTANCE:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_DISTANCE"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustmentDIST</property> <property name="digits">2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -333,7 +316,7 @@ <object class="GtkButton" id="BTN_ADD"> <property name="label">gtk-add</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> <property name="use_stock">True</property> @@ -348,7 +331,7 @@ <object class="GtkButton" id="BTN_MODIFY"> <property name="label" translatable="yes" context="linestyletabpage|BTN_MODIFY">_Modify</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> </object> @@ -362,7 +345,7 @@ <object class="GtkButton" id="BTN_DELETE"> <property name="label">gtk-delete</property> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -392,8 +375,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -410,8 +391,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -437,10 +416,24 @@ </packing> </child> <child> - <object class="svxlo-SvxXLinePreview" id="CTL_PREVIEW"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="valign">end</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_PREVIEW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -456,8 +449,8 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="linestyletabpage|label1">Properties</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> </attributes> diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 2061a211f312..db016d6d1dd6 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -268,6 +268,34 @@ public: void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap ); }; +class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLineLB +{ +private: + std::unique_ptr<weld::ComboBox> m_xControl; + + /// defines if standard fields (none, solid) are added, default is true + bool mbAddStandardFields : 1; + +public: + SvxLineLB(std::unique_ptr<weld::ComboBox> pControl); + + void Fill(const XDashListRef &pList); + bool getAddStandardFields() const { return mbAddStandardFields; } + void setAddStandardFields(bool bNew); + + void Append(const XDashEntry& rEntry, const BitmapEx& rBitmap ); + void Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap ); + + void clear() { m_xControl->clear(); } + void remove(int nPos) { m_xControl->remove(nPos); } + int get_active() const { return m_xControl->get_active(); } + void set_active(int nPos) { m_xControl->set_active(nPos); } + void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); } + OUString get_active_text() const { return m_xControl->get_active_text(); } + void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } + int get_count() const { return m_xControl->get_count(); } +}; + /************************************************************************/ class SAL_WARN_UNUSED SVX_DLLPUBLIC LineEndLB : public ListBox @@ -299,6 +327,7 @@ public: void remove(int nPos) { m_xControl->remove(nPos); } int get_active() const { return m_xControl->get_active(); } void set_active(int nPos) { m_xControl->set_active(nPos); } + void set_active_text(const OUString& rStr) { m_xControl->set_active_text(rStr); } OUString get_active_text() const { return m_xControl->get_active_text(); } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xControl->connect_changed(rLink); } int get_count() const { return m_xControl->get_count(); } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index ddfd104189e4..822aec4f095c 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -764,6 +764,11 @@ public: return convert_value_to(m_xSpinButton->get_value(), eDestUnit); } + // typically you only need to call this if set_text (e.g. with "") was + // previously called to display some arbitrary text instead of the + // formatted value and now you want to show it as formattted again + void reformat() { set_value(get_value(m_eSrcUnit), m_eSrcUnit); } + void set_range(int min, int max, FieldUnit eValueUnit) { min = convert_value_from(min, eValueUnit); diff --git a/solenv/sanitizers/ui/cui.suppr b/solenv/sanitizers/ui/cui.suppr index f084489e8c2d..b0c922a78d26 100644 --- a/solenv/sanitizers/ui/cui.suppr +++ b/solenv/sanitizers/ui/cui.suppr @@ -265,11 +265,9 @@ cui/uiconfig/ui/linetabpage.ui://GtkSpinButton[@id='MF_SYMBOL_HEIGHT:0cm'] no-la cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FT_LINE_END_STYLE'] orphan-label cui/uiconfig/ui/lineendstabpage.ui://svxlo-LineEndLB[@id='LB_LINEENDS'] no-labelled-by cui/uiconfig/ui/lineendstabpage.ui://GtkLabel[@id='FI_TIP'] orphan-label -cui/uiconfig/ui/linestyletabpage.ui://GtkLabel[@id='FT_LINESTYLE'] orphan-label -cui/uiconfig/ui/linestyletabpage.ui://svxlo-LineLB[@id='LB_LINESTYLES'] no-labelled-by cui/uiconfig/ui/linestyletabpage.ui://GtkComboBox[@id='LB_TYPE_2'] no-labelled-by cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='NUM_FLD_2'] no-labelled-by -cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='MTR_FLD_LENGTH_2:0.00cm'] no-labelled-by +cui/uiconfig/ui/linestyletabpage.ui://GtkSpinButton[@id='MTR_FLD_LENGTH_2'] no-labelled-by cui/uiconfig/ui/macroassignpage.ui://cuilo-MacroEventListBox[@id='assignments:border'] no-labelled-by cui/uiconfig/ui/macroassignpage.ui://GtkLabel[@id='eventft'] orphan-label cui/uiconfig/ui/macroassignpage.ui://GtkLabel[@id='assignft'] orphan-label diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index f75661db088c..83292b9483bb 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1076,6 +1076,105 @@ void LineLB::Modify( const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& r } } +SvxLineLB::SvxLineLB(std::unique_ptr<weld::ComboBox> pControl) + : m_xControl(std::move(pControl)) + , mbAddStandardFields(true) +{ +} + +void SvxLineLB::setAddStandardFields(bool bNew) +{ + if(getAddStandardFields() != bNew) + { + mbAddStandardFields = bNew; + } +} + +// Fills the listbox (provisional) with strings + +void SvxLineLB::Fill( const XDashListRef &pList ) +{ + m_xControl->clear(); + + if( !pList.is() ) + return; + + ScopedVclPtrInstance< VirtualDevice > pVD; + + if(getAddStandardFields()) + { + // entry for 'none' + m_xControl->append_text(pList->GetStringForUiNoLine()); + + // entry for solid line + const BitmapEx aBitmap = pList->GetBitmapForUISolidLine(); + const Size aBmpSize(aBitmap.GetSizePixel()); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmapEx(Point(), aBitmap); + m_xControl->append("", pList->GetStringForUiSolidLine(), *pVD); + } + + // entries for dashed lines + + long nCount = pList->Count(); + m_xControl->freeze(); + + for( long i = 0; i < nCount; i++ ) + { + const XDashEntry* pEntry = pList->GetDash(i); + const BitmapEx aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + { + const Size aBmpSize(aBitmap.GetSizePixel()); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmapEx(Point(), aBitmap); + m_xControl->append("", pEntry->GetName(), *pVD); + } + else + { + m_xControl->append_text(pEntry->GetName()); + } + } + + m_xControl->thaw(); +} + +void SvxLineLB::Append( const XDashEntry& rEntry, const BitmapEx& rBitmap ) +{ + if (!rBitmap.IsEmpty()) + { + ScopedVclPtrInstance< VirtualDevice > pVD; + + const Size aBmpSize(rBitmap.GetSizePixel()); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmapEx(Point(), rBitmap); + m_xControl->append("", rEntry.GetName(), *pVD); + } + else + { + m_xControl->append_text(rEntry.GetName()); + } +} + +void SvxLineLB::Modify(const XDashEntry& rEntry, sal_Int32 nPos, const BitmapEx& rBitmap) +{ + m_xControl->remove(nPos); + + if (!rBitmap.IsEmpty()) + { + ScopedVclPtrInstance< VirtualDevice > pVD; + + const Size aBmpSize(rBitmap.GetSizePixel()); + pVD->SetOutputSizePixel(aBmpSize, false); + pVD->DrawBitmapEx(Point(), rBitmap); + m_xControl->insert(nPos, "", rEntry.GetName(), nullptr, pVD); + } + else + { + m_xControl->insert_text(nPos, rEntry.GetName()); + } +} + // Fills the listbox (provisional) with strings LineEndLB::LineEndLB( vcl::Window* pParent, WinBits aWB ) |