Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / drawinglayer / source / processor2d / vclmetafileprocessor2d.hxx
blobd216fcc3f3c9f16864b1f45e1103fc3f9c73e987
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SOURCE_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
21 #define INCLUDED_DRAWINGLAYER_SOURCE_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include "vclprocessor2d.hxx"
26 #include <com/sun/star/i18n/XBreakIterator.hpp>
27 #include <basegfx/polygon/b2dpolypolygon.hxx>
30 // vcl::PDFExtOutDevData support
32 #include <vcl/pdfextoutdevdata.hxx>
35 // predefines
37 class GDIMetaFile;
38 class Rectangle;
39 class Gradient;
40 class SvtGraphicFill;
41 class SvtGraphicStroke;
43 namespace drawinglayer { namespace attribute {
44 class FillGradientAttribute;
45 class LineAttribute;
46 class StrokeAttribute;
47 class LineStartEndAttribute;
50 namespace basegfx {
51 class BColor;
55 namespace drawinglayer
57 namespace processor2d
59 /** VclMetafileProcessor2D class
61 This processor derived from VclProcessor2D is the base class for rendering
62 all feeded primitives to a classical VCL-Metafile, including all over the
63 time grown extra data in comments and PDF exception data creations. Also
64 printing needs some exception stuff.
66 All in all it is needed to emulate the old ::paint output from the old
67 Drawinglayer as long as exporters and/or filters still use the Metafile
68 and the extra-data added to it (which can be seen mostly as 'extensions'
69 or simply as 'hacks').
71 class VclMetafileProcessor2D : public VclProcessor2D
73 private:
74 /// local helper(s)
75 Rectangle impDumpToMetaFile(
76 const primitive2d::Primitive2DContainer& rContent,
77 GDIMetaFile& o_rContentMetafile);
78 void impConvertFillGradientAttributeToVCLGradient(
79 Gradient& o_rVCLGradient,
80 const attribute::FillGradientAttribute& rFiGrAtt,
81 bool bIsTransparenceGradient);
82 void impStartSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
83 void impEndSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
84 SvtGraphicStroke* impTryToCreateSvtGraphicStroke(
85 const basegfx::B2DPolygon& rB2DPolygon,
86 const basegfx::BColor* pColor,
87 const attribute::LineAttribute* pLineAttribute,
88 const attribute::StrokeAttribute* pStrokeAttribute,
89 const attribute::LineStartEndAttribute* pStart,
90 const attribute::LineStartEndAttribute* pEnd);
91 void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
92 void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
94 /// Convert the fWidth to the same space as its coordinates.
95 double getTransformedLineWidth( double fWidth ) const;
97 /// the current clipping tools::PolyPolygon from MaskPrimitive2D
98 basegfx::B2DPolyPolygon maClipPolyPolygon;
100 /// the target MetaFile
101 GDIMetaFile* mpMetaFile;
103 /* do not allow embedding SvtGraphicFills into each other,
104 use a counter to prevent that
106 sal_uInt32 mnSvtGraphicFillCount;
108 /// same for SvtGraphicStroke
109 sal_uInt32 mnSvtGraphicStrokeCount;
111 /* hold the last unified transparence value to have it handy
112 on SvtGraphicStroke creation
114 double mfCurrentUnifiedTransparence;
116 /* break iterator support
117 made static so it only needs to be fetched once, even with many single
118 constructed VclMetafileProcessor2D. It's still incarnated on demand,
119 but exists for OOo runtime now by purpose.
121 static css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator;
123 /* vcl::PDFExtOutDevData support
124 For the first step, some extra actions at vcl::PDFExtOutDevData need to
125 be emulated with the VclMetafileProcessor2D. These are potentially temporarily
126 since PDF export may use PrimitiveSequences one day directly.
128 vcl::PDFExtOutDevData* mpPDFExtOutDevData;
130 protected:
131 /* the local processor for BasePrimitive2D-Implementation based primitives,
132 called from the common process()-implementation
134 virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
136 public:
137 /// constructor/destructor
138 VclMetafileProcessor2D(
139 const geometry::ViewInformation2D& rViewInformation,
140 OutputDevice& rOutDev);
141 virtual ~VclMetafileProcessor2D();
143 } // end of namespace processor2d
144 } // end of namespace drawinglayer
147 #endif // INCLUDED_DRAWINGLAYER_SOURCE_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */