xref: /trunk/main/sd/source/ui/inc/SlideView.hxx (revision c45d927a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_SLIDE_VIEW_HXX
25 #define SD_SLIDE_VIEW_HXX
26 
27 #include "View.hxx"
28 
29 class SdDrawDocument;
30 class BitmapCache;
31 class SdPage;
32 
33 namespace sd {
34 
35 class SlideViewShell;
36 class Window;
37 
38 // ----------------------
39 // - SlideViewFocusMove -
40 // ----------------------
41 
42 enum SlideViewFocusMove
43 {
44     SLIDEVIEWFOCUSMOVE_NONE = 0,
45     SLIDEVIEWFOCUSMOVE_TOGGLE = 1,
46     SLIDEVIEWFOCUSMOVE_SELECT = 2,
47     SLIDEVIEWFOCUSMOVE_LEFT = 3,
48     SLIDEVIEWFOCUSMOVE_TOP = 4,
49     SLIDEVIEWFOCUSMOVE_RIGHT = 5,
50     SLIDEVIEWFOCUSMOVE_BOTTOM = 6
51 };
52 
53 // ---------------
54 // - SdSlideView -
55 // ---------------
56 
57 class SlideView
58     : public ::sd::View
59 {
60 public:
61     TYPEINFO();
62 
63     SlideView (
64         SdDrawDocument* pDoc,
65         ::Window* pWindow,
66         SlideViewShell* pSlideVShell);
67     virtual ~SlideView (void);
68 
69     void                Select( sal_uInt16 nSdPageNum, sal_Bool bSelect );
70     void                SelectAllSlides( sal_Bool bSelect );
71 
72     void                MoveFocus( SlideViewFocusMove eMove );
73     sal_uInt16              GetFocusPage() const;
74     sal_Bool                HasFocus() const;
75 
76 	sal_uInt16              ChangePagesPerRow( sal_uInt16 nNum );
77 	sal_uInt16              GetPagesPerRow() const { return nPagesPerRow; }
78 
79 	virtual void        InvalidateOneWin( ::Window& rWin );
80 	virtual void        InvalidateOneWin( ::Window& rWin, const Rectangle& rRect );
81 
82 	void                SetAllowInvalidate( sal_Bool bFlag );
83 	sal_Bool                IsInvalidateAllowed() const;
84 
85 	void                Paint(const Rectangle& rRect, OutputDevice* pOut);
86 	void                DrawSelectionRect(sal_uInt16 nPage);
87 
88 	Point	            CalcPagePos( sal_uInt16 nPageNo ) const;
89 	Rectangle           GetPageArea( sal_uInt16 nPageNo ) const;
90 	sal_uLong	            GetPageGap() const;
91 	Rectangle           GetFadeIconArea( sal_uInt16 nPageNo ) const;
92     SdPage*             GetHitPage( const Point& rPos ) const;
93     SdPage*             GetFadePage( const Point& rPos ) const;
94     SdPage*             GetNearestPage( const Point& rPos ) const;
95 
96 	void                DeleteMarked();
97 	void                MoveMarked( sal_uInt16 nTargetPage );
98 
99 	void		            AddToCache( SdPage* pPage, const Bitmap& rBitmap, long nZoom );
100 	const GraphicObject*    GetFromCache( SdPage* pPage, long& rZoom, long nZoomTolerance ) const;
101 
102 	virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
103 
104 	virtual void        DoCut( ::Window* pWindow = NULL );
105 	virtual void        DoCopy( ::Window* pWindow = NULL );
106 	virtual void        DoPaste( ::Window* pWindow = NULL );
107 
108     virtual void        StartDrag( const Point& rDragPt, ::Window* pWindow );
109 	virtual void        DragFinished( sal_Int8 nDropAction );
110 
111     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTargetHelper,
112                                     ::sd::Window* pTargetWindow = NULL,
113                                     sal_uInt16 nPage = SDRPAGE_NOTFOUND,
114                                     sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
115 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTargetHelper,
116                                      ::sd::Window* pTargetWindow = NULL,
117                                      sal_uInt16 nPage = SDRPAGE_NOTFOUND,
118                                      sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
119 
120 	void 	            UpdateAllPages();
121 
122 private:
123 	Timer				aDelayedPaintTimer;
124 	List				aDelayedPaints;
125 	SlideViewShell*		pSlideViewShell;
126 	BitmapCache*		pCache;
127 	VirtualDevice*		mpVDev;
128 	sal_uInt16				nAllowInvalidateSmph;
129 	sal_uInt16				nPagesPerRow;
130     sal_uInt16              nFocusPage;
131 	sal_Bool				bInPaint;
132 	sal_Bool				bInDelayedPaint;
133 
134 	                    DECL_LINK( PaintDelayed, Timer * );
135     void CreateSlideTransferable (::Window* pWindow, sal_Bool bDrag);
136 };
137 
138 } // end of namespace sd
139 
140 #endif
141