Branch libreoffice-6-3
[LibreOffice.git] / include / drawinglayer / primitive2d / pagepreviewprimitive2d.hxx
blob6abe873e6f22a0cac49dbbe753c9c2c54c9a98bf
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 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
28 namespace com::sun::star::drawing { class XDrawPage; }
31 namespace drawinglayer
33 namespace primitive2d
35 /** PagePreviewPrimitive2D class
37 This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing
38 the page contents (given as PageContent here) if these contain e.g.
39 view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want
40 those primitives to be visualized correctly, Your renderer needs to locally correct its
41 ViewInformation2D to reference the new XDrawPage.
43 class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D
45 private:
46 /** the XDrawPage visualized by this primitive. When we go forward with primitives
47 this will not only be used by the renderers to provide the correct decompose
48 graphic attribute context, but also to completely create the page's sub-content.
50 const css::uno::Reference< css::drawing::XDrawPage > mxDrawPage;
52 /// the PageContent
53 Primitive2DContainer maPageContent;
55 /// the own geometry
56 basegfx::B2DHomMatrix maTransform;
58 /// content width and height
59 double mfContentWidth;
60 double mfContentHeight;
62 protected:
63 /// local decomposition. Implementation will just return children
64 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
66 public:
67 /// constructor
68 PagePreviewPrimitive2D(
69 const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
70 const basegfx::B2DHomMatrix& rTransform,
71 double fContentWidth,
72 double fContentHeight,
73 const Primitive2DContainer& rPageContent);
75 /// data read access
76 const css::uno::Reference< css::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
77 const Primitive2DContainer& getPageContent() const { return maPageContent; }
78 const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
79 double getContentWidth() const { return mfContentWidth; }
80 double getContentHeight() const { return mfContentHeight; }
82 /// compare operator
83 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
85 /// own getB2DRange
86 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
88 /// provide unique ID
89 DeclPrimitive2DIDBlock()
91 } // end of namespace primitive2d
92 } // end of namespace drawinglayer
95 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */