diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-28 10:30:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-28 16:57:00 +0200 |
commit | 3120c9722f5c7553c78d638c3fd1f976f76bc9e9 (patch) | |
tree | 4624b95c98ccf78ce7562d38bdce2ea06a4a6978 /cui | |
parent | 45c753aff6468b9761e68bc0bf48ab161cd0cba6 (diff) |
weld SvxConnectionPage
Change-Id: I155f0c037f0d1879cec4d0b511d60a276466b1bb
Reviewed-on: https://gerrit.libreoffice.org/61077
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/connect.hxx | 43 | ||||
-rw-r--r-- | cui/source/tabpages/connect.cxx | 321 | ||||
-rw-r--r-- | cui/uiconfig/ui/connectortabpage.ui | 146 |
3 files changed, 263 insertions, 247 deletions
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx index 5c034d2104af..a7e499743275 100644 --- a/cui/source/inc/connect.hxx +++ b/cui/source/inc/connect.hxx @@ -21,10 +21,8 @@ #include <svx/connctrl.hxx> #include <sfx2/tabdlg.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/group.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> #include <sfx2/basedlgs.hxx> class SdrView; @@ -34,36 +32,33 @@ class SvxConnectionPage : public SfxTabPage { private: static const sal_uInt16 pRanges[]; - VclPtr<ListBox> m_pLbType; - - VclPtr<FixedText> m_pFtLine1; - VclPtr<MetricField> m_pMtrFldLine1; - VclPtr<FixedText> m_pFtLine2; - VclPtr<MetricField> m_pMtrFldLine2; - VclPtr<FixedText> m_pFtLine3; - VclPtr<MetricField> m_pMtrFldLine3; - - VclPtr<MetricField> m_pMtrFldHorz1; - VclPtr<MetricField> m_pMtrFldVert1; - VclPtr<MetricField> m_pMtrFldHorz2; - VclPtr<MetricField> m_pMtrFldVert2; - - VclPtr<SvxXConnectionPreview> m_pCtlPreview; - const SfxItemSet& rOutAttrs; SfxItemSet aAttrSet; const SdrView* pView; MapUnit eUnit; + SvxXConnectionPreview m_aCtlPreview; + std::unique_ptr<weld::ComboBox> m_xLbType; + std::unique_ptr<weld::Label> m_xFtLine1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldLine1; + std::unique_ptr<weld::Label> m_xFtLine2; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldLine2; + std::unique_ptr<weld::Label> m_xFtLine3; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldLine3; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldHorz1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldVert1; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldHorz2; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldVert2; + std::unique_ptr<weld::CustomWeld> m_xCtlPreview; + void FillTypeLB(); - DECL_LINK( ChangeAttrEditHdl_Impl, Edit&, void ); - DECL_LINK( ChangeAttrListBoxHdl_Impl, ListBox&, void ); - void ChangeAttrHdl_Impl(void const *); + DECL_LINK(ChangeAttrEditHdl_Impl, weld::MetricSpinButton&, void); + DECL_LINK(ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void); public: - SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs ); + SvxConnectionPage(TabPageParent pWindow, const SfxItemSet& rInAttrs); virtual ~SvxConnectionPage() override; virtual void dispose() override; diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx index 2820e383434c..cffd7806beeb 100644 --- a/cui/source/tabpages/connect.cxx +++ b/cui/source/tabpages/connect.cxx @@ -68,29 +68,24 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet |* \************************************************************************/ -SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs ) - : SfxTabPage(pWindow ,"ConnectorTabPage" ,"cui/ui/connectortabpage.ui" - ,&rInAttrs) +SvxConnectionPage::SvxConnectionPage(TabPageParent pWindow, const SfxItemSet& rInAttrs) + : SfxTabPage(pWindow, "cui/ui/connectortabpage.ui", "ConnectorTabPage", &rInAttrs) , rOutAttrs(rInAttrs) , aAttrSet(*rInAttrs.GetPool()) , pView(nullptr) + , m_xLbType(m_xBuilder->weld_combo_box("LB_TYPE")) + , m_xFtLine1(m_xBuilder->weld_label("FT_LINE_1")) + , m_xMtrFldLine1(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_1", FUNIT_CM)) + , m_xFtLine2(m_xBuilder->weld_label("FT_LINE_2")) + , m_xMtrFldLine2(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_2", FUNIT_CM)) + , m_xFtLine3(m_xBuilder->weld_label("FT_LINE_3")) + , m_xMtrFldLine3(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_3", FUNIT_CM)) + , m_xMtrFldHorz1(m_xBuilder->weld_metric_spin_button("MTR_FLD_HORZ_1", FUNIT_MM)) + , m_xMtrFldVert1(m_xBuilder->weld_metric_spin_button("MTR_FLD_VERT_1", FUNIT_MM)) + , m_xMtrFldHorz2(m_xBuilder->weld_metric_spin_button("MTR_FLD_HORZ_2", FUNIT_MM)) + , m_xMtrFldVert2(m_xBuilder->weld_metric_spin_button("MTR_FLD_VERT_2", FUNIT_MM)) + , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview)) { - get(m_pLbType,"LB_TYPE"); - - get(m_pFtLine1,"FT_LINE_1"); - get(m_pMtrFldLine1,"MTR_FLD_LINE_1"); - get(m_pFtLine2,"FT_LINE_2"); - get(m_pMtrFldLine2,"MTR_FLD_LINE_2"); - get(m_pFtLine3,"FT_LINE_3"); - get(m_pMtrFldLine3,"MTR_FLD_LINE_3"); - - get(m_pMtrFldHorz1,"MTR_FLD_HORZ_1"); - get(m_pMtrFldVert1,"MTR_FLD_VERT_1"); - get(m_pMtrFldHorz2,"MTR_FLD_HORZ_2"); - get(m_pMtrFldVert2,"MTR_FLD_VERT_2"); - - get(m_pCtlPreview,"CTL_PREVIEW"); - SfxItemPool* pPool = rOutAttrs.GetPool(); DBG_ASSERT( pPool, "Where is the pool" ); eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST ); @@ -98,36 +93,33 @@ SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rI FillTypeLB(); const FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( *m_pMtrFldHorz1, eFUnit ); - SetFieldUnit( *m_pMtrFldHorz2, eFUnit ); - SetFieldUnit( *m_pMtrFldVert1, eFUnit ); - SetFieldUnit( *m_pMtrFldVert2, eFUnit ); - SetFieldUnit( *m_pMtrFldLine1, eFUnit ); - SetFieldUnit( *m_pMtrFldLine2, eFUnit ); - SetFieldUnit( *m_pMtrFldLine3, eFUnit ); + SetFieldUnit( *m_xMtrFldHorz1, eFUnit ); + SetFieldUnit( *m_xMtrFldHorz2, eFUnit ); + SetFieldUnit( *m_xMtrFldVert1, eFUnit ); + SetFieldUnit( *m_xMtrFldVert2, eFUnit ); + SetFieldUnit( *m_xMtrFldLine1, eFUnit ); + SetFieldUnit( *m_xMtrFldLine2, eFUnit ); + SetFieldUnit( *m_xMtrFldLine3, eFUnit ); if( eFUnit == FUNIT_MM ) { - m_pMtrFldHorz1->SetSpinSize( 50 ); - m_pMtrFldHorz2->SetSpinSize( 50 ); - m_pMtrFldVert1->SetSpinSize( 50 ); - m_pMtrFldVert2->SetSpinSize( 50 ); - m_pMtrFldLine1->SetSpinSize( 50 ); - m_pMtrFldLine2->SetSpinSize( 50 ); - m_pMtrFldLine3->SetSpinSize( 50 ); + m_xMtrFldHorz1->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldHorz2->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldVert1->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldVert2->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldLine1->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldLine2->set_increments(50, 500, FUNIT_NONE); + m_xMtrFldLine3->set_increments(50, 500, FUNIT_NONE); } - // disable 3D border - m_pCtlPreview->SetBorderStyle(WindowBorderStyle::MONO); - - Link<Edit&,void> aLink( LINK( this, SvxConnectionPage, ChangeAttrEditHdl_Impl ) ); - m_pMtrFldHorz1->SetModifyHdl( aLink ); - m_pMtrFldVert1->SetModifyHdl( aLink ); - m_pMtrFldHorz2->SetModifyHdl( aLink ); - m_pMtrFldVert2->SetModifyHdl( aLink ); - m_pMtrFldLine1->SetModifyHdl( aLink ); - m_pMtrFldLine2->SetModifyHdl( aLink ); - m_pMtrFldLine3->SetModifyHdl( aLink ); - m_pLbType->SetSelectHdl( LINK( this, SvxConnectionPage, ChangeAttrListBoxHdl_Impl ) ); + Link<weld::MetricSpinButton&,void> aLink(LINK(this, SvxConnectionPage, ChangeAttrEditHdl_Impl)); + m_xMtrFldHorz1->connect_value_changed(aLink); + m_xMtrFldVert1->connect_value_changed(aLink); + m_xMtrFldHorz2->connect_value_changed(aLink); + m_xMtrFldVert2->connect_value_changed(aLink); + m_xMtrFldLine1->connect_value_changed(aLink); + m_xMtrFldLine2->connect_value_changed(aLink); + m_xMtrFldLine3->connect_value_changed(aLink); + m_xLbType->connect_changed(LINK(this, SvxConnectionPage, ChangeAttrListBoxHdl_Impl)); } SvxConnectionPage::~SvxConnectionPage() @@ -137,18 +129,7 @@ SvxConnectionPage::~SvxConnectionPage() void SvxConnectionPage::dispose() { - m_pLbType.clear(); - m_pFtLine1.clear(); - m_pMtrFldLine1.clear(); - m_pFtLine2.clear(); - m_pMtrFldLine2.clear(); - m_pFtLine3.clear(); - m_pMtrFldLine3.clear(); - m_pMtrFldHorz1.clear(); - m_pMtrFldVert1.clear(); - m_pMtrFldHorz2.clear(); - m_pMtrFldVert2.clear(); - m_pCtlPreview.clear(); + m_xCtlPreview.reset(); SfxTabPage::dispose(); } @@ -169,12 +150,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrEdgeNode1HorzDistItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldHorz1, nValue, eUnit ); + SetMetricValue(*m_xMtrFldHorz1, nValue, eUnit); } else - m_pMtrFldHorz1->SetEmptyFieldValue(); + m_xMtrFldHorz1->set_text(""); - m_pMtrFldHorz1->SaveValue(); + m_xMtrFldHorz1->save_value(); // SdrEdgeNode2HorzDistItem pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2HORZDIST ); @@ -183,12 +164,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrEdgeNode2HorzDistItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldHorz2, nValue, eUnit ); + SetMetricValue(*m_xMtrFldHorz2, nValue, eUnit); } else - m_pMtrFldHorz2->SetEmptyFieldValue(); + m_xMtrFldHorz2->set_text(""); - m_pMtrFldHorz2->SaveValue(); + m_xMtrFldHorz2->save_value(); // SdrEdgeNode1VertDistItem pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1VERTDIST ); @@ -197,12 +178,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrEdgeNode1VertDistItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldVert1, nValue, eUnit ); + SetMetricValue(*m_xMtrFldVert1, nValue, eUnit); } else - m_pMtrFldVert1->SetEmptyFieldValue(); + m_xMtrFldVert1->set_text(""); - m_pMtrFldVert1->SaveValue(); + m_xMtrFldVert1->save_value(); // SdrEdgeNode2VertDistItem pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2VERTDIST ); @@ -211,12 +192,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrEdgeNode2VertDistItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldVert2, nValue, eUnit ); + SetMetricValue(*m_xMtrFldVert2, nValue, eUnit); } else - m_pMtrFldVert2->SetEmptyFieldValue(); + m_xMtrFldVert2->set_text(""); - m_pMtrFldVert2->SaveValue(); + m_xMtrFldVert2->save_value(); // SdrEdgeLine1DeltaItem pItem = GetItem( *rAttrs, SDRATTR_EDGELINE1DELTA ); @@ -225,12 +206,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldLine1, nValue, eUnit ); + SetMetricValue(*m_xMtrFldLine1, nValue, eUnit); } else - m_pMtrFldLine1->SetEmptyFieldValue(); + m_xMtrFldLine1->set_text(""); - m_pMtrFldLine1->SaveValue(); + m_xMtrFldLine1->save_value(); // SdrEdgeLine2DeltaItem pItem = GetItem( *rAttrs, SDRATTR_EDGELINE2DELTA ); @@ -239,12 +220,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldLine2, nValue, eUnit ); + SetMetricValue(*m_xMtrFldLine2, nValue, eUnit); } else - m_pMtrFldLine2->SetEmptyFieldValue(); + m_xMtrFldLine2->set_text(""); - m_pMtrFldLine2->SaveValue(); + m_xMtrFldLine2->save_value(); // SdrEdgeLine3DeltaItem pItem = GetItem( *rAttrs, SDRATTR_EDGELINE3DELTA ); @@ -253,12 +234,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); - SetMetricValue( *m_pMtrFldLine3, nValue, eUnit ); + SetMetricValue(*m_xMtrFldLine3, nValue, eUnit); } else - m_pMtrFldLine3->SetEmptyFieldValue(); + m_xMtrFldLine3->set_text(""); - m_pMtrFldLine3->SaveValue(); + m_xMtrFldLine3->save_value(); // SdrEdgeLineDeltaAnzItem pItem = GetItem( *rAttrs, SDRATTR_EDGELINEDELTACOUNT ); @@ -269,21 +250,21 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) sal_uInt16 nValue = static_cast<const SdrEdgeLineDeltaCountItem*>( pItem )->GetValue(); if( nValue <= 2 ) { - m_pFtLine3->Enable( false ); - m_pMtrFldLine3->Enable( false ); - m_pMtrFldLine3->SetEmptyFieldValue(); + m_xFtLine3->set_sensitive(false); + m_xMtrFldLine3->set_sensitive(false); + m_xMtrFldLine3->set_text(""); } if( nValue <= 1 ) { - m_pFtLine2->Enable( false ); - m_pMtrFldLine2->Enable( false ); - m_pMtrFldLine2->SetEmptyFieldValue(); + m_xFtLine2->set_sensitive(false); + m_xMtrFldLine2->set_sensitive(false); + m_xMtrFldLine2->set_text(""); } if( nValue == 0 ) { - m_pFtLine1->Enable( false ); - m_pMtrFldLine1->Enable( false ); - m_pMtrFldLine1->SetEmptyFieldValue(); + m_xFtLine1->set_sensitive(false); + m_xMtrFldLine1->set_sensitive(false); + m_xMtrFldLine1->set_text(""); } } @@ -294,11 +275,11 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) if( pItem ) { SdrEdgeKind nValue = static_cast<const SdrEdgeKindItem*>( pItem )->GetValue(); - m_pLbType->SelectEntryPos( sal::static_int_cast< sal_uInt16 >(nValue) ); + m_xLbType->set_active(sal::static_int_cast<sal_uInt16>(nValue)); } else - m_pLbType->SetNoSelection(); - m_pLbType->SaveValue(); + m_xLbType->set_active(-1); + m_xLbType->save_value(); } /************************************************************************* @@ -312,60 +293,59 @@ bool SvxConnectionPage::FillItemSet( SfxItemSet* rAttrs) bool bModified = false; sal_Int32 nValue; - if( m_pMtrFldHorz1->IsValueChangedFromSaved() ) + if (m_xMtrFldHorz1->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldHorz1, eUnit ); + nValue = GetCoreValue(*m_xMtrFldHorz1, eUnit); rAttrs->Put( SdrEdgeNode1HorzDistItem( nValue ) ); bModified = true; } - if( m_pMtrFldHorz2->IsValueChangedFromSaved() ) + if (m_xMtrFldHorz2->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldHorz2, eUnit ); + nValue = GetCoreValue(*m_xMtrFldHorz2, eUnit); rAttrs->Put( SdrEdgeNode2HorzDistItem( nValue ) ); bModified = true; } - if( m_pMtrFldVert1->IsValueChangedFromSaved() ) + if (m_xMtrFldVert1->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldVert1, eUnit ); + nValue = GetCoreValue(*m_xMtrFldVert1, eUnit); rAttrs->Put( SdrEdgeNode1VertDistItem( nValue ) ); bModified = true; } - if( m_pMtrFldVert2->IsValueChangedFromSaved() ) + if (m_xMtrFldVert2->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldVert2, eUnit ); + nValue = GetCoreValue(*m_xMtrFldVert2, eUnit); rAttrs->Put( SdrEdgeNode2VertDistItem( nValue ) ); bModified = true; } - if( m_pMtrFldLine1->IsValueChangedFromSaved() ) + if (m_xMtrFldLine1->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldLine1, eUnit ); + nValue = GetCoreValue(*m_xMtrFldLine1, eUnit); rAttrs->Put( makeSdrEdgeLine1DeltaItem( nValue ) ); bModified = true; } - if( m_pMtrFldLine2->IsValueChangedFromSaved() ) + if (m_xMtrFldLine2->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldLine2, eUnit ); + nValue = GetCoreValue(*m_xMtrFldLine2, eUnit); rAttrs->Put( makeSdrEdgeLine2DeltaItem( nValue ) ); bModified = true; } - if( m_pMtrFldLine3->IsValueChangedFromSaved() ) + if (m_xMtrFldLine3->get_value_changed_from_saved()) { - nValue = GetCoreValue( *m_pMtrFldLine3, eUnit ); + nValue = GetCoreValue(*m_xMtrFldLine3, eUnit); rAttrs->Put( makeSdrEdgeLine3DeltaItem( nValue ) ); bModified = true; } - - sal_Int32 nPos = m_pLbType->GetSelectedEntryPos(); - if( m_pLbType->IsValueChangedFromSaved() ) + int nPos = m_xLbType->get_active(); + if (m_xLbType->get_value_changed_from_saved()) { - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + if (nPos != -1) { rAttrs->Put( SdrEdgeKindItem( static_cast<SdrEdgeKind>(nPos) ) ); bModified = true; @@ -379,8 +359,8 @@ void SvxConnectionPage::Construct() { DBG_ASSERT( pView, "No valid View transfer!" ); - m_pCtlPreview->SetView( pView ); - m_pCtlPreview->Construct(); + m_aCtlPreview.SetView(pView); + m_aCtlPreview.Construct(); } /************************************************************************* @@ -389,103 +369,92 @@ void SvxConnectionPage::Construct() |* \************************************************************************/ -VclPtr<SfxTabPage> SvxConnectionPage::Create( TabPageParent pWindow, - const SfxItemSet* rAttrs ) +VclPtr<SfxTabPage> SvxConnectionPage::Create(TabPageParent pParent, + const SfxItemSet* rAttrs) { - return VclPtr<SvxConnectionPage>::Create( pWindow.pParent, *rAttrs ); + return VclPtr<SvxConnectionPage>::Create(pParent, *rAttrs); } -IMPL_LINK( SvxConnectionPage, ChangeAttrListBoxHdl_Impl, ListBox&, r, void ) -{ - ChangeAttrHdl_Impl(&r); -} -IMPL_LINK( SvxConnectionPage, ChangeAttrEditHdl_Impl, Edit&, r, void ) +IMPL_LINK_NOARG(SvxConnectionPage, ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void) { - ChangeAttrHdl_Impl(&r); + int nPos = m_xLbType->get_active(); + if (nPos != -1) + { + aAttrSet.Put( SdrEdgeKindItem( static_cast<SdrEdgeKind>(nPos) ) ); + } + + m_aCtlPreview.SetAttributes(aAttrSet); + + // get the number of line displacements + sal_uInt16 nCount = m_aCtlPreview.GetLineDeltaCount(); + + m_xFtLine3->set_sensitive( nCount > 2 ); + m_xMtrFldLine3->set_sensitive( nCount > 2 ); + if( nCount > 2 ) + m_xMtrFldLine3->set_value(m_xMtrFldLine3->get_value(FUNIT_NONE), FUNIT_NONE); + else + m_xMtrFldLine3->set_text(""); + + m_xFtLine2->set_sensitive( nCount > 1 ); + m_xMtrFldLine2->set_sensitive( nCount > 1 ); + if( nCount > 1 ) + m_xMtrFldLine2->set_value(m_xMtrFldLine2->get_value(FUNIT_NONE), FUNIT_NONE); + else + m_xMtrFldLine2->set_text(""); + + m_xFtLine1->set_sensitive( nCount > 0 ); + m_xMtrFldLine1->set_sensitive( nCount > 0 ); + if( nCount > 0 ) + m_xMtrFldLine1->set_value(m_xMtrFldLine1->get_value(FUNIT_NONE), FUNIT_NONE); + else + m_xMtrFldLine1->set_text(""); } -void SvxConnectionPage::ChangeAttrHdl_Impl(void const * p) + +IMPL_LINK(SvxConnectionPage, ChangeAttrEditHdl_Impl, weld::MetricSpinButton&, r, void) { - if( p == m_pMtrFldHorz1 ) + if (&r == m_xMtrFldHorz1.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldHorz1, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldHorz1, eUnit); aAttrSet.Put( SdrEdgeNode1HorzDistItem( nValue ) ); } - if( p == m_pMtrFldHorz2 ) + if (&r == m_xMtrFldHorz2.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldHorz2, eUnit ); + sal_Int32 nValue = GetCoreValue( *m_xMtrFldHorz2, eUnit ); aAttrSet.Put( SdrEdgeNode2HorzDistItem( nValue ) ); } - if( p == m_pMtrFldVert1 ) + if (&r == m_xMtrFldVert1.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldVert1, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldVert1, eUnit); aAttrSet.Put( SdrEdgeNode1VertDistItem( nValue ) ); } - if( p == m_pMtrFldVert2 ) + if (&r == m_xMtrFldVert2.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldVert2, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldVert2, eUnit); aAttrSet.Put( SdrEdgeNode2VertDistItem( nValue ) ); } - if( p == m_pMtrFldLine1 ) + if (&r == m_xMtrFldLine1.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine1, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldLine1, eUnit); aAttrSet.Put( makeSdrEdgeLine1DeltaItem( nValue ) ); } - if( p == m_pMtrFldLine2 ) + if (&r == m_xMtrFldLine2.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine2, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldLine2, eUnit); aAttrSet.Put( makeSdrEdgeLine2DeltaItem( nValue ) ); } - if( p == m_pMtrFldLine3 ) + if (&r == m_xMtrFldLine3.get()) { - sal_Int32 nValue = GetCoreValue( *m_pMtrFldLine3, eUnit ); + sal_Int32 nValue = GetCoreValue(*m_xMtrFldLine3, eUnit); aAttrSet.Put( makeSdrEdgeLine3DeltaItem( nValue ) ); } - - if( p == m_pLbType ) - { - sal_Int32 nPos = m_pLbType->GetSelectedEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aAttrSet.Put( SdrEdgeKindItem( static_cast<SdrEdgeKind>(nPos) ) ); - } - } - - m_pCtlPreview->SetAttributes( aAttrSet ); - - if( p == m_pLbType ) - { - // get the number of line displacements - sal_uInt16 nCount = m_pCtlPreview->GetLineDeltaCount(); - - m_pFtLine3->Enable( nCount > 2 ); - m_pMtrFldLine3->Enable( nCount > 2 ); - if( nCount > 2 ) - m_pMtrFldLine3->SetValue( m_pMtrFldLine3->GetValue() ); - else - m_pMtrFldLine3->SetEmptyFieldValue(); - - m_pFtLine2->Enable( nCount > 1 ); - m_pMtrFldLine2->Enable( nCount > 1 ); - if( nCount > 1 ) - m_pMtrFldLine2->SetValue( m_pMtrFldLine2->GetValue() ); - else - m_pMtrFldLine2->SetEmptyFieldValue(); - - m_pFtLine1->Enable( nCount > 0 ); - m_pMtrFldLine1->Enable( nCount > 0 ); - if( nCount > 0 ) - m_pMtrFldLine1->SetValue( m_pMtrFldLine1->GetValue() ); - else - m_pMtrFldLine1->SetEmptyFieldValue(); - - } + m_aCtlPreview.SetAttributes(aAttrSet); } void SvxConnectionPage::FillTypeLB() @@ -500,12 +469,10 @@ void SvxConnectionPage::FillTypeLB() { const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>( pItem ); sal_uInt16 nCount = pEdgeKindItem->GetValueCount(); - OUString aStr; - for( sal_uInt16 i = 0; i < nCount; i++ ) { - aStr = pEdgeKindItem->GetValueTextByPos( i ); - m_pLbType->InsertEntry( aStr ); + OUString aStr = pEdgeKindItem->GetValueTextByPos(i); + m_xLbType->append_text(aStr); } } } diff --git a/cui/uiconfig/ui/connectortabpage.ui b/cui/uiconfig/ui/connectortabpage.ui index 40c7d2777719..7fab7a025659 100644 --- a/cui/uiconfig/ui/connectortabpage.ui +++ b/cui/uiconfig/ui/connectortabpage.ui @@ -1,13 +1,42 @@ <?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"/> <object class="GtkAdjustment" id="adjustment1"> <property name="upper">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkAdjustment" id="adjustment2"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment3"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="adjustment7"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="ConnectorTabPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -30,10 +59,10 @@ <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="connectortabpage|FT_TYPE">_Type:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">LB_TYPE</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -42,9 +71,9 @@ </packing> </child> <child> - <object class="GtkComboBox" id="LB_TYPE"> + <object class="GtkComboBoxText" id="LB_TYPE"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> </object> <packing> <property name="expand">False</property> @@ -81,10 +110,10 @@ <object class="GtkLabel" id="FT_LINE_1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_LINE_1">Line _1:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_LINE_1:0.00cm</property> + <property name="mnemonic_widget">MTR_FLD_LINE_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -95,10 +124,10 @@ <object class="GtkLabel" id="FT_LINE_2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_LINE_2">Line _2:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_LINE_2:0.00cm</property> + <property name="mnemonic_widget">MTR_FLD_LINE_2</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -109,10 +138,10 @@ <object class="GtkLabel" id="FT_LINE_3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_LINE_3">Line _3:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_LINE_3:0.00cm</property> + <property name="mnemonic_widget">MTR_FLD_LINE_3</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -120,9 +149,10 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LINE_1:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_LINE_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">adjustment1</property> <property name="digits">2</property> </object> @@ -132,10 +162,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LINE_2:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_LINE_2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> <packing> @@ -144,10 +175,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_LINE_3:0.00cm"> + <object class="GtkSpinButton" id="MTR_FLD_LINE_3"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> <packing> @@ -163,8 +195,8 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|label2">Line Skew</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -199,10 +231,10 @@ <object class="GtkLabel" id="FT_HORZ_1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_HORZ_1">_Begin horizontal:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_HORZ_1:0.00mm</property> + <property name="mnemonic_widget">MTR_FLD_HORZ_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -213,10 +245,10 @@ <object class="GtkLabel" id="FT_HORZ_2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_HORZ_2">End _horizontal:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_HORZ_2:0.00mm</property> + <property name="mnemonic_widget">MTR_FLD_HORZ_2</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -227,10 +259,10 @@ <object class="GtkLabel" id="FT_VERT_1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_VERT_1">Begin _vertical:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_VERT_1:0.00mm</property> + <property name="mnemonic_widget">MTR_FLD_VERT_1</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -241,10 +273,10 @@ <object class="GtkLabel" id="FT_VERT_2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|FT_VERT_2">_End vertical:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">MTR_FLD_VERT_2:0.00mm</property> + <property name="mnemonic_widget">MTR_FLD_VERT_2</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -252,10 +284,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_HORZ_1:0.00mm"> + <object class="GtkSpinButton" id="MTR_FLD_HORZ_1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> @@ -264,10 +297,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_HORZ_2:0.00mm"> + <object class="GtkSpinButton" id="MTR_FLD_HORZ_2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment5</property> <property name="digits">2</property> </object> <packing> @@ -276,10 +310,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_VERT_1:0.00mm"> + <object class="GtkSpinButton" id="MTR_FLD_VERT_1"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment6</property> <property name="digits">2</property> </object> <packing> @@ -288,10 +323,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="MTR_FLD_VERT_2:0.00mm"> + <object class="GtkSpinButton" id="MTR_FLD_VERT_2"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="adjustment">adjustment1</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment7</property> <property name="digits">2</property> </object> <packing> @@ -307,8 +343,8 @@ <object class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="connectortabpage|label3">Line Spacing</property> + <property name="xalign">0</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -329,15 +365,33 @@ </packing> </child> <child> - <object class="svxlo-SvxXConnectionPreview" id="CTL_PREVIEW:border"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes" context="connectortabpage|CTL_PREVIEW|tooltip_text">Preview</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="CTL_PREVIEW:border-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="connectortabpage|CTL_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_PREVIEW"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="tooltip_text" translatable="yes" context="connectortabpage|CTL_PREVIEW|tooltip_text">Preview</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="CTL_PREVIEW-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes" context="connectortabpage|CTL_PREVIEW-atkobject">Example</property> + </object> + </child> + </object> + </child> </object> </child> </object> |