source: trunk/Lucide/gui/docViewer.h

Last change on this file was 678, checked in by Gregg Young, 3 years ago

Fix memory leak in "Save" code. Reduce "Save screen noise. Add Last link origin for navigating back from taking a hyper link. Ticket 309 Additional Spanish translation from Alfredo. Make help instance code tolerate a "\" on the end of the install path.

File size: 9.1 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;
[649]45class LuInputChoice;
[2]46
47struct LuSize  { double x, y; };
48
49struct PageDrawArea
50{
51    long   pagenum;
52    LuSize startpos;
53    RECTL  drawrect;
54};
55
[325]56struct PageInputFields
57{
58    LuDocument_LuInputFieldSequence *fields;
59
60    struct Cache
61    {
62        LuRectangle *rect;
63        LuInputField_Type type;
[348]64        bool supported;
[351]65        bool modified;
[325]66    };
67
68    Cache *cache;
[348]69
70    void fillCache( int i );
[325]71};
72
[17]73typedef std::vector<PageDrawArea> DrawAreas;
[2]74
75class DocumentViewer
76{
77    public:
[91]78        DocumentViewer( HWND hWndFrame );
[2]79        virtual ~DocumentViewer();
80
[50]81        void setPageLayout( PgLayout layout );
[266]82        PgLayout getPageLayout() { return layout; }
[18]83
[72]84        HWND getFrameHWND() { return hWndDocFrame; }
85        HWND getViewHWND() { return hWndDoc; }
[2]86
[678]87        short getVscrollPos() { return sVscrollPos; }
88        short getHscrollPos() { return sHscrollPos; }
[2]89        void setDocument( LuDocument *_doc );
[351]90        bool close( bool force = false );
[2]91        void goToPage( long page );
[87]92        long getCurrentPage() { return currentpage; }  // Zero based
[678]93        long getPreviousPage() { return previouspage; }  // Zero based
94        void unsetPreviousPage() { previouspage = -1; }
[2]95        void setZoom( double _zoom );
96        double getZoom() { return zoom; }
97        double getRealZoom() { return realzoom; }
[122]98        void setZoomMode( bool _zoomMode ) { zoomMode = _zoomMode; }
99        bool isZoomMode() { return zoomMode; }
[55]100        void setRotation( long _rotation );
101        long getRotation() { return rotation; }
[40]102        void selectAll();
[398]103        void unhideMouse();
[2]104        void copyToClipbrd();
105        void searchDocument( const char *_searchString, bool _caseSensitive,
[450]106                             bool _continueSearch, bool _findBack );
[399]107        void setPresentation( bool _presentation );
[212]108        void zoomInOut( bool zoomIn );
[355]109        void resetModifiedState();
[2]110
[91]111        static void registerClass();
[17]112
[678]113        MRESULT vertScroll( HWND hwnd, MPARAM mp2 );
114        MRESULT horizScroll( HWND hwnd, MPARAM mp2 );
[2]115        // Internal stuffs
116    private:
117
118        void drawPage();
119        void adjustSize();
[285]120        void countPagesizes();
[678]121       
[25]122        MRESULT wmDragOver( PDRAGINFO dragInfo );
[285]123        void wmDrop( PDRAGINFO dragInfo );
124        void wmSize( HWND hwnd, MPARAM mp2 );
[2]125        void wmPaint( HWND hwnd );
126        void wmPaintCont( HWND hwnd );
127        void wmPaintAsynch( HWND hwnd );
[18]128        void wmPaintContAsynch( HWND hwnd );
[22]129        void wmButton1Down( HWND hwnd, SHORT xpos, SHORT ypos );
[23]130        void wmButton1Up();
[268]131        void wmButton2Down( HWND hwnd, SHORT xpos, SHORT ypos );
132        void wmButton2Up();
[2]133        BOOL wmMouseMove( HWND hwnd, SHORT xpos, SHORT ypos );
134        BOOL wmClick( HWND hwnd, SHORT xpos, SHORT ypos );
[285]135        BOOL wmRightClick( HWND hwnd, SHORT xpos, SHORT ypos );
[2]136        BOOL wmChar( HWND hwnd, MPARAM mp1, MPARAM mp2 );
[285]137        void wmTimer( USHORT idTimer );
[341]138        void wmControl( USHORT idControl, USHORT notifyCode, HWND hwndControl );
[2]139        void winPosToDocPos( PPOINTL startpoint, PPOINTL endpoint, LuRectangle *r );
[22]140        void winPosToDocPos( PageDrawArea *pda, LuRectangle *r );
[59]141        void docPosToWinPos( long pagenum, LuRectangle *r, PRECTL rcl );
142        void rotateRectangle( long pagenum, LuRectangle *r );
143        HRGN rectsToRegion( long pagenum, HPS hps, LuDocument_LuRectSequence *rects );
[19]144        void drawSelection( long pagenum, HPS hps, PRECTL r );
[268]145        void scrollToPos( HWND hwnd, LONG xpos, LONG ypos, bool withSelection );
[22]146        void freeRects( LuDocument_LuRectSequence **rects );
[17]147        void freeLinks();
[324]148        void freeInputFields();
[19]149        void drawFound( long pagenum, HPS hps, PRECTL r );
[22]150        DrawAreas *findDrawAreas( PRECTL r );
[17]151        void determineCurrentPage();
152        long posToPagenum( LONG yPosWin, double *pageRest );
153        double pagenumToPos( long pagenum );
[86]154        bool isRotated() { return ( (rotation==90) || (rotation==270) ); }
[266]155        bool isContinuous() { return ( layout == Continuous ); };
[351]156        void showTextField( long page, long index, PRECTL r = NULL );
[341]157        void positionTextField( PRECTL r = NULL );
[352]158        void hideTextField( bool apply = true, PPOINTL ptl = NULL );
[649]159        void showChoiceField( long page, long index, PRECTL r = NULL );
160        void positionChoiceField( PRECTL r = NULL );
161        void hideChoiceField( bool apply = true, PPOINTL ptl = NULL );
[2]162
163        static MRESULT EXPENTRY docViewProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
[67]164        static MRESULT EXPENTRY docFrameProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
[2]165        static void searchthread( void *p );
166        static void searchabort( void *p );
167        static void drawthread( void *p );
168        static long _System asynchCallbackFnDraw( void *data );
169        static long _System asynchCallbackFnAbort( void *data );
170
171        LuDocument *doc;
172        HWND hMainFrame;
173        HWND hWndDocFrame;
[645]174        HWND hWndPopupMenu;
[2]175        HWND hWndDoc;
[346]176        HWND hWndEntry;
177        HWND hWndMLE;
[649]178        HWND hWndList;
[678]179        HWND hWndBubble;
[341]180        LuInputText *textField;
[649]181        LuInputChoice *choiceField;
[341]182        long textFieldPage;
[351]183        long textFieldIndex;
[649]184        long choiceFieldPage;
185        long choiceFieldIndex;
[390]186        PFNWP oldFrameProc;
[2]187        HWND hWndHscroll;
188        HWND hWndVscroll;
189        SHORT sHscrollMax;
190        SHORT sVscrollMax;
191        SHORT sHscrollPos;
192        SHORT sVscrollPos;
193        LONG  sVscrollInc;
194        LONG  sHscrollInc;
195        ULONG realVscrollMax;
196        LONG  cxClient;
197        LONG  cyClient;
198        LONG  spos_x;
199        LONG  spos_y;
200        HPS hpsBuffer;
201        HDC hdcBuffer;
202        LuPixbuf *pixbuf;
[27]203        short bpp;
[2]204        double width, height, zoom, realzoom, fullwidth, fullheight;
[122]205        boolean zoomMode;
[55]206        long rotation;
[678]207        long totalpages, currentpage, previouspage;
[2]208        ProgressDlg *progressDlg;
[17]209        DrawAreas *drawareas;
210        int drawareaIndex;
[50]211        bool closed;
[61]212        bool drawPS;
[266]213        PgLayout layout;
[268]214
215        // mouse drag using right button
216        bool docDraggingStarted;
217        POINTL docDraggingStart;
218        POINTL docDraggingEnd;
[285]219
[399]220        // presentation
221        bool presentation;
[241]222        bool mouseHidden;
[398]223        bool inFocus;
[241]224        SHORT xLastPos;
225        SHORT yLastPos;
[72]226        PgLayout pglSave;
227        double zoomSave;
[2]228
229        // continuous view
230        LuSize *pagesizes;
231        SHORT VScrollStep;
[18]232        RECTL savedRcl;
[2]233
234        // asynch draw
235        bool enableAsynchDraw;
236        HMTX todrawAccess;
237        HEV  haveDraw;
238        bool abortAsynch;
239        bool termdraw;
240        TID  drawThreadId;
241
242        // selection
243        bool mousePressed;
244        POINTL selectionStart;
245        POINTL selectionEnd;
[23]246        LuRectangle *selection;
[22]247        LuDocument_LuRectSequence **selrects;
[2]248
249        // links
[17]250        LuDocument_LuLinkMapSequence **links;
[2]251
[324]252        // input fields
[325]253        PageInputFields *inputFields;
[324]254
[2]255        // search
256        LuDocument_LuRectSequence **foundrects;
257        char *searchString;
258        bool caseSensitive;
259        bool continueSearch;
[450]260        bool findBack;
[2]261        bool abortSearch;
[285]262
[122]263        // pointers
264        HPOINTER handPtr;
[268]265        HPOINTER handClosedPtr;
[122]266        HPOINTER zoomInPtr;
267        HPOINTER zoomOutPtr;
[324]268        HPOINTER textPtr;
[2]269};
270
271#endif // __DOCVIEWER_H
[17]272
Note: See TracBrowser for help on using the repository browser.