Author: alg
Date: Wed Apr 24 17:26:20 2013
New Revision: 1471551
URL: http://svn.apache.org/r1471551
Log:
i122132 Some simple extensions to exporter
Modified:
openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
openoffice/trunk/main/filter/source/svg/svgwriter.cxx
openoffice/trunk/main/vcl/source/gdi/metaact.cxx
Modified:
openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx?rev=1471551&r1=1471550&r2=1471551&view=diff
==============================================================================
---
openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
(original)
+++
openoffice/trunk/main/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
Wed Apr 24 17:26:20 2013
@@ -370,6 +370,7 @@ namespace drawinglayer
if(rB2DPolygon.count() && !mnSvtGraphicStrokeCount)
{
+ basegfx::B2DPolygon aLocalPolygon(rB2DPolygon);
basegfx::BColor aStrokeColor;
basegfx::B2DPolyPolygon aStartArrow;
basegfx::B2DPolyPolygon aEndArrow;
@@ -387,30 +388,38 @@ namespace drawinglayer
// SvtGraphicStroke has NO entry for stroke
color(!)
mpOutputDevice->SetLineColor(Color(aStrokeColor));
- if(!rB2DPolygon.isClosed())
+ if(!aLocalPolygon.isClosed())
{
double fPolyLength(0.0);
+ double fStart(0.0);
+ double fEnd(0.0);
if(pStart && pStart->isActive())
{
- fPolyLength =
basegfx::tools::getLength(rB2DPolygon);
+ fPolyLength =
basegfx::tools::getLength(aLocalPolygon);
aStartArrow =
basegfx::tools::createAreaGeometryForLineStartEnd(
- rB2DPolygon,
pStart->getB2DPolyPolygon(), true, pStart->getWidth(),
- fPolyLength,
pStart->isCentered() ? 0.5 : 0.0, 0);
+ aLocalPolygon,
pStart->getB2DPolyPolygon(), true, pStart->getWidth(),
+ fPolyLength,
pStart->isCentered() ? 0.5 : 0.0, &fStart);
}
if(pEnd && pEnd->isActive())
{
if(basegfx::fTools::equalZero(fPolyLength))
{
- fPolyLength =
basegfx::tools::getLength(rB2DPolygon);
+ fPolyLength =
basegfx::tools::getLength(aLocalPolygon);
}
aEndArrow =
basegfx::tools::createAreaGeometryForLineStartEnd(
- rB2DPolygon,
pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(),
- fPolyLength,
pEnd->isCentered() ? 0.5 : 0.0, 0);
+ aLocalPolygon,
pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(),
+ fPolyLength,
pEnd->isCentered() ? 0.5 : 0.0, &fEnd);
}
+
+ if(0.0 != fStart || 0.0 != fEnd)
+ {
+ // build new poly, consume
something from old poly
+ aLocalPolygon =
basegfx::tools::getSnippetAbsolute(aLocalPolygon, fStart, fPolyLength - fEnd,
fPolyLength);
+ }
}
SvtGraphicStroke::JoinType eJoin(SvtGraphicStroke::joinNone);
@@ -490,14 +499,12 @@ namespace drawinglayer
// concept of PDF export and SvtGraphicStroke
usage does simply not
// allow handling such definitions. The only
clean way would be to
// add the transformation to SvtGraphicStroke
and to handle it there
- basegfx::B2DPolygon aB2DPolygon(rB2DPolygon);
-
- aB2DPolygon.transform(maCurrentTransformation);
+
aLocalPolygon.transform(maCurrentTransformation);
aStartArrow.transform(maCurrentTransformation);
aEndArrow.transform(maCurrentTransformation);
pRetval = new SvtGraphicStroke(
- Polygon(aB2DPolygon),
+ Polygon(aLocalPolygon),
PolyPolygon(aStartArrow),
PolyPolygon(aEndArrow),
mfCurrentUnifiedTransparence,
Modified: openoffice/trunk/main/filter/source/svg/svgwriter.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/filter/source/svg/svgwriter.cxx?rev=1471551&r1=1471550&r2=1471551&view=diff
==============================================================================
--- openoffice/trunk/main/filter/source/svg/svgwriter.cxx (original)
+++ openoffice/trunk/main/filter/source/svg/svgwriter.cxx Wed Apr 24 17:26:20
2013
@@ -1280,6 +1280,14 @@ void SVGActionWriter::ImplWriteActions(
if( rPoly.GetSize() )
{
+ const LineInfo& rLineInfo = pA->GetLineInfo();
+
+ if(rLineInfo.GetWidth())
+ {
+ sal_Int32 nStrokeWidth =
ImplMap(rLineInfo.GetWidth());
+ mrExport.AddAttribute( XML_NAMESPACE_NONE,
aXMLAttrStrokeWidth, ::rtl::OUString::valueOf( nStrokeWidth ) );
+ }
+
mpContext->AddPaintAttr(
mpVDev->GetLineColor(), Color( COL_TRANSPARENT ) );
ImplWritePolyPolygon( rPoly,
sal_True );
}
@@ -1550,83 +1558,109 @@ void SVGActionWriter::ImplWriteActions(
aStroke.getEndArrow( aEndArrow );
// Currently no support for strokes with start/end arrow(s)
- sal_Bool bSkip = ( !aStartArrow.Count() &&
!aEndArrow.Count() );
-
- if( bSkip )
- {
- Polygon aPoly;
+ // added that support
+ Polygon aPoly;
- aStroke.getPath(aPoly);
+ aStroke.getPath(aPoly);
- if(mapCurShape.get())
+ if(mapCurShape.get())
+ {
+ if(1 != mapCurShape->maShapePolyPoly.Count()
+ || !mapCurShape->maShapePolyPoly[0].IsEqual(aPoly))
{
- if(1 != mapCurShape->maShapePolyPoly.Count()
- ||
!mapCurShape->maShapePolyPoly[0].IsEqual(aPoly))
- {
- // this path action is not covering the same
path than the already existing
- // fill polypolygon, so write out the fill
polygon
- ImplWriteShape( *mapCurShape );
- mapCurShape.reset();
- }
+ // this path action is not covering the same path
than the already existing
+ // fill polypolygon, so write out the fill polygon
+ ImplWriteShape( *mapCurShape );
+ mapCurShape.reset();
}
+ }
- if( !mapCurShape.get() )
- {
+ if( !mapCurShape.get() )
+ {
- mapCurShape.reset( new SVGShapeDescriptor );
+ mapCurShape.reset( new SVGShapeDescriptor );
- if( pElementId )
- {
- mapCurShape->maId = *pElementId +
B2UCONST("_") + ::rtl::OUString::valueOf(nEntryCount++);
- }
-
- mapCurShape->maShapePolyPoly = aPoly;
+ if( pElementId )
+ {
+ mapCurShape->maId = *pElementId + B2UCONST("_") +
::rtl::OUString::valueOf(nEntryCount++);
}
- mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
- mapCurShape->maShapeLineColor.SetTransparency(
(sal_uInt8) FRound( aStroke.getTransparency() * 255.0 ) );
- mapCurShape->mnStrokeWidth = FRound(
aStroke.getStrokeWidth() );
- aStroke.getDashArray( mapCurShape->maDashArray );
+ mapCurShape->maShapePolyPoly = aPoly;
+ }
+
+ mapCurShape->maShapeLineColor = mpVDev->GetLineColor();
+ mapCurShape->maShapeLineColor.SetTransparency( (sal_uInt8)
FRound( aStroke.getTransparency() * 255.0 ) );
+ mapCurShape->mnStrokeWidth = FRound(
aStroke.getStrokeWidth() );
+ aStroke.getDashArray( mapCurShape->maDashArray );
- // added support for LineJoin
- switch(aStroke.getJoinType())
+ // added support for LineJoin
+ switch(aStroke.getJoinType())
+ {
+ default: /* SvtGraphicStroke::joinMiter,
SvtGraphicStroke::joinNone */
{
- default: /* SvtGraphicStroke::joinMiter,
SvtGraphicStroke::joinNone */
- {
- mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_MITER;
- break;
- }
- case SvtGraphicStroke::joinRound:
- {
- mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_ROUND;
- break;
- }
- case SvtGraphicStroke::joinBevel:
- {
- mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_BEVEL;
- break;
- }
+ mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_MITER;
+ break;
+ }
+ case SvtGraphicStroke::joinRound:
+ {
+ mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_ROUND;
+ break;
}
+ case SvtGraphicStroke::joinBevel:
+ {
+ mapCurShape->maLineJoin =
basegfx::B2DLINEJOIN_BEVEL;
+ break;
+ }
+ }
- // added support for LineCap
- switch(aStroke.getCapType())
+ // added support for LineCap
+ switch(aStroke.getCapType())
+ {
+ default: /* SvtGraphicStroke::capButt */
{
- default: /* SvtGraphicStroke::capButt */
- {
- mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_BUTT;
- break;
- }
- case SvtGraphicStroke::capRound:
- {
- mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_ROUND;
- break;
- }
- case SvtGraphicStroke::capSquare:
- {
- mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_SQUARE;
- break;
- }
+ mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_BUTT;
+ break;
+ }
+ case SvtGraphicStroke::capRound:
+ {
+ mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_ROUND;
+ break;
+ }
+ case SvtGraphicStroke::capSquare:
+ {
+ mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_SQUARE;
+ break;
+ }
+ }
+
+ if(mapCurShape.get() &&(aStartArrow.Count() ||
aEndArrow.Count()))
+ {
+ ImplWriteShape( *mapCurShape );
+
+ mapCurShape->maShapeFillColor =
mapCurShape->maShapeLineColor;
+ mapCurShape->maShapeLineColor = Color(COL_TRANSPARENT);
+ mapCurShape->mnStrokeWidth = 0;
+ mapCurShape->maDashArray.clear();
+ mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_MITER;
+ mapCurShape->maLineCap =
com::sun::star::drawing::LineCap_BUTT;
+
+ if(aStartArrow.Count())
+ {
+ mapCurShape->maShapePolyPoly = aStartArrow;
+ mapCurShape->maId = *pElementId + B2UCONST("_") +
::rtl::OUString::valueOf(nEntryCount++);
+
+ ImplWriteShape( *mapCurShape );
}
+
+ if(aEndArrow.Count())
+ {
+ mapCurShape->maShapePolyPoly = aEndArrow;
+ mapCurShape->maId = *pElementId + B2UCONST("_") +
::rtl::OUString::valueOf(nEntryCount++);
+
+ ImplWriteShape( *mapCurShape );
+ }
+
+ mapCurShape.reset();
}
// write open shape in every case
@@ -1637,6 +1671,8 @@ void SVGActionWriter::ImplWriteActions(
}
// skip rest of comment
+ sal_Bool bSkip = true;
+
while( bSkip && ( ++nCurAction < nCount ) )
{
pAction = rMtf.GetAction( nCurAction );
Modified: openoffice/trunk/main/vcl/source/gdi/metaact.cxx
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/metaact.cxx?rev=1471551&r1=1471550&r2=1471551&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/metaact.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/metaact.cxx Wed Apr 24 17:26:20 2013
@@ -4104,20 +4104,34 @@ void MetaCommentAction::Move( long nXMov
{
SvtGraphicStroke aStroke;
aMemStm >> aStroke;
- Polygon aPath;
+
+ Polygon aPath;
aStroke.getPath( aPath );
aPath.Move( nXMove, nYMove );
aStroke.setPath( aPath );
+
+ PolyPolygon aStartArrow;
+ aStroke.getStartArrow(aStartArrow);
+ aStartArrow.Move(nXMove, nYMove);
+ aStroke.setStartArrow(aStartArrow);
+
+ PolyPolygon aEndArrow;
+ aStroke.getEndArrow(aEndArrow);
+ aEndArrow.Move(nXMove, nYMove);
+ aStroke.setEndArrow(aEndArrow);
+
aDest << aStroke;
}
else
{
SvtGraphicFill aFill;
aMemStm >> aFill;
- PolyPolygon aPath;
+
+ PolyPolygon aPath;
aFill.getPath( aPath );
aPath.Move( nXMove, nYMove );
aFill.setPath( aPath );
+
aDest << aFill;
}
delete[] mpData;