source: trunk/Lucide/gui/docViewer.h @ 398

Last change on this file since 398 was 398, checked in by dmik, 12 years ago

Fixed: The mouse pointer could be auto-hidden in fullscreen while the file open dialog is shown.

File size: 8.4 KB
RevLine 
[35]1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: CDDL 1.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the COMMON DEVELOPMENT AND
5 * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6 * this file except in compliance with the License. You may obtain a copy of
7 * the License at http://www.sun.com/cddl/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Initial Developer of the Original Code is
15 * Eugene Romanenko, netlabs.org.
16 * Portions created by the Initial Developer are Copyright (C) 2006
17 * the Initial Developer. All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * Alternatively, the contents of this file may be used under the terms of
22 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
23 * in which case the provisions of the LGPL are applicable instead of those
[285]24 * above. If you wish to allow use of your version of this file only under the
[35]25 * terms of the LGPL, and not to allow others to use your version of this file
26 * under the terms of the CDDL, indicate your decision by deleting the
27 * provisions above and replace them with the notice and other provisions
28 * required by the LGPL. If you do not delete the provisions above, a recipient
[285]29 * may use your version of this file under the terms of any one of the CDDL
[35]30 * or the LGPL.
31 *
32 * ***** END LICENSE BLOCK ***** */
33
34
[2]35#ifndef __DOCVIEWER_H
36#define __DOCVIEWER_H
37
38#include <vector>
39
40#include <ludoc.xh>
[18]41#include "lucide.h"
[2]42
43class ProgressDlg;
[341]44class LuInputText;
[2]45
46struct LuSize  { double x, y; };
47
48struct PageDrawArea
49{
50    long   pagenum;
51    LuSize startpos;
52    RECTL  drawrect;
53};
54
[325]55struct PageInputFields
56{
57    LuDocument_LuInputFieldSequence *fields;
58
59    struct Cache
60    {
61        LuRectangle *rect;
62        LuInputField_Type type;
[348]63        bool supported;
[351]64        bool modified;
[325]65    };
66
67    Cache *cache;
[348]68
69    void fillCache( int i );
[325]70};
71
[17]72typedef std::vector<PageDrawArea> DrawAreas;
[2]73
74class DocumentViewer
75{
76    public:
[91]77        DocumentViewer( HWND hWndFrame );
[2]78        virtual ~DocumentViewer();
79
[50]80        void setPageLayout( PgLayout layout );
[266]81        PgLayout getPageLayout() { return layout; }
[18]82
[72]83        HWND getFrameHWND() { return hWndDocFrame; }
84        HWND getViewHWND() { return hWndDoc; }
[2]85
86        void setDocument( LuDocument *_doc );
[351]87        bool close( bool force = false );
[2]88        void goToPage( long page );
[87]89        long getCurrentPage() { return currentpage; }  // Zero based
[2]90        void setZoom( double _zoom );
91        double getZoom() { return zoom; }
92        double getRealZoom() { return realzoom; }
[122]93        void setZoomMode( bool _zoomMode ) { zoomMode = _zoomMode; }
94        bool isZoomMode() { return zoomMode; }
[55]95        void setRotation( long _rotation );
96        long getRotation() { return rotation; }
[40]97        void selectAll();
[398]98        void unhideMouse();
[2]99        void copyToClipbrd();
100        void searchDocument( const char *_searchString, bool _caseSensitive,
101                             bool _continueSearch );
[72]102        void setFullscreen( bool _fullscreen );
[212]103        void zoomInOut( bool zoomIn );
[355]104        void resetModifiedState();
[2]105
[91]106        static void registerClass();
[17]107
[2]108        // Internal stuffs
109    private:
110
111        void drawPage();
112        void adjustSize();
[285]113        void countPagesizes();
[2]114
[268]115        MRESULT vertScroll( HWND hwnd, MPARAM mp2 );
116        MRESULT horizScroll( HWND hwnd, MPARAM mp2 );
[25]117        MRESULT wmDragOver( PDRAGINFO dragInfo );
[285]118        void wmDrop( PDRAGINFO dragInfo );
119        void wmSize( HWND hwnd, MPARAM mp2 );
[2]120        void wmPaint( HWND hwnd );
121        void wmPaintCont( HWND hwnd );
122        void wmPaintAsynch( HWND hwnd );
[18]123        void wmPaintContAsynch( HWND hwnd );
[22]124        void wmButton1Down( HWND hwnd, SHORT xpos, SHORT ypos );
[23]125        void wmButton1Up();
[268]126        void wmButton2Down( HWND hwnd, SHORT xpos, SHORT ypos );
127        void wmButton2Up();
[2]128        BOOL wmMouseMove( HWND hwnd, SHORT xpos, SHORT ypos );
129        BOOL wmClick( HWND hwnd, SHORT xpos, SHORT ypos );
[285]130        BOOL wmRightClick( HWND hwnd, SHORT xpos, SHORT ypos );
[2]131        BOOL wmChar( HWND hwnd, MPARAM mp1, MPARAM mp2 );
[285]132        void wmTimer( USHORT idTimer );
[341]133        void wmControl( USHORT idControl, USHORT notifyCode, HWND hwndControl );
[2]134        void winPosToDocPos( PPOINTL startpoint, PPOINTL endpoint, LuRectangle *r );
[22]135        void winPosToDocPos( PageDrawArea *pda, LuRectangle *r );
[59]136        void docPosToWinPos( long pagenum, LuRectangle *r, PRECTL rcl );
137        void rotateRectangle( long pagenum, LuRectangle *r );
138        HRGN rectsToRegion( long pagenum, HPS hps, LuDocument_LuRectSequence *rects );
[19]139        void drawSelection( long pagenum, HPS hps, PRECTL r );
[268]140        void scrollToPos( HWND hwnd, LONG xpos, LONG ypos, bool withSelection );
[22]141        void freeRects( LuDocument_LuRectSequence **rects );
[17]142        void freeLinks();
[324]143        void freeInputFields();
[19]144        void drawFound( long pagenum, HPS hps, PRECTL r );
[22]145        DrawAreas *findDrawAreas( PRECTL r );
[17]146        void determineCurrentPage();
147        long posToPagenum( LONG yPosWin, double *pageRest );
148        double pagenumToPos( long pagenum );
[86]149        bool isRotated() { return ( (rotation==90) || (rotation==270) ); }
[266]150        bool isContinuous() { return ( layout == Continuous ); };
[351]151        void showTextField( long page, long index, PRECTL r = NULL );
[341]152        void positionTextField( PRECTL r = NULL );
[352]153        void hideTextField( bool apply = true, PPOINTL ptl = NULL );
[2]154
155        static MRESULT EXPENTRY docViewProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
[67]156        static MRESULT EXPENTRY docFrameProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
[2]157        static void searchthread( void *p );
158        static void searchabort( void *p );
159        static void drawthread( void *p );
160        static long _System asynchCallbackFnDraw( void *data );
161        static long _System asynchCallbackFnAbort( void *data );
162
163        LuDocument *doc;
164        HWND hMainFrame;
165        HWND hWndDocFrame;
166        HWND hWndDoc;
[346]167        HWND hWndEntry;
168        HWND hWndMLE;
[341]169        LuInputText *textField;
170        long textFieldPage;
[351]171        long textFieldIndex;
[390]172        PFNWP oldFrameProc;
[2]173        HWND hWndHscroll;
174        HWND hWndVscroll;
175        SHORT sHscrollMax;
176        SHORT sVscrollMax;
177        SHORT sHscrollPos;
178        SHORT sVscrollPos;
179        LONG  sVscrollInc;
180        LONG  sHscrollInc;
181        ULONG realVscrollMax;
182        LONG  cxClient;
183        LONG  cyClient;
184        LONG  spos_x;
185        LONG  spos_y;
186        HPS hpsBuffer;
187        HDC hdcBuffer;
188        LuPixbuf *pixbuf;
[27]189        short bpp;
[2]190        double width, height, zoom, realzoom, fullwidth, fullheight;
[122]191        boolean zoomMode;
[55]192        long rotation;
[2]193        long totalpages, currentpage;
194        ProgressDlg *progressDlg;
[17]195        DrawAreas *drawareas;
196        int drawareaIndex;
[50]197        bool closed;
[61]198        bool drawPS;
[266]199        PgLayout layout;
[268]200
201        // mouse drag using right button
202        bool docDraggingStarted;
203        POINTL docDraggingStart;
204        POINTL docDraggingEnd;
[285]205
[72]206        // fullscreen
207        bool fullscreen;
[241]208        bool mouseHidden;
[398]209        bool inFocus;
[241]210        SHORT xLastPos;
211        SHORT yLastPos;
[72]212        PgLayout pglSave;
213        double zoomSave;
[2]214
215        // continuous view
216        LuSize *pagesizes;
217        SHORT VScrollStep;
[18]218        RECTL savedRcl;
[2]219
220        // asynch draw
221        bool enableAsynchDraw;
222        HMTX todrawAccess;
223        HEV  haveDraw;
224        bool abortAsynch;
225        bool termdraw;
226        TID  drawThreadId;
227
228        // selection
229        bool mousePressed;
230        POINTL selectionStart;
231        POINTL selectionEnd;
[23]232        LuRectangle *selection;
[22]233        LuDocument_LuRectSequence **selrects;
[2]234
235        // links
[17]236        LuDocument_LuLinkMapSequence **links;
[2]237
[324]238        // input fields
[325]239        PageInputFields *inputFields;
[324]240
[2]241        // search
242        LuDocument_LuRectSequence **foundrects;
243        char *searchString;
244        bool caseSensitive;
245        bool continueSearch;
246        bool abortSearch;
[285]247
[122]248        // pointers
249        HPOINTER handPtr;
[268]250        HPOINTER handClosedPtr;
[122]251        HPOINTER zoomInPtr;
252        HPOINTER zoomOutPtr;
[324]253        HPOINTER textPtr;
[2]254};
255
256#endif // __DOCVIEWER_H
[17]257
Note: See TracBrowser for help on using the repository browser.