[Libreoffice-commits] core.git: 4 commits - chart2/source include/o3tl include/vcl o3tl/CppunitTest_o3tl_tests.mk o3tl/qa

Stephan Bergmann sbergman at redhat.com
Tue Oct 14 04:02:27 PDT 2014


 chart2/source/view/axes/Tickmarks.cxx        |    6 -
 chart2/source/view/axes/VAxisProperties.cxx  |   48 ++++++------
 chart2/source/view/axes/VAxisProperties.hxx  |   17 +---
 chart2/source/view/axes/VCartesianAxis.cxx   |  102 ++++++++++++---------------
 chart2/source/view/axes/VCartesianAxis.hxx   |    4 -
 chart2/source/view/axes/VPolarRadiusAxis.cxx |    6 -
 include/o3tl/typed_flags_set.hxx             |   12 +--
 include/vcl/outdevstate.hxx                  |    4 -
 o3tl/CppunitTest_o3tl_tests.mk               |    1 
 o3tl/qa/test-typed_flags.cxx                 |   63 ++++++++++++++++
 10 files changed, 152 insertions(+), 111 deletions(-)

New commits:
commit bf302000ea8849ac7ecd9162f3014bac9da4406e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 14 12:48:42 2014 +0200

    Revert "Make VCartesianAxis::get2DAxisMainLine() truly const method."
    
    This reverts commit 410c5bd58c36d9064a79520d5bc31cb32ead1326,
    it causes CppunitTest_chart2_xshape to fail.

diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx
index a8cd9a5..9942753 100644
--- a/chart2/source/view/axes/Tickmarks.cxx
+++ b/chart2/source/view/axes/Tickmarks.cxx
@@ -237,7 +237,7 @@ B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisP
         || ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == rAxisProperties.m_eLabelPos )
         bFarAwayLabels = true;
 
-    double fInnerDirectionSign = rAxisProperties.maLabelAlignment.mfInnerTickDirection;
+    double fInnerDirectionSign = rAxisProperties.m_fInnerDirectionSign;
     if( fInnerDirectionSign==0.0 )
         fInnerDirectionSign = 1.0;
 
@@ -269,11 +269,11 @@ B2DVector TickFactory2D::getDistanceAxisTickToText( const AxisProperties& rAxisP
     }
 
     B2DVector aLabelDirection(aStart);
-    if (rAxisProperties.maLabelAlignment.mfInnerTickDirection != rAxisProperties.maLabelAlignment.mfLabelDirection)
+    if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
         aLabelDirection = aEnd;
 
     B2DVector aOrthoLabelDirection(aOrthoDirection);
-    if (rAxisProperties.maLabelAlignment.mfInnerTickDirection != rAxisProperties.maLabelAlignment.mfLabelDirection)
+    if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign )
         aOrthoLabelDirection*=-1.0;
     aOrthoLabelDirection.normalize();
     if( bIncludeSpaceBetweenTickAndText )
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
index 9b449d5..80c2261 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -30,16 +30,11 @@
 #include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
 
