summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-10-05 05:49:21 +0000
committerOcke Janssen <oj@openoffice.org>2001-10-05 05:49:21 +0000
commitfae21d7716cc82db12c60bfe9af89334ebc76822 (patch)
tree6be0fd39c973d09b73db1c624b51b5af5dfc0a5d
parentc6a9bd9316bc0853f5c16693de8a86ee8cc849d4 (diff)
#68216# save information for unused fields
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx27
-rw-r--r--dbaccess/source/ui/inc/QueryTableView.hxx12
-rw-r--r--dbaccess/source/ui/inc/querycontroller.hxx21
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnectionData.cxx20
-rw-r--r--dbaccess/source/ui/querydesign/QTableConnectionData.hxx9
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx35
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.hxx6
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindowData.hxx7
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx10
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx256
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx425
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx50
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx9
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx44
15 files changed, 454 insertions, 485 deletions
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index 18d15f21ade3..03f76e318ae4 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,9 +67,6 @@
#ifndef _SV_SPLIT_HXX
#include <vcl/split.hxx>
#endif
-#ifndef _VECTOR_
-#include <vector>
-#endif
#ifndef _STRING_HXX
#include <tools/string.hxx>
#endif
@@ -82,6 +79,9 @@
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
+#ifndef DBAUI_QUERYCONTROLLER_HXX
+#include "querycontroller.hxx"
+#endif
namespace connectivity
{
@@ -94,7 +94,6 @@ namespace dbaui
class OQueryViewSwitch;
class OAddTableDlg;
class OQueryTableWindow;
- class OTableFieldDesc;
class OSelectionBrowseBox;
class OTableConnection;
class OQueryTableConnectionData;
@@ -126,12 +125,12 @@ namespace dbaui
void GenerateInnerJoinCriterias(::rtl::OUString& _rJoinCrit,const ::std::vector<OTableConnection*>* _pConnList);
// erzeugt das Group Argument, falls vorhanden
- ::rtl::OUString GenerateGroupBy(::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti );
+ ::rtl::OUString GenerateGroupBy(OTableFields& _rFieldList, sal_Bool bMulti );
// erzeugt Where und Having Argument, falls vorhanden
- sal_Bool GenerateCriterias(::rtl::OUString& aRetStr,::rtl::OUString& rHavingStr/*,::rtl::OUString& rOrderStr*/, ::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti );
- ::rtl::OUString GenerateOrder( ::std::vector<OTableFieldDesc*>* pFieldList , sal_Bool bMulti);
+ sal_Bool GenerateCriterias(::rtl::OUString& aRetStr,::rtl::OUString& rHavingStr/*,::rtl::OUString& rOrderStr*/, OTableFields& _rFieldList, sal_Bool bMulti );
+ ::rtl::OUString GenerateOrder( OTableFields& _rFieldList , sal_Bool bMulti);
// Erzeugt die SelectList. bAlias mu"s gesetzt sein, wenn mehr als 1 Tabelle vorhanden ist
- ::rtl::OUString GenerateSelectList(::std::vector<OTableFieldDesc*>* pFieldList,sal_Bool bAlias);
+ ::rtl::OUString GenerateSelectList(OTableFields& _rFieldList,sal_Bool bAlias);
// Erzeugt die Tabellenliste mit Joins aus pConnList, wenn bJoin == True. pConnList kann == NULL wenn bJoin == sal_False
::rtl::OUString GenerateFromClause(const OJoinTableView::OTableWindowMap* pTabMap,::std::vector<OTableConnection*>* pConnList);
@@ -154,7 +153,7 @@ namespace dbaui
sal_Bool InsertJoin(const ::connectivity::OSQLParseNode *pNode);
sal_Bool InsertJoinConnection(const ::connectivity::OSQLParseNode *pNode, const EJoinType& _eJoinType);
- sal_Bool FillDragInfo(const ::connectivity::OSQLParseNode* pTableRef,OTableFieldDesc& aDragInfo);
+ sal_Bool FillDragInfo(const ::connectivity::OSQLParseNode* pTableRef,OTableFieldDescRef& aDragInfo);
sal_Bool HasFields();
::rtl::OUString BuildTable(const OQueryTableWindow* pEntryTab);
@@ -171,7 +170,7 @@ namespace dbaui
int InsertColumnRef(const ::connectivity::OSQLParseNode * pColumnRef,
::rtl::OUString& aColumnName,const ::rtl::OUString& aColumnAlias,
- ::rtl::OUString& aTableRange,OTableFieldDesc& aInfo,
+ ::rtl::OUString& aTableRange,OTableFieldDescRef& aInfo,
OJoinTableView::OTableWindowMap* pTabList);
sal_Int32 GetColumnFormatKey(const ::connectivity::OSQLParseNode* pColumnRef);
@@ -209,7 +208,7 @@ namespace dbaui
::rtl::OUString getDecimalSeparator() const { return m_sDecimalSep;}
sal_Bool HasTable() const {return m_pTableView->GetTabWinMap()->size() != 0;}
- sal_Bool InsertField( const OTableFieldDesc& rInfo, sal_Bool bVis=sal_True, sal_Bool bActivate = sal_True);
+ sal_Bool InsertField( const OTableFieldDescRef& rInfo, sal_Bool bVis=sal_True, sal_Bool bActivate = sal_True);
// save the position of the table window and the pos of the splitters
void SaveTabWinUIConfig(OQueryTableWindow* pWin);
// called when fields are deleted
@@ -225,7 +224,7 @@ namespace dbaui
void stopTimer();
void startTimer();
- ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDesc* pEntry,
+ ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry,
const String& _sCriteria,
::rtl::OUString& _rsErrorMessage,
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn);
diff --git a/dbaccess/source/ui/inc/QueryTableView.hxx b/dbaccess/source/ui/inc/QueryTableView.hxx
index 707e6d68a3ab..69df99c71ca3 100644
--- a/dbaccess/source/ui/inc/QueryTableView.hxx
+++ b/dbaccess/source/ui/inc/QueryTableView.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTableView.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-08-27 14:24:58 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
+#ifndef DBAUI_QUERYCONTROLLER_HXX
+#include "querycontroller.hxx"
+#endif
namespace dbaui
@@ -82,7 +85,6 @@ namespace dbaui
};
//========================================================================
- class OTableFieldDesc;
class OQueryTabWinUndoAct;
class OQueryTabConnUndoAction;
class OQueryTableConnection;
@@ -113,7 +115,7 @@ namespace dbaui
// TabWin suchen
OQueryTableWindow* FindTable(const String& rAliasName);
- BOOL FindTableFromField(const String& rFieldName, OTableFieldDesc& rInfo, USHORT& rCnt);
+ BOOL FindTableFromField(const String& rFieldName, OTableFieldDescRef& rInfo, USHORT& rCnt);
// Basisklasse ueberschrieben : Connections kreieren und loeschen
virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
@@ -139,7 +141,7 @@ namespace dbaui
sal_Int32 CountTableAlias(const String& rName, sal_Int32& rMax);
// ein Feld einfuegen (wird einfach an das Elter weitergereicht
- void InsertField(const OTableFieldDesc& rInfo);
+ void InsertField(const OTableFieldDescRef& rInfo);
// alles (TabWins, Connections) neu aufbauen (PRECONDITION : vorher wurde ClearAll gerufen)
virtual void ReSync();
diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx
index 6afbb12ebb7e..959356dde98a 100644
--- a/dbaccess/source/ui/inc/querycontroller.hxx
+++ b/dbaccess/source/ui/inc/querycontroller.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.hxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: oj $ $Date: 2001-10-01 11:57:41 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,7 +103,9 @@
#ifndef DBAUI_QUERYCONTAINERWINDOW_HXX
#include "querycontainerwindow.hxx"
#endif
-
+#ifndef DBAUI_TABLEFIELDDESC_HXX
+#include "TableFieldDescription.hxx"
+#endif
class VCLXWindow;
namespace dbaui
@@ -115,9 +117,11 @@ namespace dbaui
class OAddTableDlg;
class OTableFieldDesc;
class OQueryTableWindow;
+
class OQueryController : public OJoinController
{
- ::std::vector<OTableFieldDesc*> m_vTableFieldDesc;
+ OTableFields m_vTableFieldDesc;
+ OTableFields m_vUnUsedFieldsDesc; // contains fields which aren't visible and don't have any criteria
OQueryParseContext* m_pParseContext;
::connectivity::OSQLParser* m_pSqlParser; // to parse sql statements
@@ -161,9 +165,9 @@ namespace dbaui
virtual FeatureState GetState(sal_uInt16 nId);
// execute a feature
virtual void Execute(sal_uInt16 nId);
- virtual ToolBox* CreateToolBox(Window* pParent);
+ virtual ToolBox* CreateToolBox(Window* pParent);
- virtual void reconnect( sal_Bool _bUI );
+ virtual void reconnect( sal_Bool _bUI );
OQueryContainerWindow* getContainer() { return static_cast< OQueryContainerWindow* >( getView() ); }
@@ -172,7 +176,10 @@ namespace dbaui
OQueryController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM);
~OQueryController();
- ::std::vector<OTableFieldDesc*>* getTableFieldDesc() { return &m_vTableFieldDesc; }
+ OTableFields& getTableFieldDesc() { return m_vTableFieldDesc; }
+ OTableFields& getUnUsedFields() { return m_vUnUsedFieldsDesc; }
+
+ void clearFields();
virtual void setModified(sal_Bool _bModified=sal_True);
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
index 8be452bbfb8d..2c03323bae1c 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QTableConnectionData.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2001-07-19 09:27:16 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -178,23 +178,23 @@ OQueryTableConnectionData& OQueryTableConnectionData::operator=(const OQueryTabl
}
//------------------------------------------------------------------------------
-void OQueryTableConnectionData::InitFromDrag(const OTableFieldDesc& rDragLeft, const OTableFieldDesc& rDragRight)
+void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight)
{
DBG_CHKTHIS(OQueryTableConnectionData,NULL);
// die Infos in rDrag in Parameter fuer das Basisklassen-Init umsetzen ...
- OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft.GetTabWindow());
- OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight.GetTabWindow());
+ OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
+ OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
OSL_ENSURE(pSourceWin,"NO Source window found!");
OSL_ENSURE(pDestWin,"NO Dest window found!");
Init(pSourceWin->GetWinName(), pDestWin->GetWinName());
// und dann meine Members setzen
- SetFieldIndex(JTCS_FROM, rDragLeft.GetFieldIndex());
- SetFieldIndex(JTCS_TO, rDragRight.GetFieldIndex());
+ SetFieldIndex(JTCS_FROM, rDragLeft->GetFieldIndex());
+ SetFieldIndex(JTCS_TO, rDragRight->GetFieldIndex());
- SetFieldType(JTCS_FROM, rDragLeft.GetFieldType());
- SetFieldType(JTCS_TO, rDragRight.GetFieldType());
+ SetFieldType(JTCS_FROM, rDragLeft->GetFieldType());
+ SetFieldType(JTCS_TO, rDragRight->GetFieldType());
m_strSourceTableName = pSourceWin->GetTableName();
m_aSourceWinName = pSourceWin->GetWinName();
@@ -202,7 +202,7 @@ void OQueryTableConnectionData::InitFromDrag(const OTableFieldDesc& rDragLeft, c
m_strDestTableName = pDestWin->GetTableName();
m_aDestWinName = pDestWin->GetWinName();
- AppendConnLine((::rtl::OUString)rDragLeft.GetField(),(::rtl::OUString)rDragRight.GetField());
+ AppendConnLine((::rtl::OUString)rDragLeft->GetField(),(::rtl::OUString)rDragRight->GetField());
}
// -----------------------------------------------------------------------------
OTableConnectionData* OQueryTableConnectionData::NewInstance() const
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
index 0655814715bf..db292323ecf0 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QTableConnectionData.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2001-02-06 13:04:59 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,9 @@
#ifndef _RTTI_HXX
#include <tools/rtti.hxx>
#endif
+//#ifndef DBAUI_QUERYCONTROLLER_HXX
+//#include "querycontroller.hxx"
+//#endif
namespace dbaui
{
@@ -119,7 +122,7 @@ namespace dbaui
ETableFieldType GetFieldType(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_eDestType : m_eFromType; }
void SetFieldType(EConnectionSide nWhich, ETableFieldType eType) { if (nWhich==JTCS_TO) m_eDestType=eType; else m_eFromType=eType; }
- void InitFromDrag(const OTableFieldDesc& rDragLeft, const OTableFieldDesc& rDragRight);
+ void InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight);
EJoinType GetJoinType() const { return m_eJoinType; };
void SetJoinType(const EJoinType& eJT) { m_eJoinType = eJT; };
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 32c3cf95a825..d5c9221e1aa0 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.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2001-06-28 14:22:47 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -335,23 +335,22 @@ void OQueryTableWindow::OnEntryDoubleClicked(SvLBoxEntry* pEntry)
DBG_ASSERT(pInf != NULL, "OQueryTableWindow::OnEntryDoubleClicked : Feld hat keine FieldInfo !");
// eine DragInfo aufbauen
- OTableFieldDesc aInfo;
- aInfo.SetTabWindow(this);
- aInfo.SetField(m_pListBox->GetEntryText(pEntry));
- aInfo.SetTable(GetTableName());
- aInfo.SetAlias(GetAliasName());
- aInfo.SetDatabase(GetComposedName());
- aInfo.SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
- aInfo.SetDataType(pInf->GetDataType());
+ OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(),m_pListBox->GetEntryText(pEntry));
+ aInfo->SetTabWindow(this);
+ aInfo->SetAlias(GetAliasName());
+ aInfo->SetDatabase(GetComposedName());
+ aInfo->SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
+ aInfo->SetDataType(pInf->GetDataType());
// und das entsprechende Feld einfuegen
static_cast<OQueryTableView*>(getTableView())->InsertField(aInfo);
}
//------------------------------------------------------------------------------
-sal_Bool OQueryTableWindow::ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDesc& rInfo)
+sal_Bool OQueryTableWindow::ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDescRef& rInfo)
{
DBG_ASSERT(m_pListBox != NULL, "OQueryTableWindow::ExistsField : habe keine ::com::sun::star::form::ListBox !");
+ OSL_ENSURE(rInfo.isValid(),"OQueryTableWindow::ExistsField: invlid argument for OTableFieldDescRef!");
Reference< XConnection> xConnection = getTableView()->getDesignView()->getController()->getConnection();
sal_Bool bExists = sal_False;
if(xConnection.is())
@@ -366,13 +365,13 @@ sal_Bool OQueryTableWindow::ExistsField(const ::rtl::OUString& strFieldName, OTa
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());
+ 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;
}
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.hxx b/dbaccess/source/ui/querydesign/QTableWindow.hxx
index 1d61a5366053..8cb7aba8a731 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QTableWindow.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-23 09:46:40 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,7 +100,7 @@ namespace dbaui
sal_Int32 GetAliasNum() const { return m_nAliasNum; }
- BOOL ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDesc& rInfo);
+ BOOL ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDescRef& rInfo);
BOOL ExistsAVisitedConn() const;
protected:
diff --git a/dbaccess/source/ui/querydesign/QTableWindowData.hxx b/dbaccess/source/ui/querydesign/QTableWindowData.hxx
index 2e2fd0a7eecd..0fa4fc31e4a9 100644
--- a/dbaccess/source/ui/querydesign/QTableWindowData.hxx
+++ b/dbaccess/source/ui/querydesign/QTableWindowData.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QTableWindowData.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-08-27 06:57:23 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,7 +64,8 @@
#ifndef DBAUI_TABLEWINDOWDATA_HXX
#include "TableWindowData.hxx"
#endif
-#ifndef _VECTOR_
+#ifndef INCLUDED_VECTOR
+#define INCLUDED_VECTOR
#include <vector>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
index e03bee2316ee..cecf50b58318 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignFieldUndoAct.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-20 08:13:25 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -137,14 +137,14 @@ namespace dbaui
class OTabFieldUndoAct : public OQueryDesignFieldUndoAct
{
protected:
- OTableFieldDesc* pDescr; // geloeschte Spaltenbeschreibung
+ OTableFieldDescRef pDescr; // geloeschte Spaltenbeschreibung
BOOL m_bOwnerOfDescription;
public:
OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, USHORT nCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, nCommentID) { }
- virtual ~OTabFieldUndoAct() { if (m_bOwnerOfDescription) delete pDescr; }
+ virtual ~OTabFieldUndoAct() { pDescr = NULL; }
- void SetTabFieldDescr(OTableFieldDesc* pDescription) { pDescr = pDescription; }
+ void SetTabFieldDescr(OTableFieldDescRef pDescription) { pDescr = pDescription; }
// anschliessend bitte SetOwnership
void SetOwnership(BOOL bTakeIt) { m_bOwnerOfDescription = bTakeIt; }
};
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 54d34b52b943..77c366d038eb 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.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: oj $ $Date: 2001-09-27 09:48:55 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -390,9 +390,9 @@ void OQueryDesignView::SaveTabWinUIConfig(OQueryTableWindow* pWin)
static_cast<OQueryController*>(getController())->SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos());
}
// -----------------------------------------------------------------------------
-sal_Bool OQueryDesignView::InsertField( const OTableFieldDesc& rInfo, sal_Bool bVis, sal_Bool bActivate)
+sal_Bool OQueryDesignView::InsertField( const OTableFieldDescRef& rInfo, sal_Bool bVis, sal_Bool bActivate)
{
- if(!m_pSelectionBox->InsertField( rInfo, -1,bVis, bActivate ))
+ if(!m_pSelectionBox->InsertField( rInfo, -1,bVis, bActivate ).isValid())
{
ErrorBox aBox(this, ModuleRes( ERR_QRY_TOO_MANY_COLUMNS));
aBox.Execute();
@@ -403,8 +403,9 @@ sal_Bool OQueryDesignView::InsertField( const OTableFieldDesc& rInfo, sal_Bool b
// -----------------------------------------------------------------------------
sal_Bool OQueryDesignView::getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, sal_uInt32& nWidth )
{
- ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getController())->getTableFieldDesc()->begin();
- for(;aIter != static_cast<OQueryController*>(getController())->getTableFieldDesc()->end();++aIter)
+ OTableFields& aFields = static_cast<OQueryController*>(getController())->getTableFieldDesc();
+ OTableFields::iterator aIter = aFields.begin();
+ for(;aIter != aFields.end();++aIter)
{
if( rAliasName == (*aIter)->GetFieldAlias())
{
@@ -519,10 +520,10 @@ long OQueryDesignView::PreNotify(NotifyEvent& rNEvt)
// -----------------------------------------------------------------------------
sal_Bool OQueryDesignView::HasFields()
{
- ::std::vector<OTableFieldDesc*>* pList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
- ::std::vector<OTableFieldDesc*>::iterator aIter = pList->begin();
+ OTableFields& aList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
+ OTableFields::iterator aIter = aList.begin();
::rtl::OUString aFieldName;
- for(;aIter != pList->end();++aIter)
+ for(;aIter != aList.end();++aIter)
{
aFieldName = (*aIter)->GetField();
if (aFieldName.getLength() != 0 && (*aIter)->IsVisible())
@@ -629,17 +630,16 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName);
return aCondition;
}
//------------------------------------------------------------------------------
-::rtl::OUString OQueryDesignView::GenerateSelectList(::std::vector<OTableFieldDesc*>* _pFieldList,sal_Bool bAlias)
+::rtl::OUString OQueryDesignView::GenerateSelectList(OTableFields& _rFieldList,sal_Bool bAlias)
{
-
::rtl::OUString aTmpStr,aFieldListStr;
sal_Bool bAsterix = sal_False;
int nVis = 0;
- ::std::vector<OTableFieldDesc*>::iterator aIter = _pFieldList->begin();
- for(;aIter != _pFieldList->end();++aIter)
+ OTableFields::iterator aIter = _rFieldList.begin();
+ for(;aIter != _rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
if(pEntryField->IsVisible())
{
if(pEntryField->GetField().toChar() == '*')
@@ -657,10 +657,10 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName);
Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData();
::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
- aIter = _pFieldList->begin();
- for(;aIter != _pFieldList->end();++aIter)
+ aIter = _rFieldList.begin();
+ for(;aIter != _rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
::rtl::OUString rFieldName = pEntryField->GetField();
if (rFieldName.getLength() && pEntryField->IsVisible())
{
@@ -894,16 +894,24 @@ sal_Bool OQueryDesignView::checkStatement()
//------------------------------------------------------------------------------
::rtl::OUString OQueryDesignView::getStatement()
{
- // ----------------- Feldliste aufbauen ----------------------
- // erst die Felder zaehlen
+ // used for fields which aren't any longer in the statement
+ OTableFields& rUnUsedFields = static_cast<OQueryController*>(getController())->getUnUsedFields();
+
+ // create the select columns
sal_uInt32 nFieldcount = 0;
- ::std::vector<OTableFieldDesc*>* pFieldList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
- ::std::vector<OTableFieldDesc*>::iterator aIter = pFieldList->begin();
- for(;aIter != pFieldList->end();++aIter)
+ OTableFields& rFieldList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
+ OTableFields::iterator aIter = rFieldList.begin();
+ for(;aIter != rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
if(pEntryField->GetField().getLength() && pEntryField->IsVisible())
nFieldcount++;
+ else if(pEntryField->GetField().getLength() &&
+ !pEntryField->HasCriteria() &&
+ pEntryField->GetFunctionType() == FKT_NONE &&
+ pEntryField->GetOrderDir() == ORDER_NONE &&
+ !pEntryField->GetFunction().getLength())
+ rUnUsedFields.push_back(pEntryField);
}
if(!nFieldcount) // keine Felder sichtbar also zur"uck
return ::rtl::OUString();
@@ -911,7 +919,7 @@ sal_Bool OQueryDesignView::checkStatement()
OQueryTableView::OTableWindowMap* pTabList = m_pTableView->GetTabWinMap();
sal_uInt32 nTabcount = pTabList->size();
- ::rtl::OUString aFieldListStr(GenerateSelectList(pFieldList,nTabcount>1));
+ ::rtl::OUString aFieldListStr(GenerateSelectList(rFieldList,nTabcount>1));
if( !aFieldListStr.getLength() )
return ::rtl::OUString();
// Ausnahmebehandlung, wenn keine Felder angegeben worden sind
@@ -922,13 +930,13 @@ sal_Bool OQueryDesignView::checkStatement()
::std::vector<OTableConnection*>* pConnList = m_pTableView->GetTabConnList();
::rtl::OUString aTableListStr(GenerateFromClause(pTabList,pConnList));
- DBG_ASSERT(aTableListStr.getLength(), "OQueryDesignView::GenerateSQL() : unerwartet : habe Felder, aber keine Tabellen !");
+ DBG_ASSERT(aTableListStr.getLength(), "OQueryDesignView::getStatement() : unerwartet : habe Felder, aber keine Tabellen !");
// wenn es Felder gibt, koennen die nur durch Einfuegen aus einer schon existenten Tabelle entstanden sein; wenn andererseits
// eine Tabelle geloescht wird, verschwinden auch die zugehoerigen Felder -> ergo KANN es das nicht geben, dass Felder
// existieren, aber keine Tabellen (und aFieldListStr hat schon eine Laenge, das stelle ich oben sicher)
::rtl::OUString aHavingStr,aCriteriaListStr;
// ----------------- Kriterien aufbauen ----------------------
- if (!GenerateCriterias(aCriteriaListStr,aHavingStr,pFieldList, nTabcount > 1))
+ if (!GenerateCriterias(aCriteriaListStr,aHavingStr,rFieldList, nTabcount > 1))
return ::rtl::OUString();
::rtl::OUString aJoinCrit;
@@ -959,7 +967,7 @@ sal_Bool OQueryDesignView::checkStatement()
aSqlCmd += aCriteriaListStr;
}
// ----------------- GroupBy aufbauen und Anh"angen ------------
- aSqlCmd += GenerateGroupBy(pFieldList,nTabcount > 1);
+ aSqlCmd += GenerateGroupBy(rFieldList,nTabcount > 1);
// ----------------- having Anh"angen ------------
if(aHavingStr.getLength())
{
@@ -967,12 +975,12 @@ sal_Bool OQueryDesignView::checkStatement()
aSqlCmd += aHavingStr;
}
// ----------------- Sortierung aufbauen und Anh"angen ------------
- aSqlCmd += GenerateOrder(pFieldList,nTabcount > 1);
+ aSqlCmd += GenerateOrder(rFieldList,nTabcount > 1);
return aSqlCmd;
}
//------------------------------------------------------------------------------
-::rtl::OUString OQueryDesignView::GenerateGroupBy(::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti )
+::rtl::OUString OQueryDesignView::GenerateGroupBy(OTableFields& _rFieldList, sal_Bool bMulti )
{
Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
@@ -983,10 +991,10 @@ sal_Bool OQueryDesignView::checkStatement()
::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
::rtl::OUString aGroupByStr;
- ::std::vector<OTableFieldDesc*>::iterator aIter = pFieldList->begin();
- for(;aIter != pFieldList->end();++aIter)
+ OTableFields::iterator aIter = _rFieldList.begin();
+ for(;aIter != _rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
if(pEntryField->IsGroupBy())
{
DBG_ASSERT(pEntryField->GetField().getLength(),"Kein FieldName vorhanden!;-(");
@@ -1010,19 +1018,16 @@ sal_Bool OQueryDesignView::checkStatement()
return aGroupByStr;
}
//------------------------------------------------------------------------------
-sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUString& rHavingStr/*,::rtl::OUString& rOrderStr*/, ::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti )
+sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUString& rHavingStr, OTableFields& _rFieldList, sal_Bool bMulti )
{
-
- DBG_ASSERT( pFieldList!=0, "OQueryDesignView::GenerateCriterias" );
-
// * darf keine Filter enthalten : habe ich die entsprechende Warnung schon angezeigt ?
sal_Bool bCritsOnAsterikWarning = sal_False; // ** TMFS **
::rtl::OUString aFieldName,aCriteria,aWhereStr,aHavingStr,aWork/*,aOrderStr*/;
// Zeilenweise werden die Ausdr"ucke mit AND verknuepft
sal_uInt16 nMaxCriteria = 0;
- ::std::vector<OTableFieldDesc*>::iterator aIter = pFieldList->begin();
- for(;aIter != pFieldList->end();++aIter)
+ OTableFields::iterator aIter = _rFieldList.begin();
+ for(;aIter != _rFieldList.end();++aIter)
{
nMaxCriteria = ::std::max<sal_uInt16>(nMaxCriteria,(*aIter)->GetCriteria().size());
}
@@ -1036,9 +1041,9 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
{
aHavingStr = aWhereStr = ::rtl::OUString();
- for(aIter = pFieldList->begin();aIter != pFieldList->end();++aIter)
+ for(aIter = _rFieldList.begin();aIter != _rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
aFieldName = pEntryField->GetField();
if (!aFieldName.getLength())
@@ -1185,7 +1190,7 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
//------------------------------------------------------------------------------
-::rtl::OUString OQueryDesignView::GenerateOrder( ::std::vector<OTableFieldDesc*>* pFieldList,sal_Bool bMulti )
+::rtl::OUString OQueryDesignView::GenerateOrder( OTableFields& _rFieldList,sal_Bool bMulti )
{
::rtl::OUString aRetStr, aColumnName;
@@ -1198,11 +1203,11 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS
::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString();
// * darf keine Filter enthalten : habe ich die entsprechende Warnung schon angezeigt ?
sal_Bool bCritsOnAsterikWarning = sal_False; // ** TMFS **
- ::std::vector<OTableFieldDesc*>::iterator aIter = pFieldList->begin();
+ OTableFields::iterator aIter = _rFieldList.begin();
- for(;aIter != pFieldList->end();++aIter)
+ for(;aIter != _rFieldList.end();++aIter)
{
- OTableFieldDesc* pEntryField = *aIter;
+ OTableFieldDescRef pEntryField = *aIter;
EOrderDir eOrder = pEntryField->GetOrderDir();
// nur wenn eine Sortierung und ein Tabellenname vorhanden ist-> erzeugen
@@ -1351,7 +1356,7 @@ sal_Int32 OQueryDesignView::GetColumnFormatKey(const ::connectivity::OSQLParseNo
return nFormatKey;
}
//------------------------------------------------------------------------------
-sal_Bool OQueryDesignView::FillDragInfo(const ::connectivity::OSQLParseNode* pColumnRef,OTableFieldDesc& aDragInfo)
+sal_Bool OQueryDesignView::FillDragInfo(const ::connectivity::OSQLParseNode* pColumnRef,OTableFieldDescRef& _rDragInfo)
{
sal_Bool bErg = sal_False;
@@ -1364,11 +1369,11 @@ sal_Bool OQueryDesignView::FillDragInfo(const ::connectivity::OSQLParseNode* pCo
if (aTableRange.getLength())
{
OQueryTableWindow* pSTW = static_cast<OQueryTableView*>(m_pTableView)->FindTable( aTableRange );
- if(pSTW && pSTW->ExistsField( aColumnName, aDragInfo ) )
+ if(pSTW && pSTW->ExistsField( aColumnName, _rDragInfo ) )
bErg = sal_True;
}
if(!bErg)
- bErg = static_cast<OQueryTableView*>(m_pTableView)->FindTableFromField(aColumnName, aDragInfo, nCntAccount);
+ bErg = static_cast<OQueryTableView*>(m_pTableView)->FindTableFromField(aColumnName, _rDragInfo, nCntAccount);
return bErg;
}
@@ -1502,7 +1507,7 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
else if((SQL_ISRULE(pCondition,like_predicate)))
{
::rtl::OUString aCondition;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
if(SQL_ISRULE(pCondition->getChild(0), column_ref ))
{
::rtl::OUString aColumnName;
@@ -1540,7 +1545,7 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
SQL_ISRULE(pCondition,all_or_any_predicate) || SQL_ISRULE(pCondition,between_predicate)))
{
::rtl::OUString aCondition;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
if(SQL_ISRULE(pCondition->getChild(0), column_ref ))
{
// parse condition
@@ -1568,7 +1573,7 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
else if((SQL_ISRULE(pCondition,existence_test) || SQL_ISRULE(pCondition,unique_test)))
{
::rtl::OUString aCondition;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
// Funktions-Bedingung parsen
Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
@@ -1583,8 +1588,8 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon
m_sDecimalSep.toChar());
}
- aDragLeft.SetField(aCondition);
- aDragLeft.SetFunctionType(FKT_CONDITION);
+ aDragLeft->SetField(aCondition);
+ aDragLeft->SetFunctionType(FKT_CONDITION);
m_pSelectionBox->InsertField(aDragLeft,-1,sal_False,sal_True);
}
@@ -1606,24 +1611,25 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
if(SQL_ISRULE(pCondition->getChild(0), column_ref ) || SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref ))
{
::rtl::OUString aCondition;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
sal_uInt32 nPos;
if(SQL_ISRULE(pCondition->getChild(0), column_ref ) && SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref ))
{
- OTableFieldDesc aDragRight;
+ OTableFieldDescRef aDragRight = new OTableFieldDesc();
if (!FillDragInfo(pCondition->getChild(0),aDragLeft) ||
!FillDragInfo(pCondition->getChild(2),aDragRight))
return nRet;
- OQueryTableConnection* pConn = static_cast<OQueryTableConnection*>(m_pTableView->GetTabConn(static_cast<OQueryTableWindow*>(aDragLeft.GetTabWindow()),static_cast<OQueryTableWindow*>(aDragRight.GetTabWindow())));
+ OQueryTableConnection* pConn = static_cast<OQueryTableConnection*>(m_pTableView->GetTabConn(static_cast<OQueryTableWindow*>(aDragLeft->GetTabWindow()),
+ static_cast<OQueryTableWindow*>(aDragRight->GetTabWindow())));
if(pConn)
{
::std::vector<OConnectionLineData*>* pLineDataList = pConn->GetData()->GetConnLineDataList();
::std::vector<OConnectionLineData*>::iterator aIter = pLineDataList->begin();
for(;aIter != pLineDataList->end();++aIter)
{
- if((*aIter)->GetSourceFieldName() == aDragLeft.GetField() ||
- (*aIter)->GetDestFieldName() == aDragLeft.GetField() )
+ if((*aIter)->GetSourceFieldName() == aDragLeft->GetField() ||
+ (*aIter)->GetDestFieldName() == aDragLeft->GetField() )
break;
}
if(aIter != pLineDataList->end())
@@ -1704,7 +1710,7 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
if(FillDragInfo(pCondition->getChild(nPos),aDragLeft))
{
if(bHaving)
- aDragLeft.SetGroupBy(sal_True);
+ aDragLeft->SetGroupBy(sal_True);
m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
}
else
@@ -1717,7 +1723,7 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
{
::rtl::OUString aName,
aCondition;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
OSQLParseNode* pFunction = pCondition->getChild(0);
@@ -1754,28 +1760,28 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
static_cast<OQueryController*>(getController())->getNumberFormatter(),
m_aLocale,
m_sDecimalSep.toChar());
- aDragLeft.SetField(sParameterValue);
+ aDragLeft->SetField(sParameterValue);
}
- aDragLeft.SetFunctionType(FKT_AGGREGATE);
+ aDragLeft->SetFunctionType(FKT_AGGREGATE);
if(bHaving)
- aDragLeft.SetGroupBy(sal_True);
+ aDragLeft->SetGroupBy(sal_True);
sal_Int32 nIndex = 0;
- aDragLeft.SetFunction(aColumnName.getToken(0,'(',nIndex));
+ aDragLeft->SetFunction(aColumnName.getToken(0,'(',nIndex));
}
else
{
// bei unbekannten Funktionen wird der gesamte Text in das Field gechrieben
- aDragLeft.SetField(aColumnName);
+ aDragLeft->SetField(aColumnName);
if(bHaving)
- aDragLeft.SetGroupBy(sal_True);
- aDragLeft.SetFunctionType(FKT_OTHER);
+ aDragLeft->SetGroupBy(sal_True);
+ aDragLeft->SetFunctionType(FKT_OTHER);
}
m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
}
}
else // kann sich nur um einen Expr. Ausdruck handeln
{
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
::rtl::OUString aName,aCondition;
::connectivity::OSQLParseNode *pLhs = pCondition->getChild(0);
@@ -1800,8 +1806,8 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode *
m_sDecimalSep.toChar());
}
- aDragLeft.SetField(aName);
- aDragLeft.SetFunctionType(FKT_OTHER);
+ aDragLeft->SetField(aName);
+ aDragLeft->SetFunctionType(FKT_OTHER);
// und anh"angen
m_pSelectionBox->AddCondition(aDragLeft, aCondition, nLevel);
}
@@ -1903,12 +1909,13 @@ sal_Bool OQueryDesignView::InsertJoinConnection(const ::connectivity::OSQLParseN
pNode->getChild(1)->getNodeType() == SQL_NODE_EQUAL))
return sal_False;
- OTableFieldDesc aDragLeft, aDragRight;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
+ OTableFieldDescRef aDragRight = new OTableFieldDesc();
if (!FillDragInfo(pNode->getChild(0),aDragLeft) ||
!FillDragInfo(pNode->getChild(2),aDragRight))
return sal_False;
- OQueryTableConnection* pConn = static_cast<OQueryTableConnection*>( m_pTableView->GetTabConn(static_cast<OQueryTableWindow*>(aDragLeft.GetTabWindow()),static_cast<OQueryTableWindow*>(aDragRight.GetTabWindow())));
+ OQueryTableConnection* pConn = static_cast<OQueryTableConnection*>( m_pTableView->GetTabConn(static_cast<OQueryTableWindow*>(aDragLeft->GetTabWindow()),static_cast<OQueryTableWindow*>(aDragRight->GetTabWindow())));
if(!pConn)
{
OQueryTableConnectionData aInfoData;
@@ -1922,10 +1929,10 @@ sal_Bool OQueryDesignView::InsertJoinConnection(const ::connectivity::OSQLParseN
}
else
{
- ::rtl::OUString aSourceFieldName(aDragLeft.GetField());
- ::rtl::OUString aDestFieldName(aDragRight.GetField());
+ ::rtl::OUString aSourceFieldName(aDragLeft->GetField());
+ ::rtl::OUString aDestFieldName(aDragRight->GetField());
// the connection could point on the other side
- if(pConn->GetSourceWin() == aDragRight.GetTabWindow())
+ if(pConn->GetSourceWin() == aDragRight->GetTabWindow())
{
::rtl::OUString aTmp(aSourceFieldName);
aSourceFieldName = aDestFieldName;
@@ -2069,6 +2076,12 @@ void OQueryDesignView::InitFromParseNode()
GetGroupCriteria(pParseTree);
GetHavingCriteria(pParseTree,nLevel);
GetOrderCriteria(pParseTree);
+ // now we have to insert the fields which aren't in the statement
+ OTableFields& rUnUsedFields = static_cast<OQueryController*>(getController())->getUnUsedFields();
+ for(OTableFields::iterator aIter = rUnUsedFields.begin();aIter != rUnUsedFields.end();++aIter)
+ if(m_pSelectionBox->InsertField(*aIter,-1,sal_False,sal_False).isValid())
+ (*aIter) = NULL;
+ OTableFields().swap( rUnUsedFields );
}
}
else
@@ -2087,6 +2100,7 @@ void OQueryDesignView::InitFromParseNode()
// Durch das Neuerzeugen wurden wieder Undo-Actions in den Manager gestellt
static_cast<OQueryController*>(getController())->getUndoMgr()->Clear();
+ m_pSelectionBox->Invalidate();
}
// -----------------------------------------------------------------------------
int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode, OJoinTableView::OTableWindowMap* pTabList )
@@ -2105,7 +2119,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
{
// SELECT * ...
- OTableFieldDesc aInfo;
+ OTableFieldDescRef aInfo = new OTableFieldDesc();
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
for(;aIter != pTabList->end();++aIter)
{
@@ -2132,7 +2146,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
if (SQL_ISRULE(pColumnRef,select_sublist))
{
- OTableFieldDesc aInfo;
+ OTableFieldDescRef aInfo = new OTableFieldDesc();
OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin();
for(;aIter != pTabList->end();++aIter)
{
@@ -2157,7 +2171,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
pColumnRef = pColumnRef->getChild(0);
if (SQL_ISRULE(pColumnRef,column_ref))
{
- OTableFieldDesc aInfo;
+ OTableFieldDescRef aInfo = new OTableFieldDesc();
switch(InsertColumnRef(pColumnRef,aColumnName,aColumnAlias,aTableRange,aInfo,pTabList))
{
case 5:
@@ -2173,7 +2187,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) ||
SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct))
{
- OTableFieldDesc aInfo;
+ OTableFieldDescRef aInfo = new OTableFieldDesc();
::rtl::OUString aColumns;
pColumnRef->parseNodeToStr( aColumns,
xMetaData,
@@ -2203,31 +2217,31 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
if (pTabWin->ExistsField( ::rtl::OUString::createFromAscii("*"), aInfo ))
{
- aInfo.SetAlias(String());
- aInfo.SetTable(String());
+ aInfo->SetAlias(String());
+ aInfo->SetTable(String());
break;
}
}
}
else
{
- aInfo.SetDataType(DataType::DOUBLE);
- aInfo.SetFieldType(TAB_NORMAL_FIELD);
- aInfo.SetField(aColumns);
+ aInfo->SetDataType(DataType::DOUBLE);
+ aInfo->SetFieldType(TAB_NORMAL_FIELD);
+ aInfo->SetField(aColumns);
}
- aInfo.SetTabWindow(NULL);
- aInfo.SetFieldAlias(aColumnAlias);
+ aInfo->SetTabWindow(NULL);
+ aInfo->SetFieldAlias(aColumnAlias);
}
if(SQL_ISRULE(pColumnRef,general_set_fct))
{
- aInfo.SetFunctionType(FKT_AGGREGATE);
+ aInfo->SetFunctionType(FKT_AGGREGATE);
String aCol(aColumns);
- aInfo.SetFunction(aCol.GetToken(0,'(').EraseTrailingChars(' '));
+ aInfo->SetFunction(aCol.GetToken(0,'(').EraseTrailingChars(' '));
}
else
- aInfo.SetFunctionType(FKT_OTHER);
+ aInfo->SetFunctionType(FKT_OTHER);
if(!InsertField(aInfo, sal_True, bFirstField))
return 1;
@@ -2241,13 +2255,13 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode,
&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);
+ OTableFieldDescRef aInfo = new OTableFieldDesc();
+ 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;
@@ -2276,7 +2290,7 @@ void OQueryDesignView::GetOrderCriteria(const ::connectivity::OSQLParseNode* pPa
sal_uInt16 nPos = 0;
EOrderDir eOrderDir;
- OTableFieldDesc aDragLeft;
+ OTableFieldDescRef aDragLeft = new OTableFieldDesc();
for( sal_uInt32 i=0 ; i<pNode->count() ; i++ )
{
eOrderDir = ORDER_ASC;
@@ -2295,12 +2309,12 @@ void OQueryDesignView::GetOrderCriteria(const ::connectivity::OSQLParseNode* pPa
::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController*>(getController())->getParseIterator();
rParseIter.getColumnRange( pChild->getChild(0), aColumnName, aTableRange );
- ::std::vector<OTableFieldDesc*>* pList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
- ::std::vector<OTableFieldDesc*>::iterator aIter = pList->begin();
- for(;aIter != pList->end();++aIter)
+ OTableFields& aList = static_cast<OQueryController*>(getController())->getTableFieldDesc();
+ OTableFields::iterator aIter = aList.begin();
+ for(;aIter != aList.end();++aIter)
{
- OTableFieldDesc* pEntry = *aIter;
- if(pEntry && pEntry->GetFieldAlias() == aColumnName.getStr())
+ OTableFieldDescRef pEntry = *aIter;
+ if(pEntry.isValid() && pEntry->GetFieldAlias() == aColumnName.getStr())
pEntry->SetOrderDir( eOrderDir );
}
}
@@ -2324,14 +2338,14 @@ void OQueryDesignView::GetGroupCriteria(const ::connectivity::OSQLParseNode* pSe
if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf())
{
::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2);
- OTableFieldDesc aDragInfo;
+ OTableFieldDescRef aDragInfo = new OTableFieldDesc();
for( sal_uInt32 i=0 ; i < pGroupBy->count() ; i++ )
{
::connectivity::OSQLParseNode* pColumnRef = pGroupBy->getChild( i );
if(SQL_ISRULE(pColumnRef,column_ref))
{
FillDragInfo(pColumnRef,aDragInfo);
- aDragInfo.SetGroupBy(sal_True);
+ aDragInfo->SetGroupBy(sal_True);
m_pSelectionBox->AddGroupBy(aDragInfo);
}
}
@@ -2374,7 +2388,7 @@ void OQueryDesignView::FillOuterJoins(const ::connectivity::OSQLParseNode* pTabl
}
//------------------------------------------------------------------------------
int OQueryDesignView::InsertColumnRef(const ::connectivity::OSQLParseNode * pColumnRef,::rtl::OUString& aColumnName,const ::rtl::OUString& aColumnAlias,
- ::rtl::OUString& aTableRange,OTableFieldDesc& aInfo, OJoinTableView::OTableWindowMap* pTabList)
+ ::rtl::OUString& aTableRange,OTableFieldDescRef& _raInfo, OJoinTableView::OTableWindowMap* pTabList)
{
// Tabellennamen zusammen setzen
@@ -2390,21 +2404,21 @@ int OQueryDesignView::InsertColumnRef(const ::connectivity::OSQLParseNode * pCol
for(;aIter != pTabList->end();++aIter)
{
OQueryTableWindow* pTabWin = static_cast<OQueryTableWindow*>(aIter->second);
- if (pTabWin->ExistsField( aColumnName, aInfo ) )
+ if (pTabWin->ExistsField( aColumnName, _raInfo ) )
{
if(aColumnName.toChar() != '*')
- aInfo.SetFieldAlias(aColumnAlias);
+ _raInfo->SetFieldAlias(aColumnAlias);
bFound = sal_True;
break;
}
}
if (!bFound)
{
- aInfo.SetTable(::rtl::OUString());
- aInfo.SetAlias(::rtl::OUString());
- aInfo.SetField(aColumnName);
- aInfo.SetFieldAlias(aColumnAlias); // nyi : hier ein fortlaufendes Expr_1, Expr_2 ...
- aInfo.SetFunctionType(FKT_OTHER);
+ _raInfo->SetTable(::rtl::OUString());
+ _raInfo->SetAlias(::rtl::OUString());
+ _raInfo->SetField(aColumnName);
+ _raInfo->SetFieldAlias(aColumnAlias); // nyi : hier ein fortlaufendes Expr_1, Expr_2 ...
+ _raInfo->SetFunctionType(FKT_OTHER);
}
}
else
@@ -2412,18 +2426,18 @@ int OQueryDesignView::InsertColumnRef(const ::connectivity::OSQLParseNode * pCol
// SELECT range.column, ...
OQueryTableWindow* pTabWin = static_cast<OQueryTableView*>(m_pTableView)->FindTable(aTableRange);
- if (pTabWin && pTabWin->ExistsField(aColumnName, aInfo))
+ if (pTabWin && pTabWin->ExistsField(aColumnName, _raInfo))
{
if(aColumnName.toChar() != '*')
- aInfo.SetFieldAlias(aColumnAlias);
+ _raInfo->SetFieldAlias(aColumnAlias);
}
else
{
- aInfo.SetTable(::rtl::OUString());
- aInfo.SetAlias(::rtl::OUString());
- aInfo.SetField(aColumnName);
- aInfo.SetFieldAlias(aColumnAlias); // nyi : hier ein fortlaufendes Expr_1, Expr_2 ...
- aInfo.SetFunctionType(FKT_OTHER);
+ _raInfo->SetTable(::rtl::OUString());
+ _raInfo->SetAlias(::rtl::OUString());
+ _raInfo->SetField(aColumnName);
+ _raInfo->SetFieldAlias(aColumnAlias); // nyi : hier ein fortlaufendes Expr_1, Expr_2 ...
+ _raInfo->SetFunctionType(FKT_OTHER);
}
}
return 0;
@@ -2519,13 +2533,13 @@ void OQueryDesignView::SaveUIConfig()
}
}
// -----------------------------------------------------------------------------
-OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDesc* pEntry,
+OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pEntry,
const String& _sCriteria,
::rtl::OUString& _rsErrorMessage,
Reference<XPropertySet>& _rxColumn)
{
- OSL_ENSURE(pEntry,"Entry is null!");
- if(!pEntry)
+ OSL_ENSURE(pEntry.isValid(),"Entry is null!");
+ if(!pEntry.isValid())
return NULL;
Reference< XConnection> xConnection = static_cast<OQueryController*>(getController())->getConnection();
if(!xConnection.is())
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 42af85ef8672..aade4437aa11 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.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: oj $ $Date: 2001-08-27 14:24:23 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -779,7 +779,7 @@ OQueryTableWindow* OQueryTableView::FindTable(const String& rAliasName)
}
//------------------------------------------------------------------------------
-sal_Bool OQueryTableView::FindTableFromField(const String& rFieldName, OTableFieldDesc& rInfo, sal_uInt16& rCnt)
+sal_Bool OQueryTableView::FindTableFromField(const String& rFieldName, OTableFieldDescRef& rInfo, sal_uInt16& rCnt)
{
DBG_CHKTHIS(OQueryTableView,NULL);
sal_Bool bRet = sal_False;
@@ -1040,7 +1040,7 @@ sal_Bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUn
//------------------------------------------------------------------------
-void OQueryTableView::InsertField(const OTableFieldDesc& rInfo)
+void OQueryTableView::InsertField(const OTableFieldDescRef& rInfo)
{
DBG_CHKTHIS(OQueryTableView,NULL);
DBG_ASSERT(getDesignView() != NULL, "OQueryTableView::InsertField : habe kein Parent !");
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 4ba5b0ac7172..ff41ffe33a67 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.32 $
+ * $Revision: 1.33 $
*
- * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -185,6 +185,9 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent )
// TriState der ::com::sun::star::form::CheckBox abschalten
m_pVisibleCell->GetBox().EnableTriState( sal_False );
+ m_pEmptyEntry = new OTableFieldDesc();
+ m_pEmptyEntry->SetColWidth(DEFAULT_SIZE);
+
Font aTitleFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS_UNICODE,Window::GetSettings().GetLanguage(),DEFAULTFONT_FLAGS_ONLYONE);
aTitleFont.SetSize(Size(0, 6));
SetTitleFont(aTitleFont);
@@ -216,6 +219,8 @@ OSelectionBrowseBox::~OSelectionBrowseBox()
delete m_pTableCell;
delete m_pOrderCell;
delete m_pFunctionCell;
+
+ m_pEmptyEntry = NULL;
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::initialize()
@@ -311,10 +316,7 @@ void OSelectionBrowseBox::PreFill()
OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
- for(;aIter != getFields()->end();++aIter)
- delete *aIter;
- getFields()->clear();
+ pController->clearFields();
sal_uInt16 nCurCol = GetCurColumnId();
long nCurRow = GetCurRow();
@@ -338,8 +340,8 @@ void OSelectionBrowseBox::ClearAll()
OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- ::std::vector<OTableFieldDesc*>::reverse_iterator aIter = getFields()->rbegin();
- for(sal_uInt16 nId=getFields()->size();aIter != getFields()->rend();++aIter,--nId)
+ OTableFields::reverse_iterator aIter = getFields().rbegin();
+ for(sal_uInt16 nId=getFields().size();aIter != getFields().rend();++aIter,--nId)
{
if(!(*aIter)->IsEmpty())
RemoveField(nId);
@@ -369,10 +371,10 @@ CellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId)
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
- DBG_ASSERT(pEntry, "OSelectionBrowseBox::GetController : keine FieldDescription !");
+ OTableFieldDescRef pEntry = getFields()[nColId-1];
+ DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::GetController : keine FieldDescription !");
- if (!pEntry)
+ if (!pEntry.isValid())
return NULL;
if (static_cast<OQueryController*>(getDesignView()->getController())->isReadOnly())
@@ -402,9 +404,9 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- OSL_ENSURE(getFields()->size() > sal_uInt16(nColId-1),"ColID is to great!");
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
- DBG_ASSERT(pEntry, "OSelectionBrowseBox::InitController : keine FieldDescription !");
+
+ OTableFieldDescRef pEntry = getFields()[nColId-1];
+ DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::InitController : keine FieldDescription !");
long nCellIndex = GetRealRow(nRow);
switch (nCellIndex)
@@ -430,10 +432,9 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
case BROW_TABLE_ROW:
{
m_pTableCell->Clear();
+ enableControl(pEntry,m_pTableCell);
if(pEntry->GetFunctionType() != FKT_CONDITION)
{
- m_pTableCell->Enable();
- m_pTableCell->EnableInput(sal_True);
OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap();
if (pTabWinList)
{
@@ -448,29 +449,13 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
m_pTableCell->SelectEntry(String(ModuleRes(STR_QUERY_NOTABLE)));
}
}
- else
- {
- m_pTableCell->Disable();
- m_pTableCell->EnableInput(sal_False);
- }
-
-
} break;
case BROW_VIS_ROW:
{
m_pVisibleCell->GetBox().Check(pEntry->IsVisible());
m_pVisibleCell->GetBox().SaveValue();
- if(pEntry->GetFunctionType() == FKT_CONDITION)
- {
- m_pTextCell->Disable();
- m_pTextCell->EnableInput(sal_False);
- }
- else
- {
- m_pTextCell->Enable();
- m_pTextCell->EnableInput(sal_True);
- }
+ enableControl(pEntry,m_pTextCell);
if(!pEntry->IsVisible() && pEntry->GetOrderDir() != ORDER_NONE && !m_bOrderByUnRelated)
{
@@ -486,42 +471,11 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
}
} break;
case BROW_ORDER_ROW:
- {
m_pOrderCell->SelectEntryPos(pEntry->GetOrderDir());
- if(pEntry->GetFunctionType() == FKT_CONDITION)
- {
- m_pOrderCell->Disable();
- m_pOrderCell->EnableInput(sal_False);
- }
- else
- {
- m_pOrderCell->Enable();
- m_pOrderCell->EnableInput(sal_True);
- }
- } break;
+ enableControl(pEntry,m_pOrderCell);
+ break;
case BROW_COLUMNALIAS_ROW:
- {
-
- m_pTextCell->SetText(pEntry->GetFieldAlias());
- m_pTextCell->ClearModifyFlag();
- if (!m_pTextCell->HasFocus())
- m_pTextCell->GrabFocus();
-
- if(pEntry->GetFunctionType() == FKT_CONDITION)
- {
- m_pTextCell->Disable();
- m_pTextCell->EnableInput(sal_False);
- }
- else
- {
- m_pTextCell->Enable();
- m_pTextCell->EnableInput(sal_True);
- }
- if (m_pTextCell->GetHelpId() != HID_QRYDGN_ROW_ALIAS)
- // da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen
- m_pTextCell->SetHelpText(String());
- m_pTextCell->SetHelpId(HID_QRYDGN_ROW_ALIAS);
- }
+ setTextCellContext(pEntry,pEntry->GetFieldAlias(),HID_QRYDGN_ROW_ALIAS);
break;
case BROW_FUNCTION_ROW:
{
@@ -541,16 +495,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
else
m_pFunctionCell->SelectEntryPos(0);
- if(pEntry->GetFunctionType() == FKT_CONDITION)
- {
- m_pFunctionCell->Disable();
- m_pFunctionCell->EnableInput(sal_False);
- }
- else
- {
- m_pFunctionCell->Enable();
- m_pFunctionCell->EnableInput(sal_True);
- }
+ enableControl(pEntry,m_pFunctionCell);
}
else
{
@@ -569,21 +514,7 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
default:
{
sal_uInt16 nIdx = nCellIndex-BROW_CRIT1_ROW;
- String aText( pEntry->GetCriteria( nIdx ) );
-
- m_pTextCell->SetText(aText);
- m_pTextCell->ClearModifyFlag();
- if (!m_pTextCell->HasFocus())
- m_pTextCell->GrabFocus();
-
- BOOL bDisable = pEntry->GetFunctionType() == FKT_CONDITION;
- m_pTextCell->Enable(bDisable);
- m_pTextCell->EnableInput(!bDisable);
-
- if (m_pTextCell->GetHelpId() != HID_QRYDGN_ROW_CRIT)
- // da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen
- m_pTextCell->SetHelpText(String());
- m_pTextCell->SetHelpId(HID_QRYDGN_ROW_CRIT);
+ setTextCellContext(pEntry,pEntry->GetCriteria( nIdx ),HID_QRYDGN_ROW_CRIT);
}
}
Controller()->ClearModified();
@@ -593,16 +524,16 @@ void OSelectionBrowseBox::InitController(CellControllerRef& rController, long nR
sal_Bool OSelectionBrowseBox::SaveModified()
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- OTableFieldDesc* pEntry = NULL;
+ OTableFieldDescRef pEntry = NULL;
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
- if(getFields()->size() > sal_uInt16(GetCurColumnId() - 1))
- pEntry = (*getFields())[GetCurColumnId() - 1];
+ if(getFields().size() > sal_uInt16(GetCurColumnId() - 1))
+ pEntry = getEntry(GetCurColumnId() - 1);
- sal_Bool bWasEmpty = pEntry ? pEntry->IsEmpty() : sal_False;
+ sal_Bool bWasEmpty = pEntry.isValid() ? pEntry->IsEmpty() : sal_False;
sal_Bool bError = sal_False;
sal_Bool bListAction = sal_False;
- if (pEntry && Controller().Is() && Controller()->IsModified())
+ if (pEntry.isValid() && Controller().Is() && Controller()->IsModified())
{
// fuer die Undo-Action
String strOldCellContents,sNewValue;
@@ -632,7 +563,8 @@ sal_Bool OSelectionBrowseBox::SaveModified()
String aFieldName(m_pFieldCell->GetText());
if (!aFieldName.Len())
{
- ::std::replace(getFields()->begin(),getFields()->end(),pEntry,new OTableFieldDesc);
+ OTableFieldDescRef aRef = new OTableFieldDesc();
+ ::std::replace(getFields().begin(),getFields().end(),pEntry,aRef);
sal_uInt16 nCol = GetCurColumnId();
for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen
RowModified(i,nCol);
@@ -1064,7 +996,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
}
// habe ich Daten in einer FieldDescription gespeichert, die vorher leer war und es nach den Aenderungen nicht mehr ist ?
- if (pEntry && bWasEmpty && !pEntry->IsEmpty() && !bError)
+ if (pEntry.isValid() && bWasEmpty && !pEntry->IsEmpty() && !bError)
{
// Default auf sichtbar
pEntry->SetVisible(sal_True);
@@ -1096,12 +1028,12 @@ void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const Rectangle& rRect,
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
rDev.SetClipRegion( rRect );
- OTableFieldDesc* pEntry = NULL;
- if(getFields()->size() > sal_uInt16(nColumnId - 1))
- pEntry = (*getFields())[nColumnId - 1];
+ OTableFieldDescRef pEntry = NULL;
+ if(getFields().size() > sal_uInt16(nColumnId - 1))
+ pEntry = getFields()[nColumnId - 1];
- if (!pEntry)
+ if (!pEntry.isValid())
return;
long nRow = GetRealRow(m_nSeekRow);
@@ -1135,7 +1067,7 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId)
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
// das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn
- DBG_ASSERT((nColId == 0) || (nColId <= getFields()->size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId");
+ DBG_ASSERT((nColId == 0) || (nColId <= getFields().size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId");
// ColId ist bei mir gleichbedeutend mit Position, und da sollte die Bedingung natuerlich zutreffen
sal_uInt16 nCurCol = GetCurColumnId();
@@ -1143,11 +1075,11 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId)
DeactivateCell();
// Spalteninfo rausnehmen und am Ende neues Info einfuegen
- getFields()->erase( getFields()->begin() + ((sal_uInt32)nColId - 1) );
+ getFields().erase( getFields().begin() + ((sal_uInt32)nColId - 1) );
// der Aufrufer ist dafuer verantwortlich, sich vorher die Description zu besorgen und die irgendwie aufzuraeumen
// (im Normalfall wohl erst mal in ein Undo zu schieben)
- OTableFieldDesc* pNew = new OTableFieldDesc();
- getFields()->push_back(pNew);
+ OTableFieldDescRef pNew = new OTableFieldDesc();
+ getFields().push_back(pNew);
// Nachfolgende Spalten optisch verschieben
sal_uInt16 nCount = (sal_uInt16)ColCount();
@@ -1167,10 +1099,7 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId)
pController->setModified();
- pController->InvalidateFeature( ID_BROWSER_UNDO );
- pController->InvalidateFeature( ID_BROWSER_REDO );
- pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
-
+ invalidateUndoRedo();
}
//------------------------------------------------------------------------------
@@ -1179,9 +1108,9 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nId, sal_Bool bActivate)
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
- OSL_ENSURE(getFields()->size() > sal_uInt16(nId-1),"ID is to great!");
+ OSL_ENSURE(getFields().size() > sal_uInt16(nId-1),"ID is to great!");
- OTableFieldDesc* pDesc = (*getFields())[(sal_uInt32)(nId - 1)] ;
+ OTableFieldDescRef pDesc = getEntry((sal_uInt32)(nId - 1)) ;
pDesc->SetColWidth( (sal_uInt16)GetColumnWidth(nId) ); // hat er sich vorher leider nicht gemerkt
// UndoAction erzeugen
@@ -1193,8 +1122,7 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nId, sal_Bool bActivate)
RemoveColumn(nId);
- pController->InvalidateFeature(ID_BROWSER_UNDO);
- pController->InvalidateFeature(ID_BROWSER_REDO);
+ invalidateUndoRedo();
}
//------------------------------------------------------------------------------
@@ -1295,29 +1223,28 @@ sal_Int8 OSelectionBrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& _rEvt
}
//------------------------------------------------------------------------------
-OTableFieldDesc* OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt )
+OTableFieldDescRef OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt )
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
// es koennen mehrere angelegt werden, aber der Erste
// wird returnt
- sal_uInt32 nCount = getFields()->size();
- OTableFieldDesc* pNewDesc;
+ sal_uInt32 nCount = getFields().size();
for (sal_uInt16 i=0 ; i<nCnt ; i++)
{
- pNewDesc = new OTableFieldDesc;
- pNewDesc->SetColWidth(DEFAULT_SIZE);
- getFields()->push_back(pNewDesc);
- InsertDataColumn((sal_uInt16)getFields()->size(), String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND);
+// pNewDesc = new OTableFieldDesc();
+// pNewDesc->SetColWidth(DEFAULT_SIZE);
+ getFields().push_back(m_pEmptyEntry);
+ InsertDataColumn((sal_uInt16)getFields().size(), String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND);
}
- return (*getFields())[nCount];
+ return getFields()[nCount];
}
//------------------------------------------------------------------------------
void OSelectionBrowseBox::DeleteFields(const String& rAliasName)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- if (getFields()->size())
+ if (!getFields().empty())
{
sal_uInt16 nColId = GetCurColumnId();
sal_uInt32 nRow = GetCurRow();
@@ -1326,9 +1253,9 @@ void OSelectionBrowseBox::DeleteFields(const String& rAliasName)
if (bWasEditing)
DeactivateCell();
- ::std::vector<OTableFieldDesc*>::reverse_iterator aIter = getFields()->rbegin();
- OTableFieldDesc* pEntry = NULL;
- for(sal_Int32 nPos=getFields()->size();aIter != getFields()->rend();++aIter,--nPos)
+ OTableFields::reverse_iterator aIter = getFields().rbegin();
+ OTableFieldDescRef pEntry = NULL;
+ for(sal_Int32 nPos=getFields().size();aIter != getFields().rend();++aIter,--nPos)
{
pEntry = *aIter;
if (pEntry->GetAlias() == ::rtl::OUString(rAliasName) )
@@ -1370,8 +1297,8 @@ void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth)
SetColumnWidth(nColId, nNewWidth);
// der FieldDescription Bescheid sagen
- OTableFieldDesc* pEntry = (*getFields())[nColId - 1];
- if (pEntry)
+ OTableFieldDescRef pEntry = getEntry(nColId - 1);
+ if (pEntry.isValid())
pEntry->SetColWidth(sal_uInt16(GetColumnWidth(nColId)));
if (bWasEditing)
@@ -1395,12 +1322,12 @@ Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId )
}
//------------------------------------------------------------------------------
-void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId)
+void OSelectionBrowseBox::InsertColumn(OTableFieldDescRef pEntry, long& nColId)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
// das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn
- DBG_ASSERT(sal_uInt16(nColId == -1) || (nColId <= (long)getFields()->size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId.");
+ DBG_ASSERT(sal_uInt16(nColId == -1) || (nColId <= (long)getFields().size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId.");
// -1 heisst ganz hinten, Count heisst ganz hinten, der Rest bezeichnet eine richtige Position
sal_uInt16 nCurCol = GetCurColumnId();
@@ -1410,33 +1337,32 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId)
// Gueltigkeit von nColId pruefen (ColId von 1 bis ...)
// Wenn zu klein oder zu gross, auf Ende der Liste setzen
- if ((nColId == -1) || (sal_uInt16(nColId) >= getFields()->size())) // Anhaengen des Feldes
+ if ((nColId == -1) || (sal_uInt16(nColId) >= getFields().size())) // Anhaengen des Feldes
{
if (FindFirstFreeCol(nColId) == NULL) // keine freie Column mehr
{
AppendNewCol(1);
- nColId = getFields()->size();
+ nColId = getFields().size();
}
else
nColId++; // innerhalb der vorgegebenen Liste
}
// in Liste der Spaltenbeschreibungen neues Element
- getFields()->insert( getFields()->begin()+(sal_uInt32)nColId-1 ,pEntry);
+ getFields().insert( getFields().begin()+(sal_uInt32)nColId-1 ,pEntry);
// da ich meine Spaltenzahl immer auf dem selben Wert wie die Zahl der FieldDescriptions halten muss (plus 1, da es eine
// HandleClumn gibt), muss ich fuer diese gerade eingefuegte Description auch eine loeschen
long nFirstFreeCol = -1;
CheckFreeColumns(nFirstFreeCol);
// (es kann sein, dass es keine leere gab, dann erzwingt CheckFreeColumns das)
- delete (*getFields())[(sal_uInt16)nFirstFreeCol];
- getFields()->erase(getFields()->begin()+(sal_uInt16)nFirstFreeCol);
+ getFields().erase(getFields().begin()+(sal_uInt16)nFirstFreeCol);
// jetzt kann wieder keine leere Spalte vorhanden sein (falls naemlich die soeben geloeschte die einzige war) ...
CheckFreeColumns(nFirstFreeCol);
// Nachfolgende Spalten optisch verschieben
- sal_uInt16 nCount = (sal_uInt16)getFields()->size();
+ sal_uInt16 nCount = (sal_uInt16)getFields().size();
for (sal_uInt16 i = nCount-1; i > nColId; --i)
SetColumnWidth(i, GetColumnWidth(i - 1));
@@ -1450,13 +1376,11 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId)
ActivateCell( nCurRow, nCurCol );
static_cast<OQueryController*>(getDesignView()->getController())->setModified();
- static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_UNDO );
- static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_REDO );
- static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
+ invalidateUndoRedo();
}
//------------------------------------------------------------------------------
-OTableFieldDesc* OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxdSource, long nColId, sal_Bool bVis, sal_Bool bActivate)
+OTableFieldDescRef OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxdSource, long nColId, sal_Bool bVis, sal_Bool bActivate)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(jxdSource.pListBox->GetTabWin());
@@ -1469,23 +1393,21 @@ OTableFieldDesc* OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxdSo
OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(jxdSource.pEntry->GetUserData());
// eine DragInfo aufbauen, damit ich mich auf das andere InsertField zurueckziehen kann
- OTableFieldDesc aInfo;
- aInfo.SetTabWindow(pSourceWin);
- aInfo.SetFieldIndex(nFieldIndex);
- aInfo.SetFieldType(pInf->GetKeyType());
- aInfo.SetField(aFieldName);
- aInfo.SetTable(pSourceWin->GetTableName());
- aInfo.SetAlias(pSourceWin->GetAliasName());
- aInfo.SetDatabase(pSourceWin->GetComposedName());
+ OTableFieldDescRef aInfo = new OTableFieldDesc(pSourceWin->GetTableName(),aFieldName);
+ aInfo->SetTabWindow(pSourceWin);
+ aInfo->SetFieldIndex(nFieldIndex);
+ aInfo->SetFieldType(pInf->GetKeyType());
+ aInfo->SetAlias(pSourceWin->GetAliasName());
+ aInfo->SetDatabase(pSourceWin->GetComposedName());
- aInfo.SetDataType(pInf->GetDataType());
- aInfo.SetVisible(bVis);
+ aInfo->SetDataType(pInf->GetDataType());
+ aInfo->SetVisible(bVis);
return InsertField(aInfo, nColId, bVis, bActivate);
}
//------------------------------------------------------------------------------
-OTableFieldDesc* OSelectionBrowseBox::InsertField(const OTableFieldDesc& rInfo, long nColId, sal_Bool bVis, sal_Bool bActivate)
+OTableFieldDescRef OSelectionBrowseBox::InsertField(const OTableFieldDescRef& _rInfo, long nColId, sal_Bool bVis, sal_Bool bActivate)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
@@ -1495,10 +1417,10 @@ OTableFieldDesc* OSelectionBrowseBox::InsertField(const OTableFieldDesc& rInfo,
SaveModified();
// Neue Spaltenbeschreibung
- OTableFieldDesc* pEntry = new OTableFieldDesc(rInfo);
+ OTableFieldDescRef pEntry = _rInfo;//new OTableFieldDesc(*_rInfo);
pEntry->SetVisible(bVis);
sal_uInt32 nColWidth;
- if( getDesignView()->getColWidth(rInfo.GetAlias(), rInfo.GetField(), nColWidth) )
+ if( getDesignView()->getColWidth(_rInfo->GetAlias(), _rInfo->GetField(), nColWidth) )
pEntry->SetColWidth( (sal_uInt16)nColWidth );
else
pEntry->SetColWidth( (sal_uInt16)DEFAULT_SIZE );
@@ -1522,12 +1444,12 @@ sal_uInt16 OSelectionBrowseBox::FieldsCount()
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
+ OTableFields::iterator aIter = getFields().begin();
sal_uInt16 nCount = 0;
- while (aIter != getFields()->end())
+ while (aIter != getFields().end())
{
- if ((*aIter) && !(*aIter)->IsEmpty())
+ if ((*aIter).isValid() && !(*aIter)->IsEmpty())
nCount++;
++aIter;
}
@@ -1536,17 +1458,17 @@ sal_uInt16 OSelectionBrowseBox::FieldsCount()
}
//------------------------------------------------------------------------------
-OTableFieldDesc* OSelectionBrowseBox::FindFirstFreeCol( long& rCol )
+OTableFieldDescRef OSelectionBrowseBox::FindFirstFreeCol( long& rCol )
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
+ OTableFields::iterator aIter = getFields().begin();
rCol = -1;
- while (aIter != getFields()->end())
+ while (aIter != getFields().end())
{
++rCol;
- if ((*aIter) && (*aIter)->IsEmpty())
+ if ((*aIter).isValid() && (*aIter)->IsEmpty())
return *aIter;
++aIter;
}
@@ -1562,37 +1484,37 @@ void OSelectionBrowseBox::CheckFreeColumns(long& rCol)
{
// es ist voll, also einen Packen Spalten anhaengen
AppendNewCol(DEFAULT_QUERY_COLS);
- OSL_VERIFY(FindFirstFreeCol(rCol));
+ OSL_VERIFY(FindFirstFreeCol(rCol).isValid());
}
}
//------------------------------------------------------------------------------
-void OSelectionBrowseBox::AddGroupBy( const OTableFieldDesc& rInfo )
+void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo )
{
Reference< XConnection> xConnection = static_cast<OQueryController*>(getDesignView()->getController())->getConnection();
if(!xConnection.is())
return;
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- DBG_ASSERT(!rInfo.IsEmpty(),"AddGroupBy:: OTableFieldDesc sollte nicht Empty sein!");
- OTableFieldDesc* pEntry;
+ DBG_ASSERT(!rInfo->IsEmpty(),"AddGroupBy:: OTableFieldDescRef sollte nicht Empty sein!");
+ OTableFieldDescRef pEntry;
::comphelper::UStringMixEqual bCase(xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
- for(;aIter != getFields()->end();++aIter)
+ OTableFields::iterator aIter = getFields().begin();
+ for(;aIter != getFields().end();++aIter)
{
pEntry = *aIter;
- OSL_ENSURE(pEntry,"OTableFieldDesc was null!");
+ OSL_ENSURE(pEntry.isValid(),"OTableFieldDescRef was null!");
::rtl::OUString aField = pEntry->GetField();
::rtl::OUString aAlias = pEntry->GetAlias();
- if (bCase(aField,rInfo.GetField()) &&
- bCase(aAlias,rInfo.GetAlias()) &&
- pEntry->GetFunctionType() == rInfo.GetFunctionType())
+ if (bCase(aField,rInfo->GetField()) &&
+ bCase(aAlias,rInfo->GetAlias()) &&
+ pEntry->GetFunctionType() == rInfo->GetFunctionType())
{
- if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy()))
+ if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo->IsGroupBy()))
pEntry->SetGroupBy(sal_False);
else
{
- pEntry->SetGroupBy(rInfo.IsGroupBy());
+ pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
@@ -1600,40 +1522,41 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDesc& rInfo )
}
}
- if (aIter == getFields()->end())
+ if (aIter == getFields().end())
{
- OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False );
- if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen
+ OTableFieldDescRef pTmp = InsertField(rInfo, -1, sal_False, sal_False );
+ if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo->IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen
pTmp->SetGroupBy(sal_False);
}
}
//------------------------------------------------------------------------------
-void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const String& rValue, const sal_uInt16 nLevel, const char* pOp )
+void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const String& rValue, const sal_uInt16 nLevel, const char* pOp )
{
Reference< XConnection> xConnection = static_cast<OQueryController*>(getDesignView()->getController())->getConnection();
if(!xConnection.is())
return;
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- DBG_ASSERT(!rInfo.IsEmpty(),"AddCondition:: OTableFieldDesc sollte nicht Empty sein!");
- OTableFieldDesc* pEntry;
+ DBG_ASSERT(rInfo.isValid() && !rInfo->IsEmpty(),"AddCondition:: OTableFieldDescRef sollte nicht Empty sein!");
+
+ OTableFieldDescRef pEntry;
::comphelper::UStringMixEqual bCase(xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
- for(;aIter != getFields()->end();++aIter)
+ OTableFields::iterator aIter = getFields().begin();
+ for(;aIter != getFields().end();++aIter)
{
pEntry = *aIter;
::rtl::OUString aField = pEntry->GetField();
::rtl::OUString aAlias = pEntry->GetAlias();
- if (bCase(aField,rInfo.GetField()) &&
- bCase(aAlias,rInfo.GetAlias()) &&
- pEntry->GetFunctionType() == rInfo.GetFunctionType())
+ if (bCase(aField,rInfo->GetField()) &&
+ bCase(aAlias,rInfo->GetAlias()) &&
+ pEntry->GetFunctionType() == rInfo->GetFunctionType())
{
- if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy()))
+ if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo->IsGroupBy()))
pEntry->SetGroupBy(sal_False);
else
{
- pEntry->SetGroupBy(rInfo.IsGroupBy());
+ pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
@@ -1651,12 +1574,12 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const Stri
}
}
- if (aIter == getFields()->end())
+ if (aIter == getFields().end())
{
- OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False );
- if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen
+ OTableFieldDescRef pTmp = InsertField(rInfo, -1, sal_False, sal_False );
+ if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo->IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen
pTmp->SetGroupBy(sal_False);
- if(pTmp)
+ if(pTmp.isValid())
{
pTmp->SetCriteria( nLevel, rValue);
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
@@ -1670,47 +1593,47 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const Stri
}
//------------------------------------------------------------------------------
-void OSelectionBrowseBox::AddOrder( const OTableFieldDesc& rInfo, const EOrderDir eDir, sal_uInt16& nPos )
+void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt16& nPos )
{
Reference< XConnection> xConnection = static_cast<OQueryController*>(getDesignView()->getController())->getConnection();
if(!xConnection.is())
return;
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- DBG_ASSERT(!rInfo.IsEmpty(),"AddOrder:: OTableFieldDesc sollte nicht Empty sein!");
+ DBG_ASSERT(!rInfo->IsEmpty(),"AddOrder:: OTableFieldDescRef sollte nicht Empty sein!");
// nPos merkt sich die Spalte in die Sortierung eingetragen wird,
// da weitere Sortierungen nur dahinter abgelegt werden duerfen
- OTableFieldDesc* pEntry;
+ OTableFieldDescRef pEntry;
::comphelper::UStringMixEqual bCase(xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
- ::std::vector<OTableFieldDesc*>::iterator aIter = getFields()->begin();
- for(;aIter != getFields()->end();++aIter)
+ OTableFields::iterator aIter = getFields().begin();
+ for(;aIter != getFields().end();++aIter)
{
pEntry = *aIter;
::rtl::OUString aField = pEntry->GetField();
::rtl::OUString aAlias = pEntry->GetAlias();
- if (bCase(aField,rInfo.GetField()) &&
- bCase(aAlias,rInfo.GetAlias()))
+ if (bCase(aField,rInfo->GetField()) &&
+ bCase(aAlias,rInfo->GetAlias()))
{
if(!m_bOrderByUnRelated)
pEntry->SetVisible(sal_True);
pEntry->SetOrderDir( eDir );
- nPos = getFields()->end() - aIter;
+ nPos = getFields().end() - aIter;
break;
}
}
- if (aIter == getFields()->end())
+ if (aIter == getFields().end())
{
- OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False );
- if(pTmp)
+ OTableFieldDescRef pTmp = InsertField(rInfo, -1, sal_False, sal_False );
+ if(pTmp.isValid())
{
if(!m_bOrderByUnRelated)
pTmp->SetVisible(sal_True);
pTmp->SetOrderDir( eDir );
}
- nPos = (sal_uInt16)( getFields()->size()-1 );
+ nPos = (sal_uInt16)( getFields().size()-1 );
}
}
@@ -1740,7 +1663,8 @@ void OSelectionBrowseBox::CellModified()
{
case BROW_VIS_ROW:
{
- OTableFieldDesc* pEntry = (*getFields())[GetCurColumnId() - 1];
+ OTableFieldDescRef pEntry = getEntry(GetCurColumnId() - 1);
+
sal_Bool bOldValue = pEntry->IsVisible();
sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos();
@@ -1754,18 +1678,6 @@ void OSelectionBrowseBox::CellModified()
}
else
pEntry->SetVisible(m_pVisibleCell->GetBox().IsChecked());
- // m_pVisibleCell->GetBox().SaveValue();
-
-// if(bOldValue != pEntry->IsVisible())
-// {
-// String strOldCellContents = bOldValue ? g_strOne : g_strZero;
-// // und noch die Undo-Action fuer das Ganze
-// OTabFieldCellModifiedUndoAct* pUndoAct = new OTabFieldCellModifiedUndoAct(this);
-// pUndoAct->SetCellIndex(GetCurRow());
-// pUndoAct->SetColId(GetCurColumnId());
-// pUndoAct->SetCellContents(strOldCellContents);
-// static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->AddUndoAction(pUndoAct);
-// }
}
break;
}
@@ -1962,7 +1874,7 @@ void OSelectionBrowseBox::SetNoneVisbleRow(long nRows)
String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
+ OTableFieldDescRef pEntry = getFields()[nColId-1];
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... ");
if(pEntry->IsEmpty())
return String();
@@ -2047,7 +1959,7 @@ String OSelectionBrowseBox::GetCellContents(sal_uInt16 nCellIndex, long nColId)
// DBG_ASSERT(nCellIndex < (GetRowCount()-1),"CellIndex ist zu gross");
SaveModified();
- OTableFieldDesc* pEntry = (*getFields())[nColId - 1];
+ OTableFieldDescRef pEntry = getFields()[nColId - 1];
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellContents : invalid column id, prepare for GPF ... ");
switch (nCellIndex)
@@ -2074,7 +1986,7 @@ void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const St
if (bWasEditing)
DeactivateCell();
- OTableFieldDesc* pEntry = (*getFields())[nColId - 1];
+ OTableFieldDescRef pEntry = getEntry(nColId - 1);
DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::SetCellContents : invalid column id, prepare for GPF ... ");
@@ -2127,9 +2039,9 @@ void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const St
sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) const
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
- if (!pEntry)
- return DEFAULT_SIZE;
+// OTableFieldDescRef pEntry = getFields()[nColId-1];
+// if (!pEntry.isValid())
+// return DEFAULT_SIZE;
long nRowId = GetRealRow(nRow);
if (nRowId == BROW_VIS_ROW)
@@ -2148,13 +2060,13 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId)
// but the changes aren't permanent ...
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- DBG_ASSERT(nColId <= getFields()->size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!");
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
- DBG_ASSERT(pEntry, "OSelectionBrowseBox::ColumnResized : keine FieldDescription !");
+ DBG_ASSERT(nColId <= getFields().size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!");
+ OTableFieldDescRef pEntry = getEntry(nColId-1);
+ DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::ColumnResized : keine FieldDescription !");
static_cast<OQueryController*>(getDesignView()->getController())->setModified();
EditBrowseBox::ColumnResized(nColId);
- if (pEntry)
+ if (pEntry.isValid())
{
OTabFieldSizedUndoAct* pUndo = new OTabFieldSizedUndoAct(this);
pUndo->SetColId(nColId);
@@ -2168,10 +2080,10 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId)
sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId)
{
DBG_CHKTHIS(OSelectionBrowseBox,NULL);
- DBG_ASSERT((nColId == 0) || (nColId <= getFields()->size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId");
+ DBG_ASSERT((nColId == 0) || (nColId <= getFields().size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId");
- OTableFieldDesc* pEntry = (*getFields())[nColId-1];
- DBG_ASSERT(pEntry!=NULL, "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !");
+ OTableFieldDescRef pEntry = getFields()[nColId-1];
+ DBG_ASSERT(pEntry.isValid(), "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !");
long nRow = GetRealRow(nRowId);
String strText(GetCellText(nRow, nColId));
@@ -2225,10 +2137,7 @@ void OSelectionBrowseBox::cut()
SaveModified();
RowModified(GetBrowseRow(nRow), GetCurColumnId());
- OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- pController->InvalidateFeature( ID_BROWSER_UNDO );
- pController->InvalidateFeature( ID_BROWSER_REDO );
- pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
+ invalidateUndoRedo();
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::paste()
@@ -2245,10 +2154,7 @@ void OSelectionBrowseBox::paste()
m_pTextCell->SetModifyFlag();
}
RowModified(GetBrowseRow(nRow), GetCurColumnId());
- OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
- pController->InvalidateFeature( ID_BROWSER_UNDO );
- pController->InvalidateFeature( ID_BROWSER_REDO );
- pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
+ invalidateUndoRedo();
}
// -----------------------------------------------------------------------------
void OSelectionBrowseBox::copy()
@@ -2300,11 +2206,56 @@ void OSelectionBrowseBox::startTimer()
m_timerInvalidate.Start();
}
// -----------------------------------------------------------------------------
-::std::vector<OTableFieldDesc*>* OSelectionBrowseBox::getFields() const
+OTableFields& OSelectionBrowseBox::getFields() const
{
OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController());
return pController->getTableFieldDesc();
}
// -----------------------------------------------------------------------------
+void OSelectionBrowseBox::enableControl(const OTableFieldDescRef& _rEntry,Window* _pControl)
+{
+ BOOL bEnable = _rEntry->GetFunctionType() != FKT_CONDITION;
+ _pControl->Enable(bEnable);
+ _pControl->EnableInput(bEnable);
+}
+// -----------------------------------------------------------------------------
+void OSelectionBrowseBox::setTextCellContext(const OTableFieldDescRef& _rEntry,const String& _sText,ULONG _nHelpId)
+{
+ m_pTextCell->SetText(_sText);
+ m_pTextCell->ClearModifyFlag();
+ if (!m_pTextCell->HasFocus())
+ m_pTextCell->GrabFocus();
+
+ enableControl(_rEntry,m_pTextCell);
+
+ if (m_pTextCell->GetHelpId() != _nHelpId)
+ // da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen
+ m_pTextCell->SetHelpText(String());
+ m_pTextCell->SetHelpId(_nHelpId);
+}
+// -----------------------------------------------------------------------------
+void OSelectionBrowseBox::invalidateUndoRedo()
+{
+ OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController()));
+ pController->InvalidateFeature( ID_BROWSER_UNDO );
+ pController->InvalidateFeature( ID_BROWSER_REDO );
+ pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE );
+}
+// -----------------------------------------------------------------------------
+OTableFieldDescRef OSelectionBrowseBox::getEntry(OTableFields::size_type _nPos)
+{
+ // we have to check if we need a new entry at this position
+ OTableFields& aFields = getFields();
+ OSL_ENSURE(aFields.size() > _nPos,"ColID is to great!");
+ OTableFieldDescRef pEntry = aFields[_nPos];
+ OSL_ENSURE(pEntry.isValid(),"Invalid entry!");
+ if(pEntry == m_pEmptyEntry)
+ {
+ pEntry = new OTableFieldDesc();
+ aFields[_nPos] = pEntry;
+ }
+ return pEntry;
+}
+// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index b68c4dfa5df7..e29089767fdf 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: SelectionBrowseBox.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-09-27 06:19:01 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,9 +64,9 @@
#ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
#include <svtools/editbrowsebox.hxx>
#endif
-#ifndef _VECTOR_
-#include <vector>
-#endif
+//#ifndef DBAUI_QUERYCONTROLLER_HXX
+//#include "querycontroller.hxx"
+//#endif
#ifndef DBAUI_TABLEFIELDDESC_HXX
#include "TableFieldDescription.hxx"
#endif
@@ -125,6 +125,8 @@ namespace dbaui
::svt::ListBoxControl* m_pTableCell;
::svt::ListBoxControl* m_pOrderCell;
+ OTableFieldDescRef m_pEmptyEntry; // default entry in the list may reference more than once
+
sal_Int32 m_nMaxColumns; // maximale Anzahl der Spalten in einem Select-Statement
String m_aFunctionStrings;
@@ -138,20 +140,20 @@ namespace dbaui
~OSelectionBrowseBox();
void initialize();
- OTableFieldDesc* InsertField( const OJoinExchangeData& jxdSource, long nColId=-1, sal_Bool bVis=sal_True, sal_Bool bActivate=sal_True );
- OTableFieldDesc* InsertField( const OTableFieldDesc& rInfo, long nCol=-1, sal_Bool bVis=sal_True, sal_Bool bActivate=sal_True );
- void InsertColumn( OTableFieldDesc* pEntry, long& nColId );
+ OTableFieldDescRef InsertField( const OJoinExchangeData& jxdSource, long nColId=-1, sal_Bool bVis=sal_True, sal_Bool bActivate=sal_True );
+ OTableFieldDescRef InsertField( const OTableFieldDescRef& rInfo, long nCol=-1, sal_Bool bVis=sal_True, sal_Bool bActivate=sal_True );
+ void InsertColumn( OTableFieldDescRef pEntry, long& nColId );
void RemoveColumn( sal_uInt16 nColId );
void DeleteFields( const String& rAliasName );
// AddGroupBy:: F"ugt ein Feld mit Funktion == Grupierung. Falls das Feld schon vorhanden ist und ein Aggregate Funktion
// benutzt, wird das Flag nicht gesetzt
- void AddGroupBy( const OTableFieldDesc& rInfo );
- void AddCondition( const OTableFieldDesc& rInfo,
+ void AddGroupBy( const OTableFieldDescRef& rInfo );
+ void AddCondition( const OTableFieldDescRef& rInfo,
const String& rValue,
const sal_uInt16 nLevel, const char* pOp=0 );
- void AddOrder(const OTableFieldDesc& rInfo, const EOrderDir eDir, sal_uInt16& nPos);
+ void AddOrder(const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt16& nPos);
void ClearAll();
- OTableFieldDesc* AppendNewCol( sal_uInt16 nCnt=1 );
+ OTableFieldDescRef AppendNewCol( sal_uInt16 nCnt=1 );
sal_Bool Save();
OQueryDesignView* getDesignView();
OQueryDesignView* getDesignView() const;
@@ -186,8 +188,6 @@ namespace dbaui
virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
-// virtual sal_Bool QueryDrop(const BrowserDropEvent& rEvt);
-// virtual sal_Bool Drop(const BrowserDropEvent& rEvt);
virtual void MouseButtonDown( const BrowserMouseEvent& rEvt );
virtual void MouseButtonUp( const BrowserMouseEvent& rEvt );
virtual void KeyInput( const KeyEvent& rEvt );
@@ -213,21 +213,25 @@ namespace dbaui
void startTimer();
private:
- OTableFieldDesc* FindFirstFreeCol(long & rCol);
+ OTableFieldDescRef FindFirstFreeCol(long & rCol);
// rCol enthaelt die Nummer (in pOTableFieldDescList) der ersten Spalte, die von sich sagt, dass sie leer ist
// wenn es keine solche gibt, ist rCol undefiniert und der Rueckgabewert NULL
void CheckFreeColumns(long& rCol);
// testet, ob es noch freie Spalten gibt, wenn nicht, wird ein neuer Packen angefuegt
// rCol enthaelt die Nummer der ersten freien Spalte (in pOTableFieldDescList)
- void RemoveField( sal_uInt16 nId, sal_Bool bActivate = sal_True);
- Rectangle GetInvalidRect( sal_uInt16 nColId );
- long GetRealRow(long nRow) const;
- long GetBrowseRow(long nRowId) const;
- sal_Bool GetFunktionName(String& rFkt);
- void appendUndoAction(const String& _rOldValue,const String& _rNewValue,sal_Int32 _nRow);
- void PreFill();
- ::std::vector<OTableFieldDesc*>* getFields() const;
+ void RemoveField( sal_uInt16 nId, sal_Bool bActivate = sal_True);
+ Rectangle GetInvalidRect( sal_uInt16 nColId );
+ long GetRealRow(long nRow) const;
+ long GetBrowseRow(long nRowId) const;
+ sal_Bool GetFunktionName(String& rFkt);
+ void appendUndoAction(const String& _rOldValue,const String& _rNewValue,sal_Int32 _nRow);
+ void PreFill();
+ OTableFields& getFields() const;
+ void enableControl(const OTableFieldDescRef& _rEntry,Window* _pControl);
+ void setTextCellContext(const OTableFieldDescRef& _rEntry,const String& _sText,ULONG _nHelpId);
+ void invalidateUndoRedo();
+ OTableFieldDescRef getEntry(OTableFields::size_type _nPos);
};
}
#endif // DBAUI_QUERYDESIGN_OSELECTIONBROWSEBOX_HXX
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index 6189e37edf74..9c4f1c2315c1 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableFieldDescription.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-02-05 09:21:47 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,11 +113,11 @@ OTableFieldDesc::OTableFieldDesc(const OTableFieldDesc& rRS)
m_eFieldType(rRS.GetFieldType()),
m_nIndex(rRS.GetFieldIndex()),
m_eFunctionType( rRS.GetFunctionType() ),
- m_bGroupBy(rRS.IsGroupBy())
+ m_bGroupBy(rRS.IsGroupBy()),
+ m_vecCriteria( rRS.m_vecCriteria)
{
DBG_CTOR(OTableFieldDesc,NULL);
- m_vecCriteria = rRS.GetCriteria();
}
//------------------------------------------------------------------------------
@@ -204,6 +204,7 @@ sal_Bool OTableFieldDesc::IsNumericDataType() const
case DataType::INTEGER:
case DataType::REAL:
case DataType::DOUBLE:
+ case DataType::BIGINT:
case DataType::DECIMAL:
case DataType::NUMERIC:
bErg = sal_True;
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 8b967b7e5ae5..b45435ebb322 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: querycontroller.cxx,v $
*
- * $Revision: 1.59 $
+ * $Revision: 1.60 $
*
- * last change: $Author: oj $ $Date: 2001-10-02 08:30:19 $
+ * last change: $Author: oj $ $Date: 2001-10-05 06:49:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -298,12 +298,8 @@ void OQueryController::disposing()
delete m_pSqlParser;
delete m_pParseContext;
- {
- ::std::vector< OTableFieldDesc*>::iterator aIter = m_vTableFieldDesc.begin();
- for(;aIter != m_vTableFieldDesc.end();++aIter)
- delete *aIter;
- m_vTableFieldDesc.clear();
- }
+ clearFields();
+ OTableFields().swap(m_vUnUsedFieldsDesc);
m_pView = NULL;
@@ -311,6 +307,11 @@ void OQueryController::disposing()
OJoinController::disposing();
}
// -----------------------------------------------------------------------------
+void OQueryController::clearFields()
+{
+ OTableFields().swap(m_vTableFieldDesc);
+}
+// -----------------------------------------------------------------------------
FeatureState OQueryController::GetState(sal_uInt16 _nId)
{
FeatureState aReturn;
@@ -327,10 +328,10 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId)
aReturn.aState = ::cppu::bool2any(m_bEditable);
break;
case ID_BROWSER_SAVEASDOC:
- aReturn.bEnabled = !m_bCreateView && (!m_bDesign || (m_vTableFieldDesc.size() && m_vTableData.size()));
+ aReturn.bEnabled = !m_bCreateView && (!m_bDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty()));
break;
case ID_BROWSER_SAVEDOC:
- aReturn.bEnabled = m_bModified && (!m_bDesign || (m_vTableFieldDesc.size() && m_vTableData.size()));
+ aReturn.bEnabled = m_bModified && (!m_bDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty()));
break;
case SID_PRINTDOCDIRECT:
break;
@@ -348,7 +349,7 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId)
aReturn.aState = ::cppu::bool2any(m_bDesign);
break;
case ID_BROWSER_CLEAR_QUERY:
- aReturn.bEnabled = m_bEditable && (m_sStatement.getLength() || m_vTableData.size());
+ aReturn.bEnabled = m_bEditable && (m_sStatement.getLength() || !m_vTableData.empty());
break;
case ID_BROWSER_QUERY_VIEW_FUNCTIONS:
case ID_BROWSER_QUERY_VIEW_TABLES:
@@ -751,7 +752,7 @@ OJoinDesignView* OQueryController::getJoinView()
sal_Bool SAL_CALL OQueryController::suspend(sal_Bool bSuspend) throw( RuntimeException )
{
sal_Bool bRet = sal_True;
- if(isConnected() && m_bModified && (!m_bDesign || (m_vTableFieldDesc.size() && m_vTableData.size())))
+ if(isConnected() && m_bModified && (!m_bDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())))
{
QueryBox aQry(getView(), ModuleRes(m_bCreateView ? QUERY_VIEW_DESIGN_SAVEMODIFIED : QUERY_DESIGN_SAVEMODIFIED));
switch (aQry.Execute())
@@ -856,7 +857,7 @@ void OQueryController::Save(const Reference< XObjectOutputStream>& _rxOut)
// the fielddata
_rxOut << (sal_Int32)m_vTableFieldDesc.size();
- ::std::vector<OTableFieldDesc*>::const_iterator aFieldIter = m_vTableFieldDesc.begin();
+ OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin();
for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter)
{
if(!(*aFieldIter)->IsEmpty())
@@ -876,16 +877,13 @@ void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn)
//////////////////////////////////////////////////////////////////////
// Liste loeschen
- ::std::vector< OTableFieldDesc*>::iterator aFieldIter = m_vTableFieldDesc.begin();
- for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter)
- delete *aFieldIter;
- m_vTableFieldDesc.clear();
+ OTableFields().swap(m_vTableFieldDesc);
sal_Int32 nCount = 0;
_rxIn >> nCount;
for(sal_Int32 j=0;j<nCount;++j)
{
- OTableFieldDesc* pData = new OTableFieldDesc();
+ OTableFieldDescRef pData = new OTableFieldDesc();
pData->Load(_rxIn);
m_vTableFieldDesc.push_back(pData);
}
@@ -1011,16 +1009,6 @@ void OQueryController::executeQuery()
OSL_ENSURE(0,"Couldn't create a beamer window!");
}
}
-// else
-// {
-// sal_Bool bAllEmpty = sal_True;
-// ::std::vector< OTableFieldDesc*>::const_iterator aIter = m_vTableFieldDesc.begin();
-// for(;bAllEmpty && aIter != m_vTableFieldDesc.end();++aIter)
-// bAllEmpty = (*aIter)->IsEmpty();
-//
-// ErrorBox aBox(getView(), ModuleRes(bAllEmpty ? ERR_QRY_NOCRITERIA : ERR_QRY_NOSTATEMENT));
-// aBox.Execute();
-// }
}
// -----------------------------------------------------------------------------
String OQueryController::getMenu() const