update dev300-m57
[ooovba.git] / sc / source / ui / inc / preview.hxx
blob848f22e9785fa4e5563049f956242c35a71faa67
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: preview.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SC_PREVIEW_HXX
31 #define SC_PREVIEW_HXX
34 #include <vcl/window.hxx>
35 #include "printfun.hxx" // ScPrintState
37 class ScDocShell;
38 class ScPreviewShell;
39 class FmFormView;
41 class ScPreview : public Window
43 private:
44 // eingestellt:
45 long nPageNo; // Seite im Dokument
46 USHORT nZoom; // eingestellter Zoom
47 Point aOffset; // positiv
49 // berechnet:
50 BOOL bValid; // folgende Werte gueltig
51 SCTAB nTabCount;
52 SCTAB nTabsTested; // fuer wieviele Tabellen ist nPages gueltig?
53 long nPages[MAXTABCOUNT];
54 long nFirstAttr[MAXTABCOUNT];
55 SCTAB nTab; // Tabelle
56 long nTabPage; // Seite von Tabelle
57 long nTabStart; // erste Seite der Tabelle (wirklich)
58 long nDisplayStart; // dito, relativ zum Anfang der Zaehlung
59 Date aDate;
60 Time aTime;
61 long nTotalPages;
62 Size aPageSize; // fuer GetOptimalZoom
63 BOOL bStateValid;
64 BOOL bLocationValid;
65 ScPrintState aState;
66 ScPreviewLocationData* pLocationData; // stores table layout for accessibility API
67 FmFormView* pDrawView;
69 SCTAB nCurTab;
71 // intern:
72 BOOL bInPaint;
73 BOOL bInGetState;
74 ScDocShell* pDocShell;
75 ScPreviewShell* pViewShell;
77 BOOL bLeftRulerMove;
78 BOOL bRightRulerMove;
79 BOOL bTopRulerMove;
80 BOOL bBottomRulerMove;
81 BOOL bHeaderRulerMove;
82 BOOL bFooterRulerMove;
84 BOOL bLeftRulerChange;
85 BOOL bRightRulerChange;
86 BOOL bTopRulerChange;
87 BOOL bBottomRulerChange;
88 BOOL bHeaderRulerChange;
89 BOOL bFooterRulerChange;
90 BOOL bPageMargin;
91 BOOL bColRulerMove;
92 ScRange aPageArea;
93 long nRight[ MAXCOL+1 ];
94 long nLeftPosition;
95 long mnScale;
96 SCCOL nColNumberButttonDown;
97 Point aButtonDownChangePoint;
98 Point aButtonDownPt;
99 Point aButtonUpPt;
100 long nHeaderHeight;
101 long nFooterHeight;
103 void TestLastPage();
104 void CalcPages( SCTAB nToWhichTab );
105 void RecalcPages();
106 void UpdateDrawView();
107 void DoPrint( ScPreviewLocationData* pFillLocation );
109 void InvalidateLocationData( ULONG nId );
111 using Window::SetZoom;
113 protected:
114 virtual void Paint( const Rectangle& rRect );
115 virtual void Command( const CommandEvent& rCEvt );
116 virtual void KeyInput( const KeyEvent& rKEvt );
117 virtual void MouseMove( const MouseEvent& rMEvt );
118 virtual void MouseButtonDown( const MouseEvent& rMEvt );
119 virtual void MouseButtonUp( const MouseEvent& rMEvt );
121 virtual void GetFocus();
122 virtual void LoseFocus();
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
126 public:
127 ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh );
128 ~ScPreview();
130 virtual void DataChanged( const DataChangedEvent& rDCEvt );
132 void DataChanged(BOOL bNewTime = FALSE); // statt Invalidate rufen
133 void DoInvalidate();
135 void SetXOffset( long nX );
136 void SetYOffset( long nY );
137 void SetZoom(USHORT nNewZoom);
138 void SetPageNo( long nPage );
140 BOOL GetPageMargins()const { return bPageMargin; }
141 void SetPageMargins( BOOL bVal ) { bPageMargin = bVal; }
142 void DrawInvert( long nDragPos, USHORT nFlags );
143 void DragMove( long nDragMovePos, USHORT nFlags );
146 const ScPreviewLocationData& GetLocationData();
148 String GetPosString();
150 long GetPageNo() const { return nPageNo; }
151 USHORT GetZoom() const { return nZoom; }
152 Point GetOffset() const { return aOffset; }
154 SCTAB GetTab() { if (!bValid) { CalcPages(0); RecalcPages(); } return nTab; }
155 long GetTotalPages() { if (!bValid) { CalcPages(0); RecalcPages(); } return nTotalPages; }
157 BOOL AllTested() const { return bValid && nTabsTested >= nTabCount; }
159 USHORT GetOptimalZoom(BOOL bWidthOnly);
160 long GetFirstPage(SCTAB nTab);
162 void CalcAll() { CalcPages(MAXTAB); }
163 void SetInGetState(BOOL bSet) { bInGetState = bSet; }
165 DECL_STATIC_LINK( ScPreview, InvalidateHdl, void* );
166 static void StaticInvalidate();
168 FmFormView* GetDrawView() { return pDrawView; }
173 #endif