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 #include "scenariocontext.hxx"
22 #include "scenariobuffer.hxx"
27 using ::oox::core::ContextHandlerRef
;
29 ScenarioContext::ScenarioContext( WorksheetContextBase
& rParent
, SheetScenarios
& rSheetScenarios
) :
30 WorksheetContextBase( rParent
),
31 mrScenario( rSheetScenarios
.createScenario() )
35 ContextHandlerRef
ScenarioContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
37 switch( getCurrentElement() )
39 case XLS_TOKEN( scenario
):
40 if( nElement
== XLS_TOKEN( inputCells
) ) mrScenario
.importInputCells( rAttribs
);
46 void ScenarioContext::onStartElement( const AttributeList
& rAttribs
)
49 mrScenario
.importScenario( rAttribs
);
52 ContextHandlerRef
ScenarioContext::onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& rStrm
)
54 switch( getCurrentElement() )
56 case BIFF12_ID_SCENARIO
:
57 if( nRecId
== BIFF12_ID_INPUTCELLS
) mrScenario
.importInputCells( rStrm
);
63 void ScenarioContext::onStartRecord( SequenceInputStream
& rStrm
)
66 mrScenario
.importScenario( rStrm
);
69 ScenariosContext::ScenariosContext( WorksheetFragmentBase
& rFragment
) :
70 WorksheetContextBase( rFragment
),
71 mrSheetScenarios( getScenarios().createSheetScenarios( getSheetIndex() ) )
75 ContextHandlerRef
ScenariosContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& )
77 switch( getCurrentElement() )
79 case XLS_TOKEN( scenarios
):
80 if( nElement
== XLS_TOKEN( scenario
) ) return new ScenarioContext( *this, mrSheetScenarios
);
86 void ScenariosContext::onStartElement( const AttributeList
& rAttribs
)
89 mrSheetScenarios
.importScenarios( rAttribs
);
92 ContextHandlerRef
ScenariosContext::onCreateRecordContext( sal_Int32 nRecId
, SequenceInputStream
& )
94 switch( getCurrentElement() )
96 case BIFF12_ID_SCENARIOS
:
97 if( nRecId
== BIFF12_ID_SCENARIO
) return new ScenarioContext( *this, mrSheetScenarios
);
103 void ScenariosContext::onStartRecord( SequenceInputStream
& rStrm
)
105 if( isRootElement() )
106 mrSheetScenarios
.importScenarios( rStrm
);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */