LibreOffice Module sc (master)  1
scenariobuffer.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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
22 
23 #include <oox/helper/refmap.hxx>
24 #include <oox/helper/refvector.hxx>
25 #include "workbookhelper.hxx"
26 
27 namespace oox { class AttributeList; }
28 namespace oox { class SequenceInputStream; }
29 
30 namespace oox::xls {
31 
33 {
35  OUString maValue;
36  sal_Int32 mnNumFmtId;
37  bool mbDeleted;
38 
39  explicit ScenarioCellModel();
40 };
41 
43 {
44  OUString maName;
45  OUString maComment;
46  OUString maUser;
47  bool mbLocked;
48  bool mbHidden;
49  bool mbActive;
50 
51  explicit ScenarioModel();
52 };
53 
54 class Scenario : public WorkbookHelper
55 {
56 public:
57  explicit Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet, bool bIsActive );
58 
60  void importScenario( const AttributeList& rAttribs );
62  void importInputCells( const AttributeList& rAttribs );
63 
68 
70  void finalizeImport();
71 
72 private:
73  std::vector< ScenarioCellModel > maCells;
75  sal_Int16 mnSheet;
76 };
77 
79 {
80  sal_Int32 mnCurrent;
81  sal_Int32 mnShown;
82 
83  explicit SheetScenariosModel();
84 };
85 
87 {
88 public:
89  explicit SheetScenarios( const WorkbookHelper& rHelper, sal_Int16 nSheet );
90 
92  void importScenarios( const AttributeList& rAttribs );
95 
98 
100  void finalizeImport();
101 
102 private:
104  ScenarioVector maScenarios;
106  sal_Int16 mnSheet;
107 };
108 
110 {
111 public:
112  explicit ScenarioBuffer( const WorkbookHelper& rHelper );
113 
115  SheetScenarios& createSheetScenarios( sal_Int16 nSheet );
116 
118  void finalizeImport();
119 
120 private:
122  SheetScenariosMap maSheetScenarios;
123 };
124 
125 } // namespace oox::xls
126 
127 #endif
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
void finalizeImport()
Creates all scenarios in the Calc sheet.
Scenario & createScenario()
Creates and returns a new scenario in this collection.
ScenarioModel maModel
Scenario cells.
void finalizeImport()
Creates the scenario in the Calc document.
bool mbLocked
Name of user created the scenario.
std::vector< ScenarioCellModel > maCells
Scenario(const WorkbookHelper &rHelper, sal_Int16 nSheet, bool bIsActive)
OUString maUser
Comment.
bool mbHidden
True = input cell values locked.
void importScenario(const AttributeList &rAttribs)
Imports a scenario definition from a scenario element.
void importInputCells(const AttributeList &rAttribs)
Imports a new cell for this scenario from an inputCells element.
SheetScenarios & createSheetScenarios(sal_Int16 nSheet)
Creates and returns a scenario collection for the passed sheet.
RefMap< sal_Int16, SheetScenarios,::std::greater< sal_Int16 > > SheetScenariosMap
sal_Int32 mnShown
Selected scenario.
ScenarioBuffer(const WorkbookHelper &rHelper)
void importScenarios(const AttributeList &rAttribs)
Imports sheet scenario settings from a scenarios element.
void finalizeImport()
Creates all scenarios in the Calc document.
SheetScenariosModel maModel
SheetScenarios(const WorkbookHelper &rHelper, sal_Int16 nSheet)
OUString maComment
Name of the scenario.
bool mbActive
True = scenario is hidden.
SheetScenariosMap maSheetScenarios
SheetScenariosModel()
Visible scenario.
void SvStream & rStrm
sal_Int16 mnSheet
Scenario model data.
RefVector< Scenario > ScenarioVector