+namespace chart
+{
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::chart2;
 
-namespace chart {
-
-AxisLabelAlignment::AxisLabelAlignment() :
-    mfLabelDirection(1.0),
-    mfInnerTickDirection(1.0),
-    meAlignment(LABEL_ALIGN_RIGHT_TOP) {}
-
 sal_Int32 lcl_calcTickLengthForDepth(sal_Int32 nDepth,sal_Int32 nTickmarkStyle)
 {
     sal_Int32 nWidth = AXIS2D_TICKLENGTH; //@maybefuturetodo this length could be offered by the model
@@ -117,7 +112,7 @@ TickmarkProperties AxisProperties::makeTickmarkProperties(
         nTickmarkStyle = m_nMinorTickmarks;
     }
 
-    if (maLabelAlignment.mfInnerTickDirection == 0.0)
+    if( m_fInnerDirectionSign == 0.0 )
     {
         if( nTickmarkStyle != 0 )
             nTickmarkStyle = 3; //inner and outer tickmarks
@@ -133,7 +128,7 @@ TickmarkProperties AxisProperties::makeTickmarkProperties(
 TickmarkProperties AxisProperties::makeTickmarkPropertiesForComplexCategories(
     sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 /*nTextLevel*/ ) const
 {
-    sal_Int32 nTickmarkStyle = (maLabelAlignment.mfLabelDirection == maLabelAlignment.mfInnerTickDirection) ? 2/*outside*/ : 1/*inside*/;
+    sal_Int32 nTickmarkStyle = (m_fLabelDirectionSign==m_fInnerDirectionSign) ? 2/*outside*/ : 1/*inside*/;
 
     TickmarkProperties aTickmarkProperties;
     aTickmarkProperties.Length = nTickLength;// + nTextLevel*( lcl_calcTickLengthForDepth(0,nTickmarkStyle) );
@@ -163,6 +158,9 @@ AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
     , m_eTickmarkPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
     , m_bCrossingAxisHasReverseDirection(false)
     , m_bCrossingAxisIsCategoryAxes(false)
+    , m_fLabelDirectionSign(1.0)
+    , m_fInnerDirectionSign(1.0)
+    , m_aLabelAlignment(LABEL_ALIGN_RIGHT_TOP)
     , m_bDisplayLabels( true )
     , m_nNumberFormatKey(0)
     , m_nMajorTickmarks(1)
@@ -187,7 +185,9 @@ AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
     , m_eTickmarkPos( rAxisProperties.m_eTickmarkPos )
     , m_bCrossingAxisHasReverseDirection( rAxisProperties.m_bCrossingAxisHasReverseDirection )
     , m_bCrossingAxisIsCategoryAxes( rAxisProperties.m_bCrossingAxisIsCategoryAxes )
-    , maLabelAlignment( rAxisProperties.maLabelAlignment )
+    , m_fLabelDirectionSign( rAxisProperties.m_fLabelDirectionSign )
+    , m_fInnerDirectionSign( rAxisProperties.m_fInnerDirectionSign )
+    , m_aLabelAlignment( rAxisProperties.m_aLabelAlignment )
     , m_bDisplayLabels( rAxisProperties.m_bDisplayLabels )
     , m_nNumberFormatKey( rAxisProperties.m_nNumberFormatKey )
     , m_nMajorTickmarks( rAxisProperties.m_nMajorTickmarks )
@@ -209,7 +209,7 @@ AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
 LabelAlignment lcl_getLabelAlignmentForZAxis( const AxisProperties& rAxisProperties )
 {
     LabelAlignment aRet( LABEL_ALIGN_RIGHT );
-    if (rAxisProperties.maLabelAlignment.mfLabelDirection < 0)
+    if( rAxisProperties.m_fLabelDirectionSign<0 )
         aRet = LABEL_ALIGN_LEFT;
     return aRet;
 }
@@ -217,7 +217,7 @@ LabelAlignment lcl_getLabelAlignmentForZAxis( const AxisProperties& rAxisPropert
 LabelAlignment lcl_getLabelAlignmentForYAxis( const AxisProperties& rAxisProperties )
 {
     LabelAlignment aRet( LABEL_ALIGN_RIGHT );
-    if (rAxisProperties.maLabelAlignment.mfLabelDirection < 0)
+    if( rAxisProperties.m_fLabelDirectionSign<0 )
         aRet = LABEL_ALIGN_LEFT;
     return aRet;
 }
@@ -225,7 +225,7 @@ LabelAlignment lcl_getLabelAlignmentForYAxis( const AxisProperties& rAxisPropert
 LabelAlignment lcl_getLabelAlignmentForXAxis( const AxisProperties& rAxisProperties )
 {
     LabelAlignment aRet( LABEL_ALIGN_BOTTOM );
-    if (rAxisProperties.maLabelAlignment.mfLabelDirection < 0)
+    if( rAxisProperties.m_fLabelDirectionSign<0 )
         aRet = LABEL_ALIGN_TOP;
     return aRet;
 }
@@ -291,35 +291,35 @@ void AxisProperties::init( bool bCartesian )
             m_bComplexCategories = true;
 
         if( ::com::sun::star::chart::ChartAxisPosition_END == m_eCrossoverType )
-            maLabelAlignment.mfInnerTickDirection = m_bCrossingAxisHasReverseDirection ? 1.0 : -1.0;
+            m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
         else
-            maLabelAlignment.mfInnerTickDirection = m_bCrossingAxisHasReverseDirection ? -1.0 : 1.0;
+            m_fInnerDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
 
         if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS == m_eLabelPos )
-            maLabelAlignment.mfLabelDirection = maLabelAlignment.mfInnerTickDirection;
+            m_fLabelDirectionSign = m_fInnerDirectionSign;
         else if( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE == m_eLabelPos )
-            maLabelAlignment.mfLabelDirection = -maLabelAlignment.mfInnerTickDirection;
+            m_fLabelDirectionSign = -m_fInnerDirectionSign;
         else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == m_eLabelPos )
-            maLabelAlignment.mfLabelDirection = m_bCrossingAxisHasReverseDirection ? -1 : 1;
+            m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? -1 : 1;
         else if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == m_eLabelPos )
-            maLabelAlignment.mfLabelDirection = m_bCrossingAxisHasReverseDirection ? 1 : -1;
+            m_fLabelDirectionSign = m_bCrossingAxisHasReverseDirection ? 1 : -1;
 
         if( m_nDimensionIndex==2 )
-            maLabelAlignment.meAlignment = lcl_getLabelAlignmentForZAxis(*this);
+            m_aLabelAlignment = lcl_getLabelAlignmentForZAxis(*this);
         else
         {
             bool bIsYAxisPosition = (m_nDimensionIndex==1 && !m_bSwapXAndY)
                 || (m_nDimensionIndex==0 && m_bSwapXAndY);
             if( bIsYAxisPosition )
             {
-                maLabelAlignment.mfLabelDirection *= -1.0;
-                maLabelAlignment.mfInnerTickDirection *= -1.0;
+                m_fLabelDirectionSign*=-1;
+                m_fInnerDirectionSign*=-1;
             }
 
             if( bIsYAxisPosition )
-                maLabelAlignment.meAlignment = lcl_getLabelAlignmentForYAxis(*this);
+                m_aLabelAlignment = lcl_getLabelAlignmentForYAxis(*this);
             else
-                maLabelAlignment.meAlignment = lcl_getLabelAlignmentForXAxis(*this);
+                m_aLabelAlignment = lcl_getLabelAlignmentForXAxis(*this);
         }
     }
 
diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx
index 7495c21..b43f97b 100644
--- a/chart2/source/view/axes/VAxisProperties.hxx
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -84,16 +84,6 @@ struct AxisLabelProperties SAL_FINAL
     bool getIsStaggered() const;
 };
 
-struct AxisLabelAlignment
-{
-    double mfLabelDirection; /// which direction the labels are to be drawn.
-    double mfInnerTickDirection; /// which direction the inner tickmarks are to be drawn.
-
-    LabelAlignment meAlignment;
-
-    AxisLabelAlignment();
-};
-
 struct AxisProperties SAL_FINAL
 {
     css::uno::Reference<css::chart2::XAxis> m_xAxisModel;
@@ -112,8 +102,11 @@ struct AxisProperties SAL_FINAL
     bool        m_bCrossingAxisHasReverseDirection;
     bool        m_bCrossingAxisIsCategoryAxes;
 
-    AxisLabelAlignment maLabelAlignment;
-
+    //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;
+    LabelAlignment  m_aLabelAlignment;
     bool            m_bDisplayLabels;
 
     sal_Int32       m_nNumberFormatKey;
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index d28c031..827973e 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -98,7 +98,7 @@ Reference< drawing::XShape > createSingleLabel(
                     ->createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
 
     LabelPositionHelper::correctPositionForRotation( xShape2DText
-        , rAxisProperties.maLabelAlignment.meAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories );
+        , rAxisProperties.m_aLabelAlignment, rAxisLabelProperties.fRotationAngleDegree, rAxisProperties.m_bComplexCategories );
 
     return xShape2DText;
 }
@@ -649,7 +649,7 @@ bool VCartesianAxis::createTextShapes(
         , nLimitedSpaceForText, bLimitedHeight );
     LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
         , m_aAxisLabelProperties.m_aFontReferenceSize );
-    LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, m_aAxisProperties.maLabelAlignment.meAlignment );
+    LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, m_aAxisProperties.m_aLabelAlignment );
 
     uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,"CharColor");
     sal_Int32 nColor = Color( COL_AUTO ).GetColor();
@@ -922,8 +922,7 @@ struct lcl_GreaterYPos : ::std::binary_function< VCartesianAxis::ScreenPosAndLog
     }
 };
 
-void VCartesianAxis::get2DAxisMainLine(
-    B2DVector& rStart, B2DVector& rEnd, AxisLabelAlignment& rAlignment, double fCrossesOtherAxis ) const
+void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, double fCrossesOtherAxis )
 {
     //m_aAxisProperties might get updated and changed here because
     //    the label alignmant and inner direction sign depends exactly of the choice of the axis line position which is made here in this method
@@ -1012,23 +1011,23 @@ void VCartesianAxis::get2DAxisMainLine(
 
                 if( fabs(fDeltaY) > fabs(fDeltaX)  )
                 {
-                    rAlignment.meAlignment = LABEL_ALIGN_LEFT;
+                    m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
                     //choose most left positions
                     ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() );
-                    rAlignment.mfLabelDirection = (fDeltaY < 0) ? -1.0 : 1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1;
                 }
                 else
                 {
-                    rAlignment.meAlignment = LABEL_ALIGN_BOTTOM;
+                    m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
                     //choose most bottom positions
                     ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
-                    rAlignment.mfLabelDirection = (fDeltaX < 0) ? -1.0 : 1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
                 }
                 ScreenPosAndLogicPos aBestPos( aPosList[0] );
                 fYStart = fYEnd = aBestPos.fLogicY;
                 fZStart = fZEnd = aBestPos.fLogicZ;
                 if( !m_pPosHelper->isMathematicalOrientationX() )
-                    rAlignment.mfLabelDirection *= -1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign *= -1;
             }
         }//end 3D x axis
     }
