update dev300-m58
[ooovba.git] / sw / source / ui / inc / dbinsdlg.hxx
blob785858e9216518640c7c4d46ca2fd7a3ddf88433
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbinsdlg.hxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBINSDLG_HXX
32 #define _DBINSDLG_HXX
35 #ifndef _BUTTON_HXX //autogen
36 #include <vcl/button.hxx>
37 #endif
38 #ifndef _GROUP_HXX //autogen
39 #include <vcl/group.hxx>
40 #endif
41 #ifndef _FIXED_HXX //autogen
42 #include <vcl/fixed.hxx>
43 #endif
44 #ifndef _EDIT_HXX //autogen
45 #include <vcl/edit.hxx>
46 #endif
47 #include <vcl/lstbox.hxx>
48 #include <svtools/svmedit.hxx>
49 #include <sfx2/basedlgs.hxx>
50 #include <svtools/svarray.hxx>
51 #include <unotools/configitem.hxx>
52 #include <numfmtlb.hxx>
53 #include <swdbdata.hxx>
54 #include <com/sun/star/uno/Reference.h>
55 #include <com/sun/star/uno/Sequence.h>
56 namespace com{namespace sun{namespace star{
57 namespace sdbcx{
58 class XColumnsSupplier;
60 namespace sdbc{
61 class XDataSource;
62 class XConnection;
63 class XResultSet;
65 }}}
67 class SwTableAutoFmt;
68 class SwView;
69 class SfxItemSet;
70 class SwTableRep;
71 class _DB_Columns;
73 struct SwInsDBColumn
75 rtl::OUString sColumn, sUsrNumFmt;
76 sal_Int32 nDBNumFmt;
77 sal_uInt32 nUsrNumFmt;
78 LanguageType eUsrNumFmtLng;
79 USHORT nCol;
80 BOOL bHasFmt : 1;
81 BOOL bIsDBFmt : 1;
83 SwInsDBColumn( const String& rStr, USHORT nColumn )
84 : sColumn( rStr ),
85 nDBNumFmt( 0 ),
86 nUsrNumFmt( 0 ),
87 eUsrNumFmtLng( LANGUAGE_SYSTEM ),
88 nCol( nColumn ),
89 bHasFmt(FALSE),
90 bIsDBFmt(TRUE)
93 int operator==( const SwInsDBColumn& rCmp ) const
94 { return sColumn == rCmp.sColumn; }
95 int operator<( const SwInsDBColumn& rCmp ) const;
98 typedef SwInsDBColumn* SwInsDBColumnPtr;
99 SV_DECL_PTRARR_SORT_DEL( SwInsDBColumns, SwInsDBColumnPtr, 32, 32 )
102 class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
104 FixedText aFtInsertData;
105 RadioButton aRbAsTable;
106 RadioButton aRbAsField;
107 RadioButton aRbAsText;
109 FixedLine aFlHead;
110 FixedText aFtDbColumn;
112 ListBox aLbTblDbColumn;
113 ListBox aLbTxtDbColumn;
115 FixedLine aFlFormat;
116 RadioButton aRbDbFmtFromDb;
117 RadioButton aRbDbFmtFromUsr;
118 NumFormatListBox aLbDbFmtFromUsr;
120 /* ----- Page Text/Field ------- */
121 ImageButton aIbDbcolToEdit;
122 MultiLineEdit aEdDbText;
123 FixedText aFtDbParaColl;
124 ListBox aLbDbParaColl;
126 /* ----- Page Table ------------ */
127 ImageButton aIbDbcolAllTo;
128 ImageButton aIbDbcolOneTo;
129 ImageButton aIbDbcolOneFrom;
130 ImageButton aIbDbcolAllFrom;
131 FixedText aFtTableCol;
132 ListBox aLbTableCol;
133 CheckBox aCbTableHeadon;
134 RadioButton aRbHeadlColnms;
135 RadioButton aRbHeadlEmpty;
136 PushButton aPbTblFormat;
137 PushButton aPbTblAutofmt;
139 OKButton aBtOk;
140 CancelButton aBtCancel;
141 HelpButton aBtHelp;
143 FixedLine aFlBottom;
145 SwInsDBColumns aDBColumns;
146 const SwDBData aDBData;
148 Link aOldNumFmtLnk;
149 String sNoTmpl;
151 SwView* pView;
152 SwTableAutoFmt* pTAutoFmt;
154 SfxItemSet* pTblSet;
155 SwTableRep* pRep;
156 USHORT nGBFmtLen;
158 DECL_LINK( PageHdl, Button* );
159 DECL_LINK( AutoFmtHdl, PushButton* );
160 DECL_LINK( TblFmtHdl, PushButton* );
161 DECL_LINK( DBFormatHdl, Button* );
162 DECL_LINK( TblToFromHdl, Button* );
163 DECL_LINK( SelectHdl, ListBox* );
164 DECL_LINK( DblClickHdl, ListBox* );
165 DECL_LINK( HeaderHdl, Button* );
167 BOOL SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, BOOL bInsField );
170 virtual void Commit();
171 void Load();
173 // setze die Tabellen - Eigenschaften
174 void SetTabSet();
176 public:
177 SwInsertDBColAutoPilot( SwView& rView,
178 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
179 com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
180 const SwDBData& rData );
182 virtual ~SwInsertDBColAutoPilot();
184 void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
185 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
186 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
187 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
191 #endif