fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / oox / tablecolumnsbuffer.cxx
blob4bc71ddbcd3f3577316ddcca38c11db84fb542e2
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 "tablecolumnsbuffer.hxx"
22 #include <com/sun/star/sheet/XDatabaseRange.hpp>
23 #include <rtl/ustrbuf.hxx>
24 #include <osl/diagnose.h>
25 #include <oox/helper/attributelist.hxx>
26 #include <oox/helper/containerhelper.hxx>
27 #include <oox/helper/propertyset.hxx>
28 #include <oox/token/properties.hxx>
29 #include "addressconverter.hxx"
30 #include "biffinputstream.hxx"
31 #include "defnamesbuffer.hxx"
32 #include "dbdata.hxx"
34 namespace oox {
35 namespace xls {
37 using namespace ::com::sun::star::sheet;
38 using namespace ::com::sun::star::table;
39 using namespace ::com::sun::star::uno;
41 TableColumn::TableColumn( const WorkbookHelper& rHelper ) :
42 WorkbookHelper( rHelper ),
43 mnId( -1 ),
44 mnDataDxfId( -1 )
48 void TableColumn::importTableColumn( const AttributeList& rAttribs )
50 mnId = rAttribs.getInteger( XML_id, -1 );
51 maName = rAttribs.getString( XML_name, OUString() );
52 mnDataDxfId = rAttribs.getInteger( XML_dataDxfId, -1 );
55 void TableColumn::importTableColumn( SequenceInputStream& /*rStrm*/ )
57 /* XXX not implemented */
58 (void) mnId;
61 const OUString& TableColumn::getName() const
63 return maName;
66 TableColumns::TableColumns( const WorkbookHelper& rHelper ) :
67 WorkbookHelper( rHelper ),
68 mnCount(0)
72 void TableColumns::importTableColumns( const AttributeList& rAttribs )
74 mnCount = rAttribs.getInteger( XML_count, 0 );
77 void TableColumns::importTableColumns( SequenceInputStream& /*rStrm*/ )
79 /* XXX not implemented */
80 (void) mnCount;
83 TableColumn& TableColumns::createTableColumn()
85 TableColumnVector::value_type xTableColumn( new TableColumn( *this ) );
86 maTableColumnVector.push_back( xTableColumn );
87 return *xTableColumn;
90 bool TableColumns::finalizeImport( ScDBData* pDBData )
92 SAL_WARN_IF( static_cast<size_t>(mnCount) != maTableColumnVector.size(), "sc.filter",
93 "TableColumns::finalizeImport - count attribute doesn't match number of tableColumn elements");
94 if ( pDBData )
96 /* TODO: use svl::SharedString for names */
97 ::std::vector< OUString > aNames( maTableColumnVector.size());
98 size_t i = 0;
99 for (TableColumnVector::const_iterator aIt = maTableColumnVector.begin(), aEnd = maTableColumnVector.end();
100 aIt != aEnd; ++aIt, ++i)
102 aNames[i] = (*aIt)->getName();
104 pDBData->SetTableColumnNames( aNames);
105 return true;
107 return false;
110 TableColumnsBuffer::TableColumnsBuffer( const WorkbookHelper& rHelper ) :
111 WorkbookHelper( rHelper )
115 TableColumns& TableColumnsBuffer::createTableColumns()
117 TableColumnsVector::value_type xTableColumns( new TableColumns( *this ) );
118 maTableColumnsVector.push_back( xTableColumns );
119 return *xTableColumns;
122 bool TableColumnsBuffer::finalizeImport( ScDBData* pDBData )
124 TableColumns* pTableColumns = getActiveTableColumns();
125 if ( pTableColumns )
126 return pTableColumns->finalizeImport( pDBData );
127 return false;
130 TableColumns* TableColumnsBuffer::getActiveTableColumns()
132 // not more than one table columns descriptor per table
133 SAL_WARN_IF( maTableColumnsVector.size() > 1, "sc.filter",
134 "TableColumnsBuffer::getActiveTableColumns - too many table columns" );
135 // stick to the last imported table columns
136 return maTableColumnsVector.empty() ? 0 : maTableColumnsVector.back().get();
139 } // namespace xls
140 } // namespace oox
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */