fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / inc / Window.hxx
blob995f71777b83408a699fda1892dafb5a7dcd925f
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 .
20 #ifndef SD_WINDOW_HXX
21 #define SD_WINDOW_HXX
24 #include <tools/gen.hxx>
25 #include <vcl/window.hxx>
26 #include <svtools/transfer.hxx>
28 namespace sd {
30 class ViewShell;
32 /** An SdWindow contains the actual working area of ViewShell.
34 <p>The zoom factor used by this class controls how much the page and the
35 shapes on it are scaled down (<100%) or up (>100%) when displayed on the
36 output device represented by the <type>OutputDevice</type>base class. A
37 zoom factor of 100% would result (with a correctly set DPI value for an
38 output device) in a one to one mapping of the internal coordinates that
39 are stored in 100th of mm. The zoom factor is stored in the map mode
40 member of the <type>OutputDevice</type> base class. It is calculated to
41 be an integer percent value.
43 class Window
44 : public ::Window,
45 public ::DropTargetHelper
47 public:
48 Window (::Window* pParent);
49 virtual ~Window (void);
51 void SetViewShell (ViewShell* pViewSh);
53 /** Set the zoom factor to the specified value and center the display
54 area arround the zoom center.
55 @param nZoom
56 The zoom factor is given as integral percent value.
58 void SetZoomIntegral(long nZoom);
60 /** This internally used method performs the actual adaption of the
61 window's map mode to the specified zoom factor.
62 @param nZoom
63 The zoom factor is given as integral percent value.
64 @return
65 When the given zoom factor lies outside the valid range enclosed
66 by the minimal zoom factor previously calculated by
67 <member>CalcMinZoom</member> and a constant upper value it is
68 forced into that interval. Therefore the returned value is a
69 valid zoom factor.
71 long SetZoomFactor(long nZoom);
73 /** This method is called when the whole page shall be displayed in the
74 window. Position and zoom factor are set so that the given
75 rectangle is displayed as large as possible in the window while at
76 the same time maintaining the rectangle's aspect ratio and adding a
77 small space at all its four sides (about 3% of width and height).
78 The map mode is adapted accordingly.
79 @param rZoomRect
80 The rectangle is expected to be given relative to the upper left
81 corner of the window in logical coordinates (100th of mm).
82 @return
83 The new zoom factor is returned as integral percent value.
85 long SetZoomRect (const Rectangle& rZoomRect);
87 long GetZoomForRect( const Rectangle& rZoomRect );
90 void SetMinZoomAutoCalc (bool bAuto);
91 void SetCalcMinZoomByMinSide (bool bMin);
93 /** Calculate the minimal zoom factor as the value at which the
94 application area would completely fill the window. All values set
95 manually or programatically are set to this value if they are
96 smaller. If the currently used zoom factor is smaller than the minimal zoom
97 factor than set the minimal zoom factor as the new current zoom
98 factor.
100 <p>This calculation is performed only when the
101 <member>bMinZoomAutoCalc</member> is set (to <TRUE/>).</p>
103 void CalcMinZoom (void);
104 void SetMinZoom (long int nMin);
105 long GetMinZoom (void) const;
106 void SetMaxZoom (long int nMax);
107 long GetMaxZoom (void) const;
109 long GetZoom (void) const;
111 Point GetWinViewPos (void) const;
112 Point GetViewOrigin (void) const;
113 Size GetViewSize (void) const;
114 void SetWinViewPos(const Point& rPnt);
115 void SetViewOrigin(const Point& rPnt);
116 void SetViewSize(const Size& rSize);
117 void SetCenterAllowed (bool bIsAllowed);
119 /** Calculate origin of the map mode accoring to the size of the view
120 and window (its size in model coordinates; that takes the zoom
121 factor into account), and the bCenterAllowed flag. When it is not
122 set then nothing is changed. When in any direction the window is
123 larger than the view or the value of aWinPos in this direction is -1
124 then the window is centered in this direction.
126 void UpdateMapOrigin (sal_Bool bInvalidate = sal_True);
128 void UpdateMapMode (void);
130 double GetVisibleX(); // Interface fuer ScrollBars
131 double GetVisibleY();
132 void SetVisibleXY(double fX, double fY);
133 double GetVisibleWidth();
134 double GetVisibleHeight();
135 double GetScrlLineWidth();
136 double GetScrlLineHeight();
137 double GetScrlPageWidth();
138 double GetScrlPageHeight();
139 virtual void GrabFocus();
140 virtual void DataChanged( const DataChangedEvent& rDCEvt );
142 // DropTargetHelper
143 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
144 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
146 /** The DropScroll() method is used by AcceptDrop() to scroll the
147 content of the window while dragging and dropping. With this method
148 you can control whether DropScroll() shall be used.
150 void SetUseDropScroll (bool bUseDropScroll);
151 void DropScroll (const Point& rMousePos);
152 protected:
153 ::sd::Window* mpShareWin;
154 Point maWinPos;
155 Point maViewOrigin;
156 Size maViewSize;
157 Size maPrevSize; // contains previous window size in logical coords
158 sal_uInt16 mnMinZoom;
159 sal_uInt16 mnMaxZoom;
161 /** This flag tells whether to re-calculate the minimal zoom factor
162 depening on the current zoom factor. Its default value is now false.
164 bool mbMinZoomAutoCalc;
165 bool mbCalcMinZoomByMinSide;
166 bool mbCenterAllowed;
167 long mnTicks;
168 bool mbDraggedFrom;
170 ViewShell* mpViewShell;
171 bool mbUseDropScroll;
173 virtual void Resize();
174 virtual void PrePaint();
175 virtual void Paint(const Rectangle& rRect);
176 virtual void KeyInput(const KeyEvent& rKEvt);
177 virtual void MouseMove(const MouseEvent& rMEvt);
178 virtual void MouseButtonUp(const MouseEvent& rMEvt);
179 virtual void MouseButtonDown(const MouseEvent& rMEvt);
180 virtual void Command(const CommandEvent& rCEvt);
181 virtual void RequestHelp( const HelpEvent& rEvt );
182 virtual void LoseFocus();
183 virtual long Notify( NotifyEvent& rNEvt );
185 /** Create an accessibility object that makes this window accessible.
187 @return
188 The returned reference is empty if an accessible object could
189 not be created.
191 virtual ::com::sun::star::uno::Reference<
192 ::com::sun::star::accessibility::XAccessible>
193 CreateAccessible (void);
195 OUString GetSurroundingText() const;
196 Selection GetSurroundingTextSelection() const;
199 } // end of namespace sd
201 #endif
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */