diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-07-16 06:55:35 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-07-16 06:55:35 +0000 |
commit | 0861aa80142cfe7f575391b9ca413d697b6d2dab (patch) | |
tree | 83cd63d42c6cf7320669320700cf8c6a194c40aa /dbaccess | |
parent | c5e3e02943a330138f07946bc224a201687b183f (diff) |
#89657# check if copy is allowed
Diffstat (limited to 'dbaccess')
8 files changed, 82 insertions, 33 deletions
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx index 4cb6c99c5e3e..7a4beae6c349 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FieldDescGenWin.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-04-24 14:32:28 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -195,6 +195,11 @@ String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const return m_pFieldControl->BoolStringUI(rPersistentString); } // ----------------------------------------------------------------------------- +sal_Bool OFieldDescGenWin::isCopyAllowed() +{ + return (m_pFieldControl && m_pFieldControl->isCutAllowed()); +} +// ----------------------------------------------------------------------------- sal_Bool OFieldDescGenWin::isCutAllowed() { return (m_pFieldControl && m_pFieldControl->isCutAllowed()); diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx index 2c4f8a2156dd..b2d4fae7cf0c 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx +++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FieldDescGenWin.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-03-22 07:54:07 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,10 @@ namespace dbaui String BoolStringPersistent(const String& rUIString) const; String BoolStringUI(const String& rPersistentString) const; + sal_Bool isCutAllowed(); + sal_Bool isCopyAllowed(); + void cut(); void copy(); void paste(); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 7ea6121d3243..0008295422e7 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TEditControl.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: oj $ $Date: 2001-07-06 11:15:38 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1330,24 +1330,34 @@ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow ) sal_Bool OTableEditorCtrl::IsCopyAllowed( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - Reference<XPropertySet> xTable = GetView()->getController()->getTable(); - if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) - return sal_False; - - ////////////////////////////////////////////////////////////////////// - // Wenn eine der markierten Zeilen leer ist, kein Copy moeglich - OTableRow* pRow; - long nIndex = FirstSelectedRow(); - while( nIndex >= 0 ) + sal_Bool bIsCopyAllowed = sal_False; + if(m_eChildFocus == DESCRIPTION) + bIsCopyAllowed = pDescrCell->GetSelected().Len() != 0; + else if(m_eChildFocus == NAME) + bIsCopyAllowed = pNameCell->GetSelected().Len() != 0; + else if(m_eChildFocus == ROW) { - pRow = (*m_pRowList)[nIndex]; - if( !pRow->GetActFieldDescr() ) + Reference<XPropertySet> xTable = GetView()->getController()->getTable(); + if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) return sal_False; - nIndex = NextSelectedRow(); + ////////////////////////////////////////////////////////////////////// + // Wenn eine der markierten Zeilen leer ist, kein Copy moeglich + OTableRow* pRow; + long nIndex = FirstSelectedRow(); + while( nIndex >= 0 ) + { + pRow = (*m_pRowList)[nIndex]; + if( !pRow->GetActFieldDescr() ) + return sal_False; + + nIndex = NextSelectedRow(); + } + + bIsCopyAllowed = sal_True; } - return sal_True; + return bIsCopyAllowed; } //------------------------------------------------------------------------------ @@ -1414,12 +1424,18 @@ void OTableEditorCtrl::Paste() else if(m_eChildFocus == NAME) { if(GetView()->getController()->isAlterAllowed()) + { pNameCell->Paste(); + CellModified(); + } } else if(m_eChildFocus == DESCRIPTION) { if(GetView()->getController()->isAlterAllowed()) + { pDescrCell->Paste(); + CellModified(); + } } } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx index 7b9866e0a8c1..542374a0dc35 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.hxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TEditControl.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: fs $ $Date: 2001-06-29 08:41:14 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index dddbeee8d478..955c5c2f8384 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.43 $ + * $Revision: 1.44 $ * - * last change: $Author: oj $ $Date: 2001-07-06 08:16:05 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -321,7 +321,7 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) aReturn.bEnabled = m_bEditable && m_bFrameUiActive && getView() && static_cast<OTableDesignView*>(getView())->isCutAllowed(); break; case ID_BROWSER_COPY: - aReturn.bEnabled = sal_True && m_bFrameUiActive; + aReturn.bEnabled = m_bFrameUiActive && getView() && static_cast<OTableDesignView*>(getView())->isCopyAllowed(); break; case ID_BROWSER_PASTE: aReturn.bEnabled = m_bEditable && m_bFrameUiActive; @@ -431,7 +431,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) { String aName = String(ModuleRes(STR_TBL_TITLE)); aName = aName.GetToken(0,' '); - aDefaultName = String(::dbtools::createUniqueName(xTables,aName)); + aDefaultName = ::dbaui::createDefaultName(m_xConnection->getMetaData(),xTables,aName); } OSaveAsDlg aDlg(getView(),CommandType::TABLE,xTables,m_xConnection->getMetaData(),aDefaultName); @@ -759,7 +759,7 @@ void OTableController::AddSupportedFeatures() // m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:BrowserMode")] = SID_BROWSER_MODE; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:HelpMenu")] = SID_HELPMENU; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:NewDoc")] = SID_NEWDOC; - m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:SaveAsDoc")] = SID_SAVEASDOC; + m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:SaveAsDoc")] = ID_BROWSER_SAVEASDOC; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:Copy")] = ID_BROWSER_COPY; m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:Cut")] = ID_BROWSER_CUT; @@ -1162,7 +1162,10 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star:: { String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME)); strMessage.SearchAndReplaceAscii("$column$", pFieldDesc->GetName()); - throw SQLException(strMessage,*this,::rtl::OUString::createFromAscii("HY0000"),1000,Any()); + String sTitle(ModuleRes(STR_STAT_WARNING)); + OSQLMessageBox aMsg(getView(),sTitle,strMessage,WB_OK | WB_DEF_OK,OSQLMessageBox::Error); + aMsg.Execute(); + return sal_False; } } } diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index ae257a8fb860..9084bb04b376 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableDesignView.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-04-24 14:32:28 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -339,6 +339,21 @@ long OTableDesignView::PreNotify( NotifyEvent& rNEvt ) return ODataView::PreNotify(rNEvt); } // ----------------------------------------------------------------------------- +sal_Bool OTableDesignView::isCopyAllowed() +{ + sal_Bool bAllowed = sal_False; + switch(m_eChildFocus) + { + case DESCRIPTION: + bAllowed = GetDescWin()->isCopyAllowed(); + break; + case EDITOR: + bAllowed = GetEditorCtrl()->IsCopyAllowed(); + break; + } + return bAllowed; +} +// ----------------------------------------------------------------------------- sal_Bool OTableDesignView::isCutAllowed() { sal_Bool bAllowed = sal_False; diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx index dd37e53ade97..fa9e75715963 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableFieldDescWin.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-05-30 10:48:06 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -279,6 +279,11 @@ void OTableFieldDescWin::Resize() Invalidate(); } // ----------------------------------------------------------------------------- +sal_Bool OTableFieldDescWin::isCopyAllowed() +{ + return (m_pGenPage && m_pGenPage->isCutAllowed()); +} +// ----------------------------------------------------------------------------- sal_Bool OTableFieldDescWin::isCutAllowed() { return (m_pGenPage && m_pGenPage->isCutAllowed()); diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx index 3a93d29cb8dc..e5df78f0d445 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TableFieldDescWin.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-03-22 07:54:07 $ + * last change: $Author: oj $ $Date: 2001-07-16 07:55:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,6 +114,8 @@ namespace dbaui String BoolStringUI(const String& rPersistentString) const { return m_pGenPage->BoolStringUI(rPersistentString); } sal_Bool isCutAllowed(); + sal_Bool isCopyAllowed(); + void cut(); void copy(); void paste(); |