m11-master update
[ooovba.git] / oox / inc / oox / xls / viewsettings.hxx
blob750866b1c455425840e5f5f82e43f236cccfdf0d
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: viewsettings.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 #ifndef OOX_XLS_VIEWSETTINGS_HXX
32 #define OOX_XLS_VIEWSETTINGS_HXX
34 #include <com/sun/star/table/CellAddress.hpp>
35 #include <com/sun/star/table/CellRangeAddress.hpp>
36 #include "oox/helper/containerhelper.hxx"
37 #include "oox/xls/addressconverter.hxx"
38 #include "oox/xls/stylesbuffer.hxx"
39 #include "oox/xls/worksheethelper.hxx"
41 namespace oox {
42 namespace xls {
44 // ============================================================================
46 /** Contains all settings for a selection in a single pane of a sheet. */
47 struct OoxSheetSelectionData
49 ::com::sun::star::table::CellAddress maActiveCell; /// Position of active cell (cursor).
50 ApiCellRangeList maSelection; /// Selected cell ranges.
51 sal_Int32 mnActiveCellId; /// Index of active cell in selection list.
53 explicit OoxSheetSelectionData();
56 // ----------------------------------------------------------------------------
58 /** Contains all view settings for a single sheet. */
59 struct OoxSheetViewData
61 typedef RefMap< sal_Int32, OoxSheetSelectionData > OoxSelectionDataMap;
63 OoxSelectionDataMap maSelMap; /// Selections of all panes.
64 Color maGridColor; /// Grid color.
65 ::com::sun::star::table::CellAddress maFirstPos; /// First visible cell.
66 ::com::sun::star::table::CellAddress maSecondPos; /// First visible cell in additional panes.
67 sal_Int32 mnWorkbookViewId; /// Index into list of workbookView elements.
68 sal_Int32 mnViewType; /// View type (normal, page break, layout).
69 sal_Int32 mnActivePaneId; /// Active pane (with cell cursor).
70 sal_Int32 mnPaneState; /// Pane state (frozen, split).
71 double mfSplitX; /// Split X position (twips), or number of frozen columns.
72 double mfSplitY; /// Split Y position (twips), or number of frozen rows.
73 sal_Int32 mnCurrentZoom; /// Zoom factor for current view.
74 sal_Int32 mnNormalZoom; /// Zoom factor for normal view.
75 sal_Int32 mnSheetLayoutZoom; /// Zoom factor for pagebreak preview.
76 sal_Int32 mnPageLayoutZoom; /// Zoom factor for page layout view.
77 bool mbSelected; /// True = sheet is selected.
78 bool mbRightToLeft; /// True = sheet in right-to-left mode.
79 bool mbDefGridColor; /// True = default grid color.
80 bool mbShowFormulas; /// True = show formulas instead of results.
81 bool mbShowGrid; /// True = show cell grid.
82 bool mbShowHeadings; /// True = show column/row headings.
83 bool mbShowZeros; /// True = show zero value zells.
84 bool mbShowOutline; /// True = show outlines.
85 bool mbZoomToFit; /// True = zoom chart sheet to fit window.
86 Color maTabColor; /// Sheet tab color.
88 explicit OoxSheetViewData();
90 /** Returns true, if page break preview is active. */
91 bool isPageBreakPreview() const;
92 /** Returns the zoom in normal view (returns default, if current value is 0). */
93 sal_Int32 getNormalZoom() const;
94 /** Returns the zoom in pagebreak preview (returns default, if current value is 0). */
95 sal_Int32 getPageBreakZoom() const;
97 /** Returns the selection data, if available, otherwise 0. */
98 const OoxSheetSelectionData* getSelectionData( sal_Int32 nPaneId ) const;
99 /** Returns the selection data of the active pane. */
100 const OoxSheetSelectionData* getActiveSelectionData() const;
101 /** Returns read/write access to the selection data of the specified pane. */
102 OoxSheetSelectionData& createSelectionData( sal_Int32 nPaneId );
105 typedef ::boost::shared_ptr< OoxSheetViewData > OoxSheetViewDataRef;
107 // ----------------------------------------------------------------------------
109 class SheetViewSettings : public WorksheetHelper
111 public:
112 explicit SheetViewSettings( const WorksheetHelper& rHelper );
114 /** Imports the sheetView element containing sheet view settings. */
115 void importSheetView( const AttributeList& rAttribs );
116 /** Imports the tabcolor element containing tab color settings. */
117 void importTabColor( const AttributeList& rAttribs );
118 /** Imports the pane element containing sheet pane settings. */
119 void importPane( const AttributeList& rAttribs );
120 /** Imports the selection element containing selection settings for a pane. */
121 void importSelection( const AttributeList& rAttribs );
122 /** Imports the sheetView element containing view settings of a chart sheet. */
123 void importChartSheetView( const AttributeList& rAttribs );
125 /** Imports the SHEETVIEW record containing sheet view settings. */
126 void importSheetView( RecordInputStream& rStrm );
127 /** Imports the tabcolor element containing tab color settings. */
128 void importTabColor( RecordInputStream& rStrm );
129 /** Imports the PANE record containing sheet pane settings. */
130 void importPane( RecordInputStream& rStrm );
131 /** Imports the SELECTION record containing selection settings for a pane. */
132 void importSelection( RecordInputStream& rStrm );
133 /** Imports the CHARTSHEETVIEW record containing view settings of a chart sheet. */
134 void importChartSheetView( RecordInputStream& rStrm );
136 /** Imports the WINDOW2 record containing sheet view settings. */
137 void importWindow2( BiffInputStream& rStrm );
138 /** Imports the PANE record containing sheet pane settings. */
139 void importPane( BiffInputStream& rStrm );
140 /** Imports the SCL record containing sheet zoom settings. */
141 void importScl( BiffInputStream& rStrm );
142 /** Imports the SELECTION record containing selection settings for a pane. */
143 void importSelection( BiffInputStream& rStrm );
145 /** Converts all imported sheet view settings. */
146 void finalizeImport();
148 private:
149 OoxSheetViewDataRef mxSheetData;
152 // ============================================================================
154 /** Contains all view settings for the entire document. */
155 struct OoxWorkbookViewData
157 sal_Int32 mnWinX; /// X position of the workbook window (twips).
158 sal_Int32 mnWinY; /// Y position of the workbook window (twips).
159 sal_Int32 mnWinWidth; /// Width of the workbook window (twips).
160 sal_Int32 mnWinHeight; /// Height of the workbook window (twips).
161 sal_Int32 mnActiveSheet; /// Displayed (active) sheet.
162 sal_Int32 mnFirstVisSheet; /// First visible sheet in sheet tabbar.
163 sal_Int32 mnTabBarWidth; /// Width of sheet tabbar (1/1000 of window width).
164 sal_Int32 mnVisibility; /// Visibility state of workbook window.
165 bool mbShowTabBar; /// True = show sheet tabbar.
166 bool mbShowHorScroll; /// True = show horizontal sheet scrollbars.
167 bool mbShowVerScroll; /// True = show vertical sheet scrollbars.
168 bool mbMinimized; /// True = workbook window is minimized.
170 explicit OoxWorkbookViewData();
173 typedef ::boost::shared_ptr< OoxWorkbookViewData > OoxWorkbookViewDataRef;
175 // ----------------------------------------------------------------------------
177 class ViewSettings : public WorkbookHelper
179 public:
180 explicit ViewSettings( const WorkbookHelper& rHelper );
182 /** Imports the workbookView element containing workbook view settings. */
183 void importWorkbookView( const AttributeList& rAttribs );
184 /** Imports the WORKBOOKVIEW record containing workbook view settings. */
185 void importWorkbookView( RecordInputStream& rStrm );
186 /** Imports the WINDOW1 record containing workbook view settings. */
187 void importWindow1( BiffInputStream& rStrm );
189 /** Stores converted view settings for a specific worksheet. */
190 void setSheetViewSettings( sal_Int32 nSheet,
191 const OoxSheetViewDataRef& rxViewData,
192 const ::com::sun::star::uno::Any& rProperties );
194 /** Converts all imported document view settings. */
195 void finalizeImport();
197 /** Returns the index of the active sheet. */
198 sal_Int32 getActiveSheetIndex() const;
200 private:
201 OoxWorkbookViewData& createWorkbookViewData();
203 private:
204 typedef RefVector< OoxWorkbookViewData > WorkbookViewDataVec;
205 typedef RefMap< sal_Int32, OoxSheetViewData > SheetViewDataMap;
206 typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > SheetPropertiesMap;
208 WorkbookViewDataVec maBookDatas; /// Workbook view datas.
209 SheetViewDataMap maSheetDatas; /// Active view data for each sheet.
210 SheetPropertiesMap maSheetProps; /// Converted property sequences for each sheet.
213 // ============================================================================
215 } // namespace xls
216 } // namespace oox
218 #endif