Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _DBINSDLG_HXX
30 : : #define _DBINSDLG_HXX
31 : :
32 : :
33 : : #include <vcl/button.hxx>
34 : : #include <vcl/group.hxx>
35 : : #include <vcl/fixed.hxx>
36 : : #include <vcl/edit.hxx>
37 : : #include <vcl/lstbox.hxx>
38 : : #include <svtools/svmedit.hxx>
39 : : #include <sfx2/basedlgs.hxx>
40 : : #include <unotools/configitem.hxx>
41 : : #include <numfmtlb.hxx>
42 : : #include <swdbdata.hxx>
43 : : #include <com/sun/star/uno/Reference.h>
44 : : #include <com/sun/star/uno/Sequence.h>
45 : : #include <boost/ptr_container/ptr_vector.hpp>
46 : : #include <o3tl/sorted_vector.hxx>
47 : :
48 : : namespace com{namespace sun{namespace star{
49 : : namespace sdbcx{
50 : : class XColumnsSupplier;
51 : : }
52 : : namespace sdbc{
53 : : class XDataSource;
54 : : class XConnection;
55 : : class XResultSet;
56 : : }
57 : : }}}
58 : :
59 : : class SwTableAutoFmt;
60 : : class SwView;
61 : : class SfxItemSet;
62 : : class SwTableRep;
63 : : struct _DB_Column;
64 : : typedef boost::ptr_vector<_DB_Column> _DB_Columns;
65 : :
66 : 0 : struct SwInsDBColumn
67 : : {
68 : : rtl::OUString sColumn, sUsrNumFmt;
69 : : sal_Int32 nDBNumFmt;
70 : : sal_uInt32 nUsrNumFmt;
71 : : LanguageType eUsrNumFmtLng;
72 : : sal_uInt16 nCol;
73 : : sal_Bool bHasFmt : 1;
74 : : sal_Bool bIsDBFmt : 1;
75 : :
76 : 0 : SwInsDBColumn( const String& rStr, sal_uInt16 nColumn )
77 : : : sColumn( rStr ),
78 : : nDBNumFmt( 0 ),
79 : : nUsrNumFmt( 0 ),
80 : : eUsrNumFmtLng( LANGUAGE_SYSTEM ),
81 : : nCol( nColumn ),
82 : : bHasFmt(sal_False),
83 : 0 : bIsDBFmt(sal_True)
84 : 0 : {}
85 : :
86 : : int operator==( const SwInsDBColumn& rCmp ) const
87 : : { return sColumn == rCmp.sColumn; }
88 : : int operator<( const SwInsDBColumn& rCmp ) const;
89 : : };
90 : :
91 : 0 : class SwInsDBColumns : public o3tl::sorted_vector<SwInsDBColumn*, o3tl::less_ptr_to<SwInsDBColumn> >
92 : : {
93 : : public:
94 : 0 : ~SwInsDBColumns() { DeleteAndDestroyAll(); }
95 : : };
96 : :
97 : :
98 : : class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
99 : : {
100 : : FixedText aFtInsertData;
101 : : RadioButton aRbAsTable;
102 : : RadioButton aRbAsField;
103 : : RadioButton aRbAsText;
104 : :
105 : : FixedLine aFlHead;
106 : : FixedText aFtDbColumn;
107 : :
108 : : ListBox aLbTblDbColumn;
109 : : ListBox aLbTxtDbColumn;
110 : :
111 : : FixedLine aFlFormat;
112 : : RadioButton aRbDbFmtFromDb;
113 : : RadioButton aRbDbFmtFromUsr;
114 : : NumFormatListBox aLbDbFmtFromUsr;
115 : :
116 : : /* ----- Page Text/Field ------- */
117 : : ImageButton aIbDbcolToEdit;
118 : : MultiLineEdit aEdDbText;
119 : : FixedText aFtDbParaColl;
120 : : ListBox aLbDbParaColl;
121 : :
122 : : /* ----- Page Table ------------ */
123 : : ImageButton aIbDbcolAllTo;
124 : : ImageButton aIbDbcolOneTo;
125 : : ImageButton aIbDbcolOneFrom;
126 : : ImageButton aIbDbcolAllFrom;
127 : : FixedText aFtTableCol;
128 : : ListBox aLbTableCol;
129 : : CheckBox aCbTableHeadon;
130 : : RadioButton aRbHeadlColnms;
131 : : RadioButton aRbHeadlEmpty;
132 : : PushButton aPbTblFormat;
133 : : PushButton aPbTblAutofmt;
134 : :
135 : : OKButton aBtOk;
136 : : CancelButton aBtCancel;
137 : : HelpButton aBtHelp;
138 : :
139 : : FixedLine aFlBottom;
140 : :
141 : : SwInsDBColumns aDBColumns;
142 : : const SwDBData aDBData;
143 : :
144 : : Link aOldNumFmtLnk;
145 : : String sNoTmpl;
146 : :
147 : : SwView* pView;
148 : : SwTableAutoFmt* pTAutoFmt;
149 : :
150 : : SfxItemSet* pTblSet;
151 : : SwTableRep* pRep;
152 : : sal_uInt16 nGBFmtLen;
153 : :
154 : : DECL_LINK( PageHdl, Button* );
155 : : DECL_LINK( AutoFmtHdl, PushButton* );
156 : : DECL_LINK( TblFmtHdl, PushButton* );
157 : : DECL_LINK( DBFormatHdl, Button* );
158 : : DECL_LINK( TblToFromHdl, Button* );
159 : : DECL_LINK( SelectHdl, ListBox* );
160 : : DECL_LINK( DblClickHdl, ListBox* );
161 : : DECL_LINK( HeaderHdl, Button* );
162 : :
163 : : sal_Bool SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, sal_Bool bInsField );
164 : : using SfxModalDialog::Notify;
165 : : virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
166 : : virtual void Commit();
167 : : void Load();
168 : :
169 : : // set the tables - properties
170 : : void SetTabSet();
171 : :
172 : : public:
173 : : SwInsertDBColAutoPilot( SwView& rView,
174 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
175 : : com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
176 : : const SwDBData& rData );
177 : :
178 : : virtual ~SwInsertDBColAutoPilot();
179 : :
180 : : void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
181 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
182 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
183 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
184 : :
185 : : };
186 : :
187 : : #endif
188 : :
189 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|