1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef SC_PREVIEW_HXX
20 #define SC_PREVIEW_HXX
23 #include <vcl/window.hxx>
24 #include "printfun.hxx"
25 #include "markdata.hxx"
33 class ScPreview
: public Window
36 ScMarkData::MarkedTabsType maSelectedTabs
;
38 long nPageNo
; // Pages in document
39 sal_uInt16 nZoom
; // set Zoom
40 Point aOffset
; // positive
44 SCTAB nTabsTested
; // for how many sheets is nPages valid?
45 std::vector
<long> nPages
;
46 std::vector
<long> nFirstAttr
;
48 long nTabPage
; // Page of sheet
49 long nTabStart
; // First (real) page of the sheet
50 long nDisplayStart
; // same as above, relative to the start of counting
54 Size aPageSize
; // for GetOptimalZoom
56 ScPreviewLocationData
* pLocationData
; // stores table layout for accessibility API
57 FmFormView
* pDrawView
;
60 ScDocShell
* pDocShell
;
61 ScPreviewShell
* pViewShell
;
64 bool bValid
:1; // the following values true
66 bool bLocationValid
:1;
69 bool bLeftRulerMove
:1;
70 bool bRightRulerMove
:1;
72 bool bBottomRulerMove
:1;
73 bool bHeaderRulerMove
:1;
74 bool bFooterRulerMove
:1;
75 bool bLeftRulerChange
:1;
76 bool bRightRulerChange
:1;
77 bool bTopRulerChange
:1;
78 bool bBottomRulerChange
:1;
79 bool bHeaderRulerChange
:1;
80 bool bFooterRulerChange
:1;
85 long nRight
[ MAXCOL
+1 ];
88 SCCOL nColNumberButttonDown
;
89 Point aButtonDownChangePoint
;
98 void UpdateDrawView();
99 void DoPrint( ScPreviewLocationData
* pFillLocation
);
101 void InvalidateLocationData( sal_uLong nId
);
103 using Window::SetZoom
;
106 virtual void Paint( const Rectangle
& rRect
);
107 virtual void Command( const CommandEvent
& rCEvt
);
108 virtual void KeyInput( const KeyEvent
& rKEvt
);
109 virtual void MouseMove( const MouseEvent
& rMEvt
);
110 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
111 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
113 virtual void GetFocus();
114 virtual void LoseFocus();
116 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible();
119 ScPreview( Window
* pParent
, ScDocShell
* pDocSh
, ScPreviewShell
* pViewSh
);
122 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
124 SC_DLLPUBLIC
void DataChanged(bool bNewTime
= false); // Instead of calling Invalidate
127 void SetXOffset( long nX
);
128 void SetYOffset( long nY
);
129 void SetZoom(sal_uInt16 nNewZoom
);
130 SC_DLLPUBLIC
void SetPageNo( long nPage
);
132 bool GetPageMargins() const { return bPageMargin
; }
133 void SetPageMargins( bool bVal
) { bPageMargin
= bVal
; }
134 void DrawInvert( long nDragPos
, sal_uInt16 nFlags
);
135 void DragMove( long nDragMovePos
, sal_uInt16 nFlags
);
138 const ScPreviewLocationData
& GetLocationData();
140 OUString
GetPosString();
142 long GetPageNo() const { return nPageNo
; }
143 sal_uInt16
GetZoom() const { return nZoom
; }
144 Point
GetOffset() const { return aOffset
; }
146 SCTAB
GetTab() { if (!bValid
) { CalcPages(); RecalcPages(); } return nTab
; }
147 long GetTotalPages() { if (!bValid
) { CalcPages(); RecalcPages(); } return nTotalPages
; }
149 bool AllTested() const { return bValid
&& nTabsTested
>= nTabCount
; }
151 sal_uInt16
GetOptimalZoom(bool bWidthOnly
);
152 SC_DLLPUBLIC
long GetFirstPage(SCTAB nTab
);
154 void CalcAll() { CalcPages(); }
155 void SetInGetState(bool bSet
) { bInGetState
= bSet
; }
157 DECL_STATIC_LINK( ScPreview
, InvalidateHdl
, void* );
158 static void StaticInvalidate();
160 FmFormView
* GetDrawView() { return pDrawView
; }
162 SC_DLLPUBLIC
void SetSelectedTabs(const ScMarkData
& rMark
);
163 SC_DLLPUBLIC
const ScMarkData::MarkedTabsType
& GetSelectedTabs() const;
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */