diff options
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/control/sqledit.cxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryDesignView.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryTextView.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryViewSwitch.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/queryview.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/sqledit.hxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 24 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryTextView.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryViewSwitch.cxx | 31 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 34 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 7 |
12 files changed, 167 insertions, 28 deletions
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx index 3519ad1c1eae..df56982d2b7c 100644 --- a/dbaccess/source/ui/control/sqledit.cxx +++ b/dbaccess/source/ui/control/sqledit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sqledit.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-02-28 10:01:54 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:20:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,7 @@ DBG_NAME(OSqlEdit); OSqlEdit::OSqlEdit( OQueryTextView* pParent, WinBits nWinStyle ) : MultiLineEdit( pParent, nWinStyle ) ,m_bAccelAction( sal_False ) + ,m_bStopTimer(sal_False ) ,m_pView(pParent) { DBG_CTOR(OSqlEdit,NULL); @@ -173,7 +174,8 @@ IMPL_LINK(OSqlEdit, OnInvalidateTimer, void*, EMPTYARG) { static_cast<OQueryContainerWindow*>(m_pView->GetParent())->getView()->getRealView()->getController()->InvalidateFeature(SID_CUT); static_cast<OQueryContainerWindow*>(m_pView->GetParent())->getView()->getRealView()->getController()->InvalidateFeature(SID_COPY); - m_timerInvalidate.Start(); + if(!m_bStopTimer) + m_timerInvalidate.Start(); return 0L; } //------------------------------------------------------------------------------ @@ -208,5 +210,19 @@ void OSqlEdit::OverloadedSetText(const String& rNewText) m_strOrigText = rNewText; static_cast<OQueryContainerWindow*>(m_pView->GetParent())->getView()->getRealView()->getController()->setModified(sal_True); } +// ----------------------------------------------------------------------------- +void OSqlEdit::stopTimer() +{ + m_bStopTimer = sal_True; + if (m_timerInvalidate.IsActive()) + m_timerInvalidate.Stop(); +} +// ----------------------------------------------------------------------------- +void OSqlEdit::startTimer() +{ + m_bStopTimer = sal_False; + if (!m_timerInvalidate.IsActive()) + m_timerInvalidate.Start(); +} //============================================================================== diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 8ffad776f0b9..40d767ef6979 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.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-28 10:10:01 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:19:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,7 +106,7 @@ namespace dbaui ::com::sun::star::lang::Locale m_aLocale; ::rtl::OUString m_sDecimalSep; - OSelectionBrowseBox* m_pSelectionBox; // presents the lower window + OSelectionBrowseBox* m_pSelectionBox; // presents the lower window ::rtl::OUString QuoteField( const ::rtl::OUString& rValue, sal_Int32 aType ); void InitFromParseNode(); @@ -168,6 +168,8 @@ namespace dbaui virtual ~OQueryDesignView(); virtual sal_Bool isCutAllowed(); + virtual sal_Bool isPasteAllowed(); + virtual sal_Bool isCopyAllowed(); virtual void copy(); virtual void cut(); virtual void paste(); @@ -206,6 +208,8 @@ namespace dbaui void zoomTableView(const Fraction& _rFraction); void SaveUIConfig(); + void stopTimer(); + void startTimer(); protected: // return the Rectangle where I can paint myself virtual void resizeControl(Rectangle& rRect); diff --git a/dbaccess/source/ui/inc/QueryTextView.hxx b/dbaccess/source/ui/inc/QueryTextView.hxx index 85abc140a312..5e9ab2792bc2 100644 --- a/dbaccess/source/ui/inc/QueryTextView.hxx +++ b/dbaccess/source/ui/inc/QueryTextView.hxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryTextView.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-28 10:10:01 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:19:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,8 @@ namespace dbaui ~OQueryContainerWindow(); virtual void Resize(); + virtual long PreNotify( NotifyEvent& rNEvt ); + void showBeamer(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame); void hideBeamer(); void initialize(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame); @@ -117,6 +119,8 @@ namespace dbaui virtual ~OQueryTextView(); virtual sal_Bool isCutAllowed(); + virtual sal_Bool isPasteAllowed(); + virtual sal_Bool isCopyAllowed(); virtual void copy(); virtual void cut(); virtual void paste(); @@ -129,6 +133,8 @@ namespace dbaui virtual ::rtl::OUString getStatement(); /// late construction virtual void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel); + // allow access to our edit + OSqlEdit* getSqlEdit() const { return m_pEdit; } protected: virtual void Resize(); }; diff --git a/dbaccess/source/ui/inc/QueryViewSwitch.hxx b/dbaccess/source/ui/inc/QueryViewSwitch.hxx index bc13c55a829d..e5bc3cf2b645 100644 --- a/dbaccess/source/ui/inc/QueryViewSwitch.hxx +++ b/dbaccess/source/ui/inc/QueryViewSwitch.hxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryViewSwitch.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-28 10:10:37 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:19:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,8 @@ namespace dbaui virtual ~OQueryViewSwitch(); virtual sal_Bool isCutAllowed(); + virtual sal_Bool isPasteAllowed(); + virtual sal_Bool isCopyAllowed(); virtual void copy(); virtual void cut(); virtual void paste(); diff --git a/dbaccess/source/ui/inc/queryview.hxx b/dbaccess/source/ui/inc/queryview.hxx index b06032181d9d..1b13c70eebc9 100644 --- a/dbaccess/source/ui/inc/queryview.hxx +++ b/dbaccess/source/ui/inc/queryview.hxx @@ -2,9 +2,9 @@ * * $RCSfile: queryview.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-28 10:10:02 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:19:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,7 +74,9 @@ namespace dbaui OQueryView(Window* pParent, OQueryController* _pController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); virtual ~OQueryView(); - virtual sal_Bool isCutAllowed() = 0; + virtual sal_Bool isCutAllowed() = 0; + virtual sal_Bool isPasteAllowed() = 0; + virtual sal_Bool isCopyAllowed() = 0; virtual void copy() = 0; virtual void cut() = 0; virtual void paste() = 0; diff --git a/dbaccess/source/ui/inc/sqledit.hxx b/dbaccess/source/ui/inc/sqledit.hxx index 43d1ad898469..b62574042d78 100644 --- a/dbaccess/source/ui/inc/sqledit.hxx +++ b/dbaccess/source/ui/inc/sqledit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: sqledit.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-01-09 16:01:14 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:19:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,7 @@ namespace dbaui String m_strOrigText; // wird beim Undo wiederhergestellt OQueryTextView* m_pView; BOOL m_bAccelAction; // Wird bei Cut, Copy, Paste gesetzt + BOOL m_bStopTimer; DECL_LINK(OnUndoActionTimer, void*); DECL_LINK(OnInvalidateTimer, void*); @@ -101,6 +102,9 @@ namespace dbaui // bitte nicht SetModifyHdl benutzen, den brauche ich selber, der hier wird von dem damit gesetzten Handler // gerufen // der Link bekommt einen Pointer-to-string, der nach dem Link nicht mehr gueltig ist + + void stopTimer(); + void startTimer(); }; } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 3c12a5943405..d03466b44650 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.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-04-18 11:44:59 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -305,6 +305,26 @@ sal_Bool OQueryDesignView::isCutAllowed() return bCutAllowed; } // ----------------------------------------------------------------------------- +sal_Bool OQueryDesignView::isPasteAllowed() +{ + return m_pSelectionBox->HasChildPathFocus(); +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryDesignView::isCopyAllowed() +{ + return m_pSelectionBox->HasChildPathFocus(); +} +// ----------------------------------------------------------------------------- +void OQueryDesignView::stopTimer() +{ + m_pSelectionBox->stopTimer(); +} +// ----------------------------------------------------------------------------- +void OQueryDesignView::startTimer() +{ + m_pSelectionBox->startTimer(); +} +// ----------------------------------------------------------------------------- void OQueryDesignView::cut() { if(m_pSelectionBox->HasChildPathFocus()) diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx index 5ec19fd43304..d8c117ef163b 100644 --- a/dbaccess/source/ui/querydesign/QueryTextView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryTextView.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-02 10:50:54 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -193,6 +193,17 @@ void OQueryContainerWindow::hideBeamer() Resize(); } // ----------------------------------------------------------------------------- +long OQueryContainerWindow::PreNotify( NotifyEvent& rNEvt ) +{ + if(rNEvt.GetType() == EVENT_GETFOCUS && m_pView) + { + m_pView->getRealView()->getController()->InvalidateFeature(SID_CUT); + m_pView->getRealView()->getController()->InvalidateFeature(SID_COPY); + m_pView->getRealView()->getController()->InvalidateFeature(SID_PASTE); + } + return Window::PreNotify(rNEvt); +} +// ----------------------------------------------------------------------------- void OQueryContainerWindow::showBeamer(const Reference<XFrame>& _xFrame) { if(!m_pBeamer) @@ -307,6 +318,16 @@ sal_Bool OQueryTextView::isCutAllowed() return m_pEdit->GetSelected().Len() != 0; } // ----------------------------------------------------------------------------- +sal_Bool OQueryTextView::isPasteAllowed() +{ + return sal_True; +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryTextView::isCopyAllowed() +{ + return sal_True; +} +// ----------------------------------------------------------------------------- void OQueryTextView::cut() { if(!m_pEdit->IsInAccelAct() ) diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx index 2f2c256d76f8..3dc80c67bbea 100644 --- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx +++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryViewSwitch.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-03-14 10:35:11 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,9 @@ #ifndef DBAUI_QUERYCONTROLLER_HXX #include "querycontroller.hxx" #endif +#ifndef DBAUI_SQLEDIT_HXX +#include "sqledit.hxx" +#endif using namespace dbaui; @@ -206,6 +209,20 @@ sal_Bool OQueryViewSwitch::isCutAllowed() return m_pDesignView->isCutAllowed(); } // ----------------------------------------------------------------------------- +sal_Bool OQueryViewSwitch::isCopyAllowed() +{ + if(m_pTextView->IsVisible()) + return m_pTextView->isCopyAllowed(); + return m_pDesignView->isCopyAllowed(); +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryViewSwitch::isPasteAllowed() +{ + if(m_pTextView->IsVisible()) + return m_pTextView->isPasteAllowed(); + return m_pDesignView->isPasteAllowed(); +} +// ----------------------------------------------------------------------------- void OQueryViewSwitch::cut() { if(m_pTextView->IsVisible()) @@ -229,6 +246,8 @@ void OQueryViewSwitch::switchView() ToolBox* pToolBox = m_pDesignView->getToolBox(); if(pToolBox && m_pTextView->IsVisible()) { + m_pDesignView->stopTimer(); + m_pTextView->getSqlEdit()->startTimer(); pToolBox->SetParent(m_pTextView); // change owner ship m_pDesignView->Show(FALSE); pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); @@ -246,7 +265,10 @@ void OQueryViewSwitch::switchView() } else if(pToolBox) { + // we have to stop the sqledit from our textview + pToolBox->SetParent(m_pDesignView); // change owner ship + m_pTextView->getSqlEdit()->stopTimer(); // pToolBox->ShowItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_ADDTABLE)-1)); // hide the separator pToolBox->HideItem(ID_BROWSER_ESACPEPROCESSING); pToolBox->ShowItem(ID_BROWSER_ADDTABLE); @@ -262,8 +284,13 @@ void OQueryViewSwitch::switchView() m_pDesignView->InitFromParseNode(); // only show the view when the data is inserted m_pDesignView->Show(static_cast<OQueryController*>(m_pDesignView->getController())->isDesignMode()); + m_pDesignView->startTimer(); } m_pDesignView->Resize(); + + m_pDesignView->getController()->getUndoMgr()->Clear(); + m_pDesignView->getController()->InvalidateFeature(ID_BROWSER_UNDO); + m_pDesignView->getController()->InvalidateFeature(ID_BROWSER_REDO); } // ----------------------------------------------------------------------------- void OQueryViewSwitch::clearDesignView() diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index c22bd92d524d..a5b3b6edebd5 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.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-04-18 11:44:59 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -164,6 +164,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent ) ,m_aFunctionStrings(ModuleRes(STR_QUERY_FUNCTIONS)) ,m_bOrderByUnRelated(sal_True) ,m_bGroupByUnRelated(sal_True) + ,m_bStopTimer(sal_False) { DBG_CTOR(OSelectionBrowseBox,NULL); SetHelpId(HID_CTL_QRYDGNCRIT); @@ -202,6 +203,10 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent ) m_bVisibleRow.push_back(sal_True); m_bVisibleRow[BROW_FUNCTION_ROW] = sal_False; // zuerst ausblenden + + m_timerInvalidate.SetTimeout(200); + m_timerInvalidate.SetTimeoutHdl(LINK(this, OSelectionBrowseBox, OnInvalidateTimer)); + m_timerInvalidate.Start(); } //------------------------------------------------------------------------------ @@ -2252,4 +2257,29 @@ void OSelectionBrowseBox::appendUndoAction(const String& _rOldValue,const String } } // ----------------------------------------------------------------------------- +IMPL_LINK(OSelectionBrowseBox, OnInvalidateTimer, void*, EMPTYARG) +{ + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature(SID_CUT); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature(SID_COPY); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature(SID_PASTE); + if(!m_bStopTimer) + m_timerInvalidate.Start(); + return 0L; +} +// ----------------------------------------------------------------------------- +void OSelectionBrowseBox::stopTimer() +{ + m_bStopTimer = sal_True; + if (m_timerInvalidate.IsActive()) + m_timerInvalidate.Stop(); +} +// ----------------------------------------------------------------------------- +void OSelectionBrowseBox::startTimer() +{ + m_bStopTimer = sal_False; + if (!m_timerInvalidate.IsActive()) + m_timerInvalidate.Start(); +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx index f47dce32dbed..8f538028a9a6 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.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-18 11:44:59 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,6 +114,7 @@ namespace dbaui { friend class OQueryDesignView; ::std::vector<FASTBOOL> m_bVisibleRow; // an Pos steht die RowId + Timer m_timerInvalidate; long m_nSeekRow; BrowserMode m_nMode; // Merken des BrowseModes @@ -130,7 +131,9 @@ namespace dbaui sal_uInt16 m_nVisibleCount; // Anzahl der max sichtbaren Zeilen sal_Bool m_bOrderByUnRelated; sal_Bool m_bGroupByUnRelated; + sal_Bool m_bStopTimer; + DECL_LINK(OnInvalidateTimer, void*); public: OSelectionBrowseBox( Window* pParent ); ~OSelectionBrowseBox(); @@ -206,6 +209,9 @@ namespace dbaui void Fill(); + void stopTimer(); + void startTimer(); + private: OTableFieldDesc* FindFirstFreeCol(long & rCol); // rCol enthaelt die Nummer (in pOTableFieldDescList) der ersten Spalte, die von sich sagt, dass sie leer ist diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index c1ce5064ad87..4c873df42460 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.28 $ + * $Revision: 1.29 $ * - * last change: $Author: oj $ $Date: 2001-04-06 13:46:40 $ + * last change: $Author: oj $ $Date: 2001-04-18 13:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -318,9 +318,10 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) aReturn.bEnabled = m_bEditable && m_pWindow->getView()->isCutAllowed(); break; case ID_BROWSER_COPY: + aReturn.bEnabled = m_pWindow->getView()->isCopyAllowed(); break; case ID_BROWSER_PASTE: - aReturn.bEnabled = m_bEditable; + aReturn.bEnabled = m_bEditable && m_pWindow->getView()->isPasteAllowed(); break; case ID_BROWSER_SQL: aReturn.bEnabled = m_bEsacpeProcessing && m_pSqlIterator; |