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 <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>
31 
32 #include <memory>
33 #include <vector>
34 
35 namespace com{namespace sun{namespace star{
36  namespace sdbcx{
37  class XColumnsSupplier;
38  }
39  namespace sdbc{
40  class XDataSource;
41  class XConnection;
42  class XResultSet;
43  }
44 }}}
45 
46 class SwTableAutoFormat;
47 class SwView;
48 class SfxItemSet;
49 class SwTableRep;
50 struct DB_Column;
51 
52 typedef std::vector<std::unique_ptr<DB_Column>> DB_Columns;
53 
55 {
57  sal_Int32 nDBNumFormat;
58  sal_uInt32 nUsrNumFormat;
60  bool bHasFormat : 1;
61  bool bIsDBFormat : 1;
62 
63  SwInsDBColumn( const OUString& rStr )
64  : sColumn( rStr ),
65  nDBNumFormat( 0 ),
66  nUsrNumFormat( 0 ),
67  eUsrNumFormatLng( LANGUAGE_SYSTEM ),
68  bHasFormat(false),
69  bIsDBFormat(true)
70  {}
71 
72  bool operator<( const SwInsDBColumn& rCmp ) const;
73 };
74 
75 class SwInsDBColumns : public o3tl::sorted_vector<std::unique_ptr<SwInsDBColumn>, o3tl::less_uniqueptr_to<SwInsDBColumn> >
76 {
77 };
78 
80 {
83 
84  OUString const sNoTmpl;
85 
87  std::unique_ptr<SwTableAutoFormat> m_xTAutoFormat;
88 
89  std::unique_ptr<SfxItemSet> pTableSet;
90  std::unique_ptr<SwTableRep> pRep;
91  sal_Int32 nGBFormatLen;
92 
93  std::unique_ptr<weld::RadioButton> m_xRbAsTable;
94  std::unique_ptr<weld::RadioButton> m_xRbAsField;
95  std::unique_ptr<weld::RadioButton> m_xRbAsText;
96 
97  std::unique_ptr<weld::Frame> m_xHeadFrame;
98 
99  std::unique_ptr<weld::TreeView> m_xLbTableDbColumn;
100  std::unique_ptr<weld::TreeView> m_xLbTextDbColumn;
101 
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;
106 
107  // Page Text/Field
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;
112 
113  // Page Table
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;
125 
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 );
135 
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;
139  void Load();
140 
141  // set the tables - properties
142  void SetTabSet();
143 
144 public:
146  css::uno::Reference< css::sdbc::XDataSource> const & rxSource,
147  css::uno::Reference<css::sdbcx::XColumnsSupplier> const & xColSupp,
148  const SwDBData& rData );
149 
150  virtual ~SwInsertDBColAutoPilot() override;
151 
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);
156 
157 };
158 
159 #endif
160 
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Frame > m_xFormatFrame
Definition: dbinsdlg.hxx:102
OUString sColumn
Definition: dbinsdlg.hxx:56
std::unique_ptr< NumFormatListBox > m_xLbDbFormatFromUsr
Definition: dbinsdlg.hxx:105
bool bIsDBFormat
Definition: dbinsdlg.hxx:61
std::unique_ptr< weld::TreeView > m_xLbTextDbColumn
Definition: dbinsdlg.hxx:100
bool operator<(const SwInsDBColumn &rCmp) const
Definition: dbinsdlg.cxx:180
std::vector< std::unique_ptr< DB_Column > > DB_Columns
Definition: dbinsdlg.hxx:50
std::unique_ptr< SwTableRep > pRep
Definition: dbinsdlg.hxx:90
std::unique_ptr< weld::Button > m_xPbTableAutofmt
Definition: dbinsdlg.hxx:124
std::unique_ptr< weld::CheckButton > m_xCbTableHeadon
Definition: dbinsdlg.hxx:120
std::unique_ptr< weld::RadioButton > m_xRbAsText
Definition: dbinsdlg.hxx:95
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: dbinsdlg.cxx:1481
std::unique_ptr< weld::TreeView > m_xLbTableCol
Definition: dbinsdlg.hxx:119
std::unique_ptr< weld::TextView > m_xEdDbText
Definition: dbinsdlg.hxx:109
bool SplitTextToColArr(const OUString &rText, DB_Columns &rColArr, bool bInsField)
Definition: dbinsdlg.cxx:845
OUString sUsrNumFormat
Definition: dbinsdlg.hxx:56
std::unique_ptr< SfxItemSet > pTableSet
Definition: dbinsdlg.hxx:89
std::unique_ptr< weld::Label > m_xFtDbParaColl
Definition: dbinsdlg.hxx:110
SwInsDBColumn(const OUString &rStr)
Definition: dbinsdlg.hxx:63
OUString const sNoTmpl
Definition: dbinsdlg.hxx:84
LanguageType eUsrNumFormatLng
Definition: dbinsdlg.hxx:59
std::unique_ptr< weld::Button > m_xPbTableFormat
Definition: dbinsdlg.hxx:123
#define LANGUAGE_SYSTEM
std::unique_ptr< weld::RadioButton > m_xRbDbFormatFromUsr
Definition: dbinsdlg.hxx:104
std::unique_ptr< weld::RadioButton > m_xRbAsField
Definition: dbinsdlg.hxx:94
SwInsDBColumns aDBColumns
Definition: dbinsdlg.hxx:81
DECL_LINK(PageHdl, weld::Button &, void)
std::unique_ptr< weld::Frame > m_xHeadFrame
Definition: dbinsdlg.hxx:97
const SwDBData aDBData
Definition: dbinsdlg.hxx:82
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:921
std::unique_ptr< weld::RadioButton > m_xRbHeadlColnms
Definition: dbinsdlg.hxx:121
sal_Int32 nDBNumFormat
Definition: dbinsdlg.hxx:57
std::unique_ptr< weld::ComboBox > m_xLbDbParaColl
Definition: dbinsdlg.hxx:111
SwInsertDBColAutoPilot(SwView &rView, css::uno::Reference< css::sdbc::XDataSource > const &rxSource, css::uno::Reference< css::sdbcx::XColumnsSupplier > const &xColSupp, const SwDBData &rData)
Definition: dbinsdlg.cxx:185
std::unique_ptr< weld::Button > m_xIbDbcolAllTo
Definition: dbinsdlg.hxx:114
std::unique_ptr< weld::TreeView > m_xLbTableDbColumn
Definition: dbinsdlg.hxx:99
virtual void ImplCommit() override
Definition: dbinsdlg.cxx:1483
std::unique_ptr< weld::Button > m_xIbDbcolAllFrom
Definition: dbinsdlg.hxx:117
virtual ~SwInsertDBColAutoPilot() override
Definition: dbinsdlg.cxx:404
std::unique_ptr< weld::Label > m_xFtTableCol
Definition: dbinsdlg.hxx:118
std::unique_ptr< weld::Button > m_xIbDbcolOneFrom
Definition: dbinsdlg.hxx:116
std::unique_ptr< SwTableAutoFormat > m_xTAutoFormat
Definition: dbinsdlg.hxx:87
sal_Int32 nGBFormatLen
Definition: dbinsdlg.hxx:91
std::unique_ptr< weld::RadioButton > m_xRbHeadlEmpty
Definition: dbinsdlg.hxx:122
sal_uInt32 nUsrNumFormat
Definition: dbinsdlg.hxx:58
std::unique_ptr< weld::RadioButton > m_xRbDbFormatFromDb
Definition: dbinsdlg.hxx:103
Definition: view.hxx:146
bool bHasFormat
Definition: dbinsdlg.hxx:60
std::unique_ptr< weld::Button > m_xIbDbcolToEdit
Definition: dbinsdlg.hxx:108
std::unique_ptr< weld::Button > m_xIbDbcolOneTo
Definition: dbinsdlg.hxx:115
std::unique_ptr< weld::RadioButton > m_xRbAsTable
Definition: dbinsdlg.hxx:93