1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: preview.hxx,v $
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
41 class ScPreview
: public Window
45 long nPageNo
; // Seite im Dokument
46 USHORT nZoom
; // eingestellter Zoom
47 Point aOffset
; // positiv
50 BOOL bValid
; // folgende Werte gueltig
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
62 Size aPageSize
; // fuer GetOptimalZoom
66 ScPreviewLocationData
* pLocationData
; // stores table layout for accessibility API
67 FmFormView
* pDrawView
;
74 ScDocShell
* pDocShell
;
75 ScPreviewShell
* pViewShell
;
80 BOOL bBottomRulerMove
;
81 BOOL bHeaderRulerMove
;
82 BOOL bFooterRulerMove
;
84 BOOL bLeftRulerChange
;
85 BOOL bRightRulerChange
;
87 BOOL bBottomRulerChange
;
88 BOOL bHeaderRulerChange
;
89 BOOL bFooterRulerChange
;
93 long nRight
[ MAXCOL
+1 ];
96 SCCOL nColNumberButttonDown
;
97 Point aButtonDownChangePoint
;
104 void CalcPages( SCTAB nToWhichTab
);
106 void UpdateDrawView();
107 void DoPrint( ScPreviewLocationData
* pFillLocation
);
109 void InvalidateLocationData( ULONG nId
);
111 using Window::SetZoom
;
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();
127 ScPreview( Window
* pParent
, ScDocShell
* pDocSh
, ScPreviewShell
* pViewSh
);
130 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
132 void DataChanged(BOOL bNewTime
= FALSE
); // statt Invalidate rufen
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
; }