xref: /trunk/main/sw/source/ui/inc/dbinsdlg.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DBINSDLG_HXX
25cdf0e10cSrcweir #define _DBINSDLG_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen
29cdf0e10cSrcweir #include <vcl/button.hxx>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #ifndef _GROUP_HXX //autogen
32cdf0e10cSrcweir #include <vcl/group.hxx>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _FIXED_HXX //autogen
35cdf0e10cSrcweir #include <vcl/fixed.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #ifndef _EDIT_HXX //autogen
38cdf0e10cSrcweir #include <vcl/edit.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <vcl/lstbox.hxx>
41cdf0e10cSrcweir #include <svtools/svmedit.hxx>
42cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
43cdf0e10cSrcweir #include <svl/svarray.hxx>
44cdf0e10cSrcweir #include <unotools/configitem.hxx>
45cdf0e10cSrcweir #include <numfmtlb.hxx>
46cdf0e10cSrcweir #include <swdbdata.hxx>
47cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
48cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
49cdf0e10cSrcweir namespace com{namespace sun{namespace star{
50cdf0e10cSrcweir     namespace sdbcx{
51cdf0e10cSrcweir     class XColumnsSupplier;
52cdf0e10cSrcweir     }
53cdf0e10cSrcweir     namespace sdbc{
54cdf0e10cSrcweir     class XDataSource;
55cdf0e10cSrcweir     class XConnection;
56cdf0e10cSrcweir     class XResultSet;
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir }}}
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class SwTableAutoFmt;
61cdf0e10cSrcweir class SwView;
62cdf0e10cSrcweir class SfxItemSet;
63cdf0e10cSrcweir class SwTableRep;
64cdf0e10cSrcweir class _DB_Columns;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir struct SwInsDBColumn
67cdf0e10cSrcweir {
68cdf0e10cSrcweir     rtl::OUString sColumn, sUsrNumFmt;
69cdf0e10cSrcweir     sal_Int32 nDBNumFmt;
70cdf0e10cSrcweir     sal_uInt32 nUsrNumFmt;
71cdf0e10cSrcweir     LanguageType eUsrNumFmtLng;
72cdf0e10cSrcweir     sal_uInt16 nCol;
73cdf0e10cSrcweir     sal_Bool bHasFmt : 1;
74cdf0e10cSrcweir     sal_Bool bIsDBFmt : 1;
75cdf0e10cSrcweir 
SwInsDBColumnSwInsDBColumn76cdf0e10cSrcweir     SwInsDBColumn( const String& rStr, sal_uInt16 nColumn )
77cdf0e10cSrcweir         : sColumn( rStr ),
78cdf0e10cSrcweir         nDBNumFmt( 0 ),
79cdf0e10cSrcweir         nUsrNumFmt( 0 ),
80cdf0e10cSrcweir         eUsrNumFmtLng( LANGUAGE_SYSTEM ),
81cdf0e10cSrcweir         nCol( nColumn ),
82cdf0e10cSrcweir         bHasFmt(sal_False),
83cdf0e10cSrcweir         bIsDBFmt(sal_True)
84cdf0e10cSrcweir     {}
85cdf0e10cSrcweir 
operator ==SwInsDBColumn86cdf0e10cSrcweir     int operator==( const SwInsDBColumn& rCmp ) const
87cdf0e10cSrcweir         { return sColumn == rCmp.sColumn; }
88cdf0e10cSrcweir     int operator<( const SwInsDBColumn& rCmp ) const;
89cdf0e10cSrcweir };
90cdf0e10cSrcweir 
91cdf0e10cSrcweir typedef SwInsDBColumn* SwInsDBColumnPtr;
92cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL( SwInsDBColumns, SwInsDBColumnPtr, 32, 32 )
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 
95cdf0e10cSrcweir class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     FixedText       aFtInsertData;
98cdf0e10cSrcweir     RadioButton     aRbAsTable;
99cdf0e10cSrcweir     RadioButton     aRbAsField;
100cdf0e10cSrcweir     RadioButton     aRbAsText;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     FixedLine       aFlHead;
103cdf0e10cSrcweir     FixedText       aFtDbColumn;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     ListBox         aLbTblDbColumn;
106cdf0e10cSrcweir     ListBox         aLbTxtDbColumn;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     FixedLine       aFlFormat;
109cdf0e10cSrcweir     RadioButton     aRbDbFmtFromDb;
110cdf0e10cSrcweir     RadioButton     aRbDbFmtFromUsr;
111cdf0e10cSrcweir     NumFormatListBox aLbDbFmtFromUsr;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /* ----- Page Text/Field ------- */
114cdf0e10cSrcweir     ImageButton     aIbDbcolToEdit;
115cdf0e10cSrcweir     MultiLineEdit   aEdDbText;
116cdf0e10cSrcweir     FixedText       aFtDbParaColl;
117cdf0e10cSrcweir     ListBox         aLbDbParaColl;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     /* ----- Page Table ------------ */
120cdf0e10cSrcweir     ImageButton     aIbDbcolAllTo;
121cdf0e10cSrcweir     ImageButton     aIbDbcolOneTo;
122cdf0e10cSrcweir     ImageButton     aIbDbcolOneFrom;
123cdf0e10cSrcweir     ImageButton     aIbDbcolAllFrom;
124cdf0e10cSrcweir     FixedText       aFtTableCol;
125cdf0e10cSrcweir     ListBox         aLbTableCol;
126cdf0e10cSrcweir     CheckBox        aCbTableHeadon;
127cdf0e10cSrcweir     RadioButton     aRbHeadlColnms;
128cdf0e10cSrcweir     RadioButton     aRbHeadlEmpty;
129cdf0e10cSrcweir     PushButton      aPbTblFormat;
130cdf0e10cSrcweir     PushButton      aPbTblAutofmt;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     OKButton        aBtOk;
133cdf0e10cSrcweir     CancelButton    aBtCancel;
134cdf0e10cSrcweir     HelpButton      aBtHelp;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     FixedLine       aFlBottom;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     SwInsDBColumns  aDBColumns;
139cdf0e10cSrcweir     const SwDBData  aDBData;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     Link            aOldNumFmtLnk;
142cdf0e10cSrcweir     String          sNoTmpl;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     SwView*         pView;
145cdf0e10cSrcweir     SwTableAutoFmt* pTAutoFmt;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     SfxItemSet*     pTblSet;
148cdf0e10cSrcweir     SwTableRep*     pRep;
149cdf0e10cSrcweir     sal_uInt16          nGBFmtLen;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     DECL_LINK( PageHdl, Button* );
152cdf0e10cSrcweir     DECL_LINK( AutoFmtHdl, PushButton* );
153cdf0e10cSrcweir     DECL_LINK( TblFmtHdl, PushButton* );
154cdf0e10cSrcweir     DECL_LINK( DBFormatHdl, Button* );
155cdf0e10cSrcweir     DECL_LINK( TblToFromHdl, Button* );
156cdf0e10cSrcweir     DECL_LINK( SelectHdl, ListBox* );
157cdf0e10cSrcweir     DECL_LINK( DblClickHdl, ListBox* );
158cdf0e10cSrcweir     DECL_LINK( HeaderHdl, Button* );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     sal_Bool SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, sal_Bool bInsField );
161cdf0e10cSrcweir         using SfxModalDialog::Notify;
162cdf0e10cSrcweir     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
163cdf0e10cSrcweir     virtual void            Commit();
164cdf0e10cSrcweir     void                    Load();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     // setze die Tabellen - Eigenschaften
167cdf0e10cSrcweir     void SetTabSet();
168cdf0e10cSrcweir 
169cdf0e10cSrcweir public:
170cdf0e10cSrcweir     SwInsertDBColAutoPilot( SwView& rView,
171cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
172cdf0e10cSrcweir         com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
173cdf0e10cSrcweir         const SwDBData& rData  );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     virtual ~SwInsertDBColAutoPilot();
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
178cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
179cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
180cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir #endif
185