LibreOffice Module sw (master) 1
dbinsdlg.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#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX
21#define INCLUDED_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX
22
23#include <utility>
24#include <vcl/weld.hxx>
25#include <sfx2/basedlgs.hxx>
27#include "numfmtlb.hxx"
28#include <swdbdata.hxx>
29#include <com/sun/star/uno/Reference.h>
30#include <com/sun/star/uno/Sequence.h>
32
33#include <memory>
34#include <vector>
35
36namespace com::sun::star{
37 namespace sdbcx{
38 class XColumnsSupplier;
39 }
40 namespace sdbc{
41 class XDataSource;
42 class XConnection;
43 class XResultSet;
44 }
45}
46
48class SwView;
49class SfxItemSet;
50class SwTableRep;
51struct DB_Column;
52
53typedef std::vector<std::unique_ptr<DB_Column>> DB_Columns;
54
56{
58 sal_Int32 nDBNumFormat;
59 sal_uInt32 nUsrNumFormat;
61 bool bHasFormat : 1;
62 bool bIsDBFormat : 1;
63
64 SwInsDBColumn( OUString aStr )
65 : sColumn(std::move( aStr )),
66 nDBNumFormat( 0 ),
67 nUsrNumFormat( 0 ),
69 bHasFormat(false),
70 bIsDBFormat(true)
71 {}
72
73 bool operator<( const SwInsDBColumn& rCmp ) const;
74};
75
76class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_uniqueptr_to<SwInsDBColumn> >
77{
78};
79
81{
84
85 OUString m_sNoTmpl;
86
88 std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat;
89
90 std::unique_ptr<SfxItemSet> m_pTableSet;
91 std::unique_ptr<SwTableRep> m_pRep;
92 sal_Int32 m_nGBFormatLen;
93
94 std::unique_ptr<weld::RadioButton> m_xRbAsTable;
95 std::unique_ptr<weld::RadioButton> m_xRbAsField;
96 std::unique_ptr<weld::RadioButton> m_xRbAsText;
97
98 std::unique_ptr<weld::Frame> m_xHeadFrame;
99
100 std::unique_ptr<weld::TreeView> m_xLbTableDbColumn;
101 std::unique_ptr<weld::TreeView> m_xLbTextDbColumn;
102
103 std::unique_ptr<weld::Frame> m_xFormatFrame;
104 std::unique_ptr<weld::RadioButton> m_xRbDbFormatFromDb;
105 std::unique_ptr<weld::RadioButton> m_xRbDbFormatFromUsr;
106 std::unique_ptr<NumFormatListBox> m_xLbDbFormatFromUsr;
107
108 // Page Text/Field
109 std::unique_ptr<weld::Button> m_xIbDbcolToEdit;
110 std::unique_ptr<weld::TextView> m_xEdDbText;
111 std::unique_ptr<weld::Label> m_xFtDbParaColl;
112 std::unique_ptr<weld::ComboBox> m_xLbDbParaColl;
113
114 // Page Table
115 std::unique_ptr<weld::Button> m_xIbDbcolAllTo;
116 std::unique_ptr<weld::Button> m_xIbDbcolOneTo;
117 std::unique_ptr<weld::Button> m_xIbDbcolOneFrom;
118 std::unique_ptr<weld::Button> m_xIbDbcolAllFrom;
119 std::unique_ptr<weld::Label> m_xFtTableCol;
120 std::unique_ptr<weld::TreeView> m_xLbTableCol;
121 std::unique_ptr<weld::CheckButton> m_xCbTableHeadon;
122 std::unique_ptr<weld::RadioButton> m_xRbHeadlColnms;
123 std::unique_ptr<weld::RadioButton> m_xRbHeadlEmpty;
124 std::unique_ptr<weld::Button> m_xPbTableFormat;
125 std::unique_ptr<weld::Button> m_xPbTableAutofmt;
126
127 DECL_LINK( PageHdl, weld::Toggleable&, void );
128 DECL_LINK( AutoFormatHdl, weld::Button&, void );
129 DECL_LINK( TableFormatHdl, weld::Button&, void );
130 DECL_LINK( DBFormatHdl, weld::Toggleable&, void );
131 DECL_LINK( TableToFromHdl, weld::Button&, void );
132 DECL_LINK( TVSelectHdl, weld::TreeView&, void );
133 DECL_LINK( CBSelectHdl, weld::ComboBox&, void );
134 DECL_LINK( DblClickHdl, weld::TreeView&, bool );
135 DECL_LINK( HeaderHdl, weld::Toggleable&, void );
136
137 bool SplitTextToColArr( const OUString& rText, DB_Columns& rColArr, bool bInsField );
138 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
139 virtual void ImplCommit() override;
140 void Load();
141
142 // set the tables - properties
143 void SetTabSet();
144
145public:
147 css::uno::Reference< css::sdbc::XDataSource> const & rxSource,
148 css::uno::Reference<css::sdbcx::XColumnsSupplier> const & xColSupp,
149 SwDBData aData );
150
151 virtual ~SwInsertDBColAutoPilot() override;
152
153 void DataToDoc( const css::uno::Sequence< css::uno::Any >& rSelection,
154 css::uno::Reference< css::sdbc::XDataSource> const & rxSource,
155 css::uno::Reference< css::sdbc::XConnection> const & xConnection,
156 css::uno::Reference< css::sdbc::XResultSet > const & xResultSet);
157
158};
159
160#endif
161
162/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwInsertDBColAutoPilot(SwView &rView, css::uno::Reference< css::sdbc::XDataSource > const &rxSource, css::uno::Reference< css::sdbcx::XColumnsSupplier > const &xColSupp, SwDBData aData)
Definition: dbinsdlg.cxx:173
DECL_LINK(CBSelectHdl, weld::ComboBox &, void)
std::unique_ptr< SwTableRep > m_pRep
Definition: dbinsdlg.hxx:91
virtual ~SwInsertDBColAutoPilot() override
Definition: dbinsdlg.cxx:388
std::unique_ptr< SfxItemSet > m_pTableSet
Definition: dbinsdlg.hxx:90
SwInsDBColumns m_aDBColumns
Definition: dbinsdlg.hxx:82
std::unique_ptr< weld::RadioButton > m_xRbHeadlColnms
Definition: dbinsdlg.hxx:122
DECL_LINK(DBFormatHdl, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > m_xCbTableHeadon
Definition: dbinsdlg.hxx:121
DECL_LINK(TableFormatHdl, weld::Button &, void)
std::unique_ptr< weld::Label > m_xFtDbParaColl
Definition: dbinsdlg.hxx:111
DECL_LINK(AutoFormatHdl, weld::Button &, void)
const SwDBData m_aDBData
Definition: dbinsdlg.hxx:83
bool SplitTextToColArr(const OUString &rText, DB_Columns &rColArr, bool bInsField)
Definition: dbinsdlg.cxx:833
std::unique_ptr< weld::Frame > m_xFormatFrame
Definition: dbinsdlg.hxx:103
std::unique_ptr< weld::Button > m_xIbDbcolToEdit
Definition: dbinsdlg.hxx:109
std::unique_ptr< weld::RadioButton > m_xRbAsTable
Definition: dbinsdlg.hxx:94
std::unique_ptr< weld::RadioButton > m_xRbAsField
Definition: dbinsdlg.hxx:95
std::unique_ptr< weld::Frame > m_xHeadFrame
Definition: dbinsdlg.hxx:98
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
sal_Int32 m_nGBFormatLen
Definition: dbinsdlg.hxx:92
void DataToDoc(const css::uno::Sequence< css::uno::Any > &rSelection, css::uno::Reference< css::sdbc::XDataSource > const &rxSource, css::uno::Reference< css::sdbc::XConnection > const &xConnection, css::uno::Reference< css::sdbc::XResultSet > const &xResultSet)
Definition: dbinsdlg.cxx:910
std::unique_ptr< weld::TextView > m_xEdDbText
Definition: dbinsdlg.hxx:110
DECL_LINK(TableToFromHdl, weld::Button &, void)
std::unique_ptr< weld::RadioButton > m_xRbDbFormatFromDb
Definition: dbinsdlg.hxx:104
std::unique_ptr< weld::TreeView > m_xLbTextDbColumn
Definition: dbinsdlg.hxx:101
std::unique_ptr< weld::TreeView > m_xLbTableCol
Definition: dbinsdlg.hxx:120
std::unique_ptr< weld::Button > m_xIbDbcolAllFrom
Definition: dbinsdlg.hxx:118
std::unique_ptr< weld::Label > m_xFtTableCol
Definition: dbinsdlg.hxx:119
std::unique_ptr< weld::Button > m_xIbDbcolAllTo
Definition: dbinsdlg.hxx:115
std::unique_ptr< weld::RadioButton > m_xRbHeadlEmpty
Definition: dbinsdlg.hxx:123
std::unique_ptr< weld::Button > m_xPbTableFormat
Definition: dbinsdlg.hxx:124
std::unique_ptr< weld::ComboBox > m_xLbDbParaColl
Definition: dbinsdlg.hxx:112
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: dbinsdlg.cxx:1468
std::unique_ptr< NumFormatListBox > m_xLbDbFormatFromUsr
Definition: dbinsdlg.hxx:106
std::unique_ptr< SwTableAutoFormat > m_xTAutoFormat
Definition: dbinsdlg.hxx:88
std::unique_ptr< weld::Button > m_xIbDbcolOneTo
Definition: dbinsdlg.hxx:116
std::unique_ptr< weld::RadioButton > m_xRbAsText
Definition: dbinsdlg.hxx:96
std::unique_ptr< weld::TreeView > m_xLbTableDbColumn
Definition: dbinsdlg.hxx:100
std::unique_ptr< weld::Button > m_xPbTableAutofmt
Definition: dbinsdlg.hxx:125
DECL_LINK(TVSelectHdl, weld::TreeView &, void)
DECL_LINK(PageHdl, weld::Toggleable &, void)
virtual void ImplCommit() override
Definition: dbinsdlg.cxx:1470
DECL_LINK(HeaderHdl, weld::Toggleable &, void)
std::unique_ptr< weld::RadioButton > m_xRbDbFormatFromUsr
Definition: dbinsdlg.hxx:105
std::unique_ptr< weld::Button > m_xIbDbcolOneFrom
Definition: dbinsdlg.hxx:117
Definition: view.hxx:146
std::vector< std::unique_ptr< DB_Column > > DB_Columns
Definition: dbinsdlg.hxx:51
#define LANGUAGE_SYSTEM
aStr
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
bool bHasFormat
Definition: dbinsdlg.hxx:61
sal_uInt32 nUsrNumFormat
Definition: dbinsdlg.hxx:59
sal_Int32 nDBNumFormat
Definition: dbinsdlg.hxx:58
bool operator<(const SwInsDBColumn &rCmp) const
Definition: dbinsdlg.cxx:168
OUString sUsrNumFormat
Definition: dbinsdlg.hxx:57
OUString sColumn
Definition: dbinsdlg.hxx:57
bool bIsDBFormat
Definition: dbinsdlg.hxx:62
SwInsDBColumn(OUString aStr)
Definition: dbinsdlg.hxx:64
LanguageType eUsrNumFormatLng
Definition: dbinsdlg.hxx:60