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 .
19 #ifndef INCLUDED_SVX_GRAPHCTL_HXX
20 #define INCLUDED_SVX_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
;
42 Link
<GraphCtrl
*,void> aMousePosLink
;
43 Link
<GraphCtrl
*,void> aGraphSizeLink
;
44 Link
<GraphCtrl
*,void> aUpdateLink
;
48 GraphCtrlUserCall
* pUserCall
;
57 DECL_LINK( UpdateHdl
, Timer
*, void );
59 rtl::Reference
<SvxGraphCtrlAccessibleContext
> mpAccContext
;
66 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
67 virtual void Resize() override
;
68 virtual void KeyInput(const KeyEvent
& rKEvt
) override
;
69 virtual void MouseButtonDown(const MouseEvent
& rMEvt
) override
;
70 virtual void MouseButtonUp(const MouseEvent
& rMEvt
) override
;
71 virtual void MouseMove(const MouseEvent
& rMEvt
) override
;
73 virtual void InitSdrModel();
75 virtual void SdrObjCreated( const SdrObject
& rObj
);
76 virtual void SdrObjChanged( const SdrObject
& rObj
);
77 virtual void MarkListHasChanged();
79 inline SdrObjUserCall
* GetSdrUserCall();
83 GraphCtrl( vcl::Window
* pParent
, WinBits nStyle
);
84 virtual ~GraphCtrl() override
;
85 virtual void dispose() override
;
87 void SetWinStyle( WinBits nWinBits
);
89 void SetGraphic( const Graphic
& rGraphic
, bool bNewModel
= 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 bool bEditMode
);
97 void SetPolyEditMode( const sal_uInt16 nPolyEdit
);
98 sal_uInt16
GetPolyEditMode() const { return nPolyEdit
; }
100 void SetObjKind( const SdrObjKind eObjKind
);
102 SdrModel
* GetSdrModel() const { return pModel
; }
103 SdrView
* GetSdrView() const { return pView
; }
104 SdrObject
* GetSelectedSdrObject() const;
105 bool IsChanged() const { return bSdrMode
&& pModel
->IsChanged(); }
107 void SetMousePosLink( const Link
<GraphCtrl
*,void>& rLink
) { aMousePosLink
= rLink
; }
109 void SetGraphSizeLink( const Link
<GraphCtrl
*,void>& rLink
) { aGraphSizeLink
= rLink
; }
111 void SetUpdateLink( const Link
<GraphCtrl
*,void>& rLink
) { aUpdateLink
= rLink
; }
112 void QueueIdleUpdate();
114 virtual css::uno::Reference
< css::accessibility::XAccessible
> CreateAccessible() override
;
118 class GraphCtrlUserCall
: public SdrObjUserCall
124 GraphCtrlUserCall(GraphCtrl
& rGraphWin
)
128 virtual void Changed(const SdrObject
& rObj
, SdrUserCallType eType
, const tools::Rectangle
& rOldBoundRect
) override
;
131 SdrObjUserCall
* GraphCtrl::GetSdrUserCall()
136 class GraphCtrlView
: public SdrView
138 GraphCtrl
& rGraphCtrl
;
142 virtual void MarkListHasChanged() override
144 SdrView::MarkListHasChanged();
145 rGraphCtrl
.MarkListHasChanged();
149 GraphCtrlView(SdrModel
* pModel
, GraphCtrl
* pWindow
)
150 : SdrView(pModel
, pWindow
)
151 , rGraphCtrl(*pWindow
)
155 #endif // INCLUDED_SVX_GRAPHCTL_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */