diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-03-03 11:39:43 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-03-03 11:39:43 +0000 |
commit | 6b741821d6ac3bca21a98a3ce5b069b24abba41f (patch) | |
tree | 88981f97deb5975ee32b22de4611da006e183ba4 /chart2 | |
parent | 07b0c01857137de7e4bd02375e7c892d622d270e (diff) |
CWS-TOOLING: integrate CWS chart35
2009-02-20 12:33:54 +0100 nn r268312 : correct line ends
2009-01-19 12:50:45 +0100 iha r266491 : #i91800# style:text-position='0' is wrongly imported
2009-01-19 11:59:09 +0100 iha r266486 : #i91037# Position of Datalabels in 3D Bar-Charts are crossing the edge
2009-01-16 16:45:50 +0100 iha r266435 : #i93802# clockwise does not work on solars sparc
2009-01-16 13:23:37 +0100 iha r266414 : #i91037# Position of Datalabels in 3D Bar-Charts are crossing the edge
2009-01-15 14:09:27 +0100 iha r266370 : #i98102# checkbox show equation should not be checked initially
2009-01-14 17:41:33 +0100 iha r266323 : #i97133# #i97318# chart type is not detected correctly in case of invisible series
2009-01-14 16:23:06 +0100 iha r266316 : #i97133# #i97318# chart type is not detected correctly in case of invisible series
2009-01-14 13:43:38 +0100 iha r266298 : #i84417# Unable to edit existing chart title with clipboard
2009-01-14 13:43:04 +0100 iha r266297 : #i84417# Unable to edit existing chart title with IME
2009-01-14 13:14:15 +0100 dr r266293 : do not set CharEscapement property if not needed
2009-01-14 00:48:46 +0100 er r266262 : #i81383# changed ASC and JIS to use transliteration provided by i18n transliteration; patch from <bluedwarf>
2009-01-14 00:28:06 +0100 er r266261 : #i97536# silence gcc's unbracketed && || warnings
2009-01-13 22:43:45 +0100 er r266259 : #i97905# corrected IndexKey order
2009-01-13 20:36:15 +0100 er r266254 : #i97905# add SKK/EUR conversion (plus MTL/EUR and CYP/EUR)
2009-01-13 20:31:17 +0100 er r266253 : #i97905# updated locale data; contributed by <brko>
2009-01-13 11:57:08 +0100 iha r266204 : #i84103# cannot set data in xy diagram in draw
2009-01-12 20:29:37 +0100 nn r266181 : #i97680# GetStylesContainer: handle non-available style family
2009-01-12 19:53:19 +0100 nn r266180 : #i98000# don't get initial zoom value via SfxViewFrame::Current
2009-01-12 16:11:19 +0100 iha r266166 : #i71686# XY charts without valid x values are not imported correctly from Excel
2009-01-09 17:10:20 +0100 iha r266102 : #i95051# truncated asian strings on scale tabpage
2009-01-09 15:58:46 +0100 iha r266094 : #i89430# truncated asian strings in smooth lines dialog
2009-01-09 13:09:14 +0100 iha r266076 : #i94813# importing pie chart with multiline categories crashes
Diffstat (limited to 'chart2')
14 files changed, 270 insertions, 118 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 6b6d682186c5..f89171d4d55e 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -40,6 +40,7 @@ #include "ControllerLockGuard.hxx" #include "macros.hxx" #include "StatisticsHelper.hxx" +#include "ContainerHelper.hxx" #include <com/sun/star/container/XIndexReplace.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -420,28 +421,30 @@ void DataBrowserModel::removeDataSeries( sal_Int32 nAtColumnIndex ) m_apDialogModel->deleteSeries( xSeries, getHeaderForSeries( xSeries ).m_xChartType ); - Reference< chart2::XInternalDataProvider > xDataProvider( - m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); - Reference< chart2::data::XDataSource > xSource( xSeries,uno::UNO_QUERY ); - if( xDataProvider.is() && xSource.is()) + //delete sequences from internal data provider that are not used anymore + //but do not delete sequences that are still in use by the remaining series + Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); + Reference< chart2::data::XDataSource > xSourceOfDeletedSeries( xSeries, uno::UNO_QUERY ); + if( xDataProvider.is() && xSourceOfDeletedSeries.is()) { ::std::vector< sal_Int32 > aSequenceIndexesToDelete; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xSource->getDataSequences()); - Reference< chart2::XDataSeriesContainer > xSeriesCnt( - getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY ); + Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequencesOfDeletedSeries( xSourceOfDeletedSeries->getDataSequences() ); + Reference< chart2::XDataSeriesContainer > xSeriesCnt( getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY ); if( xSeriesCnt.is()) { - lcl_tSharedSeqVec aSharedSequences = lcl_getSharedSequences( xSeriesCnt->getDataSeries()); - for( sal_Int32 i=0; i<aUsedSequences.getLength(); ++i ) + Reference< chart2::data::XDataSource > xRemainingDataSource( DataSeriesHelper::getDataSource( xSeriesCnt->getDataSeries() ) ); + if( xRemainingDataSource.is() ) { - lcl_tSharedSeqVec::const_iterator aHitIt( - ::std::find_if( - aSharedSequences.begin(), aSharedSequences.end(), - lcl_RepresentationsOfLSeqMatch( aUsedSequences[i] ))); - // if not shared -> delete - if( aHitIt == aSharedSequences.end()) - aSequenceIndexesToDelete.push_back( - lcl_getValuesRepresentationIndex( aUsedSequences[i] )); + ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aRemainingSeq( ContainerHelper::SequenceToVector( xRemainingDataSource->getDataSequences() ) ); + for( sal_Int32 i=0; i<aSequencesOfDeletedSeries.getLength(); ++i ) + { + ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aHitIt( + ::std::find_if( aRemainingSeq.begin(), aRemainingSeq.end(), + lcl_RepresentationsOfLSeqMatch( aSequencesOfDeletedSeries[i] ))); + // if not used by the remaining series this sequence can be deleted + if( aHitIt == aRemainingSeq.end() ) + aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeletedSeries[i] ) ); + } } } diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index eb5aef2a8375..f60637af4c44 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -452,14 +452,17 @@ public: SplinePropertiesDialog( Window* pParent ); virtual ~SplinePropertiesDialog(); - void adjustSize(); - void fillControls( const ChartTypeParameter& rParameter ); void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines ); + virtual void StateChanged( StateChangedType nType ); + private: DECL_LINK( SplineModeRadioHdl, RadioButton* ); + void adjustControlPositions(); + void adjustSize(); + private: RadioButton m_aRB_Splines_Cubic; RadioButton m_aRB_Splines_B; @@ -497,7 +500,25 @@ SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) m_aRB_Splines_Cubic.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) ); m_aRB_Splines_B.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) ); +} + +SplinePropertiesDialog::~SplinePropertiesDialog() +{ +} + +void SplinePropertiesDialog::StateChanged( StateChangedType nType ) +{ + Dialog::StateChanged( nType ); + + if( nType == STATE_CHANGE_INITSHOW ) + { + adjustControlPositions(); + adjustSize(); + } +} +void SplinePropertiesDialog::adjustControlPositions() +{ //position of controls: //---------------- //fixed line and Fixed texts as near as possible to radio controls @@ -525,9 +546,6 @@ SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) m_aMF_SplineResolution.SetPosPixel( Point( nMFXPos, m_aMF_SplineResolution.GetPosPixel().Y() ) ); } -SplinePropertiesDialog::~SplinePropertiesDialog() -{ -} void SplinePropertiesDialog::adjustSize() { Size aDlgSize( this->GetSizePixel() ); @@ -636,10 +654,7 @@ SplineResourceGroup::~SplineResourceGroup() SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog() { if( !m_pSplinePropertiesDialog.get() ) - { m_pSplinePropertiesDialog = ::std::auto_ptr< SplinePropertiesDialog >( new SplinePropertiesDialog( m_aPB_DetailsDialog.GetParent() ) ); - m_pSplinePropertiesDialog->adjustSize(); - } return *m_pSplinePropertiesDialog; } void SplineResourceGroup::showControls( bool bShow ) diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index 581d06d84838..4c626d1dfb37 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -76,7 +76,7 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) } if( m_aCB_Clockwise.IsVisible() ) - rOutAttrs.Put(SfxInt32Item(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked())); return TRUE; } diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index d799fd31b89d..a2c3694a8469 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -137,47 +137,6 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : FreeResource(); SetExchangeSupport(); - //optimize position of the controls - { - long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() ); - nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth+=1; - - long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); - long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance; - - //ensure that the auto checkboxes are wide enough and have correct size for calculation - aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() ); - aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() ); - aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() ); - aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() ); - aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() ); - - //ensure new pos is ok - long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); - long nDialogWidth = GetSizePixel().Width(); - - long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls; - if(nLeftSpace>=0) - { - Size aSize( aTxtMin.GetSizePixel() ); - aSize.Width() = nLabelWidth; - aTxtMin.SetSizePixel(aSize); - aTxtMax.SetSizePixel(aSize); - aTxtMain.SetSizePixel(aSize); - aTxtHelp.SetSizePixel(aSize); - aTxtOrigin.SetSizePixel(aSize); - - lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos ); - lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos ); - lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); - lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); - lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); - } - } - aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); @@ -185,6 +144,56 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); } +void ScaleTabPage::StateChanged( StateChangedType nType ) +{ + TabPage::StateChanged( nType ); + + if( nType == STATE_CHANGE_INITSHOW ) + AdjustControlPositions(); +} + +void ScaleTabPage::AdjustControlPositions() +{ + //optimize position of the controls + long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() ); + nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth+=1; + + long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); + long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance; + + //ensure that the auto checkboxes are wide enough and have correct size for calculation + aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() ); + aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() ); + aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() ); + aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() ); + aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() ); + + //ensure new pos is ok + long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); + long nDialogWidth = GetSizePixel().Width(); + + long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls; + if(nLeftSpace>=0) + { + Size aSize( aTxtMin.GetSizePixel() ); + aSize.Width() = nLabelWidth; + aTxtMin.SetSizePixel(aSize); + aTxtMax.SetSizePixel(aSize); + aTxtMain.SetSizePixel(aSize); + aTxtHelp.SetSizePixel(aSize); + aTxtOrigin.SetSizePixel(aSize); + + lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos ); + lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos ); + lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); + lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); + lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); + } +} + void ScaleTabPage::EnableControls() { bool bEnableForValueOrPercentAxis = chart2::AxisType::REALNUMBER == nAxisType || chart2::AxisType::PERCENT == nAxisType; diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index 7453b3e649b6..2b0684854c48 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -62,6 +62,8 @@ public: void ShowAxisOrigin( bool bShowOrigin ); + virtual void StateChanged( StateChangedType nType ); + private: FixedLine aFlScale; @@ -98,6 +100,7 @@ private: bool m_bShowAxisOrigin; + void AdjustControlPositions(); void EnableControls(); DECL_LINK( EnableValueHdl, CheckBox* ); diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index 132e5c948a7a..4ee0ca2f1f51 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -633,29 +633,21 @@ void StatisticsItemConverter::FillSpecialItem( case SCHATTR_REGRESSION_SHOW_EQUATION: { + bool bShowEq = false; uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); if( xEqProp.is()) - { - bool bShowEq = false; - if( xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq ) - rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq )); - } - else - rOutItemSet.InvalidateItem( nWhichId ); + xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq; + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq )); } break; case SCHATTR_REGRESSION_SHOW_COEFF: { + bool bShowCoeff = false; uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); if( xEqProp.is()) - { - bool bShowCoeff = false; - if( xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff ) - rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff )); - } - else - rOutItemSet.InvalidateItem( nWhichId ); + xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff; + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff )); } break; diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 5db316196e1d..fdbda4589abd 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -80,6 +80,8 @@ // for SolarMutex #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +// for OutlinerView +#include <svx/outliner.hxx> using namespace ::com::sun::star; @@ -376,14 +378,23 @@ void ChartController::executeDispatch_Paste() OUString aString; if( aDataHelper.GetString( FORMAT_STRING, aString ) && m_pDrawModelWrapper ) { - awt::Point aTextPos; - awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); - aTextPos.X = (aPageSize.Width / 2); - aTextPos.Y = (aPageSize.Height / 2); - lcl_InsertStringAsTextShapeIntoDrawPage( - m_pDrawModelWrapper->getShapeFactory(), - m_pDrawModelWrapper->getMainDrawPage(), - aString, aTextPos ); + if( m_pDrawViewWrapper ) + { + OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + if( pOutlinerView )//in case of edit mode insert into edited string + pOutlinerView->InsertText( aString ); + else + { + awt::Point aTextPos; + awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); + aTextPos.X = (aPageSize.Width / 2); + aTextPos.Y = (aPageSize.Height / 2); + lcl_InsertStringAsTextShapeIntoDrawPage( + m_pDrawModelWrapper->getShapeFactory(), + m_pDrawModelWrapper->getMainDrawPage(), + aString, aTextPos ); + } + } } } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 55aafb1e5538..2288bb602296 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -872,6 +872,15 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } + else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) ) + { + //#i84417# enable editing with IME + if( m_pDrawViewWrapper ) + m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow ); + } } bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx index 66a35ff04790..5ffe02b5212b 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.cxx +++ b/chart2/source/model/template/LineChartTypeTemplate.cxx @@ -232,6 +232,9 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( // with symbols (or with lines) if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -244,16 +247,25 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE) && - (!m_bHasSymbols) ) + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -264,6 +276,16 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( ASSERT_EXCEPTION( ex ); } } + + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } // adapt curve style, spline order and resolution diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index 44da318a8013..ab90f0f7ff42 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -114,9 +114,11 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( // check symbol-style // for a template with symbols it is ok, if there is at least one series // with symbols, otherwise an unknown template is too easy to achieve - bool bSymbolsFound = false; if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -128,18 +130,26 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( chart2::Symbol aSymbProp; drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE ) && - (! m_bHasSymbols) ) + + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( m_bHasSymbols ) - bSymbolsFound = bSymbolsFound || (aSymbProp.Style != chart2::SymbolStyle_NONE); - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -151,8 +161,15 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( } } - if( m_bHasSymbols ) - bResult = bResult && bSymbolsFound; + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } return bResult; diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index 50c8cdc4b78f..6e5449d49f49 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -271,6 +271,9 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( // with symbols (or with lines) if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -283,16 +286,25 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE) && - (!m_bHasSymbols) ) + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -303,6 +315,16 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( ASSERT_EXCEPTION( ex ); } } + + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } // adapt curve style, spline order and resolution diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 11c408e7bc6a..baeac4a29cf1 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -203,6 +203,7 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( double fZ = fScaledZ; bool bReverse = !pPosHelper->isMathematicalOrientationY(); bool bNormalOutside = (!bReverse == !!(fBaseValue < fScaledUpperYValue)); + double fDepth = fScaledUpperBarDepth; switch(nLabelPlacement) { @@ -212,6 +213,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue; rAlignment = LABEL_ALIGN_TOP; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } else { @@ -227,6 +230,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue; rAlignment = LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } else { @@ -242,6 +247,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue; rAlignment = LABEL_ALIGN_LEFT; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } else { @@ -257,6 +264,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue; rAlignment = LABEL_ALIGN_RIGHT; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } else { @@ -273,6 +282,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; else rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::INSIDE: @@ -282,6 +293,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; else rAlignment = bNormalOutside ? LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN: @@ -291,26 +304,24 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; else rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::CENTER: fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0; rAlignment = LABEL_ALIGN_CENTER; + if(3==m_nDimension) + fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0; break; default: DBG_ERROR("this label alignment is not implemented yet"); break; } - if(3==m_nDimension) - { - rAlignment = LABEL_ALIGN_CENTER; - double fDepth = fScaledUpperBarDepth; - if(nLabelPlacement==::com::sun::star::chart::DataLabelPlacement::CENTER) - fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0; fZ -= fDepth/2.0; - } + drawing::Position3D aScenePosition3D( pPosHelper-> transformScaledLogicToScene( fX, fY, fZ, true ) ); return LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) @@ -884,13 +895,29 @@ void BarChart::createShapes() LabelAlignment eAlignment(LABEL_ALIGN_CENTER); sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nCatIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() ); + double fLowerBarDepth = fLogicBarDepth; + double fUpperBarDepth = fLogicBarDepth; + { + double fOuterBarDepth = fLogicBarDepth; + if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 ) + { + fOuterBarDepth = fLogicBarDepth * (fTopHeight)/(fabs(fCompleteHeight)); + fLowerBarDepth = (fBaseValue < fUpperYValue) ? fabs(fLogicBarDepth) : fabs(fOuterBarDepth); + fUpperBarDepth = (fBaseValue < fUpperYValue) ? fabs(fOuterBarDepth) : fabs(fLogicBarDepth); + } + } + awt::Point aScreenPosition2D( this->getLabelScreenPositionAndAlignment( eAlignment, nLabelPlacement , fLogicX, fLowerYValue, fUpperYValue, fLogicZ - , fLogicBarDepth, fLogicBarDepth, fBaseValue, pPosHelper )); + , fLowerBarDepth, fUpperBarDepth, fBaseValue, pPosHelper )); sal_Int32 nOffset = 0; if(LABEL_ALIGN_CENTER!=eAlignment) + { nOffset = 100;//add some spacing //@todo maybe get more intelligent values + if( m_nDimension == 3 ) + nOffset = 260; + } this->createDataLabel( xTextTarget, **aSeriesIter, nCatIndex , fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset ); } diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 774ea4dd5815..7759f3110cbd 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -570,7 +570,9 @@ namespace ::basegfx::B2IRectangle lcl_getRect( const uno::Reference< drawing::XShape >& xShape ) { - ::basegfx::B2IRectangle aRect( BaseGFXHelper::makeRectangle(xShape->getPosition(),xShape->getSize() )); + ::basegfx::B2IRectangle aRect; + if( xShape.is() ) + aRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),xShape->getSize() ); return aRect; } diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index f15ed34d5209..f648b7510cec 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -199,6 +199,23 @@ struct lcl_LessXOfPoint return false; } }; + +void lcl_clearIfTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence ) +{ + uno::Sequence< rtl::OUString > aStrings( DataSequenceToStringSequence( xDataSequence ) ); + for( sal_Int32 i = 0; i < rData.Doubles.getLength(); ++i ) + { + if( ::rtl::math::isNan( rData.Doubles[i] ) ) + { + if( i < aStrings.getLength() && aStrings[i].getLength() ) + { + rData.clear(); + break; + } + } + } +} + } VDataSeries::VDataSeries() @@ -280,7 +297,10 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) aARole >>= aRole; if( aRole.equals(C2U("values-x")) ) + { m_aValues_X.init( xDataSequence ); + lcl_clearIfTextIsContained( m_aValues_X, xDataSequence ); + } else if( aRole.equals(C2U("values-y")) ) m_aValues_Y.init( xDataSequence ); else if( aRole.equals(C2U("values-min")) ) |