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 // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #define _CHANGEDB_CXX 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <svtools/stdctrl.hxx> 40*cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen 41*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/sdb/XDatabaseAccess.hpp> 46*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 47*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #ifndef _VIEW_HXX 50*cdf0e10cSrcweir #include <view.hxx> 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir #include <wrtsh.hxx> 53*cdf0e10cSrcweir #ifndef _DBMGR_HXX 54*cdf0e10cSrcweir #include <dbmgr.hxx> 55*cdf0e10cSrcweir #endif 56*cdf0e10cSrcweir #include <fldmgr.hxx> 57*cdf0e10cSrcweir #include <expfld.hxx> 58*cdf0e10cSrcweir #include <txtatr.hxx> 59*cdf0e10cSrcweir #include <ndtxt.hxx> 60*cdf0e10cSrcweir #include <fldbas.hxx> 61*cdf0e10cSrcweir #include <dbfld.hxx> 62*cdf0e10cSrcweir #include <changedb.hxx> 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir #ifndef _FLDUI_HRC 65*cdf0e10cSrcweir #include <fldui.hrc> 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir #ifndef _UTLUI_HRC 68*cdf0e10cSrcweir #include <utlui.hrc> 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir #ifndef _CHANGEDB_HRC 71*cdf0e10cSrcweir #include <changedb.hrc> 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir #include <unomid.h> 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 77*cdf0e10cSrcweir using namespace ::com::sun::star::container; 78*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir /*-------------------------------------------------------------------- 82*cdf0e10cSrcweir Beschreibung: Feldeinfuegen bearbeiten 83*cdf0e10cSrcweir --------------------------------------------------------------------*/ 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) : 87*cdf0e10cSrcweir SvxStandardDialog(&rVw.GetViewFrame()->GetWindow(), SW_RES(DLG_CHANGE_DB)), 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir aDBListFL (this, SW_RES(FL_DBLIST )), 90*cdf0e10cSrcweir aUsedDBFT (this, SW_RES(FT_USEDDB )), 91*cdf0e10cSrcweir aAvailDBFT (this, SW_RES(FT_AVAILDB )), 92*cdf0e10cSrcweir aUsedDBTLB (this, SW_RES(TLB_USEDDB )), 93*cdf0e10cSrcweir aAvailDBTLB (this, SW_RES(TLB_AVAILDB ), 0), 94*cdf0e10cSrcweir aAddDBPB (this, SW_RES(PB_ADDDB)), 95*cdf0e10cSrcweir aDescFT (this, SW_RES(FT_DESC )), 96*cdf0e10cSrcweir aDocDBTextFT(this, SW_RES(FT_DOCDBTEXT )), 97*cdf0e10cSrcweir aDocDBNameFT(this, SW_RES(FT_DOCDBNAME )), 98*cdf0e10cSrcweir aOKBT (this, SW_RES(BT_OK )), 99*cdf0e10cSrcweir aCancelBT (this, SW_RES(BT_CANCEL )), 100*cdf0e10cSrcweir aHelpBT (this, SW_RES(BT_HELP )), 101*cdf0e10cSrcweir // aChangeBT (this, SW_RES(BT_CHANGEDB )), 102*cdf0e10cSrcweir aImageList (SW_RES(ILIST_DB_DLG )), 103*cdf0e10cSrcweir aImageListHC (SW_RES(ILIST_DB_DLG_HC )), 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir pSh(rVw.GetWrtShellPtr()), 106*cdf0e10cSrcweir pMgr( new SwFldMgr() ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir aAvailDBTLB.SetWrtShell(*pSh); 109*cdf0e10cSrcweir FillDBPopup(); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir FreeResource(); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir ShowDBName(pSh->GetDBData()); 114*cdf0e10cSrcweir aOKBT.SetClickHdl(LINK(this, SwChangeDBDlg, ButtonHdl)); 115*cdf0e10cSrcweir aAddDBPB.SetClickHdl(LINK(this, SwChangeDBDlg, AddDBHdl)); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir aUsedDBTLB.SetSelectionMode(MULTIPLE_SELECTION); 118*cdf0e10cSrcweir aUsedDBTLB.SetStyle(aUsedDBTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); 119*cdf0e10cSrcweir aUsedDBTLB.SetSpaceBetweenEntries(0); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir aUsedDBTLB.SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE), 122*cdf0e10cSrcweir aImageList.GetImage(IMG_EXPAND ), BMP_COLOR_NORMAL ); 123*cdf0e10cSrcweir aUsedDBTLB.SetNodeBitmaps( aImageListHC.GetImage(IMG_COLLAPSE), 124*cdf0e10cSrcweir aImageListHC.GetImage(IMG_EXPAND ), BMP_COLOR_HIGHCONTRAST ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir Link aLink = LINK(this, SwChangeDBDlg, TreeSelectHdl); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir aUsedDBTLB.SetSelectHdl(aLink); 129*cdf0e10cSrcweir aUsedDBTLB.SetDeselectHdl(aLink); 130*cdf0e10cSrcweir aAvailDBTLB.SetSelectHdl(aLink); 131*cdf0e10cSrcweir aAvailDBTLB.SetDeselectHdl(aLink); 132*cdf0e10cSrcweir TreeSelectHdl(); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir /*-------------------------------------------------------------------- 136*cdf0e10cSrcweir Beschreibung: Datenbank-Listboxen initialisieren 137*cdf0e10cSrcweir --------------------------------------------------------------------*/ 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void SwChangeDBDlg::FillDBPopup() 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir Reference<XNameAccess> xDBContext; 143*cdf0e10cSrcweir Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); 144*cdf0e10cSrcweir if( xMgr.is() ) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" )); 147*cdf0e10cSrcweir xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ; 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir DBG_ASSERT(xDBContext.is(), "com.sun.star.sdb.DataBaseContext: service not available"); 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir const SwDBData& rDBData = pSh->GetDBData(); 152*cdf0e10cSrcweir String sDBName(rDBData.sDataSource); 153*cdf0e10cSrcweir String sTableName(rDBData.sCommand); 154*cdf0e10cSrcweir aAvailDBTLB.Select(sDBName, sTableName, aEmptyStr); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir SvStringsDtor aAllDBNames(5, 5); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir Sequence< ::rtl::OUString > aDBNames = xDBContext->getElementNames(); 159*cdf0e10cSrcweir const ::rtl::OUString* pDBNames = aDBNames.getConstArray(); 160*cdf0e10cSrcweir sal_Int32 nDBCount = aDBNames.getLength(); 161*cdf0e10cSrcweir for(sal_Int32 i = 0; i < nDBCount; i++) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir aAllDBNames.Insert(new String(pDBNames[i]), aAllDBNames.Count()); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir SvStringsDtor aDBNameList(5, 1); 167*cdf0e10cSrcweir pSh->GetAllUsedDB( aDBNameList, &aAllDBNames ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir sal_uInt16 nCount = aDBNameList.Count(); 170*cdf0e10cSrcweir aUsedDBTLB.Clear(); 171*cdf0e10cSrcweir SvLBoxEntry *pFirst = 0; 172*cdf0e10cSrcweir SvLBoxEntry *pLast = 0; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir for (sal_uInt16 k = 0; k < nCount; k++) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir sDBName = *aDBNameList.GetObject(k); 177*cdf0e10cSrcweir sDBName = sDBName.GetToken(0); 178*cdf0e10cSrcweir pLast = Insert(sDBName); 179*cdf0e10cSrcweir if (!pFirst) 180*cdf0e10cSrcweir pFirst = pLast; 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir if (pFirst) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir aUsedDBTLB.MakeVisible(pFirst); 186*cdf0e10cSrcweir aUsedDBTLB.Select(pFirst); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir /*-------------------------------------------------------------------- 192*cdf0e10cSrcweir Beschreibung: 193*cdf0e10cSrcweir --------------------------------------------------------------------*/ 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir SvLBoxEntry* SwChangeDBDlg::Insert(const String& rDBName) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir String sDBName(rDBName.GetToken(0, DB_DELIM)); 199*cdf0e10cSrcweir String sTableName(rDBName.GetToken(1, DB_DELIM)); 200*cdf0e10cSrcweir int nCommandType = rDBName.GetToken(2, DB_DELIM).ToInt32(); 201*cdf0e10cSrcweir SvLBoxEntry* pParent; 202*cdf0e10cSrcweir SvLBoxEntry* pChild; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir sal_uInt16 nParent = 0; 205*cdf0e10cSrcweir sal_uInt16 nChild = 0; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir Image aTableImg = aImageList.GetImage(IMG_DBTABLE); 208*cdf0e10cSrcweir Image aDBImg = aImageList.GetImage(IMG_DB); 209*cdf0e10cSrcweir Image aQueryImg = aImageList.GetImage(IMG_DBQUERY); 210*cdf0e10cSrcweir Image aHCTableImg = aImageListHC.GetImage(IMG_DBTABLE); 211*cdf0e10cSrcweir Image aHCDBImg = aImageListHC.GetImage(IMG_DB); 212*cdf0e10cSrcweir Image aHCQueryImg = aImageListHC.GetImage(IMG_DBQUERY); 213*cdf0e10cSrcweir Image& rToInsert = nCommandType ? aQueryImg : aTableImg; 214*cdf0e10cSrcweir Image& rHCToInsert = nCommandType ? aHCQueryImg : aHCTableImg; 215*cdf0e10cSrcweir while ((pParent = aUsedDBTLB.GetEntry(nParent++)) != NULL) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir if (sDBName == aUsedDBTLB.GetEntryText(pParent)) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir while ((pChild = aUsedDBTLB.GetEntry(pParent, nChild++)) != NULL) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir if (sTableName == aUsedDBTLB.GetEntryText(pChild)) 222*cdf0e10cSrcweir return pChild; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent); 225*cdf0e10cSrcweir aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST); 226*cdf0e10cSrcweir aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST); 227*cdf0e10cSrcweir pRet->SetUserData((void*)nCommandType); 228*cdf0e10cSrcweir return pRet; 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir pParent = aUsedDBTLB.InsertEntry(sDBName, aDBImg, aDBImg); 232*cdf0e10cSrcweir aUsedDBTLB.SetExpandedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST); 233*cdf0e10cSrcweir aUsedDBTLB.SetCollapsedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent); 236*cdf0e10cSrcweir aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST); 237*cdf0e10cSrcweir aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST); 238*cdf0e10cSrcweir pRet->SetUserData((void*)nCommandType); 239*cdf0e10cSrcweir return pRet; 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir /*-------------------------------------------------------------------- 243*cdf0e10cSrcweir Beschreibung: Dialog zerstoeren 244*cdf0e10cSrcweir --------------------------------------------------------------------*/ 245*cdf0e10cSrcweir __EXPORT SwChangeDBDlg::~SwChangeDBDlg() 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir delete pMgr; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir /*-------------------------------------------------------------------- 251*cdf0e10cSrcweir Beschreibung: Schliessen 252*cdf0e10cSrcweir --------------------------------------------------------------------*/ 253*cdf0e10cSrcweir void __EXPORT SwChangeDBDlg::Apply() 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir UpdateFlds(); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir /*-------------------------------------------------------------------- 258*cdf0e10cSrcweir Beschreibung: 259*cdf0e10cSrcweir --------------------------------------------------------------------*/ 260*cdf0e10cSrcweir void SwChangeDBDlg::UpdateFlds() 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir SvStringsDtor aDBNames( (sal_uInt8)aUsedDBTLB.GetSelectionCount(), 1 ); 263*cdf0e10cSrcweir SvLBoxEntry* pEntry = aUsedDBTLB.FirstSelected(); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir while( pEntry ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir if( aUsedDBTLB.GetParent( pEntry )) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir String* pTmp = new String( aUsedDBTLB.GetEntryText( 270*cdf0e10cSrcweir aUsedDBTLB.GetParent( pEntry ))); 271*cdf0e10cSrcweir *pTmp += DB_DELIM; 272*cdf0e10cSrcweir *pTmp += aUsedDBTLB.GetEntryText( pEntry ); 273*cdf0e10cSrcweir *pTmp += DB_DELIM; 274*cdf0e10cSrcweir int nCommandType = (int)(sal_uLong)pEntry->GetUserData(); 275*cdf0e10cSrcweir *pTmp += String::CreateFromInt32(nCommandType); 276*cdf0e10cSrcweir aDBNames.Insert(pTmp, aDBNames.Count() ); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir pEntry = aUsedDBTLB.NextSelected(pEntry); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir pSh->StartAllAction(); 282*cdf0e10cSrcweir String sTableName, sColumnName; 283*cdf0e10cSrcweir sal_Bool bIsTable = sal_False; 284*cdf0e10cSrcweir String sTemp(aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable)); 285*cdf0e10cSrcweir sTemp += DB_DELIM; 286*cdf0e10cSrcweir sTemp += sTableName; 287*cdf0e10cSrcweir sTemp += DB_DELIM; 288*cdf0e10cSrcweir sTemp += bIsTable ? '0' : '1'; 289*cdf0e10cSrcweir pSh->ChangeDBFields( aDBNames, sTemp); 290*cdf0e10cSrcweir pSh->EndAllAction(); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir /*------------------------------------------------------------------------ 294*cdf0e10cSrcweir Beschreibung: 295*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir IMPL_LINK( SwChangeDBDlg, ButtonHdl, Button *, EMPTYARG ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir String sTableName, sColumnName; 301*cdf0e10cSrcweir SwDBData aData; 302*cdf0e10cSrcweir sal_Bool bIsTable = sal_False; 303*cdf0e10cSrcweir aData.sDataSource = aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable); 304*cdf0e10cSrcweir aData.sCommand = sTableName; 305*cdf0e10cSrcweir aData.nCommandType = bIsTable ? 0 : 1;; 306*cdf0e10cSrcweir pSh->ChgDBData(aData); 307*cdf0e10cSrcweir ShowDBName(pSh->GetDBData()); 308*cdf0e10cSrcweir EndDialog(RET_OK); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir return 0; 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir /*------------------------------------------------------------------------ 314*cdf0e10cSrcweir Beschreibung: 315*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir IMPL_LINK( SwChangeDBDlg, TreeSelectHdl, SvTreeListBox *, EMPTYARG ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir sal_Bool bEnable = sal_False; 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir SvLBoxEntry* pEntry = aAvailDBTLB.GetCurEntry(); 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir if (pEntry) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir if (aAvailDBTLB.GetParent(pEntry)) 327*cdf0e10cSrcweir bEnable = sal_True; 328*cdf0e10cSrcweir aOKBT.Enable( bEnable ); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir return 0; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir /*-------------------------------------------------------------------- 334*cdf0e10cSrcweir Beschreibung: Datenbankname fuer Anzeige wandeln 335*cdf0e10cSrcweir --------------------------------------------------------------------*/ 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir void SwChangeDBDlg::ShowDBName(const SwDBData& rDBData) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir String sTmp(rDBData.sDataSource); 340*cdf0e10cSrcweir String sName; 341*cdf0e10cSrcweir sTmp += '.'; 342*cdf0e10cSrcweir sTmp += (String)rDBData.sCommand; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir for (sal_uInt16 i = 0; i < sTmp.Len(); i++) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir sName += sTmp.GetChar(i); 347*cdf0e10cSrcweir if (sTmp.GetChar(i) == '~') 348*cdf0e10cSrcweir sName += '~'; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir aDocDBNameFT.SetText(sName); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir /*-- 27.05.2004 09:14:01--------------------------------------------------- 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 356*cdf0e10cSrcweir IMPL_LINK( SwChangeDBDlg, AddDBHdl, PushButton *, EMPTYARG ) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource(); 359*cdf0e10cSrcweir if(sNewDB.Len()) 360*cdf0e10cSrcweir aAvailDBTLB.AddDataSource(sNewDB); 361*cdf0e10cSrcweir return 0; 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364