1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_VIEWSETTINGS_HXX
#define INCLUDED_SC_SOURCE_FILTER_INC_VIEWSETTINGS_HXX
#include <rangelst.hxx>
#include "stylesbuffer.hxx"
#include "worksheethelper.hxx"
#include "workbookhelper.hxx"
namespace oox {
namespace xls {
/** Contains all settings for a selection in a single pane of a sheet. */
struct PaneSelectionModel
{
ScAddress maActiveCell; /// Position of active cell (cursor).
ScRangeList maSelection; /// Selected cell ranges.
sal_Int32 mnActiveCellId; /// Index of active cell in selection list.
explicit PaneSelectionModel();
};
/** Contains all view settings for a single sheet. */
struct SheetViewModel
{
typedef RefMap< sal_Int32, PaneSelectionModel > PaneSelectionModelMap;
PaneSelectionModelMap maPaneSelMap; /// Selections of all panes.
Color maGridColor; /// Grid color.
ScAddress maFirstPos; /// First visible cell.
ScAddress maSecondPos; /// First visible cell in additional panes.
sal_Int32 mnWorkbookViewId; /// Index into list of workbookView elements.
sal_Int32 mnViewType; /// View type (normal, page break, layout).
sal_Int32 mnActivePaneId; /// Active pane (with cell cursor).
sal_Int32 mnPaneState; /// Pane state (frozen, split).
double mfSplitX; /// Split X position (twips), or number of frozen columns.
double mfSplitY; /// Split Y position (twips), or number of frozen rows.
sal_Int32 mnCurrentZoom; /// Zoom factor for current view.
sal_Int32 mnNormalZoom; /// Zoom factor for normal view.
sal_Int32 mnSheetLayoutZoom; /// Zoom factor for pagebreak preview.
sal_Int32 mnPageLayoutZoom; /// Zoom factor for page layout view.
bool mbSelected; /// True = sheet is selected.
bool mbRightToLeft; /// True = sheet in right-to-left mode.
bool mbDefGridColor; /// True = default grid color.
bool mbShowFormulas; /// True = show formulas instead of results.
bool mbShowGrid; /// True = show cell grid.
bool mbShowHeadings; /// True = show column/row headings.
bool mbShowZeros; /// True = show zero value zells.
bool mbShowOutline; /// True = show outlines.
bool mbZoomToFit; /// True = zoom chart sheet to fit window.
explicit SheetViewModel();
/** Returns true, if page break preview is active. */
bool isPageBreakPreview() const;
/** Returns the zoom in normal view (returns default, if current value is 0). */
sal_Int32 getNormalZoom() const;
/** Returns the zoom in pagebreak preview (returns default, if current value is 0). */
sal_Int32 getPageBreakZoom() const;
/** Returns the grid color as RGB value. */
::Color getGridColor( const ::oox::core::FilterBase& rFilter ) const;
/** Returns the selection data of the active pane. */
const PaneSelectionModel* getActiveSelection() const;
/** Returns read/write access to the selection data of the specified pane. */
PaneSelectionModel& createPaneSelection( sal_Int32 nPaneId );
};
typedef std::shared_ptr< SheetViewModel > SheetViewModelRef;
class SheetViewSettings : public WorksheetHelper
{
public:
explicit SheetViewSettings( const WorksheetHelper& rHelper );
/** Imports the sheetView element containing sheet view settings. */
void importSheetView( const AttributeList& rAttribs );
/** Imports the pane element containing sheet pane settings. */
void importPane( const AttributeList& rAttribs );
/** Imports the selection element containing selection settings for a pane. */
void importSelection( const AttributeList& rAttribs );
/** Imports the sheetView element containing view settings of a chart sheet. */
void importChartSheetView( const AttributeList& rAttribs );
/** Imports the SHEETVIEW record containing sheet view settings. */
void importSheetView( SequenceInputStream& rStrm );
/** Imports the PANE record containing sheet pane settings. */
void importPane( SequenceInputStream& rStrm );
/** Imports the SELECTION record containing selection settings for a pane. */
void importSelection( SequenceInputStream& rStrm );
/** Imports the CHARTSHEETVIEW record containing view settings of a chart sheet. */
void importChartSheetView( SequenceInputStream& rStrm );
/** Converts all imported sheet view settings. */
void finalizeImport();
/** Returns true, if the sheet layout is set to right-to-left. */
bool isSheetRightToLeft() const;
private:
SheetViewModelRef createSheetView();
private:
typedef RefVector< SheetViewModel > SheetViewModelVec;
SheetViewModelVec maSheetViews;
};
/** Contains all view settings for the entire document. */
struct WorkbookViewModel
{
sal_Int32 mnWinX; /// X position of the workbook window (twips).
sal_Int32 mnWinY; /// Y position of the workbook window (twips).
sal_Int32 mnWinWidth; /// Width of the workbook window (twips).
sal_Int32 mnWinHeight; /// Height of the workbook window (twips).
sal_Int32 mnActiveSheet; /// Displayed (active) sheet.
sal_Int32 mnFirstVisSheet; /// First visible sheet in sheet tabbar.
sal_Int32 mnTabBarWidth; /// Width of sheet tabbar (1/1000 of window width).
sal_Int32 mnVisibility; /// Visibility state of workbook window.
bool mbShowTabBar; /// True = show sheet tabbar.
bool mbShowHorScroll; /// True = show horizontal sheet scrollbars.
bool mbShowVerScroll; /// True = show vertical sheet scrollbars.
bool mbMinimized; /// True = workbook window is minimized.
explicit WorkbookViewModel();
};
typedef std::shared_ptr< WorkbookViewModel > WorkbookViewModelRef;
class ViewSettings : public WorkbookHelper
{
public:
explicit ViewSettings( const WorkbookHelper& rHelper );
/** Imports the workbookView element containing workbook view settings. */
void importWorkbookView( const AttributeList& rAttribs );
/** Imports the oleSize element containing the visible size of the workbook. */
void importOleSize( const AttributeList& rAttribs );
/** Imports the WORKBOOKVIEW record containing workbook view settings. */
void importWorkbookView( SequenceInputStream& rStrm );
/** Imports the OLESIZE record containing the visible size of the workbook. */
void importOleSize( SequenceInputStream& rStrm );
/** Stores converted view settings for a specific worksheet. */
void setSheetViewSettings( sal_Int16 nSheet,
const SheetViewModelRef& rxSheetView,
const css::uno::Any& rProperties );
/** Stores the used area for a specific worksheet. */
void setSheetUsedArea( const ScRange& rUsedArea );
/** Converts all imported document view settings. */
void finalizeImport();
/** Returns the Calc index of the active sheet. */
sal_Int16 getActiveCalcSheet() const;
private:
WorkbookViewModel& createWorkbookView();
private:
typedef RefVector< WorkbookViewModel > WorkbookViewModelVec;
typedef RefMap< sal_Int16, SheetViewModel > SheetViewModelMap;
WorkbookViewModelVec maBookViews; /// Workbook view models.
SheetViewModelMap maSheetViews; /// Active view model for each sheet.
std::map< sal_Int16, css::uno::Any > maSheetProps; /// Converted property sequences for each sheet.
std::map< sal_Int16, ScRange > maSheetUsedAreas; /// Used area (cell range) of every sheet.
ScRange maOleSize; /// Visible area if this is an embedded OLE object.
bool mbValidOleSize; /// True = imported OLE size is a valid cell range.
};
} // namespace xls
} // namespace oox
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|