incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1232507 [3/3] - in /incubator/ooo/trunk: ./ main/basegfx/inc/basegfx/polygon/ main/basegfx/source/polygon/ main/canvas/source/vcl/ main/cppcanvas/source/mtfrenderer/ main/cui/source/inc/ main/cui/source/tabpages/ main/drawinglayer/inc/draw...
Date Tue, 17 Jan 2012 17:54:06 GMT
Modified: incubator/ooo/trunk/main/vcl/source/gdi/lineinfo.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/lineinfo.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/lineinfo.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/lineinfo.cxx Tue Jan 17 17:54:04 2012
@@ -47,7 +47,8 @@ ImplLineInfo::ImplLineInfo() :
 	mnDotCount	( 0 ),
 	mnDotLen	( 0 ),
 	mnDistance	( 0 ),
-    meLineJoin  ( basegfx::B2DLINEJOIN_ROUND )
+    meLineJoin  ( basegfx::B2DLINEJOIN_ROUND ),
+    meLineCap   ( com::sun::star::drawing::LineCap_BUTT )
 {
 }
 
@@ -62,7 +63,8 @@ ImplLineInfo::ImplLineInfo( const ImplLi
 	mnDotCount	( rImplLineInfo.mnDotCount ),
 	mnDotLen	( rImplLineInfo.mnDotLen ),
 	mnDistance	( rImplLineInfo.mnDistance ),
-    meLineJoin  ( rImplLineInfo.meLineJoin )
+    meLineJoin  ( rImplLineInfo.meLineJoin ),
+    meLineCap   ( rImplLineInfo.meLineCap )
 {
 }
 
@@ -77,7 +79,8 @@ inline bool ImplLineInfo::operator==( co
 		&& mnDotCount == rB.mnDotCount
 		&& mnDotLen == rB.mnDotLen
 		&& mnDistance == rB.mnDistance
-		&& meLineJoin == rB.meLineJoin);
+		&& meLineJoin == rB.meLineJoin
+        && meLineCap == rB.meLineCap);
 }
 
 // ------------
@@ -229,6 +232,28 @@ void LineInfo::SetLineJoin(basegfx::B2DL
 
 // -----------------------------------------------------------------------
 
+void LineInfo::SetLineCap(com::sun::star::drawing::LineCap eLineCap)
+{
+    DBG_CHKTHIS( LineInfo, NULL );
+
+    if(eLineCap != mpImplLineInfo->meLineCap)
+    {
+        ImplMakeUnique();
+        mpImplLineInfo->meLineCap = eLineCap;
+    }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool LineInfo::IsDefault() const 
+{ 
+    return( !mpImplLineInfo->mnWidth 
+        && ( LINE_SOLID == mpImplLineInfo->meStyle ) 
+        && ( com::sun::star::drawing::LineCap_BUTT == mpImplLineInfo->meLineCap));

+}
+
+// -----------------------------------------------------------------------
+
 SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
 {
     VersionCompat	aCompat( rIStm, STREAM_READ );
@@ -251,6 +276,12 @@ SvStream& operator>>( SvStream& rIStm, I
         rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16;
     }
 
+    if( aCompat.GetVersion() >= 4 )
+    {
+        // version 4
+        rIStm >> nTmp16; rImplLineInfo.meLineCap = (com::sun::star::drawing::LineCap)
nTmp16;
+    }
+
     return rIStm;
 }
 
@@ -258,7 +289,7 @@ SvStream& operator>>( SvStream& rIStm, I
 
 SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo
)
 {
-    VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
+    VersionCompat aCompat( rOStm, STREAM_WRITE, 4 );
 
     // version 1
 	rOStm << (sal_uInt16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
@@ -271,6 +302,9 @@ SvStream& operator<<( SvStream& rOStm, c
 	// since version3
 	rOStm << (sal_uInt16) rImplLineInfo.meLineJoin;
 
+    // since version4
+    rOStm << (sal_uInt16) rImplLineInfo.meLineCap;
+
     return rOStm;
 }
 
@@ -354,7 +388,8 @@ void LineInfo::applyToB2DPolyPolygon(
 				o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
 					io_rLinePolyPolygon.getB2DPolygon(a), 
 					fHalfLineWidth, 
-					GetLineJoin()));
+					GetLineJoin(),
+                    GetLineCap()));
 			}
 	        
 			io_rLinePolyPolygon.clear();

Modified: incubator/ooo/trunk/main/vcl/source/gdi/outdev.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/outdev.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/outdev.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/outdev.cxx Tue Jan 17 17:54:04 2012
@@ -1509,7 +1509,7 @@ void OutputDevice::DrawLine( const Point
             aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
         }
 
-		if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE,
this))
+		if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE,
com::sun::star::drawing::LineCap_BUTT, this))
 		{
 			return;
 		}
@@ -1596,7 +1596,8 @@ void OutputDevice::impPaintLineGeometryW
 	        aFillPolyPolygon.append(basegfx::tools::createAreaGeometry(
                 aLinePolyPolygon.getB2DPolygon(a), 
                 fHalfLineWidth, 
-                rInfo.GetLineJoin()));
+                rInfo.GetLineJoin(),
+                rInfo.GetLineCap()));
         }
         
         aLinePolyPolygon.clear();
@@ -1614,7 +1615,7 @@ void OutputDevice::impPaintLineGeometryW
 
             if(bTryAA)
             {
-                bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0),
basegfx::B2DLINEJOIN_NONE, this);
+                bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0),
basegfx::B2DLINEJOIN_NONE, com::sun::star::drawing::LineCap_BUTT, this);
             }
 
             if(!bDone)
@@ -1646,7 +1647,10 @@ void OutputDevice::impPaintLineGeometryW
         {
             for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
             {
-                const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+                Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+
+                // need to subdivide, mpGraphics->DrawPolygon ignores curves
+                aPolygon.AdaptiveSubdivide(aPolygon);
 			    mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(),
this);
             }
         }
@@ -1789,7 +1793,7 @@ void OutputDevice::DrawPolyLine( const P
         && IsLineColor());
 
 	// use b2dpolygon drawing if possible
-	if(bTryAA && ImpTryDrawPolyLineDirect(rPoly.getB2DPolygon(), 0.0, basegfx::B2DLINEJOIN_NONE))
+	if(bTryAA && ImpTryDrawPolyLineDirect(rPoly.getB2DPolygon()))
 	{
 		basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
 		const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
@@ -1803,7 +1807,7 @@ void OutputDevice::DrawPolyLine( const P
             aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
         }
 
-		if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE,
this))
+		if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE,
com::sun::star::drawing::LineCap_BUTT, this))
 		{
 			return;
 		}
@@ -1851,7 +1855,7 @@ void OutputDevice::DrawPolyLine( const P
     if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) 
         && LINE_SOLID == rLineInfo.GetStyle())
     {
-		DrawPolyLine( rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin());
+		DrawPolyLine( rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin(),
rLineInfo.GetLineCap());
 		return;
     }
 
@@ -1983,7 +1987,13 @@ void OutputDevice::DrawPolygon( const Po
 				aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon);
 			}
 
-			bSuccess = mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE,
this);
+			bSuccess = mpGraphics->DrawPolyLine( 
+                aB2DPolygon, 
+                0.0, 
+                aB2DLineWidth, 
+                basegfx::B2DLINEJOIN_NONE, 
+                com::sun::star::drawing::LineCap_BUTT,
+                this);
 		}
 
 		if(bSuccess)
@@ -2075,7 +2085,13 @@ void OutputDevice::DrawPolyPolygon( cons
 
 			for(sal_uInt32 a(0); bSuccess && a < aB2DPolyPolygon.count(); a++)
 			{
-				bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth,
basegfx::B2DLINEJOIN_NONE, this);
+				bSuccess = mpGraphics->DrawPolyLine( 
+                    aB2DPolyPolygon.getB2DPolygon(a), 
+                    0.0, 
+                    aB2DLineWidth, 
+                    basegfx::B2DLINEJOIN_NONE, 
+                    com::sun::star::drawing::LineCap_BUTT,
+                    this);
 			}
 		}
 
@@ -2198,7 +2214,13 @@ void OutputDevice::ImpDrawPolyPolygonWit
 
 			for(sal_uInt32 a(0);bSuccess && a < aB2DPolyPolygon.count(); a++)
 			{
-				bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth,
basegfx::B2DLINEJOIN_NONE, this);
+				bSuccess = mpGraphics->DrawPolyLine( 
+                    aB2DPolyPolygon.getB2DPolygon(a), 
+                    0.0, 
+                    aB2DLineWidth, 
+                    basegfx::B2DLINEJOIN_NONE, 
+                    com::sun::star::drawing::LineCap_BUTT,
+                    this);
 			}
 		}
 
@@ -2219,7 +2241,8 @@ void OutputDevice::ImpDrawPolyPolygonWit
 bool OutputDevice::ImpTryDrawPolyLineDirect(
 	const basegfx::B2DPolygon& rB2DPolygon,
     double fLineWidth,
-    basegfx::B2DLineJoin eLineJoin)
+    basegfx::B2DLineJoin eLineJoin,
+    com::sun::star::drawing::LineCap eLineCap)
 {
     const basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation();
     basegfx::B2DVector aB2DLineWidth(1.0, 1.0);
@@ -2245,17 +2268,25 @@ bool OutputDevice::ImpTryDrawPolyLineDir
     }
 
     // draw the polyline
-    return mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, eLineJoin, this);
+    return mpGraphics->DrawPolyLine( 
+        aB2DPolygon, 
+        0.0, 
+        aB2DLineWidth, 
+        eLineJoin, 
+        eLineCap,
+        this);
 }
 
 void OutputDevice::DrawPolyLine(
     const basegfx::B2DPolygon& rB2DPolygon,
     double fLineWidth,
-    basegfx::B2DLineJoin eLineJoin)
+    basegfx::B2DLineJoin eLineJoin,
+    com::sun::star::drawing::LineCap eLineCap)
 {
 	DBG_TRACE( "OutputDevice::DrawPolyLine(B2D&)" );
 	DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
     (void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free
+    (void)eLineCap;
 
 #if 0 // MetaB2DPolyLineAction is not implemented yet:
       // according to AW adding it is very dangerous since there is a lot
@@ -2297,7 +2328,7 @@ void OutputDevice::DrawPolyLine(
         && IsLineColor());
 
 	// use b2dpolygon drawing if possible
-	if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin))
+	if(bTryAA && ImpTryDrawPolyLineDirect(rB2DPolygon, fLineWidth, eLineJoin, eLineCap))
 	{
 		return;
 	}
@@ -2311,9 +2342,12 @@ void OutputDevice::DrawPolyLine(
 		&& rB2DPolygon.count() <= 1000)
 	{
 		const double fHalfLineWidth((fLineWidth * 0.5) + 0.5);
-		const basegfx::B2DPolyPolygon aAreaPolyPolygon(basegfx::tools::createAreaGeometry(
-			rB2DPolygon, fHalfLineWidth, eLineJoin));
-
+		const basegfx::B2DPolyPolygon aAreaPolyPolygon(
+            basegfx::tools::createAreaGeometry(
+			    rB2DPolygon, 
+                fHalfLineWidth, 
+                eLineJoin,
+                eLineCap));
 		const Color aOldLineColor(maLineColor);
 		const Color aOldFillColor(maFillColor);
 
@@ -2340,7 +2374,7 @@ void OutputDevice::DrawPolyLine(
 			// to avoid optical gaps
 			for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
 			{
-				ImpTryDrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a), 0.0, basegfx::B2DLINEJOIN_NONE);
+				ImpTryDrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a));
 			}
 		}
 	}

Modified: incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx Tue Jan 17 17:54:04 2012
@@ -200,7 +200,7 @@ void OutputDevice::DrawTransparent( cons
 			for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
 			{
 				const ::basegfx::B2DPolygon aOnePoly = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
-				mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE,
this );
+				mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE,
com::sun::star::drawing::LineCap_BUTT, this );
 			}
 		}
 
