diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-12 12:17:17 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-12 12:17:17 +0000 |
commit | 8f03095fa0920e870bffdd01f9f98a98a4b5291e (patch) | |
tree | 0274ef6d78f25bdfc36259e27c8c748ca1d18f3c | |
parent | 47b1cc26c2697d81b44be5fb53598321cbc5d827 (diff) |
CWS-TOOLING: integrate CWS rtlchart02
40 files changed, 2218 insertions, 575 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 96eb55f5f369..9a024cf309fc 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -40,6 +40,9 @@ #include <comphelper/InlineContainer.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include "CharacterProperties.hxx" #include "LineProperties.hxx" @@ -76,35 +79,40 @@ enum { PROP_AXIS_MAX, PROP_AXIS_MIN, - PROP_AXIS_ORIGIN, PROP_AXIS_STEPMAIN, PROP_AXIS_STEPHELP, //deprecated property use 'StepHelpCount' instead PROP_AXIS_STEPHELP_COUNT, PROP_AXIS_AUTO_MAX, PROP_AXIS_AUTO_MIN, - PROP_AXIS_AUTO_ORIGIN, PROP_AXIS_AUTO_STEPMAIN, PROP_AXIS_AUTO_STEPHELP, PROP_AXIS_LOGARITHMIC, PROP_AXIS_REVERSEDIRECTION, - PROP_AXIS_DISPLAY_LABELS, - PROP_AXIS_TEXT_ROTATION, + PROP_AXIS_VISIBLE, + PROP_AXIS_CROSSOVER_POSITION, + PROP_AXIS_CROSSOVER_VALUE, + PROP_AXIS_ORIGIN, + PROP_AXIS_AUTO_ORIGIN, PROP_AXIS_MARKS, PROP_AXIS_HELPMARKS, - PROP_AXIS_OVERLAP, - PROP_AXIS_GAP_WIDTH, + PROP_AXIS_MARK_POSITION, + PROP_AXIS_DISPLAY_LABELS, + PROP_AXIS_NUMBERFORMAT, + PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, + PROP_AXIS_LABEL_POSITION, + PROP_AXIS_TEXT_ROTATION, PROP_AXIS_ARRANGE_ORDER, PROP_AXIS_TEXTBREAK, PROP_AXIS_CAN_OVERLAP, - PROP_AXIS_NUMBERFORMAT, - PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, - PROP_AXIS_VISIBLE, - PROP_AXIS_STACKEDTEXT + PROP_AXIS_STACKEDTEXT, + PROP_AXIS_OVERLAP, + PROP_AXIS_GAP_WIDTH }; void lcl_AddPropertiesToVector( ::std::vector< Property > & rOutProperties ) { + //Properties for scaling: rOutProperties.push_back( Property( C2U( "Max" ), PROP_AXIS_MAX, @@ -120,16 +128,16 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEVOID )); rOutProperties.push_back( - Property( C2U( "Origin" ), - PROP_AXIS_ORIGIN, + Property( C2U( "StepMain" ), + PROP_AXIS_STEPMAIN, ::getCppuType( reinterpret_cast< const double * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); rOutProperties.push_back( - Property( C2U( "StepMain" ), - PROP_AXIS_STEPMAIN, - ::getCppuType( reinterpret_cast< const double * >(0)), + Property( C2U( "StepHelpCount" ), + PROP_AXIS_STEPHELP_COUNT, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); @@ -141,14 +149,6 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); - - rOutProperties.push_back( - Property( C2U( "StepHelpCount" ), - PROP_AXIS_STEPHELP_COUNT, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEVOID )); - rOutProperties.push_back( Property( C2U( "AutoMax" ), PROP_AXIS_AUTO_MAX, @@ -164,13 +164,6 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "AutoOrigin" ), - PROP_AXIS_AUTO_ORIGIN, - ::getBooleanCppuType(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( Property( C2U( "AutoStepMain" ), PROP_AXIS_AUTO_STEPMAIN, ::getBooleanCppuType(), @@ -198,20 +191,42 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); + //todo: this property is missing in the API rOutProperties.push_back( - Property( C2U( "DisplayLabels" ), - PROP_AXIS_DISPLAY_LABELS, + Property( C2U( "Visible" ), + PROP_AXIS_VISIBLE, ::getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "TextRotation" ), - PROP_AXIS_TEXT_ROTATION, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), + Property( C2U( "CrossoverPosition" ), + PROP_AXIS_CROSSOVER_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "CrossoverValue" ), + PROP_AXIS_CROSSOVER_VALUE, + ::getCppuType( reinterpret_cast< const double * >(0)), + beans::PropertyAttribute::MAYBEVOID )); + + + rOutProperties.push_back( + Property( C2U( "Origin" ), + PROP_AXIS_ORIGIN, + ::getCppuType( reinterpret_cast< const double * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( + Property( C2U( "AutoOrigin" ), + PROP_AXIS_AUTO_ORIGIN, + ::getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); + //Properties for interval marks: rOutProperties.push_back( Property( C2U( "Marks" ), PROP_AXIS_MARKS, @@ -227,15 +242,43 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "Overlap" ), - PROP_AXIS_OVERLAP, + Property( C2U( "MarkPosition" ), + PROP_AXIS_MARK_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); + + + //Properties for labels: + rOutProperties.push_back( + Property( C2U( "DisplayLabels" ), + PROP_AXIS_DISPLAY_LABELS, + ::getBooleanCppuType(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "NumberFormat" ), + PROP_AXIS_NUMBERFORMAT, ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "GapWidth" ), - PROP_AXIS_GAP_WIDTH, + Property( C2U( "LinkNumberFormatToSource" ), + PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, + ::getBooleanCppuType(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "LabelPosition" ), + PROP_AXIS_LABEL_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "TextRotation" ), + PROP_AXIS_TEXT_ROTATION, ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); @@ -262,30 +305,24 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "NumberFormat" ), - PROP_AXIS_NUMBERFORMAT, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( - Property( C2U( "LinkNumberFormatToSource" ), - PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, + Property( C2U( "StackedText" ), + PROP_AXIS_STACKEDTEXT, ::getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); + // Properties related to bar charts: rOutProperties.push_back( - Property( C2U( "Visible" ), - PROP_AXIS_VISIBLE, - ::getBooleanCppuType(), + Property( C2U( "Overlap" ), + PROP_AXIS_OVERLAP, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "StackedText" ), - PROP_AXIS_STACKEDTEXT, - ::getBooleanCppuType(), + Property( C2U( "GapWidth" ), + PROP_AXIS_GAP_WIDTH, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); } @@ -518,6 +555,7 @@ const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties() aWrappedProperties.push_back( pWrappedNumberFormatProperty ); aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) ); aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedText" ), C2U( "StackCharacters" ) ) ); + aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "CrossoverPosition" ), C2U( "CrossoverPosition" ) ) ); { WrappedGapwidthProperty* pWrappedGapwidthProperty( new WrappedGapwidthProperty( m_spChart2ModelContact ) ); WrappedBarOverlapProperty* pWrappedBarOverlapProperty( new WrappedBarOverlapProperty( m_spChart2ModelContact ) ); diff --git a/chart2/source/controller/dialogs/ResourceIds.hrc b/chart2/source/controller/dialogs/ResourceIds.hrc index 032506c1a076..8674aba240da 100644 --- a/chart2/source/controller/dialogs/ResourceIds.hrc +++ b/chart2/source/controller/dialogs/ResourceIds.hrc @@ -62,7 +62,8 @@ #define TP_OPTIONS 908 #define TP_POLAROPTIONS 909 #define TP_AXIS_LABEL 920 -#define TP_SCALE_Y 903 +#define TP_SCALE 903 +#define TP_AXIS_POSITIONS 904 #define TP_CHARTTYPE 910 #define TP_RANGECHOOSER 911 #define TP_WIZARD_TITLEANDOBJECTS 912 diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index 4cd86dbdd749..8da8700a4406 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -119,6 +119,11 @@ String STR_PAGE_SCALE Text [ en-US ] = "Scale" ; }; +String STR_PAGE_POSITIONING +{ + Text [ en-US ] = "Positioning" ; +}; + // String STR_PAGE_STATISTICS // { // Text [ en-US ] = "Statistics" ; diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc index fb136c88d75e..d56534257500 100644 --- a/chart2/source/controller/dialogs/TabPages.hrc +++ b/chart2/source/controller/dialogs/TabPages.hrc @@ -131,11 +131,9 @@ #define FT_AXIS_TEXTDIR 19 #define LB_AXIS_TEXTDIR 20 -//#define TP_SCALE_Y 903 +//#define TP_SCALE 903 -#define FL_SCALE_Y 1 -#define FL_TICKS 2 -#define FL_HELPTICKS 3 +#define FL_SCALE 1 #define TXT_MIN 1 #define TXT_MAX 2 @@ -149,17 +147,46 @@ #define CBX_AUTO_STEP_HELP 4 #define CBX_AUTO_ORIGIN 5 #define CBX_LOGARITHM 6 -#define CBX_TICKS_INNER 7 -#define CBX_HELPTICKS_INNER 8 -#define CBX_TICKS_OUTER 9 -#define CBX_HELPTICKS_OUTER 10 -#define CBX_REVERSE 11 +#define CBX_REVERSE 7 #define EDT_STEP_MAIN 1 #define EDT_MAX 2 #define EDT_MIN 3 -#define EDT_ORIGIN 5 +#define EDT_ORIGIN 4 #define MT_STEPHELP 10 +//#define TP_AXIS_POSITIONS 904 + +#define FL_AXIS_LINE 1 +#define FL_LABELS 2 +#define FL_TICKS 3 +#define FL_VERTICAL 4 +#define FL_GRIDS 5 + +#define FT_CROSSES_OTHER_AXIS_AT 1 +#define FT_AXIS_LABEL_DISTANCE 2 +#define FT_PLACE_LABELS 3 +#define FT_MAJOR 4 +#define FT_MINOR 5 +#define FT_PLACE_TICKS 6 + +#define LB_CROSSES_OTHER_AXIS_AT 1 +#define LB_PLACE_LABELS 2 +#define EDT_CROSSES_OTHER_AXIS_AT 3 +#define EDT_CROSSES_OTHER_AXIS_AT_CATEGORY 4 +#define EDT_AXIS_LABEL_DISTANCE 5 +#define LB_PLACE_TICKS 6 + +#define CB_AXIS_BETWEEN_CATEGORIES 1 +#define CB_TICKS_INNER 2 +#define CB_TICKS_OUTER 3 +#define CB_MINOR_INNER 4 +#define CB_MINOR_OUTER 5 +#define CB_MAJOR_GRID 6 +#define CB_MINOR_GRID 7 + +#define PB_MAJOR_GRID 1 +#define PB_MINOR_GRID 2 + #endif diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 4084b30c9da4..2087df6deb9e 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -46,6 +46,7 @@ #include "tp_LegendPosition.hxx" #include "tp_PointGeometry.hxx" #include "tp_Scale.hxx" +#include "tp_AxisPositions.hxx" #include "tp_ErrorBars.hxx" #include "tp_Trendline.hxx" #include "tp_SeriesToAxis.hxx" @@ -60,6 +61,8 @@ #include "DiagramHelper.hxx" #include "chartview/NumberFormatterWrapper.hxx" #include "AxisIndexDefines.hxx" +#include "AxisHelper.hxx" + #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XChartType.hpp> #include <com/sun/star/chart2/XDataSeries.hpp> @@ -86,6 +89,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using ::com::sun::star::uno::Reference; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -103,11 +107,15 @@ ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUS , m_bProvidesBarConnectors(false) , m_bHasAreaProperties(false) , m_bHasSymbolProperties(false) - , m_bHasScaleProperties(false) - , m_bCanAxisLabelsBeStaggered(false) , m_bHasNumberProperties(false) , m_bProvidesStartingAngle(false) , m_bProvidesMissingValueTreatments(false) + , m_bHasScaleProperties(false) + , m_bCanAxisLabelsBeStaggered(false) + , m_bSupportingAxisPositioning(false) + , m_bShowAxisOrigin(false) + , m_bIsCrossingAxisIsCategoryAxis(false) + , m_aCategories() , m_xChartDocument( 0 ) { rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID ); @@ -163,17 +171,42 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel //show scale properties only for a single axis not for multiselection m_bHasScaleProperties = !m_bAffectsMultipleObjects; - //no scale page for series axis if( m_bHasScaleProperties ) { uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) ); if( xAxis.is() ) { + //no scale page for series axis ScaleData aData( xAxis->getScaleData() ); if( chart2::AxisType::SERIES == aData.AxisType ) m_bHasScaleProperties = false; if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType ) m_bHasNumberProperties = true; + + sal_Int32 nCooSysIndex=0; + sal_Int32 nDimensionIndex=0; + sal_Int32 nAxisIndex=0; + if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) ) + { + xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex ); + //show positioning controls only if they make sense + m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex ); + + //show axis origin only for secondary y axis + if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) ) + m_bShowAxisOrigin = true; + } + + //is the crossin main axis a category axes?: + uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); + uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) ); + if( xCrossingMainAxis.is() ) + { + ScaleData aScale( xCrossingMainAxis->getScaleData() ); + m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType ); + if( m_bIsCrossingAxisIsCategoryAxis ) + m_aCategories = DiagramHelper::generateAutomaticCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) ); + } } } @@ -235,6 +268,22 @@ bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const { return m_bCanAxisLabelsBeStaggered; } +bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const +{ + return m_bShowAxisOrigin; +} +bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const +{ + return m_bSupportingAxisPositioning; +} +bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const +{ + return m_bIsCrossingAxisIsCategoryAxis; +} +const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const +{ + return m_aCategories; +} bool ObjectPropertiesDialogParameter::HasNumberProperties() const { return m_bHasNumberProperties; @@ -341,14 +390,17 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, case OBJECTTYPE_AXIS: { + if( m_pParameter->HasScaleProperties() ) + AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL); + + if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far + AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL); AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE))); - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); - AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL); - if( m_pParameter->HasScaleProperties() ) - AddTabPage(TP_SCALE_Y, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL); if( m_pParameter->HasNumberProperties() ) AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS))); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); break; } @@ -483,28 +535,39 @@ void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage) case TP_ALIGNMENT: break; - case TP_SCALE_Y: + + case TP_AXIS_POSITIONS: { - ScaleTabPage & rAxisTabPage = static_cast< ScaleTabPage & >( rPage ); + AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage ); + if(pPage) + { + pPage->SetNumFormatter( m_pNumberFormatter ); + if( m_pParameter->IsCrossingAxisIsCategoryAxis() ) + { + pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() ); + pPage->SetCategories( m_pParameter->GetCategories() ); + } + pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() ); + } + } + break; - // #i81259# fix for #101318# undone. The numberformatter passed - // here must contain the actually used number format. Showing - // numbers with more digits is now solved in FormattedField - // (using the input format also for output). - rAxisTabPage.SetNumFormatter( m_pNumberFormatter ); + case TP_SCALE: + { + ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage ); + if(pScaleTabPage) + { + pScaleTabPage->SetNumFormatter( m_pNumberFormatter ); + pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() ); + } } break; -//DLNF case TP_DATA_DESCR: -//DLNF { -//DLNF DataLabelsTabPage & rLabelPage = static_cast< DataLabelsTabPage & >( rPage ); -//DLNF rLabelPage.SetNumberFormatter( m_pNumberFormatter ); -//DLNF } -//DLNF break; case TP_DATA_DESCR: { - DataLabelsTabPage & rLabelPage = static_cast< DataLabelsTabPage & >( rPage ); - rLabelPage.SetNumberFormatter( m_pNumberFormatter ); + DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage ); + if( pLabelPage ) + pLabelPage->SetNumberFormatter( m_pNumberFormatter ); } break; diff --git a/chart2/source/controller/dialogs/makefile.mk b/chart2/source/controller/dialogs/makefile.mk index f124a9dc7329..52f5d4e8ab2f 100644 --- a/chart2/source/controller/dialogs/makefile.mk +++ b/chart2/source/controller/dialogs/makefile.mk @@ -71,6 +71,7 @@ SLOFILES= \ $(SLO)$/tp_Wizard_TitlesAndObjects.obj \ $(SLO)$/tp_Location.obj \ $(SLO)$/tp_AxisLabel.obj \ + $(SLO)$/tp_AxisPositions.obj \ $(SLO)$/tp_DataLabel.obj \ $(SLO)$/tp_DataSource.obj \ $(SLO)$/tp_DataSourceControls.obj \ @@ -120,6 +121,7 @@ SRC1FILES= \ tp_Wizard_TitlesAndObjects.src \ tp_Location.src \ tp_AxisLabel.src \ + tp_AxisPositions.src \ tp_DataLabel.src \ tp_DataSource.src \ tp_LegendPosition.src \ diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx new file mode 100644 index 000000000000..d1e17f677646 --- /dev/null +++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx @@ -0,0 +1,501 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tp_AxisPositions.cxx,v $ + * $Revision: 1.1.4.3 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" +#include "tp_AxisPositions.hxx" + +#include "ResId.hxx" +#include "TabPages.hrc" +#include "Strings.hrc" +#include "chartview/ChartSfxItemIds.hxx" +#include "NoWarningThisInCTOR.hxx" +#include "AxisHelper.hxx" + +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include <rtl/math.hxx> +// header for class SvxDoubleItem +#include <svx/chrtitem.hxx> +// header for class SfxBoolItem +#include <svtools/eitem.hxx> +// header for SfxInt32Item +#include <svtools/intitem.hxx> + +// header for class WarningBox +#include <vcl/msgbox.hxx> + +// header for class SvNumberformat +#ifndef _ZFORMAT_HXX +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <svtools/zformat.hxx> +#endif + +#include <svtools/controldims.hrc> + +#include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart2/AxisType.hpp> + +using namespace ::com::sun::star; + +//............................................................................. +namespace chart +{ +//............................................................................. + +namespace +{ +void lcl_newXPos( Control& rControl, long nXPos ) +{ + Point aPos( rControl.GetPosPixel() ); + aPos.X() = nXPos; + rControl.SetPosPixel(aPos); +} + +void lcl_shiftY( Control& rControl, long nYDiff ) +{ + Point aPos( rControl.GetPosPixel() ); + aPos.Y() += nYDiff; + rControl.SetPosPixel(aPos); +} + +} + +AxisPositionsTabPage::AxisPositionsTabPage(Window* pWindow,const SfxItemSet& rInAttrs) + : SfxTabPage(pWindow, SchResId(TP_AXIS_POSITIONS), rInAttrs) + + , m_aFL_AxisLine(this,SchResId(FL_AXIS_LINE)) + , m_aFT_CrossesAt(this,SchResId(FT_CROSSES_OTHER_AXIS_AT)) + , m_aLB_CrossesAt(this,SchResId(LB_CROSSES_OTHER_AXIS_AT)) + , m_aED_CrossesAt(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT)) + , m_aED_CrossesAtCategory(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT_CATEGORY)) + , m_aCB_AxisBetweenCategories(this, SchResId(CB_AXIS_BETWEEN_CATEGORIES)) + + , m_aFL_Labels(this,SchResId(FL_LABELS)) + , m_aFT_PlaceLabels( this, SchResId( FT_PLACE_LABELS ) ) + , m_aLB_PlaceLabels( this, SchResId( LB_PLACE_LABELS ) ) + , m_aFT_LabelDistance( this, SchResId( FT_AXIS_LABEL_DISTANCE ) ) + , m_aED_LabelDistance( this, SchResId( EDT_AXIS_LABEL_DISTANCE ) ) + + , m_aFL_Ticks(this,SchResId(FL_TICKS)) + , m_aFT_Major(this,SchResId(FT_MAJOR)) + , m_aCB_TicksInner(this,SchResId(CB_TICKS_INNER)) + , m_aCB_TicksOuter(this,SchResId(CB_TICKS_OUTER)) + , m_aFT_Minor(this,SchResId(FT_MINOR)) + , m_aCB_MinorInner(this,SchResId(CB_MINOR_INNER)) + , m_aCB_MinorOuter(this,SchResId(CB_MINOR_OUTER)) + + , m_aFL_Vertical(this,SchResId(FL_VERTICAL)) + , m_aFT_PlaceTicks(this,SchResId(FT_PLACE_TICKS)) + , m_aLB_PlaceTicks(this,SchResId(LB_PLACE_TICKS)) + + , m_aFL_Grids(this,SchResId(FL_GRIDS)) + , m_aCB_MajorGrid(this,SchResId(CB_MAJOR_GRID)) + , m_aPB_MajorGrid(this,SchResId(PB_MAJOR_GRID)) + , m_aCB_MinorGrid(this,SchResId(CB_MINOR_GRID)) + , m_aPB_MinorGrid(this,SchResId(PB_MINOR_GRID)) + + , m_pNumFormatter(NULL) + , m_bCrossingAxisIsCategoryAxis(false) + , m_aCategories() +{ + FreeResource(); + SetExchangeSupport(); + + const long nDialogWidth = GetSizePixel().Width(); + const long nDistance = LogicToPixel( Size(RSC_SP_CTRL_X, 0), MapMode(MAP_APPFONT) ).Width(); + + //axis line controls + { + if( m_aFT_CrossesAt.CalcMinimumSize().Width() < m_aFT_CrossesAt.GetSizePixel().Width() ) + { + m_aFT_CrossesAt.SetSizePixel(m_aFT_CrossesAt.CalcMinimumSize()); + long nXPos = m_aFT_CrossesAt.GetPosPixel().X() + m_aFT_CrossesAt.GetSizePixel().Width() + nDistance; + lcl_newXPos( m_aLB_CrossesAt, nXPos ); + + nXPos += m_aLB_CrossesAt.GetSizePixel().Width() + nDistance; + lcl_newXPos( m_aED_CrossesAt, nXPos ); + lcl_newXPos( m_aED_CrossesAtCategory, nXPos ); + } + } + + long nFixTextHeight = m_aFT_PlaceLabels.GetSizePixel().Height(); + long nLabelPlacementWidth = m_aFT_PlaceLabels.CalcMinimumSize().Width(); + long nMarkPlacementWidth = m_aFT_PlaceTicks.CalcMinimumSize().Width(); + + + long nWidth_0 = ::std::max( m_aFT_Major.CalcMinimumSize().Width(), m_aFT_Minor.CalcMinimumSize().Width() ); + nWidth_0 = ::std::max( nWidth_0, nLabelPlacementWidth ); + nWidth_0 = ::std::max( nWidth_0, nMarkPlacementWidth ); + nLabelPlacementWidth = nMarkPlacementWidth = nWidth_0; + + //label placement + { + m_aFT_PlaceLabels.SetSizePixel( Size( nLabelPlacementWidth, nFixTextHeight ) ); + long nXPos = m_aFT_PlaceLabels.GetPosPixel().X() + nLabelPlacementWidth + nDistance; + lcl_newXPos( m_aLB_PlaceLabels, nXPos ); + m_aLB_PlaceLabels.SetSizePixel(m_aLB_PlaceLabels.CalcMinimumSize()); + } + + //tickmark placement + { + m_aFT_PlaceTicks.SetSizePixel( Size( nMarkPlacementWidth, nFixTextHeight ) ); + long nXPos = m_aFT_PlaceTicks.GetPosPixel().X() + nMarkPlacementWidth + nDistance; + lcl_newXPos( m_aLB_PlaceTicks, nXPos ); + m_aLB_PlaceTicks.SetSizePixel( m_aLB_PlaceTicks.CalcMinimumSize() ); + } + + //tickmark controls + { + long nWidth_1 = ::std::max( m_aCB_TicksInner.CalcMinimumSize().Width(), m_aCB_MinorInner.CalcMinimumSize().Width() ); + long nWidth_2 = ::std::max( m_aCB_TicksOuter.CalcMinimumSize().Width(), m_aCB_MinorOuter.CalcMinimumSize().Width() ); + + long nLeftSpace = nDialogWidth - nWidth_0 - nWidth_1 - nWidth_2 - 3*nDistance; + + if(nLeftSpace>=0) + { + m_aFT_Major.SetSizePixel(m_aFT_Major.CalcMinimumSize()); + m_aFT_Minor.SetSizePixel(m_aFT_Minor.CalcMinimumSize()); + + m_aCB_TicksInner.SetSizePixel( m_aCB_TicksInner.CalcMinimumSize() ); + m_aCB_MinorInner.SetSizePixel( m_aCB_MinorInner.CalcMinimumSize() ); + + m_aCB_TicksOuter.SetSizePixel( m_aCB_TicksOuter.CalcMinimumSize() ); + m_aCB_MinorOuter.SetSizePixel( m_aCB_MinorOuter.CalcMinimumSize() ); + + long nXPos = m_aFT_Major.GetPosPixel().X() + nWidth_0 + nDistance; + lcl_newXPos( m_aCB_TicksInner, nXPos ); + lcl_newXPos( m_aCB_MinorInner, nXPos ); + + nXPos += nWidth_1 + nDistance; + lcl_newXPos( m_aCB_TicksOuter, nXPos ); + lcl_newXPos( m_aCB_MinorOuter, nXPos ); + + nXPos += nWidth_2 + nDistance; + lcl_newXPos( m_aFL_Vertical, nXPos ); + } + } + + //right alignement of listboxes: + { + long nLabelRightBorder = m_aLB_PlaceLabels.GetPosPixel().X() + m_aLB_PlaceLabels.GetSizePixel().Width(); + long nTickmarksRightBorder = m_aLB_PlaceTicks.GetPosPixel().X() + m_aLB_PlaceTicks.GetSizePixel().Width(); + + long nNewRightBorder = ::std::max( m_aLB_CrossesAt.GetPosPixel().X() + m_aLB_CrossesAt.GetSizePixel().Width(), nLabelRightBorder); + nNewRightBorder = ::std::max( nTickmarksRightBorder, nNewRightBorder ); + + long nListBoxHeight = m_aLB_PlaceLabels.GetSizePixel().Height(); + m_aLB_PlaceLabels.SetSizePixel( Size( m_aLB_PlaceLabels.GetSizePixel().Width()+nNewRightBorder-nLabelRightBorder, nListBoxHeight ) ); + m_aLB_PlaceTicks.SetSizePixel( Size( m_aLB_PlaceTicks.GetSizePixel().Width()+nNewRightBorder-nTickmarksRightBorder, nListBoxHeight ) ); + } + + m_aLB_CrossesAt.SetSelectHdl( LINK( this, AxisPositionsTabPage, CrossesAtSelectHdl ) ); + m_aLB_CrossesAt.SetDropDownLineCount( m_aLB_CrossesAt.GetEntryCount() ); + + m_aLB_PlaceLabels.SetSelectHdl( LINK( this, AxisPositionsTabPage, PlaceLabelsSelectHdl ) ); + m_aLB_PlaceLabels.SetDropDownLineCount( m_aLB_PlaceLabels.GetEntryCount() ); + m_aLB_PlaceTicks.SetDropDownLineCount( m_aLB_PlaceTicks.GetEntryCount() ); +} + +SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs) +{ + return new AxisPositionsTabPage(pWindow, rOutAttrs); +} + +BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs) +{ + // axis line + USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos(); + rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 )); + if( 2==nPos ) + { + double fCrossover = m_aED_CrossesAt.GetValue(); + if( m_bCrossingAxisIsCategoryAxis ) + fCrossover = m_aED_CrossesAtCategory.GetSelectEntryPos()+1; + rOutAttrs.Put(SvxDoubleItem(fCrossover,SCHATTR_AXIS_POSITION_VALUE)); + } + + // labels + USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); + if( nLabelPos != LISTBOX_ENTRY_NOTFOUND ) + rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos )); + + // tick marks + long nTicks=0; + long nMinorTicks=0; + + if(m_aCB_MinorInner.IsChecked()) + nMinorTicks|=CHAXIS_MARK_INNER; + if(m_aCB_MinorOuter.IsChecked()) + nMinorTicks|=CHAXIS_MARK_OUTER; + if(m_aCB_TicksInner.IsChecked()) + nTicks|=CHAXIS_MARK_INNER; + if(m_aCB_TicksOuter.IsChecked()) + nTicks|=CHAXIS_MARK_OUTER; + + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks)); + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks)); + + USHORT nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos(); + if( nMarkPos != LISTBOX_ENTRY_NOTFOUND ) + rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos )); + + return TRUE; +} + +void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) +{ + //init and enable controls + m_aED_CrossesAt.Show( !m_bCrossingAxisIsCategoryAxis ); + m_aED_CrossesAtCategory.Show( m_bCrossingAxisIsCategoryAxis ); + const sal_Int32 nMaxCount = LISTBOX_ENTRY_NOTFOUND; + if( m_bCrossingAxisIsCategoryAxis ) + { + for( sal_Int32 nN=0; nN<m_aCategories.getLength() && nN<nMaxCount; nN++ ) + m_aED_CrossesAtCategory.InsertEntry( m_aCategories[nN] ); + + USHORT nCount = m_aED_CrossesAtCategory.GetEntryCount(); + if( nCount>30 ) + nCount=30; + m_aED_CrossesAtCategory.SetDropDownLineCount( nCount ); + } + + if( m_aLB_CrossesAt.GetEntryCount() > 3 ) + { + if( m_bCrossingAxisIsCategoryAxis ) + m_aLB_CrossesAt.RemoveEntry(2); + else + m_aLB_CrossesAt.RemoveEntry(3); + } + + //fill controls + const SfxPoolItem *pPoolItem = NULL; + + //axis line + if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,TRUE, &pPoolItem)== SFX_ITEM_SET) + { + bool bZero = false; + USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + if(nPos==0) + { + //switch to value + bZero = true; + nPos = 2; + } + else + nPos--; + + if( nPos < m_aLB_CrossesAt.GetEntryCount() ) + m_aLB_CrossesAt.SelectEntryPos( nPos ); + CrossesAtSelectHdl( (void*)0 ); + + if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,TRUE, &pPoolItem)== SFX_ITEM_SET || bZero ) + { + double fCrossover = 0.0; + if( !bZero ) + fCrossover = (((const SvxDoubleItem*)pPoolItem)->GetValue()); + if( m_bCrossingAxisIsCategoryAxis ) + m_aED_CrossesAtCategory.SelectEntryPos( static_cast<USHORT>(::rtl::math::round(fCrossover-1.0)) ); + else + m_aED_CrossesAt.SetValue(fCrossover); + } + else + { + m_aED_CrossesAtCategory.SetNoSelection(); + m_aED_CrossesAt.SetTextValue(XubString()); + } + } + else + { + m_aLB_CrossesAt.SetNoSelection(); + m_aED_CrossesAt.Enable( FALSE ); + } + + // Labels + if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET ) + { + USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + if( nPos < m_aLB_PlaceLabels.GetEntryCount() ) + m_aLB_PlaceLabels.SelectEntryPos( nPos ); + } + else + m_aLB_PlaceLabels.SetNoSelection(); + PlaceLabelsSelectHdl( (void*)0 ); + + // Tick marks + long nTicks=0,nMinorTicks=0; + if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) + nTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); + if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) + nMinorTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); + + m_aCB_TicksInner.Check(BOOL(nTicks&CHAXIS_MARK_INNER)); + m_aCB_TicksOuter.Check(BOOL(nTicks&CHAXIS_MARK_OUTER)); + m_aCB_MinorInner.Check(BOOL(nMinorTicks&CHAXIS_MARK_INNER)); + m_aCB_MinorOuter.Check(BOOL(nMinorTicks&CHAXIS_MARK_OUTER)); + + // Tick position + if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET ) + { + USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + if( nPos < m_aLB_PlaceTicks.GetEntryCount() ) + m_aLB_PlaceTicks.SelectEntryPos( nPos ); + } + else + m_aLB_PlaceTicks.SetNoSelection(); + + + if( !m_bSupportAxisPositioning ) + { + m_aFL_AxisLine.Show(false); + m_aFT_CrossesAt.Show(false); + m_aLB_CrossesAt.Show(false); + m_aED_CrossesAt.Show(false); + m_aED_CrossesAtCategory.Show(false); + m_aCB_AxisBetweenCategories.Show(false); + + m_aFL_Labels.Show(false); + m_aFT_PlaceLabels.Show(false); + m_aLB_PlaceLabels.Show(false); + m_aFT_LabelDistance.Show(false); + m_aED_LabelDistance.Show(false); + + m_aFL_Vertical.Show(false); + m_aFT_PlaceTicks.Show(false); + m_aLB_PlaceTicks.Show(false); + + long nYDiff = m_aFL_AxisLine.GetPosPixel().Y() - m_aFL_Ticks.GetPosPixel().Y(); + lcl_shiftY( m_aFL_Ticks, nYDiff ); + lcl_shiftY( m_aFT_Major, nYDiff ); + lcl_shiftY( m_aCB_TicksInner, nYDiff ); + lcl_shiftY( m_aCB_TicksOuter, nYDiff ); + + lcl_shiftY( m_aFT_Minor, nYDiff ); + lcl_shiftY( m_aCB_MinorInner, nYDiff ); + lcl_shiftY( m_aCB_MinorOuter, nYDiff ); + } + else if( !AxisHelper::isAxisPositioningEnabled() ) + { + m_aFL_AxisLine.Enable(false); + m_aFT_CrossesAt.Enable(false); + m_aLB_CrossesAt.Enable(false); + m_aED_CrossesAt.Enable(false); + m_aED_CrossesAtCategory.Enable(false); + m_aCB_AxisBetweenCategories.Enable(false); + + m_aFL_Labels.Enable(false); + m_aFT_PlaceLabels.Enable(false); + m_aLB_PlaceLabels.Enable(false); + m_aFT_LabelDistance.Enable(false); + m_aED_LabelDistance.Enable(false); + + m_aFL_Vertical.Enable(false); + m_aFT_PlaceTicks.Enable(false); + m_aLB_PlaceTicks.Enable(false); + + //todo: maybe set a special help id to all those controls + } +} + +int AxisPositionsTabPage::DeactivatePage(SfxItemSet* pItemSet) +{ + if( pItemSet ) + FillItemSet( *pItemSet ); + + return LEAVE_PAGE; +} + +void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter ) +{ + m_pNumFormatter = pFormatter; + m_aED_CrossesAt.SetFormatter( m_pNumFormatter ); + m_aED_CrossesAt.UseInputStringForFormatting(); + + const SfxPoolItem *pPoolItem = NULL; + if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue(); + m_aED_CrossesAt.SetFormatKey( nFmt ); + } +} + +void AxisPositionsTabPage::SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis ) +{ + m_bCrossingAxisIsCategoryAxis = bCrossingAxisIsCategoryAxis; +} + +void AxisPositionsTabPage::SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories ) +{ + m_aCategories = rCategories; +} + +void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning ) +{ + m_bSupportAxisPositioning = bSupportAxisPositioning; +} + +IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG ) +{ + USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos(); + m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis ); + m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis ); + + if(! m_aED_CrossesAt.GetText().Len() ) + m_aED_CrossesAt.SetValue(0.0); + if( 0 == m_aED_CrossesAtCategory.GetSelectEntryCount() ) + m_aED_CrossesAtCategory.SelectEntryPos(0); + + PlaceLabelsSelectHdl( (void*)0 ); + return 0; +} + +IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG ) +{ + USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); + + bool bEnableTickmarkPlacement = (nLabelPos>1); + if( bEnableTickmarkPlacement ) + { + USHORT nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos(); + if( nLabelPos-2 == nAxisPos ) + bEnableTickmarkPlacement=false; + } + m_aFT_PlaceTicks.Enable(bEnableTickmarkPlacement); + m_aLB_PlaceTicks.Enable(bEnableTickmarkPlacement); + + return 0; +} + +//............................................................................. +} //namespace chart +//............................................................................. diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx new file mode 100644 index 000000000000..913f1a08a2f9 --- /dev/null +++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tp_AxisPositions.hxx,v $ + * $Revision: 1.1.4.2 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _CHART2_TP_AXISPOSITIONS_HXX +#define _CHART2_TP_AXISPOSITIONS_HXX + +// header for SfxTabPage +#include <sfx2/tabdlg.hxx> +#include <svtools/fmtfield.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +//class SvNumberFormatter; + +//............................................................................. +namespace chart +{ +//............................................................................. + +class AxisPositionsTabPage : public SfxTabPage +{ +public: + AxisPositionsTabPage( Window* pParent, const SfxItemSet& rInAttrs ); + + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); + virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual void Reset( const SfxItemSet& rInAttrs ); + using TabPage::DeactivatePage; + virtual int DeactivatePage( SfxItemSet* pItemSet = NULL ); + + void SetNumFormatter( SvNumberFormatter* pFormatter ); + + void SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis ); + void SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories ); + + void SupportAxisPositioning( bool bSupportAxisPositioning ); + +private: //methods: + DECL_LINK( CrossesAtSelectHdl, void* ); + DECL_LINK( PlaceLabelsSelectHdl, void* ); + +private: //member: + FixedLine m_aFL_AxisLine; + FixedText m_aFT_CrossesAt; + ListBox m_aLB_CrossesAt; + FormattedField m_aED_CrossesAt; + ComboBox m_aED_CrossesAtCategory; + CheckBox m_aCB_AxisBetweenCategories; + + FixedLine m_aFL_Labels; + FixedText m_aFT_PlaceLabels; + ListBox m_aLB_PlaceLabels; + FixedText m_aFT_LabelDistance; + FormattedField m_aED_LabelDistance; + + FixedLine m_aFL_Ticks; + + FixedText m_aFT_Major; + CheckBox m_aCB_TicksInner; + CheckBox m_aCB_TicksOuter; + + FixedText m_aFT_Minor; + CheckBox m_aCB_MinorInner; + CheckBox m_aCB_MinorOuter; + + FixedLine m_aFL_Vertical; + FixedText m_aFT_PlaceTicks; + ListBox m_aLB_PlaceTicks; + + FixedLine m_aFL_Grids; + CheckBox m_aCB_MajorGrid; + PushButton m_aPB_MajorGrid; + CheckBox m_aCB_MinorGrid; + PushButton m_aPB_MinorGrid; + + SvNumberFormatter* m_pNumFormatter; + + bool m_bCrossingAxisIsCategoryAxis; + ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories; + + bool m_bSupportAxisPositioning; +}; + +//............................................................................. +} //namespace chart +//............................................................................. + +#endif diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.src b/chart2/source/controller/dialogs/tp_AxisPositions.src new file mode 100644 index 000000000000..1628c1afaa3f --- /dev/null +++ b/chart2/source/controller/dialogs/tp_AxisPositions.src @@ -0,0 +1,295 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tp_AxisPositions.src,v $ + * $Revision: 1.1.4.2 $ + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#include "HelpIds.hrc" +#include "TabPages.hrc" + +#define Y0 3 +#define Y1 (Y0+13) +#define Y2 (Y1) +#define Y3 (Y2+16) +#define Y4 (Y3+13) +#define Y5 (Y4) +#define Y6 (Y5+16) +#define Y7 (Y6+13) +#define Y8 (Y7+16) +#define Y9 (Y8+16) +#define Y10 (Y9+16) +#define Y11 (Y10+13) +#define Y12 (Y11+16) + +#define EDITWIDTH 50 +#define LABELWIDTH 88 +#define MAXLABELWIDTH 138 + +#define X1 6 +#define X2 11 +#define X3 (X2+LABELWIDTH+4) +#define X4 (X2+MAXLABELWIDTH+4) +#define X5 (X4+EDITWIDTH+5) + +#define XTICK_1 X2 +#define XTICK_2 (XTICK_1+60) +#define XTICK_3 (XTICK_2+60) +#define XTICK_4 (XTICK_3+60) +#define XTICK_5 (XTICK_4+6) +#define TICKWIDTH 59 + +TabPage TP_AXIS_POSITIONS +{ + Hide = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + + FixedLine FL_AXIS_LINE + { + Pos = MAP_APPFONT ( X1 , Y0 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Axis line" ; + }; + + FixedText FT_CROSSES_OTHER_AXIS_AT + { + Pos = MAP_APPFONT ( X2 , Y1 ) ; + Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ; + Text [ en-US ] = "~Cross other axis at" ; + }; + ListBox LB_CROSSES_OTHER_AXIS_AT + { + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X4 , Y1-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + + StringList [ en-US ] = + { + "Start" ; + "End" ; + "Value" ; + "Category" ; + }; + }; + SpinField EDT_CROSSES_OTHER_AXIS_AT + { + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( X5 , Y1-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + }; + ComboBox EDT_CROSSES_OTHER_AXIS_AT_CATEGORY + { + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( X5 , Y1-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; + + CheckBox CB_AXIS_BETWEEN_CATEGORIES + { + Hide = TRUE; + Pos = MAP_APPFONT ( X2 , Y2 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Axis ~between categories" ; + }; + + FixedLine FL_LABELS + { + Pos = MAP_APPFONT ( X1 , Y3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Labels" ; + }; + FixedText FT_PLACE_LABELS + { + Pos = MAP_APPFONT ( X2 , Y4 ) ; + Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ; + Text [ en-US ] = "~Place labels" ; + }; + ListBox LB_PLACE_LABELS + { + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X4 , Y4-2 ) ; + Size = MAP_APPFONT ( 89 , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + + StringList [ en-US ] = + { + "Near axis" ; + "Near axis (other side)" ; + "Outside start" ; + "Outside end" ; + }; + }; + + FixedText FT_AXIS_LABEL_DISTANCE + { + Hide = TRUE; + Pos = MAP_APPFONT ( X2 , Y5 ) ; + Size = MAP_APPFONT ( MAXLABELWIDTH , 8 ) ; + Text [ en-US ] = "~Distance" ; + }; + SpinField EDT_AXIS_LABEL_DISTANCE + { + Hide = TRUE; + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( X4 , Y5-2 ) ; + Size = MAP_APPFONT ( 89 , 12 ) ; + TabStop = TRUE ; + }; + + FixedLine FL_TICKS + { + Pos = MAP_APPFONT ( X1 , Y6 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text[ en-US ] = "Interval marks"; + }; + FixedText FT_MAJOR + { + Pos = MAP_APPFONT ( XTICK_1 , Y7 ) ; + Size = MAP_APPFONT ( TICKWIDTH , 8 ) ; + Text [ en-US ] = "Major:" ; + }; + CheckBox CB_TICKS_INNER + { + Pos = MAP_APPFONT ( XTICK_2 , Y7 ) ; + Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; + Text [ en-US ] = "~Inner"; + }; + CheckBox CB_TICKS_OUTER + { + Pos = MAP_APPFONT ( XTICK_3 , Y7 ) ; + Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; + Text [ en-US ] = "~Outer"; + }; + + FixedText FT_MINOR + { + Pos = MAP_APPFONT ( XTICK_1 , Y8 ) ; + Size = MAP_APPFONT ( TICKWIDTH , 8 ) ; + Text [ en-US ] = "Minor:" ; + }; + CheckBox CB_MINOR_INNER + { + Pos = MAP_APPFONT ( XTICK_2 , Y8 ); + Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; + Text [ en-US ] = "I~nner"; + }; + CheckBox CB_MINOR_OUTER + { + Pos = MAP_APPFONT ( XTICK_3 , Y8 ) ; + Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; + Text [ en-US ] = "O~uter"; + }; + + FixedLine FL_VERTICAL + { + Hide = TRUE ; + Pos = MAP_APPFONT ( XTICK_4 , Y7 ) ; + Size = MAP_APPFONT ( 6 , 25 ) ; + Vert = TRUE ; + }; + + FixedText FT_PLACE_TICKS + { + Pos = MAP_APPFONT ( X2 , Y9 ); + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "Place ~marks"; + }; + ListBox LB_PLACE_TICKS + { + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X3 , Y9-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + + StringList [ en-US ] = + { + "At labels" ; + "At axis" ; + "At axis and labels" ; + }; + }; + + + FixedLine FL_GRIDS + { + Hide = TRUE ; + Pos = MAP_APPFONT ( X1 , Y10 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text[ en-US ] = "Grids"; + }; + CheckBox CB_MAJOR_GRID + { + Hide = TRUE ; + Pos = MAP_APPFONT ( X2 , Y11 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show major ~grid" ; + }; + PushButton PB_MAJOR_GRID + { + Hide = TRUE ; + TabStop = TRUE; + Pos = MAP_APPFONT ( X3 , Y11-2 ); + Size = MAP_APPFONT ( 54 , 14 ); + Text [ en-US ] = "Mo~re..."; + }; + CheckBox CB_MINOR_GRID + { + Hide = TRUE ; + Pos = MAP_APPFONT ( X2 , Y12 ) ; + Size = MAP_APPFONT ( 150 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Show minor grid" ; + }; + PushButton PB_MINOR_GRID + { + Hide = TRUE ; + TabStop = TRUE; + Pos = MAP_APPFONT ( X3 , Y12-2 ); + Size = MAP_APPFONT ( 54 , 14 ); + Text [ en-US ] = "Mor~e..."; + }; +}; diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index c2bf42744a50..d799fd31b89d 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -37,6 +37,7 @@ #include "Strings.hrc" #include "chartview/ChartSfxItemIds.hxx" #include "NoWarningThisInCTOR.hxx" +#include "AxisHelper.hxx" #ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> @@ -74,7 +75,7 @@ namespace chart namespace { -void lcl_shiftControls( Control& rEdit, CheckBox& rAuto, long nNewXPos ) +void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos ) { Point aPos( rEdit.GetPosPixel() ); long nShift = nNewXPos - aPos.X(); @@ -86,12 +87,24 @@ void lcl_shiftControls( Control& rEdit, CheckBox& rAuto, long nNewXPos ) rAuto.SetPosPixel(aPos); } +void lcl_placeControlsAtY( Control& rTop, Control& rBottom, long nNewYPos ) +{ + Point aPos( rTop.GetPosPixel() ); + long nShift = nNewYPos - aPos.Y(); + aPos.Y() = nNewYPos; + rTop.SetPosPixel(aPos); + + aPos = rBottom.GetPosPixel(); + aPos.Y() += nShift; + rBottom.SetPosPixel(aPos); +} + } ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : - SfxTabPage(pWindow, SchResId(TP_SCALE_Y), rInAttrs), + SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs), - aFlScale(this, SchResId(FL_SCALE_Y)), + aFlScale(this, SchResId(FL_SCALE)), aTxtMin (this, SchResId (TXT_MIN)), aFmtFldMin(this, SchResId(EDT_MIN)), aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)), @@ -104,27 +117,22 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : aTxtHelp (this, SchResId (TXT_STEP_HELP)), aMtStepHelp (this, SchResId (MT_STEPHELP)), aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)), + aTxtOrigin (this, SchResId (TXT_ORIGIN)), aFmtFldOrigin(this, SchResId(EDT_ORIGIN)), aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)), + aCbxLogarithm(this, SchResId(CBX_LOGARITHM)), aCbxReverse(this, SchResId(CBX_REVERSE)), - aFlTicks(this,SchResId(FL_TICKS)), - aCbxTicksInner(this, SchResId(CBX_TICKS_INNER)), - aCbxTicksOuter(this, SchResId(CBX_TICKS_OUTER)), - - aFlHelpTicks(this,SchResId(FL_HELPTICKS)), - aCbxHelpTicksInner(this, SchResId(CBX_HELPTICKS_INNER)), - aCbxHelpTicksOuter(this, SchResId(CBX_HELPTICKS_OUTER)), - fMin(0.0), fMax(0.0), fStepMain(0.0), nStepHelp(0), fOrigin(0.0), nAxisType(chart2::AxisType::REALNUMBER), - pNumFormatter(NULL) + pNumFormatter(NULL), + m_bShowAxisOrigin(false) { FreeResource(); SetExchangeSupport(); @@ -167,37 +175,6 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); - - //tickmark controls - long nCheckWidth = 1 + ::std::max( aCbxTicksInner.CalcMinimumSize().Width(), aCbxHelpTicksInner.CalcMinimumSize().Width() ); - aSize = aCbxTicksInner.GetSizePixel(); - aSize.Width() = nCheckWidth; - - long nCheckDistance = aCbxTicksInner.LogicToPixel( Size(RSC_SP_CTRL_X, 0), MapMode(MAP_APPFONT) ).Width(); - long nNewCheckXPos = aCbxTicksInner.GetPosPixel().X() + nCheckWidth + nCheckDistance; - - aCbxTicksOuter.SetSizePixel( aCbxTicksOuter.CalcMinimumSize() ); - aCbxHelpTicksOuter.SetSizePixel( aCbxHelpTicksOuter.CalcMinimumSize() ); - - nWidthOfOtherControls = aCbxTicksOuter.GetSizePixel().Width(); - nLeftSpace = nDialogWidth - nNewCheckXPos - nWidthOfOtherControls; - - if(nLeftSpace>=0) - { - aCbxTicksInner.SetSizePixel(aSize); - aCbxHelpTicksInner.SetSizePixel(aSize); - - if( nNewCheckXPos < nNewXPos && (nDialogWidth - nNewXPos - nWidthOfOtherControls)>=0 ) - nNewCheckXPos = nNewXPos;//alignement looks nicer - - Point aPos( aCbxTicksOuter.GetPosPixel() ); - aPos.X() = nNewCheckXPos; - aCbxTicksOuter.SetPosPixel(aPos); - - aPos = aCbxHelpTicksOuter.GetPosPixel(); - aPos.X() = nNewCheckXPos; - aCbxHelpTicksOuter.SetPosPixel(aPos); - } } } @@ -224,12 +201,20 @@ void ScaleTabPage::EnableControls() aTxtHelp.Enable( bEnableForValueOrPercentAxis ); aMtStepHelp.Enable( bEnableForValueOrPercentAxis ); aCbxAutoStepHelp.Enable( bEnableForValueOrPercentAxis ); - aTxtOrigin.Enable( bEnableForValueOrPercentAxis ); - aFmtFldOrigin.Enable( bEnableForValueOrPercentAxis ); - aCbxAutoOrigin.Enable( bEnableForValueOrPercentAxis ); aCbxLogarithm.Enable( bEnableForValueOrPercentAxis ); + + aTxtOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); + aFmtFldOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); + aCbxAutoOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); + + long nNewYPos = aTxtOrigin.GetPosPixel().Y(); + if( m_bShowAxisOrigin ) + nNewYPos += ( aTxtOrigin.GetPosPixel().Y() - aTxtHelp.GetPosPixel().Y() ); + lcl_placeControlsAtY( aCbxLogarithm, aCbxReverse, nNewYPos ); } + + IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx ) { if (pCbx == &aCbxAutoMin) @@ -265,21 +250,6 @@ BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs) { DBG_ASSERT( pNumFormatter, "No NumberFormatter available" ); - long nTicks=0; - long nHelpTicks=0; - - if(aCbxHelpTicksInner.IsChecked()) - nHelpTicks|=CHAXIS_MARK_INNER; - if(aCbxHelpTicksOuter.IsChecked()) - nHelpTicks|=CHAXIS_MARK_OUTER; - if(aCbxTicksInner.IsChecked()) - nTicks|=CHAXIS_MARK_INNER; - if(aCbxTicksOuter.IsChecked()) - nTicks|=CHAXIS_MARK_OUTER; - - rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks)); - rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nHelpTicks)); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,aCbxAutoMin.IsChecked())); rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,aCbxAutoMax.IsChecked())); rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,aCbxAutoStepHelp.IsChecked())); @@ -311,17 +281,6 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) EnableControls(); } - long nTicks=0,nHelpTicks=0; - if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) - nTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); - if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) - nHelpTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); - - aCbxHelpTicksInner.Check(BOOL(nHelpTicks&CHAXIS_MARK_INNER)); - aCbxHelpTicksOuter.Check(BOOL(nHelpTicks&CHAXIS_MARK_OUTER)); - aCbxTicksInner.Check(BOOL(nTicks&CHAXIS_MARK_INNER)); - aCbxTicksOuter.Check(BOOL(nTicks&CHAXIS_MARK_OUTER)); - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,TRUE,&pPoolItem) == SFX_ITEM_SET) aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); @@ -421,17 +380,6 @@ int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet) pEdit = &aFmtFldStepMain; nErrStrId = STR_STEP_GT_ZERO; } - //user often forgets to switch visibility of help tickmarks on - if( !aCbxAutoStepHelp.IsChecked() && aMtStepHelp.IsModified() && nStepHelp > 1 - && !aCbxHelpTicksInner.IsChecked() && !aCbxHelpTicksOuter.IsChecked() ) - //&& !aCbxHelpTicksInner.IsModified() && !aCbxHelpTicksOuter.IsModified() ) - { - //check help ticks like main ticks - if(aCbxTicksInner.IsChecked()) - aCbxHelpTicksInner.Check(); - if(aCbxTicksOuter.IsChecked()) - aCbxHelpTicksOuter.Check(); - } //check wich entries need user action @@ -511,24 +459,40 @@ void ScaleTabPage::SetNumFormat() aFmtFldMin.SetFormatKey( nFmt ); aFmtFldOrigin.SetFormatKey( nFmt ); - // for steps use standard format if date or time format is chosen - short eType = pNumFormatter->GetType( nFmt ); - if( pNumFormatter && - ( eType == NUMBERFORMAT_DATE || - eType == NUMBERFORMAT_TIME || - eType == NUMBERFORMAT_DATETIME ) ) + if( pNumFormatter ) { - const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt ); - if( pFormat ) - nFmt = pNumFormatter->GetStandardFormat( pFormat->GetLanguage()); - else - nFmt = pNumFormatter->GetStandardIndex(); + 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 ); + } } aFmtFldStepMain.SetFormatKey( nFmt ); } } +void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin ) +{ + m_bShowAxisOrigin = bShowOrigin; + if( !AxisHelper::isAxisPositioningEnabled() ) + m_bShowAxisOrigin = true; +} + bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL */ ) { if( nResIdMessage == 0 ) diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index ea222f10a1c0..7453b3e649b6 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -37,12 +37,9 @@ // header for FixedText #include <vcl/fixed.hxx> // header for CheckBox -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif // header for MetricField #include <vcl/field.hxx> -//class SvNumberFormatter; //............................................................................. namespace chart @@ -51,6 +48,20 @@ namespace chart class ScaleTabPage : public SfxTabPage { +public: + ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs ); + + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); + virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual void Reset( const SfxItemSet& rInAttrs ); + using TabPage::DeactivatePage; + virtual int DeactivatePage( SfxItemSet* pItemSet = NULL ); + + void SetNumFormatter( SvNumberFormatter* pFormatter ); + void SetNumFormat(); + + void ShowAxisOrigin( bool bShowOrigin ); + private: FixedLine aFlScale; @@ -73,17 +84,10 @@ private: FixedText aTxtOrigin; FormattedField aFmtFldOrigin; CheckBox aCbxAutoOrigin; + CheckBox aCbxLogarithm; CheckBox aCbxReverse; - FixedLine aFlTicks; - CheckBox aCbxTicksInner; - CheckBox aCbxTicksOuter; - - FixedLine aFlHelpTicks; - CheckBox aCbxHelpTicksInner; - CheckBox aCbxHelpTicksOuter; - double fMin; double fMax; double fStepMain; @@ -92,6 +96,8 @@ private: int nAxisType; SvNumberFormatter* pNumFormatter; + bool m_bShowAxisOrigin; + void EnableControls(); DECL_LINK( EnableValueHdl, CheckBox* ); @@ -110,18 +116,6 @@ private: @return false, if nResIdMessage was 0, true otherwise */ bool ShowWarning( USHORT nResIdMessage, Edit * pControl = NULL ); - -public: - ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); - virtual void Reset( const SfxItemSet& rInAttrs ); - using TabPage::DeactivatePage; - virtual int DeactivatePage( SfxItemSet* pItemSet = NULL ); - - void SetNumFormatter( SvNumberFormatter* pFormatter ); - void SetNumFormat(); }; //............................................................................. diff --git a/chart2/source/controller/dialogs/tp_Scale.src b/chart2/source/controller/dialogs/tp_Scale.src index 20e3e557040d..258c92b56aaa 100644 --- a/chart2/source/controller/dialogs/tp_Scale.src +++ b/chart2/source/controller/dialogs/tp_Scale.src @@ -30,92 +30,109 @@ #include "HelpIds.hrc" #include "TabPages.hrc" -TabPage TP_SCALE_Y +#define YLine1 3 +#define Y1 (YLine1+13) +#define Y2 (Y1+16) +#define Y3 (Y2+16) +#define Y4 (Y3+16) +#define Y5 (Y4+16) +#define Y6 (Y5+17) +#define Y7 (Y6+15) + +#define LABELWIDTH 88 +#define AUTOCHECKWIDTH 88 +#define EDITWIDTH 50 +#define X1 6 +#define X2 11 +#define X3 (X2+LABELWIDTH+4) +#define X4 (X3+EDITWIDTH+5) + +TabPage TP_SCALE { Hide = TRUE ; - HelpID = HID_SCH_SCALE_Y ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_SCALE_Y + FixedLine FL_SCALE { - Pos = MAP_APPFONT ( 5 , 4 ) ; + Pos = MAP_APPFONT ( X1 , YLine1 ) ; Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Axis scale" ; + Text [ en-US ] = "Scale" ; }; FixedText TXT_MIN { - Pos = MAP_APPFONT ( 11 , 16 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; + Pos = MAP_APPFONT ( X2 , Y1 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; Text [ en-US ] = "~Minimum:" ; }; SpinField EDT_MIN { Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( 103 , 14 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; + Pos = MAP_APPFONT ( X3 , Y1-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_MIN { - Pos = MAP_APPFONT ( 159 , 15 ) ; - Size = MAP_APPFONT ( 88 , 10 ) ; + Pos = MAP_APPFONT ( X4 , Y1-1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; + Text [ en-US ] = "~Automatic" ; }; + FixedText TXT_MAX { - Pos = MAP_APPFONT ( 11 , 32 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; + Pos = MAP_APPFONT ( X2 , Y2 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; Text [ en-US ] = "Ma~ximum:" ; }; SpinField EDT_MAX { Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( 103 , 30 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; + Pos = MAP_APPFONT ( X3 , Y2-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_MAX { - Pos = MAP_APPFONT ( 159 , 31 ) ; - Size = MAP_APPFONT ( 88 , 10 ) ; + Pos = MAP_APPFONT ( X4 , Y2-1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; + Text [ en-US ] = "A~utomatic" ; }; FixedText TXT_STEP_MAIN { - Pos = MAP_APPFONT ( 11 , 48 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; + Pos = MAP_APPFONT ( X2 , Y3 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; Text [ en-US ] = "Ma~jor interval:" ; }; SpinField EDT_STEP_MAIN { Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 46 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; + Pos = MAP_APPFONT ( X3 , Y3-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_STEP_MAIN { - Pos = MAP_APPFONT ( 159 , 47 ) ; - Size = MAP_APPFONT ( 88 , 10 ) ; + Pos = MAP_APPFONT ( X4 , Y3-1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; + Text [ en-US ] = "Au~tomatic" ; }; FixedText TXT_STEP_HELP { - Pos = MAP_APPFONT ( 11 , 64 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Text [ en-US ] = "Minor inter~val:" ; + Pos = MAP_APPFONT ( X2 , Y4 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "Minor interval ~count:" ; }; MetricField MT_STEPHELP { Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 62 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; + Pos = MAP_APPFONT ( X3 , Y4-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; Repeat = TRUE ; Spin = TRUE ; @@ -129,80 +146,48 @@ TabPage TP_SCALE_Y }; CheckBox CBX_AUTO_STEP_HELP { - Pos = MAP_APPFONT ( 159 , 63 ) ; - Size = MAP_APPFONT ( 88 , 10 ) ; + Pos = MAP_APPFONT ( X4 , Y4-1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; + Text [ en-US ] = "Aut~omatic" ; }; + FixedText TXT_ORIGIN { - Pos = MAP_APPFONT ( 11 , 80 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Text [ en-US ] = "Axi~s at:" ; + Pos = MAP_APPFONT ( X2 , Y5 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "Reference ~value:" ; }; SpinField EDT_ORIGIN { Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( 103 , 78 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; + Pos = MAP_APPFONT ( X3 , Y5-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_ORIGIN { - Pos = MAP_APPFONT ( 159 , 79 ) ; - Size = MAP_APPFONT ( 88 , 10 ) ; + Pos = MAP_APPFONT ( X4 , Y5-1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Automatic" ; + Text [ en-US ] = "Automat~ic" ; }; + CheckBox CBX_LOGARITHM { - Pos = MAP_APPFONT ( 11 , 97 ) ; + Pos = MAP_APPFONT ( X2 , Y6 ) ; Size = MAP_APPFONT ( 244 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Logarithmic scale" ; }; + CheckBox CBX_REVERSE { - Pos = MAP_APPFONT ( 11 , 112 ) ; + Pos = MAP_APPFONT ( X2 , Y7 ) ; Size = MAP_APPFONT ( 244 , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "Reverse ~direction" ; - }; - FixedLine FL_TICKS - { - Pos = MAP_APPFONT ( 6 , 129 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text[ en-US ] = "Major interval marks"; - }; - CheckBox CBX_TICKS_INNER - { - Pos = MAP_APPFONT ( 11 , 140 ) ; - Size = MAP_APPFONT ( 78 , 10 ) ; - Text [ en-US ] = "I~nner"; - }; - CheckBox CBX_TICKS_OUTER - { - Pos = MAP_APPFONT ( 103 , 140 ) ; - Size = MAP_APPFONT ( 78 , 10 ) ; - Text [ en-US ] = "~Outer"; - }; - FixedLine FL_HELPTICKS - { - Pos = MAP_APPFONT ( 6 , 155 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text[ en-US ] = "Minor interval marks"; - }; - CheckBox CBX_HELPTICKS_INNER - { - Pos = MAP_APPFONT ( 11 , 166 ); - Size = MAP_APPFONT ( 78 , 10 ) ; - Text [ en-US ] = "Inne~r"; - }; - CheckBox CBX_HELPTICKS_OUTER - { - Pos = MAP_APPFONT ( 103 , 166 ) ; - Size = MAP_APPFONT ( 78 , 10 ) ; - Text [ en-US ] = "Out~er"; + Text [ en-US ] = "~Reverse direction" ; }; + }; diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc index 8277ff8c91a0..68edcdc54dd5 100644 --- a/chart2/source/controller/inc/HelpIds.hrc +++ b/chart2/source/controller/inc/HelpIds.hrc @@ -45,8 +45,6 @@ #define HID_SCH_LEGEND_POS (HID_SCH_START + 5) #define HID_SCH_DATA_DESCR (HID_SCH_START + 6) -#define HID_SCH_SCALE_Y (HID_SCH_START + 7) - #define HID_SCH_STAT (HID_SCH_START + 8) #define HID_SCH_WIN_DOCUMENT (HID_SCH_START + 9) #define HID_SCH_CTL_DATA (HID_SCH_START + 10) diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index 3eee59149103..39a738563c50 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -58,12 +58,17 @@ public: bool ProvidesBarConnectors() const; bool HasAreaProperties() const; bool HasSymbolProperties() const; - bool HasScaleProperties() const; - bool CanAxisLabelsBeStaggered() const; bool HasNumberProperties() const; bool ProvidesStartingAngle() const; bool ProvidesMissingValueTreatments() const; + bool HasScaleProperties() const; + bool CanAxisLabelsBeStaggered() const; + bool IsSupportingAxisPositioning() const; + bool ShowAxisOrigin() const; + bool IsCrossingAxisIsCategoryAxis() const; + const ::com::sun::star::uno::Sequence< rtl::OUString >& GetCategories() const; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > getDocument() const; @@ -81,12 +86,18 @@ private: bool m_bProvidesBarConnectors; bool m_bHasAreaProperties; bool m_bHasSymbolProperties; - bool m_bHasScaleProperties; - bool m_bCanAxisLabelsBeStaggered; bool m_bHasNumberProperties; bool m_bProvidesStartingAngle; bool m_bProvidesMissingValueTreatments; + bool m_bHasScaleProperties; + bool m_bCanAxisLabelsBeStaggered; + + bool m_bSupportingAxisPositioning; + bool m_bShowAxisOrigin; + bool m_bIsCrossingAxisIsCategoryAxis; + ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument; }; diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index f827b7893cf6..f1bc4ce4097c 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -42,12 +42,13 @@ #include "ChartModelHelper.hxx" #include "AxisHelper.hxx" #include "CommonConverters.hxx" + +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/AxisOrientation.hpp> -// #ifndef _COMPHELPER_PROCESSFACTORY_HXX_ -// #include <comphelper/processfactory.hxx> -// #endif // for SfxBoolItem #include <svtools/eitem.hxx> // for SvxDoubleItem @@ -310,6 +311,55 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS } break; + case SCHATTR_AXIS_POSITION: + { + ::com::sun::star::chart::ChartAxisPosition eAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO ); + GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eAxisPos; + rOutItemSet.Put( SfxInt32Item( nWhichId, eAxisPos ) ); + } + break; + + case SCHATTR_AXIS_POSITION_VALUE: + { + double fValue = 0.0; + if( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue ) + rOutItemSet.Put( SvxDoubleItem( fValue, nWhichId ) ); + } + break; + + case SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT: + { + //read only item + //necessary tp display the crossing value with an appropriate format + + Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( + m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); + + Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); + + sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( + xCrossingMainAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) ); + + rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey )); + } + break; + + case SCHATTR_AXIS_LABEL_POSITION: + { + ::com::sun::star::chart::ChartAxisLabelPosition ePos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS ); + GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= ePos; + rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) ); + } + break; + + case SCHATTR_AXIS_MARK_POSITION: + { + ::com::sun::star::chart::ChartAxisMarkPosition ePos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS ); + GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= ePos; + rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) ); + } + break; + case SCHATTR_TEXT_DEGREES: { // convert double to int (times 100) @@ -537,11 +587,163 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI { aScale.Origin = aValue; bSetScale = true; + + if( !AxisHelper::isAxisPositioningEnabled() ) + { + //keep old and new settings for axis positioning in sync somehow + Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( + m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); + + sal_Int32 nDimensionIndex=0; + sal_Int32 nAxisIndex=0; + if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 ) + { + Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ), uno::UNO_QUERY ); + if( xCrossingMainAxis.is() ) + { + double fValue = 0.0; + if( aValue >>= fValue ) + { + xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE )); + xCrossingMainAxis->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue )); + } + else + xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START )); + } + } + } + } + } + } + break; + + case SCHATTR_AXIS_POSITION: + { + ::com::sun::star::chart::ChartAxisPosition eAxisPos = + (::com::sun::star::chart::ChartAxisPosition) + static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); + + ::com::sun::star::chart::ChartAxisPosition eOldAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO ); + bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eOldAxisPos ); + + if( !bPropExisted || ( eOldAxisPos != eAxisPos )) + { + GetPropertySet()->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eAxisPos )); + bChangedOtherwise = true; + + //move the parallel axes to the other side if necessary + if( eAxisPos==::com::sun::star::chart::ChartAxisPosition_START || eAxisPos==::com::sun::star::chart::ChartAxisPosition_END ) + { + Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY ); + if( xParallelAxis.is() ) + { + ::com::sun::star::chart::ChartAxisPosition eOtherPos; + if( xParallelAxis->getPropertyValue( C2U( "CrossoverPosition" ) ) >>= eOtherPos ) + { + if( eOtherPos == eAxisPos ) + { + ::com::sun::star::chart::ChartAxisPosition eOppositePos = + (eAxisPos==::com::sun::star::chart::ChartAxisPosition_START) + ? ::com::sun::star::chart::ChartAxisPosition_END + : ::com::sun::star::chart::ChartAxisPosition_START; + xParallelAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eOppositePos )); + } + } + } + } + } + } + break; + + case SCHATTR_AXIS_POSITION_VALUE: + { + double fValue = static_cast< const SvxDoubleItem & >( rItemSet.Get( nWhichId )).GetValue(); + + double fOldValue = 0.0; + bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fOldValue ); + + if( !bPropExisted || ( fOldValue != fValue )) + { + GetPropertySet()->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue )); + bChangedOtherwise = true; + + //keep old and new settings for axis positioning in sync somehow + { + Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( + m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); + + sal_Int32 nDimensionIndex=0; + sal_Int32 nAxisIndex=0; + if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 && nDimensionIndex==0 ) + { + Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); + if( xCrossingMainAxis.is() ) + { + ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() ); + aCrossingScale.Origin = uno::makeAny(fValue); + xCrossingMainAxis->setScaleData(aCrossingScale); + } + } + } + } + } + break; + + case SCHATTR_AXIS_LABEL_POSITION: + { + ::com::sun::star::chart::ChartAxisLabelPosition ePos = + (::com::sun::star::chart::ChartAxisLabelPosition) + static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); + + ::com::sun::star::chart::ChartAxisLabelPosition eOldPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS ); + bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= eOldPos ); + + if( !bPropExisted || ( eOldPos != ePos )) + { + GetPropertySet()->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( ePos )); + bChangedOtherwise = true; + + //move the parallel axes to the other side if necessary + if( ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START || ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END ) + { + Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY ); + if( xParallelAxis.is() ) + { + ::com::sun::star::chart::ChartAxisLabelPosition eOtherPos; + if( xParallelAxis->getPropertyValue( C2U( "LabelPosition" ) ) >>= eOtherPos ) + { + if( eOtherPos == ePos ) + { + ::com::sun::star::chart::ChartAxisLabelPosition eOppositePos = + (ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START) + ? ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END + : ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START; + xParallelAxis->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( eOppositePos )); + } + } + } } } } break; + case SCHATTR_AXIS_MARK_POSITION: + { + ::com::sun::star::chart::ChartAxisMarkPosition ePos = + (::com::sun::star::chart::ChartAxisMarkPosition) + static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); + + ::com::sun::star::chart::ChartAxisMarkPosition eOldPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS ); + bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= eOldPos ); + + if( !bPropExisted || ( eOldPos != ePos )) + { + GetPropertySet()->setPropertyValue( C2U( "MarkPosition" ), uno::makeAny( ePos )); + bChangedOtherwise = true; + } + } + break; + case SCHATTR_TEXT_DEGREES: { // convert int to double (divided by 100) diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index 63e961855cbe..de4fe9f2d745 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -147,7 +147,7 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter( if( m_bSupportingAxisSideBySide && xDiagramProperties.is() ) { xDiagramProperties->getPropertyValue( C2U("GroupBarsPerAxis")) >>= m_bGroupBarsPerAxis; - m_bAllSeriesAttachedToSameAxis = ChartTypeHelper::allSeriesAttachedToSameAxis( xChartType, m_nAllSeriesAxisIndex ); + m_bAllSeriesAttachedToSameAxis = DataSeriesHelper::areAllSeriesAttachedToSameAxis( xChartType, m_nAllSeriesAxisIndex ); } m_bSupportingStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType ); diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index 8baa2129bb7e..3fc650b9ced7 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -129,6 +129,21 @@ public: getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getCrossingMainAxis( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getParallelAxis( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getGridProperties( const ::com::sun::star::uno::Reference< @@ -210,6 +225,13 @@ public: ::com::sun::star::chart2::XChartType > getChartTypeByIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys, sal_Int32 nIndex ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getFirstChartTypeWithSeriesAttachedToAxisIndex( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); + + static bool isAxisPositioningEnabled(); }; //............................................................................. diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index ee9597b6671e..96112e4976b3 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -61,7 +61,10 @@ public: static sal_Bool isSupportingRightAngledAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); static bool isSupportingAxisSideBySide( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); static bool isSupportingStartingAngle( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + //starting value for bars or baseline for areas for example + static bool isSupportingBaseValue( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); static bool shiftTicksAtXAxisPerDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool isSupportingAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); //returns sequence of ::com::sun::star::chart::DataLabelPlacement static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( @@ -82,17 +85,6 @@ public: static sal_Int32 //one of ::com::sun::star::chart2::AxisType getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType , sal_Int32 nDimensionIndex ); - - /** Determines if all data series of a chart type are attached to the same - axis. - - @param rOutAxisIndex If, and only if, </TRUE> is returned this - out-parameter is filled with the index (0 or 1) of the axis to - which all series are attached. - */ - static bool allSeriesAttachedToSameAxis( - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, - sal_Int32 & rOutAxisIndex ); }; //............................................................................. diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index 262217a743e6..3652a27a5059 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -172,6 +172,10 @@ bool hasAttributedDataPointDifferentValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rPropertyValue ); +bool areAllSeriesAttachedToSameAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, + sal_Int32 & rOutAxisIndex ); + } // namespace DataSeriesHelper } // namespace chart diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index 50e5e4d94820..78b53e9807f4 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -286,6 +286,8 @@ #define STR_DLG_SMOOTH_LINE_PROPERTIES (RID_APP_START + 239) #define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266) +#define STR_PAGE_POSITIONING (RID_APP_START + 277) + //----------------------------------------------------------------------------- //strings used as description for actions on toolbar icons, as tip help or for undo diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index 071201910ffa..3b281f8118dd 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -180,7 +180,12 @@ #define SCHATTR_AXIS_TOPDOWN (SCHATTR_AXIS_START + 18) #define SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_START + 19) #define SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 20) -#define SCHATTR_AXIS_END SCHATTR_AXIS_REVERSE +#define SCHATTR_AXIS_POSITION (SCHATTR_AXIS_START + 21) +#define SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_START + 22) +#define SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_START + 23) +#define SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_START + 24) +#define SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_START + 25) +#define SCHATTR_AXIS_END SCHATTR_AXIS_MARK_POSITION #define SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1) #define SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2) @@ -230,7 +235,6 @@ #define CHAXIS_MARK_OUTER 2 #define CHAXIS_MARK_INNER 1 #define CHAXIS_MARK_NONE 0 -#define CHAXIS_MARK_ASMAIN 4 // values for SCHATTR_AXISTYPE items #define CHART_AXIS_X 0 diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 08e30b1ef561..d4a1cdff49e8 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -41,16 +41,16 @@ #include "CloneHelper.hxx" #include "AxisHelper.hxx" #include "EventListenerHelper.hxx" +#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/AxisType.hpp> -#ifndef _COM_SUN_STAR_CHART2_XAXISPOSITION_HPP_ -#include <com/sun/star/chart2/AxisPosition.hpp> -#endif #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/LineJoint.hpp> -#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> #include <com/sun/star/awt/Size.hpp> #include <rtl/uuid.h> #include <cppuhelper/queryinterface.hxx> @@ -77,20 +77,21 @@ static const OUString lcl_aServiceName( enum { PROP_AXIS_SHOW, - PROP_AXIS_POSITION, + PROP_AXIS_CROSSOVER_POSITION, + PROP_AXIS_CROSSOVER_VALUE, PROP_AXIS_DISPLAY_LABELS, + PROP_AXIS_NUMBER_FORMAT, + PROP_AXIS_LABEL_POSITION, PROP_AXIS_TEXT_ROTATION, PROP_AXIS_TEXT_BREAK, PROP_AXIS_TEXT_OVERLAP, PROP_AXIS_TEXT_STACKED, PROP_AXIS_TEXT_ARRANGE_ORDER, - PROP_AXIS_NUMBER_FORMAT, PROP_AXIS_REFERENCE_DIAGRAM_SIZE, - // for Testing only! PROP_AXIS_MAJOR_TICKMARKS, - // for Testing only! - PROP_AXIS_MINOR_TICKMARKS + PROP_AXIS_MINOR_TICKMARKS, + PROP_AXIS_MARK_POSITION }; void lcl_AddPropertiesToVector( @@ -104,11 +105,16 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "AxisPosition" ), - PROP_AXIS_POSITION, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); + Property( C2U( "CrossoverPosition" ), + PROP_AXIS_CROSSOVER_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "CrossoverValue" ), + PROP_AXIS_CROSSOVER_VALUE, + ::getCppuType( reinterpret_cast< const double * >(0)), + beans::PropertyAttribute::MAYBEVOID )); rOutProperties.push_back( Property( C2U( "DisplayLabels" ), @@ -118,6 +124,19 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( + Property( C2U( "NumberFormat" ), + PROP_AXIS_NUMBER_FORMAT, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( + Property( C2U( "LabelPosition" ), + PROP_AXIS_LABEL_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( Property( C2U( "TextRotation" ), PROP_AXIS_TEXT_ROTATION, ::getCppuType( reinterpret_cast< const double * >(0)), @@ -153,42 +172,38 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( - Property( C2U( "NumberFormat" ), - PROP_AXIS_NUMBER_FORMAT, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEVOID )); - - rOutProperties.push_back( Property( C2U( "ReferencePageSize" ), PROP_AXIS_REFERENCE_DIAGRAM_SIZE, ::getCppuType( reinterpret_cast< const awt::Size * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); - // for Testing only! rOutProperties.push_back( Property( C2U( "MajorTickmarks" ), PROP_AXIS_MAJOR_TICKMARKS, ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); - // for Testing only! rOutProperties.push_back( Property( C2U( "MinorTickmarks" ), PROP_AXIS_MINOR_TICKMARKS, ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); - + rOutProperties.push_back( + Property( C2U( "MarkPosition" ), + PROP_AXIS_MARK_POSITION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)), + beans::PropertyAttribute::MAYBEDEFAULT )); } void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_POSITION, chart2::AxisPosition::MAIN ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS ); ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_OVERLAP, false ); @@ -200,10 +215,9 @@ void lcl_AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight ); ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight ); - // for Testing only! ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ ); - // for Testing only! ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_MARK_POSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS ); } const Sequence< Property > & lcl_GetPropertySequence() diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 5d28ce8f9fa2..d328f3fb6921 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -51,7 +51,6 @@ #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> -#include <com/sun/star/chart2/AxisPosition.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <algorithm> diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index c433292fe6ee..86fee326497b 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -38,6 +38,11 @@ #include "AxisIndexDefines.hxx" #include "LineProperties.hxx" #include "ContainerHelper.hxx" +#include "DataSeriesHelper.hxx" + +#include <svtools/saveopt.hxx> + +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -112,6 +117,8 @@ Reference< XAxis > AxisHelper::createAxis( if( nAxisIndex>0 )//when inserting secondary axes copy some things from the main axis { + ::com::sun::star::chart::ChartAxisPosition eNewAxisPos( ::com::sun::star::chart::ChartAxisPosition_END ); + Reference< XAxis > xMainAxis( xCooSys->getAxisByDimension( nDimensionIndex, 0 ) ); if( xMainAxis.is() ) { @@ -123,15 +130,26 @@ Reference< XAxis > AxisHelper::createAxis( aScale.Orientation = aMainScale.Orientation; xAxis->setScaleData( aScale ); + + //ensure that the second axis is not placed on the main axis + Reference< beans::XPropertySet > xMainProp( xMainAxis, uno::UNO_QUERY ); + if( xMainProp.is() ) + { + ::com::sun::star::chart::ChartAxisPosition eMainAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO ); + xMainProp->getPropertyValue(C2U( "CrossoverPosition" )) >>= eMainAxisPos; + if( ::com::sun::star::chart::ChartAxisPosition_END == eMainAxisPos ) + eNewAxisPos = ::com::sun::star::chart::ChartAxisPosition_START; + } } + + Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); + if( xProp.is() ) + xProp->setPropertyValue(C2U( "CrossoverPosition" ), uno::makeAny(eNewAxisPos) ); } Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); if( xProp.is() ) try { - //todo nAxisPosition and nAxisIndex are the same values so far and maybe need to be seperated in future - xProp->setPropertyValue( C2U( "AxisPosition" ), uno::makeAny( nAxisIndex ) ); - // set correct initial AutoScale if( pRefSizeProvider ) pRefSizeProvider->setValuesAtPropertySet( xProp ); @@ -358,6 +376,49 @@ Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAx return xRet; } +//static +Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xAxis + , const Reference< XCoordinateSystem >& xCooSys ) +{ + sal_Int32 nDimensionIndex = 0; + sal_Int32 nAxisIndex = 0; + AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ); + if( 2==nDimensionIndex ) + { + nDimensionIndex=1; + bool bSwapXY = false; + Reference< beans::XPropertySet > xCooSysProp( xCooSys, uno::UNO_QUERY ); + if( xCooSysProp.is() && (xCooSysProp->getPropertyValue( C2U("SwapXAndYAxis") ) >>= bSwapXY) && bSwapXY ) + nDimensionIndex=0; + } + else if( 1==nDimensionIndex ) + nDimensionIndex=0; + else + nDimensionIndex=1; + return AxisHelper::getAxis( nDimensionIndex, 0, xCooSys ); +} + +//static +Reference< XAxis > AxisHelper::getParallelAxis( const Reference< XAxis >& xAxis + , const Reference< XDiagram >& xDiagram ) +{ + try + { + sal_Int32 nCooSysIndex=-1; + sal_Int32 nDimensionIndex=-1; + sal_Int32 nAxisIndex=-1; + if( getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) ) + { + sal_Int32 nParallelAxisIndex = (nAxisIndex==1) ?0 :1; + return getAxis( nDimensionIndex, nParallelAxisIndex, getCoordinateSystemByIndex( xDiagram, nCooSysIndex ) ); + } + } + catch( uno::RuntimeException& ) + { + } + return 0; +} + sal_Bool AxisHelper::isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis , const Reference< XDiagram >& xDiagram ) { @@ -787,6 +848,30 @@ Reference< XChartType > AxisHelper::getChartTypeByIndex( const Reference< XCoord return xChartType; } +Reference< XChartType > AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( const Reference< chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ) +{ + Reference< XChartType > xChartType; + ::std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); + ::std::vector< Reference< XDataSeries > >::const_iterator aIter = aSeriesVector.begin(); + for( ; aIter != aSeriesVector.end(); aIter++ ) + { + sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex( *aIter ); + if( nAttachedAxisIndex == nCurrentIndex ) + { + xChartType = DiagramHelper::getChartTypeOfSeries( xDiagram, *aIter ); + if(xChartType.is()) + break; + } + } + return xChartType; +} + +bool AxisHelper::isAxisPositioningEnabled() +{ + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + return nCurrentVersion >= SvtSaveOptions::ODFVER_012; +} + //............................................................................. } //namespace chart //............................................................................. diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index d914e60c9a2b..d7bb3a15bdf6 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -375,6 +375,32 @@ bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::X } return false; } +bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChartType >& xChartType ) +{ + if(xChartType.is()) + { + rtl::OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) + ) + return true; + } + return false; +} + +bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) +{ + if(xChartType.is()) + { + rtl::OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) + return false; + } + if( nDimensionCount==3 ) + return nDimensionIndex<2; + return true; +} bool ChartTypeHelper::shiftTicksAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType ) { @@ -518,46 +544,6 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( return nNumberOfSeries; } -bool ChartTypeHelper::allSeriesAttachedToSameAxis( - const uno::Reference< XChartType >& xChartType, - sal_Int32 & rOutAxisIndex ) -{ - try - { - uno::Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY_THROW ); - uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDataSeriesContainer->getDataSeries()); - - const sal_Int32 nSeriesCount( aSeriesSeq.getLength()); - // AxisIndex can only be 0 or 1 - sal_Int32 nSeriesAtFirstAxis = 0; - sal_Int32 nSeriesAtSecondAxis = 0; - - for( sal_Int32 nI = 0; nI < nSeriesCount; ++nI ) - { - uno::Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nI], uno::UNO_QUERY ); - sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex( xSeries ); - if( nAxisIndex == 0 ) - ++nSeriesAtFirstAxis; - else if( nAxisIndex == 1 ) - ++nSeriesAtSecondAxis; - } - OSL_ENSURE( nSeriesAtFirstAxis + nSeriesAtSecondAxis == nSeriesCount, "Invalid axis index found" ); - - if( nSeriesAtFirstAxis == nSeriesCount ) - rOutAxisIndex = 0; - else if( nSeriesAtSecondAxis == nSeriesCount ) - rOutAxisIndex = 1; - - return ( nSeriesAtFirstAxis == nSeriesCount || - nSeriesAtSecondAxis == nSeriesCount ); - } - catch( const uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - return false; - } -} - uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const uno::Reference< XChartType >& xChartType ) { uno::Sequence < sal_Int32 > aRet; diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index c8dfbffec354..8c3431905699 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -606,5 +606,43 @@ bool hasAttributedDataPointDifferentValue( const Reference< chart2::XDataSeries return false; } +bool areAllSeriesAttachedToSameAxis( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 & rOutAxisIndex ) +{ + try + { + uno::Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq( xDataSeriesContainer->getDataSeries()); + + const sal_Int32 nSeriesCount( aSeriesSeq.getLength()); + // AxisIndex can only be 0 or 1 + sal_Int32 nSeriesAtFirstAxis = 0; + sal_Int32 nSeriesAtSecondAxis = 0; + + for( sal_Int32 nI = 0; nI < nSeriesCount; ++nI ) + { + uno::Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nI], uno::UNO_QUERY ); + sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex( xSeries ); + if( nAxisIndex == 0 ) + ++nSeriesAtFirstAxis; + else if( nAxisIndex == 1 ) + ++nSeriesAtSecondAxis; + } + OSL_ENSURE( nSeriesAtFirstAxis + nSeriesAtSecondAxis == nSeriesCount, "Invalid axis index found" ); + + if( nSeriesAtFirstAxis == nSeriesCount ) + rOutAxisIndex = 0; + else if( nSeriesAtSecondAxis == nSeriesCount ) + rOutAxisIndex = 1; + + return ( nSeriesAtFirstAxis == nSeriesCount || + nSeriesAtSecondAxis == nSeriesCount ); + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + return false; + } +} + } // namespace DataSeriesHelper } // namespace chart diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index a32655946259..8af5b412c5c1 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -165,17 +165,6 @@ void DiagramHelper::setVertical( Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( nDimIndex,nI )); if( xAxis.is() ) { - if( nDimensionCount == 2 && nDimIndex == 0 ) - { - //adapt scale orientation for 2D bar charts - chart2::ScaleData aScaleData = xAxis->getScaleData(); - if( !bVertical != (AxisOrientation_MATHEMATICAL==aScaleData.Orientation) ) - { - aScaleData.Orientation = bVertical ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL; - xAxis->setScaleData( aScaleData ); - } - } - //adapt title rotation only when axis swapping has changed if( bChanged ) { diff --git a/chart2/source/view/axes/TickmarkHelper.cxx b/chart2/source/view/axes/TickmarkHelper.cxx index 25de4dc61864..81dc5786653e 100644 --- a/chart2/source/view/axes/TickmarkHelper.cxx +++ b/chart2/source/view/axes/TickmarkHelper.cxx @@ -693,10 +693,12 @@ void TickmarkHelper::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::Sequence TickmarkHelper_2D::TickmarkHelper_2D( const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement //, double fStrech_SceneToScreen, double fOffset_SceneToScreen ) - , const B2DVector& rStartScreenPos, const B2DVector& rEndScreenPos ) + , const B2DVector& rStartScreenPos, const B2DVector& rEndScreenPos + , const B2DVector& rAxisLineToLabelLineShift ) : TickmarkHelper( rScale, rIncrement ) , m_aAxisStartScreenPosition2D(rStartScreenPos) , m_aAxisEndScreenPosition2D(rEndScreenPos) + , m_aAxisLineToLabelLineShift(rAxisLineToLabelLineShift) , m_fStrech_LogicToScreen(1.0) , m_fOffset_LogicToScreen(0.0) { @@ -727,7 +729,7 @@ TickmarkHelper* TickmarkHelper_2D::createShiftedTickmarkHelper() const if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation ) std::swap( aStart, aEnd ); - return new TickmarkHelper_2D( m_rScale, aShiftedIncrement, aStart, aEnd ); + return new TickmarkHelper_2D( m_rScale, aShiftedIncrement, aStart, aEnd, m_aAxisLineToLabelLineShift ); } TickmarkHelper_2D::~TickmarkHelper_2D() @@ -772,12 +774,15 @@ B2DVector TickmarkHelper_2D::getTickScreenPosition2D( double fScaledLogicTickVal void TickmarkHelper_2D::addPointSequenceForTickLine( drawing::PointSequenceSequence& rPoints , sal_Int32 nSequenceIndex , double fScaledLogicTickValue, double fInnerDirectionSign - , const TickmarkProperties& rTickmarkProperties ) const + , const TickmarkProperties& rTickmarkProperties + , bool bPlaceAtLabels ) const { if( fInnerDirectionSign==0.0 ) fInnerDirectionSign = 1.0; B2DVector aTickScreenPosition = this->getTickScreenPosition2D(fScaledLogicTickValue); + if( bPlaceAtLabels ) + aTickScreenPosition += m_aAxisLineToLabelLineShift; B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D; aMainDirection.normalize(); @@ -795,8 +800,13 @@ void TickmarkHelper_2D::addPointSequenceForTickLine( drawing::PointSequenceSeque rPoints[nSequenceIndex][1].Y = static_cast<sal_Int32>(aEnd.getY()); } -B2DVector TickmarkHelper_2D::getDistanceTickToText( const AxisProperties& rAxisProperties ) const +B2DVector TickmarkHelper_2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties ) const { + bool bFarAwayLabels = false; + if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == rAxisProperties.m_eLabelPos + || ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == rAxisProperties.m_eLabelPos ) + bFarAwayLabels = true; + double fInnerDirectionSign = rAxisProperties.m_fInnerDirectionSign; if( fInnerDirectionSign==0.0 ) fInnerDirectionSign = 1.0; @@ -808,26 +818,37 @@ B2DVector TickmarkHelper_2D::getDistanceTickToText( const AxisProperties& rAxisP aOrthoDirection.normalize(); B2DVector aStart(0,0), aEnd(0,0); - for( sal_Int32 nN=rAxisProperties.m_aTickmarkPropertiesList.size();nN--;) + if( bFarAwayLabels ) + { + TickmarkProperties aProps( AxisProperties::getBiggestTickmarkProperties() ); + aStart = aOrthoDirection*aProps.RelativePos; + aEnd = aStart - aOrthoDirection*aProps.Length; + } + else { - const TickmarkProperties& rProps = rAxisProperties.m_aTickmarkPropertiesList[nN]; - B2DVector aNewStart = aOrthoDirection*rProps.RelativePos; - B2DVector aNewEnd = aNewStart - aOrthoDirection*rProps.Length; - if(aNewStart.getLength()>aStart.getLength()) - aStart=aNewStart; - if(aNewEnd.getLength()>aEnd.getLength()) - aEnd=aNewEnd; + for( sal_Int32 nN=rAxisProperties.m_aTickmarkPropertiesList.size();nN--;) + { + const TickmarkProperties& rProps = rAxisProperties.m_aTickmarkPropertiesList[nN]; + B2DVector aNewStart = aOrthoDirection*rProps.RelativePos; + B2DVector aNewEnd = aNewStart - aOrthoDirection*rProps.Length; + if(aNewStart.getLength()>aStart.getLength()) + aStart=aNewStart; + if(aNewEnd.getLength()>aEnd.getLength()) + aEnd=aNewEnd; + } } B2DVector aLabelDirection(aStart); - if(!rAxisProperties.m_bLabelsOutside) + if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign ) aLabelDirection = aEnd; B2DVector aOrthoLabelDirection(aOrthoDirection); - if(!rAxisProperties.m_bLabelsOutside) + if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign ) aOrthoLabelDirection*=-1.0; aOrthoLabelDirection.normalize(); aLabelDirection += aOrthoLabelDirection*AXIS2D_TICKLABELSPACING; + if( bFarAwayLabels ) + aLabelDirection += m_aAxisLineToLabelLineShift; return aLabelDirection; } diff --git a/chart2/source/view/axes/TickmarkHelper.hxx b/chart2/source/view/axes/TickmarkHelper.hxx index 287635ee9487..a5749a074582 100644 --- a/chart2/source/view/axes/TickmarkHelper.hxx +++ b/chart2/source/view/axes/TickmarkHelper.hxx @@ -200,7 +200,8 @@ public: TickmarkHelper_2D( const ::com::sun::star::chart2::ExplicitScaleData& rScale , const ::com::sun::star::chart2::ExplicitIncrementData& rIncrement - , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos ); + , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos + , const ::basegfx::B2DVector& rAxisLineToLabelLineShift ); //, double fStrech_SceneToScreen, double fOffset_SceneToScreen ); virtual ~TickmarkHelper_2D(); @@ -212,8 +213,8 @@ public: void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints , sal_Int32 nSequenceIndex , double fScaledLogicTickValue, double fInnerDirectionSign - , const TickmarkProperties& rTickmarkProperties ) const; - ::basegfx::B2DVector getDistanceTickToText( const AxisProperties& rAxisProperties ) const; + , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const; + ::basegfx::B2DVector getDistanceAxisTickToText( const AxisProperties& rAxisProperties ) const; virtual void updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const; virtual void hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const; @@ -228,6 +229,10 @@ private: //member ::basegfx::B2DVector m_aAxisStartScreenPosition2D; ::basegfx::B2DVector m_aAxisEndScreenPosition2D; + //labels might be posioned high or low on the border of the diagram far away from the axis + //add this vector to go from the axis line to the label line (border of the diagram) + ::basegfx::B2DVector m_aAxisLineToLabelLineShift; + double m_fStrech_LogicToScreen; double m_fOffset_LogicToScreen; }; diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index f679b05cd989..da2f01523a97 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -184,10 +184,7 @@ bool VAxisBase::prepareShapeCreation() m_xGroupShape_Shapes = this->createGroupShape( m_xLogicTarget, m_nDimension==2 ? m_aCID : C2U("")); if( m_aAxisProperties.m_bDisplayLabels ) - { - m_xTextTarget = ( m_nDimension==2 ? m_xGroupShape_Shapes - : m_pShapeFactory->createGroup2D( m_xFinalTarget, m_aCID ) ); - } + m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget, m_aCID ); return true; } diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index cca264b093a4..27ca8d2188e3 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -37,9 +37,6 @@ #include "AxisHelper.hxx" #include "DiagramHelper.hxx" -#ifndef _COM_SUN_STAR_CHART2_XAXISPOSITION_HPP_ -#include <com/sun/star/chart2/AxisPosition.hpp> -#endif #include <tools/color.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> @@ -150,6 +147,17 @@ TickmarkProperties AxisProperties::makeTickmarkProperties( return aTickmarkProperties; } +//static +TickmarkProperties AxisProperties::getBiggestTickmarkProperties() +{ + TickmarkProperties aTickmarkProperties; + sal_Int32 nDepth = 0; + sal_Int32 nTickmarkStyle = 3;//inner and outer tickmarks + aTickmarkProperties.Length = lcl_calcTickLengthForDepth( nDepth,nTickmarkStyle ); + aTickmarkProperties.RelativePos = static_cast<sal_Int32>( lcl_getTickOffset( aTickmarkProperties.Length, nTickmarkStyle ) ); + return aTickmarkProperties; +} + //-------------------------------------------------------------------------- AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel @@ -158,14 +166,20 @@ AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel , m_nDimensionIndex(0) , m_bIsMainAxis(true) , m_bSwapXAndY(false) + , m_eCrossoverType( ::com::sun::star::chart::ChartAxisPosition_ZERO ) + , m_eLabelPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS ) + , m_eTickmarkPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS ) , m_pfMainLinePositionAtOtherAxis(NULL) , m_pfExrtaLinePositionAtOtherAxis(NULL) + , m_bCrossingAxisHasReverseDirection(false) + , m_bCrossingAxisIsCategoryAxes(false) + , m_bAxisBetweenCategories(false) + , m_fLabelDirectionSign(1.0) , m_fInnerDirectionSign(1.0) , m_bLabelsOutside(true) , m_aLabelAlignment(LABEL_ALIGN_RIGHT_TOP) , m_bDisplayLabels( true ) , m_nNumberFormatKey(0) -// , m_eRelativeLabelPosition(LEFTORBOTTOM_OF_AXIS) , m_nMajorTickmarks(1) , m_nMinorTickmarks(1) , m_aTickmarkPropertiesList() @@ -182,14 +196,20 @@ AxisProperties::AxisProperties( const AxisProperties& rAxisProperties ) , m_nDimensionIndex( m_nDimensionIndex ) , m_bIsMainAxis( rAxisProperties.m_bIsMainAxis ) , m_bSwapXAndY( rAxisProperties.m_bSwapXAndY ) + , m_eCrossoverType( rAxisProperties.m_eCrossoverType ) + , m_eLabelPos( rAxisProperties.m_eLabelPos ) + , m_eTickmarkPos( rAxisProperties.m_eTickmarkPos ) , m_pfMainLinePositionAtOtherAxis( NULL ) , m_pfExrtaLinePositionAtOtherAxis( NULL ) + , m_bCrossingAxisHasReverseDirection( rAxisProperties.m_bCrossingAxisHasReverseDirection ) + , m_bCrossingAxisIsCategoryAxes( rAxisProperties.m_bCrossingAxisIsCategoryAxes ) + , m_bAxisBetweenCategories( rAxisProperties.m_bAxisBetweenCategories ) + , m_fLabelDirectionSign( rAxisProperties.m_fLabelDirectionSign ) , m_fInnerDirectionSign( rAxisProperties.m_fInnerDirectionSign ) , m_bLabelsOutside( rAxisProperties.m_bLabelsOutside ) , m_aLabelAlignment( rAxisProperties.m_aLabelAlignment ) , m_bDisplayLabels( rAxisProperties.m_bDisplayLabels ) , m_nNumberFormatKey( rAxisProperties.m_nNumberFormatKey ) -// , m_eRelativeLabelPosition( rAxisProperties.m_eRelativeLabelPosition ) , m_nMajorTickmarks( rAxisProperties.m_nMajorTickmarks ) , m_nMinorTickmarks( rAxisProperties.m_nMinorTickmarks ) , m_aTickmarkPropertiesList( rAxisProperties.m_aTickmarkPropertiesList ) @@ -213,52 +233,69 @@ AxisProperties::~AxisProperties() LabelAlignment lcl_getLabelAlignmentForZAxis( const AxisProperties& rAxisProperties ) { - LabelAlignment aRet( LABEL_ALIGN_LEFT ); - if( rAxisProperties.m_bLabelsOutside ) - aRet = LABEL_ALIGN_RIGHT; - else + LabelAlignment aRet( LABEL_ALIGN_RIGHT ); + if( rAxisProperties.m_fLabelDirectionSign<0 ) aRet = LABEL_ALIGN_LEFT; return aRet; } LabelAlignment lcl_getLabelAlignmentForYAxis( const AxisProperties& rAxisProperties ) { - LabelAlignment aRet( LABEL_ALIGN_LEFT ); - if(rAxisProperties.m_bIsMainAxis) - { - if( rAxisProperties.m_bLabelsOutside ) - aRet = LABEL_ALIGN_LEFT; - else - aRet = LABEL_ALIGN_RIGHT; - } - else - { - if( !rAxisProperties.m_bLabelsOutside ) - aRet = LABEL_ALIGN_LEFT; - else - aRet = LABEL_ALIGN_RIGHT; - } + LabelAlignment aRet( LABEL_ALIGN_RIGHT ); + if( rAxisProperties.m_fLabelDirectionSign<0 ) + aRet = LABEL_ALIGN_LEFT; return aRet; } LabelAlignment lcl_getLabelAlignmentForXAxis( const AxisProperties& rAxisProperties ) { - LabelAlignment aRet( LABEL_ALIGN_LEFT ); - if(rAxisProperties.m_bIsMainAxis ) + LabelAlignment aRet( LABEL_ALIGN_BOTTOM ); + if( rAxisProperties.m_fLabelDirectionSign<0 ) + aRet = LABEL_ALIGN_TOP; + return aRet; +} + +void AxisProperties::initAxisPositioning( const uno::Reference< beans::XPropertySet >& xAxisProp ) +{ + if( !xAxisProp.is() ) + return; + try { - if(rAxisProperties.m_bLabelsOutside) - aRet = LABEL_ALIGN_BOTTOM; + if( AxisHelper::isAxisPositioningEnabled() ) + { + xAxisProp->getPropertyValue(C2U( "CrossoverPosition" )) >>= m_eCrossoverType; + if( ::com::sun::star::chart::ChartAxisPosition_VALUE == m_eCrossoverType ) + { + double fValue = 0.0; + xAxisProp->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue; + + if( m_bCrossingAxisIsCategoryAxes ) + { + fValue = ::rtl::math::round(fValue); + if( m_bAxisBetweenCategories ) + fValue-=0.5; + } + m_pfMainLinePositionAtOtherAxis = new double(fValue); + } + else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == m_eCrossoverType ) + m_pfMainLinePositionAtOtherAxis = new double(0.0); + + xAxisProp->getPropertyValue(C2U( "LabelPosition" )) >>= m_eLabelPos; + xAxisProp->getPropertyValue(C2U( "MarkPosition" )) >>= m_eTickmarkPos; + } else - aRet = LABEL_ALIGN_TOP; + { + m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_START; + if( m_bIsMainAxis == m_bCrossingAxisHasReverseDirection ) + m_eCrossoverType = ::com::sun::star::chart::ChartAxisPosition_END; + m_eLabelPos = ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS; + m_eTickmarkPos = ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS; + } } - else + catch( uno::Exception& e ) { - if(!rAxisProperties.m_bLabelsOutside) - aRet = LABEL_ALIGN_BOTTOM; - else - aRet = LABEL_ALIGN_TOP; + ASSERT_EXCEPTION( e ); } - return aRet; } void AxisProperties::init( bool bCartesian ) @@ -267,21 +304,25 @@ void AxisProperties::init( bool bCartesian ) uno::Reference<beans::XPropertySet>::query( this->m_xAxisModel ); if( !xProp.is() ) return; + + if( m_nDimensionIndex<2 ) + initAxisPositioning( xProp ); + if( bCartesian ) { - try - { - //todo nAxisPosition and nAxisIndex are the same values so far and maybe need to be seperated in future - sal_Int32 nAxisPosition=AxisPosition::MAIN; - xProp->getPropertyValue( C2U( "AxisPosition" ) ) >>= nAxisPosition; - m_bIsMainAxis = nAxisPosition==AxisPosition::MAIN; - } - catch( uno::Exception& e ) - { - ASSERT_EXCEPTION( e ); - } + if( ::com::sun::star::chart::ChartAxisPosition_END == m_eCrossoverType ) + m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1; + else + m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1; - m_fInnerDirectionSign = m_bIsMainAxis ? 1 : -1; + if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS == m_eLabelPos ) + m_fLabelDirectionSign = m_fInnerDirectionSign; + else if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE == m_eLabelPos ) + m_fLabelDirectionSign = -m_fInnerDirectionSign; + else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_eLabelPos ) + m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1; + else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_eLabelPos ) + m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1; if( m_nDimensionIndex==2 ) m_aLabelAlignment = lcl_getLabelAlignmentForZAxis(*this); @@ -290,7 +331,10 @@ void AxisProperties::init( bool bCartesian ) bool bIsYAxisPosition = (m_nDimensionIndex==1 && !m_bSwapXAndY) || (m_nDimensionIndex==0 && m_bSwapXAndY); if( bIsYAxisPosition ) + { + m_fLabelDirectionSign*=-1; m_fInnerDirectionSign*=-1; + } if( bIsYAxisPosition ) m_aLabelAlignment = lcl_getLabelAlignmentForYAxis(*this); diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx index fd39c865bd8d..61f2477c7681 100644 --- a/chart2/source/view/axes/VAxisProperties.hxx +++ b/chart2/source/view/axes/VAxisProperties.hxx @@ -33,6 +33,10 @@ #include "TickmarkProperties.hxx" #include "PlottingPositionHelper.hxx" #include "LabelAlignment.hxx" + +#include <com/sun/star/chart/ChartAxisLabelPosition.hpp> +#include <com/sun/star/chart/ChartAxisMarkPosition.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> @@ -99,9 +103,20 @@ struct AxisProperties sal_Int32 m_nDimensionIndex; bool m_bIsMainAxis;//not secondary axis bool m_bSwapXAndY; + + ::com::sun::star::chart::ChartAxisPosition m_eCrossoverType; + ::com::sun::star::chart::ChartAxisLabelPosition m_eLabelPos; + ::com::sun::star::chart::ChartAxisMarkPosition m_eTickmarkPos; + double* m_pfMainLinePositionAtOtherAxis; double* m_pfExrtaLinePositionAtOtherAxis; + bool m_bCrossingAxisHasReverseDirection; + bool m_bCrossingAxisIsCategoryAxes; + bool m_bAxisBetweenCategories; + + //this direction is used to indicate in which direction the labels are to be drawn + double m_fLabelDirectionSign; //this direction is used to indicate in which direction inner tickmarks are to be drawn double m_fInnerDirectionSign; bool m_bLabelsOutside; @@ -110,11 +125,6 @@ struct AxisProperties sal_Int32 m_nNumberFormatKey; - -// enum RelativeLabelPosition { NONE, LEFTORBOTTOM_OF_DIAGRAM, RIGHTORTOP_OF_DIAGRAM, -// LEFTORBOTTOM_OF_AXIS, RIGHTORTOP_OF_AXIS }; -// RelativeLabelPosition m_eRelativeLabelPosition; - /* 0: no tickmarks 1: inner tickmarks 2: outer tickmarks 3: inner and outer tickmarks @@ -143,6 +153,10 @@ struct AxisProperties virtual ~AxisProperties(); virtual void init(bool bCartesian=false);//init from model data (m_xAxisModel) + void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp ); + + static TickmarkProperties getBiggestTickmarkProperties(); + private: AxisProperties(); diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 3e6d8496041d..c64102f6c984 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -43,6 +43,8 @@ #include "LabelPositionHelper.hxx" #include "TrueGuard.hxx" #include "BaseGFXHelper.hxx" +#include "AxisHelper.hxx" + #include <rtl/math.hxx> #include <tools/color.hxx> #include <tools/debug.hxx> @@ -628,7 +630,7 @@ bool VCartesianAxis::createTextShapes( FixedNumberFormatter aFixedNumberFormatter( m_xNumberFormatsSupplier, rAxisLabelProperties.nNumberFormatKey ); - B2DVector aTextToTickDistance( pTickmarkHelper->getDistanceTickToText( m_aAxisProperties ) ); + B2DVector aTextToTickDistance( pTickmarkHelper->getDistanceAxisTickToText( m_aAxisProperties ) ); TickInfo* pPreviousVisibleTickInfo = NULL; TickInfo* pPREPreviousVisibleTickInfo = NULL; @@ -815,15 +817,29 @@ double VCartesianAxis::getLogicValueWhereMainLineCrossesOtherAxis() const fCrossesOtherAxis = *m_aAxisProperties.m_pfMainLinePositionAtOtherAxis; else { - bool bMinimumForLeftAxis = ( (m_nDimensionIndex==1) && m_pPosHelper->isMathematicalOrientationX() ) - || ( (m_nDimensionIndex!=1) && m_pPosHelper->isMathematicalOrientationY() ); - if(!m_aAxisProperties.m_bIsMainAxis) - bMinimumForLeftAxis = !bMinimumForLeftAxis; - fCrossesOtherAxis = bMinimumForLeftAxis ? fMin : fMax; + if( ::com::sun::star::chart::ChartAxisPosition_END == m_aAxisProperties.m_eCrossoverType ) + fCrossesOtherAxis = fMax; + else + fCrossesOtherAxis = fMin; } return fCrossesOtherAxis; } +double VCartesianAxis::getLogicValueWhereLabelLineCrossesOtherAxis() const +{ + double fMin = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMinY(); + double fMax = (m_nDimensionIndex==1) ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMaxY(); + + double fCrossesOtherAxis; + if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_aAxisProperties.m_eLabelPos ) + fCrossesOtherAxis = fMin; + else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_aAxisProperties.m_eLabelPos ) + fCrossesOtherAxis = fMax; + else + fCrossesOtherAxis = getLogicValueWhereMainLineCrossesOtherAxis(); + return fCrossesOtherAxis; +} + bool VCartesianAxis::getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis ) const { if( !m_aAxisProperties.m_pfExrtaLinePositionAtOtherAxis ) @@ -955,139 +971,265 @@ void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, doub if( 0==m_nDimensionIndex ) //x-axis { + if( fCrossesOtherAxis < fMinY ) + fCrossesOtherAxis = fMinY; + else if( fCrossesOtherAxis > fMaxY ) + fCrossesOtherAxis = fMaxY; + fYStart = fYEnd = fCrossesOtherAxis; fXEnd=m_pPosHelper->getLogicMaxX(); if(3==m_nDimension) { - rStart = getScreenPosition( fXStart, fYStart, fZStart ); - rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); - - double fDeltaX = rEnd.getX() - rStart.getX(); - double fDeltaY = rEnd.getY() - rStart.getY(); - - //only those points are candidates which are lying on exactly one wall as these are outer edges - tScreenPosAndLogicPosList aPosList; - aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOnYPlane, fZOther ) ); - aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOther, fZOnZPlane ) ); - - if( fabs(fDeltaY) > fabs(fDeltaX) ) + if( AxisHelper::isAxisPositioningEnabled() ) { - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; - //choose most left positions - ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() ); - m_aAxisProperties.m_fInnerDirectionSign = fDeltaY<0 ? -1 : 1; + if( ::rtl::math::approxEqual( fYOther, fYStart) ) + fZStart = fZEnd = fZOnZPlane; + else + fZStart = fZEnd = fZOther; } else { - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; - //choose most bottom positions - ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); - m_aAxisProperties.m_fInnerDirectionSign = fDeltaX<0 ? -1 : 1; + rStart = getScreenPosition( fXStart, fYStart, fZStart ); + rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); + + double fDeltaX = rEnd.getX() - rStart.getX(); + double fDeltaY = rEnd.getY() - rStart.getY(); + + //only those points are candidates which are lying on exactly one wall as these are outer edges + tScreenPosAndLogicPosList aPosList; + aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOnYPlane, fZOther ) ); + aPosList.push_back( getScreenPosAndLogicPos( fMinX, fYOther, fZOnZPlane ) ); + + if( fabs(fDeltaY) > fabs(fDeltaX) ) + { + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; + //choose most left positions + ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() ); + m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1; + } + else + { + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; + //choose most bottom positions + ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); + m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1; + } + ScreenPosAndLogicPos aBestPos( aPosList[0] ); + fYStart = fYEnd = aBestPos.fLogicY; + fZStart = fZEnd = aBestPos.fLogicZ; + if( !m_pPosHelper->isMathematicalOrientationX() ) + m_aAxisProperties.m_fLabelDirectionSign *= -1; } - ScreenPosAndLogicPos aBestPos( aPosList[0] ); - fYStart = fYEnd = aBestPos.fLogicY; - fZStart = fZEnd = aBestPos.fLogicZ; - if( !m_pPosHelper->isMathematicalOrientationX() ) - m_aAxisProperties.m_fInnerDirectionSign *= -1; }//end 3D x axis } else if( 1==m_nDimensionIndex ) //y-axis { + if( fCrossesOtherAxis < fMinX ) + fCrossesOtherAxis = fMinX; + else if( fCrossesOtherAxis > fMaxX ) + fCrossesOtherAxis = fMaxX; + fXStart = fXEnd = fCrossesOtherAxis; fYEnd=m_pPosHelper->getLogicMaxY(); if(3==m_nDimension) { - rStart = getScreenPosition( fXStart, fYStart, fZStart ); - rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); - - double fDeltaX = rEnd.getX() - rStart.getX(); - double fDeltaY = rEnd.getY() - rStart.getY(); - - //only those points are candidates which are lying on exactly one wall as these are outer edges - tScreenPosAndLogicPosList aPosList; - aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fMinY, fZOther ) ); - aPosList.push_back( getScreenPosAndLogicPos( fXOther, fMinY, fZOnZPlane ) ); - - if( fabs(fDeltaY) > fabs(fDeltaX) ) + if( AxisHelper::isAxisPositioningEnabled() ) { - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; - //choose most left positions - ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() ); - m_aAxisProperties.m_fInnerDirectionSign = fDeltaY<0 ? -1 : 1; + if( ::rtl::math::approxEqual( fXOther, fXStart) ) + fZStart = fZEnd = fZOnZPlane; + else + fZStart = fZEnd = fZOther; } else { - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; - //choose most bottom positions - ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); - m_aAxisProperties.m_fInnerDirectionSign = fDeltaX<0 ? -1 : 1; + rStart = getScreenPosition( fXStart, fYStart, fZStart ); + rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); + + double fDeltaX = rEnd.getX() - rStart.getX(); + double fDeltaY = rEnd.getY() - rStart.getY(); + + //only those points are candidates which are lying on exactly one wall as these are outer edges + tScreenPosAndLogicPosList aPosList; + aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fMinY, fZOther ) ); + aPosList.push_back( getScreenPosAndLogicPos( fXOther, fMinY, fZOnZPlane ) ); + + if( fabs(fDeltaY) > fabs(fDeltaX) ) + { + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; + //choose most left positions + ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() ); + m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1; + } + else + { + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; + //choose most bottom positions + ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); + m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1; + } + ScreenPosAndLogicPos aBestPos( aPosList[0] ); + fXStart = fXEnd = aBestPos.fLogicX; + fZStart = fZEnd = aBestPos.fLogicZ; + if( !m_pPosHelper->isMathematicalOrientationY() ) + m_aAxisProperties.m_fLabelDirectionSign *= -1; } - ScreenPosAndLogicPos aBestPos( aPosList[0] ); - fXStart = fXEnd = aBestPos.fLogicX; - fZStart = fZEnd = aBestPos.fLogicZ; - if( !m_pPosHelper->isMathematicalOrientationY() ) - m_aAxisProperties.m_fInnerDirectionSign *= -1; }//end 3D y axis } else //z-axis { fZEnd = m_pPosHelper->getLogicMaxZ(); - if( !m_pPosHelper->isSwapXAndY() ) + if( AxisHelper::isAxisPositioningEnabled() ) { - fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMinX(); - fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMinY() : m_pPosHelper->getLogicMaxY(); + if( !m_aAxisProperties.m_bSwapXAndY ) + { + if( fCrossesOtherAxis < fMinY ) + fCrossesOtherAxis = fMinY; + else if( fCrossesOtherAxis > fMaxY ) + fCrossesOtherAxis = fMaxY; + fYStart = fYEnd = fCrossesOtherAxis; + + if( ::rtl::math::approxEqual( fYOther, fYStart) ) + fXStart = fXEnd = fXOnXPlane; + else + fXStart = fXEnd = fXOther; + } + else + { + if( fCrossesOtherAxis < fMinX ) + fCrossesOtherAxis = fMinX; + else if( fCrossesOtherAxis > fMaxX ) + fCrossesOtherAxis = fMaxX; + fXStart = fXEnd = fCrossesOtherAxis; + + if( ::rtl::math::approxEqual( fXOther, fXStart) ) + fYStart = fYEnd = fYOnYPlane; + else + fYStart = fYEnd = fYOther; + } } else { - fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMaxX(); - fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMaxY() : m_pPosHelper->getLogicMinY(); - } + if( !m_pPosHelper->isSwapXAndY() ) + { + fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMaxX() : m_pPosHelper->getLogicMinX(); + fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMinY() : m_pPosHelper->getLogicMaxY(); + } + else + { + fXStart = fXEnd = m_pPosHelper->isMathematicalOrientationX() ? m_pPosHelper->getLogicMinX() : m_pPosHelper->getLogicMaxX(); + fYStart = fYEnd = m_pPosHelper->isMathematicalOrientationY() ? m_pPosHelper->getLogicMaxY() : m_pPosHelper->getLogicMinY(); + } - if(3==m_nDimension) - { - rStart = getScreenPosition( fXStart, fYStart, fZStart ); - rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); + if(3==m_nDimension) + { + rStart = getScreenPosition( fXStart, fYStart, fZStart ); + rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); - double fDeltaX = rEnd.getX() - rStart.getX(); + double fDeltaX = rEnd.getX() - rStart.getX(); - //only those points are candidates which are lying on exactly one wall as these are outer edges - tScreenPosAndLogicPosList aPosList; - aPosList.push_back( getScreenPosAndLogicPos( fXOther, fYOnYPlane, fMinZ ) ); - aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fYOther, fMinZ ) ); + //only those points are candidates which are lying on exactly one wall as these are outer edges + tScreenPosAndLogicPosList aPosList; + aPosList.push_back( getScreenPosAndLogicPos( fXOther, fYOnYPlane, fMinZ ) ); + aPosList.push_back( getScreenPosAndLogicPos( fXOnXPlane, fYOther, fMinZ ) ); - ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); - ScreenPosAndLogicPos aBestPos( aPosList[0] ); - ScreenPosAndLogicPos aNotSoGoodPos( aPosList[1] ); + ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() ); + ScreenPosAndLogicPos aBestPos( aPosList[0] ); + ScreenPosAndLogicPos aNotSoGoodPos( aPosList[1] ); - //choose most bottom positions - if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefere left-right algnments - { - if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() ) - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_RIGHT; - else - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; - } - else - { - if( aBestPos.aScreenPos.getY() > aNotSoGoodPos.aScreenPos.getY() ) - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; + //choose most bottom positions + if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefere left-right algnments + { + if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() ) + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_RIGHT; + else + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT; + } else - m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_TOP; - } + { + if( aBestPos.aScreenPos.getY() > aNotSoGoodPos.aScreenPos.getY() ) + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM; + else + m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_TOP; + } - m_aAxisProperties.m_fInnerDirectionSign = fDeltaX<0 ? -1 : 1; - if( !m_pPosHelper->isMathematicalOrientationZ() ) - m_aAxisProperties.m_fInnerDirectionSign *= -1; + m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1; + if( !m_pPosHelper->isMathematicalOrientationZ() ) + m_aAxisProperties.m_fLabelDirectionSign *= -1; - fXStart = fXEnd = aBestPos.fLogicX; - fYStart = fYEnd = aBestPos.fLogicY; + fXStart = fXEnd = aBestPos.fLogicX; + fYStart = fYEnd = aBestPos.fLogicY; + } }//end 3D z axis } rStart = getScreenPosition( fXStart, fYStart, fZStart ); rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd ); + + if(3==m_nDimension && !AxisHelper::isAxisPositioningEnabled() ) + m_aAxisProperties.m_fInnerDirectionSign = m_aAxisProperties.m_fLabelDirectionSign;//to behave like before + + if(3==m_nDimension && AxisHelper::isAxisPositioningEnabled() ) + { + double fDeltaX = rEnd.getX() - rStart.getX(); + double fDeltaY = rEnd.getY() - rStart.getY(); + + if( 2==m_nDimensionIndex ) + { + if( m_eLeftWallPos != CuboidPlanePosition_Left ) + { + m_aAxisProperties.m_fLabelDirectionSign *= -1.0; + m_aAxisProperties.m_fInnerDirectionSign *= -1.0; + } + + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ? + LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; + + if( ( fDeltaY<0 && m_aScale.Orientation == AxisOrientation_REVERSE ) || + ( fDeltaY>0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) ) + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_RIGHT ) ? + LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; + } + else if( fabs(fDeltaY) > fabs(fDeltaX) ) + { + if( m_eBackWallPos != CuboidPlanePosition_Back ) + { + m_aAxisProperties.m_fLabelDirectionSign *= -1.0; + m_aAxisProperties.m_fInnerDirectionSign *= -1.0; + } + + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ? + LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; + + if( ( fDeltaY<0 && m_aScale.Orientation == AxisOrientation_REVERSE ) || + ( fDeltaY>0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) ) + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_RIGHT ) ? + LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; + } + else + { + if( m_eBackWallPos != CuboidPlanePosition_Back ) + { + m_aAxisProperties.m_fLabelDirectionSign *= -1.0; + m_aAxisProperties.m_fInnerDirectionSign *= -1.0; + } + + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ? + LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; + + if( ( fDeltaX>0 && m_aScale.Orientation == AxisOrientation_REVERSE ) || + ( fDeltaX<0 && m_aScale.Orientation == AxisOrientation_MATHEMATICAL ) ) + m_aAxisProperties.m_aLabelAlignment = + ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_TOP ) ? + LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP; + } + } } TickmarkHelper* VCartesianAxis::createTickmarkHelper() @@ -1099,7 +1241,11 @@ TickmarkHelper_2D* VCartesianAxis::createTickmarkHelper2D() { B2DVector aStart, aEnd; this->get2DAxisMainLine( aStart, aEnd, this->getLogicValueWhereMainLineCrossesOtherAxis() ); - return new TickmarkHelper_2D( m_aScale, m_aIncrement, aStart, aEnd ); + + B2DVector aLabelLineStart, aLabelLineEnd; + this->get2DAxisMainLine( aLabelLineStart, aLabelLineEnd, this->getLogicValueWhereLabelLineCrossesOtherAxis() ); + + return new TickmarkHelper_2D( m_aScale, m_aIncrement, aStart, aEnd, aLabelLineStart-aStart ); } sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount() @@ -1146,7 +1292,7 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel lcl_correctPositionForStaggering( aOuterIter , lcl_getStaggerDistance( aInnerIter - , pTickmarkHelper2D->getDistanceTickToText( m_aAxisProperties ) ) ); + , pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) ) ); } } @@ -1252,7 +1398,7 @@ void SAL_CALL VCartesianAxis::updatePositions() xShape2DText = pTickInfo->xTextShape; if( xShape2DText.is() ) { - B2DVector aTextToTickDistance( pTickmarkHelper2D->getDistanceTickToText( m_aAxisProperties ) ); + B2DVector aTextToTickDistance( pTickmarkHelper2D->getDistanceAxisTickToText( m_aAxisProperties ) ); B2DVector aTickScreenPos2D( pTickInfo->aTickScreenPosition ); aTickScreenPos2D += aTextToTickDistance; awt::Point aAnchorScreenPosition2D( @@ -1325,7 +1471,7 @@ void SAL_CALL VCartesianAxis::createShapes() const TickmarkProperties& rTickmarkProperties = m_aAxisProperties.m_aTickmarkPropertiesList[nDepth]; sal_Int32 nPointCount = (*aDepthIter).size(); - drawing::PointSequenceSequence aPoints(nPointCount); + drawing::PointSequenceSequence aPoints(2*nPointCount); ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin(); const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end(); @@ -1334,9 +1480,16 @@ void SAL_CALL VCartesianAxis::createShapes() { if( !(*aTickIter).bPaintIt ) continue; - apTickmarkHelper2D->addPointSequenceForTickLine( aPoints, nN, (*aTickIter).fScaledTickValue - , m_aAxisProperties.m_fInnerDirectionSign, rTickmarkProperties ); - nN++; + + bool bTicksAtLabels = ( m_aAxisProperties.m_eTickmarkPos != ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS ); + double fInnerDirectionSign = m_aAxisProperties.m_fInnerDirectionSign; + if( bTicksAtLabels && m_aAxisProperties.m_eLabelPos == ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END ) + fInnerDirectionSign *= -1.0; + apTickmarkHelper2D->addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue + , fInnerDirectionSign , rTickmarkProperties, bTicksAtLabels ); + if( m_aAxisProperties.m_eTickmarkPos == ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS ) + apTickmarkHelper2D->addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue + , m_aAxisProperties.m_fInnerDirectionSign, rTickmarkProperties, !bTicksAtLabels ); } aPoints.realloc(nN); m_pShapeFactory->createLine2D( m_xGroupShape_Shapes, aPoints @@ -1356,14 +1509,17 @@ void SAL_CALL VCartesianAxis::createShapes() } //----------------------------------------- //create an additional line at NULL - double fExtraLineCrossesOtherAxis; - if( getLogicValueWhereExtraLineCrossesOtherAxis(fExtraLineCrossesOtherAxis) ) + if( !AxisHelper::isAxisPositioningEnabled() ) { - B2DVector aStart, aEnd; - this->get2DAxisMainLine( aStart, aEnd, fExtraLineCrossesOtherAxis ); - drawing::PointSequenceSequence aPoints( lcl_makePointSequence(aStart,aEnd) ); - Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D( - m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties ); + double fExtraLineCrossesOtherAxis; + if( getLogicValueWhereExtraLineCrossesOtherAxis(fExtraLineCrossesOtherAxis) ) + { + B2DVector aStart, aEnd; + this->get2DAxisMainLine( aStart, aEnd, fExtraLineCrossesOtherAxis ); + drawing::PointSequenceSequence aPoints( lcl_makePointSequence(aStart,aEnd) ); + Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D( + m_xGroupShape_Shapes, aPoints, &m_aAxisProperties.m_aLineProperties ); + } } } diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx index 38531cdf2ae7..ef5c8a0bf613 100644 --- a/chart2/source/view/axes/VCartesianAxis.hxx +++ b/chart2/source/view/axes/VCartesianAxis.hxx @@ -78,6 +78,7 @@ public: //------------------------------------------------------------------------- double getLogicValueWhereMainLineCrossesOtherAxis() const; + double getLogicValueWhereLabelLineCrossesOtherAxis() const; bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis) const; void get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis ); diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 1ee09ada8038..e6e77ebea57a 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -36,6 +36,7 @@ #include "macros.hxx" #include "AxisIndexDefines.hxx" #include "AxisHelper.hxx" +#include "ChartTypeHelper.hxx" //for auto_ptr #include <memory> @@ -145,8 +146,28 @@ void VCartesianCoordinateSystem::createVAxisList( AxisProperties aAxisProperties(xAxis,this->getExplicitCategoriesProvider()); aAxisProperties.m_nDimensionIndex = nDimensionIndex; aAxisProperties.m_bSwapXAndY = bSwapXAndY; + aAxisProperties.m_bIsMainAxis = (nAxisIndex==0); + Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel ) ); + if( xCrossingMainAxis.is() ) + { + ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() ); + aAxisProperties.m_bCrossingAxisHasReverseDirection = (AxisOrientation_REVERSE==aCrossingScale.Orientation); + + if( aCrossingScale.AxisType == AxisType::CATEGORY ) + { + aAxisProperties.m_bCrossingAxisIsCategoryAxes = true; + aAxisProperties.m_bAxisBetweenCategories = ChartTypeHelper::shiftTicksAtXAxisPerDefault( AxisHelper::getChartTypeByIndex( m_xCooSysModel, 0 ) ); + } + } + if( nDimensionIndex == 2 ) + { aAxisProperties.m_xAxisTextProvider = new TextualDataProvider( m_aSeriesNamesForZAxis ); + + //for the z axis copy the positioning properties from the x axis (or from the y axis for swapped coordinate systems) + Reference< XAxis > xSisterAxis( AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel ) ); + aAxisProperties.initAxisPositioning( Reference< beans::XPropertySet >( xSisterAxis, uno::UNO_QUERY) ); + } aAxisProperties.init(true); if(aAxisProperties.m_bDisplayLabels) aAxisProperties.m_nNumberFormatKey = this->getNumberFormatKeyForAxis( xAxis, xNumberFormatsSupplier ); diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx index 7c37b1b8fb74..2b3fdf5c327c 100644 --- a/chart2/source/view/axes/VPolarRadiusAxis.cxx +++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx @@ -50,6 +50,7 @@ VPolarRadiusAxis::VPolarRadiusAxis( const AxisProperties& rAxisProperties , sal_Int32 nDimensionCount ) : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount ) { + m_aAxisProperties.m_fLabelDirectionSign=0.0; m_aAxisProperties.m_fInnerDirectionSign=0.0; m_aAxisProperties.m_bLabelsOutside=true; m_aAxisProperties.m_bIsMainAxis=false; diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index fcae915faa51..8a831caa34ac 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -182,6 +182,12 @@ ChartItemPool::ChartItemPool(): ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0); ppPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,0); + ppPoolDefaults[SCHATTR_AXIS_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_POSITION,0); + ppPoolDefaults[SCHATTR_AXIS_POSITION_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE); + ppPoolDefaults[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0); + ppPoolDefaults[SCHATTR_AXIS_LABEL_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0); + ppPoolDefaults[SCHATTR_AXIS_MARK_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0); + ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH); ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,0); ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,0); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 276889f5c296..a4f2483f0730 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -77,6 +77,7 @@ #include <time.h> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart2/ExplicitSubIncrement.hpp> @@ -900,7 +901,8 @@ void SeriesPlotterContainer::doAutoScaling( const uno::Reference< frame::XModel //iterate over the main scales first than secondary axis size_t nC; - for( sal_Int32 nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ ) + sal_Int32 nAxisIndex=0; + for( nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ ) { // - first do autoscale for all x and z scales (because they are treated independent) @@ -1058,6 +1060,47 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( const uno:: } } } + + if( AxisHelper::isAxisPositioningEnabled() ) + { + //correct origin for y main axis (the origin is where the other main axis crosses) + nAxisIndex=0; + sal_Int32 nDimensionIndex=1; + for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; aAxisIter++ ) + { + AxisUsage& rAxisUsage = (*aAxisIter).second; + ::std::vector< VCoordinateSystem* > aVCooSysList = rAxisUsage.getCoordinateSystems(nDimensionIndex,nAxisIndex); + for( nC=0; nC < aVCooSysList.size(); nC++) + { + ExplicitScaleData aExplicitScale( aVCooSysList[nC]->getExplicitScale( nDimensionIndex, nAxisIndex ) ); + ExplicitIncrementData aExplicitIncrement( aVCooSysList[nC]->getExplicitIncrement( nDimensionIndex, nAxisIndex ) ); + + Reference< chart2::XCoordinateSystem > xCooSys( aVCooSysList[nC]->getModel() ); + Reference< XAxis > xAxis( xCooSys->getAxisByDimension( nDimensionIndex, nAxisIndex ) ); + Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ), uno::UNO_QUERY ); + + ::com::sun::star::chart::ChartAxisPosition eCrossingMainAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO ); + if( xCrossingMainAxis.is() ) + { + xCrossingMainAxis->getPropertyValue(C2U( "CrossoverPosition" )) >>= eCrossingMainAxisPos; + if( ::com::sun::star::chart::ChartAxisPosition_VALUE == eCrossingMainAxisPos ) + { + double fValue = 0.0; + xCrossingMainAxis->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue; + aExplicitScale.Origin = fValue; + } + else if( ::com::sun::star::chart::ChartAxisPosition_ZERO == eCrossingMainAxisPos ) + aExplicitScale.Origin = 0.0; + else if( ::com::sun::star::chart::ChartAxisPosition_START == eCrossingMainAxisPos ) + aExplicitScale.Origin = aExplicitScale.Minimum; + else if( ::com::sun::star::chart::ChartAxisPosition_END == eCrossingMainAxisPos ) + aExplicitScale.Origin = aExplicitScale.Maximum; + } + + aVCooSysList[nC]->setExplicitScaleAndIncrement( nDimensionIndex, nAxisIndex, aExplicitScale, aExplicitIncrement ); + } + } + } } drawing::Direction3D SeriesPlotterContainer::getPreferredAspectRatio() diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index b10fa1defe56..054da3a08542 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/drawing/Direction3D.hpp> #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -49,7 +50,6 @@ #include <com/sun/star/chart2/data/XDataProvider.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/XDataSink.hpp> -#include <com/sun/star/chart2/AxisPosition.hpp> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> @@ -2872,8 +2872,7 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const XclImpChTypeGroup& rTypeGroup // axis position ------------------------------------------------------ - namespace ApiAxisPosition = ::com::sun::star::chart2::AxisPosition; - aAxisProp.SetProperty( EXC_CHPROP_AXISPOSITION, bPrimary ? ApiAxisPosition::MAIN : ApiAxisPosition::SECONDARY ); + aAxisProp.SetProperty( CREATE_OUSTRING( "CrossoverPosition" ), bPrimary ? ::com::sun::star::chart::ChartAxisPosition_START : ::com::sun::star::chart::ChartAxisPosition_END ); } return xAxis; } diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index 5e01ecfaf1fc..b6ac422b1c89 100644 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -76,7 +76,6 @@ namespace com { namespace sun { namespace star { // property names #define EXC_CHPROP_ATTAXISINDEX CREATE_OUSTRING( "AttachedAxisIndex" ) #define EXC_CHPROP_ATTRIBDATAPOINTS CREATE_OUSTRING( "AttributedDataPoints" ) -#define EXC_CHPROP_AXISPOSITION CREATE_OUSTRING( "AxisPosition" ) #define EXC_CHPROP_BLACKDAY CREATE_OUSTRING( "BlackDay" ) #define EXC_CHPROP_COLOR CREATE_OUSTRING( "Color" ) #define EXC_CHPROP_CONNECTBARS CREATE_OUSTRING( "ConnectBars" ) |