summaryrefslogtreecommitdiff
path: root/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx
blob: 1c2f8e3e9ae0f790e254b26a9fb67138e18358b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: viewinformation2d.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: aw $ $Date: 2008-02-07 13:41:57 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX

// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
// pre-declarations of com/sun/star namespace), include sal/config.h here
// where sun is redefined as 'sun' (so i guess the problem is known).
#ifndef _SAL_CONFIG_H_
#include <sal/config.h>
#endif

#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/Sequence.h>
#endif

#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif

#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGE_HPP_
#include <com/sun/star/drawing/XDrawPage.hpp>
#endif

//////////////////////////////////////////////////////////////////////////////
// predefines

namespace drawinglayer { namespace {
    class ImpViewInformation2D;
}}

namespace basegfx {
    class B2DHomMatrix;
    class B2DRange;
}

//////////////////////////////////////////////////////////////////////////////

namespace drawinglayer
{
    namespace geometry
    {
        class ViewInformation2D
        {
        private:
            // impl pointer
            ImpViewInformation2D*                   mpViewInformation2D;

        public:
            // constructor to easily build a ViewInformation2D when all view
            // information is available as basegfx implementation classes. The
            // ExtendedParameters allows adding extra parameters besides ViewTransformation,
            // Viewport and ViewTime and should not itself include one of these.
            ViewInformation2D(
                const basegfx::B2DHomMatrix& rViewTransformation,
                const basegfx::B2DRange& rViewport,
                const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
                double fViewTime,
                const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);

            // constructor to create a ViewInformation2D based on API information only. The
            // ViewParameters can contain ViewTransformation, Viewport and ViewTime but also
            // other parameters which will be preserved in the ExtendedInformation. The three
            // named information will be extracted locally for faster access.
            ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);

            // copy constructor
            ViewInformation2D(const ViewInformation2D& rCandidate);

            // destructor
            ~ViewInformation2D();

            // assignment operator
            ViewInformation2D& operator=(const ViewInformation2D& rCandidate);

            // data access
            const basegfx::B2DHomMatrix& getViewTransformation() const;
            const basegfx::B2DRange& getViewport() const;
            double getViewTime() const;

            // get the DrawPage which is visualized. Tjhis is needed e.g. for the
            // view-dependent decomposition of PageNumber Fields in Texts
            const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& ViewInformation2D::getVisualizedPage() const;

            // data access with on-demand preparations
            const basegfx::B2DHomMatrix& getInverseViewTransformation() const;
            const basegfx::B2DRange& getDiscreteViewport() const;

            // get the uno::Sequence< beans::PropertyValue > which contains all information. When
            // constructed using the API constructor, You will get back Your input. If not, the
            // needed sequence will be constructed including the extended informations.
            const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;

            // get the uno::Sequence< beans::PropertyValue > which contains only extra information. This means
            // information different from ViewTransformation, Viewport and ViewTime.
            const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
        };
    } // end of namespace geometry
} // end of namespace drawinglayer

//////////////////////////////////////////////////////////////////////////////

#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX

// eof