xref: /aoo41x/main/sd/source/ui/inc/SlideView.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_SLIDE_VIEW_HXX
29 #define SD_SLIDE_VIEW_HXX
30 
31 #include "View.hxx"
32 
33 class SdDrawDocument;
34 class BitmapCache;
35 class SdPage;
36 
37 namespace sd {
38 
39 class SlideViewShell;
40 class Window;
41 
42 // ----------------------
43 // - SlideViewFocusMove -
44 // ----------------------
45 
46 enum SlideViewFocusMove
47 {
48     SLIDEVIEWFOCUSMOVE_NONE = 0,
49     SLIDEVIEWFOCUSMOVE_TOGGLE = 1,
50     SLIDEVIEWFOCUSMOVE_SELECT = 2,
51     SLIDEVIEWFOCUSMOVE_LEFT = 3,
52     SLIDEVIEWFOCUSMOVE_TOP = 4,
53     SLIDEVIEWFOCUSMOVE_RIGHT = 5,
54     SLIDEVIEWFOCUSMOVE_BOTTOM = 6
55 };
56 
57 // ---------------
58 // - SdSlideView -
59 // ---------------
60 
61 class SlideView
62     : public ::sd::View
63 {
64 public:
65     TYPEINFO();
66 
67     SlideView (
68         SdDrawDocument* pDoc,
69         ::Window* pWindow,
70         SlideViewShell* pSlideVShell);
71     virtual ~SlideView (void);
72 
73     void                Select( sal_uInt16 nSdPageNum, sal_Bool bSelect );
74     void                SelectAllSlides( sal_Bool bSelect );
75 
76     void                MoveFocus( SlideViewFocusMove eMove );
77     sal_uInt16              GetFocusPage() const;
78     sal_Bool                HasFocus() const;
79 
80 	sal_uInt16              ChangePagesPerRow( sal_uInt16 nNum );
81 	sal_uInt16              GetPagesPerRow() const { return nPagesPerRow; }
82 
83 	virtual void        InvalidateOneWin( ::Window& rWin );
84 	virtual void        InvalidateOneWin( ::Window& rWin, const Rectangle& rRect );
85 
86 	void                SetAllowInvalidate( sal_Bool bFlag );
87 	sal_Bool                IsInvalidateAllowed() const;
88 
89 	void                Paint(const Rectangle& rRect, OutputDevice* pOut);
90 	void                DrawSelectionRect(sal_uInt16 nPage);
91 
92 	Point	            CalcPagePos( sal_uInt16 nPageNo ) const;
93 	Rectangle           GetPageArea( sal_uInt16 nPageNo ) const;
94 	sal_uLong	            GetPageGap() const;
95 	Rectangle           GetFadeIconArea( sal_uInt16 nPageNo ) const;
96     SdPage*             GetHitPage( const Point& rPos ) const;
97     SdPage*             GetFadePage( const Point& rPos ) const;
98     SdPage*             GetNearestPage( const Point& rPos ) const;
99 
100 	void                DeleteMarked();
101 	void                MoveMarked( sal_uInt16 nTargetPage );
102 
103 	void		            AddToCache( SdPage* pPage, const Bitmap& rBitmap, long nZoom );
104 	const GraphicObject*    GetFromCache( SdPage* pPage, long& rZoom, long nZoomTolerance ) const;
105 
106 	virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
107 
108 	virtual void        DoCut( ::Window* pWindow = NULL );
109 	virtual void        DoCopy( ::Window* pWindow = NULL );
110 	virtual void        DoPaste( ::Window* pWindow = NULL );
111 
112     virtual void        StartDrag( const Point& rDragPt, ::Window* pWindow );
113 	virtual void        DragFinished( sal_Int8 nDropAction );
114 
115     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
116                                     ::sd::Window* pTargetWindow = NULL,
117                                     sal_uInt16 nPage = SDRPAGE_NOTFOUND,
118                                     sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
119 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
120                                      ::sd::Window* pTargetWindow = NULL,
121                                      sal_uInt16 nPage = SDRPAGE_NOTFOUND,
122                                      sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
123 
124 	void 	            UpdateAllPages();
125 
126 private:
127 	Timer				aDelayedPaintTimer;
128 	List				aDelayedPaints;
129 	SlideViewShell*		pSlideViewShell;
130 	BitmapCache*		pCache;
131 	VirtualDevice*		mpVDev;
132 	sal_uInt16				nAllowInvalidateSmph;
133 	sal_uInt16				nPagesPerRow;
134     sal_uInt16              nFocusPage;
135 	sal_Bool				bInPaint;
136 	sal_Bool				bInDelayedPaint;
137 
138 	                    DECL_LINK( PaintDelayed, Timer * );
139     void CreateSlideTransferable (::Window* pWindow, sal_Bool bDrag);
140 };
141 
142 } // end of namespace sd
143 
144 #endif
145