2008-02-18 14:42:41 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* $RCSfile: dlg_InsertErrorBars.cxx,v $
|
2008-10-01 07:35:04 +00:00
|
|
|
* $Revision: 1.4.44.1 $
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
2008-04-10 18:54:09 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2008-02-18 14:42:41 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_chart2.hxx"
|
|
|
|
|
|
|
|
#include "dlg_InsertErrorBars.hxx"
|
|
|
|
#include "dlg_InsertErrorBars.hrc"
|
|
|
|
#include "res_ErrorBar.hxx"
|
|
|
|
#include "ResourceIds.hrc"
|
|
|
|
#include "ResId.hxx"
|
|
|
|
#include "Strings.hrc"
|
|
|
|
#include "chartview/ExplicitValueProvider.hxx"
|
|
|
|
#include "ChartModelHelper.hxx"
|
|
|
|
#include "ObjectIdentifier.hxx"
|
|
|
|
#include "DiagramHelper.hxx"
|
|
|
|
#include "AxisHelper.hxx"
|
2009-09-11 16:06:18 +00:00
|
|
|
#include "ObjectNameProvider.hxx"
|
2008-02-18 14:42:41 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/chart2/XAxis.hpp>
|
|
|
|
#include <com/sun/star/chart2/XDiagram.hpp>
|
|
|
|
|
|
|
|
using ::rtl::OUString;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::chart2;
|
|
|
|
|
|
|
|
//.............................................................................
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
//.............................................................................
|
|
|
|
|
|
|
|
InsertErrorBarsDialog::InsertErrorBarsDialog(
|
|
|
|
Window* pParent, const SfxItemSet& rMyAttrs,
|
2008-03-06 15:33:55 +00:00
|
|
|
const uno::Reference< chart2::XChartDocument > & xChartDocument,
|
2008-02-18 14:42:41 +00:00
|
|
|
ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) :
|
|
|
|
ModalDialog( pParent, SchResId( DLG_DATA_YERRORBAR )),
|
|
|
|
rInAttrs( rMyAttrs ),
|
|
|
|
aBtnOK( this, SchResId( BTN_OK )),
|
|
|
|
aBtnCancel( this, SchResId( BTN_CANCEL )),
|
|
|
|
aBtnHelp( this, SchResId( BTN_HELP )),
|
2008-03-06 15:33:55 +00:00
|
|
|
m_apErrorBarResources( new ErrorBarResources(
|
|
|
|
this, this, rInAttrs,
|
|
|
|
/* bNoneAvailable = */ true, eType ))
|
2008-02-18 14:42:41 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
2009-09-11 16:06:18 +00:00
|
|
|
this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) );
|
|
|
|
|
2008-03-06 15:33:55 +00:00
|
|
|
m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
|
2008-02-18 14:42:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
InsertErrorBarsDialog::~InsertErrorBarsDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
|
|
|
|
{
|
|
|
|
m_apErrorBarResources->FillItemSet(rOutAttrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InsertErrorBarsDialog::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
ModalDialog::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
|
|
|
m_apErrorBarResources->FillValueSets();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
|
|
|
|
{
|
|
|
|
m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth );
|
|
|
|
}
|
|
|
|
|
|
|
|
//static
|
|
|
|
double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals(
|
|
|
|
const Reference< frame::XModel >& xChartModel,
|
|
|
|
const Reference< uno::XInterface >& xChartView,
|
|
|
|
const OUString& rSelectedObjectCID )
|
|
|
|
{
|
|
|
|
double fStepWidth = 0.001;
|
|
|
|
|
|
|
|
ExplicitValueProvider* pExplicitValueProvider( ExplicitValueProvider::getExplicitValueProvider(xChartView) );
|
|
|
|
if( pExplicitValueProvider )
|
|
|
|
{
|
|
|
|
Reference< XAxis > xAxis;
|
|
|
|
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
|
|
|
|
Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedObjectCID, xChartModel );
|
|
|
|
xAxis = DiagramHelper::getAttachedAxis( xSeries, xDiagram );
|
|
|
|
if(!xAxis.is())
|
|
|
|
xAxis = AxisHelper::getAxis( 1/*nDimensionIndex*/, true/*bMainAxis*/, xDiagram );
|
|
|
|
if(xAxis.is())
|
|
|
|
{
|
|
|
|
ExplicitScaleData aExplicitScale;
|
|
|
|
ExplicitIncrementData aExplicitIncrement;
|
|
|
|
pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement );
|
|
|
|
|
|
|
|
fStepWidth = aExplicitIncrement.Distance;
|
|
|
|
if( aExplicitIncrement.SubIncrements.getLength() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
|
|
|
|
fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
|
|
|
|
else
|
|
|
|
fStepWidth/=10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fStepWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//.............................................................................
|
|
|
|
} //namespace chart
|
|
|
|
//.............................................................................
|