diff options
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r-- | dbaccess/source/ui/browser/dbtreemodel.hxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbtreeview.cxx | 28 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dbtreeview.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dsbrowserDnD.cxx | 181 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbabrw.src | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.src | 18 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 69 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbadmin.src | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/browserids.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/unodatbr.hxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 17 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 7 |
14 files changed, 286 insertions, 107 deletions
diff --git a/dbaccess/source/ui/browser/dbtreemodel.hxx b/dbaccess/source/ui/browser/dbtreemodel.hxx index 0875fd848b31..ce3a4dc8f785 100644 --- a/dbaccess/source/ui/browser/dbtreemodel.hxx +++ b/dbaccess/source/ui/browser/dbtreemodel.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtreemodel.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-08-15 13:14:59 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,11 @@ namespace com { namespace sun { namespace star { namespace lang { class XMultiSe namespace dbaui { + struct DBTreeEditedEntry + { + SvLBoxEntry* pEntry; + XubString aNewText; + }; //======================================================================== //= DBTreeListModel //======================================================================== diff --git a/dbaccess/source/ui/browser/dbtreeview.cxx b/dbaccess/source/ui/browser/dbtreeview.cxx index b0c900e2746b..cf40bb103e76 100644 --- a/dbaccess/source/ui/browser/dbtreeview.cxx +++ b/dbaccess/source/ui/browser/dbtreeview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtreeview.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: fs $ $Date: 2001-09-06 12:40:39 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -94,7 +94,7 @@ DBTreeView::DBTreeView( Window* pParent, const Reference< XMultiServiceFactory > m_pTreeListBox = new DBTreeListBox(this, _rxORB ,WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT); m_pTreeListBox->EnableCheckButton(NULL); m_pTreeListBox->SetDragDropMode( 0 ); - m_pTreeListBox->EnableInplaceEditing( sal_False ); + m_pTreeListBox->EnableInplaceEditing( sal_True ); m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX); m_pTreeListBox->Show(); } @@ -169,6 +169,26 @@ Link DBTreeView::getDeleteHandler() const return m_pTreeListBox->getDeleteHandler(); } // ----------------------------------------------------------------------------- +void DBTreeView::setEditingHandler(const Link& _rHdl) +{ + m_pTreeListBox->setEditingHandler(_rHdl); +} +// ----------------------------------------------------------------------------- +Link DBTreeView::getEditingHandler() const +{ + return m_pTreeListBox->getEditingHandler(); +} +// ----------------------------------------------------------------------------- +void DBTreeView::setEditedHandler(const Link& _rHdl) +{ + m_pTreeListBox->setEditedHandler(_rHdl); +} +// ----------------------------------------------------------------------------- +Link DBTreeView::getEditedHandler() const +{ + return m_pTreeListBox->getEditedHandler(); +} +// ----------------------------------------------------------------------------- void DBTreeView::Resize() { Window::Resize(); @@ -204,7 +224,7 @@ void DBTreeView::setSelectHdl(const Link& _rHdl) long DBTreeView::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0L; - if(rNEvt.GetType() == EVENT_GETFOCUS && m_pTreeListBox) + if(rNEvt.GetType() == EVENT_GETFOCUS && m_pTreeListBox && !m_pTreeListBox->HasChildPathFocus()) { m_pTreeListBox->GrabFocus(); nDone = 1L; diff --git a/dbaccess/source/ui/browser/dbtreeview.hxx b/dbaccess/source/ui/browser/dbtreeview.hxx index af1979834f04..9ff1549f5efb 100644 --- a/dbaccess/source/ui/browser/dbtreeview.hxx +++ b/dbaccess/source/ui/browser/dbtreeview.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbtreeview.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-07-18 11:33:57 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,6 +109,10 @@ namespace dbaui Link getPasteHandler() const; void setDeleteHandler(const Link& _rHdl); Link getDeleteHandler() const; + void setEditingHandler(const Link& _rHdl); + Link getEditingHandler() const; + void setEditedHandler(const Link& _rHdl); + Link getEditedHandler() const; DBTreeListModel* getModel() const; diff --git a/dbaccess/source/ui/browser/dsbrowserDnD.cxx b/dbaccess/source/ui/browser/dsbrowserDnD.cxx index 19107812f01b..127446ff5f63 100644 --- a/dbaccess/source/ui/browser/dsbrowserDnD.cxx +++ b/dbaccess/source/ui/browser/dsbrowserDnD.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dsbrowserDnD.cxx,v $ * - * $Revision: 1.28 $ + * $Revision: 1.29 $ * - * last change: $Author: oj $ $Date: 2001-09-20 12:56:17 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,9 @@ #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif +#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ +#include <com/sun/star/sdbcx/XRename.hpp> +#endif #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include <com/sun/star/container/XNameContainer.hpp> #endif @@ -932,6 +935,117 @@ namespace dbaui return 0; } // ----------------------------------------------------------------------------- + IMPL_LINK(SbaTableQueryBrowser, OnEditingEntry, SvLBoxEntry*, _pEntry) + { + EntryType eType = getEntryType(_pEntry); + long nRet = 0; + switch(eType) + { + case etQuery: + case etView: + case etTable: + try + { + if(eType == etQuery || isConnectionWriteAble(_pEntry)) + { + ensureObjectExists(_pEntry); + DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pEntry->GetUserData()); + if(pData && pData->xObject.is()) + { + Reference<XRename> xRename(pData->xObject,UNO_QUERY); + if(xRename.is()) + { + ::rtl::OUString sName; + Reference<XPropertySet> xProp(pData->xObject,UNO_QUERY); + xProp->getPropertyValue(PROPERTY_NAME) >>= sName; + m_pTreeView->getListBox()->SetEntryText(_pEntry,sName); + nRet = 1; + } + } + } + } + catch(const Exception&) + { + OSL_ENSURE(0,"Exception catched!"); + } + break; + default: + OSL_ENSURE(0,"Try to rename wrong entry!"); + } + return nRet; + } + // ----------------------------------------------------------------------------- + IMPL_LINK(SbaTableQueryBrowser, OnEditedEntry, DBTreeEditedEntry*, _aEntry) + { + EntryType eType = getEntryType(_aEntry->pEntry); + ::rtl::OUString sOldName; + long nRet = 0; + try + { + switch(eType) + { + case etView: + case etTable: + case etQuery: + if(etQuery == eType || isConnectionWriteAble(_aEntry->pEntry)) + { + DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_aEntry->pEntry->GetUserData()); + OSL_ENSURE(pData && pData->xObject.is(),"Error in editing!"); + if(pData && pData->xObject.is()) + { + ::rtl::OUString sName,sSchema,sCatalog; + ::rtl::OUString sNewName = _aEntry->aNewText; + Reference<XPropertySet> xProp(pData->xObject,UNO_QUERY); + xProp->getPropertyValue(PROPERTY_NAME) >>= sName; + Reference<XConnection> xConnection = getConnectionFromEntry(_aEntry->pEntry); + Reference<XDatabaseMetaData> xMeta = xConnection.is() ? xConnection->getMetaData() : Reference<XDatabaseMetaData>(); + if(etQuery == eType) + sOldName = sName; + else + ::dbaui::composeTableName(xMeta,xProp,sOldName,sal_False); + + if((etQuery == eType || (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers())) ? sName != sNewName : !sNewName.equalsIgnoreAsciiCase(sName)) + { + Reference<XRename> xRename(pData->xObject,UNO_QUERY); + OSL_ENSURE(xRename.is(),"No Xrename interface!"); + if(xRename.is()) + { + xRename->rename(sNewName); + nRet = 1; + if(etQuery != eType) + {// special handling for tables and views + xProp->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema; + xProp->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog; + ::dbtools::composeTableName(xMeta,sCatalog,sSchema,sNewName,sName,sal_False); + sOldName = sName; + } + } + } + } + } + break; + } + } + catch(const SQLException& e) + { + showError(SQLExceptionInfo(e)); + } + catch(const ElementExistException& e) + { + static ::rtl::OUString sStatus = ::rtl::OUString::createFromAscii("S1000"); + String sMsg = String(ModuleRes(STR_OBJECT_ALREADY_EXISTS)); + sMsg.SearchAndReplace('#',e.Message); + showError(SQLExceptionInfo(SQLException(sMsg, e.Context, sStatus, 0, Any()))); + } + catch(const Exception& ) + { + OSL_ENSURE(0,"Exception catched!"); + } + _aEntry->aNewText = sOldName; + + return nRet; + } + // ----------------------------------------------------------------------------- IMPL_LINK(SbaTableQueryBrowser, OnDeleteEntry, SvLBoxEntry*, _pEntry) { EntryType eType = getEntryType(_pEntry); @@ -944,22 +1058,7 @@ namespace dbaui case etTable: { // check if connection is readonly - DBTreeListModel::DBTreeListUserData* pDSData = NULL; - DBTreeListModel::DBTreeListUserData* pEntryData = NULL; - SvLBoxEntry* pDSEntry = NULL; - pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry); - pDSData = pDSEntry - ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData()) - : NULL; - - sal_Bool bIsConnectionWriteAble = sal_False; - if(pDSData && pDSData->xObject.is()) - { - Reference<XConnection> xCon(pDSData->xObject,UNO_QUERY); - if(xCon.is()) - bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly(); - } - if(bIsConnectionWriteAble && (eType == etTable || eType == etView)) + if(isConnectionWriteAble(_pEntry)) implDropTable(_pEntry); } break; @@ -1014,22 +1113,7 @@ namespace dbaui case etTableContainer: { // check if connection is readonly - DBTreeListModel::DBTreeListUserData* pDSData = NULL; - DBTreeListModel::DBTreeListUserData* pEntryData = NULL; - SvLBoxEntry* pDSEntry = NULL; - pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry); - pDSData = pDSEntry - ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData()) - : NULL; - - sal_Bool bIsConnectionWriteAble = sal_False; - if(pDSData && pDSData->xObject.is()) - { - Reference<XConnection> xCon(pDSData->xObject,UNO_QUERY); - if(xCon.is()) - bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly(); - } - bAllowed = bIsConnectionWriteAble && ((eType == etTable || eType == etView || eType == etTableContainer) && isTableFormat()); + bAllowed = isConnectionWriteAble(_pEntry) && isTableFormat(); } break; } @@ -1071,6 +1155,32 @@ namespace dbaui } } // ----------------------------------------------------------------------------- + Reference<XConnection> SbaTableQueryBrowser::getConnectionFromEntry(SvLBoxEntry* _pEntry) const + { + DBTreeListModel::DBTreeListUserData* pDSData = NULL; + DBTreeListModel::DBTreeListUserData* pEntryData = NULL; + SvLBoxEntry* pDSEntry = NULL; + pDSEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry); + pDSData = pDSEntry + ? static_cast<DBTreeListModel::DBTreeListUserData*>(pDSEntry->GetUserData()) + : NULL; + + sal_Bool bIsConnectionWriteAble = sal_False; + Reference<XConnection> xCon; + if(pDSData && pDSData->xObject.is()) + xCon = Reference<XConnection>(pDSData->xObject,UNO_QUERY); + return xCon; + } + // ----------------------------------------------------------------------------- + sal_Bool SbaTableQueryBrowser::isConnectionWriteAble(SvLBoxEntry* _pEntry) const + { + // check if connection is readonly + sal_Bool bIsConnectionWriteAble = sal_False; + Reference<XConnection> xCon = getConnectionFromEntry(_pEntry); + if(xCon.is()) + bIsConnectionWriteAble = !xCon->getMetaData()->isReadOnly(); + return bIsConnectionWriteAble; + } // ......................................................................... } // namespace dbaui // ......................................................................... @@ -1078,6 +1188,9 @@ namespace dbaui /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.28 2001/09/20 12:56:17 oj + * #92232# fixes for BIGINT type and new property HELPTEXT + * * Revision 1.27 2001/08/27 06:57:24 oj * #90015# some speedup's * diff --git a/dbaccess/source/ui/browser/sbabrw.src b/dbaccess/source/ui/browser/sbabrw.src index 7506de800baa..089d2b5dfa0a 100644 --- a/dbaccess/source/ui/browser/sbabrw.src +++ b/dbaccess/source/ui/browser/sbabrw.src @@ -2,9 +2,9 @@ * * $RCSfile: sbabrw.src,v $ * - * $Revision: 1.56 $ + * $Revision: 1.57 $ * - * last change: $Author: kz $ $Date: 2001-09-06 20:18:32 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,7 +68,9 @@ #include "browserids.hxx" #endif // #include <sfx2/sfx.hrc> +#ifndef _GLOBLMN_HRC #include <svx/globlmn.hrc> +#endif #ifndef DBAUI_TOOLBOX_HXX #include "toolbox.hrc" @@ -806,6 +808,7 @@ Menu MENU_BROWSER_QUERYCONTEXT { Separator = TRUE; }; + MenuItem { MID_RENAME_ENTRY }; MenuItem { MID_QUERY_DROP @@ -881,6 +884,7 @@ Menu MENU_BROWSER_TABLECONTEXT Separator = TRUE; }; MenuItem { MID_DROP_TABLE }; + MenuItem { MID_RENAME_ENTRY }; MenuItem { Identifier = ID_TREE_TABLE_COPY ; @@ -980,7 +984,8 @@ Menu MENU_BROWSER_VIEWCONTEXT { Separator = TRUE; }; - MenuItem { MID_DBAUI_DROP_VIEW }; + MenuItem { MID_DBAUI_DROP_VIEW }; + MenuItem { MID_RENAME_ENTRY }; MenuItem { Identifier = ID_TREE_VIEW_COPY ; diff --git a/dbaccess/source/ui/browser/sbagrid.src b/dbaccess/source/ui/browser/sbagrid.src index 67df74d832ee..6fa70dc09999 100644 --- a/dbaccess/source/ui/browser/sbagrid.src +++ b/dbaccess/source/ui/browser/sbagrid.src @@ -2,9 +2,9 @@ * * $RCSfile: sbagrid.src,v $ * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * - * last change: $Author: rt $ $Date: 2001-08-24 10:59:44 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -356,13 +356,9 @@ String STR_VIEW_TITLE Text[ finnish ] = "Ansicht #"; }; - - - - - - - - - +String STR_OBJECT_ALREADY_EXISTS +{ + Text = "Der Name # existiert bereits." ; + Text [ ENGLISH ] = "The name # already exists." ; +}; diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index ffc339ecdbe7..b8372e7a80a3 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.cxx,v $ * - * $Revision: 1.108 $ + * $Revision: 1.109 $ * - * last change: $Author: oj $ $Date: 2001-09-20 12:56:17 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -542,6 +542,8 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry)); m_pTreeView->setPasteHandler(LINK(this, SbaTableQueryBrowser, OnPasteEntry)); m_pTreeView->setDeleteHandler(LINK(this, SbaTableQueryBrowser, OnDeleteEntry)); + m_pTreeView->setEditingHandler(LINK(this, SbaTableQueryBrowser, OnEditingEntry)); + m_pTreeView->setEditedHandler(LINK(this, SbaTableQueryBrowser, OnEditedEntry)); m_pTreeView->getListBox()->setControlActionListener(this); m_pTreeView->SetHelpId(HID_CTL_TREEVIEW); @@ -3268,32 +3270,7 @@ void SbaTableQueryBrowser::implCreateObject( SvLBoxEntry* _pApplyTo, sal_uInt16 if (pQueryTextItem) sCurrentObject = static_cast<SvLBoxString*>(pQueryTextItem)->GetText(); - DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pApplyTo->GetUserData()); - if(!pData->xObject.is()) - { - // the query has not been accessed before -> create it's user data - - Reference<XNameAccess> xNameAccess; - if(ID_EDIT_TABLE == _nAction) - { - Reference<XTablesSupplier> xSup(xConnection,UNO_QUERY); - if(xSup.is()) - xNameAccess = xSup->getTables(); - } - else - { - Reference<XQueriesSupplier> xSup(xConnection,UNO_QUERY); - if(xSup.is()) - xNameAccess = xSup->getQueries(); - } - - SvLBoxItem* pTextItem = _pApplyTo->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); - if (pTextItem) - sCurrentObject = static_cast<SvLBoxString*>(pTextItem)->GetText(); - - if(xNameAccess.is() && xNameAccess->hasByName(sCurrentObject)) // remember the table or query object - xNameAccess->getByName(sCurrentObject) >>= pData->xObject; - } + ensureObjectExists(_pApplyTo); } ODesignAccess* pDispatcher = NULL; @@ -3398,7 +3375,11 @@ void SbaTableQueryBrowser::implRemoveQuery( SvLBoxEntry* _pApplyTo ) } } } - +// ----------------------------------------------------------------------------- +void SbaTableQueryBrowser::implRenameEntry( SvLBoxEntry* _pApplyTo ) +{ + m_pTreeView->getListBox()->EditEntry(_pApplyTo); +} // ----------------------------------------------------------------------------- void SbaTableQueryBrowser::implDropTable( SvLBoxEntry* _pApplyTo ) { @@ -3589,6 +3570,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent ) // 1.3 actions on existing tables aContextMenu.EnableItem(ID_EDIT_TABLE, etTable == eType && bIsConnectionWriteAble); aContextMenu.EnableItem(ID_DROP_TABLE, etTable == eType && bIsConnectionWriteAble); + aContextMenu.EnableItem(ID_RENAME_ENTRY, etTable == eType && bIsConnectionWriteAble); aContextMenu.EnableItem(ID_TREE_TABLE_COPY, etTable == eType); // these have to be disabled if the connection is readonly if(!bIsConnectionWriteAble) @@ -3607,6 +3589,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent ) // 2.3 actions on existing tables aContextMenu.EnableItem(ID_DROP_VIEW, bIsConnectionWriteAble); + aContextMenu.EnableItem(ID_RENAME_ENTRY, bIsConnectionWriteAble); aContextMenu.EnableItem(ID_TREE_VIEW_COPY, sal_True); // these have to be disabled if the connection is readonly @@ -3629,6 +3612,7 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent ) aContextMenu.EnableItem(ID_EDIT_QUERY_DESIGN, etQuery == eType); aContextMenu.EnableItem(ID_DROP_QUERY, etQuery == eType); aContextMenu.EnableItem(ID_TREE_QUERY_COPY, etQuery == eType); + aContextMenu.EnableItem(ID_RENAME_ENTRY, etQuery == eType); } break; @@ -3708,6 +3692,9 @@ sal_Bool SbaTableQueryBrowser::requestContextMenu( const CommandEvent& _rEvent ) case ID_DROP_VIEW: implDropTable( pEntry ); break; + case ID_RENAME_ENTRY: + implRenameEntry(pEntry); + break; case ID_TREE_QUERY_COPY: { @@ -3901,6 +3888,30 @@ sal_Bool SbaTableQueryBrowser::implGetQuerySignature( ::rtl::OUString& _rCommand return sal_False; } +// ----------------------------------------------------------------------------- +void SbaTableQueryBrowser::ensureObjectExists(SvLBoxEntry* _pApplyTo) +{ + // get the name of the object + DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(_pApplyTo->GetUserData()); + if(!pData->xObject.is()) + { + // the object has not been accessed before -> create it's user data + SvLBoxEntry* pEntryParent = m_pTreeView->getListBox()->GetParent(_pApplyTo); + DBTreeListModel::DBTreeListUserData* pParentData = static_cast<DBTreeListModel::DBTreeListUserData*>(pEntryParent->GetUserData()); + if(pParentData && pParentData->xObject.is()) + { + Reference<XNameAccess> xNameAccess(pParentData->xObject,UNO_QUERY); + + ::rtl::OUString sCurrentObject; + SvLBoxItem* pTextItem = _pApplyTo->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); + if (pTextItem) + sCurrentObject = static_cast<SvLBoxString*>(pTextItem)->GetText(); + + if(xNameAccess.is() && xNameAccess->hasByName(sCurrentObject)) // remember the table or query object + xNameAccess->getByName(sCurrentObject) >>= pData->xObject; + } + } +} // ......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/dlg/dbadmin.src b/dbaccess/source/ui/dlg/dbadmin.src index 937f07a7cef2..d5de10e9633f 100644 --- a/dbaccess/source/ui/dlg/dbadmin.src +++ b/dbaccess/source/ui/dlg/dbadmin.src @@ -2,9 +2,9 @@ * * $RCSfile: dbadmin.src,v $ * - * $Revision: 1.71 $ + * $Revision: 1.72 $ * - * last change: $Author: kz $ $Date: 2001-09-06 20:22:00 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2444,6 +2444,11 @@ TabPage PAGE_QUERYADMINISTRATION MID_QUERY_DROP ItemBitmap = Bitmap { File = "querydrop_sc.bmp"; }; }; + ToolBoxItem + { + MID_RENAME_ENTRY + ItemBitmap = Bitmap { File = "rename_sc.bmp"; }; + }; }; }; Control CTL_COLLECTION @@ -3356,6 +3361,9 @@ String STR_HINT_CONNECTION_NOT_CAPABLE /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.71 2001/09/06 20:22:00 kz + * Merge SRC640: 06.09.01 - 22:22:04 (NoBranch) + * * Revision 1.70 2001/08/28 08:21:37 fs * #91573# STR_HINT_READONLY_CONNECTION / STR_HINT_CONNECTION_NOT_CAPABL * diff --git a/dbaccess/source/ui/inc/browserids.hxx b/dbaccess/source/ui/inc/browserids.hxx index ff6540b4ef18..a6f51a35f042 100644 --- a/dbaccess/source/ui/inc/browserids.hxx +++ b/dbaccess/source/ui/inc/browserids.hxx @@ -2,9 +2,9 @@ * * $RCSfile: browserids.hxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: fs $ $Date: 2001-08-16 10:34:02 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -140,6 +140,7 @@ #define ID_DIRECT_SQL 32 #define ID_TREE_QUERY_PASTE 33 #define ID_BROWSER_REFRESH_REBUILD 34 +#define ID_RENAME_ENTRY 35 diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index e41f3f1c0b14..fd45aa79e2ba 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -2,9 +2,9 @@ * * $RCSfile: dbu_resource.hrc,v $ * - * $Revision: 1.61 $ + * $Revision: 1.62 $ * - * last change: $Author: fs $ $Date: 2001-08-28 08:19:41 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -451,6 +451,7 @@ #define STR_COULDNOTCONNECT_DATASOURCE RID_STRING_START + 188 #define STR_HINT_READONLY_CONNECTION RID_STRING_START + 189 #define STR_HINT_CONNECTION_NOT_CAPABLE RID_STRING_START + 190 +#define STR_OBJECT_ALREADY_EXISTS RID_STRING_START + 191 //======================================================================== // untyped resources @@ -465,6 +466,9 @@ /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.61 2001/08/28 08:19:41 fs + * #91573# STR_HINT_READONLY_CONNECTION / STR_HINT_CONNECTION_NOT_CAPABL + * * Revision 1.60 2001/08/16 10:37:03 fs * #90573# +RID_MENU_REFRESH_DATA * diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index 307db3dfa801..e5b92a67125f 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unodatbr.hxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: hr $ $Date: 2001-09-13 14:14:47 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -116,6 +116,7 @@ namespace dbaui class DBTreeView; class DBTreeListModel; + struct DBTreeEditedEntry; // ===================================================================== typedef ::cppu::ImplHelper2 < ::com::sun::star::frame::XStatusListener , ::com::sun::star::view::XSelectionSupplier @@ -332,6 +333,7 @@ namespace dbaui void implCreateObject( SvLBoxEntry* _pApplyTo, sal_uInt16 _nAction ); void implRemoveQuery( SvLBoxEntry* _pApplyTo ); void implDropTable( SvLBoxEntry* _pApplyTo ); + void implRenameEntry( SvLBoxEntry* _pApplyTo ); void implPasteTable( SvLBoxEntry* _pApplyTo, const TransferableDataHelper& _rPasteData ); void implPasteQuery( SvLBoxEntry* _pApplyTo, const TransferableDataHelper& _rPasteData ); @@ -359,6 +361,8 @@ namespace dbaui DECL_LINK( OnCopyEntry, SvLBoxEntry* ); DECL_LINK( OnPasteEntry, SvLBoxEntry* ); DECL_LINK( OnDeleteEntry, SvLBoxEntry* ); + DECL_LINK( OnEditingEntry, SvLBoxEntry* ); + DECL_LINK( OnEditedEntry, DBTreeEditedEntry* ); DECL_LINK( OnTreeEntryCompare, const SvSortData* ); DECL_LINK( OnAsyncDrop, void* ); @@ -450,6 +454,11 @@ namespace dbaui void cutEntry(SvLBoxEntry* _pEntry); void copyEntry(SvLBoxEntry* _pEntry); void pasteEntry(SvLBoxEntry* _pEntry); + // check if the connection where this entry belongs to is writeable + // Entry must be table or view type + sal_Bool isConnectionWriteAble(SvLBoxEntry* _pEntry) const; + void ensureObjectExists(SvLBoxEntry* _pApplyTo); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnectionFromEntry(SvLBoxEntry* _pEntry) const; }; // ......................................................................... diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index fcf244438774..1473ff86875e 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: UITools.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-09-24 12:17:41 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -141,9 +141,6 @@ #ifndef DBAUI_FIELDDESCRIPTIONS_HXX #include "FieldDescriptions.hxx" #endif -#ifndef _SVX_SVXENUM_HXX -#include <svx/svxenum.hxx> -#endif // ......................................................................... namespace dbaui diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 109c544bcccd..c8e2c0198376 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.54 $ + * $Revision: 1.55 $ * - * last change: $Author: oj $ $Date: 2001-08-29 12:43:18 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -672,7 +672,7 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) } } - else + if(!m_pSqlIterator) setQueryComposer(); if(!m_xFormatter.is() && haveDataSource()) { @@ -686,6 +686,9 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) } OSL_ENSURE(m_xFormatter.is(),"No NumberFormatter!"); } + + OSL_ENSURE(m_pSqlIterator,"No SQLIterator set!"); + getContainer()->initialize(); getUndoMgr()->Clear(); if(m_bDesign && !m_sName.getLength()) @@ -1038,7 +1041,7 @@ String OQueryController::getMenu() const void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sal_Bool _bSaveAs) { sal_Bool bNew = 0 == m_sName.getLength(); - bNew = bNew || _bSaveAs; + bNew = bNew || _bSaveAs || (_xElements.is() && !_xElements->hasByName(m_sName)); if(bNew) { Reference<XDatabaseMetaData> xMetaData; @@ -1072,6 +1075,8 @@ void OQueryController::askForNewName(const Reference<XNameAccess>& _xElements,sa m_sUpdateSchemaName = aDlg.getSchema(); } } + else + m_sName = ::rtl::OUString(); // reset the name because we don't want to save it } } // ----------------------------------------------------------------------------- @@ -1095,7 +1100,7 @@ void OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) if(sTranslatedStmt.getLength()) { sal_Bool bNew = 0 == m_sName.getLength(); - bNew = bNew || _bSaveAs; + bNew = bNew || _bSaveAs || !xElements->hasByName(m_sName); // first we need a name for our query so ask the user askForNewName(xElements,_bSaveAs); @@ -1106,7 +1111,7 @@ void OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) try { Reference<XPropertySet> xProp; - if(bNew || !xElements->hasByName(m_sName)) // just to make sure the query already exists + if(bNew) // just to make sure the query already exists { if(xElements->hasByName(m_sName)) { diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index d03f0c6e3881..8a1f0e6f4c44 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableController.cxx,v $ * - * $Revision: 1.53 $ + * $Revision: 1.54 $ * - * last change: $Author: oj $ $Date: 2001-09-20 12:56:16 $ + * last change: $Author: oj $ $Date: 2001-09-25 13:24:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -412,7 +412,8 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) try { xTables = xTablesSup->getTables(); - OSL_ENSURE(xTables.is(),"The queries can't be null!"); + OSL_ENSURE(xTables.is(),"The tables can't be null!"); + bNew = bNew || (xTables.is() && !xTables->hasByName(m_sName)); // first we need a name for our query so ask the user if(bNew) |