User: kz Date: 2008-06-25 12:59:50+0000 Modified: dba/dbaccess/source/ui/tabledesign/TEditControl.cxx
Log: INTEGRATION: CWS dba30d (1.59.30); FILE MERGED 2008/05/29 11:27:01 fs 1.59.30.1: during #i80943#: refactoring: IController now passed around as reference, not as pointer File Changes: Directory: /dba/dbaccess/source/ui/tabledesign/ =============================================== File [changed]: TEditControl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/tabledesign/TEditControl.cxx?r1=1.59&r2=1.60 Delta lines: +51 -50 --------------------- --- TEditControl.cxx 2008-04-10 16:39:03+0000 1.59 +++ TEditControl.cxx 2008-06-25 12:59:47+0000 1.60 @@ -181,9 +181,9 @@ //------------------------------------------------------------------ IMPL_LINK(OTableEditorCtrl::ClipboardInvalidator, OnInvalidate, void*, EMPTYARG) { - m_pOwner->GetView()->getController()->InvalidateFeature(SID_CUT); - m_pOwner->GetView()->getController()->InvalidateFeature(SID_COPY); - m_pOwner->GetView()->getController()->InvalidateFeature(SID_PASTE); + m_pOwner->GetView()->getController().InvalidateFeature(SID_CUT); + m_pOwner->GetView()->getController().InvalidateFeature(SID_COPY); + m_pOwner->GetView()->getController().InvalidateFeature(SID_PASTE); return 0L; } @@ -195,7 +195,7 @@ ////////////////////////////////////////////////////////////////////// // Soll der Entwurf ReadOnly geoeffnet werden ? - sal_Bool bRead(GetView()->getController()->isReadOnly()); + sal_Bool bRead(GetView()->getController().isReadOnly()); SetReadOnly( bRead ); @@ -252,14 +252,14 @@ SetHelpId(HID_TABDESIGN_BACKGROUND); GetDataWindow().SetHelpId(HID_CTL_TABLEEDIT); - m_pRowList = GetView()->getController()->getRows(); + m_pRowList = GetView()->getController().getRows(); m_nDataPos = 0; } //------------------------------------------------------------------------------ SfxUndoManager* OTableEditorCtrl::GetUndoManager() const { - return GetView()->getController()->getUndoMgr(); + return GetView()->getController().getUndoMgr(); } //------------------------------------------------------------------------------ @@ -315,7 +315,7 @@ Reference<XConnection> xCon; try { - xCon = GetView()->getController()->getConnection(); + xCon = GetView()->getController().getConnection(); Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>(); nMaxTextLen = ((xub_StrLen)xMetaData.is() ? static_cast<xub_StrLen>(xMetaData->getMaxColumnNameLength()) : 0); @@ -443,7 +443,7 @@ DBG_CHKTHIS(OTableEditorCtrl,NULL); ////////////////////////////////////////////////////////////////////// // Wenn EditorCtrl ReadOnly ist, darf nicht editiert werden - Reference<XPropertySet> xTable = GetView()->getController()->getTable(); + Reference<XPropertySet> xTable = GetView()->getController().getTable(); if (IsReadOnly() || ( xTable.is() && xTable->getPropertySetInfo()->hasPropertyByName(PROPERTY_TYPE) && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) @@ -500,7 +500,7 @@ if( !pActFieldDescr ) break; - const OTypeInfoMap* pTypeInfo = GetView()->getController()->getTypeInfo(); + const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo(); OTypeInfoMap::const_iterator aIter = pTypeInfo->begin(); for(;aIter != pTypeInfo->end();++aIter) pTypeCell->InsertEntry( aIter->second->aUIName ); @@ -604,7 +604,7 @@ { DBG_CHKTHIS(OTableEditorCtrl,NULL); - Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference<XConnection> xCon = GetView()->getController().getConnection(); Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>(); ::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True); @@ -798,7 +798,7 @@ GetUndoManager()->EnterListAction( sActionDescription, String() ); if (!pActFieldDescr) { - const OTypeInfoMap* pTypeInfoMap = GetView()->getController()->getTypeInfo(); + const OTypeInfoMap* pTypeInfoMap = GetView()->getController().getTypeInfo(); if ( !pTypeInfoMap->empty() ) { OTypeInfoMap::const_iterator aTypeIter = pTypeInfoMap->find(DataType::VARCHAR); @@ -807,7 +807,7 @@ pActRow->SetFieldType( aTypeIter->second ); } else - pActRow->SetFieldType( GetView()->getController()->getTypeInfoFallBack() ); + pActRow->SetFieldType( GetView()->getController().getTypeInfoFallBack() ); nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType) ); pActFieldDescr = pActRow->GetActFieldDescr(); @@ -833,7 +833,7 @@ ////////////////////////////////////////////////////////////////////// // Das ModifyFlag setzen - GetView()->getController()->setModified( sal_True ); + GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } // ----------------------------------------------------------------------------- @@ -841,7 +841,7 @@ { USHORT nPos = pTypeCell->GetSelectEntryPos(); if(nPos != LISTBOX_ENTRY_NOTFOUND) - SwitchType( GetView()->getController()->getTypeInfo(nPos) ); + SwitchType( GetView()->getController().getTypeInfo(nPos) ); else SwitchType(TOTypeInfoSP()); } @@ -854,9 +854,9 @@ // ----------------------------------------------------------------------------- void OTableEditorCtrl::InvalidateFeatures() { - GetView()->getController()->InvalidateFeature(SID_UNDO); - GetView()->getController()->InvalidateFeature(SID_REDO); - GetView()->getController()->InvalidateFeature(SID_SAVEDOC); + GetView()->getController().InvalidateFeature(SID_UNDO); + GetView()->getController().InvalidateFeature(SID_REDO); + GetView()->getController().InvalidateFeature(SID_SAVEDOC); } //------------------------------------------------------------------------------ void OTableEditorCtrl::Undo() @@ -913,7 +913,7 @@ ////////////////////////////////////////////////////////////////////// // Basisnamen zum Anhaengen einer Numerierung erstellen String aBaseName; - Reference<XConnection> xCon = GetView()->getController()->getConnection(); + Reference<XConnection> xCon = GetView()->getController().getConnection(); Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>(); xub_StrLen nMaxTextLen((xub_StrLen)( xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0)); @@ -967,7 +967,7 @@ pRow->SetReadOnly( sal_False ); sal_Int32 nType = pRow->GetActFieldDescr()->GetType(); if ( pRow->GetActFieldDescr() ) - pRow->GetActFieldDescr()->SetType(GetView()->getController()->getTypeInfoByType(nType)); + pRow->GetActFieldDescr()->SetType(GetView()->getController().getTypeInfoByType(nType)); ////////////////////////////////////////////////////////////////////// // Anpassen des Feldnamens aFieldName = GenerateName( pRow->GetActFieldDescr()->GetName() ); @@ -989,7 +989,7 @@ ////////////////////////////////////////////////////////////////////// // Undo-Action erzeugen GetUndoManager()->AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) ); - GetView()->getController()->setModified( sal_True ); + GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } @@ -997,7 +997,7 @@ void OTableEditorCtrl::DeleteRows() { DBG_CHKTHIS(OTableEditorCtrl,NULL); - OSL_ENSURE(GetView()->getController()->isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!"); + OSL_ENSURE(GetView()->getController().isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!"); ////////////////////////////////////////////////////////////////////// // Undo-Action erzeugen GetUndoManager()->AddUndoAction( new OTableEditorDelUndoAct(this) ); @@ -1034,7 +1034,7 @@ SetDataPtr( m_nDataPos ); ActivateCell(); pDescrWin->DisplayData( pActRow->GetActFieldDescr() ); - GetView()->getController()->setModified( sal_True ); + GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } @@ -1042,7 +1042,7 @@ void OTableEditorCtrl::InsertNewRows( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - OSL_ENSURE(GetView()->getController()->isAddAllowed(),"Call of InsertNewRows not valid here. Please check isAppendAllowed!"); + OSL_ENSURE(GetView()->getController().isAddAllowed(),"Call of InsertNewRows not valid here. Please check isAppendAllowed!"); ////////////////////////////////////////////////////////////////////// // Undo-Action erzeugen long nInsertRows = GetSelectRowCount(); @@ -1055,7 +1055,7 @@ m_pRowList->insert( m_pRowList->begin()+i ,::boost::shared_ptr<OTableRow>(new OTableRow())); RowInserted( nRow, nInsertRows, sal_True ); - GetView()->getController()->setModified( sal_True ); + GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } @@ -1322,8 +1322,8 @@ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - sal_Bool bIsCutAllowed = (GetView()->getController()->isAddAllowed() && GetView()->getController()->isDropAllowed()) || - GetView()->getController()->isAlterAllowed(); + sal_Bool bIsCutAllowed = (GetView()->getController().isAddAllowed() && GetView()->getController().isDropAllowed()) || + GetView()->getController().isAlterAllowed(); if(bIsCutAllowed) { @@ -1339,7 +1339,7 @@ bIsCutAllowed = sal_False; } -// Reference<XPropertySet> xTable = GetView()->getController()->getTable(); +// Reference<XPropertySet> xTable = GetView()->getController().getTable(); // if( !IsCopyAllowed(nRow) || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) // return sal_False; @@ -1358,7 +1358,7 @@ bIsCopyAllowed = pNameCell->GetSelected().Len() != 0; else if(m_eChildFocus == ROW) { - Reference<XPropertySet> xTable = GetView()->getController()->getTable(); + Reference<XPropertySet> xTable = GetView()->getController().getTable(); if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) return sal_False; @@ -1385,7 +1385,7 @@ sal_Bool OTableEditorCtrl::IsPasteAllowed( long /*nRow*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - sal_Bool bAllowed = GetView()->getController()->isAddAllowed(); + sal_Bool bAllowed = GetView()->getController().isAddAllowed(); if ( bAllowed ) { TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); @@ -1404,7 +1404,7 @@ { if(m_eChildFocus == NAME) { - if(GetView()->getController()->isAlterAllowed()) + if(GetView()->getController().isAlterAllowed()) { SaveData(-1,FIELD_NAME); pNameCell->Cut(); @@ -1413,7 +1413,7 @@ } else if(m_eChildFocus == DESCRIPTION) { - if(GetView()->getController()->isAlterAllowed()) + if(GetView()->getController().isAlterAllowed()) { SaveData(-1,FIELD_DESCR); pDescrCell->Cut(); @@ -1451,7 +1451,7 @@ } else if(m_eChildFocus == NAME) { - if(GetView()->getController()->isAlterAllowed()) + if(GetView()->getController().isAlterAllowed()) { pNameCell->Paste(); CellModified(); @@ -1459,7 +1459,7 @@ } else if(m_eChildFocus == DESCRIPTION) { - if(GetView()->getController()->isAlterAllowed()) + if(GetView()->getController().isAlterAllowed()) { pDescrCell->Paste(); CellModified(); @@ -1472,13 +1472,13 @@ { DBG_CHKTHIS(OTableEditorCtrl,NULL); - return GetSelectRowCount() != 0 && GetView()->getController()->isDropAllowed(); -// Reference<XPropertySet> xTable = GetView()->getController()->getTable(); + return GetSelectRowCount() != 0 && GetView()->getController().isDropAllowed(); +// Reference<XPropertySet> xTable = GetView()->getController().getTable(); // if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW"))) // return sal_False; // // // Wenn nur Felder hinzugefuegt werden duerfen, Delete nur auf neuen Feldern -// Reference<XConnection> xCon = GetView()->getController()->getConnection(); +// Reference<XConnection> xCon = GetView()->getController().getConnection(); // Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL; // // return !(xTable.is() && xTable->getPropertySetInfo()->getPropertyByName(PROPERTY_NAME).Attributes & PropertyAttribute::READONLY) || @@ -1490,10 +1490,10 @@ { DBG_CHKTHIS(OTableEditorCtrl,NULL); - sal_Bool bInsertNewAllowed = GetView()->getController()->isAddAllowed(); + sal_Bool bInsertNewAllowed = GetView()->getController().isAddAllowed(); ////////////////////////////////////////////////////////////// // Wenn nur Felder hinzugefuegt werden duerfen, Paste nur in neue Felder - if (bInsertNewAllowed && !GetView()->getController()->isDropAllowed()) + if (bInsertNewAllowed && !GetView()->getController().isDropAllowed()) { SetDataPtr(nRow); if( GetActRow()->IsReadOnly() ) @@ -1510,10 +1510,10 @@ if( !GetSelectRowCount() ) return sal_False; - OTableController* pController = GetView()->getController(); + OTableController& rController = GetView()->getController(); try { - Reference<XConnection> xCon = pController->getConnection(); + Reference<XConnection> xCon = rController.getConnection(); Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>(); if(!xMetaData.is() || !xMetaData->supportsCoreSQLGrammar()) @@ -1525,7 +1525,7 @@ OSL_ASSERT(!"supportsCoreSQLGrammar"); } - Reference<XPropertySet> xTable = pController->getTable(); + Reference<XPropertySet> xTable = rController.getTable(); ////////////////////////////////////////////////////////////// // Key darf nicht veraendert werden // Dies gilt jedoch nur, wenn die Tabelle nicht neu ist und keine ::com::sun::star::sdbcx::View. Ansonsten wird kein DROP ausgeführt @@ -1698,8 +1698,8 @@ { nPasteEvent = 0; - sal_Int32 nPastePosition = GetView()->getController()->getFirstEmptyRowPosition(); - if ( !GetView()->getController()->getTable().is() ) + sal_Int32 nPastePosition = GetView()->getController().getFirstEmptyRowPosition(); + if ( !GetView()->getController().getTable().is() ) nPastePosition = GetSelectRowCount() ? FirstSelectedRow() : GetCurRow(); if (!IsInsertNewAllowed(nPastePosition)) @@ -1736,8 +1736,8 @@ { DBG_CHKTHIS(OTableEditorCtrl,NULL); nInsNewRowsEvent = 0; - sal_Int32 nPastePosition = GetView()->getController()->getFirstEmptyRowPosition(); - if ( !GetView()->getController()->getTable().is() ) + sal_Int32 nPastePosition = GetView()->getController().getFirstEmptyRowPosition(); + if ( !GetView()->getController().getTable().is() ) nPastePosition = GetSelectRowCount() ? FirstSelectedRow() : m_nDataPos; InsertNewRows( nPastePosition ); @@ -1816,7 +1816,7 @@ ////////////////////////////////////////////////////////////////////// // Das ModifyFlag der TableDocSh setzen - GetView()->getController()->setModified( sal_True ); + GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } @@ -1863,12 +1863,13 @@ if ( _pType.get() ) { sal_uInt16 nCurrentlySelected = pTypeCell->GetSelectEntryPos(); - OTableController* pController = GetView()->getController(); - if ((LISTBOX_ENTRY_NOTFOUND == nCurrentlySelected) || (pController->getTypeInfo(nCurrentlySelected) != _pType)) + if ( ( LISTBOX_ENTRY_NOTFOUND == nCurrentlySelected ) + || ( GetView()->getController().getTypeInfo( nCurrentlySelected ) != _pType ) + ) { USHORT nEntryPos = 0; - const OTypeInfoMap* pTypeInfo = GetView()->getController()->getTypeInfo(); + const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo(); OTypeInfoMap::const_iterator aIter = pTypeInfo->begin(); for(;aIter != pTypeInfo->end();++aIter,++nEntryPos) { @@ -1886,7 +1887,7 @@ sal_Int32 nFormatKey = ::dbtools::getDefaultNumberFormat( pActFieldDescr->GetType(), pActFieldDescr->GetScale(), pActFieldDescr->IsCurrency(), - Reference< XNumberFormatTypes>(GetView()->getController()->getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY), + Reference< XNumberFormatTypes>(GetView()->getController().getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(),UNO_QUERY), GetView()->getLocale()); pActFieldDescr->SetFormatKey(nFormatKey); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
