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
23 #include <vcl/weld.hxx>
24 #include <sfx2/basedlgs.hxx>
25 #include <unotools/configitem.hxx>
26 #include "numfmtlb.hxx"
27 #include <swdbdata.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <com/sun/star/uno/Sequence.h>
30 #include <o3tl/sorted_vector.hxx>
35 namespace com::sun::star
{
37 class XColumnsSupplier
;
46 class SwTableAutoFormat
;
52 typedef std::vector
<std::unique_ptr
<DB_Column
>> DB_Columns
;
56 OUString sColumn
, sUsrNumFormat
;
57 sal_Int32 nDBNumFormat
;
58 sal_uInt32 nUsrNumFormat
;
59 LanguageType eUsrNumFormatLng
;
63 SwInsDBColumn( const OUString
& rStr
)
67 eUsrNumFormatLng( LANGUAGE_SYSTEM
),
72 bool operator<( const SwInsDBColumn
& rCmp
) const;
75 class SwInsDBColumns
: public o3tl::sorted_vector
<std::unique_ptr
<SwInsDBColumn
>, o3tl::less_uniqueptr_to
<SwInsDBColumn
> >
79 class SwInsertDBColAutoPilot
: public SfxDialogController
, public utl::ConfigItem
81 SwInsDBColumns aDBColumns
;
82 const SwDBData aDBData
;
87 std::unique_ptr
<SwTableAutoFormat
> m_xTAutoFormat
;
89 std::unique_ptr
<SfxItemSet
> pTableSet
;
90 std::unique_ptr
<SwTableRep
> pRep
;
91 sal_Int32 nGBFormatLen
;
93 std::unique_ptr
<weld::RadioButton
> m_xRbAsTable
;
94 std::unique_ptr
<weld::RadioButton
> m_xRbAsField
;
95 std::unique_ptr
<weld::RadioButton
> m_xRbAsText
;
97 std::unique_ptr
<weld::Frame
> m_xHeadFrame
;
99 std::unique_ptr
<weld::TreeView
> m_xLbTableDbColumn
;
100 std::unique_ptr
<weld::TreeView
> m_xLbTextDbColumn
;
102 std::unique_ptr
<weld::Frame
> m_xFormatFrame
;
103 std::unique_ptr
<weld::RadioButton
> m_xRbDbFormatFromDb
;
104 std::unique_ptr
<weld::RadioButton
> m_xRbDbFormatFromUsr
;
105 std::unique_ptr
<NumFormatListBox
> m_xLbDbFormatFromUsr
;
108 std::unique_ptr
<weld::Button
> m_xIbDbcolToEdit
;
109 std::unique_ptr
<weld::TextView
> m_xEdDbText
;
110 std::unique_ptr
<weld::Label
> m_xFtDbParaColl
;
111 std::unique_ptr
<weld::ComboBox
> m_xLbDbParaColl
;
114 std::unique_ptr
<weld::Button
> m_xIbDbcolAllTo
;
115 std::unique_ptr
<weld::Button
> m_xIbDbcolOneTo
;
116 std::unique_ptr
<weld::Button
> m_xIbDbcolOneFrom
;
117 std::unique_ptr
<weld::Button
> m_xIbDbcolAllFrom
;
118 std::unique_ptr
<weld::Label
> m_xFtTableCol
;
119 std::unique_ptr
<weld::TreeView
> m_xLbTableCol
;
120 std::unique_ptr
<weld::CheckButton
> m_xCbTableHeadon
;
121 std::unique_ptr
<weld::RadioButton
> m_xRbHeadlColnms
;
122 std::unique_ptr
<weld::RadioButton
> m_xRbHeadlEmpty
;
123 std::unique_ptr
<weld::Button
> m_xPbTableFormat
;
124 std::unique_ptr
<weld::Button
> m_xPbTableAutofmt
;
126 DECL_LINK( PageHdl
, weld::Button
&, void );
127 DECL_LINK( AutoFormatHdl
, weld::Button
&, void );
128 DECL_LINK( TableFormatHdl
, weld::Button
&, void );
129 DECL_LINK( DBFormatHdl
, weld::Button
&, void );
130 DECL_LINK( TableToFromHdl
, weld::Button
&, void );
131 DECL_LINK( TVSelectHdl
, weld::TreeView
&, void );
132 DECL_LINK( CBSelectHdl
, weld::ComboBox
&, void );
133 DECL_LINK( DblClickHdl
, weld::TreeView
&, bool );
134 DECL_LINK( HeaderHdl
, weld::Button
&, void );
136 bool SplitTextToColArr( const OUString
& rText
, DB_Columns
& rColArr
, bool bInsField
);
137 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
138 virtual void ImplCommit() override
;
141 // set the tables - properties
145 SwInsertDBColAutoPilot( SwView
& rView
,
146 css::uno::Reference
< css::sdbc::XDataSource
> const & rxSource
,
147 css::uno::Reference
<css::sdbcx::XColumnsSupplier
> const & xColSupp
,
148 const SwDBData
& rData
);
150 virtual ~SwInsertDBColAutoPilot() override
;
152 void DataToDoc( const css::uno::Sequence
< css::uno::Any
>& rSelection
,
153 css::uno::Reference
< css::sdbc::XDataSource
> const & rxSource
,
154 css::uno::Reference
< css::sdbc::XConnection
> const & xConnection
,
155 css::uno::Reference
< css::sdbc::XResultSet
> const & xResultSet
);
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */