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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
29 #include <vcl/bitmapex.hxx>
30 #include <vcl/wall.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 
34 namespace drawinglayer
35 {
36 	namespace primitive2d
37 	{
38 		/** WallpaperBitmapPrimitive2D class
39 
40 			This is a specialized primtive for the Wallpaper definitions included in
41 			VCL and Metafiles. The extraordinary about the bitmap definition part of
42 			the Wallpaper is that it uses PIXEL size of the given Bitmap and not
43 			the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
44 			To emulate this, a ViewTransformation dependent primitive is needed which
45 			takes over the correct scaling(s).
46 
47 			Since a specialized primitive is needed anyways, i opted to also add the
48 			layouting which is dependent from WallpaperStyle; thus it does not need
49 			to be handled anywhere else in the future.
50 		 */
51 		class DRAWINGLAYER_DLLPUBLIC WallpaperBitmapPrimitive2D : public ViewTransformationDependentPrimitive2D
52 		{
53 		private:
54 			basegfx::B2DRange					maObjectRange;
55 			BitmapEx							maBitmapEx;
56 			WallpaperStyle						meWallpaperStyle;
57 
58 		protected:
59 			/// create local decomposition
60 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
61 
62 		public:
63             /// constructor
64 			WallpaperBitmapPrimitive2D(
65 				const basegfx::B2DRange& rObjectRange,
66 				const BitmapEx& rBitmapEx,
67 				WallpaperStyle eWallpaperStyle);
68 
69 			/// data read access
getLocalObjectRange() const70 			const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
getBitmapEx() const71 			const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
getWallpaperStyle() const72 			WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
73 
74 			/// compare operator
75 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
76 
77 			/// get B2Drange
78 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
79 
80 			/// provide unique ID
81 			DeclPrimitrive2DIDBlock()
82 		};
83 	} // end of namespace primitive2d
84 } // end of namespace drawinglayer
85 
86 //////////////////////////////////////////////////////////////////////////////
87 
88 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
89 
90 //////////////////////////////////////////////////////////////////////////////
91 // eof
92