xref: /trunk/main/sc/source/ui/inc/preview.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir #ifndef SC_PREVIEW_HXX
24cdf0e10cSrcweir #define SC_PREVIEW_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/window.hxx>
28cdf0e10cSrcweir #include "printfun.hxx"     // ScPrintState
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class ScDocShell;
31cdf0e10cSrcweir class ScPreviewShell;
32cdf0e10cSrcweir class FmFormView;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class ScPreview : public Window
35cdf0e10cSrcweir {
36cdf0e10cSrcweir private:
37cdf0e10cSrcweir                                         // eingestellt:
38cdf0e10cSrcweir     long            nPageNo;            // Seite im Dokument
39cdf0e10cSrcweir     sal_uInt16          nZoom;              // eingestellter Zoom
40cdf0e10cSrcweir     Point           aOffset;            // positiv
41cdf0e10cSrcweir 
42cdf0e10cSrcweir                                         // berechnet:
43cdf0e10cSrcweir     sal_Bool            bValid;             // folgende Werte gueltig
44cdf0e10cSrcweir     SCTAB           nTabCount;
45cdf0e10cSrcweir     SCTAB           nTabsTested;        // fuer wieviele Tabellen ist nPages gueltig?
46cdf0e10cSrcweir     long            nPages[MAXTABCOUNT];
47cdf0e10cSrcweir     long            nFirstAttr[MAXTABCOUNT];
48cdf0e10cSrcweir     SCTAB           nTab;               // Tabelle
49cdf0e10cSrcweir     long            nTabPage;           // Seite von Tabelle
50cdf0e10cSrcweir     long            nTabStart;          // erste Seite der Tabelle (wirklich)
51cdf0e10cSrcweir     long            nDisplayStart;      // dito, relativ zum Anfang der Zaehlung
52cdf0e10cSrcweir     Date            aDate;
53cdf0e10cSrcweir     Time            aTime;
54cdf0e10cSrcweir     long            nTotalPages;
55cdf0e10cSrcweir     Size            aPageSize;          // fuer GetOptimalZoom
56cdf0e10cSrcweir     sal_Bool            bStateValid;
57cdf0e10cSrcweir     sal_Bool            bLocationValid;
58cdf0e10cSrcweir     ScPrintState    aState;
59cdf0e10cSrcweir     ScPreviewLocationData* pLocationData;   // stores table layout for accessibility API
60cdf0e10cSrcweir     FmFormView*     pDrawView;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir                                         // intern:
63cdf0e10cSrcweir     bool            bInPaint;
64cdf0e10cSrcweir     bool            bInSetZoom;
65cdf0e10cSrcweir     sal_Bool        bInGetState;
66cdf0e10cSrcweir     ScDocShell*     pDocShell;
67cdf0e10cSrcweir     ScPreviewShell* pViewShell;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     sal_Bool            bLeftRulerMove;
70cdf0e10cSrcweir     sal_Bool            bRightRulerMove;
71cdf0e10cSrcweir     sal_Bool            bTopRulerMove;
72cdf0e10cSrcweir     sal_Bool            bBottomRulerMove;
73cdf0e10cSrcweir     sal_Bool            bHeaderRulerMove;
74cdf0e10cSrcweir     sal_Bool            bFooterRulerMove;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     sal_Bool            bLeftRulerChange;
77cdf0e10cSrcweir     sal_Bool            bRightRulerChange;
78cdf0e10cSrcweir     sal_Bool            bTopRulerChange;
79cdf0e10cSrcweir     sal_Bool            bBottomRulerChange;
80cdf0e10cSrcweir     sal_Bool            bHeaderRulerChange;
81cdf0e10cSrcweir     sal_Bool            bFooterRulerChange;
82cdf0e10cSrcweir     sal_Bool            bPageMargin;
83cdf0e10cSrcweir     sal_Bool            bColRulerMove;
84cdf0e10cSrcweir     ScRange         aPageArea;
85cdf0e10cSrcweir     long            nRight[ MAXCOL+1 ];
86cdf0e10cSrcweir     long            nLeftPosition;
87cdf0e10cSrcweir     long            mnScale;
88cdf0e10cSrcweir     SCCOL           nColNumberButttonDown;
89cdf0e10cSrcweir     Point           aButtonDownChangePoint;
90cdf0e10cSrcweir     Point           aButtonDownPt;
91cdf0e10cSrcweir     Point           aButtonUpPt;
92cdf0e10cSrcweir     long            nHeaderHeight;
93cdf0e10cSrcweir     long            nFooterHeight;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     void    TestLastPage();
96cdf0e10cSrcweir     void    CalcPages( SCTAB nToWhichTab );
97cdf0e10cSrcweir     void    RecalcPages();
98cdf0e10cSrcweir     void    UpdateDrawView();
99cdf0e10cSrcweir     void    DoPrint( ScPreviewLocationData* pFillLocation );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     void    InvalidateLocationData( sal_uLong nId );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     using Window::SetZoom;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir protected:
106cdf0e10cSrcweir     virtual void   Paint( const Rectangle& rRect );
107cdf0e10cSrcweir     virtual void   Command( const CommandEvent& rCEvt );
108cdf0e10cSrcweir     virtual void   KeyInput( const KeyEvent& rKEvt );
109cdf0e10cSrcweir     virtual void   MouseMove( const MouseEvent& rMEvt );
110cdf0e10cSrcweir     virtual void   MouseButtonDown( const MouseEvent& rMEvt );
111cdf0e10cSrcweir     virtual void   MouseButtonUp( const MouseEvent& rMEvt );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     virtual void   GetFocus();
114cdf0e10cSrcweir     virtual void   LoseFocus();
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir public:
119cdf0e10cSrcweir             ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh );
120cdf0e10cSrcweir             ~ScPreview();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     virtual void DataChanged( const DataChangedEvent& rDCEvt );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     void    DataChanged(sal_Bool bNewTime = sal_False);             // statt Invalidate rufen
125cdf0e10cSrcweir     void    DoInvalidate();
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     void    SetXOffset( long nX );
128cdf0e10cSrcweir     void    SetYOffset( long nY );
129cdf0e10cSrcweir     void    SetZoom(sal_uInt16 nNewZoom);
130cdf0e10cSrcweir     void    SetPageNo( long nPage );
131cdf0e10cSrcweir 
GetPageMargins() const132cdf0e10cSrcweir     sal_Bool    GetPageMargins()const { return bPageMargin; }
SetPageMargins(sal_Bool bVal)133cdf0e10cSrcweir     void    SetPageMargins( sal_Bool bVal )  { bPageMargin = bVal; }
134cdf0e10cSrcweir     void    DrawInvert( long nDragPos, sal_uInt16 nFlags );
135cdf0e10cSrcweir     void    DragMove( long nDragMovePos, sal_uInt16 nFlags );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     const ScPreviewLocationData& GetLocationData();
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     String  GetPosString();
141cdf0e10cSrcweir 
GetPageNo() const142cdf0e10cSrcweir     long    GetPageNo() const   { return nPageNo; }
GetZoom() const143cdf0e10cSrcweir     sal_uInt16  GetZoom() const     { return nZoom; }
GetOffset() const144cdf0e10cSrcweir     Point   GetOffset() const   { return aOffset; }
145cdf0e10cSrcweir 
GetTab()146cdf0e10cSrcweir     SCTAB   GetTab()            { if (!bValid) { CalcPages(0); RecalcPages(); } return nTab; }
GetTotalPages()147cdf0e10cSrcweir     long    GetTotalPages()     { if (!bValid) { CalcPages(0); RecalcPages(); } return nTotalPages; }
148cdf0e10cSrcweir 
AllTested() const149cdf0e10cSrcweir     sal_Bool    AllTested() const   { return bValid && nTabsTested >= nTabCount; }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     sal_uInt16  GetOptimalZoom(sal_Bool bWidthOnly);
152cdf0e10cSrcweir     long    GetFirstPage(SCTAB nTab);
153cdf0e10cSrcweir 
CalcAll()154cdf0e10cSrcweir     void    CalcAll()           { CalcPages(MAXTAB); }
SetInGetState(sal_Bool bSet)155cdf0e10cSrcweir     void    SetInGetState(sal_Bool bSet) { bInGetState = bSet; }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     DECL_STATIC_LINK( ScPreview, InvalidateHdl, void* );
158cdf0e10cSrcweir     static void StaticInvalidate();
159cdf0e10cSrcweir 
GetDrawView()160cdf0e10cSrcweir     FmFormView* GetDrawView() { return pDrawView; }
161*0deba7fbSSteve Yin     virtual void SwitchView();
162cdf0e10cSrcweir };
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 
166cdf0e10cSrcweir #endif
167