@@ -1066,23 +1065,23 @@ void VCartesianAxis::get2DAxisMainLine(
 
                 if( fabs(fDeltaY) > fabs(fDeltaX)  )
                 {
-                    rAlignment.meAlignment = LABEL_ALIGN_LEFT;
+                    m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
                     //choose most left positions
                     ::std::sort( aPosList.begin(), aPosList.end(), lcl_LessXPos() );
-                    rAlignment.mfLabelDirection = (fDeltaY < 0) ? -1.0 : 1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign = fDeltaY<0 ? -1 : 1;
                 }
                 else
                 {
-                    rAlignment.meAlignment = LABEL_ALIGN_BOTTOM;
+                    m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
                     //choose most bottom positions
                     ::std::sort( aPosList.begin(), aPosList.end(), lcl_GreaterYPos() );
-                    rAlignment.mfLabelDirection = (fDeltaX < 0) ? -1.0 : 1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
                 }
                 ScreenPosAndLogicPos aBestPos( aPosList[0] );
                 fXStart = fXEnd = aBestPos.fLogicX;
                 fZStart = fZEnd = aBestPos.fLogicZ;
                 if( !m_pPosHelper->isMathematicalOrientationY() )
-                    rAlignment.mfLabelDirection *= -1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign *= -1;
             }
         }//end 3D y axis
     }
@@ -1151,21 +1150,21 @@ void VCartesianAxis::get2DAxisMainLine(
                 if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefer left-right alignments
                 {
                     if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() )
-                        rAlignment.meAlignment = LABEL_ALIGN_RIGHT;
+                        m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_RIGHT;
                     else
-                         rAlignment.meAlignment = LABEL_ALIGN_LEFT;
+                         m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_LEFT;
                 }
                 else
                 {
                     if( aBestPos.aScreenPos.getY() > aNotSoGoodPos.aScreenPos.getY() )
-                        rAlignment.meAlignment = LABEL_ALIGN_BOTTOM;
+                        m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_BOTTOM;
                     else
-                        rAlignment.meAlignment = LABEL_ALIGN_TOP;
+                         m_aAxisProperties.m_aLabelAlignment = LABEL_ALIGN_TOP;
                 }
 
