diff options
author | obo <obo@openoffice.org> | 2011-03-16 09:56:18 +0100 |
---|---|---|
committer | obo <obo@openoffice.org> | 2011-03-16 09:56:18 +0100 |
commit | d3bd824556722068e2893dd96821554ccbb1d662 (patch) | |
tree | 0a28426e53a4f3f92f29bde256ec369bf4e40692 /chart2 | |
parent | b491f91e8d6cebe3ade4f805152100489eb91754 (diff) | |
parent | 2e2bd7aab73bbf4402034569c6c5ab7d227d9c83 (diff) |
CWS-TOOLING: integrate CWS chart55
Notes
Notes:
split repo tag: calc_ooo/DEV300_m103
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_Position.cxx | 11 | ||||
-rw-r--r-- | chart2/source/view/axes/ScaleAutomatism.cxx | 28 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | chart2/source/view/main/VLegend.cxx | 4 |
4 files changed, 33 insertions, 17 deletions
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 37cbdbb30f6b..d42d3112f67c 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -62,7 +62,7 @@ using namespace ::com::sun::star::chart2; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& rPosAndSize, const awt::Size aOriginalSize ) +void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, awt::Rectangle& rPosAndSize, const awt::Size aOriginalSize ) { long nPosX(0); long nPosY(0); @@ -121,7 +121,7 @@ void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& r break; } - rPosAndSize = Rectangle(Point(nPosX,nPosY),Size(nSizX,nSizY)); + rPosAndSize = awt::Rectangle(nPosX,nPosY,nSizX,nSizY); } void SAL_CALL ChartController::executeDispatch_PositionAndSize() @@ -166,19 +166,18 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() const SfxItemSet* pOutItemSet = pDlg->GetOutputItemSet(); if(pOutItemSet) { - Rectangle aObjectRect; + awt::Rectangle aObjectRect; aItemSet.Put(*pOutItemSet);//overwrite old values with new values (-> all items are set) lcl_getPositionAndSizeFromItemSet( aItemSet, aObjectRect, aSelectedSize ); awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) ); - Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); + awt::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); bool bChanged = false; if ( eObjectType == OBJECTTYPE_LEGEND ) bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true ); bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel() - , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) - , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); + , aObjectRect, aPageRect ); if( bMoved || bChanged ) aUndoGuard.commit(); } diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx index 075ad16347c2..0ca83bf354e9 100644 --- a/chart2/source/view/axes/ScaleAutomatism.cxx +++ b/chart2/source/view/axes/ScaleAutomatism.cxx @@ -49,9 +49,16 @@ using ::com::sun::star::chart::TimeUnit::MONTH; using ::com::sun::star::chart::TimeUnit::YEAR; const sal_Int32 MAXIMUM_MANUAL_INCREMENT_COUNT = 500; -const sal_Int32 MAXIMUM_AUTO_INCREMENT_COUNT = 10; const sal_Int32 MAXIMUM_SUB_INCREMENT_COUNT = 100; +sal_Int32 lcl_getMaximumAutoIncrementCount( sal_Int32 nAxisType ) +{ + sal_Int32 nMaximumAutoIncrementCount = 10; + if( nAxisType==AxisType::DATE ) + nMaximumAutoIncrementCount = MAXIMUM_MANUAL_INCREMENT_COUNT; + return nMaximumAutoIncrementCount; +} + namespace { @@ -102,7 +109,7 @@ ScaleAutomatism::ScaleAutomatism( const ScaleData& rSourceScale, const Date& rNu : m_aSourceScale( rSourceScale ) , m_fValueMinimum( 0.0 ) , m_fValueMaximum( 0.0 ) - , m_nMaximumAutoMainIncrementCount( MAXIMUM_AUTO_INCREMENT_COUNT ) + , m_nMaximumAutoMainIncrementCount( lcl_getMaximumAutoIncrementCount( rSourceScale.AxisType ) ) , m_bExpandBorderToIncrementRhythm( false ) , m_bExpandIfValuesCloseToBorder( false ) , m_bExpandWideValuesToZero( false ) @@ -149,8 +156,8 @@ void ScaleAutomatism::setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMa { if( nMaximumAutoMainIncrementCount < 2 ) m_nMaximumAutoMainIncrementCount = 2; //#i82006 - else if( nMaximumAutoMainIncrementCount > MAXIMUM_AUTO_INCREMENT_COUNT ) - m_nMaximumAutoMainIncrementCount = MAXIMUM_AUTO_INCREMENT_COUNT; + else if( nMaximumAutoMainIncrementCount > lcl_getMaximumAutoIncrementCount( m_aSourceScale.AxisType ) ) + m_nMaximumAutoMainIncrementCount = lcl_getMaximumAutoIncrementCount( m_aSourceScale.AxisType ); else m_nMaximumAutoMainIncrementCount = nMaximumAutoMainIncrementCount; } @@ -692,6 +699,19 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis( nNumer = static_cast<sal_Int32>( rtl::math::approxCeil( nIntervalDays/nDaysPerInterval ) ); if(nNumer<=0) nNumer=1; + if( rExplicitIncrement.MajorTimeInterval.TimeUnit == DAY ) + { + if( nNumer>2 && nNumer<7 ) + nNumer=7; + else if( nNumer>7 ) + { + rExplicitIncrement.MajorTimeInterval.TimeUnit = MONTH; + nDaysPerInterval = 31.0; + nNumer = static_cast<sal_Int32>( rtl::math::approxCeil( nIntervalDays/nDaysPerInterval ) ); + if(nNumer<=0) + nNumer=1; + } + } rExplicitIncrement.MajorTimeInterval.Number = nNumer; nMainIncrementCount = nDayCount/(nNumer*nDaysPerInterval); } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index ad20a557756c..ee915ceac688 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2198,12 +2198,9 @@ std::auto_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType } uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, xChartModel ) ); - if(xTitle.is()) + rtl::OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) ); + if( aCompleteString.getLength() != 0 ) { - rtl::OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) ); - if ( aCompleteString.getLength() == 0 ) - return apVTitle;//don't create empty titles as the resulting diagram position is wrong then - //create title apVTitle = std::auto_ptr<VTitle>(new VTitle(xTitle)); rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, xChartModel ) ); diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 33e1d1f26aa4..12548e888fec 100644..100755 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -918,8 +918,8 @@ void VLegend::createShapes( RelativeSize aRelativeSize; if ((xLegendProp->getPropertyValue( C2U( "RelativeSize" )) >>= aRelativeSize)) { - aLegendSize.Width = aRelativeSize.Primary * rPageSize.Width; - aLegendSize.Height = aRelativeSize.Secondary * rPageSize.Height; + aLegendSize.Width = ::rtl::math::approxCeil( aRelativeSize.Primary * rPageSize.Width ); + aLegendSize.Height = ::rtl::math::approxCeil( aRelativeSize.Secondary * rPageSize.Height ); } else eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; |