Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
21 : #define _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 : #include <basegfx/color/bcolormodifier.hxx>
28 : #include <svtools/optionsdrawinglayer.hxx>
29 : #include <com/sun/star/rendering/ViewState.hpp>
30 : #include <com/sun/star/rendering/RenderState.hpp>
31 : #include <i18npool/lang.h>
32 : #include <basegfx/polygon/b2dpolypolygon.hxx>
33 : #include <vcl/mapmod.hxx>
34 :
35 : //////////////////////////////////////////////////////////////////////////////
36 : // forward declaration
37 :
38 : namespace basegfx {
39 : class BColor;
40 : class B2DPolygon;
41 : }
42 :
43 : namespace com { namespace sun { namespace star { namespace rendering {
44 : class XCanvas;
45 : class XPolyPolygon2D;
46 : }}}}
47 :
48 : namespace drawinglayer { namespace primitive2d {
49 : class MaskPrimitive2D;
50 : class MetafilePrimitive2D;
51 : class TextSimplePortionPrimitive2D;
52 : class BitmapPrimitive2D;
53 : class TransparencePrimitive2D;
54 : class PolygonStrokePrimitive2D;
55 : class FillBitmapPrimitive2D;
56 : class UnifiedTransparencePrimitive2D;
57 : }}
58 :
59 : //////////////////////////////////////////////////////////////////////////////
60 :
61 : namespace drawinglayer
62 : {
63 : namespace processor2d
64 : {
65 : /** canvasProcessor2D class
66 :
67 : A basic implementation of a renderer for com::sun::star::rendering::XCanvas
68 : as a target
69 : */
70 : class DRAWINGLAYER_DLLPUBLIC canvasProcessor2D : public BaseProcessor2D
71 : {
72 : private:
73 : // the (current) destination OutDev and canvas
74 : OutputDevice* mpOutputDevice;
75 : com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas;
76 : com::sun::star::rendering::ViewState maViewState;
77 : com::sun::star::rendering::RenderState maRenderState;
78 :
79 : // the modifiedColorPrimitive stack
80 : basegfx::BColorModifierStack maBColorModifierStack;
81 :
82 : // SvtOptionsDrawinglayer incarnation to react on diverse settings
83 : const SvtOptionsDrawinglayer maDrawinglayerOpt;
84 :
85 : // the current clipping PolyPolygon from MaskPrimitive2D, always in
86 : // object coordinates
87 : basegfx::B2DPolyPolygon maClipPolyPolygon;
88 :
89 : // determined LanguageType
90 : LanguageType meLang;
91 :
92 : // as tooling, the process() implementation takes over API handling and calls this
93 : // virtual render method when the primitive implementation is BasePrimitive2D-based.
94 : virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
95 :
96 : // direct primitive renderer support
97 : void impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate);
98 : void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
99 : void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
100 : void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
101 : void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
102 : void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
103 : void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
104 : void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate);
105 :
106 : public:
107 : canvasProcessor2D(
108 : const geometry::ViewInformation2D& rViewInformation,
109 : OutputDevice& rOutDev);
110 : virtual ~canvasProcessor2D();
111 :
112 : // access to Drawinglayer configuration options
113 0 : const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
114 : };
115 : } // end of namespace processor2d
116 : } // end of namespace drawinglayer
117 :
118 : //////////////////////////////////////////////////////////////////////////////
119 :
120 : #endif //_DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|