LibreOffice Module svx (master) 1
graphctl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_SVX_GRAPHCTL_HXX
20#define INCLUDED_SVX_GRAPHCTL_HXX
21
22#include <vcl/graph.hxx>
23#include <vcl/customweld.hxx>
24#include <svx/svxdllapi.h>
25
26#include <svx/svdview.hxx>
27#include <svx/svdobj.hxx>
28
29class GraphCtrl;
30
32{
34
35public:
36
38 : rWin(rGraphWin)
39 {}
40
41 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
42};
43
45
47{
48 friend class GraphCtrlView;
49 friend class GraphCtrlUserCall;
50
60 std::unique_ptr<GraphCtrlUserCall> pUserCall;
62 sal_uInt16 nPolyEdit;
67
68 DECL_DLLPRIVATE_LINK( UpdateHdl, Timer*, void );
69
71
72protected:
73
74 std::unique_ptr<SdrModel> pModel;
75 std::unique_ptr<SdrView> pView;
76
77 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
78 virtual void Resize() override;
79 virtual bool KeyInput(const KeyEvent& rKEvt) override;
80 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
81 virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
82 virtual bool MouseMove(const MouseEvent& rMEvt) override;
83
84 virtual void InitSdrModel();
85
86 virtual void SdrObjCreated( const SdrObject& rObj );
87 virtual void SdrObjChanged( const SdrObject& rObj );
88 virtual void MarkListHasChanged();
89
90 void GraphicToVD();
91
92 SdrObjUserCall* GetSdrUserCall() { return pUserCall.get(); }
93
94public:
95
96 GraphCtrl(weld::Dialog* pDialog);
97 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
98 virtual ~GraphCtrl() override;
99
100 void SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
101 const Graphic& GetGraphic() const { return aGraphic; }
102 const Size& GetGraphicSize() const { return aGraphSize; }
103
104 const Point& GetMousePos() const { return aMousePos; }
105
106 void SetEditMode( const bool bEditMode );
107
108 void SetPolyEditMode( const sal_uInt16 nPolyEdit );
109 sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
110
111 void SetObjKind( const SdrObjKind eObjKind );
112
113 SdrModel* GetSdrModel() const { return pModel.get(); }
114 SdrView* GetSdrView() const { return pView.get(); }
115 SdrObject* GetSelectedSdrObject() const;
116 bool IsChanged() const { return mbSdrMode && pModel->IsChanged(); }
117
118 void SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
119
120 void SetGraphSizeLink( const Link<GraphCtrl*,void>& rLink ) { aGraphSizeLink = rLink; }
121
122 void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
123 void QueueIdleUpdate();
124
125 void SetSdrMode(bool b);
126
127 Point GetPositionInDialog() const;
128 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
129};
130
131class GraphCtrlView final : public SdrView
132{
134
135 virtual void MarkListHasChanged() override
136 {
139 }
140
141public:
142 GraphCtrlView(SdrModel& rSdrModel, GraphCtrl* pWindow)
143 : SdrView(rSdrModel, &pWindow->GetDrawingArea()->get_ref_device())
144 , rGraphCtrl(*pWindow)
145 {
146 }
147
148 virtual ~GraphCtrlView() override;
149
150 // override these so we can get the occasions SdrPaintView would call Window::Invalidate on its vcl::Window
151 // if it had one, and route to WidgetController::Invalidate instead
153 virtual void InvalidateOneWin(OutputDevice& rWin) override;
154 virtual void InvalidateOneWin(OutputDevice& rWin, const tools::Rectangle& rRect) override;
155};
156
157#endif // INCLUDED_SVX_GRAPHCTL_HXX
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GraphCtrl & rWin
Definition: graphctl.hxx:33
GraphCtrlUserCall(GraphCtrl &rGraphWin)
Definition: graphctl.hxx:37
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
Definition: graphctl.cxx:34
virtual void MarkListHasChanged() override
Definition: graphctl.hxx:135
virtual void InvalidateOneWin(OutputDevice &rWin) override
If the View should not call Invalidate() on the windows, override the following 2 methods and do some...
Definition: graphctl.cxx:795
virtual rtl::Reference< sdr::overlay::OverlayManager > CreateOverlayManager(OutputDevice &rDevice) const override
Definition: graphctl.cxx:783
virtual ~GraphCtrlView() override
Definition: graphctl.cxx:817
GraphCtrlView(SdrModel &rSdrModel, GraphCtrl *pWindow)
Definition: graphctl.hxx:142
GraphCtrl & rGraphCtrl
Definition: graphctl.hxx:133
SdrObjUserCall * GetSdrUserCall()
Definition: graphctl.hxx:92
weld::Dialog * mpDialog
Definition: graphctl.hxx:66
bool IsChanged() const
Definition: graphctl.hxx:116
ScopedVclPtrInstance< VirtualDevice > xVD
Definition: graphctl.hxx:52
bool bEditMode
Definition: graphctl.hxx:63
SdrModel * GetSdrModel() const
Definition: graphctl.hxx:113
bool mbInIdleUpdate
Definition: graphctl.hxx:65
Size aGraphSize
Definition: graphctl.hxx:58
std::unique_ptr< GraphCtrlUserCall > pUserCall
Definition: graphctl.hxx:60
sal_uInt16 GetPolyEditMode() const
Definition: graphctl.hxx:109
MapMode aMap100
Definition: graphctl.hxx:57
void SetGraphSizeLink(const Link< GraphCtrl *, void > &rLink)
Definition: graphctl.hxx:120
std::unique_ptr< SdrView > pView
Definition: graphctl.hxx:75
void SetMousePosLink(const Link< GraphCtrl *, void > &rLink)
Definition: graphctl.hxx:118
bool mbSdrMode
Definition: graphctl.hxx:64
std::unique_ptr< SdrModel > pModel
Definition: graphctl.hxx:74
virtual void MarkListHasChanged()
Definition: graphctl.cxx:280
Idle aUpdateIdle
Definition: graphctl.hxx:53
SdrObjKind eObjKind
Definition: graphctl.hxx:61
void SetUpdateLink(const Link< GraphCtrl *, void > &rLink)
Definition: graphctl.hxx:122
Point aMousePos
Definition: graphctl.hxx:59
Link< GraphCtrl *, void > aMousePosLink
Definition: graphctl.hxx:54
const Graphic & GetGraphic() const
Definition: graphctl.hxx:101
Link< GraphCtrl *, void > aUpdateLink
Definition: graphctl.hxx:56
const Point & GetMousePos() const
Definition: graphctl.hxx:104
Link< GraphCtrl *, void > aGraphSizeLink
Definition: graphctl.hxx:55
DECL_DLLPRIVATE_LINK(UpdateHdl, Timer *, void)
SdrView * GetSdrView() const
Definition: graphctl.hxx:114
rtl::Reference< SvxGraphCtrlAccessibleContext > mpAccContext
Definition: graphctl.hxx:70
sal_uInt16 nPolyEdit
Definition: graphctl.hxx:62
const Size & GetGraphicSize() const
Definition: graphctl.hxx:102
Graphic aGraphic
Definition: graphctl.hxx:51
virtual void MarkListHasChanged() override
Definition: svdedxv.cxx:2647
Abstract DrawObject.
Definition: svdobj.hxx:260
virtual bool KeyInput(const KeyEvent &)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
virtual bool MouseMove(const MouseEvent &)
virtual bool MouseButtonDown(const MouseEvent &)
virtual bool MouseButtonUp(const MouseEvent &)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
DocumentType eType
SdrUserCallType
Definition: svdobj.hxx:112
SdrObjKind
Definition: svdobjkind.hxx:25
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28