summaryrefslogtreecommitdiff
path: root/goodies/source
diff options
context:
space:
mode:
Diffstat (limited to 'goodies/source')
-rw-r--r--goodies/source/filter.vcl/epict/epict.cxx120
-rw-r--r--goodies/source/filter.vcl/epict/makefile.mk2
-rw-r--r--goodies/source/filter.vcl/eps/eps.cxx61
-rw-r--r--goodies/source/filter.vcl/ios2met/ios2met.cxx2
-rw-r--r--goodies/source/graphic/grfmgr.cxx4
5 files changed, 163 insertions, 26 deletions
diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx
index 3e4dca455d05..cd9e33edd5d9 100644
--- a/goodies/source/filter.vcl/epict/epict.cxx
+++ b/goodies/source/filter.vcl/epict/epict.cxx
@@ -55,6 +55,9 @@
#include "dlgepct.hrc"
#include "dlgepct.hxx"
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
//============================== PictWriter ===================================
struct PictWriterAttrStackMember {
@@ -77,7 +80,6 @@ struct PictPattern {
sal_uInt32 nLo, nHi;
};
-
class PictWriter {
private:
@@ -178,6 +180,7 @@ private:
void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry);
+ void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
void WriteOpcodes(const GDIMetaFile & rMTF);
void WriteHeader(const GDIMetaFile & rMTF);
@@ -1371,6 +1374,65 @@ void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal
}
}
+void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
+{
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+
+ rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
+
+ if(aLinePolyPolygon.count())
+ {
+ aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision();
+ const sal_uInt32 nPolyCount(aLinePolyPolygon.count());
+ SetAttrForFrame();
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount)
+ {
+ const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount);
+ const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0));
+ Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY()));
+
+ for(sal_uInt32 b(0); b < nEdgeCount; b++)
+ {
+ const sal_uInt32 nNextIndex((b + 1) % nPointCount);
+ const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex));
+ const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY()));
+
+ WriteOpcode_Line(nCurr, nNext);
+ nCurr = nNext;
+ }
+ }
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor(aLineColor);
+ const Color aOldFillColor(aFillColor);
+
+ aLineColor = Color( COL_TRANSPARENT );
+ aFillColor = aOldLineColor;
+ SetAttrForPaint();
+
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision());
+ WriteOpcode_Poly(PDM_PAINT, aPolygon);
+ }
+
+ aLineColor = aOldLineColor;
+ aFillColor = aOldFillColor;
+ }
+ }
+}
void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
{
@@ -1417,8 +1479,19 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if( aLineColor != Color( COL_TRANSPARENT ) )
{
- SetAttrForFrame();
- WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
+ if(pA->GetLineInfo().IsDefault())
+ {
+ SetAttrForFrame();
+ WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
+ aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
+ }
}
break;
}
@@ -1571,24 +1644,35 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
{
const Polygon& rPoly = pA->GetPolygon();
- Polygon aSimplePoly;
- if ( rPoly.HasFlags() )
- rPoly.AdaptiveSubdivide( aSimplePoly );
- else
- aSimplePoly = rPoly;
-
- const USHORT nSize = aSimplePoly.GetSize();
- Point aLast;
-
- if ( nSize )
+ if( rPoly.GetSize() )
{
- SetAttrForFrame();
- aLast = aSimplePoly[0];
+ if(pA->GetLineInfo().IsDefault())
+ {
+ Polygon aSimplePoly;
+ if ( rPoly.HasFlags() )
+ rPoly.AdaptiveSubdivide( aSimplePoly );
+ else
+ aSimplePoly = rPoly;
- for ( USHORT i = 1; i < nSize; i++ )
+ const USHORT nSize = aSimplePoly.GetSize();
+ Point aLast;
+
+ if ( nSize )
+ {
+ SetAttrForFrame();
+ aLast = aSimplePoly[0];
+
+ for ( USHORT i = 1; i < nSize; i++ )
+ {
+ WriteOpcode_Line( aLast, aSimplePoly[i] );
+ aLast = aSimplePoly[i];
+ }
+ }
+ }
+ else
{
- WriteOpcode_Line( aLast, aSimplePoly[i] );
- aLast = aSimplePoly[i];
+ // LineInfo used; handle Dash/Dot and fat lines
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
}
}
}
diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk
index 4aa4bab80ffc..9f25a562488a 100644
--- a/goodies/source/filter.vcl/epict/makefile.mk
+++ b/goodies/source/filter.vcl/epict/makefile.mk
@@ -61,7 +61,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
.IF "$(L10N_framework)"==""
SHL1TARGET= ept$(DLLPOSTFIX)
SHL1IMPLIB= epict
-SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
+SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB)
SHL1LIBS= $(SLB)$/epict.lib
diff --git a/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx
index dc8e407b178e..83b5a94f97f2 100644
--- a/goodies/source/filter.vcl/eps/eps.cxx
+++ b/goodies/source/filter.vcl/eps/eps.cxx
@@ -388,7 +388,7 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
bTextFillColor = TRUE;
aTextFillColor = Color( COL_BLACK );
fLineWidth = 1;
- fMiterLimit = 10;
+ fMiterLimit = 15; // use same limit as most graphic systems and basegfx
eLineCap = SvtGraphicStroke::capButt;
eJoinType = SvtGraphicStroke::joinMiter;
aBackgroundColor = Color( COL_WHITE );
@@ -701,7 +701,40 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() );
const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo();
ImplWriteLineInfo( rLineInfo );
- ImplPolyLine( aPoly );
+
+ if(basegfx::B2DLINEJOIN_NONE == rLineInfo.GetLineJoin()
+ && rLineInfo.GetWidth() > 1)
+ {
+ // emulate B2DLINEJOIN_NONE by creating single edges
+ const sal_uInt16 nPoints(aPoly.GetSize());
+ const bool bCurve(aPoly.HasFlags());
+
+ for(sal_uInt16 a(0); a + 1 < nPoints; a++)
+ {
+ if(bCurve
+ && POLY_NORMAL != aPoly.GetFlags(a + 1)
+ && a + 2 < nPoints
+ && POLY_NORMAL != aPoly.GetFlags(a + 2)
+ && a + 3 < nPoints)
+ {
+ const Polygon aSnippet(4,
+ aPoly.GetConstPointAry() + a,
+ aPoly.GetConstFlagAry() + a);
+ ImplPolyLine(aSnippet);
+ a += 2;
+ }
+ else
+ {
+ const Polygon aSnippet(2,
+ aPoly.GetConstPointAry() + a);
+ ImplPolyLine(aSnippet);
+ }
+ }
+ }
+ else
+ {
+ ImplPolyLine( aPoly );
+ }
}
break;
@@ -2343,8 +2376,28 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
SvtGraphicStroke::DashArray l_aDashArray;
if ( rLineInfo.GetStyle() == LINE_DASH )
l_aDashArray.push_back( 2 );
- double fLWidth = ( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5;
- ImplWriteLineInfo( fLWidth, 10.0, SvtGraphicStroke::capButt, SvtGraphicStroke::joinMiter, l_aDashArray );
+ const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5);
+ SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
+
+ switch(rLineInfo.GetLineJoin())
+ {
+ default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
+ // do NOT use SvtGraphicStroke::joinNone here
+ // since it will be written as numerical value directly
+ // and is NOT a valid EPS value
+ break;
+ case basegfx::B2DLINEJOIN_MITER:
+ aJoinType = SvtGraphicStroke::joinMiter;
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ aJoinType = SvtGraphicStroke::joinBevel;
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ aJoinType = SvtGraphicStroke::joinRound;
+ break;
+ }
+
+ ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray );
}
//---------------------------------------------------------------------------------
diff --git a/goodies/source/filter.vcl/ios2met/ios2met.cxx b/goodies/source/filter.vcl/ios2met/ios2met.cxx
index 0fbf24f56029..8c3c19e22379 100644
--- a/goodies/source/filter.vcl/ios2met/ios2met.cxx
+++ b/goodies/source/filter.vcl/ios2met/ios2met.cxx
@@ -846,7 +846,7 @@ void OS2METReader::ReadRelLine(BOOL bGivenPos, USHORT nOrderLen)
if (nPolySize==0) return;
Polygon aPolygon(nPolySize);
for (i=0; i<nPolySize; i++) {
-#if (defined SOLARIS && defined PPC) || defined IRIX
+#if defined SOLARIS && defined PPC
UINT8 nunsignedbyte;
*pOS2MET >> nunsignedbyte; aP0.X()+=(INT8)nunsignedbyte;
*pOS2MET >> nunsignedbyte; aP0.Y()+=(INT8)nunsignedbyte;
diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx
index 39c1e53e7184..7f5970383075 100644
--- a/goodies/source/graphic/grfmgr.cxx
+++ b/goodies/source/graphic/grfmgr.cxx
@@ -845,7 +845,7 @@ const Graphic& GraphicObject::GetGraphic() const
// -----------------------------------------------------------------------------
-void GraphicObject::SetGraphic( const Graphic& rGraphic )
+void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj )
{
mpMgr->ImplUnregisterObj( *this );
@@ -858,7 +858,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic )
delete mpLink, mpLink = NULL;
delete mpSimpleCache, mpSimpleCache = NULL;
- mpMgr->ImplRegisterObj( *this, maGraphic );
+ mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj);
if( mpSwapOutTimer )
mpSwapOutTimer->Start();