2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-17 12:30:48 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
#include "tp_RangeChooser.hxx"
|
2017-10-23 22:44:16 +02:00
|
|
|
#include <DataSourceHelper.hxx>
|
2007-05-22 16:47:43 +00:00
|
|
|
#include "ChartTypeTemplateProvider.hxx"
|
|
|
|
#include "DialogModel.hxx"
|
2017-10-23 22:44:16 +02:00
|
|
|
#include <RangeSelectionHelper.hxx>
|
2018-10-08 02:29:37 +02:00
|
|
|
#include <TabPageNotifiable.hxx>
|
2018-12-22 11:35:30 +01:00
|
|
|
#include <com/sun/star/beans/PropertyState.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
2015-06-02 09:02:35 +02:00
|
|
|
#include <svtools/miscopt.hxx>
|
2018-11-12 20:55:41 +01:00
|
|
|
#include <osl/diagnose.h>
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
2013-12-28 21:52:55 -02:00
|
|
|
void lcl_ShowChooserButton(
|
2018-10-15 15:09:32 +01:00
|
|
|
weld::Button& rChooserButton,
|
2013-12-28 21:52:55 -02:00
|
|
|
bool bShow)
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
if( rChooserButton.get_visible() != bShow )
|
2013-12-28 21:52:55 -02:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
rChooserButton.show( bShow );
|
2013-12-28 21:52:55 -02:00
|
|
|
}
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
2013-12-28 21:52:55 -02:00
|
|
|
|
2018-11-26 20:30:25 +00:00
|
|
|
void lcl_enableRangeChoosing(bool bEnable, Dialog * pDialog)
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
2013-12-28 21:52:55 -02:00
|
|
|
if( pDialog )
|
|
|
|
{
|
2015-04-24 12:25:01 +02:00
|
|
|
pDialog->SetModalInputMode( !bEnable );
|
2018-11-26 20:30:25 +00:00
|
|
|
pDialog->Show(!bEnable);
|
2013-12-28 21:52:55 -02:00
|
|
|
}
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
2013-12-28 21:52:55 -02:00
|
|
|
|
2018-11-26 20:30:25 +00:00
|
|
|
void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pDialog)
|
|
|
|
{
|
|
|
|
if (!pDialog)
|
|
|
|
return;
|
|
|
|
weld::Dialog* pDlg = pDialog->getDialog();
|
|
|
|
pDlg->set_modal(!bEnable);
|
|
|
|
pDlg->show(!bEnable);
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:47:43 +00:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::chart2;
|
|
|
|
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
RangeChooserTabPage::RangeChooserTabPage(TabPageParent pParent, DialogModel & rDialogModel,
|
|
|
|
ChartTypeTemplateProvider* pTemplateProvider,
|
2018-11-26 20:30:25 +00:00
|
|
|
Dialog* pParentDialog, bool bHideDescription /* = false */)
|
2018-10-15 15:09:32 +01:00
|
|
|
: OWizardPage(pParent, "modules/schart/ui/tp_RangeChooser.ui", "tp_RangeChooser")
|
|
|
|
, m_nChangingControlCalls(0)
|
|
|
|
, m_bIsDirty(false)
|
|
|
|
, m_aLastValidRangeString()
|
|
|
|
, m_pTemplateProvider(pTemplateProvider)
|
|
|
|
, m_rDialogModel( rDialogModel )
|
2018-11-26 20:30:25 +00:00
|
|
|
, m_pParentDialog(pParentDialog)
|
|
|
|
, m_pParentController(pParent.pController)
|
|
|
|
, m_pTabPageNotifiable(pParentDialog ? dynamic_cast<TabPageNotifiable*>(pParentDialog)
|
|
|
|
: dynamic_cast<TabPageNotifiable*>(m_pParentController))
|
2018-10-15 15:09:32 +01:00
|
|
|
, m_xFT_Caption(m_xBuilder->weld_label("FT_CAPTION_FOR_WIZARD"))
|
|
|
|
, m_xFT_Range(m_xBuilder->weld_label("FT_RANGE"))
|
|
|
|
, m_xED_Range(m_xBuilder->weld_entry("ED_RANGE"))
|
|
|
|
, m_xIB_Range(m_xBuilder->weld_button("IB_RANGE"))
|
|
|
|
, m_xRB_Rows(m_xBuilder->weld_radio_button("RB_DATAROWS"))
|
|
|
|
, m_xRB_Columns(m_xBuilder->weld_radio_button("RB_DATACOLS"))
|
|
|
|
, m_xCB_FirstRowAsLabel(m_xBuilder->weld_check_button("CB_FIRST_ROW_ASLABELS"))
|
|
|
|
, m_xCB_FirstColumnAsLabel(m_xBuilder->weld_check_button("CB_FIRST_COLUMN_ASLABELS"))
|
|
|
|
, m_xFTTitle(m_xBuilder->weld_label("STR_PAGE_DATA_RANGE"))
|
|
|
|
, m_xFL_TimeBased(m_xBuilder->weld_widget("separator1"))
|
|
|
|
, m_xCB_TimeBased(m_xBuilder->weld_check_button("CB_TIME_BASED"))
|
|
|
|
, m_xFT_TimeStart(m_xBuilder->weld_label("label1"))
|
|
|
|
, m_xEd_TimeStart(m_xBuilder->weld_entry("ED_TIME_BASED_START"))
|
|
|
|
, m_xFT_TimeEnd(m_xBuilder->weld_label("label2"))
|
|
|
|
, m_xEd_TimeEnd(m_xBuilder->weld_entry("ED_TIME_BASED_END"))
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xFT_Caption->show(!bHideDescription);
|
|
|
|
|
|
|
|
SetText(m_xFTTitle->get_label());// OH:remove later with dialog
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
// set defaults as long as DetectArguments does not work
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xRB_Columns->set_active(true);
|
|
|
|
m_xCB_FirstColumnAsLabel->set_active(true);
|
|
|
|
m_xCB_FirstRowAsLabel->set_active(true);
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
// BM: Note, that the range selection is not available, if there is no view.
|
|
|
|
// This happens for charts having their own embedded spreadsheet. If you
|
|
|
|
// force to get the range selection here, this would mean when entering this
|
|
|
|
// page the calc view would be created in this case. So, I enable the
|
|
|
|
// button here, and in the worst case nothing happens when it is pressed.
|
|
|
|
// Not nice, but I see no better solution for the moment.
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xIB_Range->connect_clicked( LINK( this, RangeChooserTabPage, ChooseRangeHdl ));
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xED_Range->connect_changed( LINK( this, RangeChooserTabPage, ControlEditedHdl ));
|
|
|
|
m_xRB_Rows->connect_toggled( LINK( this, RangeChooserTabPage, ControlChangedRadioHdl ) );
|
|
|
|
m_xCB_FirstRowAsLabel->connect_toggled( LINK( this, RangeChooserTabPage, ControlChangedCheckBoxHdl ) );
|
|
|
|
m_xCB_FirstColumnAsLabel->connect_toggled( LINK( this, RangeChooserTabPage, ControlChangedCheckBoxHdl ) );
|
|
|
|
m_xCB_TimeBased->connect_toggled( LINK( this, RangeChooserTabPage, ControlChangedCheckBoxHdl ) );
|
|
|
|
m_xEd_TimeStart->connect_changed( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
|
|
|
|
m_xEd_TimeEnd->connect_changed( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
|
2015-06-02 09:02:35 +02:00
|
|
|
|
|
|
|
SvtMiscOptions aOpts;
|
|
|
|
if ( !aOpts.IsExperimentalMode() )
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xFL_TimeBased->hide();
|
|
|
|
m_xCB_TimeBased->hide();
|
|
|
|
m_xFT_TimeStart->hide();
|
|
|
|
m_xEd_TimeStart->hide();
|
|
|
|
m_xFT_TimeEnd->hide();
|
|
|
|
m_xEd_TimeEnd->hide();
|
2015-06-02 09:02:35 +02:00
|
|
|
}
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RangeChooserTabPage::~RangeChooserTabPage()
|
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
void RangeChooserTabPage::dispose()
|
|
|
|
{
|
|
|
|
m_pParentDialog.clear();
|
|
|
|
OWizardPage::dispose();
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:47:43 +00:00
|
|
|
void RangeChooserTabPage::ActivatePage()
|
|
|
|
{
|
|
|
|
OWizardPage::ActivatePage();
|
|
|
|
initControlsFromModel();
|
2018-11-26 20:30:25 +00:00
|
|
|
m_xED_Range->grab_focus();
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RangeChooserTabPage::initControlsFromModel()
|
|
|
|
{
|
|
|
|
m_nChangingControlCalls++;
|
|
|
|
|
|
|
|
if(m_pTemplateProvider)
|
|
|
|
m_xCurrentChartTypeTemplate = m_pTemplateProvider->getCurrentTemplate();
|
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
bool bUseColumns = !m_xRB_Rows->get_active();
|
|
|
|
bool bFirstCellAsLabel = bUseColumns ? m_xCB_FirstRowAsLabel->get_active() : m_xCB_FirstColumnAsLabel->get_active();
|
|
|
|
bool bHasCategories = bUseColumns ? m_xCB_FirstColumnAsLabel->get_active() : m_xCB_FirstRowAsLabel->get_active();
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
bool bIsValid = m_rDialogModel.allArgumentsForRectRangeDetected();
|
|
|
|
if( bIsValid )
|
2013-12-28 21:52:55 -02:00
|
|
|
m_rDialogModel.detectArguments(m_aLastValidRangeString, bUseColumns, bFirstCellAsLabel, bHasCategories );
|
2007-05-22 16:47:43 +00:00
|
|
|
else
|
2014-12-18 13:21:05 +01:00
|
|
|
m_aLastValidRangeString.clear();
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xED_Range->set_text( m_aLastValidRangeString );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xRB_Rows->set_active( !bUseColumns );
|
|
|
|
m_xRB_Columns->set_active( bUseColumns );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xCB_FirstRowAsLabel->set_active( m_xRB_Rows->get_active()?bHasCategories:bFirstCellAsLabel );
|
|
|
|
m_xCB_FirstColumnAsLabel->set_active( m_xRB_Columns->get_active()?bHasCategories:bFirstCellAsLabel );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
isValid();
|
|
|
|
|
|
|
|
m_nChangingControlCalls--;
|
|
|
|
}
|
|
|
|
|
2009-08-26 12:47:18 +00:00
|
|
|
void RangeChooserTabPage::DeactivatePage()
|
|
|
|
{
|
|
|
|
commitPage();
|
|
|
|
svt::OWizardPage::DeactivatePage();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RangeChooserTabPage::commitPage()
|
|
|
|
{
|
2010-05-25 10:17:24 +02:00
|
|
|
commitPage(::svt::WizardTypes::eFinish);
|
2009-08-26 12:47:18 +00:00
|
|
|
}
|
|
|
|
|
2014-03-25 14:20:18 +02:00
|
|
|
bool RangeChooserTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
|
2009-08-26 12:47:18 +00:00
|
|
|
{
|
|
|
|
//ranges may have been edited in the meanwhile (dirty is true in that case here)
|
|
|
|
if( isValid() )
|
|
|
|
{
|
|
|
|
changeDialogModelAccordingToControls();
|
2014-03-25 14:20:18 +02:00
|
|
|
return true; // return false if this page should not be left
|
2009-08-26 12:47:18 +00:00
|
|
|
}
|
|
|
|
else
|
2014-03-25 14:20:18 +02:00
|
|
|
return false;
|
2009-08-26 12:47:18 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:47:43 +00:00
|
|
|
void RangeChooserTabPage::changeDialogModelAccordingToControls()
|
|
|
|
{
|
|
|
|
if(m_nChangingControlCalls>0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( !m_xCurrentChartTypeTemplate.is() )
|
|
|
|
{
|
|
|
|
if(m_pTemplateProvider)
|
|
|
|
m_xCurrentChartTypeTemplate.set( m_pTemplateProvider->getCurrentTemplate());
|
|
|
|
if( !m_xCurrentChartTypeTemplate.is())
|
|
|
|
{
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL( "Need a template to change data source" );
|
2007-05-22 16:47:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-21 11:13:07 +00:00
|
|
|
if( m_bIsDirty )
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
bool bFirstCellAsLabel = ( m_xCB_FirstColumnAsLabel->get_active() && !m_xRB_Columns->get_active() )
|
|
|
|
|| ( m_xCB_FirstRowAsLabel->get_active() && !m_xRB_Rows->get_active() );
|
|
|
|
bool bHasCategories = ( m_xCB_FirstColumnAsLabel->get_active() && m_xRB_Columns->get_active() )
|
|
|
|
|| ( m_xCB_FirstRowAsLabel->get_active() && m_xRB_Rows->get_active() );
|
|
|
|
bool bTimeBased = m_xCB_TimeBased->get_active();
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
Sequence< beans::PropertyValue > aArguments(
|
|
|
|
DataSourceHelper::createArguments(
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xRB_Columns->get_active(), bFirstCellAsLabel, bHasCategories ) );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2013-12-31 16:05:10 +01:00
|
|
|
if(bTimeBased)
|
|
|
|
{
|
|
|
|
aArguments.realloc( aArguments.getLength() + 1 );
|
|
|
|
aArguments[aArguments.getLength() - 1] =
|
2017-02-03 08:54:47 +02:00
|
|
|
beans::PropertyValue( "TimeBased", -1, uno::Any(bTimeBased),
|
2013-12-31 16:05:10 +01:00
|
|
|
beans::PropertyState_DIRECT_VALUE );
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:47:43 +00:00
|
|
|
// only if range is valid
|
2018-10-15 15:09:32 +01:00
|
|
|
if( m_aLastValidRangeString == m_xED_Range->get_text())
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
|
|
|
m_rDialogModel.setTemplate( m_xCurrentChartTypeTemplate );
|
|
|
|
aArguments.realloc( aArguments.getLength() + 1 );
|
|
|
|
aArguments[aArguments.getLength() - 1] =
|
2012-10-06 23:58:35 -03:00
|
|
|
beans::PropertyValue( "CellRangeRepresentation" , -1,
|
2017-02-03 08:54:47 +02:00
|
|
|
uno::Any( m_aLastValidRangeString ),
|
2007-05-22 16:47:43 +00:00
|
|
|
beans::PropertyState_DIRECT_VALUE );
|
|
|
|
m_rDialogModel.setData( aArguments );
|
|
|
|
m_bIsDirty = false;
|
2014-01-02 08:04:03 +01:00
|
|
|
|
|
|
|
if(bTimeBased)
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
sal_Int32 nStart = m_xEd_TimeStart->get_text().toInt32();
|
|
|
|
sal_Int32 nEnd = m_xEd_TimeEnd->get_text().toInt32();
|
2014-01-04 11:16:06 +01:00
|
|
|
m_rDialogModel.setTimeBasedRange(true, nStart, nEnd);
|
2014-01-02 08:04:03 +01:00
|
|
|
}
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//@todo warn user that the selected range is not valid
|
|
|
|
//@todo better: disable OK-Button if range is invalid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RangeChooserTabPage::isValid()
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
OUString aRange( m_xED_Range->get_text());
|
|
|
|
bool bFirstCellAsLabel = ( m_xCB_FirstColumnAsLabel->get_active() && !m_xRB_Columns->get_active() )
|
|
|
|
|| ( m_xCB_FirstRowAsLabel->get_active() && !m_xRB_Rows->get_active() );
|
|
|
|
bool bHasCategories = ( m_xCB_FirstColumnAsLabel->get_active() && m_xRB_Columns->get_active() )
|
|
|
|
|| ( m_xCB_FirstRowAsLabel->get_active() && m_xRB_Rows->get_active() );
|
2011-12-10 22:03:11 -02:00
|
|
|
bool bIsValid = ( aRange.isEmpty() ) ||
|
2007-07-25 07:37:07 +00:00
|
|
|
m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
|
|
|
|
DataSourceHelper::createArguments(
|
2018-10-15 15:09:32 +01:00
|
|
|
aRange, Sequence< sal_Int32 >(), m_xRB_Columns->get_active(), bFirstCellAsLabel, bHasCategories ));
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
if( bIsValid )
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xED_Range->set_error(false);
|
|
|
|
m_xED_Range->set_error(false);
|
2007-05-22 16:47:43 +00:00
|
|
|
if( m_pTabPageNotifiable )
|
|
|
|
m_pTabPageNotifiable->setValidPage( this );
|
|
|
|
m_aLastValidRangeString = aRange;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xED_Range->set_error(true);
|
|
|
|
m_xED_Range->set_error(true);
|
2007-05-22 16:47:43 +00:00
|
|
|
if( m_pTabPageNotifiable )
|
|
|
|
m_pTabPageNotifiable->setInvalidPage( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// enable/disable controls
|
2007-07-25 07:37:07 +00:00
|
|
|
// #i79531# if the range is valid but an action of one of these buttons
|
|
|
|
// would render it invalid, the button should be disabled
|
|
|
|
if( bIsValid )
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
bool bDataInColumns = m_xRB_Columns->get_active();
|
2007-07-25 07:37:07 +00:00
|
|
|
bool bIsSwappedRangeValid = m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
|
|
|
|
DataSourceHelper::createArguments(
|
|
|
|
aRange, Sequence< sal_Int32 >(), ! bDataInColumns, bHasCategories, bFirstCellAsLabel ));
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xRB_Rows->set_sensitive( bIsSwappedRangeValid );
|
|
|
|
m_xRB_Columns->set_sensitive( bIsSwappedRangeValid );
|
2007-07-25 07:37:07 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xCB_FirstRowAsLabel->set_sensitive(
|
2007-07-25 07:37:07 +00:00
|
|
|
m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
|
|
|
|
DataSourceHelper::createArguments(
|
2018-10-15 15:09:32 +01:00
|
|
|
aRange, Sequence< sal_Int32 >(), m_xRB_Columns->get_active(),
|
2007-07-25 07:37:07 +00:00
|
|
|
bDataInColumns ? ! bFirstCellAsLabel : bFirstCellAsLabel,
|
|
|
|
bDataInColumns ? bHasCategories : ! bHasCategories )));
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xCB_FirstColumnAsLabel->set_sensitive(
|
2007-07-25 07:37:07 +00:00
|
|
|
m_rDialogModel.getRangeSelectionHelper()->verifyArguments(
|
|
|
|
DataSourceHelper::createArguments(
|
2018-10-15 15:09:32 +01:00
|
|
|
aRange, Sequence< sal_Int32 >(), m_xRB_Columns->get_active(),
|
2007-07-25 07:37:07 +00:00
|
|
|
bDataInColumns ? bFirstCellAsLabel : ! bFirstCellAsLabel,
|
|
|
|
bDataInColumns ? ! bHasCategories : bHasCategories )));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xRB_Rows->set_sensitive( bIsValid );
|
|
|
|
m_xRB_Columns->set_sensitive( bIsValid );
|
|
|
|
m_xCB_FirstRowAsLabel->set_sensitive( bIsValid );
|
|
|
|
m_xCB_FirstColumnAsLabel->set_sensitive( bIsValid );
|
2013-08-30 17:56:18 +02:00
|
|
|
}
|
2013-12-28 21:52:55 -02:00
|
|
|
|
|
|
|
bool bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
|
2018-10-15 15:09:32 +01:00
|
|
|
lcl_ShowChooserButton( *m_xIB_Range, bShowIB );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
return bIsValid;
|
|
|
|
}
|
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
IMPL_LINK_NOARG(RangeChooserTabPage, ControlEditedHdl, weld::Entry&, void)
|
2008-07-21 11:13:07 +00:00
|
|
|
{
|
|
|
|
setDirty();
|
|
|
|
isValid();
|
|
|
|
}
|
2007-05-22 16:47:43 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedRadioHdl, weld::ToggleButton&, void)
|
2015-09-09 11:41:20 +02:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
ControlChangedHdl(*m_xED_Range);
|
2015-09-09 11:41:20 +02:00
|
|
|
}
|
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedCheckBoxHdl, weld::ToggleButton&, void)
|
2015-09-11 13:27:40 +02:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
ControlChangedHdl(*m_xED_Range);
|
2015-09-11 13:27:40 +02:00
|
|
|
}
|
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
IMPL_LINK_NOARG(RangeChooserTabPage, ControlChangedHdl, weld::Entry&, void)
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
|
|
|
setDirty();
|
|
|
|
if( isValid())
|
|
|
|
changeDialogModelAccordingToControls();
|
|
|
|
}
|
2007-07-25 07:37:07 +00:00
|
|
|
|
2018-10-15 15:09:32 +01:00
|
|
|
IMPL_LINK_NOARG(RangeChooserTabPage, ChooseRangeHdl, weld::Button&, void)
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
2018-10-15 15:09:32 +01:00
|
|
|
OUString aRange = m_xED_Range->get_text();
|
|
|
|
OUString aTitle = m_xFTTitle->get_label();
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
lcl_enableRangeChoosing( true, m_pParentDialog );
|
2018-11-26 20:30:25 +00:00
|
|
|
lcl_enableRangeChoosing( true, m_pParentController );
|
2007-05-22 16:47:43 +00:00
|
|
|
m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this );
|
|
|
|
}
|
|
|
|
|
2012-10-06 23:58:35 -03:00
|
|
|
void RangeChooserTabPage::listeningFinished( const OUString & rNewRange )
|
2007-05-22 16:47:43 +00:00
|
|
|
{
|
|
|
|
//user has selected a new range
|
|
|
|
|
2016-04-12 10:50:29 +02:00
|
|
|
// rNewRange becomes invalid after removing the listener
|
2012-10-06 23:58:35 -03:00
|
|
|
OUString aRange( rNewRange );
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
m_rDialogModel.startControllerLockTimer();
|
|
|
|
|
|
|
|
// stop listening
|
|
|
|
m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
|
|
|
|
|
|
|
|
//update dialog state
|
|
|
|
ToTop();
|
|
|
|
GrabFocus();
|
2018-10-15 15:09:32 +01:00
|
|
|
m_xED_Range->set_text(aRange);
|
|
|
|
m_xED_Range->grab_focus();
|
2007-05-22 16:47:43 +00:00
|
|
|
|
|
|
|
setDirty();
|
|
|
|
if( isValid())
|
|
|
|
changeDialogModelAccordingToControls();
|
|
|
|
|
|
|
|
lcl_enableRangeChoosing( false, m_pParentDialog );
|
2018-11-26 20:30:25 +00:00
|
|
|
lcl_enableRangeChoosing( false, m_pParentController );
|
2007-05-22 16:47:43 +00:00
|
|
|
}
|
|
|
|
void RangeChooserTabPage::disposingRangeSelection()
|
|
|
|
{
|
|
|
|
m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
void RangeChooserTabPage::setDirty()
|
|
|
|
{
|
|
|
|
if( m_nChangingControlCalls == 0 )
|
|
|
|
m_bIsDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|