nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / filter / oox / tablefragment.cxx
blob99f3ede7a0d83fb8fc8ff2d1f396685a6ee7b4d7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <tablefragment.hxx>
21 #include <biffhelper.hxx>
23 #include <autofiltercontext.hxx>
24 #include <tablecolumnscontext.hxx>
25 #include <tablebuffer.hxx>
26 #include <oox/token/namespaces.hxx>
28 namespace oox::xls {
30 using namespace ::oox::core;
32 TableFragment::TableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
33 WorksheetFragmentBase( rHelper, rFragmentPath ),
34 mrTable( getTables().createTable() )
38 ContextHandlerRef TableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
40 switch( getCurrentElement() )
42 case XML_ROOT_CONTEXT:
43 if( nElement == XLS_TOKEN( table ) )
45 mrTable.importTable( rAttribs, getSheetIndex() );
46 return this;
48 break;
49 case XLS_TOKEN( table ):
50 switch (nElement)
52 case XLS_TOKEN( autoFilter ):
53 return new AutoFilterContext( *this, mrTable.createAutoFilter() );
54 case XLS_TOKEN( tableColumns ):
55 return new TableColumnsContext( *this, mrTable.createTableColumns() );
57 break;
59 return nullptr;
62 ContextHandlerRef TableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
64 switch( getCurrentElement() )
66 case XML_ROOT_CONTEXT:
67 if( nRecId == BIFF12_ID_TABLE )
69 mrTable.importTable( rStrm, getSheetIndex() );
70 return this;
72 break;
73 case BIFF12_ID_TABLE:
74 if( nRecId == BIFF12_ID_AUTOFILTER )
75 return new AutoFilterContext( *this, mrTable.createAutoFilter() );
76 break;
78 return nullptr;
81 const RecordInfo* TableFragment::getRecordInfos() const
83 static const RecordInfo spRecInfos[] =
85 { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
86 { BIFF12_ID_CUSTOMFILTERS, BIFF12_ID_CUSTOMFILTERS + 1 },
87 { BIFF12_ID_DISCRETEFILTERS, BIFF12_ID_DISCRETEFILTERS + 1 },
88 { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
89 { BIFF12_ID_TABLE, BIFF12_ID_TABLE + 1 },
90 { -1, -1 }
92 return spRecInfos;
95 } // namespace oox::xls
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */