LibreOffice Module sc (master) 1
tablefragment.cxx
Go to the documentation of this file.
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#include <biffhelper.hxx>
22
23#include <autofiltercontext.hxx>
25#include <tablebuffer.hxx>
26#include <oox/token/namespaces.hxx>
27
28namespace oox::xls {
29
30using namespace ::oox::core;
31
32TableFragment::TableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
33 WorksheetFragmentBase( rHelper, rFragmentPath ),
34 mrTable( getTables().createTable() )
35{
36}
37
39{
40 switch( getCurrentElement() )
41 {
43 if( nElement == XLS_TOKEN( table ) )
44 {
45 mrTable.importTable( rAttribs, getSheetIndex() );
46 return this;
47 }
48 break;
49 case XLS_TOKEN( table ):
50 switch (nElement)
51 {
52 case XLS_TOKEN( autoFilter ):
53 return new AutoFilterContext( *this, mrTable.createAutoFilter() );
54 case XLS_TOKEN( tableColumns ):
55 return new TableColumnsContext( *this, mrTable.createTableColumns() );
56 }
57 break;
58 }
59 return nullptr;
60}
61
63{
64 switch( getCurrentElement() )
65 {
67 if( nRecId == BIFF12_ID_TABLE )
68 {
70 return this;
71 }
72 break;
73 case BIFF12_ID_TABLE:
74 if( nRecId == BIFF12_ID_AUTOFILTER )
75 return new AutoFilterContext( *this, mrTable.createAutoFilter() );
76 break;
77 }
78 return nullptr;
79}
80
81const RecordInfo* TableFragment::getRecordInfos() const
82{
83 static const RecordInfo spRecInfos[] =
84 {
90 { -1, -1 }
91 };
92 return spRecInfos;
93}
94
95} // namespace oox::xls
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TableFragment(const WorksheetHelper &rHelper, const OUString &rFragmentPath)
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
virtual const ::oox::core::RecordInfo * getRecordInfos() const override
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
void importTable(const AttributeList &rAttribs, sal_Int16 nSheet)
Imports a table definition from the passed attributes.
Definition: tablebuffer.cxx:57
TableColumns & createTableColumns()
Creates a new tableColumns handler and stores it internally.
Definition: tablebuffer.hxx:53
AutoFilter & createAutoFilter()
Creates a new auto filter and stores it internally.
Definition: tablebuffer.hxx:51
Fragment handler derived from the WorksheetHelper helper class.
SCTAB getSheetIndex() const
Returns the index of the current sheet.
@ table
void SvStream & rStrm
const sal_Int32 XML_ROOT_CONTEXT
const sal_Int32 BIFF12_ID_FILTERCOLUMN
Definition: biffhelper.hxx:121
const sal_Int32 BIFF12_ID_CUSTOMFILTERS
Definition: biffhelper.hxx:80
const sal_Int32 BIFF12_ID_DISCRETEFILTERS
Definition: biffhelper.hxx:96
const sal_Int32 BIFF12_ID_TABLE
Definition: biffhelper.hxx:225
const sal_Int32 BIFF12_ID_AUTOFILTER
Definition: biffhelper.hxx:32