1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_SCENARIOBUFFER_HXX
23 #include <com/sun/star/table/CellAddress.hpp>
24 #include <oox/helper/refmap.hxx>
25 #include <oox/helper/refvector.hxx>
26 #include "workbookhelper.hxx"
31 struct ScenarioCellModel
33 ::com::sun::star::table::CellAddress maPos
;
38 explicit ScenarioCellModel();
43 OUString maName
; /// Name of the scenario.
44 OUString maComment
; /// Comment.
45 OUString maUser
; /// Name of user created the scenario.
46 bool mbLocked
; /// True = input cell values locked.
47 bool mbHidden
; /// True = scenario is hidden.
49 explicit ScenarioModel();
52 class Scenario
: public WorkbookHelper
55 explicit Scenario( const WorkbookHelper
& rHelper
, sal_Int16 nSheet
);
57 /** Imports a scenario definition from a scenario element. */
58 void importScenario( const AttributeList
& rAttribs
);
59 /** Imports a new cell for this scenario from a inputCells element. */
60 void importInputCells( const AttributeList
& rAttribs
);
62 /** Imports a scenario definition from a SCENARIO record. */
63 void importScenario( SequenceInputStream
& rStrm
);
64 /** Imports a new cell for this scenario from a INPUTCELLS record. */
65 void importInputCells( SequenceInputStream
& rStrm
);
67 /** Creates the scenario in the Calc document. */
68 void finalizeImport();
71 typedef ::std::vector
< ScenarioCellModel
> ScenarioCellVector
;
73 ScenarioCellVector maCells
; /// Scenario cells.
74 ScenarioModel maModel
; /// Scenario model data.
75 sal_Int16 mnSheet
; /// Index of the sheet this scenario is based on.
78 struct SheetScenariosModel
80 sal_Int32 mnCurrent
; /// Selected scenario.
81 sal_Int32 mnShown
; /// Visible scenario.
83 explicit SheetScenariosModel();
86 class SheetScenarios
: public WorkbookHelper
89 explicit SheetScenarios( const WorkbookHelper
& rHelper
, sal_Int16 nSheet
);
91 /** Imports sheet scenario settings from a scenarios element. */
92 void importScenarios( const AttributeList
& rAttribs
);
93 /** Imports sheet scenario settings from a SCENARIOS record. */
94 void importScenarios( SequenceInputStream
& rStrm
);
96 /** Creates and returns a new scenario in this collection. */
97 Scenario
& createScenario();
99 /** Creates all scenarios in the Calc sheet. */
100 void finalizeImport();
103 typedef RefVector
< Scenario
> ScenarioVector
;
104 ScenarioVector maScenarios
;
105 SheetScenariosModel maModel
;
109 class ScenarioBuffer
: public WorkbookHelper
112 explicit ScenarioBuffer( const WorkbookHelper
& rHelper
);
114 /** Creates and returns a scenario collection for the passed sheet. */
115 SheetScenarios
& createSheetScenarios( sal_Int16 nSheet
);
117 /** Creates all scenarios in the Calc document. */
118 void finalizeImport();
121 typedef RefMap
< sal_Int16
, SheetScenarios
, ::std::greater
< sal_Int16
> > SheetScenariosMap
;
122 SheetScenariosMap maSheetScenarios
;
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */