summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/ui/querydesign/JoinController.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx44
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx105
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx428
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx7
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx21
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx135
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowListBox.cxx139
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowTitle.cxx6
9 files changed, 504 insertions, 389 deletions
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx
index 0779bac7edba..74a5c02e31a0 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JoinController.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: fs $ $Date: 2001-06-15 09:43:49 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -278,7 +278,7 @@ void OJoinController::Load(const Reference< XObjectInputStream>& _rxIn)
// -----------------------------------------------------------------------------
void SAL_CALL OJoinController::disposing( const EventObject& Source ) throw(RuntimeException)
{
- if(Reference<XConnection>(Source.Source,UNO_QUERY) == m_xConnection)
+ if(m_xConnection.is() && Source.Source == m_xConnection)
{
// our connection was disposed so we need a new one
createNewConnection(sal_True);
@@ -295,6 +295,8 @@ void OJoinController::createNewConnection(sal_Bool _bUI)
m_xConnection = connect(m_sDataSourceName);
m_bOwnConnection = m_xConnection.is();
}
+ else
+ InvalidateAll();
}
// -----------------------------------------------------------------------------
void OJoinController::SaveTabWinPosSize(OTableWindow* pTabWin, long nOffsetX, long nOffsetY)
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 20a22c86c0d1..e782ae596595 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JoinTableView.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: oj $ $Date: 2001-04-30 13:02:01 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -233,15 +233,7 @@ OJoinTableView::~OJoinTableView()
DBG_DTOR(OJoinTableView,NULL);
//////////////////////////////////////////////////////////////////////
// Listen loeschen
- OTableWindowMapIterator aIter = GetTabWinMap()->begin();
- for(;aIter != GetTabWinMap()->end();++aIter)
- delete aIter->second;
-
- GetTabWinMap()->clear();
-
- ::std::vector<OTableConnection*>::iterator aIter2 = GetTabConnList()->begin();
- for(;aIter2 != GetTabConnList()->end();++aIter2)
- delete *aIter2;
+ clearLayoutInformation();
// den Undo-Manager des Dokuments leeren (da die UndoActions sich eventuell TabWins von mir halten, das gibt sonst eine
// Assertion in Window::~Window)
@@ -1279,13 +1271,15 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
if( (*aIter)->CheckHit(rEvt.GetMousePosPixel()) )
{
SelectConn((*aIter));
-
- PopupMenu aContextMenu(ModuleRes(RID_QUERYCOLPOPUPMENU));
- switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ if(!getDesignView()->getController()->isReadOnly() && getDesignView()->getController()->getConnection().is())
{
- case SID_DELETE:
- RemoveConnection((*aIter));
- break;
+ PopupMenu aContextMenu(ModuleRes(RID_QUERYCOLPOPUPMENU));
+ switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ {
+ case SID_DELETE:
+ RemoveConnection((*aIter));
+ break;
+ }
}
break;
}
@@ -1574,7 +1568,23 @@ void OJoinTableView::HideTabWins()
}
// -----------------------------------------------------------------------------
+void OJoinTableView::clearLayoutInformation()
+{
+ //////////////////////////////////////////////////////////////////////
+ // Listen loeschen
+ OTableWindowMapIterator aIter = GetTabWinMap()->begin();
+ for(;aIter != GetTabWinMap()->end();++aIter)
+ delete aIter->second;
+
+ GetTabWinMap()->clear();
+ ::std::vector<OTableConnection*>::iterator aIter2 = GetTabConnList()->begin();
+ for(;aIter2 != GetTabConnList()->end();++aIter2)
+ delete *aIter2;
+
+ GetTabConnList()->clear();
+}
+// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index a7fef90b91c9..32c3cf95a825 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QTableWindow.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: fs $ $Date: 2001-03-15 08:26:26 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -248,12 +248,16 @@ sal_Bool OQueryTableWindow::FillListBox()
{
Reference<XPropertySet> xProp;
::cppu::extractInterface(xProp,xKeyIndex->getByIndex(i));
- sal_Int32 nKeyType = 0;
- xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
- if(KeyType::PRIMARY == nKeyType)
+ OSL_ENSURE(xProp.is(),"OQueryTableWindow::FillListBox Key isn't a XPropertySet!");
+ if(xProp.is())
{
- xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY);
- break;
+ sal_Int32 nKeyType = 0;
+ xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+ if(KeyType::PRIMARY == nKeyType)
+ {
+ xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY);
+ break;
+ }
}
}
if(xColumnsSupplier.is())
@@ -268,29 +272,33 @@ sal_Bool OQueryTableWindow::FillListBox()
pEntry->SetUserData( new OTableFieldInfo() );
}
- Sequence< ::rtl::OUString> aColumns = GetOriginalColumns()->getElementNames();
- const ::rtl::OUString* pBegin = aColumns.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aColumns.getLength();
-
- for (; pBegin != pEnd; ++pBegin)
+ if(GetOriginalColumns().is())
{
- OTableFieldInfo* pInfo = new OTableFieldInfo();
- // is this column in the primary key
- if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin))
- {
- pEntry = m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage);
- pInfo->SetKey(TAB_PRIMARY_FIELD);
- }
- else
+ Sequence< ::rtl::OUString> aColumns = GetOriginalColumns()->getElementNames();
+ const ::rtl::OUString* pBegin = aColumns.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aColumns.getLength();
+
+ for (; pBegin != pEnd; ++pBegin)
{
- pEntry = m_pListBox->InsertEntry(*pBegin);
- pInfo->SetKey(TAB_NORMAL_FIELD);
+ OTableFieldInfo* pInfo = new OTableFieldInfo();
+ // is this column in the primary key
+ if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin))
+ {
+ pEntry = m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage);
+ pInfo->SetKey(TAB_PRIMARY_FIELD);
+ }
+ else
+ {
+ pEntry = m_pListBox->InsertEntry(*pBegin);
+ pInfo->SetKey(TAB_NORMAL_FIELD);
+ }
+ Reference<XPropertySet> xColumn;
+ ::cppu::extractInterface(xColumn,GetOriginalColumns()->getByName(*pBegin));
+ OSL_ENSURE(xColumn.is(),"No column!");
+ if(xColumn.is())
+ pInfo->SetDataType(::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)));
+ pEntry->SetUserData( pInfo );
}
- Reference<XPropertySet> xColumn;
- ::cppu::extractInterface(xColumn,GetOriginalColumns()->getByName(*pBegin));
- OSL_ENSURE(xColumn.is(),"No column!");
- pInfo->SetDataType(::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_TYPE)));
- pEntry->SetUserData( pInfo );
}
return sal_True;
}
@@ -345,31 +353,34 @@ sal_Bool OQueryTableWindow::ExistsField(const ::rtl::OUString& strFieldName, OTa
{
DBG_ASSERT(m_pListBox != NULL, "OQueryTableWindow::ExistsField : habe keine ::com::sun::star::form::ListBox !");
Reference< XConnection> xConnection = getTableView()->getDesignView()->getController()->getConnection();
- if(!xConnection.is())
- return FALSE;
- SvLBoxEntry* pEntry = m_pListBox->First();
- ::comphelper::UStringMixEqual bCase(xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
-
- while (pEntry)
+ sal_Bool bExists = sal_False;
+ if(xConnection.is())
{
- if (bCase(strFieldName,::rtl::OUString(m_pListBox->GetEntryText(pEntry))))
+ SvLBoxEntry* pEntry = m_pListBox->First();
+ ::comphelper::UStringMixEqual bCase(xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
+
+ while (pEntry)
{
- OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
- DBG_ASSERT(pInf != NULL, "OQueryTableWindow::ExistsField : Feld hat keine FieldInfo !");
-
- rInfo.SetTabWindow(this);
- rInfo.SetField(strFieldName);
- rInfo.SetTable(GetTableName());
- rInfo.SetAlias(GetAliasName());
- rInfo.SetDatabase(GetComposedName());
- rInfo.SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
- rInfo.SetDataType(pInf->GetDataType());
- return sal_True;
+ if (bCase(strFieldName,::rtl::OUString(m_pListBox->GetEntryText(pEntry))))
+ {
+ OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
+ DBG_ASSERT(pInf != NULL, "OQueryTableWindow::ExistsField : Feld hat keine FieldInfo !");
+
+ rInfo.SetTabWindow(this);
+ rInfo.SetField(strFieldName);
+ rInfo.SetTable(GetTableName());
+ rInfo.SetAlias(GetAliasName());
+ rInfo.SetDatabase(GetComposedName());
+ rInfo.SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
+ rInfo.SetDataType(pInf->GetDataType());
+ bExists = sal_True;
+ break;
+ }
+ pEntry = m_pListBox->Next(pEntry);
}
- pEntry = m_pListBox->Next(pEntry);
}
- return sal_False;
+ return bExists;
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index f7ff66656fb9..22b2e7547e87 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: oj $ $Date: 2001-05-08 14:04:19 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1079,7 +1079,7 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
if (pWin)
{
Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if(xColumns->hasByName(aFieldName))
+ if(xColumns.is() && xColumns->hasByName(aFieldName))
xColumns->getByName(aFieldName) >>= xColumn;
}
::rtl::OUString aErrorMsg;
@@ -1092,7 +1092,7 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
pParseNode->replaceNodeValue(ConvertAlias(pEntryField->GetAlias()),aFieldName);
::rtl::OUString aWhere = aWhereStr;
pParseNode->parseNodeToStr( aWhere,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
+ xMetaData,
&(static_cast<OQueryController*>(getController())->getParser()->getContext())
,sal_False,sal_True);
aWhereStr = aWhere;
@@ -1465,16 +1465,21 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
if(SQL_ISRULE(pCondition->getChild(0), column_ref ))
{
::rtl::OUString aColumnName;
- // the international doesn't matter I have a string
- pCondition->parseNodeToPredicateStr(aCondition,static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
- pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ // the international doesn't matter I have a string
+ pCondition->parseNodeToPredicateStr(aCondition,xMetaData, static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,xMetaData, static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale,
+ m_sDecimalSep.toChar());
- // don't display the column name
- aCondition = aCondition.copy(aColumnName.getLength());
- aCondition = aCondition.trim();
+ // don't display the column name
+ aCondition = aCondition.copy(aColumnName.getLength());
+ aCondition = aCondition.trim();
+ }
if (FillDragInfo(pCondition->getChild(0),aDragLeft))
m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
@@ -1497,13 +1502,18 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
OTableFieldDesc aDragLeft;
if(SQL_ISRULE(pCondition->getChild(0), column_ref ))
{
- // Bedingung parsen
- for(sal_uInt16 i=1;i< pCondition->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ // parse condition
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ for(sal_uInt16 i=1;i< pCondition->count();i++)
+ pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
}
if (FillDragInfo(pCondition->getChild(0),aDragLeft))
@@ -1520,12 +1530,17 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
OTableFieldDesc aDragLeft;
// Funktions-Bedingung parsen
- for(sal_uInt16 i=0;i< pCondition->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ for(sal_uInt16 i=0;i< pCondition->count();i++)
+ pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
aDragLeft.SetField(aCondition);
aDragLeft.SetFunctionType(FKT_CONDITION);
@@ -1586,12 +1601,17 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
// International aInter(Shell()->BuildInternational(GetColumnFormatKey(pCondition->getChild(0))));
// Bedingung parsen
- for(;i< pCondition->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ for(;i< pCondition->count();i++)
+ pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
}
else if(SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref ))
{
@@ -1628,12 +1648,17 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
// International aInter(Shell()->BuildInternational(GetColumnFormatKey(pCondition->getChild(pCondition->count()-1))));
// go backward
- for (; i >= 0; i--)
- pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ for (; i >= 0; i--)
+ pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
}
if(FillDragInfo(pCondition->getChild(nPos),aDragLeft))
{
@@ -1654,16 +1679,21 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
OTableFieldDesc aDragLeft;
::rtl::OUString aColumnName;
- pCondition->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
- pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ pCondition->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
// don't display the column name
aCondition = aCondition.copy(aColumnName.getLength());
@@ -1701,19 +1731,24 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
::connectivity::OSQLParseNode *pLhs = pCondition->getChild(0);
::connectivity::OSQLParseNode *pRhs = pCondition->getChild(2);
// Feldnamen
- for(sal_uInt16 i=0;i< pLhs->count();i++)
- pCondition->getChild(i)->parseNodeToStr(aName,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- &static_cast<OQueryController*>(getController())->getParser()->getContext(),
- sal_True);
- // Kriterium
- aCondition = pCondition->getChild(1)->getTokenValue();
- for(i=0;i< pRhs->count();i++)
- pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- static_cast<OQueryController*>(getController())->getNumberFormatter(),
- m_aLocale,
- m_sDecimalSep.toChar());
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
+ {
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ for(sal_uInt16 i=0;i< pLhs->count();i++)
+ pCondition->getChild(i)->parseNodeToStr(aName,
+ xMetaData,
+ &static_cast<OQueryController*>(getController())->getParser()->getContext(),
+ sal_True);
+ // Kriterium
+ aCondition = pCondition->getChild(1)->getTokenValue();
+ for(i=0;i< pRhs->count();i++)
+ pCondition->getChild(i)->parseNodeToPredicateStr(aCondition,
+ xMetaData,
+ static_cast<OQueryController*>(getController())->getNumberFormatter(),
+ m_aLocale,
+ m_sDecimalSep.toChar());
+ }
aDragLeft.SetField(aName);
aDragLeft.SetFunctionType(FKT_OTHER);
@@ -1738,7 +1773,10 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
return rValue;
}
- Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData();
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ Reference< XDatabaseMetaData > xMetaData;
+ if(xConnection.is())
+ xMetaData = xConnection->getMetaData();
::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
switch( aType )
@@ -1918,75 +1956,79 @@ void OQueryDesignView::InitFromParseNode()
const OSQLTables& aMap = aIterator.getTables();
::comphelper::UStringMixEqual aKeyComp(static_cast< ::comphelper::UStringMixLess*>(&aMap.key_comp())->isCaseSensitive());
- Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData();
-
- sal_Int32 nMax = xMetaData->getMaxTablesInSelect();
- if(!nMax || nMax >= (sal_Int32)aMap.size()) // Anzahl der Tabellen im Select-Statement "uberpr"ufen
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
{
- ::rtl::OUString aComposedName;
- ::rtl::OUString aQualifierName;
- ::rtl::OUString sAlias;
- OSQLTables::const_iterator aIter = aMap.begin();
- for(;aIter != aMap.end();++aIter)
- {
- OSQLTable xTable = aIter->second;
- ::dbaui::composeTableName(xMetaData,Reference<XPropertySet>(xTable,UNO_QUERY),aComposedName,sal_False);
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
- OQueryTableWindow* pExistentWin = static_cast<OQueryTableView*>(m_pTableView)->FindTable(aIter->first);
- if (!pExistentWin)
- {
- m_pTableView->AddTabWin(aComposedName, aIter->first,sal_False);// don't create data here
- }
- else
+ sal_Int32 nMax = xMetaData->getMaxTablesInSelect();
+ if(!nMax || nMax >= (sal_Int32)aMap.size()) // Anzahl der Tabellen im Select-Statement "uberpr"ufen
+ {
+ ::rtl::OUString aComposedName;
+ ::rtl::OUString aQualifierName;
+ ::rtl::OUString sAlias;
+ OSQLTables::const_iterator aIter = aMap.begin();
+ for(;aIter != aMap.end();++aIter)
{
- // es existiert schon ein Fenster mit dem selben Alias ...
- ::rtl::OUString aFullWinName();
+ OSQLTable xTable = aIter->second;
+ ::dbaui::composeTableName(xMetaData,Reference<XPropertySet>(xTable,UNO_QUERY),aComposedName,sal_False);
+
+ OQueryTableWindow* pExistentWin = static_cast<OQueryTableView*>(m_pTableView)->FindTable(aIter->first);
+ if (!pExistentWin)
+ {
+ m_pTableView->AddTabWin(aComposedName, aIter->first,sal_False);// don't create data here
+ }
+ else
+ {
+ // es existiert schon ein Fenster mit dem selben Alias ...
+ ::rtl::OUString aFullWinName();
- if (!aKeyComp(pExistentWin->GetData()->GetComposedName(),aComposedName))
- // ... aber anderem Tabellennamen -> neues Fenster
- m_pTableView->AddTabWin(aComposedName, aIter->first);
+ if (!aKeyComp(pExistentWin->GetData()->GetComposedName(),aComposedName))
+ // ... aber anderem Tabellennamen -> neues Fenster
+ m_pTableView->AddTabWin(aComposedName, aIter->first);
+ }
}
- }
- // now delete the data for which we haven't any tablewindow
- OJoinTableView::OTableWindowMap* pTableMap = m_pTableView->GetTabWinMap();
- ::std::vector< OTableWindowData*>::iterator aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->begin();
- for(;aDataIter != static_cast<OQueryController*>(getController())->getTableWindowData()->end();)
- {
- OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(*aDataIter);
- if(pTableMap->find(pData->GetAliasName()) == pTableMap->end())
+ // now delete the data for which we haven't any tablewindow
+ OJoinTableView::OTableWindowMap* pTableMap = m_pTableView->GetTabWinMap();
+ ::std::vector< OTableWindowData*>::iterator aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->begin();
+ for(;aDataIter != static_cast<OQueryController*>(getController())->getTableWindowData()->end();)
{
- delete *aDataIter;
- aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->erase(aDataIter);
+ OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(*aDataIter);
+ if(pTableMap->find(pData->GetAliasName()) == pTableMap->end())
+ {
+ delete *aDataIter;
+ aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->erase(aDataIter);
+ }
+ else
+ ++aDataIter;
}
- else
- ++aDataIter;
- }
- FillOuterJoins(pParseTree->getChild(3)->getChild(0)->getChild(1));
+ FillOuterJoins(pParseTree->getChild(3)->getChild(0)->getChild(1));
- // check if we have a distinct statement
- if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT))
- {
- static_cast<OQueryController*>(getController())->setDistinct(sal_True);
- static_cast<OQueryController*>(getController())->InvalidateFeature(ID_BROWSER_QUERY_DISTINCT_VALUES);
+ // check if we have a distinct statement
+ if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT))
+ {
+ static_cast<OQueryController*>(getController())->setDistinct(sal_True);
+ static_cast<OQueryController*>(getController())->InvalidateFeature(ID_BROWSER_QUERY_DISTINCT_VALUES);
+ }
+ if (!InstallFields(pParseTree, m_pTableView->GetTabWinMap()))
+ {
+ // GetSelectionCriteria mu"s vor GetHavingCriteria aufgerufen werden
+ int nLevel=0;
+
+ GetSelectionCriteria(pParseTree,nLevel,sal_True);
+ GetGroupCriteria(pParseTree);
+ GetHavingCriteria(pParseTree,nLevel);
+ GetOrderCriteria(pParseTree);
+ }
}
- if (!InstallFields(pParseTree, m_pTableView->GetTabWinMap()))
+ else
{
- // GetSelectionCriteria mu"s vor GetHavingCriteria aufgerufen werden
- int nLevel=0;
-
- GetSelectionCriteria(pParseTree,nLevel,sal_True);
- GetGroupCriteria(pParseTree);
- GetHavingCriteria(pParseTree,nLevel);
- GetOrderCriteria(pParseTree);
+ ErrorBox aBox(this, ModuleRes( ERR_QRY_TOO_MANY_TABLES));
+ aBox.Execute();
}
}
- else
- {
- ErrorBox aBox(this, ModuleRes( ERR_QRY_TOO_MANY_TABLES));
- aBox.Execute();
- }
}
else
{
@@ -2059,101 +2101,105 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
}
else if (SQL_ISRULE(pColumnRef,derived_column))
{
- ::rtl::OUString aColumnAlias(static_cast<OQueryController*>(getController())->getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein
- pColumnRef = pColumnRef->getChild(0);
- if (SQL_ISRULE(pColumnRef,column_ref))
- {
- OTableFieldDesc aInfo;
- switch(InsertColumnRef(pColumnRef,aColumnName,aColumnAlias,aTableRange,aInfo,pTabList))
- {
- case 5:
- ErrorBox( this, ModuleRes( ERR_QRY_AMB_FIELD ) ).Execute();
- break;
- default:
- if(!InsertField(aInfo, sal_True, bFirstField))
- return 1;
- bFirstField = sal_False;
- }
- }
- else if(SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) ||
- SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) ||
- SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct))
+ Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
+ if(xConnection.is())
{
- OTableFieldDesc aInfo;
- ::rtl::OUString aColumns;
-
- pColumnRef->parseNodeToStr( aColumns,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- &static_cast<OQueryController*>(getController())->getParser()->getContext(),
- sal_True,
- sal_False);
-
- ::connectivity::OSQLParseNode * pParamRef = pColumnRef->getChild(pColumnRef->count()-2);
- if (SQL_ISRULE(pColumnRef,general_set_fct)
- && SQL_ISRULE(pParamRef = pColumnRef->getChild(pColumnRef->count()-2),column_ref))
+ Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ ::rtl::OUString aColumnAlias(static_cast<OQueryController*>(getController())->getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein
+ pColumnRef = pColumnRef->getChild(0);
+ if (SQL_ISRULE(pColumnRef,column_ref))
{
- // Parameter auf Columnref pr"ufen
- switch(InsertColumnRef(pParamRef,aColumnName,aColumnAlias,aTableRange,aInfo,pTabList))
+ OTableFieldDesc aInfo;
+ switch(InsertColumnRef(pColumnRef,aColumnName,aColumnAlias,aTableRange,aInfo,pTabList))
{
case 5:
ErrorBox( this, ModuleRes( ERR_QRY_AMB_FIELD ) ).Execute();
break;
+ default:
+ if(!InsertField(aInfo, sal_True, bFirstField))
+ return 1;
+ bFirstField = sal_False;
}
}
- else
+ else if(SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) ||
+ SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) ||
+ SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct))
{
- if(pParamRef && pParamRef->getTokenValue().toChar() == '*')
+ OTableFieldDesc aInfo;
+ ::rtl::OUString aColumns;
+ pColumnRef->parseNodeToStr( aColumns,
+ xMetaData,
+ &static_cast<OQueryController*>(getController())->getParser()->getContext(),
+ sal_True,
+ sal_False);
+
+ ::connectivity::OSQLParseNode * pParamRef = pColumnRef->getChild(pColumnRef->count()-2);
+ if (SQL_ISRULE(pColumnRef,general_set_fct)
+ && SQL_ISRULE(pParamRef = pColumnRef->getChild(pColumnRef->count()-2),column_ref))
{
- OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
- for(;aIter != pTabList->end();++aIter)
+ // Parameter auf Columnref pr"ufen
+ switch(InsertColumnRef(pParamRef,aColumnName,aColumnAlias,aTableRange,aInfo,pTabList))
{
- OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
- if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
+ case 5:
+ ErrorBox( this, ModuleRes( ERR_QRY_AMB_FIELD ) ).Execute();
break;
}
}
else
{
- aInfo.SetDataType(DataType::DOUBLE);
- aInfo.SetFieldType(TAB_NORMAL_FIELD);
- aInfo.SetTabWindow(NULL);
- aInfo.SetField(aColumns);
- aInfo.SetFieldAlias(aColumnAlias);
+ if(pParamRef && pParamRef->getTokenValue().toChar() == '*')
+ {
+ OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
+ for(;aIter != pTabList->end();++aIter)
+ {
+ OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
+ if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
+ break;
+ }
+ }
+ else
+ {
+ aInfo.SetDataType(DataType::DOUBLE);
+ aInfo.SetFieldType(TAB_NORMAL_FIELD);
+ aInfo.SetTabWindow(NULL);
+ aInfo.SetField(aColumns);
+ aInfo.SetFieldAlias(aColumnAlias);
+ }
}
- }
- if(SQL_ISRULE(pColumnRef,general_set_fct))
- {
- aInfo.SetFunctionType(FKT_AGGREGATE);
- String aCol(aColumns);
- aInfo.SetFunction(aCol.GetToken(0,'(').EraseTrailingChars(' '));
+ if(SQL_ISRULE(pColumnRef,general_set_fct))
+ {
+ aInfo.SetFunctionType(FKT_AGGREGATE);
+ String aCol(aColumns);
+ aInfo.SetFunction(aCol.GetToken(0,'(').EraseTrailingChars(' '));
+ }
+ else
+ aInfo.SetFunctionType(FKT_OTHER);
+
+ if(!InsertField(aInfo, sal_True, bFirstField))
+ return 1;
+ bFirstField = sal_False;
}
- else
+ else //if(SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))
+ {
+ ::rtl::OUString aColumns;
+ pColumnRef->parseNodeToStr( aColumns,
+ xMetaData,
+ &static_cast<OQueryController*>(getController())->getParser()->getContext(),
+ sal_True,sal_False);
+
+ OTableFieldDesc aInfo;
+ aInfo.SetDataType(DataType::DOUBLE);
+ aInfo.SetFieldType(TAB_NORMAL_FIELD);
+ aInfo.SetTabWindow(NULL);
+ aInfo.SetField(aColumns);
+ aInfo.SetFieldAlias(aColumnAlias);
aInfo.SetFunctionType(FKT_OTHER);
- if(!InsertField(aInfo, sal_True, bFirstField))
- return 1;
- bFirstField = sal_False;
- }
- else //if(SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))
- {
- ::rtl::OUString aColumns;
- pColumnRef->parseNodeToStr( aColumns,
- static_cast<OQueryController*>(getController())->getConnection()->getMetaData(),
- &static_cast<OQueryController*>(getController())->getParser()->getContext(),
- sal_True,sal_False);
-
- OTableFieldDesc aInfo;
- aInfo.SetDataType(DataType::DOUBLE);
- aInfo.SetFieldType(TAB_NORMAL_FIELD);
- aInfo.SetTabWindow(NULL);
- aInfo.SetField(aColumns);
- aInfo.SetFieldAlias(aColumnAlias);
- aInfo.SetFunctionType(FKT_OTHER);
-
- if(!InsertField(aInfo, sal_True, bFirstField))
- return 1;
- bFirstField = sal_False;
+ if(!InsertField(aInfo, sal_True, bFirstField))
+ return 1;
+ bFirstField = sal_False;
+ }
}
}
}
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 6bc0a8d88813..d4f0a69070cb 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTableView.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-04-30 13:02:01 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -567,6 +567,9 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
if(bNewTable && pTabWins->size() && strTableName.getLength())
{
Reference<XConnection> xCon = m_pView->getController()->getConnection();
+ OSL_ENSURE(xCon.is(),"OQueryTableView::AddTabWin connection is null!");
+ if(!xCon.is())
+ return;
Reference<XTablesSupplier> xSup(xCon,UNO_QUERY);
Reference<XNameAccess> xTables = xSup->getTables();
Reference<XPropertySet> xTable;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 992049f64455..02eb9addc253 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: SelectionBrowseBox.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2001-05-02 06:32:25 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -649,12 +649,15 @@ sal_Bool OSelectionBrowseBox::SaveModified()
if (pWin)
{
Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if (aFieldName.GetTokenCount('.') == 2 && xColumns->hasByName(aFieldName.GetToken(1,'.'))) // falls alias.Feld angegeben
- ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName.GetToken(1,'.')));
- else if(xColumns->hasByName(aFieldName))
- ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName));
- else if(aFieldName.GetTokenCount('.') == 2 && aFieldName.GetToken(1,'.').GetChar(0) == '*')
- bAsterix = sal_True;
+ if(xColumns.is())
+ {
+ if (aFieldName.GetTokenCount('.') == 2 && xColumns->hasByName(aFieldName.GetToken(1,'.'))) // falls alias.Feld angegeben
+ ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName.GetToken(1,'.')));
+ else if(xColumns->hasByName(aFieldName))
+ ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName));
+ else if(aFieldName.GetTokenCount('.') == 2 && aFieldName.GetToken(1,'.').GetChar(0) == '*')
+ bAsterix = sal_True;
+ }
}
if(!xColumn.is() && !bAsterix) // only when text not a column of the table
@@ -977,7 +980,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
if (pWin)
{
Reference<XNameAccess> xColumns = pWin->GetOriginalColumns();
- if (xColumns->hasByName(pEntry->GetField()))
+ if (xColumns.is() && xColumns->hasByName(pEntry->GetField()))
::cppu::extractInterface(xColumn,xColumns->getByName(pEntry->GetField()));
}
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index cb63f2948b7e..c2d29f7381af 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableWindow.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: fs $ $Date: 2001-03-15 08:26:26 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -121,11 +121,13 @@
using namespace dbaui;
+using namespace ::utl;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
const long TABWIN_SIZING_AREA = 4;
const long LISTBOX_SCROLLING_AREA = 6;
@@ -169,6 +171,9 @@ OTableWindow::OTableWindow( Window* pParent, OTableWindowData* pTabWinData )
//------------------------------------------------------------------------------
OTableWindow::~OTableWindow()
{
+ Reference<XComponent> xComponent(m_xTable,UNO_QUERY);
+ if(xComponent.is())
+ stopComponentListening(xComponent);
if (m_pListBox)
{
EmptyListBox();
@@ -237,6 +242,7 @@ BOOL OTableWindow::FillListBox()
if (GetData()->IsShowAll())
m_pListBox->InsertEntry( ::rtl::OUString::createFromAscii("*") );
+ ::osl::MutexGuard aGuard( m_aMutex );
// first we need the keys from the table
Reference<XKeysSupplier> xKeys(m_xTable,UNO_QUERY);
Reference<XNameAccess> xPKeyColumns;
@@ -260,17 +266,20 @@ BOOL OTableWindow::FillListBox()
if(xColumnsSupplier.is())
xPKeyColumns = xColumnsSupplier->getColumns();
}
- Sequence< ::rtl::OUString> aColumns = m_xColumns->getElementNames();
- const ::rtl::OUString* pBegin = aColumns.getConstArray();
- const ::rtl::OUString* pEnd = pBegin + aColumns.getLength();
-
- for (; pBegin != pEnd; ++pBegin)
+ if(m_xColumns.is())
{
- // is this column in the primary key
- if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin))
- m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage);
- else
- m_pListBox->InsertEntry(*pBegin);
+ Sequence< ::rtl::OUString> aColumns = m_xColumns->getElementNames();
+ const ::rtl::OUString* pBegin = aColumns.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aColumns.getLength();
+
+ for (; pBegin != pEnd; ++pBegin)
+ {
+ // is this column in the primary key
+ if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin))
+ m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage);
+ else
+ m_pListBox->InsertEntry(*pBegin);
+ }
}
return TRUE;
@@ -298,49 +307,67 @@ BOOL OTableWindow::Init()
Reference<XConnection > xConnection = pParent->getController()->getConnection();
Reference<XTablesSupplier> xSups(xConnection,UNO_QUERY);
OSL_ENSURE(xSups.is(),"The connection isn't a tablessupplier!");
- Reference<XNameAccess> xTables = xSups->getTables();
-
- ::rtl::OUString aName = GetComposedName();
- if(!xTables->hasByName(aName))
- return FALSE;
-
- try
- {
- ::cppu::extractInterface(m_xTable,xTables->getByName(aName));
- Reference<XColumnsSupplier> xColumnsSups(m_xTable,UNO_QUERY);
- m_xColumns = xColumnsSups->getColumns();
- }
- catch(SQLException& e)
+ sal_Bool bInit = sal_False;
+ if(xSups.is())
{
- ::dbaui::showError(::dbtools::SQLExceptionInfo(e),pParent,pParent->getController()->getORB());
- return FALSE;
- }
- catch(Exception&)
- {
- return FALSE;
- }
+ Reference<XNameAccess> xTables = xSups->getTables();
+ ::rtl::OUString aName = GetComposedName();
+ if(xTables->hasByName(aName))
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ try
+ {
+ ::cppu::extractInterface(m_xTable,xTables->getByName(aName));
+ if(m_xTable.is())
+ {
+ Reference<XComponent> xComponent(m_xTable,UNO_QUERY);
+ if(xComponent.is())
+ startComponentListening(xComponent);
+ Reference<XColumnsSupplier> xColumnsSups(m_xTable,UNO_QUERY);
+ OSL_ENSURE(xColumnsSups.is(),"OTableWindow::Init Table isn't a XColumnsSupplier!");
+ if(xColumnsSups.is())
+ {
+ m_xColumns = xColumnsSups->getColumns();
+ bInit = sal_True;
+ }
+ }
+ }
+ catch(SQLException& e)
+ {
+ ::dbaui::showError(::dbtools::SQLExceptionInfo(e),pParent,pParent->getController()->getORB());
+ bInit = FALSE;
+ }
+ catch(Exception&)
+ {
+ bInit = FALSE;
+ }
- // ListBox anlegen, wenn notwendig
- if (!m_pListBox)
- {
- m_pListBox = CreateListBox();
- DBG_ASSERT(m_pListBox != NULL, "OTableWindow::Init() : CreateListBox hat NULL geliefert !");
- m_pListBox->SetSelectionMode(MULTIPLE_SELECTION);
+ if(bInit)
+ {
+ // ListBox anlegen, wenn notwendig
+ if (!m_pListBox)
+ {
+ m_pListBox = CreateListBox();
+ DBG_ASSERT(m_pListBox != NULL, "OTableWindow::Init() : CreateListBox hat NULL geliefert !");
+ m_pListBox->SetSelectionMode(MULTIPLE_SELECTION);
+ }
+
+ // Titel setzen
+ m_aTitle.SetText( m_pData->GetWinName() );
+ m_aTitle.Show();
+
+ m_pListBox->Show();
+
+ // die Felder in die ListBox eintragen
+ EmptyListBox();
+ if (bInit = FillListBox())
+ m_pListBox->SelectAll(FALSE);
+ }
+ }
}
- // Titel setzen
- m_aTitle.SetText( m_pData->GetWinName() );
- m_aTitle.Show();
-
- m_pListBox->Show();
-
- // die Felder in die ListBox eintragen
- EmptyListBox();
- if (!FillListBox())
- return FALSE;
- m_pListBox->SelectAll(FALSE);
- return TRUE;
+ return bInit;
}
//------------------------------------------------------------------------------
@@ -603,6 +630,14 @@ void OTableWindow::StateChanged( StateChangedType nType )
}
}
// -----------------------------------------------------------------------------
+void OTableWindow::_disposing( const ::com::sun::star::lang::EventObject& _rSource )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_xTable = NULL;
+ m_xColumns = NULL;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
index a8310fa177b9..040b75c8014c 100644
--- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableWindowListBox.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: fs $ $Date: 2001-03-30 13:06:46 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,9 +147,15 @@ SvLBoxEntry* OTableWindowListBox::GetEntryFromText( const String& rEntryText )
SvLBoxEntry* pEntry = (SvLBoxEntry*)pTreeList->First();
OJoinDesignView* pView = m_pTabWin->getDesignView();
OJoinController* pController = pView->getController();
- Reference<XDatabaseMetaData> xMeta = pController->getConnection()->getMetaData();
- BOOL bCase = xMeta->storesMixedCaseQuotedIdentifiers();
+ BOOL bCase = FALSE;
+ Reference<XConnection> xConnection = pController->getConnection();
+ if(xConnection.is())
+ {
+ Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
+ if(xMeta.is())
+ bCase = xMeta->storesMixedCaseQuotedIdentifiers();
+ }
while( pEntry )
{
@@ -263,77 +269,76 @@ void OTableWindowListBox::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
//------------------------------------------------------------------------------
sal_Int8 OTableWindowListBox::AcceptDrop( const AcceptDropEvent& _rEvt )
{
+ sal_Int8 nDND_Action = DND_ACTION_NONE;
// check the format
- if (!OJoinExchObj::isFormatAvailable(GetDataFlavorExVector()))
- return DND_ACTION_NONE;
-
- // don't drop into the window if it's the drag source itself
- if (m_bDragSource)
- return DND_ACTION_NONE;
-
- // remove the selection if the dragging operation is leaving the window
- if (_rEvt.mbLeaving)
- {
- SelectAll(FALSE);
- return DND_ACTION_NONE;
- }
-
-/*
- // Wenn der erste Eintrag der Quelle (*) gedraggt wird, lehne ich grundsaetzlich ab
- // TODO there isn't a exchange object yet
-
- OJoinExchangeData jxdSource = ((OJoinExchObj*)&xDataObj)->GetSourceDescription();
- if (jxdSource.pListBox->GetTabWin()->GetData()->IsShowAll() && (jxdSource.pListBox->First() == jxdSource.pEntry))
- return FALSE;
-*/
+ if (OJoinExchObj::isFormatAvailable(GetDataFlavorExVector()) && !m_bDragSource)
+ { // don't drop into the window if it's the drag source itself
- // hit test
- m_aMousePos = _rEvt.maPosPixel;
- Size aOutputSize = GetOutputSizePixel();
- SvLBoxEntry* pEntry = GetEntry( m_aMousePos );
- if( !pEntry )
- return DND_ACTION_NONE;
- // Scrolling Areas
- Rectangle aBottomScrollArea( Point(0, aOutputSize.Height()-LISTBOX_SCROLLING_AREA),
- Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
- Rectangle aTopScrollArea( Point(0,0), Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
-
- // Wenn Zeiger auf der oberen ScrollingArea steht, nach oben scrollen
- if( aBottomScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
+ // remove the selection if the dragging operation is leaving the window
+ if (_rEvt.mbLeaving)
+ SelectAll(FALSE);
+ else
{
- m_aScrollTimer.SetTimeoutHdl( LINK(this, OTableWindowListBox, ScrollUpHdl) );
- ScrollUpHdl( this );
- }
- }
- // Wenn Zeiger auf der oberen ScrollingArea steht, nach unten scrollen
- else if( aTopScrollArea.IsInside(m_aMousePos) )
- {
- if( !m_aScrollTimer.IsActive() )
- {
- m_aScrollTimer.SetTimeoutHdl( LINK(this, OTableWindowListBox, ScrollDownHdl) );
- ScrollDownHdl( this );
+ /*
+ // Wenn der erste Eintrag der Quelle (*) gedraggt wird, lehne ich grundsaetzlich ab
+ // TODO there isn't a exchange object yet
+
+ OJoinExchangeData jxdSource = ((OJoinExchObj*)&xDataObj)->GetSourceDescription();
+ if (jxdSource.pListBox->GetTabWin()->GetData()->IsShowAll() && (jxdSource.pListBox->First() == jxdSource.pEntry))
+ return FALSE;
+ */
+
+ // hit test
+ m_aMousePos = _rEvt.maPosPixel;
+ Size aOutputSize = GetOutputSizePixel();
+ SvLBoxEntry* pEntry = GetEntry( m_aMousePos );
+ if( !pEntry )
+ return DND_ACTION_NONE;
+
+ // Scrolling Areas
+ Rectangle aBottomScrollArea( Point(0, aOutputSize.Height()-LISTBOX_SCROLLING_AREA),
+ Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
+ Rectangle aTopScrollArea( Point(0,0), Size(aOutputSize.Width(), LISTBOX_SCROLLING_AREA) );
+
+ // Wenn Zeiger auf der oberen ScrollingArea steht, nach oben scrollen
+ if( aBottomScrollArea.IsInside(m_aMousePos) )
+ {
+ if( !m_aScrollTimer.IsActive() )
+ {
+ m_aScrollTimer.SetTimeoutHdl( LINK(this, OTableWindowListBox, ScrollUpHdl) );
+ ScrollUpHdl( this );
+ }
+ }
+
+ // Wenn Zeiger auf der oberen ScrollingArea steht, nach unten scrollen
+ else if( aTopScrollArea.IsInside(m_aMousePos) )
+ {
+ if( !m_aScrollTimer.IsActive() )
+ {
+ m_aScrollTimer.SetTimeoutHdl( LINK(this, OTableWindowListBox, ScrollDownHdl) );
+ ScrollDownHdl( this );
+ }
+ }
+ else
+ {
+ if( m_aScrollTimer.IsActive() )
+ m_aScrollTimer.Stop();
+ }
+
+ // Beim Drag automatisch den richtigen Eintrag selektieren
+ if ((FirstSelected() != pEntry) || (FirstSelected() && NextSelected(FirstSelected())))
+ SelectAll(FALSE);
+ Select(pEntry, TRUE);
+
+ // Auf den ersten Eintrag (*) kann nicht gedroppt werden
+ if(!( m_pTabWin->GetData()->IsShowAll() && (pEntry==First()) ))
+ nDND_Action = DND_ACTION_LINK;
}
}
- else
- {
- if( m_aScrollTimer.IsActive() )
- m_aScrollTimer.Stop();
- }
-
- // Beim Drag automatisch den richtigen Eintrag selektieren
- if ((FirstSelected() != pEntry) || (FirstSelected() && NextSelected(FirstSelected())))
- SelectAll(FALSE);
- Select(pEntry, TRUE);
- // Auf den ersten Eintrag (*) kann nicht gedroppt werden
- if( m_pTabWin->GetData()->IsShowAll() && (pEntry==First()) )
- return DND_ACTION_NONE;
-
- return DND_ACTION_LINK;
+ return nDND_Action;
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
index ad4d2588ef95..fd327a3c4a8e 100644
--- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableWindowTitle.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2001-05-04 10:56:29 $
+ * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -179,7 +179,7 @@ void OTableWindowTitle::Command( const CommandEvent& rEvt )
GrabFocus();
OQueryTableView* pView = static_cast<OQueryTableView*>(m_pTabWin->getTableView());
OSL_ENSURE(pView,"No OQueryTableView!");
- if (!pView->getDesignView()->getController()->isReadOnly())
+ if(!pView->getDesignView()->getController()->isReadOnly() && pView->getDesignView()->getController()->getConnection().is())
{
Point aPoint = rEvt.GetMousePosPixel();
PopupMenu aContextMenu( ModuleRes(RID_QUERYCOLPOPUPMENU) );