@@ -317,7 +317,7 @@ void OutputDevice::DrawTransparent( cons
 			for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
 			{
 				const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx );
-				bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE,
this );
+				bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE,
com::sun::star::drawing::LineCap_BUTT, this );
 			}
 			// prepare to restore the fill color
 			mbInitFillColor = mbFillColor;

Modified: incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl.cxx Tue Jan 17 17:54:04 2012
@@ -1624,7 +1624,28 @@ void PDFWriterImpl::PDFPage::appendMappe
 
 bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffer&
rBuffer ) const
 {
-    bool bRet = true;
+    if(LINE_DASH == rInfo.GetStyle() && rInfo.GetDashLen() != rInfo.GetDotLen())
+    {
+        // dashed and non-degraded case, check for implementation limits of dash array
+        // in PDF reader apps (e.g. acroread)
+        if(2 * (rInfo.GetDashCount() + rInfo.GetDotCount()) > 10)
+        {
+            return false;
+        }
+    }
+
+    if(basegfx::B2DLINEJOIN_NONE != rInfo.GetLineJoin())
+    {
+        // LineJoin used, ExtLineInfo required
+        return false;
+    }
+
+    if(com::sun::star::drawing::LineCap_BUTT != rInfo.GetLineCap())
+    {
+        // LineCap used, ExtLineInfo required
+        return false;
+    }
+
     if( rInfo.GetStyle() == LINE_DASH )
     {
         rBuffer.append( "[ " );
@@ -1637,10 +1658,6 @@ bool PDFWriterImpl::PDFPage::appendLineI
         }
         else
         {
-            // check for implementation limits of dash array
-            // in PDF reader apps (e.g. acroread)
-            if( 2*(rInfo.GetDashCount() + rInfo.GetDotCount()) > 10 )
-                bRet = false;
             for( int n = 0; n < rInfo.GetDashCount(); n++ )
             {
                 appendMappedLength( (sal_Int32)rInfo.GetDashLen(), rBuffer );
@@ -1658,6 +1675,7 @@ bool PDFWriterImpl::PDFPage::appendLineI
         }
         rBuffer.append( "] 0 d\n" );
     }
+
     if( rInfo.GetWidth() > 1 )
     {
         appendMappedLength( (sal_Int32)rInfo.GetWidth(), rBuffer );
@@ -1669,7 +1687,8 @@ bool PDFWriterImpl::PDFPage::appendLineI
         appendDouble( 72.0/double(m_pWriter->getReferenceDevice()->ImplGetDPIX()),
rBuffer );
         rBuffer.append( " w\n" );
     }
-    return bRet;
+
+    return true;
 }
 
 void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal_Int32 nDelta,
OStringBuffer& rBuffer ) const
@@ -9045,21 +9064,68 @@ void PDFWriterImpl::convertLineInfoToExt
     rOut.m_fMiterLimit          = 10;
     rOut.m_aDashArray.clear();
 
-    int nDashes     = rIn.GetDashCount();
-    int nDashLen    = rIn.GetDashLen();
-    int nDistance   = rIn.GetDistance();
+    // add DashDot to DashArray
+    const int nDashes     = rIn.GetDashCount();
+    const int nDashLen    = rIn.GetDashLen();
+    const int nDistance   = rIn.GetDistance();
+
     for( int n  = 0; n < nDashes; n++ )
     {
         rOut.m_aDashArray.push_back( nDashLen );
         rOut.m_aDashArray.push_back( nDistance );
     }
-    int nDots       = rIn.GetDotCount();
-    int nDotLen     = rIn.GetDotLen();
+
+    const int nDots       = rIn.GetDotCount();
+    const int nDotLen     = rIn.GetDotLen();
+
     for( int n  = 0; n < nDots; n++ )
     {
         rOut.m_aDashArray.push_back( nDotLen );
         rOut.m_aDashArray.push_back( nDistance );
     }
+
+    // add LineJoin
+    switch(rIn.GetLineJoin())
+    {
+        case basegfx::B2DLINEJOIN_BEVEL :
+        {
+            rOut.m_eJoin = PDFWriter::joinBevel;
+            break;
+        }
+        default : // basegfx::B2DLINEJOIN_NONE :
+        // Pdf has no 'none' lineJoin, default is miter
+        case basegfx::B2DLINEJOIN_MIDDLE :
+        case basegfx::B2DLINEJOIN_MITER :
+        {
+            rOut.m_eJoin = PDFWriter::joinMiter;
+            break;
+        }
+        case basegfx::B2DLINEJOIN_ROUND :
+        {
+            rOut.m_eJoin = PDFWriter::joinRound;
+            break;
+        }
+    }
+
+    // add LineCap
+    switch(rIn.GetLineCap())
+    {
+        default: /* com::sun::star::drawing::LineCap_BUTT */
+        {
+            rOut.m_eCap = PDFWriter::capButt;
+            break;
+        }
+        case com::sun::star::drawing::LineCap_ROUND:
+        {
+            rOut.m_eCap = PDFWriter::capRound;
+            break;
+        }
+        case com::sun::star::drawing::LineCap_SQUARE:
+        {
+            rOut.m_eCap = PDFWriter::capSquare;
+            break;
+        }
+    }
 }
 
 void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLineInfo&
rInfo )

Modified: incubator/ooo/trunk/main/vcl/source/gdi/salgdilayout.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/salgdilayout.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/salgdilayout.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/salgdilayout.cxx Tue Jan 17 17:54:04 2012
@@ -412,7 +412,8 @@ bool SalGraphics::drawPolyLine( 
     const basegfx::B2DPolygon& /*rPolyPolygon*/,
     double /*fTransparency*/,
     const basegfx::B2DVector& /*rLineWidths*/, 
-    basegfx::B2DLineJoin /*eLineJoin*/)
+    basegfx::B2DLineJoin /*eLineJoin*/,
+    com::sun::star::drawing::LineCap /*eLineCap*/)
 {
     return false;
 }
@@ -542,18 +543,22 @@ sal_Bool SalGraphics::DrawPolyPolygonBez
     return bRet;
 }
 
-bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double fTransparency,
-    const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin,
+bool SalGraphics::DrawPolyLine( 
+    const ::basegfx::B2DPolygon& i_rPolygon, 
+    double i_fTransparency,
+    const ::basegfx::B2DVector& i_rLineWidth, 
+    basegfx::B2DLineJoin i_eLineJoin,
+    com::sun::star::drawing::LineCap i_eLineCap,
     const OutputDevice* i_pOutDev )
 {
     bool bRet = false;
 	if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled())
) 
 	{
         basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) );
-        bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin );
+        bRet = drawPolyLine( aMirror, i_fTransparency, i_rLineWidth, i_eLineJoin, i_eLineCap
);
     }
     else
-        bRet = drawPolyLine( i_rPolygon, fTransparency, i_rLineWidth, i_eLineJoin );
+        bRet = drawPolyLine( i_rPolygon, i_fTransparency, i_rLineWidth, i_eLineJoin, i_eLineCap
);
     return bRet;
 }
 

Modified: incubator/ooo/trunk/main/vcl/unx/generic/gdi/pspgraphics.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/generic/gdi/pspgraphics.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/generic/gdi/pspgraphics.cxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/generic/gdi/pspgraphics.cxx Tue Jan 17 17:54:04 2012
@@ -401,7 +401,12 @@ bool PspGraphics::drawPolyPolygon( const
         return false;
 }
 
-bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTranspareny*/,
const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/)
+bool PspGraphics::drawPolyLine( 
+    const basegfx::B2DPolygon&, 
+    double /*fTranspareny*/, 
+    const basegfx::B2DVector& /*rLineWidths*/, 
+    basegfx::B2DLineJoin /*eJoin*/,
+    com::sun::star::drawing::LineCap /*eLineCap*/)
 {
     // TODO: a PS printer can draw B2DPolyLines almost directly
     return false;

Modified: incubator/ooo/trunk/main/vcl/unx/generic/gdi/salgdi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/generic/gdi/salgdi.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/generic/gdi/salgdi.cxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/generic/gdi/salgdi.cxx Tue Jan 17 17:54:04 2012
@@ -1186,7 +1186,12 @@ bool X11SalGraphics::drawFilledTrapezoid
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double fTransparency,
const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
+bool X11SalGraphics::drawPolyLine(
+    const ::basegfx::B2DPolygon& rPolygon, 
+    double fTransparency, 
+    const ::basegfx::B2DVector& rLineWidth, 
+    basegfx::B2DLineJoin eLineJoin,
+    com::sun::star::drawing::LineCap eLineCap)
 {
     const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX()
<= 1.2);
 
@@ -1240,7 +1245,7 @@ bool X11SalGraphics::drawPolyLine(const 
     }
 
     // create the area-polygon for the line
-    const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon,
fHalfWidth, eLineJoin) );
+    const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon,
fHalfWidth, eLineJoin, eLineCap) );
 
     if( (rLineWidth.getX() != rLineWidth.getY())
     && !basegfx::fTools::equalZero( rLineWidth.getX() ) )

Modified: incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.cxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.cxx Tue Jan 17 17:54:04 2012
@@ -372,7 +372,12 @@ void SvpSalGraphics::drawPolyPolygon( sa
     dbgOut( m_aDevice );
 }
 
-bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/,
const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
+bool SvpSalGraphics::drawPolyLine( 
+    const ::basegfx::B2DPolygon&, 
+    double /*fTransparency*/, 
+    const ::basegfx::B2DVector& /*rLineWidths*/, 
+    basegfx::B2DLineJoin /*eJoin*/,
+    com::sun::star::drawing::LineCap /*eLineCap*/)
 {
         // TODO: implement and advertise OutDevSupport_B2DDraw support
         return false;

Modified: incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.hxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.hxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/headless/svpgdi.hxx Tue Jan 17 17:54:04 2012
@@ -115,7 +115,12 @@ public:
     virtual void			drawLine( long nX1, long nY1, long nX2, long nY2 );
     virtual void			drawRect( long nX, long nY, long nWidth, long nHeight );
     virtual bool            drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double
fTransparency );
-    virtual bool            drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency,
const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
+    virtual bool            drawPolyLine( 
+        const ::basegfx::B2DPolygon&, 
+        double fTransparency, 
+        const ::basegfx::B2DVector& rLineWidths, 
+        basegfx::B2DLineJoin,
+        com::sun::star::drawing::LineCap);
     virtual void			drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
     virtual void			drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
     virtual void			drawPolyPolygon( sal_uInt32 nPoly,

Modified: incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.cxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.cxx Tue Jan 17 17:54:04 2012
@@ -320,7 +320,12 @@ void PspGraphics::drawPolyPolygon( sal_u
     m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, (const Point**)pPtAry);
 }
 
-bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/,
const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ )
+bool PspGraphics::drawPolyLine( 
+    const ::basegfx::B2DPolygon&, 
+    double /*fTransparency*/, 
+    const ::basegfx::B2DVector& /*rLineWidths*/, 
+    basegfx::B2DLineJoin /*eJoin*/,
+    com::sun::star::drawing::LineCap /*eLineCap*/)
 {
         // TODO: implement and advertise OutDevSupport_B2DDraw support
         return false;

Modified: incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.hxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.hxx (original)
+++ incubator/ooo/trunk/main/vcl/unx/headless/svppspgraphics.hxx Tue Jan 17 17:54:04 2012
@@ -136,7 +136,12 @@ public:
     virtual void			drawPolyLine( sal_uLong nPoints, const SalPoint* pPtAry );
     virtual void			drawPolygon( sal_uLong nPoints, const SalPoint* pPtAry );
     virtual bool            drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double
fTransparency );
-    virtual bool            drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency,
const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin );
+    virtual bool            drawPolyLine( 
+        const ::basegfx::B2DPolygon&, 
+        double fTransparency, 
+        const ::basegfx::B2DVector& rLineWidths, 
+        basegfx::B2DLineJoin,
+        com::sun::star::drawing::LineCap);
     virtual void			drawPolyPolygon( sal_uInt32 nPoly,
                                              const sal_uInt32* pPoints,
                                              PCONSTSALPOINT* pPtAry );

