bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / dbinsdlg.hxx
blobaa1207fc553f96c92391fcb92c6138e6aba9a1c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _DBINSDLG_HXX
21 #define _DBINSDLG_HXX
24 #include <vcl/button.hxx>
25 #include <vcl/group.hxx>
26 #include <vcl/fixed.hxx>
27 #include <vcl/edit.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <svtools/svmedit.hxx>
30 #include <sfx2/basedlgs.hxx>
31 #include <unotools/configitem.hxx>
32 #include <numfmtlb.hxx>
33 #include <swdbdata.hxx>
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/uno/Sequence.h>
36 #include <boost/ptr_container/ptr_vector.hpp>
37 #include <o3tl/sorted_vector.hxx>
39 namespace com{namespace sun{namespace star{
40 namespace sdbcx{
41 class XColumnsSupplier;
43 namespace sdbc{
44 class XDataSource;
45 class XConnection;
46 class XResultSet;
48 }}}
50 class SwTableAutoFmt;
51 class SwView;
52 class SfxItemSet;
53 class SwTableRep;
54 struct _DB_Column;
55 typedef boost::ptr_vector<_DB_Column> _DB_Columns;
57 struct SwInsDBColumn
59 OUString sColumn, sUsrNumFmt;
60 sal_Int32 nDBNumFmt;
61 sal_uInt32 nUsrNumFmt;
62 LanguageType eUsrNumFmtLng;
63 sal_uInt16 nCol;
64 sal_Bool bHasFmt : 1;
65 sal_Bool bIsDBFmt : 1;
67 SwInsDBColumn( const String& rStr, sal_uInt16 nColumn )
68 : sColumn( rStr ),
69 nDBNumFmt( 0 ),
70 nUsrNumFmt( 0 ),
71 eUsrNumFmtLng( LANGUAGE_SYSTEM ),
72 nCol( nColumn ),
73 bHasFmt(sal_False),
74 bIsDBFmt(sal_True)
77 int operator==( const SwInsDBColumn& rCmp ) const
78 { return sColumn == rCmp.sColumn; }
79 int operator<( const SwInsDBColumn& rCmp ) const;
82 class SwInsDBColumns : public o3tl::sorted_vector<SwInsDBColumn*, o3tl::less_ptr_to<SwInsDBColumn> >
84 public:
85 ~SwInsDBColumns() { DeleteAndDestroyAll(); }
89 class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
91 FixedText aFtInsertData;
92 RadioButton aRbAsTable;
93 RadioButton aRbAsField;
94 RadioButton aRbAsText;
96 FixedLine aFlHead;
97 FixedText aFtDbColumn;
99 ListBox aLbTblDbColumn;
100 ListBox aLbTxtDbColumn;
102 FixedLine aFlFormat;
103 RadioButton aRbDbFmtFromDb;
104 RadioButton aRbDbFmtFromUsr;
105 NumFormatListBox aLbDbFmtFromUsr;
107 /* ----- Page Text/Field ------- */
108 ImageButton aIbDbcolToEdit;
109 MultiLineEdit aEdDbText;
110 FixedText aFtDbParaColl;
111 ListBox aLbDbParaColl;
113 /* ----- Page Table ------------ */
114 ImageButton aIbDbcolAllTo;
115 ImageButton aIbDbcolOneTo;
116 ImageButton aIbDbcolOneFrom;
117 ImageButton aIbDbcolAllFrom;
118 FixedText aFtTableCol;
119 ListBox aLbTableCol;
120 CheckBox aCbTableHeadon;
121 RadioButton aRbHeadlColnms;
122 RadioButton aRbHeadlEmpty;
123 PushButton aPbTblFormat;
124 PushButton aPbTblAutofmt;
126 OKButton aBtOk;
127 CancelButton aBtCancel;
128 HelpButton aBtHelp;
130 FixedLine aFlBottom;
132 SwInsDBColumns aDBColumns;
133 const SwDBData aDBData;
135 Link aOldNumFmtLnk;
136 String sNoTmpl;
138 SwView* pView;
139 SwTableAutoFmt* pTAutoFmt;
141 SfxItemSet* pTblSet;
142 SwTableRep* pRep;
143 sal_Int32 nGBFmtLen;
145 DECL_LINK( PageHdl, Button* );
146 DECL_LINK( AutoFmtHdl, PushButton* );
147 DECL_LINK( TblFmtHdl, PushButton* );
148 DECL_LINK( DBFormatHdl, Button* );
149 DECL_LINK( TblToFromHdl, Button* );
150 DECL_LINK( SelectHdl, ListBox* );
151 DECL_LINK( DblClickHdl, ListBox* );
152 DECL_LINK( HeaderHdl, Button* );
154 bool SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, sal_Bool bInsField );
155 using SfxModalDialog::Notify;
156 virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames );
157 virtual void Commit();
158 void Load();
160 // set the tables - properties
161 void SetTabSet();
163 public:
164 SwInsertDBColAutoPilot( SwView& rView,
165 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
166 com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
167 const SwDBData& rData );
169 virtual ~SwInsertDBColAutoPilot();
171 void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
172 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
173 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
174 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
178 #endif
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */