LibreOffice Module sc (master)  1
viewsettings.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <rangelst.hxx>
23 #include "stylesbuffer.hxx"
24 #include "worksheethelper.hxx"
25 #include "workbookhelper.hxx"
26 
27 namespace oox::xls {
28 
31 {
34  sal_Int32 mnActiveCellId;
35 
36  explicit PaneSelectionModel();
37 };
38 
41 {
43 
44  PaneSelectionModelMap maPaneSelMap;
48  sal_Int32 mnWorkbookViewId;
49  sal_Int32 mnViewType;
50  sal_Int32 mnActivePaneId;
51  sal_Int32 mnPaneState;
52  double mfSplitX;
53  double mfSplitY;
54  sal_Int32 mnCurrentZoom;
55  sal_Int32 mnNormalZoom;
56  sal_Int32 mnSheetLayoutZoom;
57  sal_Int32 mnPageLayoutZoom;
58  bool mbSelected;
62  bool mbShowGrid;
64  bool mbShowZeros;
66  bool mbZoomToFit;
67 
68  explicit SheetViewModel();
69 
71  bool isPageBreakPreview() const;
73  sal_Int32 getNormalZoom() const;
75  sal_Int32 getPageBreakZoom() const;
77  ::Color getGridColor( const ::oox::core::FilterBase& rFilter ) const;
78 
82  PaneSelectionModel& createPaneSelection( sal_Int32 nPaneId );
83 };
84 
85 typedef std::shared_ptr< SheetViewModel > SheetViewModelRef;
86 
88 {
89 public:
90  explicit SheetViewSettings( const WorksheetHelper& rHelper );
91 
93  void importSheetView( const AttributeList& rAttribs );
95  void importPane( const AttributeList& rAttribs );
97  void importSelection( const AttributeList& rAttribs );
99  void importChartSheetView( const AttributeList& rAttribs );
100 
104  void importPane( SequenceInputStream& rStrm );
106  void importSelection( SequenceInputStream& rStrm );
109 
111  void finalizeImport();
112 
114  bool isSheetRightToLeft() const;
115 
116 private:
117  SheetViewModelRef createSheetView();
118 
119 private:
121  SheetViewModelVec maSheetViews;
122 };
123 
126 {
127  sal_Int32 mnWinX;
128  sal_Int32 mnWinY;
129  sal_Int32 mnWinWidth;
130  sal_Int32 mnWinHeight;
131  sal_Int32 mnActiveSheet;
132  sal_Int32 mnFirstVisSheet;
133  sal_Int32 mnTabBarWidth;
134  sal_Int32 mnVisibility;
138  bool mbMinimized;
139 
140  explicit WorkbookViewModel();
141 };
142 
143 typedef std::shared_ptr< WorkbookViewModel > WorkbookViewModelRef;
144 
146 {
147 public:
148  explicit ViewSettings( const WorkbookHelper& rHelper );
149 
151  void importWorkbookView( const AttributeList& rAttribs );
153  void importOleSize( const AttributeList& rAttribs );
157  void importOleSize( SequenceInputStream& rStrm );
158 
160  void setSheetViewSettings( sal_Int16 nSheet,
161  const SheetViewModelRef& rxSheetView,
162  const css::uno::Any& rProperties );
164  void setSheetUsedArea( const ScRange& rUsedArea );
165 
167  void finalizeImport();
168 
170  sal_Int16 getActiveCalcSheet() const;
171 
172 private:
174 
175 private:
178 
179  WorkbookViewModelVec maBookViews;
180  SheetViewModelMap maSheetViews;
181  std::map< sal_Int16, css::uno::Any > maSheetProps;
182  std::map< sal_Int16, ScRange > maSheetUsedAreas;
185 };
186 
187 } // namespace oox::xls
188 
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
sal_Int32 mnWinWidth
Y position of the workbook window (twips).
bool isSheetRightToLeft() const
Returns true, if the sheet layout is set to right-to-left.
bool mbZoomToFit
True = show outlines.
sal_Int32 mnWinHeight
Width of the workbook window (twips).
WorkbookViewModelVec maBookViews
double mfSplitY
Split X position (twips), or number of frozen columns.
sal_Int32 mnTabBarWidth
First visible sheet in sheet tabbar.
sal_Int32 mnActivePaneId
View type (normal, page break, layout).
sal_Int32 mnNormalZoom
Zoom factor for current view.
bool mbShowGrid
True = show formulas instead of results.
ScRange maOleSize
Used area (cell range) of every sheet.
sal_Int32 mnCurrentZoom
Split Y position (twips), or number of frozen rows.
::Color getGridColor(const ::oox::core::FilterBase &rFilter) const
Returns the grid color as RGB value.
Contains all view settings for the entire document.
void finalizeImport()
Converts all imported sheet view settings.
ScRangeList maSelection
Position of active cell (cursor).
ScAddress maFirstPos
Grid color.
bool mbMinimized
True = show vertical sheet scrollbars.
void importChartSheetView(const AttributeList &rAttribs)
Imports the sheetView element containing view settings of a chart sheet.
void setSheetViewSettings(sal_Int16 nSheet, const SheetViewModelRef &rxSheetView, const css::uno::Any &rProperties)
Stores converted view settings for a specific worksheet.
sal_Int32 mnWinY
X position of the workbook window (twips).
bool mbShowZeros
True = show column/row headings.
ScAddress maSecondPos
First visible cell.
PaneSelectionModel()
Index of active cell in selection list.
bool isPageBreakPreview() const
Returns true, if page break preview is active.
sal_Int32 mnViewType
Index into list of workbookView elements.
SheetViewModel()
True = zoom chart sheet to fit window.
std::shared_ptr< SheetViewModel > SheetViewModelRef
sal_Int32 mnVisibility
Width of sheet tabbar (1/1000 of window width).
sal_Int16 getActiveCalcSheet() const
Returns the Calc index of the active sheet.
SheetViewModelMap maSheetViews
Workbook view models.
Contains all settings for a selection in a single pane of a sheet.
bool mbRightToLeft
True = sheet is selected.
RefMap< sal_Int16, SheetViewModel > SheetViewModelMap
sal_Int32 getPageBreakZoom() const
Returns the zoom in pagebreak preview (returns default, if current value is 0).
std::shared_ptr< WorkbookViewModel > WorkbookViewModelRef
SheetViewModelRef createSheetView()
void importSelection(const AttributeList &rAttribs)
Imports the selection element containing selection settings for a pane.
sal_Int32 mnPaneState
Active pane (with cell cursor).
SheetViewSettings(const WorksheetHelper &rHelper)
bool mbDefGridColor
True = sheet in right-to-left mode.
RefVector< WorkbookViewModel > WorkbookViewModelVec
sal_Int32 mnPageLayoutZoom
Zoom factor for pagebreak preview.
WorkbookViewModel()
True = workbook window is minimized.
SheetViewModelVec maSheetViews
sal_Int32 getNormalZoom() const
Returns the zoom in normal view (returns default, if current value is 0).
sal_Int32 mnFirstVisSheet
Displayed (active) sheet.
double mfSplitX
Pane state (frozen, split).
bool mbSelected
Zoom factor for page layout view.
void setSheetUsedArea(const ScRange &rUsedArea)
Stores the used area for a specific worksheet.
WorkbookViewModel & createWorkbookView()
std::map< sal_Int16, ScRange > maSheetUsedAreas
Converted property sequences for each sheet.
void importWorkbookView(const AttributeList &rAttribs)
Imports the workbookView element containing workbook view settings.
ViewSettings(const WorkbookHelper &rHelper)
bool mbShowOutline
True = show zero value zells.
void finalizeImport()
Converts all imported document view settings.
void importSheetView(const AttributeList &rAttribs)
Imports the sheetView element containing sheet view settings.
RefMap< sal_Int32, PaneSelectionModel > PaneSelectionModelMap
const PaneSelectionModel * getActiveSelection() const
Returns the selection data of the active pane.
sal_Int32 mnSheetLayoutZoom
Zoom factor for normal view.
PaneSelectionModel & createPaneSelection(sal_Int32 nPaneId)
Returns read/write access to the selection data of the specified pane.
bool mbShowHeadings
True = show cell grid.
bool mbShowHorScroll
True = show sheet tabbar.
sal_Int32 mnActiveCellId
Selected cell ranges.
bool mbValidOleSize
Visible area if this is an embedded OLE object.
Color maGridColor
Selections of all panes.
void SvStream & rStrm
sal_Int32 mnWorkbookViewId
First visible cell in additional panes.
bool mbShowVerScroll
True = show horizontal sheet scrollbars.
void importPane(const AttributeList &rAttribs)
Imports the pane element containing sheet pane settings.
bool mbShowTabBar
Visibility state of workbook window.
bool mbShowFormulas
True = default grid color.
std::map< sal_Int16, css::uno::Any > maSheetProps
Active view model for each sheet.
Contains all view settings for a single sheet.
PaneSelectionModelMap maPaneSelMap
sal_Int32 mnActiveSheet
Height of the workbook window (twips).
RefVector< SheetViewModel > SheetViewModelVec
void importOleSize(const AttributeList &rAttribs)
Imports the oleSize element containing the visible size of the workbook.