1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <com/sun/star/drawing/XDrawPage.hpp>
27 #include <basegfx/matrix/b2dhommatrix.hxx>
31 namespace drawinglayer
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
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 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> mxDrawPage
;
53 Primitive2DSequence maPageContent
;
56 basegfx::B2DHomMatrix maTransform
;
58 /// content width and height
59 double mfContentWidth
;
60 double mfContentHeight
;
63 /// flag to allow keeping the aspect ratio
64 bool mbKeepAspectRatio
: 1;
67 /// local decomposition. Implementation will just return children
68 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
72 PagePreviewPrimitive2D(
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& rxDrawPage
,
74 const basegfx::B2DHomMatrix
& rTransform
,
76 double fContentHeight
,
77 const Primitive2DSequence
& rPageContent
,
78 bool bKeepAspectRatio
);
81 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& getXDrawPage() const { return mxDrawPage
; }
82 const Primitive2DSequence
& getPageContent() const { return maPageContent
; }
83 const basegfx::B2DHomMatrix
& getTransform() const { return maTransform
; }
84 double getContentWidth() const { return mfContentWidth
; }
85 double getContentHeight() const { return mfContentHeight
; }
86 bool getKeepAspectRatio() const { return mbKeepAspectRatio
; }
89 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
92 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
95 DeclPrimitive2DIDBlock()
97 } // end of namespace primitive2d
98 } // end of namespace drawinglayer
102 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */