diff options
Diffstat (limited to 'dbaccess/source/ui/inc')
-rw-r--r-- | dbaccess/source/ui/inc/QueryDesignView.hxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryViewSwitch.hxx | 21 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/RTableConnectionData.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/UITools.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/WNameMatch.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/datasourceconnector.hxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbtreelistbox.hxx | 63 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/querycontainerwindow.hxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/querycontroller.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/unodatbr.hxx | 7 |
10 files changed, 85 insertions, 76 deletions
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index d45087709e8d..1078946a5dc5 100644 --- a/dbaccess/source/ui/inc/QueryDesignView.hxx +++ b/dbaccess/source/ui/inc/QueryDesignView.hxx @@ -153,7 +153,18 @@ namespace dbaui void stopTimer(); void startTimer(); void reset(); - sal_Bool InitFromParseNode(); + + /** initializes the view from the current parser / parse iterator of the controller + + @param _pErrorInfo + When not <NULL/>, the instance pointed to by this parameter takes the error + which happened during the initialization. + If it is not <NULL/>, then any such error will be displayed, using the controller's + showError method. + + @return <TRUE/> if and only if the initialization was successful + */ + bool initByParseIterator( ::dbtools::SQLExceptionInfo* _pErrorInfo ); ::connectivity::OSQLParseNode* getPredicateTreeFromEntry( OTableFieldDescRef pEntry, const String& _sCriteria, diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx index 122dd2f24b41..c0692ba48af0 100644 --- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx +++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx @@ -30,9 +30,12 @@ #ifndef DBAUI_QUERYVIEWSWITCH_HXX #define DBAUI_QUERYVIEWSWITCH_HXX -#ifndef DBAUI_QUERYVIEW_HXX #include "queryview.hxx" -#endif + +namespace dbtools +{ + class SQLExceptionInfo; +} namespace dbaui { @@ -70,18 +73,20 @@ namespace dbaui virtual void initialize(); /** show the text or the design view @return - <TRUE/> when all went right otherwise <FALSE/> which implies an aditional - call of switchView from the controller to restore the old state + <TRUE/> if and only if the view could be successfully, switched, <FALSE/> otherwise + (In the latter case, the controller will issue another switchView call to restore the + old state) */ - sal_Bool switchView(); + bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); sal_Bool isSlotEnabled(sal_Int32 _nSlotId); void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); void setNoneVisbleRow(sal_Int32 _nRows); + void SaveUIConfig(); + bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo ); + void GrabFocus(); + // returs the add table dialog from the design view OAddTableDlg* getAddTableDialog(); - void SaveUIConfig(); - void reset(); - void GrabFocus(); OQueryDesignView* getDesignView() const { return m_pDesignView; } OQueryContainerWindow* getContainer() const; diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx index d5215e503734..1cb3c75540bd 100644 --- a/dbaccess/source/ui/inc/RTableConnectionData.hxx +++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx @@ -58,7 +58,6 @@ namespace dbaui friend bool operator!=(const ORelationTableConnectionData& lhs, const ORelationTableConnectionData& rhs) { return !(lhs == rhs); } ::osl::Mutex m_aMutex; - ::rtl::OUString m_sDatabaseName; // @see com.sun.star.sdbc.KeyRule sal_Int32 m_nUpdateRules; @@ -85,8 +84,6 @@ namespace dbaui virtual void CopyFrom(const OTableConnectionData& rSource); virtual OTableConnectionData* NewInstance() const { return new ORelationTableConnectionData(); } - inline ::rtl::OUString GetDatabaseName() const { return m_sDatabaseName; } - /** Update create a new relation @return true if successful diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 297cdceb9b36..51722ee431cb 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -200,15 +200,15 @@ namespace dbaui the window to use as parent for error messages @param _rxORB a service factory to use for components to be created - @param _bDisplayError - determines whether the method should display an error, when it happens, or simply absorb it + @param _pErrorInfo + takes the error info in case of failure. If <NULL/>, the error is displayed to the user. */ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > - getDataSourceByName_displayError( + getDataSourceByName( const ::rtl::OUString& _rDataSourceName, Window* _pErrorMessageParent, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB, - bool _bDisplayError + ::dbtools::SQLExceptionInfo* _pErrorInfo ); /** returns either the model when data source is given as parameter, diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx index 3b6653494ac7..c8f7daa83394 100644 --- a/dbaccess/source/ui/inc/WNameMatch.hxx +++ b/dbaccess/source/ui/inc/WNameMatch.hxx @@ -95,8 +95,8 @@ namespace dbaui DECL_LINK( ButtonClickHdl, Button * ); DECL_LINK( RightButtonClickHdl, Button * ); DECL_LINK( AllNoneClickHdl, Button * ); - DECL_LINK( TableListClickHdl, SvTreeListBox* ); - DECL_LINK( TableListRightSelectHdl, SvTreeListBox* ); + DECL_LINK( TableListClickHdl, void* ); + DECL_LINK( TableListRightSelectHdl, void* ); public: virtual void Reset ( ); diff --git a/dbaccess/source/ui/inc/datasourceconnector.hxx b/dbaccess/source/ui/inc/datasourceconnector.hxx index 4a6b31dedb8b..382e59b10e7f 100644 --- a/dbaccess/source/ui/inc/datasourceconnector.hxx +++ b/dbaccess/source/ui/inc/datasourceconnector.hxx @@ -44,6 +44,11 @@ #include <com/sun/star/sdbc/XDataSource.hpp> #endif +namespace dbtools +{ + class SQLExceptionInfo; +} + class Window; //......................................................................... namespace dbaui @@ -75,14 +80,21 @@ namespace dbaui /// returns <TRUE/> if the object is able to create data source connections sal_Bool isValid() const { return m_xORB.is(); } - /// create a data source connection + /** creates a connection to the data source, displays the possible error to the user, or returns it + */ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > - connect(const ::rtl::OUString& _rDataSourceName, sal_Bool _bShowError = sal_True) const; + connect( + const ::rtl::OUString& _rDataSourceName, + ::dbtools::SQLExceptionInfo* _pErrorInfo + ) const; - /// create a data source connection + /** creates a connection to the data source, displays the possible error to the user, or returns it + */ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > - connect(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource - , sal_Bool _bShowError = sal_True) const; + connect( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource, + ::dbtools::SQLExceptionInfo* _pErrorInfo + ) const; }; //......................................................................... diff --git a/dbaccess/source/ui/inc/dbtreelistbox.hxx b/dbaccess/source/ui/inc/dbtreelistbox.hxx index b28729b29eb8..2877e2650323 100644 --- a/dbaccess/source/ui/inc/dbtreelistbox.hxx +++ b/dbaccess/source/ui/inc/dbtreelistbox.hxx @@ -30,21 +30,15 @@ #ifndef DBAUI_DBTREELISTBOX_HXX #define DBAUI_DBTREELISTBOX_HXX -#ifndef _SVTREEBOX_HXX -#include <svtools/svtreebx.hxx> -#endif -#ifndef _SV_TIMER_HXX -#include <vcl/timer.hxx> -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#endif -#ifndef DBAUI_SCROLLHELPER_HXX #include "ScrollHelper.hxx" -#endif -#ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" -#endif + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <svtools/svtreebx.hxx> +#include <vcl/timer.hxx> + +#include <set> namespace dbaui @@ -70,13 +64,14 @@ namespace dbaui OScrollHelper m_aScrollHelper; Timer m_aTimer; // is needed for table updates Point m_aMousePos; - SvLBoxEntry* m_pSelectedEntry; + ::std::set< SvListEntry* > m_aSelectedEntries; SvLBoxEntry* m_pDragedEntry; IControlActionListener* m_pActionListener; IContextMenuProvider* m_pContextMenuProvider; Link m_aPreExpandHandler; // handler to be called before a node is expanded + Link m_aSelChangeHdl; // handlet to be called (asynchronously) when the selection changes in any way Link m_aCutHandler; // called when someone press CTRL+X Link m_aCopyHandler; // called when someone press CTRL+C Link m_aPasteHandler; // called when someone press CTRL+V @@ -86,7 +81,6 @@ namespace dbaui Link m_aEnterKeyHdl; - sal_Int32 m_nSelectLock; sal_Bool m_bHandleEnterKey; protected: @@ -116,28 +110,15 @@ namespace dbaui inline void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB) { m_xORB = _xORB; } - void SetPreExpandHandler(const Link& _rHdl) { m_aPreExpandHandler = _rHdl; } - Link GetPreExpandHandler() const { return m_aPreExpandHandler; } - - void setCutHandler(const Link& _rHdl) { m_aCutHandler = _rHdl; } - Link getCutHandler() const { return m_aCutHandler; } - - void setCopyHandler(const Link& _rHdl) { m_aCopyHandler = _rHdl; } - Link getCopyHandler() const { return m_aCopyHandler; } - - void setPasteHandler(const Link& _rHdl) { m_aPasteHandler = _rHdl; } - Link getPasteHandler() const { return m_aPasteHandler; } + void SetPreExpandHandler(const Link& _rHdl) { m_aPreExpandHandler = _rHdl; } + void SetSelChangeHdl( const Link& _rHdl ) { m_aSelChangeHdl = _rHdl; } + void setCutHandler(const Link& _rHdl) { m_aCutHandler = _rHdl; } + void setCopyHandler(const Link& _rHdl) { m_aCopyHandler = _rHdl; } + void setPasteHandler(const Link& _rHdl) { m_aPasteHandler = _rHdl; } + void setDeleteHandler(const Link& _rHdl) { m_aDeleteHandler = _rHdl; } + void setEditingHandler(const Link& _rHdl) { m_aEditingHandler = _rHdl; } + void setEditedHandler(const Link& _rHdl) { m_aEditedHandler = _rHdl; } - void setDeleteHandler(const Link& _rHdl) { m_aDeleteHandler = _rHdl; } - Link getDeleteHandler() const { return m_aDeleteHandler; } - - void setEditingHandler(const Link& _rHdl){ m_aEditingHandler = _rHdl; } - Link getEditingHandler() const { return m_aEditingHandler; } - - void setEditedHandler(const Link& _rHdl) { m_aEditedHandler = _rHdl; } - Link getEditedHandler() const { return m_aEditedHandler; } - - inline SvLBoxEntry* GetSelectedEntry() const { return m_pSelectedEntry; } // modified the given entry so that the expand handler is called whenever the entry is expanded // (normally, the expand handler is called only once) void EnableExpandHandler(SvLBoxEntry* _pEntry); @@ -152,7 +133,6 @@ namespace dbaui virtual void StateChanged( StateChangedType nStateChange ); virtual void InitEntry( SvLBoxEntry* pEntry, const XubString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp, SvLBoxButtonKind eButtonKind); - virtual void SelectEntry(SvLBoxEntry* _pEntry); // enable editing for tables/views and queries virtual BOOL EditingEntry( SvLBoxEntry* pEntry, Selection& ); virtual BOOL EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText ); @@ -162,13 +142,9 @@ namespace dbaui virtual PopupMenu* CreateContextMenu( void ); virtual void ExcecuteContextMenuAction( USHORT nSelectedPopupEntry ); - sal_Int32 lockAutoSelect(); - sal_Int32 unlockAutoSelect(); - sal_Int32 locked() const { return m_nSelectLock; } - void SetEnterKeyHdl(const Link& rNewHdl) {m_aEnterKeyHdl = rNewHdl;} - inline void clearCurrentSelectionEntry() { m_pSelectedEntry = NULL; } + void clearCurrentSelection() { m_aSelectedEntries.clear(); } protected: virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -183,7 +159,8 @@ namespace dbaui virtual void ModelHasRemoved( SvListEntry* pEntry ); virtual void ModelHasEntryInvalidated( SvListEntry* pEntry ); - void implSelected(SvLBoxEntry* _pSelected); + void implStopSelectionTimer(); + void implStartSelectionTimer(); protected: using SvTreeListBox::ExecuteDrop; diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx index 831af124969b..44af65ed2b2a 100644 --- a/dbaccess/source/ui/inc/querycontainerwindow.hxx +++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx @@ -113,11 +113,12 @@ namespace dbaui ::rtl::OUString getStatement() { return m_pViewSwitch->getStatement( ); } void setStatement( const ::rtl::OUString& _rsStatement ) { m_pViewSwitch->setStatement( _rsStatement ); } - void initialize() { m_pViewSwitch->initialize(); } - void SaveUIConfig() { m_pViewSwitch->SaveUIConfig(); } - void reset() { m_pViewSwitch->reset(); } + void initialize() { m_pViewSwitch->initialize(); } + void SaveUIConfig() { m_pViewSwitch->SaveUIConfig(); } + bool reset( ::dbtools::SQLExceptionInfo* _pErrorInfo ) { return m_pViewSwitch->reset( _pErrorInfo ); } + + bool switchView( ::dbtools::SQLExceptionInfo* _pErrorInfo ); - sal_Bool switchView(); virtual void GetFocus(); protected: diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx index c3a50673a76b..b79e6ea6dfc5 100644 --- a/dbaccess/source/ui/inc/querycontroller.hxx +++ b/dbaccess/source/ui/inc/querycontroller.hxx @@ -196,7 +196,7 @@ namespace dbaui static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); - protected: + private: virtual void onLoadedMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; @@ -207,7 +207,13 @@ namespace dbaui virtual void reset(); virtual void impl_initialize(); - void resetImpl(); + void impl_reset(); + /// tells the user that we needed to switch to SQL view automatically + void impl_showAutoSQLViewError( const ::com::sun::star::uno::Any& _rErrorDetails ); + + /** switches to the graphical or SQL view mode, as determined by m_bGraphicalDesign + */ + bool impl_setViewMode( ::dbtools::SQLExceptionInfo* _pErrorInfo ); /// sets m_sStatement, and notifies our respective property change listeners void setStatement_fireEvent( const ::rtl::OUString& _rNewStatement, bool _bFireStatementChange = true ); @@ -217,6 +223,7 @@ namespace dbaui // OJoinController overridables virtual bool allowViews() const; virtual bool allowQueries() const; + private: DECL_LINK( OnExecuteAddTable, void* ); }; diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index 556c381bc063..9354aa943a93 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -132,8 +132,6 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMainToolbar; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xCurrentDatabaseDocument; - ::osl::Mutex m_aEntryMutex; - // --------------------------- struct ExternalFeature { @@ -398,10 +396,10 @@ namespace dbaui String GetEntryText( SvLBoxEntry* _pEntry ) const; // is called when a table or a query was selected - DECL_LINK( OnSelectEntry, SvLBoxEntry* ); + DECL_LINK( OnSelectionChange, void* ); DECL_LINK( OnExpandEntry, SvLBoxEntry* ); - DECL_LINK( OnCopyEntry, SvLBoxEntry* ); + DECL_LINK( OnCopyEntry, void* ); DECL_LINK( OnTreeEntryCompare, const SvSortData* ); @@ -410,6 +408,7 @@ namespace dbaui void implRemoveStatusListeners(); sal_Bool implSelect(const ::svx::ODataAccessDescriptor& _rDescriptor,sal_Bool _bSelectDirect = sal_False); + bool implSelect( SvLBoxEntry* _pEntry ); /// selects the entry given and loads the grid control with the object's data sal_Bool implSelect( |