1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/processor2d/vclprocessor2d.hxx>
26 #include <com/sun/star/i18n/XBreakIterator.hpp>
27 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 //////////////////////////////////////////////////////////////////////////////
30 // vcl::PDFExtOutDevData support
32 #include <vcl/pdfextoutdevdata.hxx>
34 //////////////////////////////////////////////////////////////////////////////
41 class SvtGraphicStroke
;
43 namespace drawinglayer
{ namespace attribute
{
44 class FillGradientAttribute
;
46 class StrokeAttribute
;
47 class LineStartEndAttribute
;
54 //////////////////////////////////////////////////////////////////////////////
56 namespace drawinglayer
60 /** VclMetafileProcessor2D class
62 This processor derived from VclProcessor2D is the base class for rendering
63 all feeded primitives to a classical VCL-Metafile, including all over the
64 time grown extra data in comments and PDF exception data creations. Also
65 printing needs some exception stuff.
67 All in all it is needed to emulate the old ::paint output from the old
68 Drawinglayer as long as exporters and/or filters still use the Metafile
69 and the extra-data added to it (which can be seen mostly as 'extensions'
70 or simply as 'hacks').
72 class DRAWINGLAYER_DLLPUBLIC VclMetafileProcessor2D
: public VclProcessor2D
76 Rectangle
impDumpToMetaFile(
77 const primitive2d::Primitive2DSequence
& rContent
,
78 GDIMetaFile
& o_rContentMetafile
);
79 void impConvertFillGradientAttributeToVCLGradient(
80 Gradient
& o_rVCLGradient
,
81 const attribute::FillGradientAttribute
& rFiGrAtt
,
82 bool bIsTransparenceGradient
);
83 void impStartSvtGraphicFill(SvtGraphicFill
* pSvtGraphicFill
);
84 void impEndSvtGraphicFill(SvtGraphicFill
* pSvtGraphicFill
);
85 SvtGraphicStroke
* impTryToCreateSvtGraphicStroke(
86 const basegfx::B2DPolygon
& rB2DPolygon
,
87 const basegfx::BColor
* pColor
,
88 const attribute::LineAttribute
* pLineAttribute
,
89 const attribute::StrokeAttribute
* pStrokeAttribute
,
90 const attribute::LineStartEndAttribute
* pStart
,
91 const attribute::LineStartEndAttribute
* pEnd
);
92 void impStartSvtGraphicStroke(SvtGraphicStroke
* pSvtGraphicStroke
);
93 void impEndSvtGraphicStroke(SvtGraphicStroke
* pSvtGraphicStroke
);
95 /// Convert the fWidth to the same space as its coordinates.
96 double getTransformedLineWidth( double fWidth
) const;
98 /// the current clipping PolyPolygon from MaskPrimitive2D
99 basegfx::B2DPolyPolygon maClipPolyPolygon
;
101 /// the target MetaFile
102 GDIMetaFile
* mpMetaFile
;
104 /* do not allow embedding SvtGraphicFills into each other,
105 use a counter to prevent that
107 sal_uInt32 mnSvtGraphicFillCount
;
109 /// same for SvtGraphicStroke
110 sal_uInt32 mnSvtGraphicStrokeCount
;
112 /* hold the last unified transparence value to have it handy
113 on SvtGraphicStroke creation
115 double mfCurrentUnifiedTransparence
;
117 /* break iterator support
118 made static so it only needs to be fetched once, even with many single
119 constructed VclMetafileProcessor2D. It's still incarnated on demand,
120 but exists for OOo runtime now by purpose.
122 static ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XBreakIterator
> mxBreakIterator
;
124 /* vcl::PDFExtOutDevData support
125 For the first step, some extra actions at vcl::PDFExtOutDevData need to
126 be emulated with the VclMetafileProcessor2D. These are potentially temporarily
127 since PDF export may use PrimitiveSequences one day directly.
129 vcl::PDFExtOutDevData
* mpPDFExtOutDevData
;
132 /* the local processor for BasePrinitive2D-Implementation based primitives,
133 called from the common process()-implementation
135 virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D
& rCandidate
);
138 /// constructor/destructor
139 VclMetafileProcessor2D(
140 const geometry::ViewInformation2D
& rViewInformation
,
141 OutputDevice
& rOutDev
);
142 virtual ~VclMetafileProcessor2D();
144 } // end of namespace processor2d
145 } // end of namespace drawinglayer
147 //////////////////////////////////////////////////////////////////////////////
149 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */