Line data Source code
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 "tablefragment.hxx"
21 :
22 : #include "autofilterbuffer.hxx"
23 : #include "autofiltercontext.hxx"
24 : #include "tablebuffer.hxx"
25 :
26 : namespace oox {
27 : namespace xls {
28 :
29 : using namespace ::oox::core;
30 :
31 0 : TableFragment::TableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
32 : WorksheetFragmentBase( rHelper, rFragmentPath ),
33 0 : mrTable( getTables().createTable() )
34 : {
35 0 : }
36 :
37 0 : ContextHandlerRef TableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
38 : {
39 0 : switch( getCurrentElement() )
40 : {
41 : case XML_ROOT_CONTEXT:
42 0 : if( nElement == XLS_TOKEN( table ) )
43 : {
44 0 : mrTable.importTable( rAttribs, getSheetIndex() );
45 0 : return this;
46 : }
47 0 : break;
48 : case XLS_TOKEN( table ):
49 0 : if( nElement == XLS_TOKEN( autoFilter ) )
50 0 : return new AutoFilterContext( *this, mrTable.createAutoFilter() );
51 0 : break;
52 : }
53 0 : return 0;
54 : }
55 :
56 0 : ContextHandlerRef TableFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
57 : {
58 0 : switch( getCurrentElement() )
59 : {
60 : case XML_ROOT_CONTEXT:
61 0 : if( nRecId == BIFF12_ID_TABLE )
62 : {
63 0 : mrTable.importTable( rStrm, getSheetIndex() );
64 0 : return this;
65 : }
66 0 : break;
67 : case BIFF12_ID_TABLE:
68 0 : if( nRecId == BIFF12_ID_AUTOFILTER )
69 0 : return new AutoFilterContext( *this, mrTable.createAutoFilter() );
70 0 : break;
71 : }
72 0 : return 0;
73 : }
74 :
75 0 : const RecordInfo* TableFragment::getRecordInfos() const
76 : {
77 : static const RecordInfo spRecInfos[] =
78 : {
79 : { BIFF12_ID_AUTOFILTER, BIFF12_ID_AUTOFILTER + 1 },
80 : { BIFF12_ID_CUSTOMFILTERS, BIFF12_ID_CUSTOMFILTERS + 1 },
81 : { BIFF12_ID_DISCRETEFILTERS, BIFF12_ID_DISCRETEFILTERS + 1 },
82 : { BIFF12_ID_FILTERCOLUMN, BIFF12_ID_FILTERCOLUMN + 1 },
83 : { BIFF12_ID_TABLE, BIFF12_ID_TABLE + 1 },
84 : { -1, -1 }
85 : };
86 0 : return spRecInfos;
87 : }
88 :
89 : } // namespace xls
90 48 : } // namespace oox
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|