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_PAGEPREVIEWPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <com/sun/star/drawing/XDrawPage.hpp>
27 : #include <basegfx/matrix/b2dhommatrix.hxx>
28 :
29 : //////////////////////////////////////////////////////////////////////////////
30 :
31 : namespace drawinglayer
32 : {
33 : namespace primitive2d
34 : {
35 : /** PagePreviewPrimitive2D class
36 :
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 it's
41 : ViewInformation2D to reference the new XDrawPage.
42 : */
43 0 : class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D
44 : {
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.
49 : */
50 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage;
51 :
52 : /// the PageContent
53 : Primitive2DSequence maPageContent;
54 :
55 : /// the own geometry
56 : basegfx::B2DHomMatrix maTransform;
57 :
58 : /// content width and height
59 : double mfContentWidth;
60 : double mfContentHeight;
61 :
62 : /// bitfield
63 : /// flag to allow keeping the aspect ratio
64 : unsigned mbKeepAspectRatio : 1;
65 :
66 : protected:
67 : /// local decomposition. Implementation will just return children
68 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
69 :
70 : public:
71 : /// constructor
72 : PagePreviewPrimitive2D(
73 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
74 : const basegfx::B2DHomMatrix& rTransform,
75 : double fContentWidth,
76 : double fContentHeight,
77 : const Primitive2DSequence& rPageContent,
78 : bool bKeepAspectRatio);
79 :
80 : /// data read access
81 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
82 0 : const Primitive2DSequence& getPageContent() const { return maPageContent; }
83 0 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
84 0 : double getContentWidth() const { return mfContentWidth; }
85 0 : double getContentHeight() const { return mfContentHeight; }
86 0 : bool getKeepAspectRatio() const { return mbKeepAspectRatio; }
87 :
88 : /// compare operator
89 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
90 :
91 : /// own getB2DRange
92 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
93 :
94 : /// provide unique ID
95 : DeclPrimitrive2DIDBlock()
96 : };
97 : } // end of namespace primitive2d
98 : } // end of namespace drawinglayer
99 :
100 : //////////////////////////////////////////////////////////////////////////////
101 :
102 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|