1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX 25*b1cdbd2cSJim Jagielski #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <drawinglayer/drawinglayerdllapi.h> 28*b1cdbd2cSJim Jagielski #include <drawinglayer/processor2d/vclprocessor2d.hxx> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/i18n/XBreakIterator.hpp> 30*b1cdbd2cSJim Jagielski #include <basegfx/polygon/b2dpolypolygon.hxx> 31*b1cdbd2cSJim Jagielski 32*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 33*b1cdbd2cSJim Jagielski // vcl::PDFExtOutDevData support 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski #include <vcl/pdfextoutdevdata.hxx> 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 38*b1cdbd2cSJim Jagielski // predefines 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski class GDIMetaFile; 41*b1cdbd2cSJim Jagielski class Rectangle; 42*b1cdbd2cSJim Jagielski class Gradient; 43*b1cdbd2cSJim Jagielski class SvtGraphicFill; 44*b1cdbd2cSJim Jagielski class SvtGraphicStroke; 45*b1cdbd2cSJim Jagielski 46*b1cdbd2cSJim Jagielski namespace drawinglayer { namespace attribute { 47*b1cdbd2cSJim Jagielski class FillGradientAttribute; 48*b1cdbd2cSJim Jagielski class LineAttribute; 49*b1cdbd2cSJim Jagielski class StrokeAttribute; 50*b1cdbd2cSJim Jagielski class LineStartEndAttribute; 51*b1cdbd2cSJim Jagielski }} 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski namespace basegfx { 54*b1cdbd2cSJim Jagielski class BColor; 55*b1cdbd2cSJim Jagielski } 56*b1cdbd2cSJim Jagielski 57*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski namespace drawinglayer 60*b1cdbd2cSJim Jagielski { 61*b1cdbd2cSJim Jagielski namespace processor2d 62*b1cdbd2cSJim Jagielski { 63*b1cdbd2cSJim Jagielski /** VclMetafileProcessor2D class 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski This processor derived from VclProcessor2D is the base class for rendering 66*b1cdbd2cSJim Jagielski all feeded primitives to a classical VCL-Metafile, including all over the 67*b1cdbd2cSJim Jagielski time grown extra data in comments and PDF exception data creations. Also 68*b1cdbd2cSJim Jagielski printing needs some exception stuff. 69*b1cdbd2cSJim Jagielski 70*b1cdbd2cSJim Jagielski All in all it is needed to emulate the old ::paint output from the old 71*b1cdbd2cSJim Jagielski Drawinglayer as long as exporters and/or filters still use the Metafile 72*b1cdbd2cSJim Jagielski and the extra-data added to it (which can be seen mostly as 'extensions' 73*b1cdbd2cSJim Jagielski or simply as 'hacks'). 74*b1cdbd2cSJim Jagielski */ 75*b1cdbd2cSJim Jagielski class VclMetafileProcessor2D : public VclProcessor2D 76*b1cdbd2cSJim Jagielski { 77*b1cdbd2cSJim Jagielski private: 78*b1cdbd2cSJim Jagielski /// local helper(s) 79*b1cdbd2cSJim Jagielski Rectangle impDumpToMetaFile( 80*b1cdbd2cSJim Jagielski const primitive2d::Primitive2DSequence& rContent, 81*b1cdbd2cSJim Jagielski GDIMetaFile& o_rContentMetafile); 82*b1cdbd2cSJim Jagielski void impConvertFillGradientAttributeToVCLGradient( 83*b1cdbd2cSJim Jagielski Gradient& o_rVCLGradient, 84*b1cdbd2cSJim Jagielski const attribute::FillGradientAttribute& rFiGrAtt, 85*b1cdbd2cSJim Jagielski bool bIsTransparenceGradient); 86*b1cdbd2cSJim Jagielski void impStartSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill); 87*b1cdbd2cSJim Jagielski void impEndSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill); 88*b1cdbd2cSJim Jagielski SvtGraphicStroke* impTryToCreateSvtGraphicStroke( 89*b1cdbd2cSJim Jagielski const basegfx::B2DPolygon& rB2DPolygon, 90*b1cdbd2cSJim Jagielski const basegfx::BColor* pColor, 91*b1cdbd2cSJim Jagielski const attribute::LineAttribute* pLineAttribute, 92*b1cdbd2cSJim Jagielski const attribute::StrokeAttribute* pStrokeAttribute, 93*b1cdbd2cSJim Jagielski const attribute::LineStartEndAttribute* pStart, 94*b1cdbd2cSJim Jagielski const attribute::LineStartEndAttribute* pEnd); 95*b1cdbd2cSJim Jagielski void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); 96*b1cdbd2cSJim Jagielski void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); 97*b1cdbd2cSJim Jagielski 98*b1cdbd2cSJim Jagielski /// the current clipping PolyPolygon from MaskPrimitive2D 99*b1cdbd2cSJim Jagielski basegfx::B2DPolyPolygon maClipPolyPolygon; 100*b1cdbd2cSJim Jagielski 101*b1cdbd2cSJim Jagielski /// the target MetaFile 102*b1cdbd2cSJim Jagielski GDIMetaFile* mpMetaFile; 103*b1cdbd2cSJim Jagielski 104*b1cdbd2cSJim Jagielski /* do not allow embedding SvtGraphicFills into each other, 105*b1cdbd2cSJim Jagielski use a counter to prevent that 106*b1cdbd2cSJim Jagielski */ 107*b1cdbd2cSJim Jagielski sal_uInt32 mnSvtGraphicFillCount; 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski /// same for SvtGraphicStroke 110*b1cdbd2cSJim Jagielski sal_uInt32 mnSvtGraphicStrokeCount; 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski /* hold the last unified transparence value to have it handy 113*b1cdbd2cSJim Jagielski on SvtGraphicStroke creation 114*b1cdbd2cSJim Jagielski */ 115*b1cdbd2cSJim Jagielski double mfCurrentUnifiedTransparence; 116*b1cdbd2cSJim Jagielski 117*b1cdbd2cSJim Jagielski /* break iterator support 118*b1cdbd2cSJim Jagielski made static so it only needs to be fetched once, even with many single 119*b1cdbd2cSJim Jagielski constructed VclMetafileProcessor2D. It's still incarnated on demand, 120*b1cdbd2cSJim Jagielski but exists for OOo runtime now by purpose. 121*b1cdbd2cSJim Jagielski */ 122*b1cdbd2cSJim Jagielski static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator; 123*b1cdbd2cSJim Jagielski 124*b1cdbd2cSJim Jagielski /* vcl::PDFExtOutDevData support 125*b1cdbd2cSJim Jagielski For the first step, some extra actions at vcl::PDFExtOutDevData need to 126*b1cdbd2cSJim Jagielski be emulated with the VclMetafileProcessor2D. These are potentially temporarily 127*b1cdbd2cSJim Jagielski since PDF export may use PrimitiveSequences one day directly. 128*b1cdbd2cSJim Jagielski */ 129*b1cdbd2cSJim Jagielski vcl::PDFExtOutDevData* mpPDFExtOutDevData; 130*b1cdbd2cSJim Jagielski 131*b1cdbd2cSJim Jagielski protected: 132*b1cdbd2cSJim Jagielski /* the local processor for BasePrinitive2D-Implementation based primitives, 133*b1cdbd2cSJim Jagielski called from the common process()-implementation 134*b1cdbd2cSJim Jagielski */ 135*b1cdbd2cSJim Jagielski virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski public: 138*b1cdbd2cSJim Jagielski /// constructor/destructor 139*b1cdbd2cSJim Jagielski VclMetafileProcessor2D( 140*b1cdbd2cSJim Jagielski const geometry::ViewInformation2D& rViewInformation, 141*b1cdbd2cSJim Jagielski OutputDevice& rOutDev); 142*b1cdbd2cSJim Jagielski virtual ~VclMetafileProcessor2D(); 143*b1cdbd2cSJim Jagielski }; 144*b1cdbd2cSJim Jagielski } // end of namespace processor2d 145*b1cdbd2cSJim Jagielski } // end of namespace drawinglayer 146*b1cdbd2cSJim Jagielski 147*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 148*b1cdbd2cSJim Jagielski 149*b1cdbd2cSJim Jagielski #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX 150*b1cdbd2cSJim Jagielski 151*b1cdbd2cSJim Jagielski // eof 152