1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_DBINSDLG_HXX
24 #include <vcl/weld.hxx>
25 #include <sfx2/basedlgs.hxx>
26 #include <unotools/configitem.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>
31 #include <o3tl/sorted_vector.hxx>
36 namespace com::sun::star
{
38 class XColumnsSupplier
;
47 class SwTableAutoFormat
;
53 typedef std::vector
<std::unique_ptr
<DB_Column
>> DB_Columns
;
57 OUString sColumn
, sUsrNumFormat
;
58 sal_Int32 nDBNumFormat
;
59 sal_uInt32 nUsrNumFormat
;
60 LanguageType eUsrNumFormatLng
;
64 SwInsDBColumn( OUString aStr
)
65 : sColumn(std::move( aStr
)),
68 eUsrNumFormatLng( LANGUAGE_SYSTEM
),
73 bool operator<( const SwInsDBColumn
& rCmp
) const;
76 class SwInsDBColumns
: public o3tl::sorted_vector
<std::unique_ptr
<SwInsDBColumn
>, o3tl::less_ptr_to
>
80 class SwInsertDBColAutoPilot final
: public SfxDialogController
, public utl::ConfigItem
82 SwInsDBColumns m_aDBColumns
;
83 const SwDBData m_aDBData
;
88 std::unique_ptr
<SwTableAutoFormat
> m_xTAutoFormat
;
90 std::unique_ptr
<SfxItemSet
> m_pTableSet
;
91 std::unique_ptr
<SwTableRep
> m_pRep
;
92 sal_Int32 m_nGBFormatLen
;
94 std::unique_ptr
<weld::RadioButton
> m_xRbAsTable
;
95 std::unique_ptr
<weld::RadioButton
> m_xRbAsField
;
96 std::unique_ptr
<weld::RadioButton
> m_xRbAsText
;
98 std::unique_ptr
<weld::Frame
> m_xHeadFrame
;
100 std::unique_ptr
<weld::TreeView
> m_xLbTableDbColumn
;
101 std::unique_ptr
<weld::TreeView
> m_xLbTextDbColumn
;
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
;
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
;
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
;
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 );
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
;
142 // set the tables - properties
146 SwInsertDBColAutoPilot( SwView
& rView
,
147 css::uno::Reference
< css::sdbc::XDataSource
> const & rxSource
,
148 css::uno::Reference
<css::sdbcx::XColumnsSupplier
> const & xColSupp
,
151 virtual ~SwInsertDBColAutoPilot() override
;
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
);
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */