Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "scenariocontext.hxx"
30 : :
31 : : #include "scenariobuffer.hxx"
32 : :
33 : : namespace oox {
34 : : namespace xls {
35 : :
36 : : // ============================================================================
37 : :
38 : : using ::oox::core::ContextHandlerRef;
39 : :
40 : : // ============================================================================
41 : :
42 : 0 : ScenarioContext::ScenarioContext( WorksheetContextBase& rParent, SheetScenarios& rSheetScenarios ) :
43 : : WorksheetContextBase( rParent ),
44 [ # # ]: 0 : mrScenario( rSheetScenarios.createScenario() )
45 : : {
46 : 0 : }
47 : :
48 : 0 : ContextHandlerRef ScenarioContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
49 : : {
50 [ # # ]: 0 : switch( getCurrentElement() )
51 : : {
52 : : case XLS_TOKEN( scenario ):
53 [ # # ]: 0 : if( nElement == XLS_TOKEN( inputCells ) ) mrScenario.importInputCells( rAttribs );
54 : 0 : break;
55 : : }
56 : 0 : return 0;
57 : : }
58 : :
59 : 0 : void ScenarioContext::onStartElement( const AttributeList& rAttribs )
60 : : {
61 [ # # ]: 0 : if( isRootElement() )
62 : 0 : mrScenario.importScenario( rAttribs );
63 : 0 : }
64 : :
65 : 0 : ContextHandlerRef ScenarioContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
66 : : {
67 [ # # ]: 0 : switch( getCurrentElement() )
68 : : {
69 : : case BIFF12_ID_SCENARIO:
70 [ # # ]: 0 : if( nRecId == BIFF12_ID_INPUTCELLS ) mrScenario.importInputCells( rStrm );
71 : 0 : break;
72 : : }
73 : 0 : return 0;
74 : : }
75 : :
76 : 0 : void ScenarioContext::onStartRecord( SequenceInputStream& rStrm )
77 : : {
78 [ # # ]: 0 : if( isRootElement() )
79 : 0 : mrScenario.importScenario( rStrm );
80 : 0 : }
81 : :
82 : : // ============================================================================
83 : :
84 : 0 : ScenariosContext::ScenariosContext( WorksheetFragmentBase& rFragment ) :
85 : : WorksheetContextBase( rFragment ),
86 [ # # ][ # # ]: 0 : mrSheetScenarios( getScenarios().createSheetScenarios( getSheetIndex() ) )
[ # # ]
87 : : {
88 : 0 : }
89 : :
90 : 0 : ContextHandlerRef ScenariosContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
91 : : {
92 [ # # ]: 0 : switch( getCurrentElement() )
93 : : {
94 : : case XLS_TOKEN( scenarios ):
95 [ # # ][ # # ]: 0 : if( nElement == XLS_TOKEN( scenario ) ) return new ScenarioContext( *this, mrSheetScenarios );
96 : 0 : break;
97 : : }
98 : 0 : return 0;
99 : : }
100 : :
101 : 0 : void ScenariosContext::onStartElement( const AttributeList& rAttribs )
102 : : {
103 [ # # ]: 0 : if( isRootElement() )
104 : 0 : mrSheetScenarios.importScenarios( rAttribs );
105 : 0 : }
106 : :
107 : 0 : ContextHandlerRef ScenariosContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& )
108 : : {
109 [ # # ]: 0 : switch( getCurrentElement() )
110 : : {
111 : : case BIFF12_ID_SCENARIOS:
112 [ # # ][ # # ]: 0 : if( nRecId == BIFF12_ID_SCENARIO ) return new ScenarioContext( *this, mrSheetScenarios );
113 : 0 : break;
114 : : }
115 : 0 : return 0;
116 : : }
117 : :
118 : 0 : void ScenariosContext::onStartRecord( SequenceInputStream& rStrm )
119 : : {
120 [ # # ]: 0 : if( isRootElement() )
121 : 0 : mrSheetScenarios.importScenarios( rStrm );
122 : 0 : }
123 : :
124 : : // ============================================================================
125 : :
126 : : } // namespace xls
127 [ + - ][ + - ]: 24 : } // namespace oox
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|