2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
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
|
|
|
* 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
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#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();
|
2012-03-17 20:40:39 +00:00
|
|
|
ObjectType objType = eType == ErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X;
|
2012-03-14 18:40:44 +00:00
|
|
|
|
|
|
|
this->SetText( ObjectNameProvider::getName_ObjectForAllSeries(objType) );
|
2009-09-11 16:06:18 +00:00
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2010-11-30 01:45:03 +01:00
|
|
|
if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 )
|
2008-02-18 14:42:41 +00:00
|
|
|
fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount);
|
|
|
|
else
|
|
|
|
fStepWidth/=10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fStepWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
//.............................................................................
|
|
|
|
} //namespace chart
|
|
|
|
//.............................................................................
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|