LibreOffice Module sd (master) 1
Window.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
20#pragma once
21
22#include <tools/gen.hxx>
23#include <tools/long.hxx>
24#include <vcl/DocWindow.hxx>
25#include <vcl/transfer.hxx>
26
27class OutlinerView;
28
29namespace sd
30{
31class ViewShell;
32
44class Window : public vcl::DocWindow, public ::DropTargetHelper
45{
46public:
47 Window(vcl::Window* pParent);
48 virtual ~Window() override;
49 virtual void dispose() override;
50
51 void SetViewShell(ViewShell* pViewSh);
53
60
73
86 ::tools::Long SetZoomRect(const ::tools::Rectangle& rZoomRect);
87
88 ::tools::Long GetZoomForRect(const ::tools::Rectangle& rZoomRect);
89
90 void SetMinZoomAutoCalc(bool bAuto);
91
102 void CalcMinZoom();
103 void SetMinZoom(::tools::Long nMin);
105 void SetMaxZoom(::tools::Long nMax);
107
108 ::tools::Long GetZoom() const;
109
110 const Point& GetWinViewPos() const { return maWinPos; }
111 const Point& GetViewOrigin() const { return maViewOrigin; }
112 const Size& GetViewSize() const { return maViewSize; }
113 void SetWinViewPos(const Point& rPnt);
114 void SetViewOrigin(const Point& rPnt);
115 void SetViewSize(const Size& rSize);
116 void SetCenterAllowed(bool bIsAllowed);
117
125 void UpdateMapOrigin(bool bInvalidate = true);
126
127 void UpdateMapMode();
128
129 double GetVisibleX() const; // interface for ScrollBars
130 double GetVisibleY() const;
131 void SetVisibleXY(double fX, double fY);
132 double GetVisibleWidth() const;
133 double GetVisibleHeight() const;
135 double GetScrlLineWidth() const;
136 double GetScrlLineHeight() const;
137 double GetScrlPageWidth() const;
138 double GetScrlPageHeight() const;
139 void GrabFocus();
140 virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
141
142 // DropTargetHelper
143 virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override;
144 virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override;
145
150 void SetUseDropScroll(bool bUseDropScroll);
151 void DropScroll(const Point& rMousePos);
152 virtual void KeyInput(const KeyEvent& rKEvt) override;
153
154private:
156
157protected:
161 Size maPrevSize; // contains previous window size in logical coords
162 sal_uInt16 mnMinZoom;
163 sal_uInt16 mnMaxZoom;
164
171
174
175 virtual void Resize() override;
176 virtual void PrePaint(vcl::RenderContext& rRenderContext) override;
177 virtual void Paint(vcl::RenderContext& rRenderContext,
178 const ::tools::Rectangle& rRect) override;
179 virtual void MouseMove(const MouseEvent& rMEvt) override;
180 virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
181 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
182 virtual void Command(const CommandEvent& rCEvt) override;
183 virtual void RequestHelp(const HelpEvent& rEvt) override;
184 virtual void LoseFocus() override;
185 virtual bool EventNotify(NotifyEvent& rNEvt) override;
186
193 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
194
195 OUString GetSurroundingText() const override;
196 Selection GetSurroundingTextSelection() const override;
197 bool DeleteSurroundingText(const Selection& rSelection) override;
198
200 void LogicInvalidate(const ::tools::Rectangle* pRectangle) override;
201
202 FactoryFunction GetUITestFactory() const override;
203};
204
205} // end of namespace sd
206
207/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
sal_uInt16 mnMinZoom
Definition: Window.hxx:162
const Point & GetWinViewPos() const
Definition: Window.hxx:110
::tools::Long mnTicks
Definition: Window.hxx:170
void DropScroll(const Point &rMousePos)
Definition: sdwindow.cxx:915
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: sdwindow.cxx:883
double GetVisibleWidth() const
Definition: sdwindow.cxx:667
::tools::Long SetZoomFactor(::tools::Long nZoom)
This internally used method performs the actual adaptation of the window's map mode to the specified ...
Definition: sdwindow.cxx:331
bool DeleteSurroundingText(const Selection &rSelection) override
Definition: sdwindow.cxx:1015
double GetScrlPageHeight() const
Definition: sdwindow.cxx:733
Size maViewSize
Definition: Window.hxx:160
OUString GetSurroundingText() const override
Definition: sdwindow.cxx:999
void GrabFocus()
Activate window.
Definition: sdwindow.cxx:750
Point maViewOrigin
Definition: Window.hxx:159
Selection GetSurroundingTextSelection() const override
Definition: sdwindow.cxx:1007
double GetVisibleX() const
Definition: sdwindow.cxx:631
virtual void LoseFocus() override
Deactivate window.
Definition: sdwindow.cxx:741
double GetVisibleY() const
Definition: sdwindow.cxx:640
FactoryFunction GetUITestFactory() const override
Definition: sdwindow.cxx:1048
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: sdwindow.cxx:898
sal_uInt16 mnMaxZoom
Definition: Window.hxx:163
void UpdateMapMode()
Definition: sdwindow.cxx:583
virtual void PrePaint(vcl::RenderContext &rRenderContext) override
Definition: sdwindow.cxx:204
void SetViewShell(ViewShell *pViewSh)
Definition: sdwindow.cxx:113
void SetViewSize(const Size &rSize)
Set size of the whole working area which can be seen with the window.
Definition: sdwindow.cxx:320
void CalcMinZoom()
Calculate the minimal zoom factor as the value at which the application area would completely fill th...
Definition: sdwindow.cxx:140
void SetMaxZoom(::tools::Long nMax)
Definition: sdwindow.cxx:178
double GetVisibleHeight() const
Definition: sdwindow.cxx:680
virtual ~Window() override
Definition: sdwindow.cxx:96
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: sdwindow.cxx:210
Size maPrevSize
Definition: Window.hxx:161
void SetUseDropScroll(bool bUseDropScroll)
The DropScroll() method is used by AcceptDrop() to scroll the content of the window while dragging an...
Definition: sdwindow.cxx:910
::tools::Long GetMaxZoom() const
Definition: Window.hxx:106
bool mbMinZoomAutoCalc
This flag tells whether to re-calculate the minimal zoom factor depending on the current zoom factor.
Definition: Window.hxx:168
void SetCenterAllowed(bool bIsAllowed)
Definition: sdwindow.cxx:326
const Point & GetViewOrigin() const
Definition: Window.hxx:111
double GetScrlLineHeight() const
Definition: sdwindow.cxx:715
::tools::Long GetMinZoom() const
Definition: Window.hxx:104
void SetMinZoomAutoCalc(bool bAuto)
Definition: sdwindow.cxx:526
void SetMinZoom(::tools::Long nMin)
Definition: sdwindow.cxx:173
ViewShell * GetViewShell()
Definition: sdwindow.cxx:135
virtual void dispose() override
Definition: sdwindow.cxx:101
::tools::Long GetZoomForRect(const ::tools::Rectangle &rZoomRect)
Definition: sdwindow.cxx:388
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: sdwindow.cxx:216
void LogicInvalidate(const ::tools::Rectangle *pRectangle) override
Definition: sdwindow.cxx:1023
bool mbUseDropScroll
Definition: Window.hxx:173
void SetWinViewPos(const Point &rPnt)
Set the position of the upper left corner from the visible area of the window.
Definition: sdwindow.cxx:304
::tools::Long SetZoomRect(const ::tools::Rectangle &rZoomRect)
This method is called when the whole page shall be displayed in the window.
Definition: sdwindow.cxx:447
Window(vcl::Window *pParent)
Definition: sdwindow.cxx:62
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: sdwindow.cxx:756
Point maWinPos
Definition: Window.hxx:158
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: sdwindow.cxx:281
virtual void Command(const CommandEvent &rCEvt) override
Definition: sdwindow.cxx:259
virtual void RequestHelp(const HelpEvent &rEvt) override
Definition: sdwindow.cxx:294
void SetViewOrigin(const Point &rPnt)
Set origin of the representation in respect to the whole working area.
Definition: sdwindow.cxx:312
::tools::Long GetZoom() const
Definition: sdwindow.cxx:183
double GetScrlPageWidth() const
Definition: sdwindow.cxx:724
Point GetVisibleCenter()
Definition: sdwindow.cxx:689
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Create an accessibility object that makes this window accessible.
Definition: sdwindow.cxx:958
double GetScrlLineWidth() const
Definition: sdwindow.cxx:706
void SetVisibleXY(double fX, double fY)
Set x and y position of the visible area as fraction (< 1) of the whole working area.
Definition: sdwindow.cxx:649
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: sdwindow.cxx:251
OutlinerView * GetOutlinerView() const
Definition: sdwindow.cxx:983
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: sdwindow.cxx:239
bool mbCenterAllowed
Definition: Window.hxx:169
void UpdateMapOrigin(bool bInvalidate=true)
Calculate origin of the map mode according to the size of the view and window (its size in model coor...
Definition: sdwindow.cxx:536
ViewShell * mpViewShell
Definition: Window.hxx:172
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: sdwindow.cxx:245
void SetZoomIntegral(::tools::Long nZoom)
Set the zoom factor to the specified value and center the display area around the zoom center.
Definition: sdwindow.cxx:364
const Size & GetViewSize() const
Definition: Window.hxx:112
virtual void Resize() override
Definition: sdwindow.cxx:195
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
long Long
signed char sal_Int8