2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2003-10-06 08:58:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 19:24:18 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:24:18 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:24:18 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:24:18 +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.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:24:18 +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).
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:24:18 +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.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 11:59:34 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_chart2.hxx"
|
2003-10-06 08:58:36 +00:00
|
|
|
#include "tp_Scale.hxx"
|
2010-11-30 01:45:03 +01:00
|
|
|
#include "tp_Scale.hrc"
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
#include "ResId.hxx"
|
|
|
|
#include "Strings.hrc"
|
2007-05-22 16:48:21 +00:00
|
|
|
#include "chartview/ChartSfxItemIds.hxx"
|
|
|
|
#include "NoWarningThisInCTOR.hxx"
|
2008-12-12 12:17:17 +00:00
|
|
|
#include "AxisHelper.hxx"
|
2007-05-22 16:48:21 +00:00
|
|
|
|
|
|
|
#include <svx/svxids.hrc>
|
2003-10-06 08:58:36 +00:00
|
|
|
#include <rtl/math.hxx>
|
|
|
|
// header for class SvxDoubleItem
|
|
|
|
#include <svx/chrtitem.hxx>
|
|
|
|
// header for class SfxBoolItem
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/eitem.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
// header for SfxInt32Item
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/intitem.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
// header for class WarningBox
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
|
|
|
|
// header for class SvNumberformat
|
|
|
|
#ifndef _ZFORMAT_HXX
|
|
|
|
#ifndef _ZFORLIST_DECLARE_TABLE
|
|
|
|
#define _ZFORLIST_DECLARE_TABLE
|
|
|
|
#endif
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/zformat.hxx>
|
2003-10-06 08:58:36 +00:00
|
|
|
#endif
|
|
|
|
|
2008-01-14 12:56:51 +00:00
|
|
|
#include <svtools/controldims.hrc>
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
#include <com/sun/star/chart2/AxisType.hpp>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
//.............................................................................
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
//.............................................................................
|
|
|
|
|
2008-01-14 12:56:51 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
void lcl_placeControlAtX( Control& rControl, long nNewXPos )
|
|
|
|
{
|
|
|
|
Point aPos( rControl.GetPosPixel() );
|
|
|
|
aPos.X() = nNewXPos;
|
|
|
|
rControl.SetPosPixel(aPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_placeControlAtY( Control& rControl, long nNewYPos )
|
|
|
|
{
|
|
|
|
Point aPos( rControl.GetPosPixel() );
|
|
|
|
aPos.Y() = nNewYPos;
|
|
|
|
rControl.SetPosPixel(aPos);
|
|
|
|
}
|
|
|
|
|
2008-12-12 12:17:17 +00:00
|
|
|
void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos )
|
2008-01-14 12:56:51 +00:00
|
|
|
{
|
|
|
|
Point aPos( rEdit.GetPosPixel() );
|
|
|
|
long nShift = nNewXPos - aPos.X();
|
|
|
|
aPos.X() = nNewXPos;
|
|
|
|
rEdit.SetPosPixel(aPos);
|
|
|
|
|
|
|
|
aPos = rAuto.GetPosPixel();
|
|
|
|
aPos.X() += nShift;
|
|
|
|
rAuto.SetPosPixel(aPos);
|
|
|
|
}
|
|
|
|
|
2011-01-14 18:59:53 +01:00
|
|
|
long lcl_getLabelDistance( Control& rControl )
|
2008-12-12 12:17:17 +00:00
|
|
|
{
|
2011-01-14 18:59:53 +01:00
|
|
|
return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width();
|
|
|
|
}
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2011-01-14 18:59:53 +01:00
|
|
|
void lcl_setValue( FormattedField& rFmtField, double fValue )
|
|
|
|
{
|
|
|
|
rFmtField.SetValue( fValue );
|
|
|
|
rFmtField.SetDefaultValue( fValue );
|
2008-12-12 12:17:17 +00:00
|
|
|
}
|
|
|
|
|
2008-01-14 12:56:51 +00:00
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) :
|
2008-12-12 12:17:17 +00:00
|
|
|
SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs),
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2008-12-12 12:17:17 +00:00
|
|
|
aFlScale(this, SchResId(FL_SCALE)),
|
2010-11-30 01:45:03 +01:00
|
|
|
|
|
|
|
aCbxReverse(this, SchResId(CBX_REVERSE)),
|
|
|
|
aCbxLogarithm(this, SchResId(CBX_LOGARITHM)),
|
|
|
|
|
|
|
|
m_aTxt_AxisType(this, SchResId (TXT_AXIS_TYPE)),
|
|
|
|
m_aLB_AxisType(this, SchResId(LB_AXIS_TYPE)),
|
|
|
|
|
2007-04-26 08:37:14 +00:00
|
|
|
aTxtMin (this, SchResId (TXT_MIN)),
|
|
|
|
aFmtFldMin(this, SchResId(EDT_MIN)),
|
|
|
|
aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)),
|
2010-11-30 01:45:03 +01:00
|
|
|
|
2007-04-26 08:37:14 +00:00
|
|
|
aTxtMax(this, SchResId (TXT_MAX)),
|
|
|
|
aFmtFldMax(this, SchResId(EDT_MAX)),
|
|
|
|
aCbxAutoMax(this, SchResId(CBX_AUTO_MAX)),
|
2010-11-30 01:45:03 +01:00
|
|
|
|
|
|
|
m_aTxt_TimeResolution(this, SchResId (TXT_TIME_RESOLUTION)),
|
|
|
|
m_aLB_TimeResolution(this, SchResId(LB_TIME_RESOLUTION)),
|
|
|
|
m_aCbx_AutoTimeResolution(this, SchResId(CBX_AUTO_TIME_RESOLUTION)),
|
|
|
|
|
2007-04-26 08:37:14 +00:00
|
|
|
aTxtMain (this, SchResId (TXT_STEP_MAIN)),
|
|
|
|
aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)),
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aMt_MainDateStep(this, SchResId(MT_MAIN_DATE_STEP)),
|
|
|
|
m_aLB_MainTimeUnit(this, SchResId(LB_MAIN_TIME_UNIT)),
|
2007-04-26 08:37:14 +00:00
|
|
|
aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)),
|
2010-11-30 01:45:03 +01:00
|
|
|
|
|
|
|
aTxtHelpCount (this, SchResId (TXT_STEP_HELP_COUNT)),
|
2007-04-26 08:37:14 +00:00
|
|
|
aTxtHelp (this, SchResId (TXT_STEP_HELP)),
|
|
|
|
aMtStepHelp (this, SchResId (MT_STEPHELP)),
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aLB_HelpTimeUnit(this, SchResId(LB_HELP_TIME_UNIT)),
|
2007-04-26 08:37:14 +00:00
|
|
|
aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)),
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2007-04-26 08:37:14 +00:00
|
|
|
aTxtOrigin (this, SchResId (TXT_ORIGIN)),
|
|
|
|
aFmtFldOrigin(this, SchResId(EDT_ORIGIN)),
|
|
|
|
aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)),
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
fMin(0.0),
|
|
|
|
fMax(0.0),
|
|
|
|
fStepMain(0.0),
|
|
|
|
nStepHelp(0),
|
|
|
|
fOrigin(0.0),
|
2010-11-30 01:45:03 +01:00
|
|
|
m_nTimeResolution(1),
|
|
|
|
m_nMainTimeUnit(1),
|
|
|
|
m_nHelpTimeUnit(1),
|
|
|
|
m_nAxisType(chart2::AxisType::REALNUMBER),
|
|
|
|
m_bAllowDateAxis(false),
|
2008-12-12 12:17:17 +00:00
|
|
|
pNumFormatter(NULL),
|
|
|
|
m_bShowAxisOrigin(false)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
FreeResource();
|
|
|
|
SetExchangeSupport();
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
|
|
|
aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
|
|
|
aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
|
|
|
aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
|
|
|
aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aCbx_AutoTimeResolution.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl));
|
|
|
|
|
|
|
|
m_aLB_AxisType.SetDropDownLineCount(3);
|
|
|
|
m_aLB_AxisType.SetSelectHdl(LINK(this, ScaleTabPage, SelectAxisTypeHdl));
|
|
|
|
|
|
|
|
m_aLB_TimeResolution.SetDropDownLineCount(3);
|
|
|
|
m_aLB_MainTimeUnit.SetDropDownLineCount(3);
|
|
|
|
m_aLB_HelpTimeUnit.SetDropDownLineCount(3);
|
2011-01-14 18:59:53 +01:00
|
|
|
|
|
|
|
aFmtFldMin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
|
|
|
|
aFmtFldMax.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
|
|
|
|
aFmtFldStepMain.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
|
|
|
|
aFmtFldOrigin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl));
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied )
|
|
|
|
{
|
|
|
|
if( pFmtFied )
|
|
|
|
pFmtFied->SetDefaultValue( pFmtFied->GetValue() );
|
|
|
|
return 0;
|
2007-10-22 15:48:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-03 11:39:43 +00:00
|
|
|
void ScaleTabPage::StateChanged( StateChangedType nType )
|
|
|
|
{
|
|
|
|
TabPage::StateChanged( nType );
|
|
|
|
|
|
|
|
if( nType == STATE_CHANGE_INITSHOW )
|
|
|
|
AdjustControlPositions();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScaleTabPage::AdjustControlPositions()
|
|
|
|
{
|
|
|
|
//optimize position of the controls
|
|
|
|
long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() );
|
|
|
|
nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth );
|
|
|
|
nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth );
|
2010-11-30 01:45:03 +01:00
|
|
|
nLabelWidth = ::std::max( aTxtHelpCount.CalcMinimumSize().Width(), nLabelWidth );
|
2009-03-03 11:39:43 +00:00
|
|
|
nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth );
|
2010-11-30 01:45:03 +01:00
|
|
|
nLabelWidth = ::std::max( m_aTxt_TimeResolution.CalcMinimumSize().Width(), nLabelWidth );
|
|
|
|
nLabelWidth = ::std::max( m_aTxt_AxisType.CalcMinimumSize().Width(), nLabelWidth );
|
2009-03-03 11:39:43 +00:00
|
|
|
nLabelWidth+=1;
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
long nLabelDistance = lcl_getLabelDistance(aTxtMin);
|
2009-03-03 11:39:43 +00:00
|
|
|
long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance;
|
|
|
|
|
|
|
|
//ensure that the auto checkboxes are wide enough and have correct size for calculation
|
|
|
|
aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() );
|
|
|
|
aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() );
|
|
|
|
aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() );
|
|
|
|
aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() );
|
|
|
|
aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() );
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aCbx_AutoTimeResolution.SetSizePixel( m_aCbx_AutoTimeResolution.CalcMinimumSize() );
|
2009-03-03 11:39:43 +00:00
|
|
|
|
|
|
|
//ensure new pos is ok
|
2010-11-30 01:45:03 +01:00
|
|
|
long nWidthOfOtherControls = m_aLB_MainTimeUnit.GetPosPixel().X() + m_aLB_MainTimeUnit.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X();
|
2009-03-03 11:39:43 +00:00
|
|
|
long nDialogWidth = GetSizePixel().Width();
|
|
|
|
|
|
|
|
long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls;
|
|
|
|
if(nLeftSpace>=0)
|
|
|
|
{
|
|
|
|
Size aSize( aTxtMin.GetSizePixel() );
|
|
|
|
aSize.Width() = nLabelWidth;
|
|
|
|
aTxtMin.SetSizePixel(aSize);
|
|
|
|
aTxtMax.SetSizePixel(aSize);
|
|
|
|
aTxtMain.SetSizePixel(aSize);
|
|
|
|
aTxtHelp.SetSizePixel(aSize);
|
2010-11-30 01:45:03 +01:00
|
|
|
aTxtHelpCount.SetSizePixel(aSize);
|
2009-03-03 11:39:43 +00:00
|
|
|
aTxtOrigin.SetSizePixel(aSize);
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aTxt_TimeResolution.SetSizePixel(aSize);
|
|
|
|
m_aTxt_AxisType.SetSizePixel(aSize);
|
|
|
|
|
|
|
|
long nOrgAutoCheckX = aCbxAutoMin.GetPosPixel().X();
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepMain, nOrgAutoCheckX );
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepHelp, nOrgAutoCheckX );
|
2009-03-03 11:39:43 +00:00
|
|
|
|
|
|
|
lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos );
|
|
|
|
lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos );
|
|
|
|
lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos );
|
2010-11-30 01:45:03 +01:00
|
|
|
lcl_placeControlAtX( m_aMt_MainDateStep, aFmtFldStepMain.GetPosPixel().X() );
|
2009-03-03 11:39:43 +00:00
|
|
|
lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos );
|
|
|
|
lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos );
|
2010-11-30 01:45:03 +01:00
|
|
|
lcl_shiftControls( m_aLB_TimeResolution, m_aCbx_AutoTimeResolution, nNewXPos );
|
|
|
|
lcl_placeControlAtX( m_aLB_AxisType, nNewXPos );
|
|
|
|
|
|
|
|
nNewXPos = aCbxAutoStepMain.GetPosPixel().X() + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
|
|
|
|
lcl_placeControlAtX( m_aLB_MainTimeUnit, nNewXPos );
|
|
|
|
lcl_placeControlAtX( m_aLB_HelpTimeUnit, nNewXPos );
|
2009-03-03 11:39:43 +00:00
|
|
|
}
|
2010-11-30 01:45:03 +01:00
|
|
|
PlaceIntervalControlsAccordingToAxisType();
|
2009-03-03 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
void ScaleTabPage::PlaceIntervalControlsAccordingToAxisType()
|
2007-10-22 15:48:11 +00:00
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
long nMinX = std::min( aCbxAutoStepMain.GetPosPixel().X(), m_aLB_MainTimeUnit.GetPosPixel().X() );
|
|
|
|
long nLabelDistance = lcl_getLabelDistance(aTxtMin);
|
|
|
|
long nListWidth = m_aLB_MainTimeUnit.GetSizePixel().Width();
|
|
|
|
|
|
|
|
if( chart2::AxisType::DATE == m_nAxisType )
|
|
|
|
{
|
|
|
|
lcl_placeControlAtX( m_aLB_MainTimeUnit, nMinX );
|
|
|
|
lcl_placeControlAtX( m_aLB_HelpTimeUnit, nMinX );
|
|
|
|
long nSecondX = nMinX + nListWidth + nLabelDistance;
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepMain, nSecondX );
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepHelp, nSecondX );
|
|
|
|
|
|
|
|
long nOne = m_aMt_MainDateStep.LogicToPixel( Size(0, 1), MapMode(MAP_APPFONT) ).Height();
|
|
|
|
|
|
|
|
long nYMajor = m_aMt_MainDateStep.GetPosPixel().Y();
|
|
|
|
lcl_placeControlAtY( aCbxAutoStepMain , nYMajor+(3*nOne));
|
|
|
|
lcl_placeControlAtY( aTxtMain , nYMajor+nOne+nOne);
|
|
|
|
|
|
|
|
long nYMinor = m_aLB_HelpTimeUnit.GetPosPixel().Y();
|
|
|
|
lcl_placeControlAtY( aMtStepHelp , nYMinor );
|
|
|
|
lcl_placeControlAtY( aCbxAutoStepHelp , nYMinor+(3*nOne));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepMain, nMinX );
|
|
|
|
lcl_placeControlAtX( aCbxAutoStepHelp, nMinX );
|
|
|
|
long nSecondX = nMinX + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance;
|
|
|
|
long nSecondXMax = GetSizePixel().Width() - nListWidth;
|
|
|
|
if( nSecondX > nSecondXMax )
|
|
|
|
nSecondX = nSecondXMax;
|
|
|
|
lcl_placeControlAtX( m_aLB_MainTimeUnit, nSecondX );
|
|
|
|
lcl_placeControlAtX( m_aLB_HelpTimeUnit, nSecondX );
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
void ScaleTabPage::EnableControls()
|
|
|
|
{
|
|
|
|
bool bValueAxis = chart2::AxisType::REALNUMBER == m_nAxisType || chart2::AxisType::PERCENT == m_nAxisType || chart2::AxisType::DATE == m_nAxisType;
|
|
|
|
bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
|
|
|
|
|
|
|
|
m_aTxt_AxisType.Show(m_bAllowDateAxis);
|
|
|
|
m_aLB_AxisType.Show(m_bAllowDateAxis);
|
|
|
|
|
|
|
|
aCbxLogarithm.Show( bValueAxis && !bDateAxis );
|
|
|
|
aTxtMin.Show( bValueAxis );
|
|
|
|
aFmtFldMin.Show( bValueAxis );
|
|
|
|
aCbxAutoMin.Show( bValueAxis );
|
|
|
|
aTxtMax.Show( bValueAxis );
|
|
|
|
aFmtFldMax.Show( bValueAxis );
|
|
|
|
aCbxAutoMax.Show( bValueAxis );
|
|
|
|
aTxtMain.Show( bValueAxis );
|
|
|
|
aFmtFldStepMain.Show( bValueAxis );
|
|
|
|
aCbxAutoStepMain.Show( bValueAxis );
|
|
|
|
aTxtHelp.Show( bValueAxis );
|
|
|
|
aTxtHelpCount.Show( bValueAxis );
|
|
|
|
aMtStepHelp.Show( bValueAxis );
|
|
|
|
aCbxAutoStepHelp.Show( bValueAxis );
|
|
|
|
|
|
|
|
aTxtOrigin.Show( m_bShowAxisOrigin && bValueAxis );
|
|
|
|
aFmtFldOrigin.Show( m_bShowAxisOrigin && bValueAxis );
|
|
|
|
aCbxAutoOrigin.Show( m_bShowAxisOrigin && bValueAxis );
|
|
|
|
|
|
|
|
aTxtHelpCount.Show( bValueAxis && !bDateAxis );
|
|
|
|
aTxtHelp.Show( bDateAxis );
|
|
|
|
|
|
|
|
m_aTxt_TimeResolution.Show( bDateAxis );
|
|
|
|
m_aLB_TimeResolution.Show( bDateAxis );
|
|
|
|
m_aCbx_AutoTimeResolution.Show( bDateAxis );
|
|
|
|
|
|
|
|
bool bWasDateAxis = m_aMt_MainDateStep.IsVisible();
|
|
|
|
if( bWasDateAxis != bDateAxis )
|
|
|
|
{
|
|
|
|
//transport value from one to other control
|
|
|
|
if( bWasDateAxis )
|
2011-01-14 18:59:53 +01:00
|
|
|
lcl_setValue( aFmtFldStepMain, m_aMt_MainDateStep.GetValue() );
|
2010-11-30 01:45:03 +01:00
|
|
|
else
|
|
|
|
m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(aFmtFldStepMain.GetValue()) );
|
|
|
|
}
|
|
|
|
aFmtFldStepMain.Show( bValueAxis && !bDateAxis );
|
|
|
|
m_aMt_MainDateStep.Show( bDateAxis );
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aLB_MainTimeUnit.Show( bDateAxis );
|
|
|
|
m_aLB_HelpTimeUnit.Show( bDateAxis );
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
EnableValueHdl(&aCbxAutoMin);
|
|
|
|
EnableValueHdl(&aCbxAutoMax);
|
|
|
|
EnableValueHdl(&aCbxAutoStepMain);
|
|
|
|
EnableValueHdl(&aCbxAutoStepHelp);
|
|
|
|
EnableValueHdl(&aCbxAutoOrigin);
|
|
|
|
EnableValueHdl(&m_aCbx_AutoTimeResolution);
|
|
|
|
}
|
2008-12-12 12:17:17 +00:00
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
bool bEnable = pCbx && !pCbx->IsChecked() && pCbx->IsEnabled();
|
2003-10-06 08:58:36 +00:00
|
|
|
if (pCbx == &aCbxAutoMin)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
aFmtFldMin.Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else if (pCbx == &aCbxAutoMax)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
aFmtFldMax.Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else if (pCbx == &aCbxAutoStepMain)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
aFmtFldStepMain.Enable( bEnable );
|
|
|
|
m_aMt_MainDateStep.Enable( bEnable );
|
|
|
|
m_aLB_MainTimeUnit.Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else if (pCbx == &aCbxAutoStepHelp)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
aMtStepHelp.Enable( bEnable );
|
|
|
|
m_aLB_HelpTimeUnit.Enable( bEnable );
|
|
|
|
}
|
|
|
|
else if (pCbx == &m_aCbx_AutoTimeResolution)
|
|
|
|
{
|
|
|
|
m_aLB_TimeResolution.Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else if (pCbx == &aCbxAutoOrigin)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
aFmtFldOrigin.Enable( bEnable );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
enum AxisTypeListBoxEntry
|
|
|
|
{
|
|
|
|
TYPE_AUTO=0,
|
|
|
|
TYPE_TEXT=1,
|
|
|
|
TYPE_DATE=2
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPL_LINK( ScaleTabPage, SelectAxisTypeHdl, void *, EMPTYARG )
|
|
|
|
{
|
2011-02-07 18:01:48 +01:00
|
|
|
sal_uInt16 nPos = m_aLB_AxisType.GetSelectEntryPos();
|
2010-11-30 01:45:03 +01:00
|
|
|
if( nPos==TYPE_DATE )
|
|
|
|
m_nAxisType = chart2::AxisType::DATE;
|
|
|
|
else
|
|
|
|
m_nAxisType = chart2::AxisType::CATEGORY;
|
|
|
|
if( chart2::AxisType::DATE == m_nAxisType )
|
|
|
|
aCbxLogarithm.Check(false);
|
|
|
|
EnableControls();
|
|
|
|
PlaceIntervalControlsAccordingToAxisType();
|
|
|
|
SetNumFormat();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-10-22 15:48:11 +00:00
|
|
|
return new ScaleTabPage(pWindow, rOutAttrs);
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
sal_Bool ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXISTYPE, m_nAxisType));
|
|
|
|
if(m_bAllowDateAxis)
|
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, TYPE_AUTO==m_aLB_AxisType.GetSelectEntryPos()));
|
|
|
|
|
|
|
|
bool bAutoScale = false;
|
|
|
|
if( m_nAxisType==chart2::AxisType::CATEGORY )
|
|
|
|
bAutoScale = true;//reset scaling for category charts
|
|
|
|
|
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,bAutoScale || aCbxAutoMin.IsChecked()));
|
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,bAutoScale || aCbxAutoMax.IsChecked()));
|
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || aCbxAutoStepHelp.IsChecked()));
|
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,bAutoScale || aCbxAutoOrigin.IsChecked()));
|
2003-10-06 08:58:36 +00:00
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,aCbxLogarithm.IsChecked()));
|
2007-10-22 15:48:11 +00:00
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,aCbxReverse.IsChecked()));
|
2003-10-06 08:58:36 +00:00
|
|
|
rOutAttrs.Put(SvxDoubleItem(fMax , SCHATTR_AXIS_MAX));
|
|
|
|
rOutAttrs.Put(SvxDoubleItem(fMin , SCHATTR_AXIS_MIN));
|
|
|
|
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp));
|
|
|
|
rOutAttrs.Put(SvxDoubleItem(fOrigin , SCHATTR_AXIS_ORIGIN));
|
|
|
|
|
2010-12-09 18:32:46 +01:00
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || aCbxAutoStepMain.IsChecked()));
|
2003-10-06 08:58:36 +00:00
|
|
|
rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN));
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_aCbx_AutoTimeResolution.IsChecked()));
|
|
|
|
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,m_nTimeResolution));
|
|
|
|
|
|
|
|
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,m_nMainTimeUnit));
|
|
|
|
rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,m_nHelpTimeUnit));
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
return sal_True;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
void ScaleTabPage::Reset(const SfxItemSet& rInAttrs)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT( pNumFormatter, "No NumberFormatter available" );
|
|
|
|
if(!pNumFormatter)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const SfxPoolItem *pPoolItem = NULL;
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_ALLOW_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
m_bAllowDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
|
|
|
|
m_nAxisType=chart2::AxisType::REALNUMBER;
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
m_nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue();
|
2010-12-01 13:46:27 +01:00
|
|
|
if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis )
|
|
|
|
m_nAxisType=chart2::AxisType::CATEGORY;
|
2010-11-30 01:45:03 +01:00
|
|
|
if( m_bAllowDateAxis )
|
2007-10-22 15:48:11 +00:00
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
bool bAutoDateAxis = false;
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
bAutoDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue();
|
|
|
|
|
2011-02-07 13:06:08 +01:00
|
|
|
sal_uInt16 nPos = 0;
|
2010-11-30 01:45:03 +01:00
|
|
|
if( m_nAxisType==chart2::AxisType::DATE )
|
|
|
|
nPos=TYPE_DATE;
|
|
|
|
else if( bAutoDateAxis )
|
|
|
|
nPos=TYPE_AUTO;
|
|
|
|
else
|
|
|
|
nPos=TYPE_TEXT;
|
|
|
|
m_aLB_AxisType.SelectEntryPos( nPos );
|
2007-10-22 15:48:11 +00:00
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2010-11-30 19:17:18 +01:00
|
|
|
if( m_bAllowDateAxis )
|
|
|
|
aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:MayBeDateAxis");
|
|
|
|
else if( m_nAxisType==chart2::AxisType::CATEGORY || m_nAxisType==chart2::AxisType::SERIES )
|
|
|
|
aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:Category");
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
PlaceIntervalControlsAccordingToAxisType();
|
|
|
|
|
|
|
|
aCbxAutoMin.Check( true );
|
|
|
|
aCbxAutoMax.Check( true );
|
|
|
|
aCbxAutoStepMain.Check( true );
|
|
|
|
aCbxAutoStepHelp.Check( true );
|
|
|
|
aCbxAutoOrigin.Check( true );
|
|
|
|
m_aCbx_AutoTimeResolution.Check( true );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,sal_True,&pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
|
2011-01-14 18:59:53 +01:00
|
|
|
lcl_setValue( aFmtFldMin, fMin );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue();
|
2011-01-14 18:59:53 +01:00
|
|
|
lcl_setValue( aFmtFldMax, fMax );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue();
|
2011-01-14 18:59:53 +01:00
|
|
|
lcl_setValue( aFmtFldStepMain, fStepMain );
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(fStepMain) );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2007-10-22 15:48:11 +00:00
|
|
|
aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
nStepHelp = ((const SfxInt32Item*)pPoolItem)->GetValue();
|
|
|
|
aMtStepHelp.SetValue( nStepHelp );
|
|
|
|
}
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
2011-01-14 15:18:08 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue();
|
2011-01-14 18:59:53 +01:00
|
|
|
lcl_setValue( aFmtFldOrigin, fOrigin );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
m_aCbx_AutoTimeResolution.Check(((const SfxBoolItem*)pPoolItem)->GetValue());
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
{
|
|
|
|
m_nTimeResolution = ((const SfxInt32Item*)pPoolItem)->GetValue();
|
|
|
|
m_aLB_TimeResolution.SelectEntryPos( m_nTimeResolution );
|
|
|
|
}
|
|
|
|
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
{
|
|
|
|
m_nMainTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
|
|
|
|
m_aLB_MainTimeUnit.SelectEntryPos( m_nMainTimeUnit );
|
|
|
|
}
|
2011-02-07 18:01:48 +01:00
|
|
|
if (rInAttrs.GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET)
|
2010-11-30 01:45:03 +01:00
|
|
|
{
|
|
|
|
m_nHelpTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue();
|
|
|
|
m_aLB_HelpTimeUnit.SelectEntryPos( m_nHelpTimeUnit );
|
|
|
|
}
|
|
|
|
|
|
|
|
EnableControls();
|
|
|
|
SetNumFormat();
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
if( !pNumFormatter )
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL( "No NumberFormatter available" );
|
2003-10-06 08:58:36 +00:00
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
|
|
|
|
|
2005-12-14 13:58:50 +00:00
|
|
|
sal_uInt32 nIndex = pNumFormatter->GetStandardIndex(LANGUAGE_SYSTEM);
|
2007-09-18 13:55:12 +00:00
|
|
|
const SfxPoolItem *pPoolItem = NULL;
|
2011-01-14 15:18:08 +01:00
|
|
|
if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
|
2007-09-18 13:55:12 +00:00
|
|
|
nIndex = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL( "Using Standard Language" );
|
2007-09-18 13:55:12 +00:00
|
|
|
}
|
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
Control* pControl = NULL;
|
2011-01-14 15:18:08 +01:00
|
|
|
sal_uInt16 nErrStrId = 0;
|
2003-10-06 08:58:36 +00:00
|
|
|
double fDummy;
|
|
|
|
|
|
|
|
fMax = aFmtFldMax.GetValue();
|
|
|
|
fMin = aFmtFldMin.GetValue();
|
|
|
|
fOrigin = aFmtFldOrigin.GetValue();
|
2010-11-30 01:45:03 +01:00
|
|
|
fStepMain = bDateAxis ? m_aMt_MainDateStep.GetValue() : aFmtFldStepMain.GetValue();
|
2007-07-25 07:37:32 +00:00
|
|
|
nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue());
|
2010-11-30 01:45:03 +01:00
|
|
|
m_nTimeResolution = m_aLB_TimeResolution.GetSelectEntryPos();
|
|
|
|
m_nMainTimeUnit = m_aLB_MainTimeUnit.GetSelectEntryPos();
|
|
|
|
m_nHelpTimeUnit = m_aLB_HelpTimeUnit.GetSelectEntryPos();
|
|
|
|
|
|
|
|
if( chart2::AxisType::REALNUMBER != m_nAxisType )
|
|
|
|
aCbxLogarithm.Show( false );
|
|
|
|
|
|
|
|
//check wich entries need user action
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if ( aCbxLogarithm.IsChecked() &&
|
|
|
|
( ( !aCbxAutoMin.IsChecked() && fMin <= 0.0 )
|
|
|
|
|| ( !aCbxAutoMax.IsChecked() && fMax <= 0.0 ) ) )
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldMin;
|
2003-10-06 08:58:36 +00:00
|
|
|
nErrStrId = STR_BAD_LOGARITHM;
|
|
|
|
}
|
2010-11-30 01:45:03 +01:00
|
|
|
else if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() &&
|
|
|
|
fMin >= fMax)
|
|
|
|
{
|
|
|
|
pControl = &aFmtFldMin;
|
|
|
|
nErrStrId = STR_MIN_GREATER_MAX;
|
|
|
|
}
|
|
|
|
else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldStepMain;
|
2003-10-06 08:58:36 +00:00
|
|
|
nErrStrId = STR_STEP_GT_ZERO;
|
|
|
|
}
|
|
|
|
// check for entries that cannot be parsed for the current number format
|
2010-11-30 01:45:03 +01:00
|
|
|
else if ( aFmtFldMin.IsModified()
|
2003-10-06 08:58:36 +00:00
|
|
|
&& !aCbxAutoMin.IsChecked()
|
|
|
|
&& !pNumFormatter->IsNumberFormat(aFmtFldMin.GetText(), nIndex, fDummy))
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldMin;
|
2003-10-06 08:58:36 +00:00
|
|
|
nErrStrId = STR_INVALID_NUMBER;
|
|
|
|
}
|
|
|
|
else if (aFmtFldMax.IsModified() && !aCbxAutoMax.IsChecked() &&
|
|
|
|
!pNumFormatter->IsNumberFormat(aFmtFldMax.GetText(),
|
|
|
|
nIndex, fDummy))
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldMax;
|
2003-10-06 08:58:36 +00:00
|
|
|
nErrStrId = STR_INVALID_NUMBER;
|
|
|
|
}
|
2010-11-30 01:45:03 +01:00
|
|
|
else if ( !bDateAxis && aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() &&
|
2003-10-06 08:58:36 +00:00
|
|
|
!pNumFormatter->IsNumberFormat(aFmtFldStepMain.GetText(),
|
|
|
|
nIndex, fDummy))
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldStepMain;
|
2007-05-22 16:48:21 +00:00
|
|
|
nErrStrId = STR_STEP_GT_ZERO;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() &&
|
|
|
|
!pNumFormatter->IsNumberFormat(aFmtFldOrigin.GetText(),
|
|
|
|
nIndex, fDummy))
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldOrigin;
|
2003-10-06 08:58:36 +00:00
|
|
|
nErrStrId = STR_INVALID_NUMBER;
|
|
|
|
}
|
|
|
|
else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0)
|
|
|
|
{
|
2010-11-30 01:45:03 +01:00
|
|
|
pControl = &aFmtFldStepMain;
|
2007-05-22 16:48:21 +00:00
|
|
|
nErrStrId = STR_STEP_GT_ZERO;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
2010-11-30 01:45:03 +01:00
|
|
|
else if( bDateAxis )
|
|
|
|
{
|
|
|
|
if( !aCbxAutoStepMain.IsChecked() && !aCbxAutoStepHelp.IsChecked() )
|
|
|
|
{
|
|
|
|
if( m_nHelpTimeUnit > m_nMainTimeUnit )
|
|
|
|
{
|
|
|
|
pControl = &m_aLB_MainTimeUnit;
|
|
|
|
nErrStrId = STR_INVALID_INTERVALS;
|
|
|
|
}
|
|
|
|
else if( m_nHelpTimeUnit == m_nMainTimeUnit && nStepHelp > fStepMain )
|
|
|
|
{
|
|
|
|
pControl = &m_aLB_MainTimeUnit;
|
|
|
|
nErrStrId = STR_INVALID_INTERVALS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !nErrStrId && !m_aCbx_AutoTimeResolution.IsChecked() )
|
|
|
|
{
|
|
|
|
if( (!aCbxAutoStepMain.IsChecked() && m_nTimeResolution > m_nMainTimeUnit )
|
|
|
|
||
|
|
|
|
(!aCbxAutoStepHelp.IsChecked() && m_nTimeResolution > m_nHelpTimeUnit )
|
|
|
|
)
|
|
|
|
{
|
|
|
|
pControl = &m_aLB_TimeResolution;
|
|
|
|
nErrStrId = STR_INVALID_TIME_UNIT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2010-11-30 01:45:03 +01:00
|
|
|
if( ShowWarning( nErrStrId, pControl ) )
|
2003-10-06 08:58:36 +00:00
|
|
|
return KEEP_PAGE;
|
|
|
|
|
|
|
|
if( pItemSet )
|
|
|
|
FillItemSet( *pItemSet );
|
|
|
|
|
|
|
|
return LEAVE_PAGE;
|
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
void ScaleTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
pNumFormatter = pFormatter;
|
|
|
|
aFmtFldMax.SetFormatter( pNumFormatter );
|
|
|
|
aFmtFldMin.SetFormatter( pNumFormatter );
|
|
|
|
aFmtFldStepMain.SetFormatter( pNumFormatter );
|
|
|
|
aFmtFldOrigin.SetFormatter( pNumFormatter );
|
2007-09-18 13:55:12 +00:00
|
|
|
|
2011-02-07 20:20:44 +01:00
|
|
|
// #i6278# allow more decimal places than the output format. As
|
2007-09-18 13:55:12 +00:00
|
|
|
// the numbers shown in the edit fields are used for input, it makes more
|
|
|
|
// sense to display the values in the input format rather than the output
|
|
|
|
// format.
|
|
|
|
aFmtFldMax.UseInputStringForFormatting();
|
|
|
|
aFmtFldMin.UseInputStringForFormatting();
|
|
|
|
aFmtFldStepMain.UseInputStringForFormatting();
|
|
|
|
aFmtFldOrigin.UseInputStringForFormatting();
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
SetNumFormat();
|
|
|
|
}
|
|
|
|
|
2007-10-22 15:48:11 +00:00
|
|
|
void ScaleTabPage::SetNumFormat()
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
const SfxPoolItem *pPoolItem = NULL;
|
|
|
|
|
2011-01-14 15:18:08 +01:00
|
|
|
if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2011-01-14 15:18:08 +01:00
|
|
|
sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue();
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
aFmtFldMax.SetFormatKey( nFmt );
|
|
|
|
aFmtFldMin.SetFormatKey( nFmt );
|
|
|
|
aFmtFldOrigin.SetFormatKey( nFmt );
|
|
|
|
|
2008-12-12 12:17:17 +00:00
|
|
|
if( pNumFormatter )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2008-12-12 12:17:17 +00:00
|
|
|
short eType = pNumFormatter->GetType( nFmt );
|
|
|
|
if( eType == NUMBERFORMAT_DATE )
|
|
|
|
{
|
|
|
|
// for intervals use standard format for dates (so you can enter a number of days)
|
|
|
|
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
|
|
|
|
if( pFormat )
|
|
|
|
nFmt = pNumFormatter->GetStandardIndex( pFormat->GetLanguage());
|
|
|
|
else
|
|
|
|
nFmt = pNumFormatter->GetStandardIndex();
|
|
|
|
}
|
|
|
|
else if( eType == NUMBERFORMAT_DATETIME )
|
|
|
|
{
|
|
|
|
// for intervals use time format for date times
|
|
|
|
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
|
|
|
|
if( pFormat )
|
|
|
|
nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME, pFormat->GetLanguage() );
|
|
|
|
else
|
|
|
|
nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME );
|
|
|
|
}
|
2010-11-30 01:45:03 +01:00
|
|
|
|
|
|
|
if( chart2::AxisType::DATE == m_nAxisType && ( eType != NUMBERFORMAT_DATE && eType != NUMBERFORMAT_DATETIME) )
|
|
|
|
{
|
|
|
|
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
|
|
|
|
if( pFormat )
|
|
|
|
nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE, pFormat->GetLanguage() );
|
|
|
|
else
|
|
|
|
nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE );
|
|
|
|
|
|
|
|
aFmtFldMax.SetFormatKey( nFmt );
|
|
|
|
aFmtFldMin.SetFormatKey( nFmt );
|
|
|
|
aFmtFldOrigin.SetFormatKey( nFmt );
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aFmtFldStepMain.SetFormatKey( nFmt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-12 12:17:17 +00:00
|
|
|
void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
|
|
|
|
{
|
|
|
|
m_bShowAxisOrigin = bShowOrigin;
|
|
|
|
if( !AxisHelper::isAxisPositioningEnabled() )
|
|
|
|
m_bShowAxisOrigin = true;
|
|
|
|
}
|
|
|
|
|
2011-02-07 13:06:08 +01:00
|
|
|
bool ScaleTabPage::ShowWarning( sal_uInt16 nResIdMessage, Control* pControl /* = NULL */ )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
if( nResIdMessage == 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
WarningBox( this, WinBits( WB_OK ), String( SchResId( nResIdMessage ))).Execute();
|
|
|
|
if( pControl )
|
|
|
|
{
|
|
|
|
pControl->GrabFocus();
|
2010-11-30 01:45:03 +01:00
|
|
|
Edit* pEdit = dynamic_cast<Edit*>(pControl);
|
|
|
|
if(pEdit)
|
|
|
|
pEdit->SetSelection( Selection( 0, SELECTION_MAX ));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//.............................................................................
|
|
|
|
} //namespace chart
|
|
|
|
//.............................................................................
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|