LibreOffice Module dbaccess (master) 1
TableCopyHelper.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#pragma once
20
21#include "AppElementType.hxx"
22#include "commontypes.hxx"
24#include <sot/storage.hxx>
25#include <vcl/transfer.hxx>
26#include <vcl/weld.hxx>
27#include <com/sun/star/sdbc/XConnection.hpp>
28#include <com/sun/star/sdbc/XResultSet.hpp>
29
30namespace dbaui
31{
32 class OGenericUnoController;
35 {
38 : eEntryType(_eEntryType)
39 {
40 }
41
42 bool operator()(const DataFlavorExVector::value_type& _aType)
43 {
44 switch (_aType.mnSotId)
45 {
46 case SotClipboardFormatId::RTF: // RTF data descriptions
47 case SotClipboardFormatId::HTML: // HTML data descriptions
48 case SotClipboardFormatId::DBACCESS_TABLE: // table descriptor
49 return (E_TABLE == eEntryType);
50 case SotClipboardFormatId::DBACCESS_QUERY: // query descriptor
51 case SotClipboardFormatId::DBACCESS_COMMAND: // SQL command
52 return E_QUERY == eEntryType;
53 default: break;
54 }
55 return false;
56 }
57 };
58
60 {
61 private:
64
65 public:
66 // is needed to describe the drop target
68 {
70
71 //for transfor the tablename
73
74 OUString aUrl;
77 std::unique_ptr<weld::TreeIter> xDroppedAt;
79 bool bHtml;
80 bool bError;
81
83 : nType(E_TABLE)
85 , bHtml(false)
86 , bError(false)
87 { }
88 };
89
91
98 void pasteTable( const TransferableDataHelper& _rTransData
99 ,std::u16string_view _sDestDataSourceName
100 ,const SharedConnection& _xConnection);
101
110 void pasteTable( SotClipboardFormatId _nFormatId
111 ,const TransferableDataHelper& _rTransData
112 ,std::u16string_view _sDestDataSourceName
113 ,const SharedConnection& _xConnection);
114
123 bool copyTagTable( DropDescriptor const & _rDesc,
124 bool _bCheck,
125 const SharedConnection& _xConnection);
126
135 void asyncCopyTagTable( DropDescriptor& _rDesc
136 ,std::u16string_view _sDestDataSourceName
137 ,const SharedConnection& _xConnection);
138
147 bool copyTagTable(const TransferableDataHelper& _aDroppedData,
148 DropDescriptor& _rAsyncDrop,
149 const SharedConnection& _xConnection);
150
152 static bool isTableFormat(const TransferableDataHelper& _rClipboard);
153
154 void SetTableNameForAppend( const OUString& _rDefaultTableName ) { m_sTableNameForAppend = _rDefaultTableName; }
156 const OUString& GetTableNameForAppend() const { return m_sTableNameForAppend ;}
157
158 private:
165 void pasteTable(
166 const svx::ODataAccessDescriptor& _rPasteData,
167 std::u16string_view _sDestDataSourceName,
168 const SharedConnection& _xDestConnection
169 );
170
173 void insertTable(
174 std::u16string_view i_rSourceDataSource,
175 const css::uno::Reference< css::sdbc::XConnection>& i_rSourceConnection,
176 const OUString& i_rCommand,
177 const sal_Int32 i_nCommandType,
178 const css::uno::Reference< css::sdbc::XResultSet >& i_rSourceRows,
179 const css::uno::Sequence< css::uno::Any >& i_rSelection,
180 const bool i_bBookmarkSelection,
181 std::u16string_view i_rDestDataSource,
182 const css::uno::Reference< css::sdbc::XConnection>& i_rDestConnection
183 );
184
185 };
186} // namespace dbaui
187
188/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool isTableFormat(const TransferableDataHelper &_rClipboard)
returns <TRUE> if the clipboard supports a table format, otherwise <FALSE>.
OGenericUnoController * m_pController
void pasteTable(const TransferableDataHelper &_rTransData, std::u16string_view _sDestDataSourceName, const SharedConnection &_xConnection)
pastes a table into the data source
bool copyTagTable(DropDescriptor const &_rDesc, bool _bCheck, const SharedConnection &_xConnection)
copies a table which was constructed by tags like HTML or RTF
void asyncCopyTagTable(DropDescriptor &_rDesc, std::u16string_view _sDestDataSourceName, const SharedConnection &_xConnection)
copies a table which was constructed by tags like HTML or RTF
OTableCopyHelper(OGenericUnoController *_pController)
const OUString & GetTableNameForAppend() const
void insertTable(std::u16string_view i_rSourceDataSource, const css::uno::Reference< css::sdbc::XConnection > &i_rSourceConnection, const OUString &i_rCommand, const sal_Int32 i_nCommandType, const css::uno::Reference< css::sdbc::XResultSet > &i_rSourceRows, const css::uno::Sequence< css::uno::Any > &i_rSelection, const bool i_bBookmarkSelection, std::u16string_view i_rDestDataSource, const css::uno::Reference< css::sdbc::XConnection > &i_rDestConnection)
insert a table into the data source.
void SetTableNameForAppend(const OUString &_rDefaultTableName)
SotClipboardFormatId
svx::ODataAccessDescriptor aDroppedData
std::unique_ptr< weld::TreeIter > xDroppedAt
tools::SvRef< SotTempStream > aHtmlRtfStorage
Functor object for class DataFlavorExVector::value_type returntype is bool.
TAppSupportedSotFunctor(const ElementType &_eEntryType)
bool operator()(const DataFlavorExVector::value_type &_aType)
#define DND_ACTION_NONE
signed char sal_Int8