diff options
-rw-r--r-- | dbaccess/source/ui/inc/JoinController.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryDesignView.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/QueryViewSwitch.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/RelationController.hxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/querycontainerwindow.hxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/querycontroller.hxx | 12 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinController.cxx | 27 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 28 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryViewSwitch.cxx | 54 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 49 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 250 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RelationController.cxx | 52 |
13 files changed, 278 insertions, 244 deletions
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx index 36262b431a11..bb93dcec4820 100644 --- a/dbaccess/source/ui/inc/JoinController.hxx +++ b/dbaccess/source/ui/inc/JoinController.hxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinController.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-08-24 14:18:41 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,6 +147,9 @@ namespace dbaui // ::com::sun::star::lang::XComponent virtual void SAL_CALL disposing(); + // ::com::sun::star::frame::XController + virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); + // virtual void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxIn); @@ -171,6 +174,10 @@ namespace dbaui } protected: virtual OTableWindowData* createTableWindowData() = 0; + // ask the user if the design should be saved when it is modified + virtual short saveModified() = 0; + // called when the orignal state should be reseted (first time load) + virtual void reset() = 0; virtual void AddSupportedFeatures(); virtual OJoinDesignView* getJoinView(); diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx index 02009ed26ce8..2ae66f61cebb 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.10 $ + * $Revision: 1.11 $ * - * last change: $Author: oj $ $Date: 2001-10-22 09:57:52 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -206,6 +206,7 @@ namespace dbaui BOOL IsAddAllowed(); sal_Bool isSlotEnabled(sal_Int32 _nSlotId); void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); + void setNoneVisbleRow(sal_Int32 _nRows); ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;} ::rtl::OUString getDecimalSeparator() const { return m_sDecimalSep;} @@ -226,6 +227,7 @@ namespace dbaui void SaveUIConfig(); void stopTimer(); void startTimer(); + void reset(); ::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 795d34ce70dd..16c1f04530c2 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.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-09-27 06:25:16 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,6 +102,7 @@ namespace dbaui void switchView(); sal_Bool isSlotEnabled(sal_Int32 _nSlotId); void setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable); + void setNoneVisbleRow(sal_Int32 _nRows); // returs the add table dialog from the design view OAddTableDlg* getAddTableDialog(); BOOL IsAddAllowed(); @@ -109,6 +110,7 @@ namespace dbaui void SaveUIConfig(); void clearDesignView(); void GetFocus(); + void reset(); OQueryDesignView* getDesignView() const { return m_pDesignView; } OQueryContainerWindow* getContainer() const; diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx index 48b60b9ebd67..dcb696ad4192 100644 --- a/dbaccess/source/ui/inc/RelationController.hxx +++ b/dbaccess/source/ui/inc/RelationController.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationController.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-08-24 06:32:57 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,8 +93,7 @@ namespace dbaui ORelationDesignView* getRelationView() { return static_cast<ORelationDesignView*>(m_pView); } void loadData(); sal_Bool existsTable(const ::rtl::OUString& _rComposedTableName) const; - // ask the user if the design should be saved when it is modified - short saveModified(); + // load the window positions out of the datasource void loadLayoutInformation(); void loadTableData(const ::com::sun::star::uno::Any& _aTable); @@ -107,9 +106,6 @@ namespace dbaui virtual sal_Bool Construct(Window* pParent); - // ::com::sun::star::frame::XController - virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); - // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); @@ -123,6 +119,9 @@ namespace dbaui protected: virtual OTableWindowData* createTableWindowData(); + // ask the user if the design should be saved when it is modified + virtual short saveModified(); + virtual void reset(); }; } #endif // DBAUI_RELATIONCONTROLLER_HXX diff --git a/dbaccess/source/ui/inc/querycontainerwindow.hxx b/dbaccess/source/ui/inc/querycontainerwindow.hxx index 8316b34d2f43..47155e0bf013 100644 --- a/dbaccess/source/ui/inc/querycontainerwindow.hxx +++ b/dbaccess/source/ui/inc/querycontainerwindow.hxx @@ -2,9 +2,9 @@ * * $RCSfile: querycontainerwindow.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-09-27 06:19:05 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,6 +139,7 @@ namespace dbaui void clear() { m_pViewSwitch->clear(); } sal_Bool isSlotEnabled( sal_Int32 _nSlotId ) { return m_pViewSwitch->isSlotEnabled( _nSlotId ); } void setSlotEnabled( sal_Int32 _nSlotId, sal_Bool _bEnable ) { m_pViewSwitch->setSlotEnabled( _nSlotId, _bEnable ); } + void setNoneVisbleRow(sal_Int32 _nRows) { m_pViewSwitch->setNoneVisbleRow( _nRows); } void setReadOnly( sal_Bool _bReadOnly ) { m_pViewSwitch->setReadOnly( _bReadOnly ); } @@ -148,6 +149,7 @@ namespace dbaui void initialize() { m_pViewSwitch->initialize(); } void SaveUIConfig() { m_pViewSwitch->SaveUIConfig(); } + void reset() { m_pViewSwitch->reset(); } void switchView(); virtual void GetFocus(); @@ -170,6 +172,9 @@ namespace dbaui /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.2 2001/09/27 06:19:05 oj + * #92325# impl new sql functions + * * Revision 1.1 2001/08/23 14:25:36 fs * initial checkin - outsourced from QueryTextView.hxx (the container window for the query design) * diff --git a/dbaccess/source/ui/inc/querycontroller.hxx b/dbaccess/source/ui/inc/querycontroller.hxx index 959356dde98a..48b8d3586677 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.20 $ + * $Revision: 1.21 $ * - * last change: $Author: oj $ $Date: 2001-10-05 06:49:21 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -170,7 +170,7 @@ namespace dbaui virtual void reconnect( sal_Bool _bUI ); - OQueryContainerWindow* getContainer() { return static_cast< OQueryContainerWindow* >( getView() ); } + OQueryContainerWindow* getContainer() const { return static_cast< OQueryContainerWindow* >( getView() ); } public: OQueryController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); @@ -209,8 +209,6 @@ namespace dbaui // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::frame::XController - virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); // ::com::sun::star::lang::XComponent virtual void SAL_CALL disposing(); @@ -232,6 +230,10 @@ namespace dbaui protected: virtual OTableWindowData* createTableWindowData(); virtual OJoinDesignView* getJoinView(); + // ask the user if the design should be saved when it is modified + virtual short saveModified(); + virtual void reset(); + void resetImpl(); }; } #endif // DBAUI_QUERYCONTROLLER_HXX diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx b/dbaccess/source/ui/querydesign/JoinController.cxx index b7c52f940014..2b4b5bc42639 100644 --- a/dbaccess/source/ui/querydesign/JoinController.cxx +++ b/dbaccess/source/ui/querydesign/JoinController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinController.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2001-08-27 06:57:23 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -338,8 +338,26 @@ void OJoinController::Execute(sal_uInt16 _nId) return; break; case ID_BROWSER_EDITDOC: + if(m_bEditable) + { // the state should be changed to not editable + switch (saveModified()) + { + case RET_CANCEL: + // don't change anything here so return + return; + break; + case RET_NO: + reset(); + setModified(sal_False); // and we are not modified yet + break; + default: + break; + } + } m_bEditable = !m_bEditable; getJoinView()->setReadOnly(!m_bEditable); + InvalidateAll(); + return; break; case ID_BROWSER_UNDO: m_aUndoManager.Undo(); @@ -399,6 +417,11 @@ void OJoinController::AddSupportedFeatures() m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DB/Close")] = SID_CLOSEDOC; } // ----------------------------------------------------------------------------- +sal_Bool SAL_CALL OJoinController::suspend(sal_Bool bSuspend) throw( RuntimeException ) +{ + return saveModified() != RET_CANCEL; +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index d87fe6058a5c..edcbd16da41d 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.34 $ + * $Revision: 1.35 $ * - * last change: $Author: oj $ $Date: 2001-10-22 09:57:51 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -187,7 +187,7 @@ OQueryDesignView::OQueryDesignView(OQueryContainerWindow* _pParent, OQueryContro } m_pSelectionBox = new OSelectionBrowseBox(this); - m_pSelectionBox->SetNoneVisbleRow(static_cast<OQueryController*>(getController())->getVisibleRows()); + setNoneVisbleRow(static_cast<OQueryController*>(getController())->getVisibleRows()); m_pSelectionBox->Show(); // Splitter einrichten m_aSplitter.SetSplitHdl(LINK(this, OQueryDesignView,SplitHdl)); @@ -230,9 +230,7 @@ void OQueryDesignView::initialize() m_aSplitter.SetSplitPosPixel(static_cast<OQueryController*>(getController())->getSplitPos()); } m_pSelectionBox->initialize(); - m_pSelectionBox->PreFill(); - m_pSelectionBox->SetReadOnly(static_cast<OQueryController*>(getController())->isReadOnly()); - m_pSelectionBox->Fill(); + reset(); } // ------------------------------------------------------------------------- void OQueryDesignView::resizeDocumentView(Rectangle& _rPlayground) @@ -282,9 +280,7 @@ void OQueryDesignView::setReadOnly(sal_Bool _bReadOnly) // ----------------------------------------------------------------------------- void OQueryDesignView::clear() { - m_pSelectionBox->ClearAll(); // clear the whole selection - // m_pSelectionBox->Fill(); // fill with empty the fields m_pTableView->ClearAll(); } // ----------------------------------------------------------------------------- @@ -2665,6 +2661,18 @@ void OQueryDesignView::GetFocus() } } // ----------------------------------------------------------------------------- - - +void OQueryDesignView::reset() +{ + m_pTableView->ClearAll(); + m_pTableView->ReSync(); + m_pSelectionBox->PreFill(); + m_pSelectionBox->SetReadOnly(static_cast<OQueryController*>(getController())->isReadOnly()); + m_pSelectionBox->Fill(); +} +// ----------------------------------------------------------------------------- +void OQueryDesignView::setNoneVisbleRow(sal_Int32 _nRows) +{ + m_pSelectionBox->SetNoneVisbleRow(_nRows); +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx index 4ae2ba9606e6..a993966e72c0 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.11 $ + * $Revision: 1.12 $ * - * last change: $Author: oj $ $Date: 2001-10-15 13:42:05 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -250,6 +250,18 @@ void OQueryViewSwitch::switchView() ToolBox* pToolBox = pContainer ? pContainer->getToolBox() : NULL; DBG_ASSERT( pToolBox, "OQueryViewSwitch::switchView: no toolbox!" ); + if ( pToolBox ) + { + pToolBox->ShowItem(ID_BROWSER_QUERY_DISTINCT_VALUES,bGraphicalDesign); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_ALIASES,bGraphicalDesign); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_TABLES,bGraphicalDesign); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS,bGraphicalDesign); + pToolBox->ShowItem(ID_BROWSER_ADDTABLE,bGraphicalDesign); + pToolBox->ShowItem(ID_QUERY_ZOOM_IN,bGraphicalDesign); + pToolBox->ShowItem(ID_QUERY_ZOOM_OUT,bGraphicalDesign); + pToolBox->ShowItem(ID_BROWSER_ESACPEPROCESSING,!bGraphicalDesign); + } + if ( m_pTextView->IsVisible() ) { m_pDesignView->stopTimer(); @@ -257,36 +269,11 @@ void OQueryViewSwitch::switchView() m_pTextView->clear(); m_pTextView->setStatement(static_cast<OQueryController*>(m_pDesignView->getController())->getStatement()); - - if ( pToolBox ) - { - pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_TABLES); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); - pToolBox->HideItem(ID_BROWSER_ADDTABLE); - pToolBox->HideItem(ID_QUERY_ZOOM_IN); - pToolBox->HideItem(ID_QUERY_ZOOM_OUT); - pToolBox->ShowItem(ID_BROWSER_ESACPEPROCESSING); - } } else { // we have to stop the sqledit from our textview m_pTextView->getSqlEdit()->stopTimer(); - - if ( pToolBox ) - { - pToolBox->HideItem(ID_BROWSER_ESACPEPROCESSING); - pToolBox->ShowItem(ID_BROWSER_ADDTABLE); - pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); - pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_TABLES); - pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_ALIASES); - pToolBox->ShowItem(ID_BROWSER_QUERY_DISTINCT_VALUES); - pToolBox->ShowItem(ID_QUERY_ZOOM_IN); - pToolBox->ShowItem(ID_QUERY_ZOOM_OUT); - } - getAddTableDialog()->Update(); m_pDesignView->InitFromParseNode(); @@ -350,4 +337,15 @@ Reference< XMultiServiceFactory > OQueryViewSwitch::getORB() const return m_pDesignView->getORB(); } // ----------------------------------------------------------------------------- - +void OQueryViewSwitch::reset() +{ + m_pDesignView->reset(); + switchView(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::setNoneVisbleRow(sal_Int32 _nRows) +{ + if(m_pDesignView) + m_pDesignView->setNoneVisbleRow(_nRows); +} +// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 9391981ef292..ac1fa4c086eb 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.35 $ + * $Revision: 1.36 $ * - * last change: $Author: oj $ $Date: 2001-10-22 09:57:51 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -161,6 +161,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent ) ,m_bOrderByUnRelated(sal_True) ,m_bGroupByUnRelated(sal_True) ,m_bStopTimer(sal_False) + ,m_bWasEditing(sal_False) { DBG_CTOR(OSelectionBrowseBox,NULL); SetHelpId(HID_CTL_QRYDGNCRIT); @@ -334,12 +335,6 @@ void OSelectionBrowseBox::PreFill() RemoveColumns(); InsertHandleColumn( 70 ); SetUpdateMode(sal_True); - - -#if defined (OS2) - Invalidate(); -#endif - } //------------------------------------------------------------------------------ void OSelectionBrowseBox::ClearAll() @@ -1254,8 +1249,8 @@ void OSelectionBrowseBox::DeleteFields(const String& rAliasName) sal_uInt16 nColId = GetCurColumnId(); sal_uInt32 nRow = GetCurRow(); - sal_Bool bWasEditing = IsEditing(); - if (bWasEditing) + m_bWasEditing = IsEditing(); + if (m_bWasEditing) DeactivateCell(); OTableFields::reverse_iterator aIter = getFields().rbegin(); @@ -1267,8 +1262,9 @@ void OSelectionBrowseBox::DeleteFields(const String& rAliasName) RemoveField((sal_uInt16)nPos, sal_False); } - if (bWasEditing) + if (m_bWasEditing) ActivateCell(nRow , nColId); + m_bWasEditing = sal_False; } } @@ -1294,8 +1290,8 @@ void OSelectionBrowseBox::SetColWidth() void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - sal_Bool bWasEditing = IsEditing(); - if (bWasEditing) + m_bWasEditing = IsEditing(); + if (m_bWasEditing) DeactivateCell(); // die Basisklasse machen lassen @@ -1306,8 +1302,9 @@ void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth) if (pEntry.isValid()) pEntry->SetColWidth(sal_uInt16(GetColumnWidth(nColId))); - if (bWasEditing) + if (m_bWasEditing) ActivateCell(GetCurRow(), GetCurColumnId()); + m_bWasEditing = sal_False; } //------------------------------------------------------------------------------ @@ -1789,8 +1786,8 @@ void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, sal_Bool _bVis) DBG_CHKTHIS(OSelectionBrowseBox,NULL); DBG_ASSERT(_nWhich>=0 && _nWhich<m_bVisibleRow.size(), "OSelectionBrowseBox::SetRowVisible : invalid parameter !"); - sal_Bool bWasEditing = IsEditing(); - if (bWasEditing) + m_bWasEditing = IsEditing(); + if (m_bWasEditing) DeactivateCell(); // do this before removing or inserting rows, as this triggers ActivateCell-calls, which rely on m_bVisibleRow @@ -1800,16 +1797,17 @@ void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, sal_Bool _bVis) if (_bVis) { RowInserted(nId,1); - m_nVisibleCount++; + ++m_nVisibleCount; } else { RowRemoved(nId,1); - m_nVisibleCount--; + --m_nVisibleCount; } - if (bWasEditing) + if (m_bWasEditing) ActivateCell(); + m_bWasEditing = sal_False; } //------------------------------------------------------------------------------ @@ -1858,7 +1856,7 @@ static long nVisibleRowMask[] = sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const { sal_Int32 nErg(0); - // only the foirst 11 row are interesting + // only the first 11 row are interesting sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); for(sal_Int32 i=0;i<nSize;i++) { @@ -1870,7 +1868,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const //------------------------------------------------------------------------------ void OSelectionBrowseBox::SetNoneVisbleRow(long nRows) { - // only the foirst 11 row are interesting + // only the first 11 row are interesting sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); for(sal_Int32 i=0;i< nSize;i++) m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]); @@ -1987,8 +1985,8 @@ String OSelectionBrowseBox::GetCellContents(sal_uInt16 nCellIndex, long nColId) void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const String& strNewText) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - sal_Bool bWasEditing = IsEditing() && (GetCurColumnId() == nColId) && IsRowVisible(nRow) && (GetCurRow() == GetBrowseRow(nRow)); - if (bWasEditing) + m_bWasEditing = IsEditing() && (GetCurColumnId() == nColId) && IsRowVisible(nRow) && (GetCurRow() == GetBrowseRow(nRow)); + if (m_bWasEditing) DeactivateCell(); OTableFieldDescRef pEntry = getEntry(nColId - 1); @@ -2035,9 +2033,10 @@ void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const St if (pEntry->IsEmpty()) pEntry->SetVisible(sal_False); - if (bWasEditing) + if (m_bWasEditing) ActivateCell(nCellIndex, (sal_uInt16)nColId); + m_bWasEditing = sal_False; static_cast<OQueryController*>(getDesignView()->getController())->setModified(); } //------------------------------------------------------------------------------ @@ -2265,7 +2264,7 @@ OTableFieldDescRef OSelectionBrowseBox::getEntry(OTableFields::size_type _nPos) // ----------------------------------------------------------------------------- void OSelectionBrowseBox::GetFocus() { - if(!IsEditing()) + if(!IsEditing() && !m_bWasEditing) ActivateCell(); EditBrowseBox::GetFocus(); } diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx index 1c6879a74d12..7422e44f4908 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.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-10-22 09:57:51 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,6 +134,7 @@ namespace dbaui sal_Bool m_bOrderByUnRelated; sal_Bool m_bGroupByUnRelated; sal_Bool m_bStopTimer; + sal_Bool m_bWasEditing; DECL_LINK(OnInvalidateTimer, void*); public: OSelectionBrowseBox( Window* pParent ); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 2d0a128be524..4dbc3fe5653d 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.62 $ + * $Revision: 1.63 $ * - * last change: $Author: oj $ $Date: 2001-10-12 12:02:56 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -324,9 +324,6 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) aReturn.aState = ::cppu::bool2any(!m_bEsacpeProcessing); aReturn.bEnabled = m_pSqlIterator != NULL; break; - case ID_BROWSER_EDITDOC: - aReturn.aState = ::cppu::bool2any(m_bEditable); - break; case ID_BROWSER_SAVEASDOC: aReturn.bEnabled = !m_bCreateView && (!m_bDesign || !(m_vTableFieldDesc.empty() || m_vTableData.empty())); break; @@ -357,6 +354,7 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) aReturn.aState = ::cppu::bool2any(getContainer() && getContainer()->isSlotEnabled(_nId)); break; case ID_BROWSER_QUERY_DISTINCT_VALUES: + aReturn.bEnabled = m_bEditable; aReturn.aState = ::cppu::bool2any(m_bDistinct); break; case ID_BROWSER_QUERY_EXECUTE: @@ -375,14 +373,9 @@ void OQueryController::Execute(sal_uInt16 _nId) { case ID_BROWSER_ESACPEPROCESSING: m_bEsacpeProcessing = !m_bEsacpeProcessing; + setModified(sal_True); InvalidateFeature(ID_BROWSER_SQL); break; - case ID_BROWSER_EDITDOC: - m_bEditable = !m_bEditable; - getContainer()->setReadOnly(!m_bEditable); - InvalidateFeature(ID_BROWSER_PASTE); - InvalidateFeature(ID_BROWSER_CLEAR_QUERY); - break; case ID_BROWSER_SAVEASDOC: case ID_BROWSER_SAVEDOC: doSaveAsDoc(ID_BROWSER_SAVEASDOC == _nId); @@ -483,6 +476,7 @@ void OQueryController::Execute(sal_uInt16 _nId) case ID_BROWSER_QUERY_VIEW_TABLES: case ID_BROWSER_QUERY_VIEW_ALIASES: getContainer()->setSlotEnabled(_nId,!getContainer()->isSlotEnabled(_nId)); + setModified(sal_True); break; case ID_BROWSER_QUERY_DISTINCT_VALUES: m_bDistinct = !m_bDistinct; @@ -514,7 +508,6 @@ void OQueryController::Execute(sal_uInt16 _nId) // ----------------------------------------------------------------------------- void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) { - OJoinController::initialize(aArguments); PropertyValue aValue; @@ -596,77 +589,6 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) try { - // get command from the query if a query name was supplied - if(m_sName.getLength()) - { - OSL_ENSURE(!m_bCreateView,"Can not support a name for a view!"); - Reference<XNameAccess> xQueries = getElements(); - if(xQueries.is()) - { - Reference<XPropertySet> xProp; - if(xQueries->hasByName(m_sName) && ::cppu::extractInterface(xProp,xQueries->getByName(m_sName)) && xProp.is()) - { - xProp->getPropertyValue(PROPERTY_COMMAND) >>= m_sStatement; - m_bDesign = m_bDesign && (m_bEsacpeProcessing = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_USE_ESCAPE_PROCESSING))); - // load the layoutInformation - try - { - Sequence< sal_Int8 > aInputSequence; - xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aInputSequence; - { - Reference< XInputStream> xInStreamHelper = new SequenceInputStream(aInputSequence);; // used for wrapping sequence to xinput - Reference< XObjectInputStream> xInStream = Reference< XObjectInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")),UNO_QUERY); - Reference< XInputStream> xMarkInStream = Reference< XInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")),UNO_QUERY); - Reference< XActiveDataSink >(xMarkInStream,UNO_QUERY)->setInputStream(xInStreamHelper); - Reference< XActiveDataSink > xInDataSource(xInStream, UNO_QUERY); - OSL_ENSURE(xInDataSource.is(),"Couldn't create com.sun.star.io.ObjectInputStream!"); - xInDataSource->setInputStream(xMarkInStream); - Load(xInStream); - } - } - catch(Exception&) - { - } - setQueryComposer(); - if(m_bEsacpeProcessing) - { - ::rtl::OUString aErrorMsg; - ::connectivity::OSQLParseNode* pNode = m_pSqlParser->parseTree(aErrorMsg,m_sStatement,m_bDesign); - // m_pParseNode = pNode; - if(pNode) - { - if(m_pSqlIterator) - { - delete m_pSqlIterator->getParseTree(); - m_pSqlIterator->setParseTree(pNode); - m_pSqlIterator->traverseAll(); - SQLWarning aWarning = m_pSqlIterator->getWarning(); - if(aWarning.Message.getLength()) - { - showError(SQLExceptionInfo(aWarning)); - m_bDesign = sal_False; - } - } - else - { - delete pNode; - m_bDesign = sal_False; - } - } - else - { - String aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR)); - OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg); - aDlg.Execute(); - m_bDesign = sal_False; // the statement can't be parsed so we show the text view - } - } - } - } - - } - if(!m_pSqlIterator) - setQueryComposer(); if(!m_xFormatter.is() && haveDataSource()) { Reference< XNumberFormatsSupplier> xSupplier; @@ -679,11 +601,10 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) } OSL_ENSURE(m_xFormatter.is(),"No NumberFormatter!"); } - - OSL_ENSURE(m_pSqlIterator,"No SQLIterator set!"); - + resetImpl(); getContainer()->initialize(); getUndoMgr()->Clear(); + if(m_bDesign && !m_sName.getLength()) Execute(ID_BROWSER_ADDTABLE); setModified(sal_False); @@ -756,28 +677,6 @@ OJoinDesignView* OQueryController::getJoinView() { return getContainer()->getDesignView(); } - -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OQueryController::suspend(sal_Bool bSuspend) throw( RuntimeException ) -{ - sal_Bool bRet = sal_True; - 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()) - { - case RET_YES: - doSaveAsDoc(sal_False); - bRet = m_sName.getLength() != 0 && !isModified(); - break; - case RET_CANCEL: - bRet = sal_False; - default: - break; - } - } - return bRet; -} // ----------------------------------------------------------------------------- void OQueryController::AddSupportedFeatures() { @@ -790,16 +689,7 @@ void OQueryController::AddSupportedFeatures() // ----------------------------------------------------------------------------- ToolBox* OQueryController::CreateToolBox(Window* _pParent) { -// if ( getContainer() && getContainer()->getDesignView() ) -// return getContainer()->getDesignView()->getToolBox(); -// return new ToolBox(_pParent, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); - - ToolBox* pToolBox = new ToolBox(_pParent, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); - -// if ( getContainer() && getContainer()->getDesignView() ) -// getContainer()->getDesignView()->setToolBox(pToolBox); - - return pToolBox; + return new ToolBox(_pParent, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); } // ----------------------------------------------------------------------------- void OQueryController::setModified(sal_Bool _bModified) @@ -865,13 +755,21 @@ void OQueryController::Save(const Reference< XObjectOutputStream>& _rxOut) _rxOut << m_nVisibleRows; // the fielddata - _rxOut << (sal_Int32)m_vTableFieldDesc.size(); OTableFields::const_iterator aFieldIter = m_vTableFieldDesc.begin(); + sal_Int32 nCount = 0; + for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter) + { + if(!(*aFieldIter)->IsEmpty()) + ++nCount; + } + _rxOut << nCount; + aFieldIter = m_vTableFieldDesc.begin(); for(;aFieldIter != m_vTableFieldDesc.end();++aFieldIter) { if(!(*aFieldIter)->IsEmpty()) (*aFieldIter)->Save(_rxOut); } + _rxOut << m_nVisibleRows; } // ----------------------------------------------------------------------------- void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn) @@ -890,16 +788,22 @@ void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn) sal_Int32 nCount = 0; _rxIn >> nCount; + m_vTableFieldDesc.reserve(nCount); for(sal_Int32 j=0;j<nCount;++j) { - OTableFieldDescRef pData = new OTableFieldDesc(); - pData->Load(_rxIn); - m_vTableFieldDesc.push_back(pData); + if(aSection.available()) + { + OTableFieldDescRef pData = new OTableFieldDesc(); + pData->Load(_rxIn); + m_vTableFieldDesc.push_back(pData); + } } } catch(Exception&) { } + if(aSection.available()) + _rxIn >> m_nVisibleRows; } // ----------------------------------------------------------------------------- @@ -1313,4 +1217,106 @@ void OQueryController::doSaveAsDoc(sal_Bool _bSaveAs) return sTranslatedStmt; } // ----------------------------------------------------------------------------- +short OQueryController::saveModified() +{ + short nRet = RET_YES; + 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)); + nRet = aQry.Execute(); + if(nRet == RET_YES) + { + doSaveAsDoc(sal_False); + nRet = (m_sName.getLength() != 0 && !isModified()) ? RET_YES : RET_CANCEL; + } + } + return nRet; +} +// ----------------------------------------------------------------------------- +void OQueryController::resetImpl() +{ + // get command from the query if a query name was supplied + if(m_sName.getLength()) + { + OSL_ENSURE(!m_bCreateView,"Can not support a name for a view!"); + Reference<XNameAccess> xQueries = getElements(); + if(xQueries.is()) + { + Reference<XPropertySet> xProp; + if(xQueries->hasByName(m_sName) && ::cppu::extractInterface(xProp,xQueries->getByName(m_sName)) && xProp.is()) + { + xProp->getPropertyValue(PROPERTY_COMMAND) >>= m_sStatement; + m_bDesign = m_bDesign && (m_bEsacpeProcessing = ::cppu::any2bool(xProp->getPropertyValue(PROPERTY_USE_ESCAPE_PROCESSING))); + // load the layoutInformation + try + { + Sequence< sal_Int8 > aInputSequence; + xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aInputSequence; + { + Reference< XInputStream> xInStreamHelper = new SequenceInputStream(aInputSequence);; // used for wrapping sequence to xinput + Reference< XObjectInputStream> xInStream = Reference< XObjectInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")),UNO_QUERY); + Reference< XInputStream> xMarkInStream = Reference< XInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")),UNO_QUERY); + Reference< XActiveDataSink >(xMarkInStream,UNO_QUERY)->setInputStream(xInStreamHelper); + Reference< XActiveDataSink > xInDataSource(xInStream, UNO_QUERY); + OSL_ENSURE(xInDataSource.is(),"Couldn't create com.sun.star.io.ObjectInputStream!"); + xInDataSource->setInputStream(xMarkInStream); + Load(xInStream); + } + } + catch(Exception&) + { + } + setQueryComposer(); + if(m_bEsacpeProcessing) + { + ::rtl::OUString aErrorMsg; + ::connectivity::OSQLParseNode* pNode = m_pSqlParser->parseTree(aErrorMsg,m_sStatement,m_bDesign); + // m_pParseNode = pNode; + if(pNode) + { + if(m_pSqlIterator) + { + delete m_pSqlIterator->getParseTree(); + m_pSqlIterator->setParseTree(pNode); + m_pSqlIterator->traverseAll(); + SQLWarning aWarning = m_pSqlIterator->getWarning(); + if(aWarning.Message.getLength()) + { + showError(SQLExceptionInfo(aWarning)); + m_bDesign = sal_False; + } + } + else + { + delete pNode; + m_bDesign = sal_False; + } + } + else + { + String aTitle(ModuleRes(STR_SVT_SQL_SYNTAX_ERROR)); + OSQLMessageBox aDlg(getView(),aTitle,aErrorMsg); + aDlg.Execute(); + m_bDesign = sal_False; // the statement can't be parsed so we show the text view + } + } + } + } + + } + if(!m_pSqlIterator) + setQueryComposer(); + OSL_ENSURE(m_pSqlIterator,"No SQLIterator set!"); + + getContainer()->setNoneVisbleRow(m_nVisibleRows); +} +// ----------------------------------------------------------------------------- +void OQueryController::reset() +{ + resetImpl(); + getContainer()->reset(); + getUndoMgr()->Clear(); +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index 0085cedcf4c8..352ab66c4faa 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationController.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: oj $ $Date: 2001-09-27 13:38:18 $ + * last change: $Author: oj $ $Date: 2001-10-23 12:30:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -262,9 +262,6 @@ FeatureState ORelationController::GetState(sal_uInt16 _nId) aReturn.bEnabled = m_bRelationsPossible; switch (_nId) { - case ID_BROWSER_EDITDOC: - aReturn.aState = ::cppu::bool2any(m_bEditable); - break; case ID_REALTION_ADD_RELATION: aReturn.bEnabled = m_vTableData.size() > 1 && isConnected() && m_bEditable; aReturn.aState = ::cppu::bool2any(sal_False); @@ -327,30 +324,6 @@ void ORelationController::Execute(sal_uInt16 _nId) case ID_REALTION_ADD_RELATION: static_cast<ORelationTableView*>(static_cast<ORelationDesignView*>(m_pView)->getTableView())->AddNewRelation(); break; - case ID_BROWSER_EDITDOC: - if(m_bEditable) - { // the state should be changed to not editable - switch (saveModified()) - { - case RET_CANCEL: - // don't change anything here so return - return; - break; - case RET_NO: - loadLayoutInformation(); - getView()->initialize(); - getView()->Invalidate(INVALIDATE_NOERASE); - setModified(sal_False); // and we are not modified yet - break; - default: - break; - } - } - OJoinController::Execute(_nId); - InvalidateAll(); - return; - break; - // run through default: OJoinController::Execute(_nId); return; @@ -423,7 +396,6 @@ void SAL_CALL ORelationController::initialize( const Sequence< Any >& aArguments loadLayoutInformation(); try { - loadData(); getView()->initialize(); // show the windows and fill with our informations getView()->Invalidate(INVALIDATE_NOERASE); @@ -458,11 +430,6 @@ sal_Bool ORelationController::Construct(Window* pParent) return sal_True; } // ----------------------------------------------------------------------------- -sal_Bool SAL_CALL ORelationController::suspend(sal_Bool bSuspend) throw( RuntimeException ) -{ - return saveModified() != RET_CANCEL; -} -// ----------------------------------------------------------------------------- short ORelationController::saveModified() { short nSaved = RET_YES; @@ -674,3 +641,18 @@ void ORelationController::loadLayoutInformation() { } } +// ----------------------------------------------------------------------------- +void ORelationController::reset() +{ + loadLayoutInformation(); + ODataView* pView = getView(); + OSL_ENSURE(pView,"No current view!"); + if(pView) + { + pView->initialize(); + pView->Invalidate(INVALIDATE_NOERASE); + } +} +// ----------------------------------------------------------------------------- + + |