Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / drawinglayer / inc / primitive2d / wallpaperprimitive2d.hxx
blobc92006b36db3d9e6360f00438d97748591a99078
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
23 #include <vcl/bitmapex.hxx>
24 #include <vcl/wall.hxx>
27 namespace drawinglayer::primitive2d
29 /** WallpaperBitmapPrimitive2D class
31 This is a specialized primitive for the Wallpaper definitions included in
32 VCL and Metafiles. The extraordinary about the bitmap definition part of
33 the Wallpaper is that it uses PIXEL size of the given Bitmap and not
34 the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
35 To emulate this, a ViewTransformation dependent primitive is needed which
36 takes over the correct scaling(s).
38 Since a specialized primitive is needed anyways, i opted to also add the
39 layouting which is dependent from WallpaperStyle; thus it does not need
40 to be handled anywhere else in the future.
42 class WallpaperBitmapPrimitive2D final : public ViewTransformationDependentPrimitive2D
44 private:
45 basegfx::B2DRange maObjectRange;
46 BitmapEx maBitmapEx;
47 WallpaperStyle meWallpaperStyle;
49 /// create local decomposition
50 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
52 public:
53 /// constructor
54 WallpaperBitmapPrimitive2D(
55 const basegfx::B2DRange& rObjectRange,
56 const BitmapEx& rBitmapEx,
57 WallpaperStyle eWallpaperStyle);
59 /// data read access
60 const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
61 const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
62 WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
64 /// compare operator
65 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
67 /// get B2Drange
68 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
70 /// provide unique ID
71 virtual sal_uInt32 getPrimitive2DID() const override;
74 } // end of namespace drawinglayer::primitive2d
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */