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 #pragma once
21 
22 #include <oox/helper/refmap.hxx>
23 #include <oox/helper/refvector.hxx>
24 #include "workbookhelper.hxx"
25 
26 namespace oox { class AttributeList; }
27 namespace oox { class SequenceInputStream; }
28 
29 namespace oox::xls {
30 
32 {
34  OUString maValue;
35  sal_Int32 mnNumFmtId;
36  bool mbDeleted;
37 
38  explicit ScenarioCellModel();
39 };
40 
42 {
43  OUString maName;
44  OUString maComment;
45  OUString maUser;
46  bool mbLocked;
47  bool mbHidden;
48  bool mbActive;
49 
50  explicit ScenarioModel();
51 };
52 
53 class Scenario : public WorkbookHelper
54 {
55 public:
56  explicit Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet, bool bIsActive );
57 
59  void importScenario( const AttributeList& rAttribs );
61  void importInputCells( const AttributeList& rAttribs );
62 
67 
69  void finalizeImport();
70 
71 private:
72  std::vector< ScenarioCellModel > maCells;
74  sal_Int16 mnSheet;
75 };
76 
78 {
79  sal_Int32 mnCurrent;
80  sal_Int32 mnShown;
81 
82  explicit SheetScenariosModel();
83 };
84 
86 {
87 public:
88  explicit SheetScenarios( const WorkbookHelper& rHelper, sal_Int16 nSheet );
89 
91  void importScenarios( const AttributeList& rAttribs );
94 
97 
99  void finalizeImport();
100 
101 private:
103  ScenarioVector maScenarios;
105  sal_Int16 mnSheet;
106 };
107 
109 {
110 public:
111  explicit ScenarioBuffer( const WorkbookHelper& rHelper );
112 
114  SheetScenarios& createSheetScenarios( sal_Int16 nSheet );
115 
117  void finalizeImport();
118 
119 private:
121  SheetScenariosMap maSheetScenarios;
122 };
123 
124 } // namespace oox::xls
125 
126 /* 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