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