1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tablefragment.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/xls/scenariocontext.hxx"
32 #include "oox/xls/scenariobuffer.hxx"
34 using ::oox::core::ContextHandlerRef
;
39 // ============================================================================
41 OoxScenarioContext::OoxScenarioContext( OoxWorksheetContextBase
& rParent
, SheetScenarios
& rSheetScenarios
) :
42 OoxWorksheetContextBase( rParent
),
43 mrScenario( rSheetScenarios
.createScenario() )
47 ContextHandlerRef
OoxScenarioContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
)
49 switch( getCurrentElement() )
51 case XLS_TOKEN( scenario
):
52 if( nElement
== XLS_TOKEN( inputCells
) ) mrScenario
.importInputCells( rAttribs
);
58 void OoxScenarioContext::onStartElement( const AttributeList
& rAttribs
)
61 mrScenario
.importScenario( rAttribs
);
64 ContextHandlerRef
OoxScenarioContext::onCreateRecordContext( sal_Int32 nRecId
, RecordInputStream
& rStrm
)
66 switch( getCurrentElement() )
68 case OOBIN_ID_SCENARIO
:
69 if( nRecId
== OOBIN_ID_INPUTCELLS
) mrScenario
.importInputCells( rStrm
);
75 void OoxScenarioContext::onStartRecord( RecordInputStream
& rStrm
)
78 mrScenario
.importScenario( rStrm
);
81 // ============================================================================
83 OoxScenariosContext::OoxScenariosContext( OoxWorksheetFragmentBase
& rFragment
) :
84 OoxWorksheetContextBase( rFragment
),
85 mrSheetScenarios( getScenarios().createSheetScenarios( getSheetIndex() ) )
89 ContextHandlerRef
OoxScenariosContext::onCreateContext( sal_Int32 nElement
, const AttributeList
& )
91 switch( getCurrentElement() )
93 case XLS_TOKEN( scenarios
):
94 if( nElement
== XLS_TOKEN( scenario
) ) return new OoxScenarioContext( *this, mrSheetScenarios
);
100 void OoxScenariosContext::onStartElement( const AttributeList
& rAttribs
)
102 if( isRootElement() )
103 mrSheetScenarios
.importScenarios( rAttribs
);
106 ContextHandlerRef
OoxScenariosContext::onCreateRecordContext( sal_Int32 nRecId
, RecordInputStream
& )
108 switch( getCurrentElement() )
110 case OOBIN_ID_SCENARIOS
:
111 if( nRecId
== OOBIN_ID_SCENARIO
) return new OoxScenarioContext( *this, mrSheetScenarios
);
117 void OoxScenariosContext::onStartRecord( RecordInputStream
& rStrm
)
119 if( isRootElement() )
120 mrSheetScenarios
.importScenarios( rStrm
);
123 // ============================================================================