summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorOliver Specht <os@openoffice.org>2001-02-21 11:27:37 +0000
committerOliver Specht <os@openoffice.org>2001-02-21 11:27:37 +0000
commit199b49e0058268280baee5b56f739aefdc8c7b08 (patch)
treee64908bf05dcf219288b24f8be9272c5a1ccee9e /sw/source/ui
parent4f3d101f696ee1e166089981f84ff4df75998371 (diff)
use database struct instead of a combined string
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/app/appenv.cxx7
-rw-r--r--sw/source/ui/app/apphdl.cxx23
-rw-r--r--sw/source/ui/app/applab.cxx6
-rw-r--r--sw/source/ui/app/swmodul1.cxx17
-rw-r--r--sw/source/ui/app/swmodule.cxx5
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx35
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx53
-rw-r--r--sw/source/ui/envelp/envlop1.cxx9
-rw-r--r--sw/source/ui/fldui/changedb.cxx30
-rw-r--r--sw/source/ui/fldui/flddb.cxx51
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx46
-rw-r--r--sw/source/ui/fldui/fldpage.cxx21
-rw-r--r--sw/source/ui/inc/changedb.hxx7
-rw-r--r--sw/source/ui/inc/dbinsdlg.hxx17
-rw-r--r--sw/source/ui/inc/fldmgr.hxx6
-rw-r--r--sw/source/ui/shells/textsh2.cxx15
16 files changed, 172 insertions, 176 deletions
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
index 7a25b14bcd5f..4597c8fd6d3e 100644
--- a/sw/source/ui/app/appenv.cxx
+++ b/sw/source/ui/app/appenv.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: appenv.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-09-26 13:06:16 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -559,8 +559,7 @@ static USHORT nTitleNo = 0;
pFrame->GetBindings().Invalidate( aInva );
// Datenbankbeamer oeffnen
- String sDBName(pSh->GetDBName());
- ShowDBObj(*pSh, sDBName);
+ ShowDBObj(*pSh, pSh->GetDBData());
}
}
}
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index b8020989779d..bf989bbf5de6 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: apphdl.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: os $ $Date: 2001-02-15 08:58:48 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -221,7 +221,9 @@
#ifndef _UINUMS_HXX //autogen
#include <uinums.hxx>
#endif
-
+#ifndef _DBCONFIG_HXX
+#include <dbconfig.hxx>
+#endif
#ifndef _LINGUISTIC_LNGPROPS_HHX_
#include <linguistic/lngprops.hxx>
#endif
@@ -523,7 +525,7 @@ void SwModule::StateOther(SfxItemSet &rSet)
case FN_QRY_MERGE:
{
SwView *pView = ::GetActiveView();
- if(!pView || !GetView()->GetWrtShell().GetDBName().Len())
+ if(!pView || !GetView()->GetWrtShell().GetDBData().sDataSource.getLength())
rSet.DisableItem(nWhich);
}
break;
@@ -985,8 +987,7 @@ void SwModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
sal_uInt16 nCount = aDBNameList.Count();
if (nCount)
{ // Datenbankbeamer oeffnen
- String sDBName = pDoc->GetDBName();
- ShowDBObj(*pWrtSh, sDBName);
+ ShowDBObj(*pWrtSh, pDoc->GetDBData());
}
}
break;
@@ -1028,6 +1029,7 @@ void SwModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
DELETEZ(pToolbarConfig) ;
DELETEZ(pWebToolbarConfig) ;
DELETEZ(pAuthorNames) ;
+ DELETEZ(pDBConfig);
}
}
void SwModule::FillStatusBar( StatusBar& rStatusBar )
@@ -1083,7 +1085,6 @@ void SwModule::FillStatusBar( StatusBar& rStatusBar )
/*-----------------18.11.96 10.42-------------------
--------------------------------------------------*/
-
SwSrcViewConfig* SwModule::GetSourceViewConfig()
{
if(!pSrcViewConfig)
@@ -1092,7 +1093,15 @@ SwSrcViewConfig* SwModule::GetSourceViewConfig()
}
return pSrcViewConfig;
}
+/* -----------------------------20.02.01 12:43--------------------------------
+ ---------------------------------------------------------------------------*/
+SwDBConfig* SwModule::GetDBConfig()
+{
+ if(!pDBConfig)
+ pDBConfig = new SwDBConfig;
+ return pDBConfig;
+}
/*-----------------30.01.97 08.30-------------------
--------------------------------------------------*/
diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx
index 36278c2b68f4..be75778c42c4 100644
--- a/sw/source/ui/app/applab.cxx
+++ b/sw/source/ui/app/applab.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: applab.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: hr $ $Date: 2000-10-31 15:35:35 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -548,7 +548,7 @@ static sal_uInt16 nBCTitleNo = 0;
if( rItem.aWriting.indexOf( '<' ) >= 0 )
{
// Datenbankbrowser mit zuletzt verwendeter Datenbank oeffnen
- ShowDBObj( *pSh, pSh->GetDBName() );
+ ShowDBObj( *pSh, pSh->GetDBData() );
}
if( rItem.bSynchron )
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index f3b354c7e6cb..cc407721d052 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swmodul1.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: jp $ $Date: 2001-02-21 10:08:37 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -607,17 +607,17 @@ void SwModule::ExecDB(SfxRequest &rReq)
case FN_QRY_MERGE:
case FN_QRY:
{
- String sDBName;
+ SwDBData aData;
if (GetView())
{
SwWrtShell &rSh = GetView()->GetWrtShell();
- sDBName = rSh.GetDBName();
+ aData = rSh.GetDBData();
rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
// das Mischen von DB-Feldern notwendig.
GetView()->AttrChangedNotify( &rSh );
pNewDBMgr->SetMergeType( DBMGR_MERGE );
- ShowDBObj(rSh, sDBName, sal_True);
+ ShowDBObj(rSh, aData, sal_True);
}
if (pNewDBMgr && nSlot == FN_QRY_MERGE)
@@ -678,12 +678,9 @@ void SwModule::StateIsView(SfxItemSet& rSet)
Beschreibung:
--------------------------------------------------------------------*/
-void SwModule::ShowDBObj(SwWrtShell& rSh, const String& rDBName, sal_Bool bShowError)
+void SwModule::ShowDBObj(SwWrtShell& rSh, const SwDBData& rData, sal_Bool bShowError)
{
- String sDBName(rDBName.GetToken(0, DB_DELIM));
-
- String sTable(rDBName.GetToken(1, DB_DELIM));
- rSh.GetNewDBMgr()->ShowInBeamer( sDBName, sTable, SW_DB_SELECT_UNKNOWN, aEmptyStr );
+ rSh.GetNewDBMgr()->ShowInBeamer( rData.sDataSource, rData.sCommand, rData.nCommandType, aEmptyStr );
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index f693909c1849..06ac2b00a8cc 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swmodule.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: os $ $Date: 2001-02-12 11:14:09 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -388,6 +388,7 @@ SwModule::SwModule( SvFactory* pFact,
pUsrPref(0),
pToolbarConfig(0),
pWebToolbarConfig(0),
+ pDBConfig(0),
pClipboard(0),
pDragDrop(0),
pAttrPool(0),
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 5f96da35eaf2..5b08d310328a 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbinsdlg.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: os $ $Date: 2001-02-12 12:42:44 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,6 +90,9 @@
#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include <com/sun/star/sdb/CommandType.hpp>
+#endif
#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
#include <com/sun/star/sdb/XColumn.hpp>
#endif
@@ -381,7 +384,7 @@ int SwInsDBColumn::operator<( const SwInsDBColumn& rCmp ) const
SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
Reference<XDataSource> xDataSource,
Reference<sdbcx::XColumnsSupplier> xColSupp,
- const SwInsDBData& rData )
+ const SwDBData& rData )
: SfxModalDialog( rView.GetWindow(), SW_RES( DLG_AP_INSERT_DB_SEL )),
ConfigItem(C2U("Office.Writer/InsertData/DataSet"), CONFIG_MODE_DELAYED_UPDATE),
aFtInsertData( this, SW_RES( FT_INSERT_DATA )),
@@ -1138,11 +1141,8 @@ FASTBOOL SwInsertDBColAutoPilot::SplitTextToColArr( const String& rTxt,
if( bInsField )
{
SwWrtShell& rSh = pView->GetWrtShell();
- String sDBContent(aDBData.sDataBaseName);
- sDBContent += DB_DELIM;
- sDBContent += aDBData.sDataTableName;
SwDBFieldType aFldType( rSh.GetDoc(), aSrch.sColumn,
- sDBContent );
+ aDBData );
pNew = new _DB_Column( rFndCol, *new SwDBField(
(SwDBFieldType*)rSh.InsertFldType( aFldType ),
nFormat ) );
@@ -1193,8 +1193,8 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<sal_Int32>& rSelection,
aResType <<= (sal_Int32)ResultSetType::SCROLL_INSENSITIVE;
xStatProp->setPropertyValue(C2U("ResultSetType"), aResType);
}
- if(xStatement.is())
- xResultSet = xStatement->executeQuery(aDBData.sStatement);
+ if(xStatement.is() && sdb::CommandType::COMMAND == aDBData.nCommandType)
+ xResultSet = xStatement->executeQuery(aDBData.sCommand);
xRow = Reference< sdbc::XRow >(xResultSet, UNO_QUERY);
}
catch(Exception& aExcept)
@@ -1486,14 +1486,9 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<sal_Int32>& rSelection,
aDBFormatData.aLocale = *(Locale*)aLoc.getValue();
}
- String sDBContent(aDBData.sDataBaseName);
- sDBContent += DB_DELIM;
- sDBContent += aDBData.sDataTableName;
- sDBContent += ';';
- sDBContent += aDBData.sStatement;
SwDBNextSetField aNxtDBFld( (SwDBNextSetFieldType*)rSh.
GetFldType( 0, RES_DBNEXTSETFLD ),
- C2S("1"), aEmptyStr, sDBContent );
+ C2S("1"), aEmptyStr, aDBData );
BOOL bSetCrsr = TRUE;
@@ -1835,7 +1830,7 @@ void SwInsertDBColAutoPilot::Commit()
OUString sSource, sCommand;
pSourceProps[0] >>= sSource;
pSourceProps[1] >>= sCommand;
- if(sSource.equals(aDBData.sDataBaseName) && sCommand.equals(aDBData.sDataTableName))
+ if(sSource.equals(aDBData.sDataSource) && sCommand.equals(aDBData.sCommand))
{
Sequence<OUString> aElements(1);
aElements.getArray()[0] = pNames[nNode];
@@ -1856,9 +1851,9 @@ void SwInsertDBColAutoPilot::Commit()
pValues[i].Name += pNodeNames[i];
}
- pValues[0].Value <<= OUString(aDBData.sDataBaseName);
- pValues[1].Value <<= OUString(aDBData.sDataTableName);
- pValues[2].Value <<= sal_Int16(0);
+ pValues[0].Value <<= OUString(aDBData.sDataSource);
+ pValues[1].Value <<= OUString(aDBData.sCommand);
+ pValues[2].Value <<= aDBData.nCommandType;
pValues[3].Value <<= OUString(aEdDbText.GetText());
String sTmp;
@@ -1968,7 +1963,7 @@ void SwInsertDBColAutoPilot::Load()
pDataSourceProps[0] >>= sSource;
pDataSourceProps[1] >>= sCommand;
pDataSourceProps[2] >>= nCommandType;
- if(sSource.equals(aDBData.sDataBaseName) && sCommand.equals(aDBData.sDataTableName))
+ if(sSource.equals(aDBData.sDataSource) && sCommand.equals(aDBData.sCommand))
{
_DB_ColumnConfigData* pNewData = new _DB_ColumnConfigData;
pNewData->sSource = sSource;
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 8a2ca662a9c8..c63f949474d7 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbmgr.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: os $ $Date: 2001-02-16 14:58:11 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,6 +99,9 @@
#ifndef _SFXVIEWFRM_HXX
#include <sfx2/viewfrm.hxx>
#endif
+#ifndef _DBCONFIG_HXX
+#include <dbconfig.hxx>
+#endif
#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
#endif
@@ -460,7 +463,13 @@ BOOL SwNewDBMgr::MergeNew(USHORT nOpt, SwWrtShell& rSh,
// Bei Datenbankfeldern ohne DB-Name DB-Name von Dok einsetzen
SvStringsDtor aDBNames(1, 1);
aDBNames.Insert( new String(), 0);
- rSh.ChangeDBFields( aDBNames, rSh.GetDBName());
+ SwDBData aData = rSh.GetDBData();
+ String sDBName = aData.sDataSource;
+ sDBName += DB_DELIM;
+ sDBName += (String)aData.sCommand;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(aData.nCommandType);
+ rSh.ChangeDBFields( aDBNames, sDBName);
SetInitDBFields(FALSE);
}
@@ -530,7 +539,13 @@ BOOL SwNewDBMgr::Merge( USHORT nOpt, SwWrtShell* pSh,
// Bei Datenbankfeldern ohne DB-Name DB-Name von Dok einsetzen
SvStringsDtor aDBNames(1, 1);
aDBNames.Insert( new String(), 0);
- pSh->ChangeDBFields( aDBNames, pSh->GetDBName());
+ SwDBData aData = pSh->GetDBData();
+ String sDBName = aData.sDataSource;
+ sDBName += DB_DELIM;
+ sDBName += (String)aData.sCommand;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(aData.nCommandType);
+ pSh->ChangeDBFields( aDBNames, sDBName);
SetInitDBFields(FALSE);
}
const SbaSelectionList* pSelList = 0;
@@ -816,12 +831,11 @@ void SwNewDBMgr::ChgDBName(SwWrtShell* pSh,
{
if (pSh)
{
- String sNewDBName(rDataSource);
- sNewDBName += DB_DELIM;
- sNewDBName += rTableOrQuery;
- sNewDBName += ';';
- sNewDBName += rStatement;
- pSh->ChgDBName(sNewDBName);
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ aData.sCommand = rStatement.Len() ? rStatement : rTableOrQuery;
+ aData.nCommandType = rStatement.Len() ? CommandType::COMMAND : CommandType::TABLE;
+ pSh->ChgDBData(aData);
}
}
@@ -2164,17 +2178,9 @@ void SwNewDBMgr::GetDSSelection(const String& rDBDesc, long& rSelStart, long&
/* -----------------------------17.07.00 14:34--------------------------------
---------------------------------------------------------------------------*/
-const String& SwNewDBMgr::GetAddressDBName()
+const SwDBData& SwNewDBMgr::GetAddressDBName()
{
-#ifdef DBG_UTIL
- static BOOL bShowError = TRUE;
- if(bShowError)
- {
- DBG_ERROR("SwNewDBMgr::GetAddressDBName(): no address data base selection available")
- bShowError=FALSE;
- }
-#endif
- return aEmptyStr;
+ return SW_MOD()->GetDBConfig()->GetAddressSource();
}
/* -----------------------------18.07.00 13:13--------------------------------
@@ -2295,9 +2301,10 @@ void SwNewDBMgr::InsertText(SwWrtShell& rSh,
Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
Reference<XDataSource> xSource = dbtools::getDataSource(sDataSource, xMgr);
Reference< XColumnsSupplier > xColSupp( xResSet, UNO_QUERY );
- SwInsDBData aDBData;
- aDBData.sDataBaseName = sDataSource;
- aDBData.sDataTableName = sDataTableOrQuery;
+ SwDBData aDBData;
+ aDBData.sDataSource = sDataSource;
+ aDBData.sCommand = sDataTableOrQuery;
+ aDBData.nCommandType = nCmdType;
SwInsertDBColAutoPilot *pDlg = new SwInsertDBColAutoPilot(
rSh.GetView(),
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index 9c7f8fc00c8c..fde4110c536b 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: envlop1.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: os $ $Date: 2000-10-27 14:29:46 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -287,7 +287,10 @@ SwEnvPage::SwEnvPage(Window* pParent, const SfxItemSet& rSet) :
aInsertBT .SetClickHdl (LINK(this, SwEnvPage, FieldHdl ));
aSenderBox .SetClickHdl (LINK(this, SwEnvPage, SenderHdl ));
- sActDBName = pSh->GetDBName();
+ SwDBData aData = pSh->GetDBData();
+ sActDBName = aData.sDataSource;
+ sActDBName += DB_DELIM;
+ sActDBName += (String)aData.sCommand;
InitDatabaseBox();
}
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
index 9f1fdc8ed745..d4f013aa65f1 100644
--- a/sw/source/ui/fldui/changedb.cxx
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: changedb.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: os $ $Date: 2000-10-27 11:24:22 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -166,7 +166,7 @@ SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) :
FreeResource();
- ShowDBName(pSh->GetDBName());
+ ShowDBName(pSh->GetDBData());
aOKBT.SetClickHdl(LINK(this, SwChangeDBDlg, ButtonHdl));
aUsedDBTLB.SetSelectionMode(MULTIPLE_SELECTION);
@@ -200,9 +200,9 @@ void SwChangeDBDlg::FillDBPopup()
}
DBG_ASSERT(xDBContext.is(), "com.sun.star.sdb.DataBaseContext: service not available")
- String sDataBaseName(pSh->GetDBName());
- String sDBName(sDataBaseName.GetToken(0, DB_DELIM));
- String sTableName(sDataBaseName.GetToken(1, DB_DELIM));
+ const SwDBData& rDBData = pSh->GetDBData();
+ String sDBName(rDBData.sDataSource);
+ String sTableName(rDBData.sCommand);
aAvailDBTLB.Select(sDBName, sTableName, aEmptyStr);
SvStringsDtor aAllDBNames(5, 5);
@@ -326,13 +326,11 @@ void SwChangeDBDlg::UpdateFlds()
IMPL_LINK( SwChangeDBDlg, ButtonHdl, Button *, pBtn )
{
String sTableName, sColumnName;
- String sTemp(aAvailDBTLB.GetDBName(sTableName, sColumnName));
- sTemp += DB_DELIM;
- sTemp += sTableName;
- sTemp += DB_DELIM;
- sTemp += sColumnName;
- pSh->ChgDBName(sTemp);
- ShowDBName(pSh->GetDBName());
+ SwDBData aData;
+ aData.sDataSource = aAvailDBTLB.GetDBName(sTableName, sColumnName);
+ aData.sCommand = sTableName;
+ pSh->ChgDBData(aData);
+ ShowDBName(pSh->GetDBData());
EndDialog(RET_OK);
return 0;
@@ -362,12 +360,12 @@ IMPL_LINK( SwChangeDBDlg, TreeSelectHdl, SvTreeListBox *, pBox )
Beschreibung: Datenbankname fuer Anzeige wandeln
--------------------------------------------------------------------*/
-void SwChangeDBDlg::ShowDBName(const String& rDBName)
+void SwChangeDBDlg::ShowDBName(const SwDBData& rDBData)
{
- String sTmp(rDBName.GetToken(0, DB_DELIM));
+ String sTmp(rDBData.sDataSource);
String sName;
sTmp += '.';
- sTmp += rDBName.GetToken(1, DB_DELIM);
+ sTmp += (String)rDBData.sCommand;
for (USHORT i = 0; i < sTmp.Len(); i++)
{
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index c16c8dc176eb..1a5d0ccf4b48 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: flddb.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-10-27 11:24:22 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -207,12 +207,9 @@ void __EXPORT SwFldDBPage::Reset(const SfxItemSet& rSet)
else
{
SwWrtShell *pSh = ::GetActiveView()->GetWrtShellPtr();
- String sTmp(pSh->GetDBName());
+ SwDBData aTmp(pSh->GetDBData());
- aDatabaseTLB.Select(
- sTmp.GetToken(0, DB_DELIM),
- sTmp.GetToken(1, DB_DELIM),
- sTmp.GetToken(2, DB_DELIM));
+ aDatabaseTLB.Select(aTmp.sDataSource, aTmp.sCommand, aEmptyStr);
}
}
@@ -222,7 +219,7 @@ void __EXPORT SwFldDBPage::Reset(const SfxItemSet& rSet)
if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
{
String sVal = sUserData.GetToken(1, ';');
- USHORT nVal = sVal.ToInt32();
+ USHORT nVal = (USHORT)sVal.ToInt32();
if(nVal != USHRT_MAX)
{
for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
@@ -257,24 +254,17 @@ void __EXPORT SwFldDBPage::Reset(const SfxItemSet& rSet)
BOOL __EXPORT SwFldDBPage::FillItemSet(SfxItemSet& rSet)
{
String sTableName, sColumnName;
- String sDBName = aDatabaseTLB.GetDBName(sTableName, sColumnName);
+ SwDBData aData;
+ aData.sDataSource = aDatabaseTLB.GetDBName(sTableName, sColumnName);
+ aData.sCommand = sTableName;
SwWrtShell *pSh = ::GetActiveView()->GetWrtShellPtr();
- if (!sDBName.Len())
- {
- String sTmp = pSh->GetDBName();
- sDBName = sTmp.GetToken(0, DB_DELIM);
- sTableName = sTmp.GetToken(1, DB_DELIM);
- }
+ if (!aData.sDataSource.getLength())
+ aData = pSh->GetDBData();
else
- {
- String sNewDBName = sDBName;
- sNewDBName += DB_DELIM;
- sNewDBName += sTableName;
- pSh->ChgDBName(sNewDBName);
- }
+ pSh->ChgDBData(aData);
- if (sDBName.Len()) // Ohne Datenbank kein neuer Feldbefehl
+ if(aData.sDataSource.getLength()) // Ohne Datenbank kein neuer Feldbefehl
{
USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
String aVal(aValueED.GetText());
@@ -282,8 +272,9 @@ BOOL __EXPORT SwFldDBPage::FillItemSet(SfxItemSet& rSet)
ULONG nFormat = 0;
USHORT nSubType = 0;
+ String sDBName = aData.sDataSource;
sDBName += DB_DELIM;
- sDBName += sTableName;
+ sDBName += (String)aData.sCommand;
sDBName += DB_DELIM;
if(sColumnName.Len())
{
@@ -372,20 +363,18 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
if (IsFldEdit())
{
- String sDBName, sTableName, sColumnName;
+ SwDBData aData;
+ String sColumnName;
if (nTypeId == TYP_DBFLD)
{
- sDBName = ((SwDBField*)GetCurField())->GetDBName();
+ aData = ((SwDBField*)GetCurField())->GetDBData();
sColumnName = ((SwDBFieldType*)GetCurField()->GetTyp())->GetColumnName();
}
else
{
- sDBName = ((SwDBNameInfField*)GetCurField())->GetDBName(pSh->GetDoc());
+ aData = ((SwDBNameInfField*)GetCurField())->GetDBData(pSh->GetDoc());
}
- sTableName = sDBName.GetToken(1, DB_DELIM);
- sDBName = sDBName.GetToken(0, DB_DELIM);
-
- aDatabaseTLB.Select(sDBName, sTableName, sColumnName);
+ aDatabaseTLB.Select(aData.sDataSource, aData.sCommand, sColumnName);
}
switch (nTypeId)
@@ -587,7 +576,7 @@ void SwFldDBPage::FillUserData()
if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
nTypeSel = USHRT_MAX;
else
- nTypeSel = (ULONG)aTypeLB.GetEntryData( nTypeSel );
+ nTypeSel = (USHORT)aTypeLB.GetEntryData( nTypeSel );
sData += String::CreateFromInt32( nTypeSel );
SetUserData(sData);
}
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 736a8be783a9..7151d91653df 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fldmgr.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2001-01-18 14:01:38 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1198,35 +1198,32 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
}
case TYP_DBFLD:
{
- String sDBName;
+ SwDBData aDBData;
String sPar1;
if (rPar1.Search(DB_DELIM) == STRING_NOTFOUND)
{
- sDBName = pSh->GetDBName();
+ aDBData = pSh->GetDBData();
sPar1 = rPar1;
}
else
{
- sDBName = rPar1.GetToken(0, DB_DELIM);
- sDBName += DB_DELIM;
- sDBName += rPar1.GetToken(1, DB_DELIM);
+ aDBData.sDataSource = rPar1.GetToken(0, DB_DELIM);
+ aDBData.sCommand = rPar1.GetToken(1, DB_DELIM);
sPar1 = rPar1.GetToken(2, DB_DELIM);
}
- if (sDBName.Len() && pSh->GetDBName() != sDBName)
- pSh->ChgDBName(sDBName);
+ if(aDBData.sDataSource.getLength() && pSh->GetDBData() != aDBData)
+ pSh->ChgDBData(aDBData);
SwDBFieldType* pTyp = (SwDBFieldType*)pSh->InsertFldType(
- SwDBFieldType(pSh->GetDoc(), sPar1, sDBName) );
+ SwDBFieldType(pSh->GetDoc(), sPar1, aDBData) );
pFld = new SwDBField(pTyp);
pFld->SetSubType(nSubType);
if( !(nSubType & SUB_OWN_FMT) ) // Datenbankformat ermitteln
{
- String sSourceName(sDBName.GetToken(0, DB_DELIM));
- String sTableName(sDBName.GetToken(1, DB_DELIM));
- nFormat = pSh->GetNewDBMgr()->GetColumnFmt( sSourceName, sTableName, sPar1,
+ nFormat = pSh->GetNewDBMgr()->GetColumnFmt( aDBData.sDataSource, aDBData.sCommand, sPar1,
pSh->GetNumberFormatter(), GetCurrLanguage() );
}
pFld->ChangeFormat( nFormat );
@@ -1240,15 +1237,15 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
case TYP_DBNAMEFLD:
{
USHORT nPos, nTablePos, nExpPos;
- String sDBName, sPar1;
+ String sPar1;
+ SwDBData aDBData;
// DBName aus rPar1 extrahieren. Format: DBName.TableName.ExpStrg
if ((nTablePos = rPar1.Search(DB_DELIM)) != STRING_NOTFOUND)
- sDBName = rPar1.Copy(0, nTablePos++);
+ aDBData.sDataSource = rPar1.Copy(0, nTablePos++);
if ((nExpPos = rPar1.Search(DB_DELIM, nTablePos)) != STRING_NOTFOUND)
{
- sDBName += DB_DELIM;
- sDBName += rPar1.Copy(nTablePos, nExpPos++ - nTablePos);
+ aDBData.sCommand = rPar1.Copy(nTablePos, nExpPos++ - nTablePos);
}
if (nExpPos != STRING_NOTFOUND)
nPos = nExpPos;
@@ -1258,8 +1255,8 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
nPos = 0;
sPar1 = rPar1.Copy(nPos);
- if (sDBName.Len() && pSh->GetDBName() != sDBName)
- pSh->ChgDBName(sDBName);
+ if (aDBData.sDataSource.getLength() && pSh->GetDBData() != aDBData)
+ pSh->ChgDBData(aDBData);
switch(nType)
{
@@ -1267,7 +1264,7 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
{
SwDBNameFieldType* pTyp =
(SwDBNameFieldType*)pSh->GetFldType(0, RES_DBNAMEFLD);
- pFld = new SwDBNameField(pTyp, sDBName);
+ pFld = new SwDBNameField(pTyp, aDBData);
break;
}
@@ -1275,7 +1272,7 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
{
SwDBNextSetFieldType* pTyp = (SwDBNextSetFieldType*)pSh->GetFldType(
0, RES_DBNEXTSETFLD);
- pFld = new SwDBNextSetField(pTyp, sPar1, rPar2, sDBName);
+ pFld = new SwDBNextSetField(pTyp, sPar1, rPar2, aDBData);
bExp = TRUE;
break;
}
@@ -1283,7 +1280,7 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
{
SwDBNumSetFieldType* pTyp = (SwDBNumSetFieldType*)pSh->GetFldType(
0, RES_DBNUMSETFLD);
- pFld = new SwDBNumSetField( pTyp, sPar1, rPar2, sDBName);
+ pFld = new SwDBNumSetField( pTyp, sPar1, rPar2, aDBData);
bExp = TRUE;
break;
}
@@ -1291,7 +1288,7 @@ BOOL SwFldMgr::InsertFld(USHORT nType,
{
SwDBSetNumberFieldType* pTyp = (SwDBSetNumberFieldType*)
pSh->GetFldType(0, RES_DBSETNUMBERFLD);
- pFld = new SwDBSetNumberField( pTyp, sDBName, nFormat);
+ pFld = new SwDBSetNumberField( pTyp, aDBData, nFormat);
bExp = TRUE;
break;
}
@@ -1646,7 +1643,7 @@ BOOL SwFldMgr::SetFieldValue(const String &rFieldName,
/*------------------------------------------------------------------------
Beschreibung: Wert Datenbankfeld erfragen
------------------------------------------------------------------------*/
-
+#if 0
String SwFldMgr::GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh)
{
@@ -1672,6 +1669,7 @@ String SwFldMgr::GetDataBaseFieldValue(const String &rDBName, const String &rFie
return aEmptyStr;
}
+#endif
/*--------------------------------------------------------------------
Beschreibung: Ist das Datenbankfeld numerisch?
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index cc33f80ac7fc..780daac1c15d 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fldpage.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-11-08 12:46:44 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -251,15 +251,14 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1,
case TYP_DBSETNUMBERFLD:
{
USHORT nPos, nTablePos, nExpPos;
- String sDBName;
+ SwDBData aData;
// DBName aus rPar1 extrahieren. Format: DBName.TableName.ExpStrg
if ((nTablePos = rPar1.Search(DB_DELIM)) != STRING_NOTFOUND)
- sDBName = rPar1.Copy(0, nTablePos++);
+ aData.sDataSource = rPar1.Copy(0, nTablePos++);
if ((nExpPos = rPar1.Search(DB_DELIM, nTablePos)) != STRING_NOTFOUND)
{
- sDBName += DB_DELIM;
- sDBName += rPar1.Copy(nTablePos, nExpPos++ - nTablePos);
+ aData.sCommand = rPar1.Copy(nTablePos, nExpPos++ - nTablePos);
}
if (nExpPos != STRING_NOTFOUND)
nPos = nExpPos;
@@ -269,21 +268,21 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1,
nPos = 0;
sPar1 = rPar1.Copy(nPos);
- ((SwDBNameInfField*)pCurFld)->SetDBName(sDBName);
+ ((SwDBNameInfField*)pCurFld)->SetDBData(aData);
bDBChanged = TRUE;
}
break;
case TYP_DBFLD:
{
- String sDBName = rPar1.GetToken(0, DB_DELIM);
- sDBName += DB_DELIM;
- sDBName += rPar1.GetToken(1, DB_DELIM);
+ SwDBData aData;
+ aData.sDataSource = rPar1.GetToken(0, DB_DELIM);
+ aData.sCommand = rPar1.GetToken(1, DB_DELIM);
String sColumn = rPar1.GetToken(2, DB_DELIM);
SwDBFieldType* pOldTyp = (SwDBFieldType*)pCurFld->GetTyp();
SwDBFieldType* pTyp = (SwDBFieldType*)pSh->InsertFldType(
- SwDBFieldType(pSh->GetDoc(), sColumn, sDBName));
+ SwDBFieldType(pSh->GetDoc(), sColumn, aData));
SwClientIter aIter( *pOldTyp );
diff --git a/sw/source/ui/inc/changedb.hxx b/sw/source/ui/inc/changedb.hxx
index 6ffe3451eaf3..e1a93a6e05b1 100644
--- a/sw/source/ui/inc/changedb.hxx
+++ b/sw/source/ui/inc/changedb.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: changedb.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:14:38 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,7 @@
class SwFldMgr;
class SwView;
class SwWrtShell;
+struct SwDBData;
/*--------------------------------------------------------------------
Beschreibung: Datenbank an Feldern austauschen
@@ -125,7 +126,7 @@ class SwChangeDBDlg: public SvxStandardDialog
void UpdateFlds();
void FillDBPopup();
SvLBoxEntry* Insert(const String& rDBName);
- void ShowDBName(const String& rDBName);
+ void ShowDBName(const SwDBData& rDBData);
public:
SwChangeDBDlg(SwView& rVw);
diff --git a/sw/source/ui/inc/dbinsdlg.hxx b/sw/source/ui/inc/dbinsdlg.hxx
index cc6d2404d6e7..4b0a6dd29705 100644
--- a/sw/source/ui/inc/dbinsdlg.hxx
+++ b/sw/source/ui/inc/dbinsdlg.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbinsdlg.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: os $ $Date: 2000-12-08 10:19:55 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,6 +93,9 @@
#ifndef _SWNUMFMTLB_HXX //autogen
#include <numfmtlb.hxx>
#endif
+#ifndef _SWDBDATA_HXX
+#include <swdbdata.hxx>
+#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
@@ -136,12 +139,6 @@ struct SwInsDBColumn
int operator<( const SwInsDBColumn& rCmp ) const;
};
-struct SwInsDBData
-{
- String sDataBaseName;
- String sDataTableName;
- String sStatement;
-};
typedef SwInsDBColumn* SwInsDBColumnPtr;
SV_DECL_PTRARR_SORT_DEL( SwInsDBColumns, SwInsDBColumnPtr, 32, 32 )
@@ -189,7 +186,7 @@ class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
HelpButton aBtHelp;
SwInsDBColumns aDBColumns;
- const SwInsDBData aDBData;
+ const SwDBData aDBData;
Link aOldNumFmtLnk;
String sNoTmpl;
@@ -223,7 +220,7 @@ public:
SwInsertDBColAutoPilot( SwView& rView,
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
- const SwInsDBData& rData );
+ const SwDBData& rData );
virtual ~SwInsertDBColAutoPilot();
diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx
index 732dfa51a992..a9794130d051 100644
--- a/sw/source/ui/inc/fldmgr.hxx
+++ b/sw/source/ui/inc/fldmgr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fldmgr.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: os $ $Date: 2000-10-27 11:24:26 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -193,7 +193,7 @@ public:
const String &rValue);
// Erfragen von Werten aus Datenbankfeldern (BASIC )
- String GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh);
+// String GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh);
BOOL IsDBNumeric(const String& rDBName, const String& rTblQryName,
BOOL bIsTable, const String& rFldName);
diff --git a/sw/source/ui/shells/textsh2.cxx b/sw/source/ui/shells/textsh2.cxx
index 2f5afb030f34..cd9a53d758a6 100644
--- a/sw/source/ui/shells/textsh2.cxx
+++ b/sw/source/ui/shells/textsh2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: textsh2.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: os $ $Date: 2000-12-05 12:27:39 $
+ * last change: $Author: os $ $Date: 2001-02-21 12:27:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,9 @@
#ifndef _SFXREQUEST_HXX
#include <sfx2/request.hxx>
#endif
+#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include <com/sun/star/sdb/CommandType.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
@@ -333,10 +336,10 @@ IMPL_STATIC_LINK( SwBaseShell, InsertDBTextHdl, String*, pString )
if( xColSupp.is() )
{
- SwInsDBData aDBData;
- aDBData.sDataBaseName = sSourceName;
- aDBData.sDataTableName = sTblQryName;
- aDBData.sStatement = sStatmnt;
+ SwDBData aDBData;
+ aDBData.sDataSource = sSourceName;
+ aDBData.sCommand = sStatmnt.Len() ? sStatmnt : sTblQryName;
+ aDBData.nCommandType = sStatmnt.Len() ? sdb::CommandType::COMMAND : sdb::CommandType::TABLE;
SwInsertDBColAutoPilot *pDlg = new SwInsertDBColAutoPilot(
pThis->GetView(),
xSource,