1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _CPPCANVAS_CANVASGRAPHICHELPER_HXX 25 #define _CPPCANVAS_CANVASGRAPHICHELPER_HXX 26 27 #include <com/sun/star/rendering/RenderState.hpp> 28 #include <basegfx/polygon/b2dpolypolygon.hxx> 29 30 #include <cppcanvas/canvasgraphic.hxx> 31 32 #include <boost/optional.hpp> 33 34 namespace com { namespace sun { namespace star { namespace rendering 35 { 36 class XGraphicDevice; 37 } } } } 38 39 40 /* Definition of CanvasGraphicHelper class */ 41 42 namespace cppcanvas 43 { 44 45 namespace internal 46 { 47 48 class CanvasGraphicHelper : public virtual CanvasGraphic 49 { 50 public: 51 CanvasGraphicHelper( const CanvasSharedPtr& rParentCanvas ); 52 53 // CanvasGraphic implementation 54 virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ); 55 virtual ::basegfx::B2DHomMatrix getTransformation() const; 56 virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ); 57 virtual void setClip(); 58 virtual ::basegfx::B2DPolyPolygon const* getClip() const; 59 virtual void setRGBAColor( Color::IntSRGBA ); 60 virtual Color::IntSRGBA getRGBAColor() const; 61 virtual void setCompositeOp( CompositeOp aOp ); 62 virtual CompositeOp getCompositeOp() const; 63 64 protected: 65 // for our clients 66 // =============== 67 CanvasSharedPtr getCanvas() const; 68 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > getGraphicDevice() const; 69 const ::com::sun::star::rendering::RenderState& getRenderState() const; 70 71 private: 72 mutable ::com::sun::star::rendering::RenderState maRenderState; 73 74 boost::optional<basegfx::B2DPolyPolygon> maClipPolyPolygon; 75 CanvasSharedPtr mpCanvas; 76 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice; 77 }; 78 79 } 80 } 81 82 #endif /* _CPPCANVAS_CANVASGRAPHICHELPER_HXX */ 83