LibreOffice Module sc (master) 1
scenariocontext.cxx
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#include <scenariocontext.hxx>
21#include <biffhelper.hxx>
22
23#include <scenariobuffer.hxx>
24#include <oox/token/namespaces.hxx>
25
26namespace oox::xls {
27
28using ::oox::core::ContextHandlerRef;
29
31 WorksheetContextBase( rParent ),
32 mrScenario( rSheetScenarios.createScenario() )
33{
34}
35
37{
38 switch( getCurrentElement() )
39 {
40 case XLS_TOKEN( scenario ):
41 if( nElement == XLS_TOKEN( inputCells ) ) mrScenario.importInputCells( rAttribs );
42 break;
43 }
44 return nullptr;
45}
46
48{
49 if( isRootElement() )
50 mrScenario.importScenario( rAttribs );
51}
52
54{
55 switch( getCurrentElement() )
56 {
59 break;
60 }
61 return nullptr;
62}
63
65{
66 if( isRootElement() )
68}
69
71 WorksheetContextBase( rFragment ),
72 mrSheetScenarios( getScenarios().createSheetScenarios( getSheetIndex() ) )
73{
74}
75
77{
78 switch( getCurrentElement() )
79 {
80 case XLS_TOKEN( scenarios ):
81 if( nElement == XLS_TOKEN( scenario ) ) return new ScenarioContext( *this, mrSheetScenarios );
82 break;
83 }
84 return nullptr;
85}
86
88{
89 if( isRootElement() )
91}
92
94{
95 switch( getCurrentElement() )
96 {
98 if( nRecId == BIFF12_ID_SCENARIO ) return new ScenarioContext( *this, mrSheetScenarios );
99 break;
100 }
101 return nullptr;
102}
103
105{
106 if( isRootElement() )
108}
109
110} // namespace oox::xls
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void onStartElement(const AttributeList &rAttribs) override
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
ScenarioContext(WorksheetContextBase &rParent, SheetScenarios &rSheetScenarios)
virtual void onStartRecord(SequenceInputStream &rStrm) override
void importInputCells(const AttributeList &rAttribs)
Imports a new cell for this scenario from an inputCells element.
void importScenario(const AttributeList &rAttribs)
Imports a scenario definition from a scenario element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
SheetScenarios & mrSheetScenarios
virtual void onStartElement(const AttributeList &rAttribs) override
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
ScenariosContext(WorksheetFragmentBase &rFragment)
virtual void onStartRecord(SequenceInputStream &rStrm) override
void importScenarios(const AttributeList &rAttribs)
Imports sheet scenario settings from a scenarios element.
Context handler derived from the WorksheetHelper helper class.
Fragment handler derived from the WorksheetHelper helper class.
void SvStream & rStrm
const sal_Int32 BIFF12_ID_SCENARIO
Definition: biffhelper.hxx:210
const sal_Int32 BIFF12_ID_INPUTCELLS
Definition: biffhelper.hxx:134
const sal_Int32 BIFF12_ID_SCENARIOS
Definition: biffhelper.hxx:211