Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <com/sun/star/drawing/XDrawPage.hpp>
36 : : #include <basegfx/matrix/b2dhommatrix.hxx>
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : :
40 : : namespace drawinglayer
41 : : {
42 : : namespace primitive2d
43 : : {
44 : : /** PagePreviewPrimitive2D class
45 : :
46 : : This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing
47 : : the page contents (given as PageContent here) if these contain e.g.
48 : : view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want
49 : : those primitives to be visualized correctly, Your renderer needs to locally correct it's
50 : : ViewInformation2D to reference the new XDrawPage.
51 : : */
52 [ # # ][ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D
[ # # ]
53 : : {
54 : : private:
55 : : /** the XDrawPage visualized by this primitive. When we go forward with primitives
56 : : this will not only be used by the renderers to provide the correct decompose
57 : : graphic attribute context, but also to completely create the page's sub-content.
58 : : */
59 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage;
60 : :
61 : : /// the PageContent
62 : : Primitive2DSequence maPageContent;
63 : :
64 : : /// the own geometry
65 : : basegfx::B2DHomMatrix maTransform;
66 : :
67 : : /// content width and height
68 : : double mfContentWidth;
69 : : double mfContentHeight;
70 : :
71 : : /// bitfield
72 : : /// flag to allow keeping the aspect ratio
73 : : unsigned mbKeepAspectRatio : 1;
74 : :
75 : : protected:
76 : : /// local decomposition. Implementation will just return children
77 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
78 : :
79 : : public:
80 : : /// constructor
81 : : PagePreviewPrimitive2D(
82 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
83 : : const basegfx::B2DHomMatrix& rTransform,
84 : : double fContentWidth,
85 : : double fContentHeight,
86 : : const Primitive2DSequence& rPageContent,
87 : : bool bKeepAspectRatio);
88 : :
89 : : /// data read access
90 : 0 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
91 : 0 : const Primitive2DSequence& getPageContent() const { return maPageContent; }
92 : 0 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
93 : 0 : double getContentWidth() const { return mfContentWidth; }
94 : 0 : double getContentHeight() const { return mfContentHeight; }
95 : 0 : bool getKeepAspectRatio() const { return mbKeepAspectRatio; }
96 : :
97 : : /// compare operator
98 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
99 : :
100 : : /// own getB2DRange
101 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
102 : :
103 : : /// provide unique ID
104 : : DeclPrimitrive2DIDBlock()
105 : : };
106 : : } // end of namespace primitive2d
107 : : } // end of namespace drawinglayer
108 : :
109 : : //////////////////////////////////////////////////////////////////////////////
110 : :
111 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
112 : :
113 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|