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