Kaydet (Commit) 3120c972 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxConnectionPage

Change-Id: I155f0c037f0d1879cec4d0b511d60a276466b1bb
Reviewed-on: https://gerrit.libreoffice.org/61077
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 45c753af
...@@ -21,10 +21,8 @@ ...@@ -21,10 +21,8 @@
#include <svx/connctrl.hxx> #include <svx/connctrl.hxx>
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <vcl/fixed.hxx> #include <vcl/customweld.hxx>
#include <vcl/field.hxx> #include <vcl/weld.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/group.hxx>
#include <sfx2/basedlgs.hxx> #include <sfx2/basedlgs.hxx>
class SdrView; class SdrView;
...@@ -34,36 +32,33 @@ class SvxConnectionPage : public SfxTabPage ...@@ -34,36 +32,33 @@ class SvxConnectionPage : public SfxTabPage
{ {
private: private:
static const sal_uInt16 pRanges[]; 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; const SfxItemSet& rOutAttrs;
SfxItemSet aAttrSet; SfxItemSet aAttrSet;
const SdrView* pView; const SdrView* pView;
MapUnit eUnit; 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(); void FillTypeLB();
DECL_LINK( ChangeAttrEditHdl_Impl, Edit&, void ); DECL_LINK(ChangeAttrEditHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK( ChangeAttrListBoxHdl_Impl, ListBox&, void ); DECL_LINK(ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void);
void ChangeAttrHdl_Impl(void const *);
public: public:
SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs ); SvxConnectionPage(TabPageParent pWindow, const SfxItemSet& rInAttrs);
virtual ~SvxConnectionPage() override; virtual ~SvxConnectionPage() override;
virtual void dispose() override; virtual void dispose() override;
......
...@@ -68,29 +68,24 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet ...@@ -68,29 +68,24 @@ SvxConnectionDialog::SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet
|* |*
\************************************************************************/ \************************************************************************/
SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs ) SvxConnectionPage::SvxConnectionPage(TabPageParent pWindow, const SfxItemSet& rInAttrs)
: SfxTabPage(pWindow ,"ConnectorTabPage" ,"cui/ui/connectortabpage.ui" : SfxTabPage(pWindow, "cui/ui/connectortabpage.ui", "ConnectorTabPage", &rInAttrs)
,&rInAttrs)
, rOutAttrs(rInAttrs) , rOutAttrs(rInAttrs)
, aAttrSet(*rInAttrs.GetPool()) , aAttrSet(*rInAttrs.GetPool())
, pView(nullptr) , 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(); SfxItemPool* pPool = rOutAttrs.GetPool();
DBG_ASSERT( pPool, "Where is the pool" ); DBG_ASSERT( pPool, "Where is the pool" );
eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST ); eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST );
...@@ -98,36 +93,33 @@ SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rI ...@@ -98,36 +93,33 @@ SvxConnectionPage::SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rI
FillTypeLB(); FillTypeLB();
const FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); const FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
SetFieldUnit( *m_pMtrFldHorz1, eFUnit ); SetFieldUnit( *m_xMtrFldHorz1, eFUnit );
SetFieldUnit( *m_pMtrFldHorz2, eFUnit ); SetFieldUnit( *m_xMtrFldHorz2, eFUnit );
SetFieldUnit( *m_pMtrFldVert1, eFUnit ); SetFieldUnit( *m_xMtrFldVert1, eFUnit );
SetFieldUnit( *m_pMtrFldVert2, eFUnit ); SetFieldUnit( *m_xMtrFldVert2, eFUnit );
SetFieldUnit( *m_pMtrFldLine1, eFUnit ); SetFieldUnit( *m_xMtrFldLine1, eFUnit );
SetFieldUnit( *m_pMtrFldLine2, eFUnit ); SetFieldUnit( *m_xMtrFldLine2, eFUnit );
SetFieldUnit( *m_pMtrFldLine3, eFUnit ); SetFieldUnit( *m_xMtrFldLine3, eFUnit );
if( eFUnit == FUNIT_MM ) if( eFUnit == FUNIT_MM )
{ {
m_pMtrFldHorz1->SetSpinSize( 50 ); m_xMtrFldHorz1->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldHorz2->SetSpinSize( 50 ); m_xMtrFldHorz2->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldVert1->SetSpinSize( 50 ); m_xMtrFldVert1->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldVert2->SetSpinSize( 50 ); m_xMtrFldVert2->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldLine1->SetSpinSize( 50 ); m_xMtrFldLine1->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldLine2->SetSpinSize( 50 ); m_xMtrFldLine2->set_increments(50, 500, FUNIT_NONE);
m_pMtrFldLine3->SetSpinSize( 50 ); m_xMtrFldLine3->set_increments(50, 500, FUNIT_NONE);
} }
// disable 3D border Link<weld::MetricSpinButton&,void> aLink(LINK(this, SvxConnectionPage, ChangeAttrEditHdl_Impl));
m_pCtlPreview->SetBorderStyle(WindowBorderStyle::MONO); m_xMtrFldHorz1->connect_value_changed(aLink);
m_xMtrFldVert1->connect_value_changed(aLink);
Link<Edit&,void> aLink( LINK( this, SvxConnectionPage, ChangeAttrEditHdl_Impl ) ); m_xMtrFldHorz2->connect_value_changed(aLink);
m_pMtrFldHorz1->SetModifyHdl( aLink ); m_xMtrFldVert2->connect_value_changed(aLink);
m_pMtrFldVert1->SetModifyHdl( aLink ); m_xMtrFldLine1->connect_value_changed(aLink);
m_pMtrFldHorz2->SetModifyHdl( aLink ); m_xMtrFldLine2->connect_value_changed(aLink);
m_pMtrFldVert2->SetModifyHdl( aLink ); m_xMtrFldLine3->connect_value_changed(aLink);
m_pMtrFldLine1->SetModifyHdl( aLink ); m_xLbType->connect_changed(LINK(this, SvxConnectionPage, ChangeAttrListBoxHdl_Impl));
m_pMtrFldLine2->SetModifyHdl( aLink );
m_pMtrFldLine3->SetModifyHdl( aLink );
m_pLbType->SetSelectHdl( LINK( this, SvxConnectionPage, ChangeAttrListBoxHdl_Impl ) );
} }
SvxConnectionPage::~SvxConnectionPage() SvxConnectionPage::~SvxConnectionPage()
...@@ -137,18 +129,7 @@ SvxConnectionPage::~SvxConnectionPage() ...@@ -137,18 +129,7 @@ SvxConnectionPage::~SvxConnectionPage()
void SvxConnectionPage::dispose() void SvxConnectionPage::dispose()
{ {
m_pLbType.clear(); m_xCtlPreview.reset();
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();
SfxTabPage::dispose(); SfxTabPage::dispose();
} }
...@@ -169,12 +150,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -169,12 +150,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrEdgeNode1HorzDistItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrEdgeNode1HorzDistItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldHorz1, nValue, eUnit ); SetMetricValue(*m_xMtrFldHorz1, nValue, eUnit);
} }
else else
m_pMtrFldHorz1->SetEmptyFieldValue(); m_xMtrFldHorz1->set_text("");
m_pMtrFldHorz1->SaveValue(); m_xMtrFldHorz1->save_value();
// SdrEdgeNode2HorzDistItem // SdrEdgeNode2HorzDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2HORZDIST ); pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2HORZDIST );
...@@ -183,12 +164,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -183,12 +164,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrEdgeNode2HorzDistItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrEdgeNode2HorzDistItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldHorz2, nValue, eUnit ); SetMetricValue(*m_xMtrFldHorz2, nValue, eUnit);
} }
else else
m_pMtrFldHorz2->SetEmptyFieldValue(); m_xMtrFldHorz2->set_text("");
m_pMtrFldHorz2->SaveValue(); m_xMtrFldHorz2->save_value();
// SdrEdgeNode1VertDistItem // SdrEdgeNode1VertDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1VERTDIST ); pItem = GetItem( *rAttrs, SDRATTR_EDGENODE1VERTDIST );
...@@ -197,12 +178,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -197,12 +178,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrEdgeNode1VertDistItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrEdgeNode1VertDistItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldVert1, nValue, eUnit ); SetMetricValue(*m_xMtrFldVert1, nValue, eUnit);
} }
else else
m_pMtrFldVert1->SetEmptyFieldValue(); m_xMtrFldVert1->set_text("");
m_pMtrFldVert1->SaveValue(); m_xMtrFldVert1->save_value();
// SdrEdgeNode2VertDistItem // SdrEdgeNode2VertDistItem
pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2VERTDIST ); pItem = GetItem( *rAttrs, SDRATTR_EDGENODE2VERTDIST );
...@@ -211,12 +192,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -211,12 +192,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrEdgeNode2VertDistItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrEdgeNode2VertDistItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldVert2, nValue, eUnit ); SetMetricValue(*m_xMtrFldVert2, nValue, eUnit);
} }
else else
m_pMtrFldVert2->SetEmptyFieldValue(); m_xMtrFldVert2->set_text("");
m_pMtrFldVert2->SaveValue(); m_xMtrFldVert2->save_value();
// SdrEdgeLine1DeltaItem // SdrEdgeLine1DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE1DELTA ); pItem = GetItem( *rAttrs, SDRATTR_EDGELINE1DELTA );
...@@ -225,12 +206,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -225,12 +206,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldLine1, nValue, eUnit ); SetMetricValue(*m_xMtrFldLine1, nValue, eUnit);
} }
else else
m_pMtrFldLine1->SetEmptyFieldValue(); m_xMtrFldLine1->set_text("");
m_pMtrFldLine1->SaveValue(); m_xMtrFldLine1->save_value();
// SdrEdgeLine2DeltaItem // SdrEdgeLine2DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE2DELTA ); pItem = GetItem( *rAttrs, SDRATTR_EDGELINE2DELTA );
...@@ -239,12 +220,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -239,12 +220,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldLine2, nValue, eUnit ); SetMetricValue(*m_xMtrFldLine2, nValue, eUnit);
} }
else else
m_pMtrFldLine2->SetEmptyFieldValue(); m_xMtrFldLine2->set_text("");
m_pMtrFldLine2->SaveValue(); m_xMtrFldLine2->save_value();
// SdrEdgeLine3DeltaItem // SdrEdgeLine3DeltaItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINE3DELTA ); pItem = GetItem( *rAttrs, SDRATTR_EDGELINE3DELTA );
...@@ -253,12 +234,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -253,12 +234,12 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue(); long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
SetMetricValue( *m_pMtrFldLine3, nValue, eUnit ); SetMetricValue(*m_xMtrFldLine3, nValue, eUnit);
} }
else else
m_pMtrFldLine3->SetEmptyFieldValue(); m_xMtrFldLine3->set_text("");
m_pMtrFldLine3->SaveValue(); m_xMtrFldLine3->save_value();
// SdrEdgeLineDeltaAnzItem // SdrEdgeLineDeltaAnzItem
pItem = GetItem( *rAttrs, SDRATTR_EDGELINEDELTACOUNT ); pItem = GetItem( *rAttrs, SDRATTR_EDGELINEDELTACOUNT );
...@@ -269,21 +250,21 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -269,21 +250,21 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
sal_uInt16 nValue = static_cast<const SdrEdgeLineDeltaCountItem*>( pItem )->GetValue(); sal_uInt16 nValue = static_cast<const SdrEdgeLineDeltaCountItem*>( pItem )->GetValue();
if( nValue <= 2 ) if( nValue <= 2 )
{ {
m_pFtLine3->Enable( false ); m_xFtLine3->set_sensitive(false);
m_pMtrFldLine3->Enable( false ); m_xMtrFldLine3->set_sensitive(false);
m_pMtrFldLine3->SetEmptyFieldValue(); m_xMtrFldLine3->set_text("");
} }
if( nValue <= 1 ) if( nValue <= 1 )
{ {
m_pFtLine2->Enable( false ); m_xFtLine2->set_sensitive(false);
m_pMtrFldLine2->Enable( false ); m_xMtrFldLine2->set_sensitive(false);
m_pMtrFldLine2->SetEmptyFieldValue(); m_xMtrFldLine2->set_text("");
} }
if( nValue == 0 ) if( nValue == 0 )
{ {
m_pFtLine1->Enable( false ); m_xFtLine1->set_sensitive(false);
m_pMtrFldLine1->Enable( false ); m_xMtrFldLine1->set_sensitive(false);
m_pMtrFldLine1->SetEmptyFieldValue(); m_xMtrFldLine1->set_text("");
} }
} }
...@@ -294,11 +275,11 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs ) ...@@ -294,11 +275,11 @@ void SvxConnectionPage::Reset( const SfxItemSet* rAttrs )
if( pItem ) if( pItem )
{ {
SdrEdgeKind nValue = static_cast<const SdrEdgeKindItem*>( pItem )->GetValue(); 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 else
m_pLbType->SetNoSelection(); m_xLbType->set_active(-1);
m_pLbType->SaveValue(); m_xLbType->save_value();
} }
/************************************************************************* /*************************************************************************
...@@ -312,60 +293,59 @@ bool SvxConnectionPage::FillItemSet( SfxItemSet* rAttrs) ...@@ -312,60 +293,59 @@ bool SvxConnectionPage::FillItemSet( SfxItemSet* rAttrs)
bool bModified = false; bool bModified = false;
sal_Int32 nValue; 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 ) ); rAttrs->Put( SdrEdgeNode1HorzDistItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( SdrEdgeNode2HorzDistItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( SdrEdgeNode1VertDistItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( SdrEdgeNode2VertDistItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( makeSdrEdgeLine1DeltaItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( makeSdrEdgeLine2DeltaItem( nValue ) );
bModified = true; 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 ) ); rAttrs->Put( makeSdrEdgeLine3DeltaItem( nValue ) );
bModified = true; bModified = true;
} }
int nPos = m_xLbType->get_active();
sal_Int32 nPos = m_pLbType->GetSelectedEntryPos(); if (m_xLbType->get_value_changed_from_saved())
if( m_pLbType->IsValueChangedFromSaved() )
{ {
if( nPos != LISTBOX_ENTRY_NOTFOUND ) if (nPos != -1)
{ {
rAttrs->Put( SdrEdgeKindItem( static_cast<SdrEdgeKind>(nPos) ) ); rAttrs->Put( SdrEdgeKindItem( static_cast<SdrEdgeKind>(nPos) ) );
bModified = true; bModified = true;
...@@ -379,8 +359,8 @@ void SvxConnectionPage::Construct() ...@@ -379,8 +359,8 @@ void SvxConnectionPage::Construct()
{ {
DBG_ASSERT( pView, "No valid View transfer!" ); DBG_ASSERT( pView, "No valid View transfer!" );
m_pCtlPreview->SetView( pView ); m_aCtlPreview.SetView(pView);
m_pCtlPreview->Construct(); m_aCtlPreview.Construct();
} }
/************************************************************************* /*************************************************************************
...@@ -389,103 +369,92 @@ void SvxConnectionPage::Construct() ...@@ -389,103 +369,92 @@ void SvxConnectionPage::Construct()
|* |*
\************************************************************************/ \************************************************************************/
VclPtr<SfxTabPage> SvxConnectionPage::Create( TabPageParent pWindow, VclPtr<SfxTabPage> SvxConnectionPage::Create(TabPageParent pParent,
const SfxItemSet* rAttrs ) const SfxItemSet* rAttrs)
{ {
return VclPtr<SvxConnectionPage>::Create( pWindow.pParent, *rAttrs ); return VclPtr<SvxConnectionPage>::Create(pParent, *rAttrs);
} }
IMPL_LINK( SvxConnectionPage, ChangeAttrListBoxHdl_Impl, ListBox&, r, void ) IMPL_LINK_NOARG(SvxConnectionPage, ChangeAttrListBoxHdl_Impl, weld::ComboBox&, void)
{
ChangeAttrHdl_Impl(&r);
}
IMPL_LINK( SvxConnectionPage, ChangeAttrEditHdl_Impl, Edit&, r, 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 ) ); 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 ) ); 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 ) ); 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 ) ); 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 ) ); 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 ) ); 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 ) ); aAttrSet.Put( makeSdrEdgeLine3DeltaItem( nValue ) );
} }
m_aCtlPreview.SetAttributes(aAttrSet);
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();
}
} }
void SvxConnectionPage::FillTypeLB() void SvxConnectionPage::FillTypeLB()
...@@ -500,12 +469,10 @@ void SvxConnectionPage::FillTypeLB() ...@@ -500,12 +469,10 @@ void SvxConnectionPage::FillTypeLB()
{ {
const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>( pItem ); const SdrEdgeKindItem* pEdgeKindItem = static_cast<const SdrEdgeKindItem*>( pItem );
sal_uInt16 nCount = pEdgeKindItem->GetValueCount(); sal_uInt16 nCount = pEdgeKindItem->GetValueCount();
OUString aStr;
for( sal_uInt16 i = 0; i < nCount; i++ ) for( sal_uInt16 i = 0; i < nCount; i++ )
{ {
aStr = pEdgeKindItem->GetValueTextByPos( i ); OUString aStr = pEdgeKindItem->GetValueTextByPos(i);
m_pLbType->InsertEntry( aStr ); m_xLbType->append_text(aStr);
} }
} }
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="cui"> <interface domain="cui">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
</object> </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"> <object class="GtkBox" id="ConnectorTabPage">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
...@@ -30,10 +59,10 @@ ...@@ -30,10 +59,10 @@
<object class="GtkLabel" id="FT_TYPE"> <object class="GtkLabel" id="FT_TYPE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_TYPE">_Type:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">LB_TYPE</property> <property name="mnemonic_widget">LB_TYPE</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -42,9 +71,9 @@ ...@@ -42,9 +71,9 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBox" id="LB_TYPE"> <object class="GtkComboBoxText" id="LB_TYPE">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
...@@ -81,10 +110,10 @@ ...@@ -81,10 +110,10 @@
<object class="GtkLabel" id="FT_LINE_1"> <object class="GtkLabel" id="FT_LINE_1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_LINE_1">Line _1:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -95,10 +124,10 @@ ...@@ -95,10 +124,10 @@
<object class="GtkLabel" id="FT_LINE_2"> <object class="GtkLabel" id="FT_LINE_2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_LINE_2">Line _2:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -109,10 +138,10 @@ ...@@ -109,10 +138,10 @@
<object class="GtkLabel" id="FT_LINE_3"> <object class="GtkLabel" id="FT_LINE_3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_LINE_3">Line _3:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -120,9 +149,10 @@ ...@@ -120,9 +149,10 @@
</packing> </packing>
</child> </child>
<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="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="adjustment">adjustment1</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
...@@ -132,10 +162,11 @@ ...@@ -132,10 +162,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment2</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -144,10 +175,11 @@ ...@@ -144,10 +175,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment3</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -163,8 +195,8 @@ ...@@ -163,8 +195,8 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|label2">Line Skew</property>
<property name="xalign">0</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
...@@ -199,10 +231,10 @@ ...@@ -199,10 +231,10 @@
<object class="GtkLabel" id="FT_HORZ_1"> <object class="GtkLabel" id="FT_HORZ_1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_HORZ_1">_Begin horizontal:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -213,10 +245,10 @@ ...@@ -213,10 +245,10 @@
<object class="GtkLabel" id="FT_HORZ_2"> <object class="GtkLabel" id="FT_HORZ_2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_HORZ_2">End _horizontal:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -227,10 +259,10 @@ ...@@ -227,10 +259,10 @@
<object class="GtkLabel" id="FT_VERT_1"> <object class="GtkLabel" id="FT_VERT_1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_VERT_1">Begin _vertical:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -241,10 +273,10 @@ ...@@ -241,10 +273,10 @@
<object class="GtkLabel" id="FT_VERT_2"> <object class="GtkLabel" id="FT_VERT_2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|FT_VERT_2">_End vertical:</property>
<property name="use_underline">True</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> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -252,10 +284,11 @@ ...@@ -252,10 +284,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment4</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -264,10 +297,11 @@ ...@@ -264,10 +297,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment5</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -276,10 +310,11 @@ ...@@ -276,10 +310,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment6</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -288,10 +323,11 @@ ...@@ -288,10 +323,11 @@
</packing> </packing>
</child> </child>
<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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="adjustment">adjustment1</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment7</property>
<property name="digits">2</property> <property name="digits">2</property>
</object> </object>
<packing> <packing>
...@@ -307,8 +343,8 @@ ...@@ -307,8 +343,8 @@
<object class="GtkLabel" id="label3"> <object class="GtkLabel" id="label3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="connectortabpage|label3">Line Spacing</property>
<property name="xalign">0</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
...@@ -329,18 +365,36 @@ ...@@ -329,18 +365,36 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="svxlo-SvxXConnectionPreview" id="CTL_PREVIEW:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</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="tooltip_text" translatable="yes" context="connectortabpage|CTL_PREVIEW|tooltip_text">Preview</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="CTL_PREVIEW:border-atkobject"> <object class="AtkObject" id="CTL_PREVIEW-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="connectortabpage|CTL_PREVIEW-atkobject">Example</property> <property name="AtkObject::accessible-name" translatable="yes" context="connectortabpage|CTL_PREVIEW-atkobject">Example</property>
</object> </object>
</child> </child>
</object> </object>
</child>
</object>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
......
...@@ -200,9 +200,6 @@ ...@@ -200,9 +200,6 @@
<glade-widget-class title="SvxXLinePreview" name="svxlo-SvxXLinePreview" <glade-widget-class title="SvxXLinePreview" name="svxlo-SvxXLinePreview"
generic-name="Line Preview Window" parent="GtkDrawingArea" generic-name="Line Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
<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="Svx 3D Light Control" name="svxlo-SvxLightCtl3D" <glade-widget-class title="Svx 3D Light Control" name="svxlo-SvxLightCtl3D"
generic-name="3D Light Control" parent="GtkDrawingArea" generic-name="3D Light Control" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <tools/wintypes.hxx> #include <tools/wintypes.hxx>
#include <vcl/ctrl.hxx> #include <vcl/customweld.hxx>
#include <vcl/event.hxx> #include <vcl/event.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
#include <memory> #include <memory>
...@@ -40,34 +40,33 @@ class SdrPage; ...@@ -40,34 +40,33 @@ class SdrPage;
|* SvxXConnectionPreview |* SvxXConnectionPreview
|* |*
\************************************************************************/ \************************************************************************/
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXConnectionPreview : public Control class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXConnectionPreview : public weld::CustomWidgetController
{ {
friend class SvxConnectionPage; friend class SvxConnectionPage;
private: private:
MapMode aNewMapMode;
SdrEdgeObj* pEdgeObj; SdrEdgeObj* pEdgeObj;
std::unique_ptr<SdrPage> pSdrPage; std::unique_ptr<SdrPage> pSdrPage;
const SdrView* pView; const SdrView* pView;
SVX_DLLPRIVATE void SetStyles();
SVX_DLLPRIVATE void AdaptSize(); SVX_DLLPRIVATE void AdaptSize();
SVX_DLLPRIVATE void SetMapMode(const MapMode& rNewMapMode) { aNewMapMode = rNewMapMode; }
SVX_DLLPRIVATE const MapMode& GetMapMode() const { return aNewMapMode; }
public: public:
SvxXConnectionPreview( vcl::Window* pParent, WinBits nStyle); SvxXConnectionPreview();
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual ~SvxXConnectionPreview() override; virtual ~SvxXConnectionPreview() override;
virtual void dispose() override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void Resize() override; virtual void Resize() override;
virtual Size GetOptimalSize() const override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
void SetAttributes( const SfxItemSet& rInAttrs ); void SetAttributes( const SfxItemSet& rInAttrs );
sal_uInt16 GetLineDeltaCount(); sal_uInt16 GetLineDeltaCount();
void Construct(); void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; } void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
}; };
#endif // INCLUDED_SVX_CONNCTRL_HXX #endif // INCLUDED_SVX_CONNCTRL_HXX
......
...@@ -35,42 +35,32 @@ ...@@ -35,42 +35,32 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <memory> #include <memory>
SvxXConnectionPreview::SvxXConnectionPreview( vcl::Window* pParent, WinBits nStyle) SvxXConnectionPreview::SvxXConnectionPreview()
: Control(pParent, nStyle) : pEdgeObj(nullptr)
, pEdgeObj(nullptr)
, pView(nullptr) , pView(nullptr)
{ {
SetMapMode(MapMode(MapUnit::Map100thMM)); SetMapMode(MapMode(MapUnit::Map100thMM));
SetStyles();
} }
VCL_BUILDER_FACTORY_CONSTRUCTOR(SvxXConnectionPreview, 0) void SvxXConnectionPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
SvxXConnectionPreview::~SvxXConnectionPreview()
{ {
disposeOnce(); weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(118 , 121), MapMode(MapUnit::MapAppFont)));
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
SetOutputSizePixel(aSize);
} }
void SvxXConnectionPreview::dispose() SvxXConnectionPreview::~SvxXConnectionPreview()
{ {
pSdrPage.reset();
Control::dispose();
} }
void SvxXConnectionPreview::Resize() void SvxXConnectionPreview::Resize()
{ {
Control::Resize();
AdaptSize(); AdaptSize();
Invalidate(); Invalidate();
} }
Size SvxXConnectionPreview::GetOptimalSize() const
{
return LogicToPixel(Size(118 , 121), MapMode(MapUnit::MapAppFont));
}
void SvxXConnectionPreview::AdaptSize() void SvxXConnectionPreview::AdaptSize()
{ {
// Adapt size // Adapt size
...@@ -89,7 +79,7 @@ void SvxXConnectionPreview::AdaptSize() ...@@ -89,7 +79,7 @@ void SvxXConnectionPreview::AdaptSize()
MapMode aDisplayMap( aMapMode ); MapMode aDisplayMap( aMapMode );
Point aNewPos; Point aNewPos;
Size aNewSize; Size aNewSize;
const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap ); const Size aWinSize = GetDrawingArea()->get_ref_device().PixelToLogic(GetOutputSizePixel(), aDisplayMap);
const long nWidth = aWinSize.Width(); const long nWidth = aWinSize.Width();
const long nHeight = aWinSize.Height(); const long nHeight = aWinSize.Height();
if (aRect.GetHeight() == 0) if (aRect.GetHeight() == 0)
...@@ -123,7 +113,7 @@ void SvxXConnectionPreview::AdaptSize() ...@@ -123,7 +113,7 @@ void SvxXConnectionPreview::AdaptSize()
aNewPos.setX( ( nWidth - aNewSize.Width() ) >> 1 ); aNewPos.setX( ( nWidth - aNewSize.Width() ) >> 1 );
aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 ); aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 );
aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) ); aDisplayMap.SetOrigin(OutputDevice::LogicToLogic(aNewPos, aMapMode, aDisplayMap));
SetMapMode( aDisplayMap ); SetMapMode( aDisplayMap );
// Origin // Origin
...@@ -206,6 +196,14 @@ void SvxXConnectionPreview::Construct() ...@@ -206,6 +196,14 @@ void SvxXConnectionPreview::Construct()
void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{ {
rRenderContext.Push(PushFlags::ALL);
rRenderContext.SetMapMode(GetMapMode());
const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
rRenderContext.SetDrawMode(rStyles.GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
rRenderContext.SetBackground(Wallpaper(rStyles.GetFieldColor()));
if (pSdrPage) if (pSdrPage)
{ {
// This will not work anymore. To not start at Adam and Eve, i will // This will not work anymore. To not start at Adam and Eve, i will
...@@ -231,6 +229,8 @@ void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tool ...@@ -231,6 +229,8 @@ void SvxXConnectionPreview::Paint(vcl::RenderContext& rRenderContext, const tool
// do processing // do processing
aPainter.ProcessDisplay(aDisplayInfo); aPainter.ProcessDisplay(aDisplayInfo);
} }
rRenderContext.Pop();
} }
void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs ) void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs )
...@@ -240,7 +240,6 @@ void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs ) ...@@ -240,7 +240,6 @@ void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs )
Invalidate(); Invalidate();
} }
// Get number of lines which are offset based on the preview object // Get number of lines which are offset based on the preview object
sal_uInt16 SvxXConnectionPreview::GetLineDeltaCount() sal_uInt16 SvxXConnectionPreview::GetLineDeltaCount()
...@@ -291,7 +290,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -291,7 +290,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
aMapMode.SetScaleY( aYFrac ); aMapMode.SetScaleY( aYFrac );
SetMapMode( aMapMode ); SetMapMode( aMapMode );
Size aOutSize( GetOutputSize() ); Size aOutSize(GetOutputSizePixel());
aOutSize = GetDrawingArea()->get_ref_device().PixelToLogic(aOutSize);
Point aPt( aMapMode.GetOrigin() ); Point aPt( aMapMode.GetOrigin() );
long nX = static_cast<long>( ( static_cast<double>(aOutSize.Width()) - ( static_cast<double>(aOutSize.Width()) * static_cast<double>(*pMultFrac) ) ) / 2.0 + 0.5 ); long nX = static_cast<long>( ( static_cast<double>(aOutSize.Width()) - ( static_cast<double>(aOutSize.Width()) * static_cast<double>(*pMultFrac) ) ) / 2.0 + 0.5 );
...@@ -307,21 +307,4 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -307,21 +307,4 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
} }
} }
void SvxXConnectionPreview::SetStyles()
{
const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
SetBackground( Wallpaper( rStyles.GetFieldColor() ) );
}
void SvxXConnectionPreview::DataChanged( const DataChangedEvent& rDCEvt )
{
Control::DataChanged( rDCEvt );
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
SetStyles();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment