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