Modified: incubator/ooo/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx (original)
+++ incubator/ooo/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx Tue Jan 17 17:54:04 2012
@@ -187,7 +187,12 @@ bool WinSalGraphics::drawPolyPolygon( co
  	return true;
 }
 
-bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double fTransparency,
const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin )
+bool WinSalGraphics::drawPolyLine( 
+    const basegfx::B2DPolygon& rPolygon, 
+    double fTransparency, 
+    const basegfx::B2DVector& rLineWidths, 
+    basegfx::B2DLineJoin eLineJoin,
+    com::sun::star::drawing::LineCap eLineCap)
 {
     const sal_uInt32 nCount(rPolygon.count());
 
@@ -230,6 +235,27 @@ bool WinSalGraphics::drawPolyLine( const
 			}
 		}
 
+        switch(eLineCap)
+        {
+            default: /*com::sun::star::drawing::LineCap_BUTT*/
+            {
+                // nothing to do
+                break;
+            }
+            case com::sun::star::drawing::LineCap_ROUND:
+            {
+                aTestPen.SetStartCap(Gdiplus::LineCapRound);
+                aTestPen.SetEndCap(Gdiplus::LineCapRound);
+                break;
+            }
+            case com::sun::star::drawing::LineCap_SQUARE:
+            {
+                aTestPen.SetStartCap(Gdiplus::LineCapSquare);
+                aTestPen.SetEndCap(Gdiplus::LineCapSquare);
+                break;
+            }
+        }
+
 		if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5))
         {
     		impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin);

Modified: incubator/ooo/trunk/main/xmloff/inc/xmloff/xmltoken.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/inc/xmloff/xmltoken.hxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/inc/xmloff/xmltoken.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/inc/xmloff/xmltoken.hxx Tue Jan 17 17:54:04 2012
@@ -340,6 +340,7 @@ namespace xmloff { namespace token {
         XML_BUBBLE,
         XML_BULLET_CHAR,
         XML_BULLET_RELATIVE_SIZE,
+        XML_BUTT,
         XML_BUTTON1,
         XML_BUTTON2,
         XML_BUTTON3,
@@ -1681,6 +1682,7 @@ namespace xmloff { namespace token {
         XML_STROKE,
         XML_STROKE_COLOR,
         XML_STROKE_DASH,
+        XML_STROKE_LINECAP,
         XML_STROKE_LINEJOIN,
         XML_STROKE_OPACITY,
         XML_STROKE_WIDTH,

Modified: incubator/ooo/trunk/main/xmloff/source/core/xmltoken.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/core/xmltoken.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/core/xmltoken.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/core/xmltoken.cxx Tue Jan 17 17:54:04 2012
@@ -348,6 +348,7 @@ namespace xmloff { namespace token {
         TOKEN( "bubble",                          XML_BUBBLE ),
         TOKEN( "bullet-char",                     XML_BULLET_CHAR ),
         TOKEN( "bullet-relative-size",            XML_BULLET_RELATIVE_SIZE ),
+        TOKEN( "butt",                            XML_BUTT ),
         TOKEN( "button1",                         XML_BUTTON1 ),
         TOKEN( "button2",                         XML_BUTTON2 ),
         TOKEN( "button3",                         XML_BUTTON3 ),
@@ -1689,6 +1690,7 @@ namespace xmloff { namespace token {
         TOKEN( "stroke",                          XML_STROKE ),
         TOKEN( "stroke-color",                    XML_STROKE_COLOR ),
         TOKEN( "stroke-dash",                     XML_STROKE_DASH ),
+        TOKEN( "stroke-linecap",                  XML_STROKE_LINECAP ),
         TOKEN( "stroke-linejoin",                 XML_STROKE_LINEJOIN ),
         TOKEN( "stroke-opacity",                  XML_STROKE_OPACITY ),
         TOKEN( "stroke-width",                    XML_STROKE_WIDTH ),

Modified: incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.cxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.cxx Tue Jan 17 17:54:04 2012
@@ -28,6 +28,7 @@
 #include <com/sun/star/container/XIndexReplace.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/presentation/AnimationSpeed.hpp>
 #include <com/sun/star/presentation/FadeEffect.hpp>
@@ -111,6 +112,7 @@ const XMLPropertyMapEntry aXMLSDProperti
 	GMAP( "LineEndCenter",					XML_NAMESPACE_DRAW, XML_MARKER_END_CENTER,		XML_TYPE_BOOL, 0
),
 	GMAP( "LineTransparence",				XML_NAMESPACE_SVG,	XML_STROKE_OPACITY, 		XML_SD_TYPE_OPACITY,
0 ),
 	GMAP( "LineJoint",						XML_NAMESPACE_DRAW,	XML_STROKE_LINEJOIN,		XML_SD_TYPE_LINEJOIN,
0 ),
+    GMAP( "LineCap",                        XML_NAMESPACE_SVG , XML_STROKE_LINECAP,     
   XML_SD_TYPE_LINECAP, 0 ),
 
 	// fill attributes
 	GMAP( "FillStyle",						XML_NAMESPACE_DRAW,	XML_FILL,					XML_SD_TYPE_FILLSTYLE, 0 ),
@@ -392,6 +394,14 @@ SvXMLEnumMapEntry aXML_LineJoint_EnumMap
 	{ XML_TOKEN_INVALID, 0 }
 };
 
+SvXMLEnumMapEntry aXML_LineCap_EnumMap[] =
+{
+    { XML_BUTT, drawing::LineCap_BUTT },
+    { XML_ROUND, drawing::LineCap_ROUND },
+    { XML_GRADIENTSTYLE_SQUARE, drawing::LineCap_SQUARE }, // use XML_GRADIENTSTYLE_SQUARE
as XML_SQUARE, is defined as "square" already
+    { XML_TOKEN_INVALID, 0 }
+};
+
 SvXMLEnumMapEntry aXML_FillStyle_EnumMap[] =
 {
 	{ XML_NONE,	    drawing::FillStyle_NONE },
@@ -887,6 +897,11 @@ const XMLPropertyHandler* XMLSdPropHdlFa
 				pHdl = new XMLEnumPropertyHdl( aXML_LineJoint_EnumMap, ::getCppuType((const drawing::LineJoint*)0)
);
 				break;
 			}
+            case XML_SD_TYPE_LINECAP :
+            {
+                pHdl = new XMLEnumPropertyHdl( aXML_LineCap_EnumMap, ::getCppuType((const
drawing::LineCap*)0) );
+                break;
+            }
 			case XML_SD_TYPE_FILLSTYLE :
 			{
 				pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const drawing::FillStyle*)0)
);

Modified: incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.hxx?rev=1232507&r1=1232506&r2=1232507&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/sdpropls.hxx Tue Jan 17 17:54:04 2012
@@ -83,6 +83,7 @@ extern const XMLPropertyMapEntry aXMLSDP
 #define XML_SD_TYPE_CONTROL_BORDER					(XML_SD_TYPES_START + 32 )
 #define XML_SD_TYPE_CONTROL_BORDER_COLOR            (XML_SD_TYPES_START + 33 )
 #define XML_SD_TYPE_IMAGE_SCALE_MODE                (XML_SD_TYPES_START + 34 )
+#define XML_SD_TYPE_LINECAP                         (XML_SD_TYPES_START + 35 )
 
 // 3D property types
 #define XML_SD_TYPE_BACKFACE_CULLING				(XML_SD_TYPES_START + 40 )



Mime
View raw message