Files
libreoffice/sd/source/ui/inc/Window.hxx

221 lines
8.0 KiB
C++
Raw Normal View History

2010-10-27 12:53:26 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SD_WINDOW_HXX
#define SD_WINDOW_HXX
#include <tools/gen.hxx>
#include <vcl/window.hxx>
#include <svtools/transfer.hxx>
namespace sd {
class ViewShell;
// Since we removed all old SV-stuff, there is no brush any more
// and so there is no BRUSH_SIZE defined in VCL.
// So I define it here
// #i2237#
// removed old stuff here which still forced zoom to be
// %BRUSH_SIZE which is outdated now
//#define BRUSH_SIZE 8
/** An SdWindow contains the actual working area of ViewShell.
<p>The zoom factor used by this class controls how much the page and the
shapes on it are scaled down (<100%) or up (>100%) when displayed on the
output device represented by the <type>OutputDevice</type>base class. A
zoom factor of 100% would result (with a correctly set DPI value for an
output device) in a one to one mapping of the internal coordinates that
are stored in 100th of mm. The zoom factor is stored in the map mode
member of the <type>OutputDevice</type> base class. It is calculated to
be an integer percent value.
*/
class Window
: public ::Window,
public ::DropTargetHelper
{
public:
Window (::Window* pParent);
virtual ~Window (void);
void SetViewShell (ViewShell* pViewSh);
/** Set the zoom factor to the specified value and center the display
area arround the zoom center.
@param nZoom
The zoom factor is given as integral percent value.
*/
void SetZoomIntegral(long nZoom);
/** This internally used method performs the actual adaption of the
window's map mode to the specified zoom factor.
@param nZoom
The zoom factor is given as integral percent value.
@return
When the given zoom factor lies outside the valid range enclosed
by the minimal zoom factor previously calculated by
<member>CalcMinZoom</member> and a constant upper value it is
forced into that interval. Therefore the returned value is a
valid zoom factor.
*/
long SetZoomFactor(long nZoom);
/** This method is called when the whole page shall be displayed in the
window. Position and zoom factor are set so that the given
rectangle is displayed as large as possible in the window while at
the same time maintaining the rectangle's aspect ratio and adding a
small space at all its four sides (about 3% of width and height).
The map mode is adapted accordingly.
@param rZoomRect
The rectangle is expected to be given relative to the upper left
corner of the window in logical coordinates (100th of mm).
@return
The new zoom factor is returned as integral percent value.
*/
long SetZoomRect (const Rectangle& rZoomRect);
2008-10-29 11:47:54 +00:00
long GetZoomForRect( const Rectangle& rZoomRect );
void SetMinZoomAutoCalc (bool bAuto);
void SetCalcMinZoomByMinSide (bool bMin);
/** Calculate the minimal zoom factor as the value at which the
application area would completely fill the window. All values set
manually or programatically are set to this value if they are
smaller. If the currently used zoom factor is smaller than the minimal zoom
factor than set the minimal zoom factor as the new current zoom
factor.
<p>This calculation is performed only when the
<member>bMinZoomAutoCalc</member> is set (to <TRUE/>).</p>
*/
void CalcMinZoom (void);
void SetMinZoom (long int nMin);
long GetMinZoom (void) const;
void SetMaxZoom (long int nMax);
long GetMaxZoom (void) const;
long GetZoom (void) const;
Point GetWinViewPos (void) const;
Point GetViewOrigin (void) const;
Size GetViewSize (void) const;
void SetWinViewPos(const Point& rPnt);
void SetViewOrigin(const Point& rPnt);
void SetViewSize(const Size& rSize);
void SetCenterAllowed (bool bIsAllowed);
/** Calculate origin of the map mode accoring to the size of the view
and window (its size in model coordinates; that takes the zoom
factor into account), and the bCenterAllowed flag. When it is not
set then nothing is changed. When in any direction the window is
larger than the view or the value of aWinPos in this direction is -1
then the window is centered in this direction.
*/
void UpdateMapOrigin (sal_Bool bInvalidate = sal_True);
void UpdateMapMode (void);
double GetVisibleX(); // Interface fuer ScrollBars
double GetVisibleY();
void SetVisibleXY(double fX, double fY);
double GetVisibleWidth();
double GetVisibleHeight();
double GetScrlLineWidth();
double GetScrlLineHeight();
double GetScrlPageWidth();
double GetScrlPageHeight();
virtual void GrabFocus();
virtual void DataChanged( const DataChangedEvent& rDCEvt );
// DropTargetHelper
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
/** The DropScroll() method is used by AcceptDrop() to scroll the
content of the window while dragging and dropping. With this method
you can control whether DropScroll() shall be used.
*/
void SetUseDropScroll (bool bUseDropScroll);
void DropScroll (const Point& rMousePos);
protected:
::sd::Window* mpShareWin;
Point maWinPos;
Point maViewOrigin;
Size maViewSize;
2011-03-13 06:22:49 -05:00
Size maPrevSize; // contains previous window size in logical coords
sal_uInt16 mnMinZoom;
sal_uInt16 mnMaxZoom;
/** This flag tells whether to re-calculate the minimal zoom factor
depening on the current zoom factor. Its default value is now sal_False.
*/
bool mbMinZoomAutoCalc;
bool mbCalcMinZoomByMinSide;
bool mbCenterAllowed;
long mnTicks;
bool mbDraggedFrom;
ViewShell* mpViewShell;
bool mbUseDropScroll;
virtual void Resize();
virtual void PrePaint();
virtual void Paint(const Rectangle& rRect);
virtual void KeyInput(const KeyEvent& rKEvt);
virtual void MouseMove(const MouseEvent& rMEvt);
virtual void MouseButtonUp(const MouseEvent& rMEvt);
virtual void MouseButtonDown(const MouseEvent& rMEvt);
virtual void Command(const CommandEvent& rCEvt);
virtual void RequestHelp( const HelpEvent& rEvt );
virtual void LoseFocus();
virtual long Notify( NotifyEvent& rNEvt );
/** Create an accessibility object that makes this window accessible.
@return
The returned reference is empty if an accessible object could
not be created.
*/
virtual ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>
CreateAccessible (void);
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
rtl::OUString GetSurroundingText() const;
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
Selection GetSurroundingTextSelection() const;
};
} // end of namespace sd
#endif
2010-10-27 12:53:26 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */