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 SwTableAutoFormat;
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, sUsrNumFormat;
60 : sal_Int32 nDBNumFormat;
61 : sal_uInt32 nUsrNumFormat;
62 : LanguageType eUsrNumFormatLng;
63 : sal_uInt16 nCol;
64 : bool bHasFormat : 1;
65 : bool bIsDBFormat : 1;
66 :
67 0 : SwInsDBColumn( const OUString& rStr, sal_uInt16 nColumn )
68 : : sColumn( rStr ),
69 : nDBNumFormat( 0 ),
70 : nUsrNumFormat( 0 ),
71 : eUsrNumFormatLng( LANGUAGE_SYSTEM ),
72 : nCol( nColumn ),
73 : bHasFormat(false),
74 0 : bIsDBFormat(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 : VclPtr<RadioButton> m_pRbAsTable;
91 : VclPtr<RadioButton> m_pRbAsField;
92 : VclPtr<RadioButton> m_pRbAsText;
93 :
94 : VclPtr<VclFrame> m_pHeadFrame;
95 :
96 : VclPtr<ListBox> m_pLbTableDbColumn;
97 : VclPtr<ListBox> m_pLbTextDbColumn;
98 :
99 : VclPtr<VclFrame> m_pFormatFrame;
100 : VclPtr<RadioButton> m_pRbDbFormatFromDb;
101 : VclPtr<RadioButton> m_pRbDbFormatFromUsr;
102 : VclPtr<NumFormatListBox> m_pLbDbFormatFromUsr;
103 :
104 : // Page Text/Field
105 : VclPtr<PushButton> m_pIbDbcolToEdit;
106 : VclPtr<VclMultiLineEdit> m_pEdDbText;
107 : VclPtr<FixedText> m_pFtDbParaColl;
108 : VclPtr<ListBox> m_pLbDbParaColl;
109 :
110 : // Page Table
111 : VclPtr<PushButton> m_pIbDbcolAllTo;
112 : VclPtr<PushButton> m_pIbDbcolOneTo;
113 : VclPtr<PushButton> m_pIbDbcolOneFrom;
114 : VclPtr<PushButton> m_pIbDbcolAllFrom;
115 : VclPtr<FixedText> m_pFtTableCol;
116 : VclPtr<ListBox> m_pLbTableCol;
117 : VclPtr<CheckBox> m_pCbTableHeadon;
118 : VclPtr<RadioButton> m_pRbHeadlColnms;
119 : VclPtr<RadioButton> m_pRbHeadlEmpty;
120 : VclPtr<PushButton> m_pPbTableFormat;
121 : VclPtr<PushButton> m_pPbTableAutofmt;
122 :
123 : SwInsDBColumns aDBColumns;
124 : const SwDBData aDBData;
125 :
126 : Link<> aOldNumFormatLnk;
127 : OUString sNoTmpl;
128 :
129 : SwView* pView;
130 : SwTableAutoFormat* pTAutoFormat;
131 :
132 : SfxItemSet* pTableSet;
133 : SwTableRep* pRep;
134 : sal_Int32 nGBFormatLen;
135 :
136 : DECL_LINK( PageHdl, Button* );
137 : DECL_LINK( AutoFormatHdl, PushButton* );
138 : DECL_LINK( TableFormatHdl, PushButton* );
139 : DECL_LINK( DBFormatHdl, Button* );
140 : DECL_LINK( TableToFromHdl, Button* );
141 : DECL_LINK( SelectHdl, ListBox* );
142 : DECL_LINK( DblClickHdl, ListBox* );
143 : DECL_LINK( HeaderHdl, Button* );
144 :
145 : bool SplitTextToColArr( const OUString& rText, _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 ImplCommit() 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 : virtual void dispose() SAL_OVERRIDE;
162 :
163 : void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
164 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
165 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
166 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
167 :
168 : };
169 :
170 : #endif
171 :
172 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|