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_CONTROLPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <basegfx/matrix/b2dhommatrix.hxx>
36 : : #include <com/sun/star/awt/XControlModel.hpp>
37 : : #include <com/sun/star/awt/XControl.hpp>
38 : :
39 : : //////////////////////////////////////////////////////////////////////////////
40 : :
41 : : namespace drawinglayer
42 : : {
43 : : namespace primitive2d
44 : : {
45 : : /** ControlPrimitive2D class
46 : :
47 : : Base class for ControlPrimitive handling. It decoposes to a
48 : : graphical representation (Bitmap data) of the control. This
49 : : representation is limited to a quadratic pixel maximum defined
50 : : in the applicatin settings.
51 : : */
52 [ + - ][ - + ]: 8346 : class DRAWINGLAYER_DLLPUBLIC ControlPrimitive2D : public BufferedDecompositionPrimitive2D
53 : : {
54 : : private:
55 : : /// object's base data
56 : : basegfx::B2DHomMatrix maTransform;
57 : : com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel;
58 : :
59 : : /// the created an cached awt::XControl
60 : : com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxXControl;
61 : :
62 : : /// the last used scaling, used from getDecomposition for buffering
63 : : basegfx::B2DVector maLastViewScaling;
64 : :
65 : : /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl
66 : : and from thereon always used and returned by getXControl()
67 : : */
68 : : void createXControl();
69 : :
70 : : /// single local decompositions, used from create2DDecomposition()
71 : : Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
72 : : Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
73 : :
74 : : protected:
75 : : /// local decomposition
76 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
77 : :
78 : : public:
79 : : /// constructor
80 : : ControlPrimitive2D(
81 : : const basegfx::B2DHomMatrix& rTransform,
82 : : const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel);
83 : :
84 : : /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time
85 : : if it exists. This will avoid to create a 2nd one on demand in createXControl()
86 : : and thus double the XControls.
87 : : */
88 : : ControlPrimitive2D(
89 : : const basegfx::B2DHomMatrix& rTransform,
90 : : const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel,
91 : : const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& rxXControl);
92 : :
93 : : /// data read access
94 : 6000 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
95 : 7065 : const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; }
96 : :
97 : : /** mxControl access. This will on demand create the awt::XControl using createXControl()
98 : : if it does not exist. It may already have been created or even handed over at
99 : : incarnation
100 : : */
101 : : const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const;
102 : :
103 : : /// compare operator
104 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
105 : :
106 : : /// get range
107 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
108 : :
109 : : /// provide unique ID
110 : : DeclPrimitrive2DIDBlock()
111 : :
112 : : /// Overload standard getDecomposition call to be view-dependent here
113 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
114 : : };
115 : : } // end of namespace primitive2d
116 : : } // end of namespace drawinglayer
117 : :
118 : : //////////////////////////////////////////////////////////////////////////////
119 : :
120 : : #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|