update credits
[LibreOffice.git] / include / svx / graphctl.hxx
blob1d91aa3ddd7e5fb491d42fc02ecadce2cd4105b1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef _GRAPHCTL_HXX
20 #define _GRAPHCTL_HXX
22 #include <vcl/ctrl.hxx>
23 #include <vcl/graph.hxx>
24 #include "svx/svxdllapi.h"
26 #include <svx/svdview.hxx>
27 #include <svx/svdobj.hxx>
29 class GraphCtrlUserCall;
30 class SvxGraphCtrlAccessibleContext;
32 #define WB_SDRMODE ((WinBits)0x0080)
33 #define WB_ANIMATION ((WinBits)0x0100)
35 class SVX_DLLPUBLIC GraphCtrl : public Control
37 friend class GraphCtrlView;
38 friend class GraphCtrlUserCall;
40 Graphic aGraphic;
41 Timer aUpdateTimer;
42 Link aMousePosLink;
43 Link aGraphSizeLink;
44 Link aMarkObjLink;
45 Link aUpdateLink;
46 MapMode aMap100;
47 Size aGraphSize;
48 Point aMousePos;
49 GraphCtrlUserCall* pUserCall;
50 WinBits nWinStyle;
51 SdrObjKind eObjKind;
52 sal_uInt16 nPolyEdit;
53 sal_Bool bEditMode;
54 sal_Bool bSdrMode;
55 sal_Bool bAnim;
57 DECL_LINK( UpdateHdl, Timer* );
59 SvxGraphCtrlAccessibleContext* mpAccContext;
61 protected:
63 SdrModel* pModel;
64 SdrView* pView;
66 virtual void Paint( const Rectangle& rRect );
67 virtual void Resize();
68 virtual void KeyInput(const KeyEvent& rKEvt);
69 virtual void MouseButtonDown(const MouseEvent& rMEvt);
70 virtual void MouseButtonUp(const MouseEvent& rMEvt);
71 virtual void MouseMove(const MouseEvent& rMEvt);
73 virtual void InitSdrModel();
75 virtual void SdrObjCreated( const SdrObject& rObj );
76 virtual void SdrObjChanged( const SdrObject& rObj );
77 virtual void MarkListHasChanged();
79 SdrObjUserCall* GetSdrUserCall() { return (SdrObjUserCall*) pUserCall; }
81 public:
83 GraphCtrl( Window* pParent, const ResId& rResId );
84 ~GraphCtrl();
86 void SetWinStyle( WinBits nWinBits );
87 WinBits GetWinStyle() const { return nWinStyle; }
89 void SetGraphic( const Graphic& rGraphic, sal_Bool bNewModel = sal_True );
90 const Graphic& GetGraphic() const { return aGraphic; }
91 const Size& GetGraphicSize() const { return aGraphSize; }
93 const Point& GetMousePos() const { return aMousePos; }
95 void SetEditMode( const sal_Bool bEditMode );
96 sal_Bool IsEditMode() const { return bEditMode; }
98 void SetPolyEditMode( const sal_uInt16 nPolyEdit );
99 sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
101 void SetObjKind( const SdrObjKind eObjKind );
102 SdrObjKind GetObjKind() const { return eObjKind; }
104 SdrModel* GetSdrModel() const { return pModel; }
105 SdrView* GetSdrView() const { return pView; }
106 SdrObject* GetSelectedSdrObject() const;
107 sal_Bool IsChanged() const { return bSdrMode ? pModel->IsChanged() : sal_False; }
109 void SetMousePosLink( const Link& rLink ) { aMousePosLink = rLink; }
110 const Link& GetMousePosLink() const { return aMousePosLink; }
112 void SetGraphSizeLink( const Link& rLink ) { aGraphSizeLink = rLink; }
113 const Link& GetGraphSizeLink() const { return aGraphSizeLink; }
115 void SetMarkObjLink( const Link& rLink ) { aMarkObjLink = rLink; }
116 const Link& GetMarkObjLink() const { return aMarkObjLink; }
118 void SetUpdateLink( const Link& rLink ) { aUpdateLink = rLink; }
119 const Link& GetUpdateLink() const { return aUpdateLink; }
121 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
125 class GraphCtrlUserCall : public SdrObjUserCall
127 GraphCtrl& rWin;
129 public:
131 GraphCtrlUserCall( GraphCtrl& rGraphWin ) : rWin( rGraphWin ) {};
132 virtual ~GraphCtrlUserCall() {};
134 virtual void Changed( const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect );
137 class GraphCtrlView : public SdrView
139 GraphCtrl& rGraphCtrl;
141 protected:
143 virtual void MarkListHasChanged()
145 SdrView::MarkListHasChanged();
146 rGraphCtrl.MarkListHasChanged();
149 public:
151 GraphCtrlView( SdrModel* pModel, GraphCtrl* pWindow) :
152 SdrView ( pModel, pWindow ),
153 rGraphCtrl ( *pWindow ) {};
155 virtual ~GraphCtrlView() {};
158 #endif // _GRAPHCTL_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */