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