LibreOffice Module sc (master) 1
connectionsbuffer.hxx
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#pragma once
21
22#include <memory>
24#include "workbookhelper.hxx"
25
26namespace oox { class AttributeList; }
27namespace oox { class SequenceInputStream; }
28
29namespace oox::xls {
30
31const sal_Int32 BIFF12_CONNECTION_UNKNOWN = 0;
32const sal_Int32 BIFF12_CONNECTION_ODBC = 1;
33const sal_Int32 BIFF12_CONNECTION_DAO = 2;
34const sal_Int32 BIFF12_CONNECTION_FILE = 3;
35const sal_Int32 BIFF12_CONNECTION_HTML = 4;
36const sal_Int32 BIFF12_CONNECTION_OLEDB = 5;
37const sal_Int32 BIFF12_CONNECTION_TEXT = 6;
38const sal_Int32 BIFF12_CONNECTION_ADO = 7;
39const sal_Int32 BIFF12_CONNECTION_DSP = 8;
40
43{
44 typedef ::std::vector< css::uno::Any > TablesVector;
45
47 OUString maUrl;
48 OUString maPostMethod;
49 OUString maEditPage;
50 sal_Int32 mnHtmlFormat;
51 bool mbXml;
60
61 explicit WebPrModel();
62};
63
66{
67 typedef ::std::unique_ptr< WebPrModel > WebPrModelPtr;
68
70 OUString maName;
71 OUString maDescription;
72 OUString maSourceFile;
74 OUString maSsoId;
75 sal_Int32 mnId;
76 sal_Int32 mnType;
78 sal_Int32 mnCredentials;
79 sal_Int32 mnInterval;
81 bool mbNew;
82 bool mbDeleted;
88
89 explicit ConnectionModel();
90
92};
93
95class Connection final : public WorkbookHelper
96{
97public:
98 explicit Connection( const WorkbookHelper& rHelper );
99
101 void importConnection( const AttributeList& rAttribs );
103 void importWebPr( const AttributeList& rAttribs );
105 void importTables();
107 void importTable( const AttributeList& rAttribs, sal_Int32 nElement );
108
116 void importWebPrTable( SequenceInputStream& rStrm, sal_Int32 nRecId );
117
119 sal_Int32 getConnectionId() const { return maModel.mnId; }
121 sal_Int32 getConnectionType() const { return maModel.mnType; }
123 const ConnectionModel& getModel() const { return maModel; }
124
125private:
127};
128
129typedef std::shared_ptr< Connection > ConnectionRef;
130
132{
133public:
134 explicit ConnectionsBuffer( const WorkbookHelper& rHelper );
135
138
140 void finalizeImport();
141
143 ConnectionRef getConnection( sal_Int32 nConnId ) const;
144
145private:
147 void insertConnectionToMap( const ConnectionRef& rxConnection );
148
149private:
152
155 sal_Int32 mnUnusedId;
156};
157
158} // namespace oox::xls
159
160/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An external data connection (database, web query, etc.).
void importTables()
Imports web query table settings from the tables element.
sal_Int32 getConnectionId() const
Returns the unique connection identifier.
void importWebPr(const AttributeList &rAttribs)
Imports web query settings from the webPr element.
void importWebPrTable(SequenceInputStream &rStrm, sal_Int32 nRecId)
Imports a web query table identifier from the PCITEM_MISSING, PCITEM_STRING, or PCITEM_INDEX record.
void importTable(const AttributeList &rAttribs, sal_Int32 nElement)
Imports a web query table identifier from the m, s, or x element.
const ConnectionModel & getModel() const
Returns read-only access to the connection model data.
sal_Int32 getConnectionType() const
Returns the source data type of the connection.
Connection(const WorkbookHelper &rHelper)
void importConnection(const AttributeList &rAttribs)
Imports connection settings from the connection element.
void importWebPrTables(SequenceInputStream &rStrm)
Imports web query table settings from the WEBPRTABLES record.
ConnectionRef getConnection(sal_Int32 nConnId) const
Returns a data connection by its unique identifier.
ConnectionsBuffer(const WorkbookHelper &rHelper)
RefVector< Connection > ConnectionVector
void finalizeImport()
Maps all connections by their identifier.
RefMap< sal_Int32, Connection > ConnectionMap
Connection & createConnection()
Creates a new empty connection.
void insertConnectionToMap(const ConnectionRef &rxConnection)
Inserts the passed connection into the map according to its identifier.
Helper class to provide access to global workbook data.
void SvStream & rStrm
const sal_Int32 BIFF12_CONNECTION_TEXT
const sal_Int32 BIFF12_CONNECTION_DSP
const sal_Int32 BIFF12_CONNECTION_ADO
const sal_Int32 BIFF12_CONNECTION_OLEDB
const sal_Int32 BIFF12_CONNECTION_HTML
const sal_Int32 BIFF12_CONNECTION_FILE
const sal_Int32 BIFF12_CONNECTION_ODBC
const sal_Int32 BIFF12_CONNECTION_UNKNOWN
const sal_Int32 BIFF12_CONNECTION_DAO
std::shared_ptr< Connection > ConnectionRef
Common properties of an external data connection.
sal_Int32 mnId
Single sign-on identifier.
sal_Int32 mnInterval
Credentials method.
sal_Int32 mnReconnectMethod
Data source type.
OUString maName
Special settings for web queries.
::std::unique_ptr< WebPrModel > WebPrModelPtr
OUString maSsoId
URL of a source connection file.
bool mbSavePassword
True = save cached data with connection.
bool mbKeepAlive
Refresh interval in minutes.
bool mbSaveData
True = refresh connection on import.
bool mbBackground
True = use maSourceConnFile, ignore mnReconnectMethod.
bool mbNew
True = keep connection open after import.
ConnectionModel()
True = save password in connection string.
bool mbRefreshOnLoad
True = background refresh enabled.
OUString maDescription
Unique name of this connection.
sal_Int32 mnCredentials
Reconnection method.
OUString maSourceFile
User description of this connection.
bool mbDeleted
True = new connection, never updated.
sal_Int32 mnType
Unique connection identifier.
OUString maSourceConnFile
URL of a source data file.
bool mbOnlyUseConnFile
True = connection has been deleted.
Special properties for data connections representing web queries.
WebPrModel()
True = HTML tables, false = entire document.
OUString maPostMethod
Source URL to refresh the data.
OUString maEditPage
POST method to query data.
bool mbXl2000Refreshed
True = read date values as text, false = parse dates.
bool mbHtmlTables
True = refreshed with Excel 2000 or newer.
::std::vector< css::uno::Any > TablesVector
bool mbTextDates
True = web query created with Excel 97.
bool mbXl97Created
True = use column widths of first row for entire.
bool mbParsePre
True = import XML source data referred by HTML table.
bool mbConsecutive
True = parse preformatted sections (.
OUString maUrl
Names or indexes of the web query tables.
bool mbSourceData
True = XML query, false = HTML query.
bool mbFirstRow
True = join consecutive delimiters.
sal_Int32 mnHtmlFormat
Web page showing query data (for XML queries).
bool mbXml
Plain text, rich text, or HTML.