Kaydet (Commit) 27a5f7d3 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld TitlesAndObjectsTabPage

Change-Id: I071ddf117e44fab3b5f712198973c86a0fd8d206
Reviewed-on: https://gerrit.libreoffice.org/61798Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst ec548bce
...@@ -39,37 +39,34 @@ namespace chart ...@@ -39,37 +39,34 @@ namespace chart
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2; using namespace ::com::sun::star::chart2;
LegendPositionResources::LegendPositionResources(VclBuilderContainer& rParent) LegendPositionResources::LegendPositionResources(weld::Builder& rBuilder)
: m_xCC() //unused in this scenario : m_xRbtLeft(rBuilder.weld_radio_button("left"))
, m_pCbxShow( nullptr ) //unused in this scenario, assumed to be visible , m_xRbtRight(rBuilder.weld_radio_button("right"))
, m_xRbtTop(rBuilder.weld_radio_button("top"))
, m_xRbtBottom(rBuilder.weld_radio_button("bottom"))
{ {
rParent.get(m_pRbtLeft, "left");
rParent.get(m_pRbtRight, "right");
rParent.get(m_pRbtTop, "top");
rParent.get(m_pRbtBottom, "bottom");
impl_setRadioButtonToggleHdl(); impl_setRadioButtonToggleHdl();
} }
LegendPositionResources::LegendPositionResources(VclBuilderContainer& rParent, LegendPositionResources::LegendPositionResources(weld::Builder& rBuilder,
const uno::Reference< uno::XComponentContext >& xCC) const uno::Reference< uno::XComponentContext >& xCC)
: m_xCC(xCC) : m_xCC(xCC)
, m_xCbxShow(rBuilder.weld_check_button("show"))
, m_xRbtLeft(rBuilder.weld_radio_button("left"))
, m_xRbtRight(rBuilder.weld_radio_button("right"))
, m_xRbtTop(rBuilder.weld_radio_button("top"))
, m_xRbtBottom(rBuilder.weld_radio_button("bottom"))
{ {
rParent.get(m_pCbxShow, "show"); m_xCbxShow->connect_toggled( LINK( this, LegendPositionResources, PositionEnableHdl ) );
rParent.get(m_pRbtLeft, "left");
rParent.get(m_pRbtRight, "right");
rParent.get(m_pRbtTop, "top");
rParent.get(m_pRbtBottom, "bottom");
m_pCbxShow->SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) );
impl_setRadioButtonToggleHdl(); impl_setRadioButtonToggleHdl();
} }
void LegendPositionResources::impl_setRadioButtonToggleHdl() void LegendPositionResources::impl_setRadioButtonToggleHdl()
{ {
m_pRbtLeft->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) ); m_xRbtLeft->connect_toggled( LINK( this, LegendPositionResources, PositionChangeHdl ) );
m_pRbtTop->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) ); m_xRbtTop->connect_toggled( LINK( this, LegendPositionResources, PositionChangeHdl ) );
m_pRbtRight->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) ); m_xRbtRight->connect_toggled( LINK( this, LegendPositionResources, PositionChangeHdl ) );
m_pRbtBottom->SetToggleHdl( LINK( this, LegendPositionResources, PositionChangeHdl ) ); m_xRbtBottom->connect_toggled( LINK( this, LegendPositionResources, PositionChangeHdl ) );
} }
LegendPositionResources::~LegendPositionResources() LegendPositionResources::~LegendPositionResources()
...@@ -87,9 +84,9 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo ...@@ -87,9 +84,9 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo
//show //show
bool bShowLegend = false; bool bShowLegend = false;
xProp->getPropertyValue( "Show" ) >>= bShowLegend; xProp->getPropertyValue( "Show" ) >>= bShowLegend;
if (m_pCbxShow) if (m_xCbxShow)
m_pCbxShow->Check( bShowLegend ); m_xCbxShow->set_active( bShowLegend );
PositionEnableHdl(*m_pCbxShow); PositionEnableHdl(*m_xCbxShow);
//position //position
chart2::LegendPosition ePos; chart2::LegendPosition ePos;
...@@ -97,21 +94,20 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo ...@@ -97,21 +94,20 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo
switch( ePos ) switch( ePos )
{ {
case chart2::LegendPosition_LINE_START: case chart2::LegendPosition_LINE_START:
m_pRbtLeft->Check(); m_xRbtLeft->set_active(true);
break; break;
case chart2::LegendPosition_LINE_END: case chart2::LegendPosition_LINE_END:
m_pRbtRight->Check(); m_xRbtRight->set_active(true);
break; break;
case chart2::LegendPosition_PAGE_START: case chart2::LegendPosition_PAGE_START:
m_pRbtTop->Check(); m_xRbtTop->set_active(true);
break; break;
case chart2::LegendPosition_PAGE_END: case chart2::LegendPosition_PAGE_END:
m_pRbtBottom->Check(); m_xRbtBottom->set_active(true);
break; break;
case chart2::LegendPosition_CUSTOM: case chart2::LegendPosition_CUSTOM:
default: default:
m_pRbtRight->Check(); m_xRbtRight->set_active(true);
break; break;
} }
} }
...@@ -126,7 +122,7 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM ...@@ -126,7 +122,7 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM
{ {
try try
{ {
bool bShowLegend = m_pCbxShow && m_pCbxShow->IsChecked(); bool bShowLegend = m_xCbxShow && m_xCbxShow->get_active();
ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel.get()); ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel.get());
uno::Reference< beans::XPropertySet > xProp(LegendHelper::getLegend(rModel, m_xCC, bShowLegend), uno::UNO_QUERY); uno::Reference< beans::XPropertySet > xProp(LegendHelper::getLegend(rModel, m_xCC, bShowLegend), uno::UNO_QUERY);
if( xProp.is() ) if( xProp.is() )
...@@ -138,18 +134,18 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM ...@@ -138,18 +134,18 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM
chart2::LegendPosition eNewPos; chart2::LegendPosition eNewPos;
css::chart::ChartLegendExpansion eExp = css::chart::ChartLegendExpansion_HIGH; css::chart::ChartLegendExpansion eExp = css::chart::ChartLegendExpansion_HIGH;
if( m_pRbtLeft->IsChecked() ) if( m_xRbtLeft->get_active() )
eNewPos = chart2::LegendPosition_LINE_START; eNewPos = chart2::LegendPosition_LINE_START;
else if( m_pRbtRight->IsChecked() ) else if( m_xRbtRight->get_active() )
{ {
eNewPos = chart2::LegendPosition_LINE_END; eNewPos = chart2::LegendPosition_LINE_END;
} }
else if( m_pRbtTop->IsChecked() ) else if( m_xRbtTop->get_active() )
{ {
eNewPos = chart2::LegendPosition_PAGE_START; eNewPos = chart2::LegendPosition_PAGE_START;
eExp = css::chart::ChartLegendExpansion_WIDE; eExp = css::chart::ChartLegendExpansion_WIDE;
} }
else if( m_pRbtBottom->IsChecked() ) else if( m_xRbtBottom->get_active() )
{ {
eNewPos = chart2::LegendPosition_PAGE_END; eNewPos = chart2::LegendPosition_PAGE_END;
eExp = css::chart::ChartLegendExpansion_WIDE; eExp = css::chart::ChartLegendExpansion_WIDE;
...@@ -166,14 +162,14 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM ...@@ -166,14 +162,14 @@ void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XM
} }
} }
IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl, CheckBox&, void) IMPL_LINK_NOARG(LegendPositionResources, PositionEnableHdl, weld::ToggleButton&, void)
{ {
bool bEnable = m_pCbxShow == nullptr || m_pCbxShow->IsChecked(); bool bEnable = !m_xCbxShow || m_xCbxShow->get_active();
m_pRbtLeft->Enable( bEnable ); m_xRbtLeft->set_sensitive( bEnable );
m_pRbtTop->Enable( bEnable ); m_xRbtTop->set_sensitive( bEnable );
m_pRbtRight->Enable( bEnable ); m_xRbtRight->set_sensitive( bEnable );
m_pRbtBottom->Enable( bEnable ); m_xRbtBottom->set_sensitive( bEnable );
m_aChangeLink.Call(nullptr); m_aChangeLink.Call(nullptr);
} }
...@@ -187,51 +183,51 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs ) ...@@ -187,51 +183,51 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
switch( nLegendPosition ) switch( nLegendPosition )
{ {
case chart2::LegendPosition_LINE_START: case chart2::LegendPosition_LINE_START:
m_pRbtLeft->Check(); m_xRbtLeft->set_active(true);
break; break;
case chart2::LegendPosition_PAGE_START: case chart2::LegendPosition_PAGE_START:
m_pRbtTop->Check(); m_xRbtTop->set_active(true);
break; break;
case chart2::LegendPosition_LINE_END: case chart2::LegendPosition_LINE_END:
m_pRbtRight->Check(); m_xRbtRight->set_active(true);
break; break;
case chart2::LegendPosition_PAGE_END: case chart2::LegendPosition_PAGE_END:
m_pRbtBottom->Check(); m_xRbtBottom->set_active(true);
break; break;
default: default:
break; break;
} }
} }
if( m_pCbxShow && rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, true, &pPoolItem ) == SfxItemState::SET ) if( m_xCbxShow && rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, true, &pPoolItem ) == SfxItemState::SET )
{ {
bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
m_pCbxShow->Check(bShow); m_xCbxShow->set_active(bShow);
} }
} }
void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
{ {
chart2::LegendPosition nLegendPosition = chart2::LegendPosition_CUSTOM; chart2::LegendPosition nLegendPosition = chart2::LegendPosition_CUSTOM;
if( m_pRbtLeft->IsChecked() ) if( m_xRbtLeft->get_active() )
nLegendPosition = chart2::LegendPosition_LINE_START; nLegendPosition = chart2::LegendPosition_LINE_START;
else if( m_pRbtTop->IsChecked() ) else if( m_xRbtTop->get_active() )
nLegendPosition = chart2::LegendPosition_PAGE_START; nLegendPosition = chart2::LegendPosition_PAGE_START;
else if( m_pRbtRight->IsChecked() ) else if( m_xRbtRight->get_active() )
nLegendPosition = chart2::LegendPosition_LINE_END; nLegendPosition = chart2::LegendPosition_LINE_END;
else if( m_pRbtBottom->IsChecked() ) else if( m_xRbtBottom->get_active() )
nLegendPosition = chart2::LegendPosition_PAGE_END; nLegendPosition = chart2::LegendPosition_PAGE_END;
rOutAttrs.Put( SfxInt32Item(SCHATTR_LEGEND_POS, static_cast<sal_Int32>(nLegendPosition) ) ); rOutAttrs.Put( SfxInt32Item(SCHATTR_LEGEND_POS, static_cast<sal_Int32>(nLegendPosition) ) );
rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_pCbxShow == nullptr || m_pCbxShow->IsChecked()) ); rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, !m_xCbxShow || m_xCbxShow->get_active()) );
} }
IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton&, rRadio, void ) IMPL_LINK (LegendPositionResources, PositionChangeHdl, weld::ToggleButton&, rRadio, void)
{ {
//for each radio click there are coming two change events //for each radio click there are coming two change events
//first uncheck of previous button -> ignore that call //first uncheck of previous button -> ignore that call
//the second call gives the check of the new button //the second call gives the check of the new button
if( rRadio.IsChecked() ) if( rRadio.get_active() )
m_aChangeLink.Call(nullptr); m_aChangeLink.Call(nullptr);
} }
......
...@@ -25,127 +25,109 @@ ...@@ -25,127 +25,109 @@
namespace chart namespace chart
{ {
TitleResources::TitleResources( VclBuilderContainer& rBuilder, bool bShowSecondaryAxesTitle ) TitleResources::TitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesTitle)
: m_xFT_Main(rBuilder.weld_label("labelMainTitle"))
, m_xFT_Sub(rBuilder.weld_label("labelSubTitle"))
, m_xEd_Main(rBuilder.weld_entry("maintitle"))
, m_xEd_Sub(rBuilder.weld_entry("subtitle"))
, m_xFT_XAxis(rBuilder.weld_label("labelPrimaryXaxis"))
, m_xFT_YAxis(rBuilder.weld_label("labelPrimaryYaxis"))
, m_xFT_ZAxis(rBuilder.weld_label("labelPrimaryZaxis"))
, m_xEd_XAxis(rBuilder.weld_entry("primaryXaxis"))
, m_xEd_YAxis(rBuilder.weld_entry("primaryYaxis"))
, m_xEd_ZAxis(rBuilder.weld_entry("primaryZaxis"))
, m_xFT_SecondaryXAxis(rBuilder.weld_label("labelSecondaryXAxis"))
, m_xFT_SecondaryYAxis(rBuilder.weld_label("labelSecondaryYAxis"))
, m_xEd_SecondaryXAxis(rBuilder.weld_entry("secondaryXaxis"))
, m_xEd_SecondaryYAxis(rBuilder.weld_entry("secondaryYaxis"))
{ {
rBuilder.get( m_pFT_Main, "labelMainTitle" ); m_xFT_SecondaryXAxis->show( bShowSecondaryAxesTitle );
rBuilder.get( m_pFT_Sub, "labelSubTitle" ); m_xFT_SecondaryYAxis->show( bShowSecondaryAxesTitle );
rBuilder.get( m_pEd_Main, "maintitle" ); m_xEd_SecondaryXAxis->show( bShowSecondaryAxesTitle );
rBuilder.get( m_pEd_Sub, "subtitle" ); m_xEd_SecondaryYAxis->show( bShowSecondaryAxesTitle );
rBuilder.get( m_pFT_XAxis, "labelPrimaryXaxis" );
rBuilder.get( m_pFT_YAxis, "labelPrimaryYaxis" );
rBuilder.get( m_pFT_ZAxis, "labelPrimaryZaxis" );
rBuilder.get( m_pEd_XAxis, "primaryXaxis" );
rBuilder.get( m_pEd_YAxis, "primaryYaxis" );
rBuilder.get( m_pEd_ZAxis, "primaryZaxis" );
rBuilder.get( m_pFT_SecondaryXAxis, "labelSecondaryXAxis" );
rBuilder.get( m_pFT_SecondaryYAxis, "labelSecondaryYAxis" );
rBuilder.get( m_pEd_SecondaryXAxis, "secondaryXaxis" );
rBuilder.get( m_pEd_SecondaryYAxis, "secondaryYaxis" );
m_pFT_SecondaryXAxis->Show( bShowSecondaryAxesTitle );
m_pFT_SecondaryYAxis->Show( bShowSecondaryAxesTitle );
m_pEd_SecondaryXAxis->Show( bShowSecondaryAxesTitle );
m_pEd_SecondaryYAxis->Show( bShowSecondaryAxesTitle );
} }
TitleResources::~TitleResources() TitleResources::~TitleResources()
{ {
} }
void TitleResources::SetUpdateDataHdl( const Link<Edit&,void>& rLink ) void TitleResources::connect_changed( const Link<weld::Entry&,void>& rLink )
{ {
sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; m_xEd_Main->connect_changed( rLink );
m_xEd_Sub->connect_changed( rLink );
m_pEd_Main->EnableUpdateData( nTimeout ); m_xEd_XAxis->connect_changed( rLink );
m_pEd_Main->SetUpdateDataHdl( rLink ); m_xEd_YAxis->connect_changed( rLink );
m_xEd_ZAxis->connect_changed( rLink );
m_pEd_Sub->EnableUpdateData( nTimeout ); m_xEd_SecondaryXAxis->connect_changed( rLink );
m_pEd_Sub->SetUpdateDataHdl( rLink ); m_xEd_SecondaryYAxis->connect_changed( rLink );
m_pEd_XAxis->EnableUpdateData( nTimeout );
m_pEd_XAxis->SetUpdateDataHdl( rLink );
m_pEd_YAxis->EnableUpdateData( nTimeout );
m_pEd_YAxis->SetUpdateDataHdl( rLink );
m_pEd_ZAxis->EnableUpdateData( nTimeout );
m_pEd_ZAxis->SetUpdateDataHdl( rLink );
m_pEd_SecondaryXAxis->EnableUpdateData( nTimeout );
m_pEd_SecondaryXAxis->SetUpdateDataHdl( rLink );
m_pEd_SecondaryYAxis->EnableUpdateData( nTimeout );
m_pEd_SecondaryYAxis->SetUpdateDataHdl( rLink );
} }
bool TitleResources::IsModified() bool TitleResources::get_value_changed_from_saved()
{ {
return m_pEd_Main->IsModified() return m_xEd_Main->get_value_changed_from_saved()
|| m_pEd_Sub->IsModified() || m_xEd_Sub->get_value_changed_from_saved()
|| m_pEd_XAxis->IsModified() || m_xEd_XAxis->get_value_changed_from_saved()
|| m_pEd_YAxis->IsModified() || m_xEd_YAxis->get_value_changed_from_saved()
|| m_pEd_ZAxis->IsModified() || m_xEd_ZAxis->get_value_changed_from_saved()
|| m_pEd_SecondaryXAxis->IsModified() || m_xEd_SecondaryXAxis->get_value_changed_from_saved()
|| m_pEd_SecondaryYAxis->IsModified(); || m_xEd_SecondaryYAxis->get_value_changed_from_saved();
} }
void TitleResources::ClearModifyFlag() void TitleResources::save_value()
{ {
m_pEd_Main->ClearModifyFlag(); m_xEd_Main->save_value();
m_pEd_Sub->ClearModifyFlag(); m_xEd_Sub->save_value();
m_pEd_XAxis->ClearModifyFlag(); m_xEd_XAxis->save_value();
m_pEd_YAxis->ClearModifyFlag(); m_xEd_YAxis->save_value();
m_pEd_ZAxis->ClearModifyFlag(); m_xEd_ZAxis->save_value();
m_pEd_SecondaryXAxis->ClearModifyFlag(); m_xEd_SecondaryXAxis->save_value();
m_pEd_SecondaryYAxis->ClearModifyFlag(); m_xEd_SecondaryYAxis->save_value();
} }
void TitleResources::writeToResources( const TitleDialogData& rInput ) void TitleResources::writeToResources( const TitleDialogData& rInput )
{ {
m_pFT_Main->Enable( rInput.aPossibilityList[0] ); m_xFT_Main->set_sensitive( rInput.aPossibilityList[0] );
m_pFT_Sub->Enable( rInput.aPossibilityList[1] ); m_xFT_Sub->set_sensitive( rInput.aPossibilityList[1] );
m_pFT_XAxis->Enable( rInput.aPossibilityList[2] ); m_xFT_XAxis->set_sensitive( rInput.aPossibilityList[2] );
m_pFT_YAxis->Enable( rInput.aPossibilityList[3] ); m_xFT_YAxis->set_sensitive( rInput.aPossibilityList[3] );
m_pFT_ZAxis->Enable( rInput.aPossibilityList[4] ); m_xFT_ZAxis->set_sensitive( rInput.aPossibilityList[4] );
m_pFT_SecondaryXAxis->Enable( rInput.aPossibilityList[5] ); m_xFT_SecondaryXAxis->set_sensitive( rInput.aPossibilityList[5] );
m_pFT_SecondaryYAxis->Enable( rInput.aPossibilityList[6] ); m_xFT_SecondaryYAxis->set_sensitive( rInput.aPossibilityList[6] );
m_pEd_Main->Enable( rInput.aPossibilityList[0] ); m_xEd_Main->set_sensitive( rInput.aPossibilityList[0] );
m_pEd_Sub->Enable( rInput.aPossibilityList[1] ); m_xEd_Sub->set_sensitive( rInput.aPossibilityList[1] );
m_pEd_XAxis->Enable( rInput.aPossibilityList[2] ); m_xEd_XAxis->set_sensitive( rInput.aPossibilityList[2] );
m_pEd_YAxis->Enable( rInput.aPossibilityList[3] ); m_xEd_YAxis->set_sensitive( rInput.aPossibilityList[3] );
m_pEd_ZAxis->Enable( rInput.aPossibilityList[4] ); m_xEd_ZAxis->set_sensitive( rInput.aPossibilityList[4] );
m_pEd_SecondaryXAxis->Enable( rInput.aPossibilityList[5] ); m_xEd_SecondaryXAxis->set_sensitive( rInput.aPossibilityList[5] );
m_pEd_SecondaryYAxis->Enable( rInput.aPossibilityList[6] ); m_xEd_SecondaryYAxis->set_sensitive( rInput.aPossibilityList[6] );
m_pEd_Main->SetText(rInput.aTextList[0]); m_xEd_Main->set_text(rInput.aTextList[0]);
m_pEd_Sub->SetText(rInput.aTextList[1]); m_xEd_Sub->set_text(rInput.aTextList[1]);
m_pEd_XAxis->SetText(rInput.aTextList[2]); m_xEd_XAxis->set_text(rInput.aTextList[2]);
m_pEd_YAxis->SetText(rInput.aTextList[3]); m_xEd_YAxis->set_text(rInput.aTextList[3]);
m_pEd_ZAxis->SetText(rInput.aTextList[4]); m_xEd_ZAxis->set_text(rInput.aTextList[4]);
m_pEd_SecondaryXAxis->SetText(rInput.aTextList[5]); m_xEd_SecondaryXAxis->set_text(rInput.aTextList[5]);
m_pEd_SecondaryYAxis->SetText(rInput.aTextList[6]); m_xEd_SecondaryYAxis->set_text(rInput.aTextList[6]);
} }
void TitleResources::readFromResources( TitleDialogData& rOutput ) void TitleResources::readFromResources( TitleDialogData& rOutput )
{ {
rOutput.aExistenceList[0] = !m_pEd_Main->GetText().isEmpty(); rOutput.aExistenceList[0] = !m_xEd_Main->get_text().isEmpty();
rOutput.aExistenceList[1] = !m_pEd_Sub->GetText().isEmpty(); rOutput.aExistenceList[1] = !m_xEd_Sub->get_text().isEmpty();
rOutput.aExistenceList[2] = !m_pEd_XAxis->GetText().isEmpty(); rOutput.aExistenceList[2] = !m_xEd_XAxis->get_text().isEmpty();
rOutput.aExistenceList[3] = !m_pEd_YAxis->GetText().isEmpty(); rOutput.aExistenceList[3] = !m_xEd_YAxis->get_text().isEmpty();
rOutput.aExistenceList[4] = !m_pEd_ZAxis->GetText().isEmpty(); rOutput.aExistenceList[4] = !m_xEd_ZAxis->get_text().isEmpty();
rOutput.aExistenceList[5] = !m_pEd_SecondaryXAxis->GetText().isEmpty(); rOutput.aExistenceList[5] = !m_xEd_SecondaryXAxis->get_text().isEmpty();
rOutput.aExistenceList[6] = !m_pEd_SecondaryYAxis->GetText().isEmpty(); rOutput.aExistenceList[6] = !m_xEd_SecondaryYAxis->get_text().isEmpty();
rOutput.aTextList[0] = m_pEd_Main->GetText(); rOutput.aTextList[0] = m_xEd_Main->get_text();
rOutput.aTextList[1] = m_pEd_Sub->GetText(); rOutput.aTextList[1] = m_xEd_Sub->get_text();
rOutput.aTextList[2] = m_pEd_XAxis->GetText(); rOutput.aTextList[2] = m_xEd_XAxis->get_text();
rOutput.aTextList[3] = m_pEd_YAxis->GetText(); rOutput.aTextList[3] = m_xEd_YAxis->get_text();
rOutput.aTextList[4] = m_pEd_ZAxis->GetText(); rOutput.aTextList[4] = m_xEd_ZAxis->get_text();
rOutput.aTextList[5] = m_pEd_SecondaryXAxis->GetText(); rOutput.aTextList[5] = m_xEd_SecondaryXAxis->get_text();
rOutput.aTextList[6] = m_pEd_SecondaryYAxis->GetText(); rOutput.aTextList[6] = m_xEd_SecondaryYAxis->get_text();
} }
SchTitleResources::SchTitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesTitle) SchTitleResources::SchTitleResources(weld::Builder& rBuilder, bool bShowSecondaryAxesTitle)
......
...@@ -30,27 +30,26 @@ namespace chart ...@@ -30,27 +30,26 @@ namespace chart
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2; using namespace ::com::sun::star::chart2;
TitlesAndObjectsTabPage::TitlesAndObjectsTabPage( svt::OWizardMachine* pParent TitlesAndObjectsTabPage::TitlesAndObjectsTabPage(TabPageParent pParent,
, const uno::Reference< XChartDocument >& xChartModel const uno::Reference< XChartDocument >& xChartModel,
, const uno::Reference< uno::XComponentContext >& xContext ) const uno::Reference< uno::XComponentContext >& xContext )
: OWizardPage(pParent, "WizElementsPage", "modules/schart/ui/wizelementspage.ui") : OWizardPage(pParent, "modules/schart/ui/wizelementspage.ui", "WizElementsPage")
, m_xTitleResources(new TitleResources(*this, false)) , m_xTitleResources(new TitleResources(*m_xBuilder, false))
, m_xLegendPositionResources(new LegendPositionResources(*this, xContext)) , m_xLegendPositionResources(new LegendPositionResources(*m_xBuilder, xContext))
, m_xChartModel(xChartModel) , m_xChartModel(xChartModel)
, m_xCC(xContext) , m_xCC(xContext)
, m_bCommitToModel(true) , m_bCommitToModel(true)
, m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) ) , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
, m_xCB_Grid_X(m_xBuilder->weld_check_button("x"))
, m_xCB_Grid_Y(m_xBuilder->weld_check_button("y"))
, m_xCB_Grid_Z(m_xBuilder->weld_check_button("z"))
{ {
get(m_pCB_Grid_X, "x"); m_xTitleResources->connect_changed( LINK( this, TitlesAndObjectsTabPage, ChangeEditHdl ));
get(m_pCB_Grid_Y, "y");
get(m_pCB_Grid_Z, "z");
m_xTitleResources->SetUpdateDataHdl( LINK( this, TitlesAndObjectsTabPage, ChangeEditHdl ));
m_xLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl )); m_xLegendPositionResources->SetChangeHdl( LINK( this, TitlesAndObjectsTabPage, ChangeHdl ));
m_pCB_Grid_X->SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl )); m_xCB_Grid_X->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
m_pCB_Grid_Y->SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl )); m_xCB_Grid_Y->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
m_pCB_Grid_Z->SetToggleHdl( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl )); m_xCB_Grid_Z->connect_toggled( LINK( this, TitlesAndObjectsTabPage, ChangeCheckBoxHdl ));
} }
TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage() TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
...@@ -58,14 +57,6 @@ TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage() ...@@ -58,14 +57,6 @@ TitlesAndObjectsTabPage::~TitlesAndObjectsTabPage()
disposeOnce(); disposeOnce();
} }
void TitlesAndObjectsTabPage::dispose()
{
m_pCB_Grid_X.clear();
m_pCB_Grid_Y.clear();
m_pCB_Grid_Z.clear();
OWizardPage::dispose();
}
void TitlesAndObjectsTabPage::initializePage() void TitlesAndObjectsTabPage::initializePage()
{ {
m_bCommitToModel = false; m_bCommitToModel = false;
...@@ -89,12 +80,12 @@ void TitlesAndObjectsTabPage::initializePage() ...@@ -89,12 +80,12 @@ void TitlesAndObjectsTabPage::initializePage()
uno::Sequence< sal_Bool > aExistenceList; uno::Sequence< sal_Bool > aExistenceList;
AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, false ); AxisHelper::getAxisOrGridPossibilities( aPossibilityList, xDiagram, false );
AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, false ); AxisHelper::getAxisOrGridExcistence( aExistenceList, xDiagram, false );
m_pCB_Grid_X->Enable( aPossibilityList[0] ); m_xCB_Grid_X->set_sensitive( aPossibilityList[0] );
m_pCB_Grid_Y->Enable( aPossibilityList[1] ); m_xCB_Grid_Y->set_sensitive( aPossibilityList[1] );
m_pCB_Grid_Z->Enable( aPossibilityList[2] ); m_xCB_Grid_Z->set_sensitive( aPossibilityList[2] );
m_pCB_Grid_X->Check( aExistenceList[0] ); m_xCB_Grid_X->set_active( aExistenceList[0] );
m_pCB_Grid_Y->Check( aExistenceList[1] ); m_xCB_Grid_Y->set_active( aExistenceList[1] );
m_pCB_Grid_Z->Check( aExistenceList[2] ); m_xCB_Grid_Z->set_active( aExistenceList[2] );
} }
m_bCommitToModel = true; m_bCommitToModel = true;
...@@ -102,7 +93,7 @@ void TitlesAndObjectsTabPage::initializePage() ...@@ -102,7 +93,7 @@ void TitlesAndObjectsTabPage::initializePage()
bool TitlesAndObjectsTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ ) bool TitlesAndObjectsTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
{ {
if( m_xTitleResources->IsModified() ) //titles may have changed in the meanwhile if( m_xTitleResources->get_value_changed_from_saved() ) //titles may have changed in the meanwhile
commitToModel(); commitToModel();
return true;//return false if this page should not be left return true;//return false if this page should not be left
} }
...@@ -119,7 +110,7 @@ void TitlesAndObjectsTabPage::commitToModel() ...@@ -119,7 +110,7 @@ void TitlesAndObjectsTabPage::commitToModel()
TitleDialogData aTitleOutput; TitleDialogData aTitleOutput;
m_xTitleResources->readFromResources( aTitleOutput ); m_xTitleResources->readFromResources( aTitleOutput );
aTitleOutput.writeDifferenceToModel( xModel, m_xCC ); aTitleOutput.writeDifferenceToModel( xModel, m_xCC );
m_xTitleResources->ClearModifyFlag(); m_xTitleResources->save_value();
} }
//commit legend changes to model //commit legend changes to model
...@@ -133,23 +124,24 @@ void TitlesAndObjectsTabPage::commitToModel() ...@@ -133,23 +124,24 @@ void TitlesAndObjectsTabPage::commitToModel()
uno::Sequence< sal_Bool > aOldExistenceList; uno::Sequence< sal_Bool > aOldExistenceList;
AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, false ); AxisHelper::getAxisOrGridExcistence( aOldExistenceList, xDiagram, false );
uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList); uno::Sequence< sal_Bool > aNewExistenceList(aOldExistenceList);
aNewExistenceList[0] = m_pCB_Grid_X->IsChecked(); aNewExistenceList[0] = m_xCB_Grid_X->get_active();
aNewExistenceList[1] = m_pCB_Grid_Y->IsChecked(); aNewExistenceList[1] = m_xCB_Grid_Y->get_active();
aNewExistenceList[2] = m_pCB_Grid_Z->IsChecked(); aNewExistenceList[2] = m_xCB_Grid_Z->get_active();
AxisHelper::changeVisibilityOfGrids( xDiagram AxisHelper::changeVisibilityOfGrids( xDiagram
, aOldExistenceList, aNewExistenceList ); , aOldExistenceList, aNewExistenceList );
} }
} }
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeCheckBoxHdl, weld::ToggleButton&, void)
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeCheckBoxHdl, CheckBox&, void)
{ {
ChangeHdl(nullptr); ChangeHdl(nullptr);
} }
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeEditHdl, Edit&, void)
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeEditHdl, weld::Entry&, void)
{ {
ChangeHdl(nullptr); ChangeHdl(nullptr);
} }
IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeHdl, LinkParamNone*, void) IMPL_LINK_NOARG(TitlesAndObjectsTabPage, ChangeHdl, LinkParamNone*, void)
{ {
if( m_bCommitToModel ) if( m_bCommitToModel )
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp>
#include <svtools/wizardmachine.hxx> #include <svtools/wizardmachine.hxx>
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <memory> #include <memory>
...@@ -39,11 +37,10 @@ namespace chart ...@@ -39,11 +37,10 @@ namespace chart
class TitlesAndObjectsTabPage final : public svt::OWizardPage class TitlesAndObjectsTabPage final : public svt::OWizardPage
{ {
public: public:
TitlesAndObjectsTabPage( svt::OWizardMachine* pParent TitlesAndObjectsTabPage(TabPageParent pParent,
, const css::uno::Reference< css::chart2::XChartDocument >& xChartModel const css::uno::Reference< css::chart2::XChartDocument >& xChartModel,
, const css::uno::Reference< css::uno::XComponentContext >& xContext ); const css::uno::Reference< css::uno::XComponentContext >& xContext);
virtual ~TitlesAndObjectsTabPage() override; virtual ~TitlesAndObjectsTabPage() override;
virtual void dispose() override;
virtual void initializePage() override; virtual void initializePage() override;
virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) override; virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) override;
...@@ -52,21 +49,21 @@ public: ...@@ -52,21 +49,21 @@ public:
private: private:
void commitToModel(); void commitToModel();
DECL_LINK( ChangeHdl, LinkParamNone*, void ); DECL_LINK( ChangeHdl, LinkParamNone*, void );
DECL_LINK( ChangeEditHdl, Edit&, void ); DECL_LINK( ChangeEditHdl, weld::Entry&, void );
DECL_LINK( ChangeCheckBoxHdl, CheckBox&, void ); DECL_LINK( ChangeCheckBoxHdl, weld::ToggleButton&, void );
std::unique_ptr< TitleResources > m_xTitleResources; std::unique_ptr< TitleResources > m_xTitleResources;
std::unique_ptr< LegendPositionResources > m_xLegendPositionResources; std::unique_ptr< LegendPositionResources > m_xLegendPositionResources;
VclPtr<CheckBox> m_pCB_Grid_X;
VclPtr<CheckBox> m_pCB_Grid_Y;
VclPtr<CheckBox> m_pCB_Grid_Z;
css::uno::Reference< css::chart2::XChartDocument > m_xChartModel; css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
css::uno::Reference< css::uno::XComponentContext> m_xCC; css::uno::Reference< css::uno::XComponentContext> m_xCC;
bool m_bCommitToModel; bool m_bCommitToModel;
TimerTriggeredControllerLock m_aTimerTriggeredControllerLock; TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
std::unique_ptr<weld::CheckButton> m_xCB_Grid_X;
std::unique_ptr<weld::CheckButton> m_xCB_Grid_Y;
std::unique_ptr<weld::CheckButton> m_xCB_Grid_Z;
}; };
} //namespace chart } //namespace chart
......
...@@ -19,12 +19,9 @@ ...@@ -19,12 +19,9 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX
#include <vcl/button.hxx>
#include <vcl/weld.hxx> #include <vcl/weld.hxx>
#include <svl/itemset.hxx> #include <svl/itemset.hxx>
class VclBuilderContainer;
namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
...@@ -36,9 +33,9 @@ class LegendPositionResources final ...@@ -36,9 +33,9 @@ class LegendPositionResources final
public: public:
//constructor without Display checkbox //constructor without Display checkbox
LegendPositionResources(VclBuilderContainer& rParent); LegendPositionResources(weld::Builder& rBuilder);
//constructor inclusive Display checkbox //constructor inclusive Display checkbox
LegendPositionResources(VclBuilderContainer& rParent, const css::uno::Reference< LegendPositionResources(weld::Builder& rBuilder, const css::uno::Reference<
css::uno::XComponentContext>& xCC ); css::uno::XComponentContext>& xCC );
~LegendPositionResources(); ~LegendPositionResources();
...@@ -50,23 +47,21 @@ public: ...@@ -50,23 +47,21 @@ public:
void SetChangeHdl( const Link<LinkParamNone*,void>& rLink ); void SetChangeHdl( const Link<LinkParamNone*,void>& rLink );
DECL_LINK( PositionEnableHdl, CheckBox&, void ); DECL_LINK( PositionEnableHdl, weld::ToggleButton&, void );
DECL_LINK( PositionChangeHdl, RadioButton&, void ); DECL_LINK( PositionChangeHdl, weld::ToggleButton&, void );
private: private:
void impl_setRadioButtonToggleHdl(); void impl_setRadioButtonToggleHdl();
private: private:
css::uno::Reference< css::uno::XComponentContext> m_xCC; css::uno::Reference< css::uno::XComponentContext> m_xCC;
VclPtr<CheckBox> m_pCbxShow;
VclPtr<RadioButton> m_pRbtLeft;
VclPtr<RadioButton> m_pRbtRight;
VclPtr<RadioButton> m_pRbtTop;
VclPtr<RadioButton> m_pRbtBottom;
Link<LinkParamNone*,void> m_aChangeLink; Link<LinkParamNone*,void> m_aChangeLink;
std::unique_ptr<weld::CheckButton> m_xCbxShow;
std::unique_ptr<weld::RadioButton> m_xRbtLeft;
std::unique_ptr<weld::RadioButton> m_xRbtRight;
std::unique_ptr<weld::RadioButton> m_xRbtTop;
std::unique_ptr<weld::RadioButton> m_xRbtBottom;
}; };
......
...@@ -20,45 +20,41 @@ ...@@ -20,45 +20,41 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX
#include "TitleDialogData.hxx" #include "TitleDialogData.hxx"
#include <vcl/fixed.hxx>
#include <vcl/weld.hxx> #include <vcl/weld.hxx>
class VclBuilderContainer;
class Edit;
namespace chart namespace chart
{ {
class TitleResources final class TitleResources final
{ {
public: public:
TitleResources(VclBuilderContainer& rParent, bool bShowSecondaryAxesTitle); TitleResources(weld::Builder& rParent, bool bShowSecondaryAxesTitle);
~TitleResources(); ~TitleResources();
void writeToResources( const TitleDialogData& rInput ); void writeToResources( const TitleDialogData& rInput );
void readFromResources( TitleDialogData& rOutput ); void readFromResources( TitleDialogData& rOutput );
void SetUpdateDataHdl( const Link<Edit&,void>& rLink ); void connect_changed( const Link<weld::Entry&,void>& rLink );
bool IsModified(); bool get_value_changed_from_saved();
void ClearModifyFlag(); void save_value();
private: private:
VclPtr<FixedText> m_pFT_Main; std::unique_ptr<weld::Label> m_xFT_Main;
VclPtr<FixedText> m_pFT_Sub; std::unique_ptr<weld::Label> m_xFT_Sub;
VclPtr<Edit> m_pEd_Main; std::unique_ptr<weld::Entry> m_xEd_Main;
VclPtr<Edit> m_pEd_Sub; std::unique_ptr<weld::Entry> m_xEd_Sub;
VclPtr<FixedText> m_pFT_XAxis; std::unique_ptr<weld::Label> m_xFT_XAxis;
VclPtr<FixedText> m_pFT_YAxis; std::unique_ptr<weld::Label> m_xFT_YAxis;
VclPtr<FixedText> m_pFT_ZAxis; std::unique_ptr<weld::Label> m_xFT_ZAxis;
VclPtr<Edit> m_pEd_XAxis; std::unique_ptr<weld::Entry> m_xEd_XAxis;
VclPtr<Edit> m_pEd_YAxis; std::unique_ptr<weld::Entry> m_xEd_YAxis;
VclPtr<Edit> m_pEd_ZAxis; std::unique_ptr<weld::Entry> m_xEd_ZAxis;
VclPtr<FixedText> m_pFT_SecondaryXAxis; std::unique_ptr<weld::Label> m_xFT_SecondaryXAxis;
VclPtr<FixedText> m_pFT_SecondaryYAxis; std::unique_ptr<weld::Label> m_xFT_SecondaryYAxis;
VclPtr<Edit> m_pEd_SecondaryXAxis; std::unique_ptr<weld::Entry> m_xEd_SecondaryXAxis;
VclPtr<Edit> m_pEd_SecondaryYAxis; std::unique_ptr<weld::Entry> m_xEd_SecondaryYAxis;
}; };
class SchTitleResources final class SchTitleResources final
......
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