[Libreoffice-commits] core.git: include/postmac.h include/premac.h include/tools include/vcl sw/source tools/source vcl/source

Norbert Thiebaud nthiebaud at gmail.com
Sun Aug 16 23:30:23 PDT 2015


 include/postmac.h                 |    1 -
 include/premac.h                  |    1 -
 include/tools/line.hxx            |    9 +++++++--
 include/vcl/outdev.hxx            |    6 ++++--
 sw/source/core/layout/trvlfrm.cxx |    2 +-
 tools/source/generic/line.cxx     |    7 ++++++-
 vcl/source/outdev/hatch.cxx       |   14 +++++++-------
 7 files changed, 25 insertions(+), 15 deletions(-)

New commits:
commit 5109114856898a67f0538a2c04a73d41b0f2fc78
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sun Aug 16 23:36:06 2015 -0500

    Put Line under tools namespace
    
    Change-Id: I7442848951c0d4579fb2a2a3eef3bfed7135aac4
    Reviewed-on: https://gerrit.libreoffice.org/17791
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/include/postmac.h b/include/postmac.h
index 0b846a9..5e1342d 100644
--- a/include/postmac.h
+++ b/include/postmac.h
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#undef Line
 #undef Point
 #undef Size
 #undef TimeValue
diff --git a/include/premac.h b/include/premac.h
index 8bcf683..6b5a3c9 100644
--- a/include/premac.h
+++ b/include/premac.h
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#define Line MacOSLine
 #define Point MacOSPoint
 #define Size MacOSSize
 #define TimeValue MacOSTimeValue
diff --git a/include/tools/line.hxx b/include/tools/line.hxx
index 7508a8f..8a0486a 100644
--- a/include/tools/line.hxx
+++ b/include/tools/line.hxx
@@ -22,6 +22,9 @@
 #include <tools/toolsdllapi.h>
 #include <tools/gen.hxx>
 
+namespace tools
+{
+
 class TOOLS_DLLPUBLIC Line
 {
 private:
@@ -40,13 +43,15 @@ public:
 
     double          GetLength() const;
 
-    bool            Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const;
-    bool            Intersection( const Line& rLine, Point& rIntersection ) const;
+    bool            Intersection( const tools::Line& rLine, double& rIntersectionX, double& rIntersectionY ) const;
+    bool            Intersection( const tools::Line& rLine, Point& rIntersection ) const;
 
     double          GetDistance( const double& rPtX, const double& rPtY ) const;
     double          GetDistance( const Point& rPoint ) const { return( GetDistance( rPoint.X(), rPoint.Y() ) ); }
 };
 
+} // namespace tools
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 339c10a..b116956 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -80,7 +80,9 @@ class TextRectInfo;
 class FontMetric;
 class GDIMetaFile;
 class GfxLink;
-class Line;
+namespace tools {
+    class Line;
+}
 class LineInfo;
 class AlphaMask;
 class FontCharMap;
@@ -972,7 +974,7 @@ public:
 private:
 
     SAL_DLLPRIVATE void         CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt16 nAngle10, Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 );
-    SAL_DLLPRIVATE void         DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
+    SAL_DLLPRIVATE void         DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly, Point* pPtBuffer, bool bMtf );
     ///@}
 
 
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 04f46ae..4254ec2 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -93,7 +93,7 @@ namespace {
         // Otherwise, compute the distance to the center of the rectangle.
         if ( !rRect.IsInside( rPoint ) )
         {
-            Line aLine( rPoint, rRect.Center( ) );
+            tools::Line aLine( rPoint, rRect.Center( ) );
             nDist = aLine.GetLength( );
         }
 
diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx
index f84003c..597b783 100644
--- a/tools/source/generic/line.cxx
+++ b/tools/source/generic/line.cxx
@@ -24,6 +24,9 @@
 #include <cstdlib>
 #include <math.h>
 
+namespace tools
+{
+
 double Line::GetLength() const
 {
     return hypot( maStart.X() - maEnd.X(), maStart.Y() - maEnd.Y() );
@@ -46,7 +49,7 @@ bool Line::Intersection( const Line& rLine, Point& rIntersection ) const
     return bRet;
 }
 
-bool Line::Intersection( const Line& rLine, double& rIntersectionX, double& rIntersectionY ) const
+bool Line::Intersection( const tools::Line& rLine, double& rIntersectionX, double& rIntersectionY ) const
 {
     const double    fAx = maEnd.X() - maStart.X();
     const double    fAy = maEnd.Y() - maStart.Y();
@@ -134,4 +137,6 @@ double Line::GetDistance( const double& rPtX, const double& rPtY ) const
     return fDist;
 }
 
+} //namespace tools
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 076ff8b..484ba61 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -178,7 +178,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
             CalcHatchValues( aRect, nWidth, rHatch.GetAngle(), aPt1, aPt2, aInc, aEndPt1 );
             do
             {
-                DrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
+                DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
                 aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
                 aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
             }
@@ -190,7 +190,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
                 CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
                 do
                 {
-                    DrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
+                    DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
                     aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
                     aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
                 }
@@ -202,7 +202,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
                     CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
                     do
                     {
-                        DrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
+                        DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
                         aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
                         aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
                     }
@@ -321,7 +321,7 @@ void OutputDevice::CalcHatchValues( const Rectangle& rRect, long nDist, sal_uInt
     }
 }
 
-void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& rPolyPoly,
+void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPolygon& rPolyPoly,
                                       Point* pPtBuffer, bool bMtf )
 {
     assert(!is_double_buffered_window());
@@ -335,7 +335,7 @@ void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& r
 
         if( rPoly.GetSize() > 1 )
         {
-            Line    aCurSegment( rPoly[ 0 ], Point() );
+            tools::Line aCurSegment( rPoly[ 0 ], Point() );
 
             for( long i = 1, nCount = rPoly.GetSize(); i <= nCount; i++ )
             {
@@ -347,7 +347,7 @@ void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& r
                     if( ( fabs( fX - aCurSegment.GetStart().X() ) <= 0.0000001 ) &&
                         ( fabs( fY - aCurSegment.GetStart().Y() ) <= 0.0000001 ) )
                     {
-                        const Line      aPrevSegment( rPoly[ (sal_uInt16)( ( i > 1 ) ? ( i - 2 ) : ( nCount - 1 ) ) ], aCurSegment.GetStart() );
+                        const tools::Line aPrevSegment( rPoly[ (sal_uInt16)( ( i > 1 ) ? ( i - 2 ) : ( nCount - 1 ) ) ], aCurSegment.GetStart() );
                         const double    fPrevDistance = rLine.GetDistance( aPrevSegment.GetStart() );
                         const double    fCurDistance = rLine.GetDistance( aCurSegment.GetEnd() );
 
@@ -360,7 +360,7 @@ void OutputDevice::DrawHatchLine( const Line& rLine, const tools::PolyPolygon& r
                     else if( ( fabs( fX - aCurSegment.GetEnd().X() ) <= 0.0000001 ) &&
                              ( fabs( fY - aCurSegment.GetEnd().Y() ) <= 0.0000001 ) )
                     {
-                        const Line aNextSegment( aCurSegment.GetEnd(), rPoly[ (sal_uInt16)( ( i + 1 ) % nCount ) ] );
+                        const tools::Line aNextSegment( aCurSegment.GetEnd(), rPoly[ (sal_uInt16)( ( i + 1 ) % nCount ) ] );
 
                         if( ( fabs( rLine.GetDistance( aNextSegment.GetEnd() ) ) <= 0.0000001 ) &&
                             ( rLine.GetDistance( aCurSegment.GetStart() ) > 0.0 ) )


More information about the Libreoffice-commits mailing list