Line data Source code
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/button.hxx>
24 : #include <vcl/group.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/edit.hxx>
27 : #include <vcl/layout.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>
38 :
39 : namespace com{namespace sun{namespace star{
40 : namespace sdbcx{
41 : class XColumnsSupplier;
42 : }
43 : namespace sdbc{
44 : class XDataSource;
45 : class XConnection;
46 : class XResultSet;
47 : }
48 : }}}
49 :
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;
56 :
57 0 : struct SwInsDBColumn
58 : {
59 : OUString sColumn, sUsrNumFmt;
60 : sal_Int32 nDBNumFmt;
61 : sal_uInt32 nUsrNumFmt;
62 : LanguageType eUsrNumFmtLng;
63 : sal_uInt16 nCol;
64 : bool bHasFmt : 1;
65 : bool bIsDBFmt : 1;
66 :
67 0 : SwInsDBColumn( const OUString& rStr, sal_uInt16 nColumn )
68 : : sColumn( rStr ),
69 : nDBNumFmt( 0 ),
70 : nUsrNumFmt( 0 ),
71 : eUsrNumFmtLng( LANGUAGE_SYSTEM ),
72 : nCol( nColumn ),
73 : bHasFmt(false),
74 0 : bIsDBFmt(true)
75 0 : {}
76 :
77 : bool operator==( const SwInsDBColumn& rCmp ) const
78 : { return sColumn == rCmp.sColumn; }
79 : bool operator<( const SwInsDBColumn& rCmp ) const;
80 : };
81 :
82 0 : class SwInsDBColumns : public o3tl::sorted_vector<SwInsDBColumn*, o3tl::less_ptr_to<SwInsDBColumn> >
83 : {
84 : public:
85 0 : ~SwInsDBColumns() { DeleteAndDestroyAll(); }
86 : };
87 :
88 : class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
89 : {
90 : RadioButton* m_pRbAsTable;
91 : RadioButton* m_pRbAsField;
92 : RadioButton* m_pRbAsText;
93 :
94 : VclFrame* m_pHeadFrame;
95 :
96 : ListBox* m_pLbTblDbColumn;
97 : ListBox* m_pLbTxtDbColumn;
98 :
99 : VclFrame* m_pFormatFrame;
100 : RadioButton* m_pRbDbFmtFromDb;
101 : RadioButton* m_pRbDbFmtFromUsr;
102 : NumFormatListBox* m_pLbDbFmtFromUsr;
103 :
104 : // Page Text/Field
105 : PushButton* m_pIbDbcolToEdit;
106 : VclMultiLineEdit* m_pEdDbText;
107 : FixedText* m_pFtDbParaColl;
108 : ListBox* m_pLbDbParaColl;
109 :
110 : // Page Table
111 : PushButton* m_pIbDbcolAllTo;
112 : PushButton* m_pIbDbcolOneTo;
113 : PushButton* m_pIbDbcolOneFrom;
114 : PushButton* m_pIbDbcolAllFrom;
115 : FixedText* m_pFtTableCol;
116 : ListBox* m_pLbTableCol;
117 : CheckBox* m_pCbTableHeadon;
118 : RadioButton* m_pRbHeadlColnms;
119 : RadioButton* m_pRbHeadlEmpty;
120 : PushButton* m_pPbTblFormat;
121 : PushButton* m_pPbTblAutofmt;
122 :
123 : SwInsDBColumns aDBColumns;
124 : const SwDBData aDBData;
125 :
126 : Link aOldNumFmtLnk;
127 : OUString sNoTmpl;
128 :
129 : SwView* pView;
130 : SwTableAutoFmt* pTAutoFmt;
131 :
132 : SfxItemSet* pTblSet;
133 : SwTableRep* pRep;
134 : sal_Int32 nGBFmtLen;
135 :
136 : DECL_LINK( PageHdl, Button* );
137 : DECL_LINK( AutoFmtHdl, PushButton* );
138 : DECL_LINK( TblFmtHdl, PushButton* );
139 : DECL_LINK( DBFormatHdl, Button* );
140 : DECL_LINK( TblToFromHdl, Button* );
141 : DECL_LINK( SelectHdl, ListBox* );
142 : DECL_LINK( DblClickHdl, ListBox* );
143 : DECL_LINK( HeaderHdl, Button* );
144 :
145 : bool SplitTextToColArr( const OUString& rTxt, _DB_Columns& rColArr, bool bInsField );
146 : using SfxModalDialog::Notify;
147 : virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
148 : virtual void Commit() SAL_OVERRIDE;
149 : void Load();
150 :
151 : // set the tables - properties
152 : void SetTabSet();
153 :
154 : public:
155 : SwInsertDBColAutoPilot( SwView& rView,
156 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
157 : com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
158 : const SwDBData& rData );
159 :
160 : virtual ~SwInsertDBColAutoPilot();
161 :
162 : void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
163 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
164 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
165 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
166 :
167 : };
168 :
169 : #endif
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|