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 : : #ifndef _GRAPHCTL_HXX
29 : : #define _GRAPHCTL_HXX
30 : :
31 : : #include <vcl/ctrl.hxx>
32 : : #include <vcl/graph.hxx>
33 : : #include "svx/svxdllapi.h"
34 : :
35 : : #include <svx/svdview.hxx>
36 : : #include <svx/svdobj.hxx>
37 : :
38 : : class GraphCtrlUserCall;
39 : : class SvxGraphCtrlAccessibleContext;
40 : :
41 : : #define WB_SDRMODE ((WinBits)0x0080)
42 : : #define WB_ANIMATION ((WinBits)0x0100)
43 : :
44 : : class SVX_DLLPUBLIC GraphCtrl : public Control
45 : : {
46 : : friend class GraphCtrlView;
47 : : friend class GraphCtrlUserCall;
48 : :
49 : : Graphic aGraphic;
50 : : Timer aUpdateTimer;
51 : : Link aMousePosLink;
52 : : Link aGraphSizeLink;
53 : : Link aMarkObjLink;
54 : : Link aUpdateLink;
55 : : MapMode aMap100;
56 : : Size aGraphSize;
57 : : Point aMousePos;
58 : : GraphCtrlUserCall* pUserCall;
59 : : WinBits nWinStyle;
60 : : SdrObjKind eObjKind;
61 : : sal_uInt16 nPolyEdit;
62 : : sal_Bool bEditMode;
63 : : sal_Bool bSdrMode;
64 : : sal_Bool bAnim;
65 : :
66 : : DECL_LINK( UpdateHdl, Timer* );
67 : :
68 : : SvxGraphCtrlAccessibleContext* mpAccContext;
69 : :
70 : : protected:
71 : :
72 : : SdrModel* pModel;
73 : : SdrView* pView;
74 : :
75 : : virtual void Paint( const Rectangle& rRect );
76 : : virtual void Resize();
77 : : virtual void KeyInput(const KeyEvent& rKEvt);
78 : : virtual void MouseButtonDown(const MouseEvent& rMEvt);
79 : : virtual void MouseButtonUp(const MouseEvent& rMEvt);
80 : : virtual void MouseMove(const MouseEvent& rMEvt);
81 : :
82 : : virtual void InitSdrModel();
83 : :
84 : : virtual void SdrObjCreated( const SdrObject& rObj );
85 : : virtual void SdrObjChanged( const SdrObject& rObj );
86 : : virtual void MarkListHasChanged();
87 : :
88 : : SdrObjUserCall* GetSdrUserCall() { return (SdrObjUserCall*) pUserCall; }
89 : :
90 : : public:
91 : :
92 : : GraphCtrl( Window* pParent, const ResId& rResId );
93 : : ~GraphCtrl();
94 : :
95 : : void SetWinStyle( WinBits nWinBits );
96 : : WinBits GetWinStyle() const { return nWinStyle; }
97 : :
98 : : void SetGraphic( const Graphic& rGraphic, sal_Bool bNewModel = sal_True );
99 : : const Graphic& GetGraphic() const { return aGraphic; }
100 : : const Size& GetGraphicSize() const { return aGraphSize; }
101 : :
102 : : const Point& GetMousePos() const { return aMousePos; }
103 : :
104 : : void SetEditMode( const sal_Bool bEditMode );
105 : : sal_Bool IsEditMode() const { return bEditMode; }
106 : :
107 : : void SetPolyEditMode( const sal_uInt16 nPolyEdit );
108 : : sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
109 : :
110 : : void SetObjKind( const SdrObjKind eObjKind );
111 : : SdrObjKind GetObjKind() const { return eObjKind; }
112 : :
113 : : SdrModel* GetSdrModel() const { return pModel; }
114 : : SdrView* GetSdrView() const { return pView; }
115 : : SdrObject* GetSelectedSdrObject() const;
116 : : sal_Bool IsChanged() const { return bSdrMode ? pModel->IsChanged() : sal_False; }
117 : :
118 : : void SetMousePosLink( const Link& rLink ) { aMousePosLink = rLink; }
119 : : const Link& GetMousePosLink() const { return aMousePosLink; }
120 : :
121 : : void SetGraphSizeLink( const Link& rLink ) { aGraphSizeLink = rLink; }
122 : : const Link& GetGraphSizeLink() const { return aGraphSizeLink; }
123 : :
124 : : void SetMarkObjLink( const Link& rLink ) { aMarkObjLink = rLink; }
125 : : const Link& GetMarkObjLink() const { return aMarkObjLink; }
126 : :
127 : : void SetUpdateLink( const Link& rLink ) { aUpdateLink = rLink; }
128 : : const Link& GetUpdateLink() const { return aUpdateLink; }
129 : :
130 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
131 : : };
132 : :
133 : :
134 : : class GraphCtrlUserCall : public SdrObjUserCall
135 : : {
136 : : GraphCtrl& rWin;
137 : :
138 : : public:
139 : :
140 : : GraphCtrlUserCall( GraphCtrl& rGraphWin ) : rWin( rGraphWin ) {};
141 [ # # ]: 0 : virtual ~GraphCtrlUserCall() {};
142 : :
143 : : virtual void Changed( const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect );
144 : : };
145 : :
146 : : class GraphCtrlView : public SdrView
147 : : {
148 : : GraphCtrl& rGraphCtrl;
149 : :
150 : : protected:
151 : :
152 : 0 : virtual void MarkListHasChanged()
153 : : {
154 : 0 : SdrView::MarkListHasChanged();
155 : 0 : rGraphCtrl.MarkListHasChanged();
156 : 0 : }
157 : :
158 : : public:
159 : :
160 : : GraphCtrlView( SdrModel* pModel, GraphCtrl* pWindow) :
161 : : SdrView ( pModel, pWindow ),
162 : : rGraphCtrl ( *pWindow ) {};
163 : :
164 [ # # ]: 0 : virtual ~GraphCtrlView() {};
165 : : };
166 : :
167 : : #endif // _GRAPHCTL_HXX
168 : :
169 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|