-                rAlignment.mfLabelDirection = (fDeltaX < 0) ? -1.0 : 1.0;
+                m_aAxisProperties.m_fLabelDirectionSign = fDeltaX<0 ? -1 : 1;
                 if( !m_pPosHelper->isMathematicalOrientationZ() )
-                    rAlignment.mfLabelDirection *= -1.0;
+                    m_aAxisProperties.m_fLabelDirectionSign *= -1;
 
                 fXStart = fXEnd = aBestPos.fLogicX;
                 fYStart = fYEnd = aBestPos.fLogicY;
@@ -1177,7 +1176,7 @@ void VCartesianAxis::get2DAxisMainLine(
     rEnd = getScreenPosition( fXEnd, fYEnd, fZEnd );
 
     if(3==m_nDimension && !AxisHelper::isAxisPositioningEnabled() )
-        rAlignment.mfInnerTickDirection = rAlignment.mfLabelDirection;//to behave like before
+        m_aAxisProperties.m_fInnerDirectionSign = m_aAxisProperties.m_fLabelDirectionSign;//to behave like before
 
     if(3==m_nDimension && AxisHelper::isAxisPositioningEnabled() )
     {
@@ -1188,54 +1187,54 @@ void VCartesianAxis::get2DAxisMainLine(
         {
             if( m_eLeftWallPos != CuboidPlanePosition_Left )
             {
-                rAlignment.mfLabelDirection *= -1.0;
-                rAlignment.mfInnerTickDirection *= -1.0;
+                m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+                m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
             }
 
-            rAlignment.meAlignment =
-                (rAlignment.mfLabelDirection < 0) ?
+            m_aAxisProperties.m_aLabelAlignment =
+                ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
                     LABEL_ALIGN_LEFT :  LABEL_ALIGN_RIGHT;
 
             if( ( fDeltaY<0 && m_aScale.Orientation == chart2::AxisOrientation_REVERSE ) ||
                 ( fDeltaY>0 && m_aScale.Orientation == chart2::AxisOrientation_MATHEMATICAL ) )
-                rAlignment.meAlignment =
-                    (rAlignment.meAlignment == LABEL_ALIGN_RIGHT) ?
-                        LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+                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 )
             {
-                rAlignment.mfLabelDirection *= -1.0;
-                rAlignment.mfInnerTickDirection *= -1.0;
+                m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+                m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
             }
 
-            rAlignment.meAlignment =
-                (rAlignment.mfLabelDirection < 0) ?
-                    LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT;
+            m_aAxisProperties.m_aLabelAlignment =
+                ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
+                    LABEL_ALIGN_LEFT :  LABEL_ALIGN_RIGHT;
 
             if( ( fDeltaY<0 && m_aScale.Orientation == chart2::AxisOrientation_REVERSE ) ||
                 ( fDeltaY>0 && m_aScale.Orientation == chart2::AxisOrientation_MATHEMATICAL ) )
-                rAlignment.meAlignment =
-                    (rAlignment.meAlignment == LABEL_ALIGN_RIGHT) ?
+                m_aAxisProperties.m_aLabelAlignment =
+                    ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_RIGHT ) ?
                         LABEL_ALIGN_LEFT :  LABEL_ALIGN_RIGHT;
         }
         else
         {
             if( m_eBackWallPos != CuboidPlanePosition_Back )
             {
-                rAlignment.mfLabelDirection *= -1.0;
-                rAlignment.mfInnerTickDirection *= -1.0;
+                m_aAxisProperties.m_fLabelDirectionSign *= -1.0;
+                m_aAxisProperties.m_fInnerDirectionSign *= -1.0;
             }
 
-            rAlignment.meAlignment =
-                (rAlignment.mfLabelDirection < 0) ?
+            m_aAxisProperties.m_aLabelAlignment =
+                ( m_aAxisProperties.m_fLabelDirectionSign<0 ) ?
                     LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
 
             if( ( fDeltaX>0 && m_aScale.Orientation == chart2::AxisOrientation_REVERSE ) ||
                 ( fDeltaX<0 && m_aScale.Orientation == chart2::AxisOrientation_MATHEMATICAL ) )
-                rAlignment.meAlignment =
-                    (rAlignment.meAlignment == LABEL_ALIGN_TOP) ?
+                m_aAxisProperties.m_aLabelAlignment =
+                    ( m_aAxisProperties.m_aLabelAlignment==LABEL_ALIGN_TOP ) ?
                         LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP;
         }
     }
@@ -1248,14 +1247,11 @@ TickFactory* VCartesianAxis::createTickFactory()
 
 TickFactory2D* VCartesianAxis::createTickFactory2D()
 {
-    AxisLabelAlignment aLabelAlign;
     B2DVector aStart, aEnd;
-    get2DAxisMainLine(aStart, aEnd, aLabelAlign, getAxisIntersectionValue());
-    m_aAxisProperties.maLabelAlignment = aLabelAlign;
+    get2DAxisMainLine( aStart, aEnd, getAxisIntersectionValue() );
 
     B2DVector aLabelLineStart, aLabelLineEnd;
-    get2DAxisMainLine(aLabelLineStart, aLabelLineEnd, aLabelAlign, getLabelLineIntersectionValue());
-    m_aAxisProperties.maLabelAlignment = aLabelAlign;
+    get2DAxisMainLine( aLabelLineStart, aLabelLineEnd, getLabelLineIntersectionValue() );
 
     return new TickFactory2D( m_aScale, m_aIncrement, aStart, aEnd, aLabelLineStart-aStart );
 }
@@ -1301,9 +1297,7 @@ sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount()
         return nRet;
 
     B2DVector aStart, aEnd;
-    AxisLabelAlignment aLabelAlign;
-    get2DAxisMainLine(aStart, aEnd, aLabelAlign, getAxisIntersectionValue());
-    m_aAxisProperties.maLabelAlignment = aLabelAlign;
+    this->get2DAxisMainLine( aStart, aEnd, getAxisIntersectionValue() );
 
     sal_Int32 nMaxHeight = static_cast<sal_Int32>(fabs(aEnd.getY()-aStart.getY()));
     sal_Int32 nMaxWidth = static_cast<sal_Int32>(fabs(aEnd.getX()-aStart.getX()));
@@ -1522,7 +1516,7 @@ void VCartesianAxis::updatePositions()
 
                 //correctPositionForRotation
                 LabelPositionHelper::correctPositionForRotation( xShape2DText
-                    , m_aAxisProperties.maLabelAlignment.meAlignment, fRotationAngleDegree, m_aAxisProperties.m_bComplexCategories );
+                    , m_aAxisProperties.m_aLabelAlignment, fRotationAngleDegree, m_aAxisProperties.m_bComplexCategories );
             }
         }
     }
@@ -1544,7 +1538,7 @@ void VCartesianAxis::createTickMarkLineShapes( TickInfoArrayType& rTickInfos, co
             continue;
 
         bool bTicksAtLabels = ( m_aAxisProperties.m_eTickmarkPos != ::com::sun::star::chart::ChartAxisMarkPosition_AT_AXIS );
-        double fInnerDirectionSign = m_aAxisProperties.maLabelAlignment.mfInnerTickDirection;
+        double fInnerDirectionSign = m_aAxisProperties.m_fInnerDirectionSign;
         if( bTicksAtLabels && m_aAxisProperties.m_eLabelPos == ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END )
             fInnerDirectionSign *= -1.0;
         bTicksAtLabels = bTicksAtLabels || bOnlyAtLabels;
@@ -1554,7 +1548,7 @@ void VCartesianAxis::createTickMarkLineShapes( TickInfoArrayType& rTickInfos, co
         //add ticks at axis (without lables):
         if( !bOnlyAtLabels && m_aAxisProperties.m_eTickmarkPos == ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
             rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
-                , m_aAxisProperties.maLabelAlignment.mfInnerTickDirection, rTickmarkProperties, !bTicksAtLabels );
+                , m_aAxisProperties.m_fInnerDirectionSign, rTickmarkProperties, !bTicksAtLabels );
     }
     aPoints.realloc(nN);
     m_pShapeFactory->createLine2D( m_xGroupShape_Shapes, aPoints
@@ -1647,9 +1641,7 @@ void VCartesianAxis::createShapes()
             if (!rtl::math::isNan(fExtraLineCrossesOtherAxis))
             {
                 B2DVector aStart, aEnd;
-                AxisLabelAlignment aLabelAlign;
-                get2DAxisMainLine(aStart, aEnd, aLabelAlign, fExtraLineCrossesOtherAxis);
-                m_aAxisProperties.maLabelAlignment = aLabelAlign;
+                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 e3f26a8..0bbeb43 100644
--- a/chart2/source/view/axes/VCartesianAxis.hxx
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -71,9 +71,7 @@ public:
      */
     double getExtraLineIntersectionValue() const;
 
-    void get2DAxisMainLine(
-        basegfx::B2DVector& rStart, basegfx::B2DVector& rEnd, AxisLabelAlignment& rLabelAlignment,
-        double fCrossesOtherAxis ) const;
+    void        get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis );
 
     //Layout interface for cartesian axes:
 
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx
index f5d9992..6db58e8 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.cxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx
@@ -35,10 +35,10 @@ VPolarRadiusAxis::VPolarRadiusAxis( const AxisProperties& rAxisProperties
             , sal_Int32 nDimensionCount )
             : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount )
 {
-    m_aAxisProperties.maLabelAlignment.mfLabelDirection = 0.0;
-    m_aAxisProperties.maLabelAlignment.mfInnerTickDirection = 0.0;
-    m_aAxisProperties.maLabelAlignment.meAlignment = LABEL_ALIGN_RIGHT;
+    m_aAxisProperties.m_fLabelDirectionSign=0.0;
+    m_aAxisProperties.m_fInnerDirectionSign=0.0;
     m_aAxisProperties.m_bIsMainAxis=false;
+    m_aAxisProperties.m_aLabelAlignment=LABEL_ALIGN_RIGHT;
     m_aAxisProperties.init();
 
     m_apAxisWithLabels.reset( new VCartesianAxis(
commit 2cd1128555cec70b6ba3d977f6a156b2be1659ad
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Oct 14 10:36:45 2014 +0200

    fixes and tests for o3tl::typed_flags
    
    create test suite for typed_flags template.
    fix the operator&= and operator|= definitions
    
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
    Conflicts:
    	include/o3tl/typed_flags_set.hxx
    
    Change-Id: I1df9ae197889af98a2fd76ff2bc07756c7b14ced

diff --git a/include/o3tl/typed_flags_set.hxx b/include/o3tl/typed_flags_set.hxx
index b9b40d8..1aac625 100644
--- a/include/o3tl/typed_flags_set.hxx
+++ b/include/o3tl/typed_flags_set.hxx
@@ -177,7 +177,7 @@ inline typename o3tl::typed_flags<E>::Self operator |(
 }
 
 template<typename E>
-inline typename o3tl::typed_flags<E>::Self operator &=(E & lhs, E rhs) {
+inline E operator &=(E & lhs, E rhs) {
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs) >= 0);
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs) >= 0);
     lhs = lhs & rhs;
@@ -185,16 +185,14 @@ inline typename o3tl::typed_flags<E>::Self operator &=(E & lhs, E rhs) {
 }
 
 template<typename E>
-inline typename o3tl::typed_flags<E>::Self operator &=(
-    E & lhs, typename o3tl::typed_flags<E>::Self rhs)
-{
+inline E operator &=(E & lhs, typename o3tl::typed_flags<E>::Self rhs) {
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs) >= 0);
     lhs = lhs & rhs;
     return lhs;
 }
 
 template<typename E>
-inline typename o3tl::typed_flags<E>::Self operator |=(E & lhs, E rhs) {
+inline E operator |=(E & lhs, E rhs) {
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs) >= 0);
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(rhs) >= 0);
     lhs = lhs | rhs;
@@ -202,9 +200,7 @@ inline typename o3tl::typed_flags<E>::Self operator |=(E & lhs, E rhs) {
 }
 
 template<typename E>
-inline typename o3tl::typed_flags<E>::Self operator |=(
-    E & lhs, typename o3tl::typed_flags<E>::Self rhs)
-{
+inline E operator |=(E & lhs, typename o3tl::typed_flags<E>::Self rhs) {
     assert(static_cast<O3TL_STD_UNDERLYING_TYPE_E>(lhs) >= 0);
     lhs = lhs | rhs;
     return lhs;
diff --git a/o3tl/CppunitTest_o3tl_tests.mk b/o3tl/CppunitTest_o3tl_tests.mk
index a4d6d71..66f2951 100644
--- a/o3tl/CppunitTest_o3tl_tests.mk
+++ b/o3tl/CppunitTest_o3tl_tests.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,o3tl_tests,\
 	o3tl/qa/test-range \
 	o3tl/qa/test-vector_pool \
 	o3tl/qa/test-sorted_vector \
+	o3tl/qa/test-typed_flags \
 ))
 
 # vim: set noet sw=4:
diff --git a/o3tl/qa/test-typed_flags.cxx b/o3tl/qa/test-typed_flags.cxx
new file mode 100644
index 0000000..de6e080
--- /dev/null
+++ b/o3tl/qa/test-typed_flags.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+
+#include <o3tl/typed_flags_set.hxx>
+
+using namespace ::o3tl;
+
+
+enum class ConfigurationChangedHint { NONE, ONE, TWO };
+
+namespace o3tl
+{
+    template<> struct typed_flags< ConfigurationChangedHint> : is_typed_flags< ConfigurationChangedHint, 0xFF> {};
+}
+
+class typed_flags_test : public CppUnit::TestFixture
+{
+public:
+    void testBasics()
+    {
+        ConfigurationChangedHint nHint = ConfigurationChangedHint::ONE;
+
+        CPPUNIT_ASSERT( ConfigurationChangedHint::ONE & ConfigurationChangedHint::ONE );
+        CPPUNIT_ASSERT( nHint & ConfigurationChangedHint::ONE );
+        CPPUNIT_ASSERT( ConfigurationChangedHint::ONE & nHint );
+
+        CPPUNIT_ASSERT( ConfigurationChangedHint::ONE | ConfigurationChangedHint::ONE );
+        CPPUNIT_ASSERT( nHint | ConfigurationChangedHint::ONE );
+        CPPUNIT_ASSERT( ConfigurationChangedHint::ONE | nHint );
+
+        CPPUNIT_ASSERT( ~nHint );
+        CPPUNIT_ASSERT( ~ConfigurationChangedHint::ONE );
+
+        nHint |= ConfigurationChangedHint::ONE;
+        CPPUNIT_ASSERT( nHint |= ConfigurationChangedHint::ONE );
+
+        nHint &= ConfigurationChangedHint::ONE;
+        CPPUNIT_ASSERT( nHint &= ConfigurationChangedHint::ONE );
+    }
+
+    // Change the following lines only, if you add, remove or rename
+    // member functions of the current class,
+    // because these macros are need by auto register mechanism.
+
+    CPPUNIT_TEST_SUITE(typed_flags_test);
+    CPPUNIT_TEST(testBasics);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION(typed_flags_test);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a1a83ceb8bd2723be49f8282e887da24f4a421f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 14 10:05:48 2014 +0200

    Remove commented out code
    
    Change-Id: I1ebcffc9f1b77b9491335c13ca99090385882ec3

diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 221635f..47f3c09 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -50,8 +50,6 @@ enum class PushFlags {
     TEXTLANGUAGE    = 0x1000,
     OVERLINECOLOR   = 0x2000,
     ALL             = 0xFFFF
-
-    //bool operator bool() { return static_cast<sal_uInt16>(*this) != 0; }
 };
 
 namespace o3tl
commit 2e57092d6f6c6b048d7e4bbb36eaa3e6b7cd78a6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 14 10:05:29 2014 +0200

    No apparent reason to fix underlying type of PushFlags
    
    Change-Id: I7d578b135c7a1e681a70484bba30ff1e8b33e04d

diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index ed84aa0..221635f 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -33,7 +33,7 @@
 #include <o3tl/typed_flags_set.hxx>
 
 // Flags for OutputDevice::Push() and OutDevState
-enum class PushFlags : sal_uInt16 {
+enum class PushFlags {
     NONE            = 0x0000,
     LINECOLOR       = 0x0001,
     FILLCOLOR       = 0x0002,


More information about the Libreoffice-commits mailing list