some (a lot of) new imlpementations - still under development

This commit is contained in:
Frank Schönheit 2000-10-09 11:39:52 +00:00
parent 5665c11113
commit 303e9e0281
9 changed files with 855 additions and 421 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: adminpages.cxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:04:12 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -111,11 +111,15 @@
#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
#include <com/sun/star/sdb/SQLContext.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::dbtools;
//.........................................................................
@ -225,8 +229,8 @@ OGeneralPage::OGeneralPage(Window* pParent, const SfxItemSet& _rItems)
// do some knittings
m_aDatasourceType.SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected));
m_aName.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aConnection.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aName.SetModifyHdl(getControlModifiedLink());
m_aConnection.SetModifyHdl(getControlModifiedLink());
}
//-------------------------------------------------------------------------
@ -394,7 +398,7 @@ OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nRe
,m_pUserName(NULL)
,m_pPasswordLabel(NULL)
,m_pPassword(NULL)
,m_pAskIfEmptyPwd(NULL)
,m_pPasswordRequired(NULL)
,m_pOptionsLabel(NULL)
,m_pOptions(NULL)
,m_pCharsetLabel(NULL)
@ -405,27 +409,28 @@ OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nRe
{
m_pUserNameLabel = new FixedText(this, ResId(FT_USERNAME));
m_pUserName = new Edit(this, ResId(ET_USERNAME));
m_pUserName->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_pUserName->SetModifyHdl(getControlModifiedLink());
m_pPasswordRequired = new CheckBox(this, ResId(CB_PASSWORD_REQUIRED));
m_pPasswordRequired->SetClickHdl(LINK(this, OCommonBehaviourTabPage, OnPasswordRequired));
m_pPasswordLabel = new FixedText(this, ResId(FT_PASSWORD));
m_pPassword = new Edit(this, ResId(ET_PASSWORD));
m_pPassword->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_pAskIfEmptyPwd = new CheckBox(this, ResId(CB_ASK_WHEN_EMPTY_PWD));
m_pAskIfEmptyPwd->SetClickHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_pPassword->SetModifyHdl(getControlModifiedLink());
}
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
m_pOptionsLabel = new FixedText(this, ResId(FT_OPTIONS));
m_pOptions = new Edit(this, ResId(ET_OPTIONS));
m_pOptions->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_pOptions->SetModifyHdl(getControlModifiedLink());
}
if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
{
m_pCharsetLabel = new FixedText(this, ResId(FT_CHARSET));
m_pCharset = new ListBox(this, ResId(LB_CHARSET));
m_pCharset->SetSelectHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_pCharset->SetSelectHdl(getControlModifiedLink());
OCharsetCollection::CharsetIterator aLoop = m_aCharsets.begin();
while (aLoop != m_aCharsets.end())
@ -443,7 +448,7 @@ OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
DELETEZ(m_pUserName);
DELETEZ(m_pPasswordLabel);
DELETEZ(m_pPassword);
DELETEZ(m_pAskIfEmptyPwd);
DELETEZ(m_pPasswordRequired);
DELETEZ(m_pOptionsLabel);
DELETEZ(m_pOptions);
@ -464,7 +469,7 @@ void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
SFX_ITEMSET_GET(_rSet, pPwdItem, SfxStringItem, DSID_PASSWORD, sal_True);
SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True);
SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True);
SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_ASKFOREMPTYPWD, sal_True);
SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
// forward the values to the controls
if (bValid)
@ -473,7 +478,7 @@ void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
{
m_pUserName->SetText(pUidItem->GetValue());
m_pPassword->SetText(pPwdItem->GetValue());
m_pAskIfEmptyPwd->Check(pAllowEmptyPwd->GetValue());
m_pPasswordRequired->Check(pAllowEmptyPwd->GetValue());
m_pUserName->ClearModifyFlag();
m_pPassword->ClearModifyFlag();
@ -482,12 +487,10 @@ void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
{
m_pUserName->SaveValue();
m_pPassword->SaveValue();
m_pAskIfEmptyPwd->SaveValue();
m_pPasswordRequired->SaveValue();
}
m_pUserName->SetModifyHdl(LINK(this, OCommonBehaviourTabPage, OnPasswordModified));
m_pPassword->SetModifyHdl(LINK(this, OCommonBehaviourTabPage, OnPasswordModified));
LINK(this, OCommonBehaviourTabPage, OnPasswordModified).Call(m_pAskIfEmptyPwd);
LINK(this, OCommonBehaviourTabPage, OnPasswordRequired).Call(NULL);
// for the initial state
}
@ -515,7 +518,7 @@ void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
m_pUserName->Disable();
m_pPasswordLabel->Disable();
m_pPassword->Disable();
m_pAskIfEmptyPwd->Disable();
m_pPasswordRequired->Disable();
}
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
@ -540,28 +543,28 @@ sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
{
if (m_pUserName->GetText() != m_pUserName->GetSavedValue())
{
String strUserId(m_pUserName->GetText());
_rSet.Put(SfxStringItem(DSID_USER, strUserId));
_rSet.Put(SfxStringItem(DSID_USER, m_pUserName->GetText()));
bChangedSomething = sal_True;
}
if (m_pPassword->GetText() != m_pPassword->GetSavedValue())
{
String strPassword(m_pPassword->GetText());
_rSet.Put(SfxStringItem(DSID_PASSWORD, strPassword));
_rSet.Put(SfxStringItem(DSID_PASSWORD, m_pPassword->GetText()));
bChangedSomething = sal_True;
}
if (m_pAskIfEmptyPwd->IsChecked() != m_pAskIfEmptyPwd->GetSavedValue())
_rSet.Put(SfxBoolItem(DSID_ASKFOREMPTYPWD, m_pAskIfEmptyPwd->IsChecked()));
if (m_pPasswordRequired->IsChecked() != m_pPasswordRequired->GetSavedValue())
{
_rSet.Put(SfxBoolItem(DSID_PASSWORDREQUIRED, m_pPasswordRequired->IsChecked()));
bChangedSomething = sal_True;
}
}
if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
{
if( m_pOptions->GetText() != m_pOptions->GetSavedValue() )
{
String strOptions = m_pOptions->GetText();
_rSet.Put(SfxStringItem(DSID_ADDITIONALOPTIONS, strOptions));
_rSet.Put(SfxStringItem(DSID_ADDITIONALOPTIONS, m_pOptions->GetText()));
bChangedSomething = sal_True;
}
}
@ -579,11 +582,16 @@ sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
}
//------------------------------------------------------------------------
IMPL_LINK( OCommonBehaviourTabPage, OnPasswordModified, Control*, pControl)
IMPL_LINK( OCommonBehaviourTabPage, OnPasswordRequired, Control*, pControl)
{
DBG_ASSERT((m_nControlFlags & CBTP_USE_UIDPWD) == CBTP_USE_UIDPWD, "OCommonBehaviourTabPage::OnPasswordModified : wrong mode, will probably crash!");
DBG_ASSERT((m_nControlFlags & CBTP_USE_UIDPWD) == CBTP_USE_UIDPWD, "OCommonBehaviourTabPage::OnPasswordRequired : wrong mode, will probably crash!");
m_pAskIfEmptyPwd->Enable((m_pUserName->GetText().Len() > 0) && (m_pPassword->GetText().Len() == 0));
m_pPassword->Enable(m_pPasswordRequired->IsChecked());
m_pPasswordLabel->Enable(m_pPasswordRequired->IsChecked());
if (pControl)
// it really came from the control, it was no implicit call
callModifiedHdl();
return 0L;
}
@ -708,13 +716,13 @@ OJdbcDetailsPage::OJdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAtt
,m_aJdbcUrl (this, ResId(ET_CONNECTURL))
,m_aSeparator1 (this, ResId(FL_SEPARATOR1))
{
m_aDriver.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aJdbcUrl.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aDriver.SetModifyHdl(getControlModifiedLink());
m_aJdbcUrl.SetModifyHdl(getControlModifiedLink());
m_pUserName->SetZOrder(&m_aJdbcUrl, WINDOW_ZORDER_BEHIND);
m_pPassword->SetZOrder(m_pUserName, WINDOW_ZORDER_BEHIND);
m_pAskIfEmptyPwd->SetZOrder(m_pPassword, WINDOW_ZORDER_BEHIND);
m_pCharset->SetZOrder(m_pAskIfEmptyPwd, WINDOW_ZORDER_BEHIND);
m_pPasswordRequired->SetZOrder(m_pPassword, WINDOW_ZORDER_BEHIND);
m_pCharset->SetZOrder(m_pPasswordRequired, WINDOW_ZORDER_BEHIND);
FreeResource();
}
@ -785,6 +793,7 @@ sal_Bool OJdbcDetailsPage::FillItemSet( SfxItemSet& _rSet )
//========================================================================
OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_UIDPWD | CBTP_USE_CHARSET | CBTP_USE_OPTIONS)
,m_aSeparator2 (this, ResId(FL_SEPARATOR2))
,m_aSeparator1 (this, ResId(FL_SEPARATOR1))
{
FreeResource();
@ -803,6 +812,7 @@ OAdabasDetailsPage::OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCor
:OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_UIDPWD | CBTP_USE_CHARSET)
// Yes, we're using the resource for the ODBC page here. It contains two controls which we don't use
// and except that it's excatly what we need here.
,m_aSeparator2 (this, ResId(FL_SEPARATOR2))
,m_aSeparator1 (this, ResId(FL_SEPARATOR1))
{
// move the charset related control some pixel up (as they are positioned as if above them there are the option
@ -854,18 +864,18 @@ OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAtt
m_aTextSeparator.InsertEntry( m_aTextSeparatorList.GetToken( i, '\t' ) );
// set the modify handlers
m_aHeader.SetClickHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aFieldSeparator.SetUpdateDataHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aFieldSeparator.SetSelectHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aTextSeparator.SetUpdateDataHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aTextSeparator.SetSelectHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aExtension.SetSelectHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aHeader.SetClickHdl(getControlModifiedLink());
m_aFieldSeparator.SetUpdateDataHdl(getControlModifiedLink());
m_aFieldSeparator.SetSelectHdl(getControlModifiedLink());
m_aTextSeparator.SetUpdateDataHdl(getControlModifiedLink());
m_aTextSeparator.SetSelectHdl(getControlModifiedLink());
m_aExtension.SetSelectHdl(getControlModifiedLink());
m_aFieldSeparator.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aTextSeparator.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aDecimalSeparator.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aThousandsSeparator.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aExtension.SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aFieldSeparator.SetModifyHdl(getControlModifiedLink());
m_aTextSeparator.SetModifyHdl(getControlModifiedLink());
m_aDecimalSeparator.SetModifyHdl(getControlModifiedLink());
m_aThousandsSeparator.SetModifyHdl(getControlModifiedLink());
m_aExtension.SetModifyHdl(getControlModifiedLink());
m_pCharset->SetZOrder(&m_aExtension, WINDOW_ZORDER_BEHIND);
@ -1105,13 +1115,19 @@ void OTextDetailsPage::SetSeparator( ComboBox& rBox, const String& rList, sal_uI
//------------------------------------------------------------------------
OTableSubscriptionPage::OTableSubscriptionPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OGenericAdministrationPage( pParent, ModuleRes(PAGE_TABLESUBSCRIPTION), _rCoreAttrs )
,m_aIncludeAll (this, ResId(RB_INCLUDEALL))
,m_aIncludeNone (this, ResId(RB_INCLUDENONE))
,m_aIncludeSelected (this, ResId(RB_INCLUDESPECIFIC))
,m_aTablesListLabel (this, ResId(FT_TABLESUBSCRIPTION))
,m_aTablesList (this, ResId(CTL_TABLESUBSCRIPTION))
,m_aIncludeAllTables (this, ResId(PB_ADDALLTABLES))
,m_bCheckedAll (sal_True)
,m_pLastCheckedButton (NULL)
,m_pAdminDialog (NULL)
{
m_aIncludeAllTables.SetClickHdl( LINK(this, OTableSubscriptionPage, AddAllClickHdl) );
m_aIncludeAllTables.SetText( ResId(STR_CHECK_ALL) );
m_aIncludeAll.SetClickHdl(LINK(this, OTableSubscriptionPage, OnRadioButtonClicked));
m_aIncludeNone.SetClickHdl(LINK(this, OTableSubscriptionPage, OnRadioButtonClicked));
m_aIncludeSelected.SetClickHdl(LINK(this, OTableSubscriptionPage, OnRadioButtonClicked));
m_aTablesList.SetCheckHandler(getControlModifiedLink());
// initialize the TabListBox
m_aTablesList.SetSelectionMode( MULTIPLE_SELECTION );
@ -1123,7 +1139,7 @@ OTableSubscriptionPage::OTableSubscriptionPage( Window* pParent, const SfxItemSe
FreeResource();
m_aTablesList.SetCheckButtonHdl(LINK(this, OGenericAdministrationPage, OnControlModified));
m_aTablesList.SetCheckButtonHdl(getControlModifiedLink());
}
//------------------------------------------------------------------------
@ -1137,6 +1153,54 @@ SfxTabPage* OTableSubscriptionPage::Create( Window* pParent, const SfxItemSet& r
return ( new OTableSubscriptionPage( pParent, rAttrSet ) );
}
//------------------------------------------------------------------------
void OTableSubscriptionPage::implCheckTables(const Sequence< ::rtl::OUString >& _rTables)
{
// the meta data for the current connection, used for splitting up table names
Reference< XDatabaseMetaData > xMeta;
try
{
if (m_xCurrentConnection.is())
xMeta = m_xCurrentConnection->getMetaData();
}
catch(SQLException&)
{
DBG_ERROR("OTableSubscriptionPage::implCheckTables : could not retrieve the current connection's meta data!");
}
// uncheck all
SvLBoxEntry* pUncheckLoop = m_aTablesList.First();
while (pUncheckLoop)
{
m_aTablesList.SetCheckButtonState(pUncheckLoop, SV_BUTTON_UNCHECKED);
pUncheckLoop = m_aTablesList.Next(pUncheckLoop);
}
// check the ones which are in the list
String aListBoxTable;
::rtl::OUString aCatalog,aSchema,aName;
const ::rtl::OUString* pIncludeTable = _rTables.getConstArray();
for (sal_Int32 i=0; i<_rTables.getLength(); ++i, ++pIncludeTable)
{
if (xMeta.is())
qualifiedNameComponents(xMeta, pIncludeTable->getStr(), aCatalog, aSchema, aName);
else
aName = pIncludeTable->getStr();
SvLBoxEntry* pCatalog = m_aTablesList.GetEntryPosByName(aCatalog);
SvLBoxEntry* pSchema = m_aTablesList.GetEntryPosByName(aSchema,pCatalog);
SvLBoxEntry* pEntry = m_aTablesList.GetEntryPosByName(aName,pSchema);
if(pEntry)
m_aTablesList.SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
}
m_aTablesList.CheckButtons();
m_bCheckedAll = sal_False;
m_aLastDetailedSelection = _rTables;
}
//------------------------------------------------------------------------
void OTableSubscriptionPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
@ -1144,58 +1208,14 @@ void OTableSubscriptionPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
bValid = bValid && m_xCurrentConnection.is();
bReadonly = bReadonly || !bValid;
m_aTablesList.Enable(!bReadonly);
m_aTablesListLabel.Enable(!bReadonly);
m_aIncludeAllTables.Enable(!bReadonly);
// the PropertyValues for the current dialog settings
Sequence< PropertyValue > aConnectionParams = ODbAdminDialog::toDriverParams(_rSet);
// the current DSN
String sURL;
SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
if (bValid)
sURL = pUrlItem->GetValue();
// fill the table list with this connection information
Reference< XConnection > xConn;
Reference< XDatabaseMetaData > xMeta;
SQLExceptionInfo aErrorInfo;
try
{
xConn = m_aTablesList.UpdateTableList(sURL, aConnectionParams);
}
catch (SQLContext& e) { aErrorInfo = SQLExceptionInfo(e); }
catch (SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); }
catch (SQLException& e) { aErrorInfo = SQLExceptionInfo(e); }
if (aErrorInfo.isValid())
{
// establishing the connection failed. Show an error window and exit.
OSQLMessageBox(GetParent(), aErrorInfo, WB_OK | WB_DEF_OK, OSQLMessageBox::Error).Execute();
m_aTablesList.Enable(sal_False);
m_aTablesListLabel.Enable(sal_False);
m_aIncludeAllTables.Enable(sal_False);
m_aTablesList.Clear();
return;
}
// in addition, we need some infos about the connection used
m_sCatalogSeparator = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); // (default)
m_bCatalogAtStart = sal_True; // (default)
try
{
if (xConn.is())
xMeta = xConn->getMetaData();
if (xMeta.is())
{
m_sCatalogSeparator = xMeta->getCatalogSeparator();
m_bCatalogAtStart = xMeta->isCatalogAtStart();
}
}
catch(SQLException&)
{
DBG_ERROR("OTableSubscriptionPage::implInitControls : could not retrieve the qualifier separator for the used connection !");
}
m_aIncludeAll.Enable(!bReadonly);
m_aIncludeNone.Enable(!bReadonly);
m_aIncludeSelected.Enable(!bReadonly);
m_bCheckedAll = sal_True;
// get the current table filter
@ -1205,35 +1225,33 @@ void OTableSubscriptionPage::implInitControls(const SfxItemSet& _rSet, sal_Bool
aTableFilter = pTableFilter->getList();
if (!aTableFilter.getLength())
{ // unfortunally, we don't know what this means: It could be that the user unchecked _all_ the tables,
// because he/she does not want to see any of them, or the user did _check_ all of them.
CheckAll();
{ // no tables visible
CheckAll(sal_False);
m_aIncludeNone.Check();
LINK(this, OTableSubscriptionPage, OnRadioButtonClicked).Call(&m_aIncludeNone);
}
else
{ // check the ones which are in the list
String aListBoxTable;
::rtl::OUString aCatalog,aSchema,aName;
const ::rtl::OUString* pIncludeTable = aTableFilter.getConstArray();
for (sal_Int32 i=0; i<aTableFilter.getLength(); ++i, ++pIncludeTable)
{
if (xMeta.is())
qualifiedNameComponents(xMeta, pIncludeTable->getStr(), aCatalog, aSchema, aName);
else
aName = pIncludeTable->getStr();
SvLBoxEntry* pCatalog = m_aTablesList.GetEntryPosByName(aCatalog);
SvLBoxEntry* pSchema = m_aTablesList.GetEntryPosByName(aSchema,pCatalog);
SvLBoxEntry* pEntry = m_aTablesList.GetEntryPosByName(aName,pSchema);
if(pEntry)
m_aTablesList.SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
{
if ((1 == aTableFilter.getLength()) && aTableFilter[0].equalsAsciiL("%", 1))
{ // all tables visible
CheckAll(sal_True);
m_aIncludeAll.Check();
LINK(this, OTableSubscriptionPage, OnRadioButtonClicked).Call(&m_aIncludeAll);
}
else
{
m_aLastDetailedSelection = aTableFilter;
m_aIncludeSelected.Check();
LINK(this, OTableSubscriptionPage, OnRadioButtonClicked).Call(&m_aIncludeSelected);
}
m_aTablesList.CheckButtons();
m_bCheckedAll = sal_False;
}
m_aIncludeAllTables.Enable(0 != m_aTablesList.GetEntryCount());
if (!bValid)
{
if (m_pLastCheckedButton)
m_pLastCheckedButton->Check(sal_False);
m_pLastCheckedButton = NULL;
}
}
//------------------------------------------------------------------------
@ -1247,22 +1265,97 @@ void OTableSubscriptionPage::CheckAll( sal_Bool bCheck )
pEntry = m_aTablesList.GetModel()->Next(pEntry);
}
{
OLocalResourceAccess aStringResAccess(PAGE_TABLESUBSCRIPTION, RSC_TABPAGE);
m_aIncludeAllTables.SetText(bCheck ? ResId(STR_CHECK_NONE) : ResId(STR_CHECK_ALL));
}
m_bCheckedAll = bCheck;
}
//------------------------------------------------------------------------
sal_Bool OTableSubscriptionPage::FillItemSet( SfxItemSet& _rCoreAttrs )
int OTableSubscriptionPage::DeactivatePage(SfxItemSet* _pSet)
{
/////////////////////////////////////////////////////////////////////////
// create the output string which contains all the table names
sal_uInt16 nEntryCount = 0;
sal_uInt16 nChecked = 0;
int nResult = OGenericAdministrationPage::DeactivatePage(_pSet);
// dispose the connection, we don't need it anymore, so we're not wasting resources
Reference< XComponent > xComp(m_xCurrentConnection, UNO_QUERY);
if (xComp.is())
try { xComp->dispose(); } catch (RuntimeException&) { }
m_xCurrentConnection = NULL;
return nResult;
}
//------------------------------------------------------------------------
void OTableSubscriptionPage::ActivatePage(const SfxItemSet& _rSet)
{
DBG_ASSERT(!m_xCurrentConnection.is(), "OTableSubscriptionPage::ActivatePage: already have an active connection! ");
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
// get the current table list from the connection for the current settings
// the PropertyValues for the current dialog settings
Sequence< PropertyValue > aConnectionParams;
DBG_ASSERT(m_pAdminDialog, "OTableSubscriptionPage::ActivatePage : need a parent dialog doing the translation!");
if (m_pAdminDialog)
if (!m_pAdminDialog->getCurrentSettings(aConnectionParams))
{
OGenericAdministrationPage::ActivatePage(_rSet);
return;
}
// the current DSN
String sURL;
SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
if (bValid)
sURL = pUrlItem->GetValue();
// fill the table list with this connection information
SQLExceptionInfo aErrorInfo;
try
{
m_xCurrentConnection = m_aTablesList.UpdateTableList(sURL, aConnectionParams);
}
catch (SQLContext& e) { aErrorInfo = SQLExceptionInfo(e); }
catch (SQLWarning& e) { aErrorInfo = SQLExceptionInfo(e); }
catch (SQLException& e) { aErrorInfo = SQLExceptionInfo(e); }
if (aErrorInfo.isValid())
{
// establishing the connection failed. Show an error window and exit.
OSQLMessageBox(GetParent(), aErrorInfo, WB_OK | WB_DEF_OK, OSQLMessageBox::Error).Execute();
m_aTablesList.Enable(sal_False);
m_aTablesListLabel.Enable(sal_False);
m_aTablesList.Clear();
}
else
{
// in addition, we need some infos about the connection used
m_sCatalogSeparator = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); // (default)
m_bCatalogAtStart = sal_True; // (default)
try
{
Reference< XDatabaseMetaData > xMeta;
if (m_xCurrentConnection.is())
xMeta = m_xCurrentConnection->getMetaData();
if (xMeta.is())
{
m_sCatalogSeparator = xMeta->getCatalogSeparator();
m_bCatalogAtStart = xMeta->isCatalogAtStart();
}
}
catch(SQLException&)
{
DBG_ERROR("OTableSubscriptionPage::ActivatePage : could not retrieve the qualifier separator for the used connection !");
}
}
m_pLastCheckedButton = NULL;
OGenericAdministrationPage::ActivatePage(_rSet);
}
//------------------------------------------------------------------------
Sequence< ::rtl::OUString > OTableSubscriptionPage::collectDetailedSelection() const
{
Sequence< ::rtl::OUString > aTableFilter;
static const ::rtl::OUString sDot(RTL_CONSTASCII_USTRINGPARAM("."));
@ -1304,18 +1397,33 @@ sal_Bool OTableSubscriptionPage::FillItemSet( SfxItemSet& _rCoreAttrs )
aTableFilter[nOldLen] = sComposedName;
// reset the composed name
sComposedName = String();
nChecked++;
}
if(!m_aTablesList.GetModel()->HasChilds(pEntry))
nEntryCount++;
pEntry = m_aTablesList.GetModel()->Next(pEntry);
}
if (nChecked == nEntryCount)
aTableFilter.realloc(0);
// TODO : have no possibility to distinguish between "all" and "none"
return aTableFilter;
}
//------------------------------------------------------------------------
sal_Bool OTableSubscriptionPage::FillItemSet( SfxItemSet& _rCoreAttrs )
{
/////////////////////////////////////////////////////////////////////////
// create the output string which contains all the table names
Sequence< ::rtl::OUString > aTableFilter;
if (m_aIncludeAll.IsChecked())
{
aTableFilter.realloc(1);
aTableFilter[0] = ::rtl::OUString("%", 1, RTL_TEXTENCODING_ASCII_US);
}
else if (m_aIncludeNone.IsChecked())
{
// nothing to do: the sequence is already empty, which means "no tables"
}
else
{
aTableFilter = collectDetailedSelection();
}
//////////////////////////////////////////////////////////////////////
// put this string into the set
@ -1323,6 +1431,30 @@ sal_Bool OTableSubscriptionPage::FillItemSet( SfxItemSet& _rCoreAttrs )
return sal_True;
}
//------------------------------------------------------------------------
IMPL_LINK( OTableSubscriptionPage, OnRadioButtonClicked, Button*, pButton )
{
if (&m_aIncludeSelected == m_pLastCheckedButton)
m_aLastDetailedSelection = collectDetailedSelection();
m_pLastCheckedButton = static_cast<RadioButton*>(pButton);
if (m_aIncludeAll.IsChecked() || m_aIncludeNone.IsChecked())
{
m_aTablesList.Enable(sal_False);
CheckAll(m_aIncludeAll.IsChecked());
}
else
{
m_aTablesList.Enable(sal_True);
implCheckTables(m_aLastDetailedSelection);
}
// as the enable state has been changed, invalidate the control
m_aTablesList.Invalidate();
callModifiedHdl();
return 0L;
}
//------------------------------------------------------------------------
IMPL_LINK( OTableSubscriptionPage, AddAllClickHdl, PushButton*, pButton )
{
@ -1338,6 +1470,9 @@ IMPL_LINK( OTableSubscriptionPage, AddAllClickHdl, PushButton*, pButton )
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:04:12 fs
* initial checkin
*
*
* Revision 1.0 26.09.00 11:47:18 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: adminpages.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:04:22 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -142,6 +142,9 @@ protected:
is modified. The implementation just calls callModifiedHdl.
*/
DECL_LINK(OnControlModified, Control*);
/// may be used in SetXXXHdl calls to controls, is a link to <method>OnControlModified</method>
Link getControlModifiedLink() { return LINK(this, OGenericAdministrationPage, OnControlModified); }
};
//=========================================================================
@ -216,7 +219,7 @@ protected:
Edit* m_pUserName;
FixedText* m_pPasswordLabel;
Edit* m_pPassword;
CheckBox* m_pAskIfEmptyPwd;
CheckBox* m_pPasswordRequired;
FixedText* m_pOptionsLabel;
Edit* m_pOptions;
@ -238,7 +241,7 @@ protected:
virtual ~OCommonBehaviourTabPage();
private:
DECL_LINK(OnPasswordModified, Control*);
DECL_LINK(OnPasswordRequired, Control*);
};
//========================================================================
@ -300,6 +303,7 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& _rAttrSet );
private:
FixedLine m_aSeparator2;
FixedLine m_aSeparator1;
OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
@ -314,6 +318,7 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& _rAttrSet );
private:
FixedLine m_aSeparator2;
FixedLine m_aSeparator1;
OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
@ -359,30 +364,58 @@ private:
//========================================================================
//= OTableSubscriptionPage
//========================================================================
class ODbAdminDialog;
class OTableSubscriptionPage : public OGenericAdministrationPage
{
friend class ODbAdminDialog;
private:
RadioButton m_aIncludeAll;
RadioButton m_aIncludeNone;
RadioButton m_aIncludeSelected;
OTableTreeListBox m_aTablesList;
FixedText m_aTablesListLabel;
PushButton m_aIncludeAllTables;
sal_Bool m_bCheckedAll : 1;
sal_Bool m_bCatalogAtStart : 1;
::rtl::OUString m_sCatalogSeparator;
ODbAdminDialog* m_pAdminDialog; /** needed for translating an SfxItemSet into Sequence< PropertyValue >
(for building an XConnection)
*/
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
m_xCurrentConnection; /// valid as long as the page is active
::com::sun::star::uno::Sequence< ::rtl::OUString >
m_aLastDetailedSelection;
RadioButton* m_pLastCheckedButton;
public:
static SfxTabPage* Create( Window* _pParent, const SfxItemSet& _rAttrSet);
virtual BOOL FillItemSet(SfxItemSet& _rCoreAttrs);
virtual void ActivatePage(const SfxItemSet& _rSet);
virtual int DeactivatePage(SfxItemSet* _pSet);
void setServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB)
{ m_aTablesList.setServiceFactory(_rxORB); }
protected:
void SetAdminDialog(ODbAdminDialog* _pDialog) { m_pAdminDialog = _pDialog; }
private:
OTableSubscriptionPage( Window* pParent, const SfxItemSet& _rCoreAttrs );
~OTableSubscriptionPage();
/** check the tables in <member>m_aTablesList</member> according to <arg>_rTables</arg>
*/
void implCheckTables(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTables);
/** return the current selection in <member>m_aTablesList</member>
*/
::com::sun::star::uno::Sequence< ::rtl::OUString > collectDetailedSelection() const;
void CheckAll( BOOL bCheck=TRUE );
DECL_LINK( AddAllClickHdl, PushButton* );
// plausibility check
DECL_LINK( OnRadioButtonClicked, Button* );
virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
};
@ -396,6 +429,9 @@ private:
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:04:22 fs
* initial checkin
*
*
* Revision 1.0 26.09.00 11:46:15 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: dbadmin.cxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:04:31 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -89,9 +89,15 @@
#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif
#ifndef _SVTOOLS_LOGINDLG_HXX_
#include <svtools/logindlg.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_
#include <com/sun/star/uno/XNamingService.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
#include <com/sun/star/util/XFlushable.hpp>
#endif
#ifndef _DBASHARED_STRINGCONSTANTS_HRC_
#include "stringconstants.hrc"
#endif
@ -118,6 +124,7 @@ namespace dbaui
using namespace dbaccess;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::util;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
@ -142,10 +149,7 @@ ODbAdminDialog::ODbAdminDialog(Window* _pParent, SfxItemSet* _pItems, const Refe
SetViewAlign(WINDOWALIGN_LEFT);
// do some knittings
m_aSelector.m_aDatasourceList.SetSelectHdl(LINK(this, ODbAdminDialog, OnDatasourceSelected));
// concretize some items in our set which are independent of a concret selected datasource
// GetInputSetImpl()->Put(DbuTypeCollectionItem(DSID_TYPECOLLECTION, m_pCollection));
m_aSelector.setSelectHandler(LINK(this, ODbAdminDialog, OnDatasourceSelected));
// create the DatabaseContext service
DBG_ASSERT(m_xORB.is(), "ODbAdminDialog::ODbAdminDialog : need a service factory !");
@ -169,11 +173,7 @@ ODbAdminDialog::ODbAdminDialog(Window* _pParent, SfxItemSet* _pItems, const Refe
Sequence< ::rtl::OUString > aDatasources = m_xDatabaseContext->getElementNames();
const ::rtl::OUString* pDatasources = aDatasources.getConstArray();
for (sal_Int32 i=0; i<aDatasources.getLength(); ++i, ++pDatasources)
{
sal_Int16 nPos = m_aSelector.m_aDatasourceList.InsertEntry(*pDatasources);
m_aSelector.m_aDatasourceList.SetEntryData(nPos, reinterpret_cast<void*>(sal_False));
// the entry data is the modified flags
}
m_aSelector.insert(*pDatasources);
if (!aDatasources.getLength())
{
@ -195,16 +195,124 @@ ODbAdminDialog::~ODbAdminDialog()
}
//-------------------------------------------------------------------------
Sequence< PropertyValue > ODbAdminDialog::toDriverParams(const SfxItemSet& _rSet)
short ODbAdminDialog::Execute()
{
// TODO
return Sequence< PropertyValue >();
short nResult = SfxTabDialog::Execute();
// within it's dtor, the SfxTabDialog saves (amongst others) the currently selected tab page and
// reads it upon the next Execute (dependent on the resource id, which thus has to be globally unique,
// though our's isn't)
// As this is not wanted if e.g. the table subscription page is selected, we show the GeneralPage here
ShowPage(PAGE_GENERAL);
// clear the temporary SfxItemSets we created
m_aSelector.clearAllModified();
return nResult;
}
//-------------------------------------------------------------------------
void ODbAdminDialog::toDialogItems(const Sequence< PropertyValue >& _rProperties, SfxItemSet& _rOutSet)
sal_Bool ODbAdminDialog::getCurrentSettings(Sequence< PropertyValue >& _rDriverParam)
{
// TODO
DBG_ASSERT(GetExampleSet(), "ODbAdminDialog::getCurrentSettings : not to be called without an example set!");
if (!GetExampleSet())
return sal_False;
::std::vector< PropertyValue > aReturn;
// collecting this in a vector because it has a push_back, in opposite to sequences
// user: DSID_USER -> "user"
SFX_ITEMSET_GET(*GetExampleSet(), pUser, SfxStringItem, DSID_USER, sal_True);
if (pUser)
aReturn.push_back(
PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")), 0,
makeAny(::rtl::OUString(pUser->GetValue())), PropertyState_DIRECT_VALUE));
// password: DSID_PASSWORD -> "password"
SFX_ITEMSET_GET(*GetExampleSet(), pPassword, SfxStringItem, DSID_PASSWORD, sal_True);
String sPassword = pPassword ? pPassword->GetValue() : String();
SFX_ITEMSET_GET(*GetExampleSet(), pPasswordRequired, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
// if the set does not contain a password, but the item set says it requires one, ask the user
if ((!pPassword || !pPassword->GetValue().Len()) && (pPasswordRequired && pPasswordRequired->GetValue()))
{
SFX_ITEMSET_GET(*GetExampleSet(), pName, SfxStringItem, DSID_NAME, sal_True);
::svt::LoginDialog aDlg(this,
LF_NO_PATH | LF_NO_ACCOUNT | LF_NO_ERRORTEXT | LF_USERNAME_READONLY,
String(), NULL);
aDlg.SetName(pUser ? pUser->GetValue() : String());
aDlg.ClearPassword(); // this will give the password field the focus
String sLoginRequest(ModuleRes(STR_ENTER_CONNECTION_PASSWORD));
sLoginRequest.SearchAndReplaceAscii("$name$", pName ? pName->GetValue() : String()),
aDlg.SetLoginRequestText(sLoginRequest);
sal_uInt16 nResult = aDlg.Execute();
if (nResult != RET_OK)
return sal_False;
sPassword = aDlg.GetPassword();
if (aDlg.IsSavePassword())
pExampleSet->Put(SfxStringItem(DSID_PASSWORD, sPassword));
}
if (sPassword.Len())
aReturn.push_back(
PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")), 0,
makeAny(::rtl::OUString(sPassword)), PropertyState_DIRECT_VALUE));
// TODO: all the other stuff (charset etc.)
_rDriverParam = Sequence< PropertyValue >(aReturn.begin(), aReturn.size());
return sal_True;
}
//-------------------------------------------------------------------------
short ODbAdminDialog::Ok()
{
short nResult = SfxTabDialog::Ok();
if (RET_OK == nResult)
{
// save the settings for the currently selected data source
sal_Int32 nCurrentlySelected = m_aSelector.getSelected();
if (m_aSelector.isModified(nCurrentlySelected))
m_aSelector.update(nCurrentlySelected, *GetExampleSet());
// propagate all the settings made to the appropriate data source
for (sal_Int32 i=0; i<m_aSelector.getCount(); ++i)
{
// nothing to do if no modifications were done
if (m_aSelector.isModified(i))
{
String sDSName = m_aSelector.getOriginalName(i);
Reference< XPropertySet > xDatasource = getDatasource(sDSName);
if (xDatasource.is())
{
// put the remembered settings into the property set
translateProperties(*m_aSelector.getItems(i), xDatasource);
// flush the data source
Reference< XFlushable > xFlushDatasource(xDatasource, UNO_QUERY);
if (!xFlushDatasource.is())
{
DBG_ERROR("ODbAdminDialog::Ok: the datasource should be flushable!");
continue;
}
try
{
xFlushDatasource->flush();
}
catch(RuntimeException&)
{
DBG_ERROR("ODbAdminDialog::Ok: caught an exception whild flushing the data source's data!");
}
}
}
}
}
return nResult;
}
//-------------------------------------------------------------------------
@ -221,6 +329,7 @@ void ODbAdminDialog::PageCreated(USHORT _nId, SfxTabPage& _rPage)
break;
case PAGE_TABLESUBSCRIPTION:
static_cast<OTableSubscriptionPage&>(_rPage).setServiceFactory(m_xORB);
static_cast<OTableSubscriptionPage&>(_rPage).SetAdminDialog(this);
break;
}
@ -239,8 +348,9 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
_rppDefaults = new SfxPoolItem*[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1];
SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults
*pCounter++ = new SfxStringItem(DSID_NAME, String());
*pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, String());
*pCounter++ = new SfxStringItem(DSID_CONNECTURL, String());
*pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >());
*pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >(&::rtl::OUString("%", 1, RTL_TEXTENCODING_ASCII_US), 1));
*pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
*pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, sal_False);
*pCounter++ = new SfxBoolItem(DSID_READONLY, sal_False);
@ -248,7 +358,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
*pCounter++ = new SfxStringItem(DSID_PASSWORD, String());
*pCounter++ = new SfxStringItem(DSID_ADDITIONALOPTIONS, String());
*pCounter++ = new SfxStringItem(DSID_CHARSET, String());
*pCounter++ = new SfxBoolItem(DSID_ASKFOREMPTYPWD, sal_False);
*pCounter++ = new SfxBoolItem(DSID_PASSWORDREQUIRED, sal_False);
*pCounter++ = new SfxBoolItem(DSID_SHOWDELETEDROWS, sal_False);
*pCounter++ = new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, sal_False);
*pCounter++ = new SfxStringItem(DSID_JDBCDRIVERCLASS, String());
@ -282,6 +392,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp
{0,0},
{0,0},
{0,0},
{0,0},
};
_rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID,
@ -321,16 +432,25 @@ void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool,
//-------------------------------------------------------------------------
IMPL_LINK(ODbAdminDialog, OnDatasourceSelected, ListBox*, _pBox)
{
sal_Int16 nSelected = _pBox->GetSelectEntryPos();
sal_Bool bModified = reinterpret_cast<sal_Bool>(_pBox->GetEntryData(nSelected));
// first ask the current page if it is allowed to leave
if (!PrepareLeaveCurrentPage())
{ // the page did not allow us to leave -> restore the old selection
m_aSelector.select(m_sCurrentDatasource);
return 1L;
}
// if the entry is modified, we have to remove the modified marker to get the correct name
String sSelected = _pBox->GetEntry(nSelected);
// TODO: additionally, check if the name (which may have been modified by the user) is unique within the data source
// collection
// remember the settings for this data source
sal_Int32 nOldPos = m_aSelector.getPos(m_sCurrentDatasource);
if (m_aSelector.isModified(nOldPos))
m_aSelector.update(nOldPos, *GetExampleSet());
sal_Int32 nNewPos = m_aSelector.getSelected();
// switch the content of the pages
implSelectDatasource(m_aSelector.getOriginalName(nNewPos));
if (bModified)
implSelectDatasource(sSelected.Copy(0, sSelected.Len() - (sizeof(MODIFIED_MARKER) - 1)));
else
implSelectDatasource(sSelected);
return 0L;
}
@ -338,24 +458,13 @@ IMPL_LINK(ODbAdminDialog, OnDatasourceSelected, ListBox*, _pBox)
IMPL_LINK(ODbAdminDialog, OnDatasourceModifed, SfxTabPage*, _pTabPage)
{
// check if the currently selected entry is already marked as modified
sal_Int16 nSelected = m_aSelector.m_aDatasourceList.GetSelectEntryPos();
sal_Bool bModified = reinterpret_cast<sal_Bool>(m_aSelector.m_aDatasourceList.GetEntryData(nSelected));
if (bModified)
sal_Int16 nSelected = m_aSelector.getSelected();
if (m_aSelector.isModified(nSelected))
// yes -> nothing to do
return 0L;
// no -> append the modified marker to the text
// (unfortunally the ListBox does not have an operation such as SetEntryText ...)
m_aSelector.m_aDatasourceList.SetUpdateMode(sal_False);
String sText = m_aSelector.m_aDatasourceList.GetEntry(nSelected);
m_aSelector.m_aDatasourceList.RemoveEntry(nSelected);
sText.AppendAscii(MODIFIED_MARKER);
nSelected = m_aSelector.m_aDatasourceList.InsertEntry(sText, nSelected);
m_aSelector.m_aDatasourceList.SelectEntryPos (nSelected, sal_True);
m_aSelector.m_aDatasourceList.SetUpdateMode(sal_True);
// mark it as modified
m_aSelector.m_aDatasourceList.SetEntryData(nSelected, reinterpret_cast<void*>(sal_True));
m_aSelector.modified(nSelected, GetExampleSet() ? *GetExampleSet() : *GetInputSetImpl());
return 0L;
}
@ -402,29 +511,36 @@ IMPL_LINK(ODbAdminDialog, OnTypeSelected, OGeneralPage*, _pTabPage)
}
//-------------------------------------------------------------------------
void ODbAdminDialog::implSelectDatasource(const ::rtl::OUString& _rRegisteredName)
Reference< XPropertySet > ODbAdminDialog::getDatasource(const ::rtl::OUString& _rName)
{
DBG_ASSERT(m_xDatabaseContext.is(), "ODbAdminDialog::implSelectDatasource : have no database context!");
DBG_ASSERT(m_xDatabaseContext.is(), "ODbAdminDialog::getDatasource : have no database context!");
Reference< XPropertySet > xDatasource;
try
{
if (m_xDatabaseContext.is() && _rRegisteredName.getLength())
::cppu::extractInterface(xDatasource, m_xDatabaseContext->getByName(_rRegisteredName));
if (m_xDatabaseContext.is() && _rName.getLength())
::cppu::extractInterface(xDatasource, m_xDatabaseContext->getByName(_rName));
}
catch(NoSuchElementException&)
{
DBG_ERROR("ODbAdminDialog::implSelectDatasource : did not find the element with the given name!");
DBG_ERROR("ODbAdminDialog::getDatasource : did not find the element with the given name!");
}
catch(WrappedTargetException&)
{
DBG_ERROR("ODbAdminDialog::implSelectDatasource : caught a WrappedTargetException!");
DBG_ERROR("ODbAdminDialog::getDatasource : caught a WrappedTargetException!");
}
return xDatasource;
}
//-------------------------------------------------------------------------
void ODbAdminDialog::implSelectDatasource(const ::rtl::OUString& _rRegisteredName)
{
Reference< XPropertySet > xDatasource = getDatasource(_rRegisteredName);
if (!xDatasource.is())
{
m_aSelector.m_aDatasourceList.SelectEntryPos(m_aSelector.m_aDatasourceList.GetSelectEntryPos(), sal_False);
}
m_aSelector.select(m_aSelector.getSelected(), sal_False);
else
m_aSelector.m_aDatasourceList.SelectEntry(_rRegisteredName);
m_aSelector.select(_rRegisteredName);
m_sCurrentDatasource = _rRegisteredName;
// the selection is valid if and only if we have a datasource now
GetInputSetImpl()->Put(SfxBoolItem(DSID_INVALID_SELECTION, !xDatasource.is()));
@ -432,12 +548,10 @@ void ODbAdminDialog::implSelectDatasource(const ::rtl::OUString& _rRegisteredNam
// from "just set them to readonly")
// reset the pages
resetPages(xDatasource);
}
//-------------------------------------------------------------------------
void ODbAdminDialog::resetPages(const Reference< XPropertySet >& _rxDatasource)
{
// prevent flicker
SetUpdateMode(sal_False);
// remove all tab pages (except the general one)
// remove all current detail pages
while (m_aCurrentDetailPages.size())
@ -448,23 +562,11 @@ void ODbAdminDialog::resetPages(const Reference< XPropertySet >& _rxDatasource)
// remove the table/query tab pages
RemoveTabPage(PAGE_TABLESUBSCRIPTION);
// extract all relevant data from the property set
::rtl::OUString sNewConnectURL, sName;
try
{
if (_rxDatasource.is())
{
_rxDatasource->getPropertyValue(PROPERTY_URL) >>= sNewConnectURL;
_rxDatasource->getPropertyValue(PROPERTY_NAME) >>= sName;
}
}
catch(Exception&)
{
DBG_ERROR("ODbAdminDialog::toDialogItems : could not extract all the relevant datasource properties!");
}
// extract all relevant data from the property set of the data source
translateProperties(xDatasource, *GetInputSetImpl());
GetInputSetImpl()->Put(SfxStringItem(DSID_CONNECTURL, sNewConnectURL));
GetInputSetImpl()->Put(SfxStringItem(DSID_NAME, sName));
// fill in the remembered settings for the data source
m_aSelector.getSettings(m_aSelector.getSelected(), *GetInputSetImpl());
// propagate this set as our new input set and reset the example set
SetInputSet(GetInputSetImpl());
@ -477,6 +579,9 @@ void ODbAdminDialog::resetPages(const Reference< XPropertySet >& _rxDatasource)
AddTabPage(PAGE_TABLESUBSCRIPTION, String(ResId(STR_PAGETITLE_TABLESUBSCRIPTION)), OTableSubscriptionPage::Create, NULL);
}
ShowPage(PAGE_GENERAL);
SetUpdateMode(sal_True);
// propagate the new data to the general tab page the general tab page
SfxTabPage* pGeneralPage = GetTabPage(PAGE_GENERAL);
if (pGeneralPage)
@ -485,14 +590,86 @@ void ODbAdminDialog::resetPages(const Reference< XPropertySet >& _rxDatasource)
// dialog was displayed (probably from inside the ctor)
}
//-------------------------------------------------------------------------
void ODbAdminDialog::translateProperties(const Reference< XPropertySet >& _rxSource, SfxItemSet& _rDest)
{
::rtl::OUString sNewConnectURL, sName, sUid, sPwd;
Sequence< ::rtl::OUString > aTableFitler;
sal_Bool bPasswordRequired = sal_False;
sal_Bool bReadOnly = sal_True;
try
{
if (_rxSource.is())
{
_rxSource->getPropertyValue(PROPERTY_URL) >>= sNewConnectURL;
_rxSource->getPropertyValue(PROPERTY_NAME) >>= sName;
_rxSource->getPropertyValue(PROPERTY_USER) >>= sUid;
_rxSource->getPropertyValue(PROPERTY_PASSWORD) >>= sPwd;
_rxSource->getPropertyValue(PROPERTY_TABLEFILTER) >>= aTableFitler;
_rxSource->getPropertyValue(PROPERTY_ISPASSWORDREQUIRED) >>= bPasswordRequired;
_rxSource->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly;
}
}
catch(Exception&)
{
DBG_ERROR("ODbAdminDialog::translateProperties : could not extract all the relevant datasource properties!");
}
_rDest.Put(SfxStringItem(DSID_CONNECTURL, sNewConnectURL));
_rDest.Put(SfxStringItem(DSID_NAME, sName));
_rDest.Put(SfxStringItem(DSID_USER, sUid));
_rDest.Put(SfxStringItem(DSID_PASSWORD, sPwd));
_rDest.Put(OStringListItem(DSID_TABLEFILTER, aTableFitler));
_rDest.Put(SfxBoolItem(DSID_PASSWORDREQUIRED, bPasswordRequired));
_rDest.Put(SfxBoolItem(DSID_READONLY, bReadOnly));
}
//-------------------------------------------------------------------------
void ODbAdminDialog::translateProperties(const SfxItemSet& _rSource, const Reference< XPropertySet >& _rxDest)
{
DBG_ASSERT(_rxDest.is(), "ODbAdminDialog::translateProperties : invalid property set!");
if (!_rxDest.is())
return;
// get the items
SFX_ITEMSET_GET(_rSource, pConnectURL, SfxStringItem, DSID_CONNECTURL, sal_True);
SFX_ITEMSET_GET(_rSource, pName, SfxStringItem, DSID_NAME, sal_True);
SFX_ITEMSET_GET(_rSource, pUser, SfxStringItem, DSID_USER, sal_True);
SFX_ITEMSET_GET(_rSource, pPassword, SfxStringItem, DSID_PASSWORD, sal_True);
SFX_ITEMSET_GET(_rSource, pTableFilter, OStringListItem, DSID_TABLEFILTER, sal_True);
SFX_ITEMSET_GET(_rSource, pPasswordRequired, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
// set the values
try
{
if (pConnectURL)
_rxDest->setPropertyValue(PROPERTY_URL, makeAny(::rtl::OUString(pConnectURL->GetValue().GetBuffer())));
if (pUser)
_rxDest->setPropertyValue(PROPERTY_USER, makeAny(::rtl::OUString(pUser->GetValue().GetBuffer())));
if (pPassword)
_rxDest->setPropertyValue(PROPERTY_PASSWORD, makeAny(::rtl::OUString(pPassword->GetValue().GetBuffer())));
if (pTableFilter)
_rxDest->setPropertyValue(PROPERTY_TABLEFILTER, makeAny(pTableFilter->getList()));
if (pPasswordRequired)
_rxDest->setPropertyValue(PROPERTY_ISPASSWORDREQUIRED, makeAny(pPasswordRequired->GetValue()));
// if (pName)
// _rxDest->setPropertyValue(PROPERTY_NAME, makeAny(::rtl::OUString(pName->GetValue().GetBuffer())));
// TODO: a changed name requires an removeByName and insertByName
}
catch(Exception&)
{
DBG_ERROR("ODbAdminDialog::translateProperties : could not set all the relevant datasource properties!");
}
}
//=========================================================================
//= ODatasourceSelector
//=========================================================================
//-------------------------------------------------------------------------
ODatasourceSelector::ODatasourceSelector(Window* _pParent, const ResId& _rResId)
:Window(_pParent, _rResId)
,m_aBorderWindow (this, ResId(WND_SELECTORBORDER))
,m_aTitle (this, ResId(FT_SELECTOR_TITLE))
,m_aNewDatasource (this, ResId(PB_NEW_DATASOURCE))
,m_aDatasourceList (this, ResId(LB_DATASOURCES))
{
FreeResource();
@ -500,7 +677,6 @@ ODatasourceSelector::ODatasourceSelector(Window* _pParent, const ResId& _rResId)
m_aDatasourceList.SetZOrder(NULL, WINDOW_ZORDER_FIRST);
m_aDatasourceList.EnableClipSiblings(sal_True);
m_aBorderWindow.EnableClipSiblings(sal_True);
}
//-------------------------------------------------------------------------
@ -508,23 +684,115 @@ ODatasourceSelector::~ODatasourceSelector()
{
}
//-------------------------------------------------------------------------
sal_Bool ODatasourceSelector::isModified(sal_Int32 _nPos) const
{
return NULL != m_aDatasourceList.GetEntryData(_nPos);
}
//-------------------------------------------------------------------------
void ODatasourceSelector::clearAllModified()
{
// delete all SfxItemSets which are bound to the entries
for (sal_Int32 nLoop = 0; nLoop < m_aDatasourceList.GetEntryCount(); ++nLoop)
{
SfxItemSet* pItems = reinterpret_cast<SfxItemSet*>(m_aDatasourceList.GetEntryData(nLoop));
if (pItems)
{
delete pItems;
m_aDatasourceList.SetEntryData(nLoop, reinterpret_cast<SfxItemSet*>(NULL));
}
}
}
//-------------------------------------------------------------------------
void ODatasourceSelector::modified(sal_Int32 _nPos, const SfxItemSet& _rSet)
{
SfxItemSet* pItems = reinterpret_cast<SfxItemSet*>(m_aDatasourceList.GetEntryData(_nPos));
if (pItems)
pItems->Put(_rSet);
else
{
pItems = new SfxItemSet(_rSet);
// the entry was not modified before. Add the modified marker
// (unfortunately the ListBox does not have an operation such as SetEntryText ...)
m_aDatasourceList.SetUpdateMode(sal_False);
String sText = m_aDatasourceList.GetEntry(_nPos);
// remember the original name
pItems->Put(SfxStringItem(DSID_ORIGINALNAME, sText));
m_aDatasourceList.RemoveEntry(_nPos);
sText.AppendAscii(MODIFIED_MARKER);
_nPos = m_aDatasourceList.InsertEntry(sText, _nPos);
m_aDatasourceList.SelectEntryPos (_nPos, sal_True);
m_aDatasourceList.SetUpdateMode(sal_True);
}
m_aDatasourceList.SetEntryData(_nPos, reinterpret_cast<void*>(pItems));
}
//-------------------------------------------------------------------------
void ODatasourceSelector::getSettings(sal_Int32 _nPos, SfxItemSet& _rSet)
{
SfxItemSet* pItems = reinterpret_cast<SfxItemSet*>(m_aDatasourceList.GetEntryData(_nPos));
if (pItems)
_rSet.Put(*pItems);
}
//-------------------------------------------------------------------------
sal_Int32 ODatasourceSelector::getPos(const String& _rName) const
{
sal_uInt16 nPos = m_aDatasourceList.GetEntryPos(_rName);
if ((sal_uInt16)-1 == nPos)
nPos = m_aDatasourceList.GetEntryPos(String(_rName).AppendAscii(MODIFIED_MARKER));
if ((sal_uInt16)-1 == nPos)
nPos = -1;
return nPos;
}
//-------------------------------------------------------------------------
String ODatasourceSelector::getOriginalName(sal_Int32 _nPos) const
{
// calc the name of the newly selected data source (we may have to cut the modified marker)
String sText = m_aDatasourceList.GetEntry(_nPos);
if (!isModified(_nPos))
return sText;
const SfxItemSet* pItems = getItems(_nPos);
DBG_ASSERT(pItems, "ODatasourceSelector::getOriginalName: not modified, but no items?");
SFX_ITEMSET_GET(*pItems, pOriginal, SfxStringItem, DSID_ORIGINALNAME, sal_True);
DBG_ASSERT(pOriginal, "ODatasourceSelector::getOriginalName: a modified set should always have an OriginalName entry!");
return pOriginal->GetValue();
}
//-------------------------------------------------------------------------
const SfxItemSet* ODatasourceSelector::getItems(sal_Int32 _nPos) const
{
return reinterpret_cast<const SfxItemSet*>(m_aDatasourceList.GetEntryData(_nPos));
}
//-------------------------------------------------------------------------
sal_Int32 ODatasourceSelector::insert(const String& _rName)
{
sal_Int16 nPos = m_aDatasourceList.InsertEntry(_rName);
m_aDatasourceList.SetEntryData(nPos, reinterpret_cast<void*>(NULL));
return nPos;
}
//-------------------------------------------------------------------------
void ODatasourceSelector::Resize()
{
Window::Resize();
// set the border window to the same size weself have
Size aSize = GetSizePixel();
m_aBorderWindow.SetSizePixel(aSize);
// resize the text field
sal_Int32 nTextHeight = LogicToPixel(Size(0, GetTextHeight())).Height();
nTextHeight += 4; // leave a margin
m_aTitle.SetPosPixel(Point(2, 2 + 2));
m_aTitle.SetSizePixel(Size(aSize.Width() - 4, nTextHeight));
// adjust the width of the button
sal_Int32 nButtonHeight = m_aNewDatasource.GetSizePixel().Height();
m_aNewDatasource.SetSizePixel(Size(aSize.Width(), nButtonHeight));
// resize the listbox accordingly
m_aDatasourceList.SetPosPixel(Point(2, 4 + nTextHeight));
m_aDatasourceList.SetSizePixel(Size(aSize.Width() - 4, aSize.Height() - 4 - nTextHeight));
// adjust width/height of the listbox
m_aDatasourceList.SetPosPixel(Point(0, nButtonHeight));
m_aDatasourceList.SetSizePixel(Size(aSize.Width(), aSize.Height() - nButtonHeight));
}
//.........................................................................
@ -534,6 +802,9 @@ void ODatasourceSelector::Resize()
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:04:31 fs
* initial checkin
*
*
* Revision 1.0 20.09.00 10:55:58 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: dbadmin.hrc,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:04:46 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -67,19 +67,18 @@
#define FT_DATATYPE 1
#define FT_CONNECTURL 2
#define FT_SELECTOR_TITLE 3
#define FT_DATASOURCENAME 4
#define FT_USERNAME 5
#define FT_PASSWORD 6
#define FT_OPTIONS 7
#define FT_CHARSET 8
#define FT_JDBCDRIVERCLASS 9
#define FT_FIELDSEPARATOR 10
#define FT_TEXTSEPARATOR 11
#define FT_DECIMALSEPARATOR 12
#define FT_THOUSANDSSEPARATOR 13
#define FT_EXTENSION 14
#define FT_TABLESUBSCRIPTION 15
#define FT_DATASOURCENAME 3
#define FT_USERNAME 4
#define FT_PASSWORD 5
#define FT_OPTIONS 6
#define FT_CHARSET 7
#define FT_JDBCDRIVERCLASS 8
#define FT_FIELDSEPARATOR 9
#define FT_TEXTSEPARATOR 10
#define FT_DECIMALSEPARATOR 11
#define FT_THOUSANDSSEPARATOR 12
#define FT_EXTENSION 13
#define FT_TABLESUBSCRIPTION 14
#define LB_DATATYPE 1
#define LB_DATASOURCES 2
@ -95,16 +94,18 @@
#define PB_BROWSECONNECTION 1
#define PB_INDICIES 2
#define PB_ADDALLTABLES 3
#define PB_NEW_DATASOURCE 4
#define GB_CONNECTION 1
#define GB_DBASE_MAIN 2
#define CB_ASK_WHEN_EMPTY_PWD 1
#define CB_PASSWORD_REQUIRED 1
#define CB_SHOWDELETEDROWS 2
#define CB_ALLOWLONGNAMES 3
#define CB_HEADER 4
#define FL_SEPARATOR1 1
#define FL_SEPARATOR2 2
#define CM_FIELDSEPARATOR 1
#define CM_TEXTSEPARATOR 2
@ -117,6 +118,10 @@
#define CTL_TABLESUBSCRIPTION 1
#define RB_INCLUDEALL 1
#define RB_INCLUDENONE 2
#define RB_INCLUDESPECIFIC 3
//========================================================================
// string ids (relative to other resources, that's why not necessarily unique)
@ -132,14 +137,15 @@
#define STR_DELIMITER_MISSING 10
#define STR_DELIMITER_MUST_DIFFER 11
#define STR_NO_WILDCARDS 12
#define STR_CHECK_ALL 13
#define STR_CHECK_NONE 14
#endif // _DBAUI_DBADMIN_HRC_
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:04:46 fs
* initial checkin
*
*
* Revision 1.0 20.09.00 11:42:05 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: dbadmin.src,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:05:05 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -79,7 +79,7 @@ TabDialog DLG_DATABASE_ADMINISTRATION
Window WND_DATASOURCESELECTOR
{
Pos = MAP_APPFONT ( 0, 0 ) ;
Size = MAP_APPFONT ( 80, 200 ) ;
Size = MAP_APPFONT ( 60, 200 ) ;
ClipChildren = TRUE;
// the following window is just to have a border. In a tab dialog, we can't use a window with border
@ -87,23 +87,26 @@ TabDialog DLG_DATABASE_ADMINISTRATION
Window WND_SELECTORBORDER
{
Pos = MAP_APPFONT ( 0, 0 ) ;
Size = MAP_APPFONT ( 80, 200 ) ;
Size = MAP_APPFONT ( 60, 200 ) ;
Border = TRUE;
};
FixedText FT_SELECTOR_TITLE
PushButton PB_NEW_DATASOURCE
{
Pos = MAP_APPFONT ( 2, 2 ) ;
Size = MAP_APPFONT ( 76, 20 ) ;
Center = TRUE;
Pos = MAP_APPFONT ( 0, 0 ) ;
Size = MAP_APPFONT ( 56, 14 ) ;
Border = TRUE;
SVLook = TRUE;
Text = "Datenquellen";
Text [ english ] = "Data sources";
Text = "Neue Datenquelle";
Text [ english ] = "New data source";
Text [ english_us ] = "New data source";
};
ListBox LB_DATASOURCES
{
Border = TRUE;
SVLook = TRUE;
Pos = MAP_APPFONT ( 2, 22 ) ;
Size = MAP_APPFONT ( 76, 196 ) ;
Size = MAP_APPFONT ( 56, 196 ) ;
};
};
@ -687,7 +690,7 @@ TabPage PAGE_JDBC
TabStop = TRUE ;
PassWord = TRUE ;
};
CheckBox CB_ASK_WHEN_EMPTY_PWD
CheckBox CB_PASSWORD_REQUIRED
{
Pos = MAP_APPFONT ( 90 , 66 ) ;
Size = MAP_APPFONT ( 105 , 10 ) ;
@ -799,10 +802,23 @@ TabPage PAGE_ODBC
Size = MAP_APPFONT ( 105 , 12 ) ;
TabStop = TRUE ;
};
FixedLine FL_SEPARATOR2
{
Pos = MAP_APPFONT ( 6 , 21 ) ;
Size = MAP_APPFONT ( 248 , 1 ) ;
};
CheckBox CB_PASSWORD_REQUIRED
{
Pos = MAP_APPFONT ( 6 , 27 ) ;
Size = MAP_APPFONT ( 105 , 10 ) ;
Text = "Passwort erforderlich";
Text [ english ] = "Password required";
Text [ english_us ] = "Password required";
};
FixedText FT_PASSWORD
{
Pos = MAP_APPFONT ( 6 , 22 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Pos = MAP_APPFONT ( 12 , 41 ) ;
Size = MAP_APPFONT ( 94 , 10 ) ;
Text = "~Passwort" ;
Text [ ENGLISH ] = "~Password" ;
Text [ NORWEGIAN ] = "~Passord" ;
@ -830,45 +846,19 @@ TabPage PAGE_ODBC
Edit ET_PASSWORD
{
Border = TRUE ;
Pos = MAP_APPFONT ( 110 , 21 ) ;
Pos = MAP_APPFONT ( 110 , 40 ) ;
Size = MAP_APPFONT ( 105 , 12 ) ;
TabStop = TRUE ;
PassWord = TRUE ;
};
CheckBox CB_ASK_WHEN_EMPTY_PWD
{
Pos = MAP_APPFONT ( 110 , 36 ) ;
Size = MAP_APPFONT ( 105 , 10 ) ;
Text = "beim Öffnen ~fragen";
Text [ ENGLISH ] = "beim Öffnen ~fragen";
Text[ italian ] = "Chiedi all'apertura";
Text[ portuguese_brazilian ] = "beim Öffnen ~fragen";
Text[ portuguese ] = "~Perguntar ao abrir";
Text[ danish ] = "spørg ved åbning";
Text[ french ] = "~Requête à l'ouverture";
Text[ swedish ] = "~fråga vid öppnandet";
Text[ dutch ] = "bij openen ~vragen";
Text[ spanish ] = "preguntar al ~abrir";
Text[ english_us ] = "Request when opened";
Text[ chinese_simplified ] = "ÔÚ´ò¿ªÊ±Ñ¯ÎÊ";
Text[ russian ] = "Çàïðàøèâàòü ïðè îòêðûâàíèè";
Text[ polish ] = "Pytaj przy otwieraniu";
Text[ japanese ] = "ŠJ­<E2809A>ÛÉ<E2809A>qËé";
Text[ chinese_traditional ] = "¦b¶}±Ò®É¸ß°Ý";
Text[ arabic ] = "ÇáÇÓÊÝÓÇÑ ÚäÏ ÇáÝÊÍ";
Text[ greek ] = "Åñþôçóç ìå ôï Üíïéãìá";
Text[ korean ] = "¿­ ¶§ ¿äû";
Text[ turkish ] = "Açarken sor";
Text[ language_user1 ] = " ";
};
FixedLine FL_SEPARATOR1
{
Pos = MAP_APPFONT ( 6 , 49 ) ;
Pos = MAP_APPFONT ( 6 , 55 ) ;
Size = MAP_APPFONT ( 248 , 1 ) ;
};
FixedText FT_OPTIONS
{
Pos = MAP_APPFONT ( 6 , 55 ) ;
Pos = MAP_APPFONT ( 6 , 61 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text = "~Treibereinstellungen" ;
Text [ ENGLISH ] = "ODBC ~options" ;
@ -897,13 +887,13 @@ TabPage PAGE_ODBC
Edit ET_OPTIONS
{
Border = TRUE ;
Pos = MAP_APPFONT ( 110 , 54 ) ;
Pos = MAP_APPFONT ( 110 , 60 ) ;
Size = MAP_APPFONT ( 105 , 12 ) ;
TabStop = TRUE ;
};
FixedText FT_CHARSET
{
Pos = MAP_APPFONT ( 6 , 70 ) ;
Pos = MAP_APPFONT ( 6 , 76 ) ;
Size = MAP_APPFONT ( 100 , 10 ) ;
Text = "~Zeichensatz" ;
Text [ ENGLISH ] = "~Character set" ;
@ -932,7 +922,7 @@ TabPage PAGE_ODBC
ListBox LB_CHARSET
{
Border = TRUE ;
Pos = MAP_APPFONT ( 110 , 69 ) ;
Pos = MAP_APPFONT ( 110 , 75 ) ;
Size = MAP_APPFONT ( 105 , 60 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
@ -1355,67 +1345,39 @@ TabPage PAGE_TABLESUBSCRIPTION
Text[ turkish ] = "Görüntülenecek tablolarý seçin:";
Text[ language_user1 ] = " ";
};
Control CTL_TABLESUBSCRIPTION
RadioButton RB_INCLUDEALL
{
Pos = MAP_APPFONT ( 6 , 20 ) ;
Size = MAP_APPFONT ( 192 , 109 ) ;
Size = MAP_APPFONT ( 60 , 12 ) ;
Group = TRUE;
Text = "~Alle";
Text [ english ] = "~All";
Text [ english_us ] = "~All";
};
RadioButton RB_INCLUDENONE
{
Pos = MAP_APPFONT ( 6 , 35 ) ;
Size = MAP_APPFONT ( 60 , 12 ) ;
Text = "~Keine";
Text [ english ] = "~None";
Text [ english_us ] = "~None";
};
RadioButton RB_INCLUDESPECIFIC
{
Pos = MAP_APPFONT ( 6 , 50 ) ;
Size = MAP_APPFONT ( 60 , 12 ) ;
Text = "Aus~wahl";
Text [ english ] = "~Selection";
Text [ english_us ] = "~Selection";
};
Control CTL_TABLESUBSCRIPTION
{
Group = TRUE;
Pos = MAP_APPFONT ( 69 , 20 ) ;
Size = MAP_APPFONT ( 185 , 109 ) ;
Border = TRUE ;
TabStop = TRUE ;
};
PushButton PB_ADDALLTABLES
{
TabStop = TRUE ;
Pos = MAP_APPFONT ( 204 , 20 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
String STR_CHECK_ALL
{
Text = "~Alle" ;
Text [ English ] = "All" ;
Text [ portuguese ] = "~Todas" ;
Text [ english_us ] = "~All" ;
Text [ portuguese_brazilian ] = "Alle" ;
Text [ swedish ] = "~Alla" ;
Text [ danish ] = "Alle" ;
Text [ italian ] = "Tutte" ;
Text [ spanish ] = "To~das" ;
Text [ french ] = "Toutes" ;
Text [ dutch ] = "~Alle" ;
Text[ chinese_simplified ] = "È«²¿(~A)";
Text[ russian ] = "Âñå";
Text[ polish ] = "Wszystkie";
Text[ japanese ] = "‚·‚ׂÄ(~A)";
Text[ chinese_traditional ] = "¥þ³¡(~A)";
Text[ arabic ] = "Çáßá";
Text[ greek ] = "¼ëá";
Text[ korean ] = "Àüü(~A)";
Text[ turkish ] = "Tümü";
Text[ language_user1 ] = " ";
};
String STR_CHECK_NONE
{
Text = "~Keine" ;
Text [ English ] = "None" ;
Text [ portuguese ] = "~Nenhuma" ;
Text [ english_us ] = "~None" ;
Text [ portuguese_brazilian ] = "Keine" ;
Text [ swedish ] = "In~ga" ;
Text [ danish ] = "Ingen" ;
Text [ italian ] = "Nessuna" ;
Text [ spanish ] = "~Ninguna" ;
Text [ french ] = "Aucune" ;
Text [ dutch ] = "~Geen" ;
Text[ chinese_simplified ] = "ÎÞ(~N)";
Text[ russian ] = "Íåò";
Text[ polish ] = "Brak";
Text[ japanese ] = "‚È‚µ(~N)";
Text[ chinese_traditional ] = "µL(~N)";
Text[ arabic ] = "ÈÏæä";
Text[ greek ] = "ÊáíÝíá";
Text[ korean ] = "¾øÀ½(~N)";
Text[ turkish ] = "Hiçbiri";
Text[ language_user1 ] = " ";
};
};
@ -1426,9 +1388,19 @@ WarningBox ERR_NOREGISTEREDDATASOURCES
Message [ english_us ] = "Currently, there are no registered data sources.";
};
String STR_ENTER_CONNECTION_PASSWORD
{
Text = "Die Verbindung zur Datenquelle \"$name$\" erfordert die Eingabe eines Passwortes.";
Text [ english ] = "Connecting to data source \"$name$\" requires you to enter a password.";
Text [ english_us ] = "Connecting to data source \"$name$\" requires you to enter a password.";
};
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:05:05 fs
* initial checkin
*
*
* Revision 1.0 20.09.00 10:58:47 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: dsitems.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:05:55 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -65,26 +65,27 @@
//========================================================================
//= item ids for the data source administration dialog
#define DSID_NAME 1
#define DSID_CONNECTURL 2
#define DSID_TABLEFILTER 3
#define DSID_TYPECOLLECTION 4
#define DSID_INVALID_SELECTION 5
#define DSID_READONLY 6
#define DSID_USER 7
#define DSID_PASSWORD 8
#define DSID_ADDITIONALOPTIONS 9
#define DSID_CHARSET 10
#define DSID_ASKFOREMPTYPWD 11
#define DSID_SHOWDELETEDROWS 12
#define DSID_ALLOWLONGTABLENAMES 13
#define DSID_JDBCDRIVERCLASS 14
#define DSID_FIELDDELIMITER 15
#define DSID_TEXTDELIMITER 16
#define DSID_DECIMALDELIMITER 17
#define DSID_THOUSANDSDELIMITER 18
#define DSID_TEXTFILEEXTENSION 19
#define DSID_TEXTFILEHEADER 20
#define DSID_NAME 1 // name of a data source, SfxStringItem
#define DSID_ORIGINALNAME 2 // orginal name, internal, SfxStringItem
#define DSID_CONNECTURL 3 // connection URL, SfxStringItem
#define DSID_TABLEFILTER 4 // table filter, OStringListItem
#define DSID_TYPECOLLECTION 5 // collection of data source types, ODsnTypeCollection
#define DSID_INVALID_SELECTION 6 // is the selection (thus the set data) invalid?, SfxBoolItem
#define DSID_READONLY 7 // is the selection (thus the set data) readonly?, SfxBoolItem
#define DSID_USER 8 // the user name used for logon, SfxStringItem
#define DSID_PASSWORD 9 // the password used for logon, SfxStringItem
#define DSID_ADDITIONALOPTIONS 10 // additional options used for connecting, SfxStringItem
#define DSID_CHARSET 11 // character set to use, SfxStringItem by now
#define DSID_PASSWORDREQUIRED 12 // is the password required to connect?, SfxBoolItem
#define DSID_SHOWDELETEDROWS 13 // show deleted rows?, SfxBoolItem
#define DSID_ALLOWLONGTABLENAMES 14 // allow tables names longer than 8.3?, SfxBoolItem
#define DSID_JDBCDRIVERCLASS 15 // JDBC driver class, SfxStringItem
#define DSID_FIELDDELIMITER 16 // field delimiter, SfxUInt16Item
#define DSID_TEXTDELIMITER 17 // text delimiter, SfxUInt16Item
#define DSID_DECIMALDELIMITER 18 // decimal delimiter, SfxUInt16Item
#define DSID_THOUSANDSDELIMITER 19 // thousands delimiter, SfxUInt16Item
#define DSID_TEXTFILEEXTENSION 20 // extension for text files, SfxStringItem
#define DSID_TEXTFILEHEADER 21 // the text file contains a header?, SfxBoolItem
//========================================================================
//= item range. Adjust this if you introduce new items above
@ -97,6 +98,9 @@
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:05:55 fs
* initial checkin
*
*
* Revision 1.0 22.09.00 08:10:45 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
# $Revision: 1.2 $
#
# last change: $Author: fs $ $Date: 2000-10-05 10:06:31 $
# last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@ -84,9 +84,9 @@ SRCFILES = \
# ... object files ............................
SLOFILES= \
$(SLO)$/dbadmin.obj \
$(SLO)$/adminpages.obj \
$(SLO)$/genericunodialog.obj \
$(SLO)$/dbadmin.obj \
$(SLO)$/unoadmin.obj \
$(SLO)$/unosqlmessage.obj \
$(SLO)$/sqlmessage.obj \
@ -100,6 +100,9 @@ SLOFILES= \
#########################################################################
# history:
# $Log: not supported by cvs2svn $
# Revision 1.1 2000/10/05 10:06:31 fs
# initial checkin
#
#
# Revision 1.0 20.09.00 10:58:55 fs
########################################################################/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: sqlmessage.cxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:06:44 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -163,9 +163,9 @@ OExceptionChainDialog::OExceptionChainDialog(Window* pParent, const ::com::sun::
DBG_ASSERT(aInfo.isValid(), "OExceptionChainDialog::OExceptionChainDialog : invalid chain start !");
SQLExceptionIteratorHelper aIter(( const ::com::sun::star::sdbc::SQLException*)aInfo);
Image aErrorImage(BMP_EXCEPTION_ERROR),
aWarningImage(BMP_EXCEPTION_WARNING),
m_aInfoImage(BMP_EXCEPTION_INFO);
Image aErrorImage(ModuleRes(BMP_EXCEPTION_ERROR)),
aWarningImage(ModuleRes(BMP_EXCEPTION_WARNING)),
m_aInfoImage(ModuleRes(BMP_EXCEPTION_INFO));
while (aIter.hasMoreElements())
{
@ -193,7 +193,7 @@ OExceptionChainDialog::OExceptionChainDialog(Window* pParent, const ::com::sun::
{
UniString sTitle(sErrorCodeLabel);
sTitle.AppendAscii(" : ");
sTitle += pUserData->ErrorCode;
sTitle += String::CreateFromInt32(pUserData->ErrorCode);
SvLBoxEntry* pErrorCodeEntry = m_aExceptionList.InsertEntry(sTitle, aErrorImage, aErrorImage, pListEntry);
pErrorCodeEntry->SetUserData(pUserData);
m_aExceptionList.Expand(pListEntry);
@ -508,6 +508,7 @@ OSQLMessageBox::OSQLMessageBox(Window* _pParent, const SQLExceptionInfo& _rExcep
,m_aTitle(this,WB_WORDBREAK | WB_LEFT)
,m_aMessage(this,WB_WORDBREAK | WB_LEFT)
,m_pInfoButton(NULL)
,m_aNextChainElement(_rException.get())
{
Construct(_rException, _nStyle, _eImage);
}
@ -546,6 +547,9 @@ IMPL_LINK( OSQLMessageBox, ButtonClickHdl, Button *, pButton )
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:06:44 fs
* initial checkin
*
*
* Revision 1.0 02.10.00 12:37:20 fs
************************************************************************/

View file

@ -2,9 +2,9 @@
*
* $RCSfile: sqlmessage.src,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: fs $ $Date: 2000-10-05 10:07:13 $
* last change: $Author: fs $ $Date: 2000-10-09 12:39:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -163,43 +163,6 @@ ModalDialog DLG_SQLMESSAGE
Text[ korean ] = "ÅؽºÆ®";
Text[ turkish ] = "Metin";
Text[ language_user1 ] = " ";
String STR_EXCEPTION_ERROR
{
Text = "Fehler";
Text [ english ] = "Error";
Text [ english_us ] = "Error";
};
String STR_EXCEPTION_WARNING
{
Text = "Warnung";
Text [ english ] = "Warning";
Text [ english_us ] = "Warning";
};
String STR_EXCEPTION_INFO
{
Text = "Information";
Text [ english ] = "Information";
Text [ english_us ] = "Information";
};
String STR_EXCEPTION_DETAILS
{
Text = "Details";
Text [ english ] = "Details";
Text [ english_us ] = "Details";
};
String STR_EXCEPTION_STATUS
{
Text = "SQL-Status";
Text [ english ] = "SQL State";
Text [ english_us ] = "SQL State";
};
String STR_EXCEPTION_ERRORCODE
{
Text = "Fehler-Code";
Text [ english ] = "Error code";
Text [ english_us ] = "Error code";
};
};
ModalDialog DLG_SQLEXCEPTIONCHAIN
@ -310,12 +273,52 @@ ModalDialog DLG_SQLEXCEPTIONCHAIN
TabStop = TRUE ;
DefButton = TRUE ;
};
String STR_EXCEPTION_ERROR
{
Text = "Fehler";
Text [ english ] = "Error";
Text [ english_us ] = "Error";
};
String STR_EXCEPTION_WARNING
{
Text = "Warnung";
Text [ english ] = "Warning";
Text [ english_us ] = "Warning";
};
String STR_EXCEPTION_INFO
{
Text = "Information";
Text [ english ] = "Information";
Text [ english_us ] = "Information";
};
String STR_EXCEPTION_DETAILS
{
Text = "Details";
Text [ english ] = "Details";
Text [ english_us ] = "Details";
};
String STR_EXCEPTION_STATUS
{
Text = "SQL-Status";
Text [ english ] = "SQL State";
Text [ english_us ] = "SQL State";
};
String STR_EXCEPTION_ERRORCODE
{
Text = "Fehler-Code";
Text [ english ] = "Error code";
Text [ english_us ] = "Error code";
};
};
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.1 2000/10/05 10:07:13 fs
* initial checkin
*
*
* Revision 1.0 02.10.00 12:43:18 fs
************************************************************************/