Hey,

the attached patch together with [1] fixes the remaining problems when
you try to edit the chart in the document attached to fdo#44832. [1]
was an obvious fix while the attached patch is not obvious and I'm not
sure that it will not introduce another regression. I don't fully
understand why we need to add special handling for labels of second
and following categories.

Maybe someone here has an idea about the code, otherwise I would push
it to master and wait for people to test it carefully in 3-6.

Regards,
Markus

[1] 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=a769fd1ec076b61c1ce2f84da87283cc637dd5d5
From 1cda150c6d798f8ba30cd3db58d3faa089f905eb Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <[email protected]>
Date: Sun, 4 Mar 2012 20:45:45 +0100
Subject: [PATCH] don't add special handling for second and following
 categories, fdo#44832

---
 chart2/source/view/axes/VCartesianAxis.cxx |   36 +++++++---------------------
 1 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index a6547ef..8291efb 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1333,20 +1333,15 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel
         for( sal_Int32 nTextLevel=0; nTextLevel<nTextLevelCount; nTextLevel++ )
         {
             SAL_WNODEPRECATED_DECLARATIONS_PUSH
-            ::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
+                ::std::auto_ptr< TickIter > apTickIter = createLabelTickIterator( nTextLevel );
             SAL_WNODEPRECATED_DECLARATIONS_POP
-            if(apTickIter.get())
-            {
-                double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
-                if( nTextLevel>0 )
+                if(apTickIter.get())
                 {
-                    lcl_shiftLables( *apTickIter.get(), aCummulatedLabelsDistance );
-                    fRotationAngleDegree = 0.0;
+                    double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
+                    aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
+                            , pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties )
+                            , fRotationAngleDegree );
                 }
-                aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get()
-                    , pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties )
-                    , fRotationAngleDegree );
-            }
         }
     }
     else if( rAxisLabelProperties.getIsStaggered() )
@@ -1408,18 +1403,9 @@ void VCartesianAxis::createLabels()
                 AxisLabelProperties aComplexProps(m_aAxisLabelProperties);
                 if( m_aAxisProperties.m_bComplexCategories )
                 {
-                    if( nTextLevel==0 )
-                    {
-                        aComplexProps.bLineBreakAllowed = true;
-                        aComplexProps.bOverlapAllowed = !::rtl::math::approxEqual( aComplexProps.fRotationAngleDegree, 0.0 );
-                    }
-                    else
-                    {
-                        aComplexProps.bOverlapAllowed = true;
-                        aComplexProps.bRhythmIsFix = true;
-                        aComplexProps.nRhythm = 1;
-                        aComplexProps.fRotationAngleDegree = 0.0;
-                    }
+                    aComplexProps.bLineBreakAllowed = true;
+                    aComplexProps.bOverlapAllowed = !::rtl::math::approxEqual( aComplexProps.fRotationAngleDegree, 0.0 );
+
                 }
                 AxisLabelProperties& rAxisLabelProperties =  m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties;
                 while( !createTextShapes( m_xTextTarget, *apTickIter.get(), rAxisLabelProperties, pTickFactory2D, nScreenDistanceBetweenTicks ) )
@@ -1515,8 +1501,6 @@ void VCartesianAxis::updatePositions()
                         ,static_cast<sal_Int32>(aTickScreenPos2D.getY()));
 
                     double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
-                    if( nDepth>0 )
-                        fRotationAngleDegree = 0.0;
 
                     // #i78696# use mathematically correct rotation now
                     const double fRotationAnglePi(fRotationAngleDegree * (F_PI / -180.0));
@@ -1615,8 +1599,6 @@ void VCartesianAxis::createShapes()
                 if( apTickIter.get() )
                 {
                     double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree;
-                    if( nTextLevel>0 )
-                        fRotationAngleDegree = 0.0;
                     B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, false ), fRotationAngleDegree ) );
                     sal_Int32 nCurrentLength = static_cast<sal_Int32>(aLabelsDistance.getLength());
                     aTickmarkPropertiesList.push_back( m_aAxisProperties.makeTickmarkPropertiesForComplexCategories( nOffset + nCurrentLength, 0, nTextLevel ) );
-- 
1.7.7

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to