From 82233965486f88f4ce1313dcf35b4bc688e1832a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Dec 2021 13:51:03 +0200 Subject: loplugin:flatten in desktop..drawinglayer Change-Id: Ie6594c9961aba5517c6ff61fb3bc1142081b1197 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127225 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dbaccess/source/core/api/tablecontainer.cxx | 30 +++-- dbaccess/source/filter/xml/xmlfilter.cxx | 56 +++++---- dbaccess/source/ui/app/AppController.cxx | 123 ++++++++++---------- dbaccess/source/ui/browser/unodatbr.cxx | 126 ++++++++++----------- dbaccess/source/ui/dlg/indexdialog.cxx | 36 +++--- dbaccess/source/ui/misc/WTypeSelect.cxx | 26 ++--- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 33 +++--- dbaccess/source/ui/tabledesign/TableRow.cxx | 85 +++++++------- 8 files changed, 254 insertions(+), 261 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 7aefea3e2306..9bcf4b610eec 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -62,26 +62,24 @@ namespace bool lcl_isPropertySetDefaulted(const Sequence< OUString>& _aNames,const Reference& _xProp) { Reference xState(_xProp,UNO_QUERY); - if ( xState.is() ) + if ( !xState ) + return false; + const OUString* pIter = _aNames.getConstArray(); + const OUString* pEnd = pIter + _aNames.getLength(); + for(;pIter != pEnd;++pIter) { - const OUString* pIter = _aNames.getConstArray(); - const OUString* pEnd = pIter + _aNames.getLength(); - for(;pIter != pEnd;++pIter) + try { - try - { - PropertyState aState = xState->getPropertyState(*pIter); - if ( aState != PropertyState_DEFAULT_VALUE ) - break; - } - catch(const Exception&) - { - TOOLS_WARN_EXCEPTION("dbaccess", "" ); - } + PropertyState aState = xState->getPropertyState(*pIter); + if ( aState != PropertyState_DEFAULT_VALUE ) + break; + } + catch(const Exception&) + { + TOOLS_WARN_EXCEPTION("dbaccess", "" ); } - return ( pIter == pEnd ); } - return false; + return ( pIter == pEnd ); } } diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 88765c186961..6848d5a1bb2d 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -132,42 +132,40 @@ static ErrCode ReadThroughComponent( OSL_ENSURE( xStorage.is(), "Need storage!"); OSL_ENSURE(nullptr != pStreamName, "Please, please, give me a name!"); - if ( xStorage.is() ) - { - uno::Reference< io::XStream > xDocStream; + if ( !xStorage ) + // TODO/LATER: better error handling + return ErrCode(1); - try - { - // open stream (and set parser input) - OUString sStreamName = OUString::createFromAscii(pStreamName); - if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) ) - { - // stream name not found! return immediately with OK signal - return ERRCODE_NONE; - } + uno::Reference< io::XStream > xDocStream; - // get input stream - xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); - } - catch (const packages::WrongPasswordException&) - { - return ERRCODE_SFX_WRONGPASSWORD; - } - catch (const uno::Exception&) + try + { + // open stream (and set parser input) + OUString sStreamName = OUString::createFromAscii(pStreamName); + if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) ) { - return ErrCode(1); // TODO/LATER: error handling + // stream name not found! return immediately with OK signal + return ERRCODE_NONE; } - uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); - // read from the stream - return ReadThroughComponent( xInputStream - ,xModelComponent - ,rxContext - ,_rFilter ); + // get input stream + xDocStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); + } + catch (const packages::WrongPasswordException&) + { + return ERRCODE_SFX_WRONGPASSWORD; + } + catch (const uno::Exception&) + { + return ErrCode(1); // TODO/LATER: error handling } - // TODO/LATER: better error handling - return ErrCode(1); + uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); + // read from the stream + return ReadThroughComponent( xInputStream + ,xModelComponent + ,rxContext + ,_rFilter ); } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 003b295e3178..f6837cfdbe65 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1694,23 +1694,23 @@ bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView) if (!rTreeView.get_cursor(xHdlEntry.get())) return false; - if (pContainer->isLeaf(rTreeView, *xHdlEntry)) + if (!pContainer->isLeaf(rTreeView, *xHdlEntry)) + return false; // not handled + + try { - try - { - // opens a new frame with either the table or the query or report or form or view - openElementWithArguments( - getContainer()->getQualifiedName(xHdlEntry.get()), - getContainer()->getElementType(), - E_OPEN_NORMAL, - 0, - ::comphelper::NamedValueCollection() ); - return true; // handled - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION("dbaccess"); - } + // opens a new frame with either the table or the query or report or form or view + openElementWithArguments( + getContainer()->getQualifiedName(xHdlEntry.get()), + getContainer()->getElementType(), + E_OPEN_NORMAL, + 0, + ::comphelper::NamedValueCollection() ); + return true; // handled + } + catch(const Exception&) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); } return false; // not handled @@ -2324,43 +2324,42 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const sal_Int8 nActionAskedFor = _rEvt.mnAction; // check if we're a table or query container OApplicationView* pView = getContainer(); - if ( pView && !isDataSourceReadOnly() ) + if ( !pView || isDataSourceReadOnly() ) + return DND_ACTION_NONE; + + ElementType eType = pView->getElementType(); + if ( eType == E_NONE || (eType == E_TABLE && isConnectionReadOnly()) ) + return DND_ACTION_NONE; + + // check for the concrete type + if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType))) + return DND_ACTION_COPY; + + if ( eType != E_FORM && eType != E_REPORT ) + return DND_ACTION_NONE; + + sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE; + if ( nAction == DND_ACTION_NONE ) + return DND_ACTION_NONE; + + auto xHitEntry = pView->getEntry(_rEvt.maPosPixel); + if (xHitEntry) { - ElementType eType = pView->getElementType(); - if ( eType != E_NONE && (eType != E_TABLE || !isConnectionReadOnly()) ) + OUString sName = pView->getQualifiedName(xHitEntry.get()); + if ( !sName.isEmpty() ) { - // check for the concrete type - if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType))) - return DND_ACTION_COPY; - if ( eType == E_FORM || eType == E_REPORT ) + Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY); + if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) ) { - sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE; - if ( nAction != DND_ACTION_NONE ) - { - auto xHitEntry = pView->getEntry(_rEvt.maPosPixel); - if (xHitEntry) - { - OUString sName = pView->getQualifiedName(xHitEntry.get()); - if ( !sName.isEmpty() ) - { - Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY); - if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) ) - { - Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY); - if ( xHitObject.is() ) - nAction = nActionAskedFor & DND_ACTION_COPYMOVE; - } - else - nAction = DND_ACTION_NONE; - } - } - } - return nAction; + Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY); + if ( xHitObject.is() ) + nAction = nActionAskedFor & DND_ACTION_COPYMOVE; } + else + nAction = DND_ACTION_NONE; } } - - return DND_ACTION_NONE; + return nAction; } sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt ) @@ -2616,25 +2615,25 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > } // initial preview mode - if ( m_xDataSource.is() ) + if ( !m_xDataSource ) + return true; + + try { - try - { - // to get the 'modified' for the data source - ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); - if ( aLayoutInfo.has( INFO_PREVIEW ) ) - { - const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); - m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); - if ( getView() ) - getContainer()->switchPreview( m_ePreviewMode ); - } - } - catch( const Exception& ) + // to get the 'modified' for the data source + ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); + if ( aLayoutInfo.has( INFO_PREVIEW ) ) { - DBG_UNHANDLED_EXCEPTION("dbaccess"); + const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); + m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); + if ( getView() ) + getContainer()->switchPreview( m_ePreviewMode ); } } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } return true; } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 035a0e1ef8c2..ee07b531f8b2 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -286,49 +286,49 @@ bool SbaTableQueryBrowser::Construct(vcl::Window* pParent) { SAL_WARN("dbaccess.ui", "SbaTableQueryBrowser::Construct: could not create (or start listening at) the database context!"); } + // some help ids - if (getBrowserView() && getBrowserView()->getVclControl()) - { + if (!getBrowserView() || !getBrowserView()->getVclControl()) + return true; - // create controls and set sizes - const tools::Long nFrameWidth = getBrowserView()->LogicToPixel(::Size(3, 0), MapMode(MapUnit::MapAppFont)).Width(); + // create controls and set sizes + const tools::Long nFrameWidth = getBrowserView()->LogicToPixel(::Size(3, 0), MapMode(MapUnit::MapAppFont)).Width(); - m_pSplitter = VclPtr::Create(getBrowserView(),WB_HSCROLL); - m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) ); - m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) ); + m_pSplitter = VclPtr::Create(getBrowserView(),WB_HSCROLL); + m_pSplitter->SetPosSizePixel( ::Point(0,0), ::Size(nFrameWidth,0) ); + m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) ); - m_pTreeView = VclPtr::Create(getBrowserView()); + m_pTreeView = VclPtr::Create(getBrowserView()); - weld::TreeView& rTreeView = m_pTreeView->GetWidget(); - rTreeView.connect_expanding(LINK(this, SbaTableQueryBrowser, OnExpandEntry)); + weld::TreeView& rTreeView = m_pTreeView->GetWidget(); + rTreeView.connect_expanding(LINK(this, SbaTableQueryBrowser, OnExpandEntry)); - m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry)); + m_pTreeView->setCopyHandler(LINK(this, SbaTableQueryBrowser, OnCopyEntry)); - m_pTreeView->setContextMenuProvider( this ); - m_pTreeView->setControlActionListener( this ); - m_pTreeView->SetHelpId(HID_CTL_TREEVIEW); + m_pTreeView->setContextMenuProvider( this ); + m_pTreeView->setControlActionListener( this ); + m_pTreeView->SetHelpId(HID_CTL_TREEVIEW); - // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide - m_pSplitter->SetSplitPosPixel(getBrowserView()->LogicToPixel(::Size(80, 0), MapMode(MapUnit::MapAppFont)).Width()); + // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide + m_pSplitter->SetSplitPosPixel(getBrowserView()->LogicToPixel(::Size(80, 0), MapMode(MapUnit::MapAppFont)).Width()); - getBrowserView()->setSplitter(m_pSplitter); - getBrowserView()->setTreeView(m_pTreeView); + getBrowserView()->setSplitter(m_pSplitter); + getBrowserView()->setTreeView(m_pTreeView); - // fill view with data - rTreeView.set_sort_order(true); - rTreeView.set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){ - return OnTreeEntryCompare(rLeft, rRight); - }); - rTreeView.make_sorted(); - m_pTreeView->SetSelChangeHdl(LINK(this, SbaTableQueryBrowser, OnSelectionChange)); - m_pTreeView->show_container(); + // fill view with data + rTreeView.set_sort_order(true); + rTreeView.set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){ + return OnTreeEntryCompare(rLeft, rRight); + }); + rTreeView.make_sorted(); + m_pTreeView->SetSelChangeHdl(LINK(this, SbaTableQueryBrowser, OnSelectionChange)); + m_pTreeView->show_container(); - // TODO - getBrowserView()->getVclControl()->SetHelpId(HID_CTL_TABBROWSER); - if (getBrowserView()->getVclControl()->GetHeaderBar()) - getBrowserView()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER); - InvalidateFeature(ID_BROWSER_EXPLORER); - } + // TODO + getBrowserView()->getVclControl()->SetHelpId(HID_CTL_TABBROWSER); + if (getBrowserView()->getVclControl()->GetHeaderBar()) + getBrowserView()->getVclControl()->GetHeaderBar()->SetHelpId(HID_DATABROWSE_HEADER); + InvalidateFeature(ID_BROWSER_EXPLORER); return true; } @@ -2427,45 +2427,45 @@ bool SbaTableQueryBrowser::implSelect(const OUString& _rDataSourceName, const OU const SharedConnection& _rxConnection, bool _bSelectDirect) { - if (_rDataSourceName.getLength() && _rCommand.getLength() && (-1 != nCommandType)) - { - std::unique_ptr xDataSource; - std::unique_ptr xCommandType; - std::unique_ptr xCommand = getObjectEntry( _rDataSourceName, _rCommand, nCommandType, &xDataSource, &xCommandType, true, _rxConnection ); + if (!_rDataSourceName.getLength() || !_rCommand.getLength() || (-1 == nCommandType)) + return false; - if (xCommand) - { - weld::TreeView& rTreeView = m_pTreeView->GetWidget(); + std::unique_ptr xDataSource; + std::unique_ptr xCommandType; + std::unique_ptr xCommand = getObjectEntry( _rDataSourceName, _rCommand, nCommandType, &xDataSource, &xCommandType, true, _rxConnection ); - bool bSuccess = true; - if ( _bSelectDirect ) - { - bSuccess = implSelect(xCommand.get()); - } - else - { - rTreeView.select(*xCommand); - } + if (xCommand) + { + weld::TreeView& rTreeView = m_pTreeView->GetWidget(); - if ( bSuccess ) - { - rTreeView.scroll_to_row(*xCommand); - rTreeView.set_cursor(*xCommand); - } + bool bSuccess = true; + if ( _bSelectDirect ) + { + bSuccess = implSelect(xCommand.get()); } - else if (!xCommandType) + else { - if (m_xCurrentlyDisplayed) - { - // tell the old entry (if any) it has been deselected - selectPath(m_xCurrentlyDisplayed.get(), false); - m_xCurrentlyDisplayed.reset(); - } + rTreeView.select(*xCommand); + } - // we have a command and need to display this in the rowset - return implLoadAnything(_rDataSourceName, _rCommand, nCommandType, _bEscapeProcessing, _rxConnection); + if ( bSuccess ) + { + rTreeView.scroll_to_row(*xCommand); + rTreeView.set_cursor(*xCommand); } } + else if (!xCommandType) + { + if (m_xCurrentlyDisplayed) + { + // tell the old entry (if any) it has been deselected + selectPath(m_xCurrentlyDisplayed.get(), false); + m_xCurrentlyDisplayed.reset(); + } + + // we have a command and need to display this in the rowset + return implLoadAnything(_rDataSourceName, _rCommand, nCommandType, _bEscapeProcessing, _rxConnection); + } return false; } diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index cbe866cf5be4..4c93128482d5 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -537,28 +537,28 @@ namespace dbaui bool DbaIndexDialog::implSaveModified(bool _bPlausibility) { - if (m_xPreviousSelection) - { - // try to commit the previously selected index - if (m_xFields->IsModified() && !m_xFields->SaveModified()) - return false; + if (!m_xPreviousSelection) + return true; - Indexes::iterator aPreviouslySelected = m_xIndexes->begin() + m_xIndexList->get_id(*m_xPreviousSelection).toUInt32(); + // try to commit the previously selected index + if (m_xFields->IsModified() && !m_xFields->SaveModified()) + return false; - // the unique flag - aPreviouslySelected->bUnique = m_xUnique->get_active(); - if (m_xUnique->get_state_changed_from_saved()) - aPreviouslySelected->setModified(true); + Indexes::iterator aPreviouslySelected = m_xIndexes->begin() + m_xIndexList->get_id(*m_xPreviousSelection).toUInt32(); - // the fields - m_xFields->commitTo(aPreviouslySelected->aFields); - if (m_xFields->GetSavedValue() != aPreviouslySelected->aFields) - aPreviouslySelected->setModified(true); + // the unique flag + aPreviouslySelected->bUnique = m_xUnique->get_active(); + if (m_xUnique->get_state_changed_from_saved()) + aPreviouslySelected->setModified(true); - // plausibility checks - if (_bPlausibility && !implCheckPlausibility(aPreviouslySelected)) - return false; - } + // the fields + m_xFields->commitTo(aPreviouslySelected->aFields); + if (m_xFields->GetSavedValue() != aPreviouslySelected->aFields) + aPreviouslySelected->setModified(true); + + // plausibility checks + if (_bPlausibility && !implCheckPlausibility(aPreviouslySelected)) + return false; return true; } diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 245e6281ed87..6f3fbd79d22c 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -391,25 +391,25 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool) xContextMenu->set_active("primarykey", true); OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); - if (sCommand == "primarykey") + if (sCommand != "primarykey") + return true; + + for (sal_Int32 j = 0 ; j < nCount; ++j) { - for (sal_Int32 j = 0 ; j < nCount; ++j) + OFieldDescription* pFieldDescr = reinterpret_cast(m_xControl->get_id(j).toInt64()); + if (pFieldDescr) { - OFieldDescription* pFieldDescr = reinterpret_cast(m_xControl->get_id(j).toInt64()); - if (pFieldDescr) + if(!bCheckOk && m_xControl->is_selected(j)) { - if(!bCheckOk && m_xControl->is_selected(j)) - { - setPrimaryKey(pFieldDescr,j,true); - } - else - { - setPrimaryKey(pFieldDescr,j); - } + setPrimaryKey(pFieldDescr,j,true); + } + else + { + setPrimaryKey(pFieldDescr,j); } } - m_aChangeHdl.Call(*m_xControl); } + m_aChangeHdl.Call(*m_xControl); return true; } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 4ea3681e26cd..ce6c45673688 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1819,27 +1819,26 @@ namespace else return false; - if ( eJoinType == CROSS_JOIN || bNatural ) - { + if ( eJoinType != CROSS_JOIN && !bNatural ) + return true; - OQueryTableWindow* pLeftWindow = static_cast(_pView->getTableView())->FindTable( getTableRange(_pView,pNode->getChild(0)) ); - OQueryTableWindow* pRightWindow = static_cast(_pView->getTableView())->FindTable( getTableRange(_pView,pRightTableRef) ); - OSL_ENSURE(pLeftWindow && pRightWindow,"Table Windows could not be found!"); - if ( !pLeftWindow || !pRightWindow ) - return false; + OQueryTableWindow* pLeftWindow = static_cast(_pView->getTableView())->FindTable( getTableRange(_pView,pNode->getChild(0)) ); + OQueryTableWindow* pRightWindow = static_cast(_pView->getTableView())->FindTable( getTableRange(_pView,pRightTableRef) ); + OSL_ENSURE(pLeftWindow && pRightWindow,"Table Windows could not be found!"); + if ( !pLeftWindow || !pRightWindow ) + return false; - OTableFieldDescRef aDragLeft = new OTableFieldDesc(); - aDragLeft->SetTabWindow(pLeftWindow); - aDragLeft->SetTable(pLeftWindow->GetTableName()); - aDragLeft->SetAlias(pLeftWindow->GetAliasName()); + OTableFieldDescRef aDragLeft = new OTableFieldDesc(); + aDragLeft->SetTabWindow(pLeftWindow); + aDragLeft->SetTable(pLeftWindow->GetTableName()); + aDragLeft->SetAlias(pLeftWindow->GetAliasName()); - OTableFieldDescRef aDragRight = new OTableFieldDesc(); - aDragRight->SetTabWindow(pRightWindow); - aDragRight->SetTable(pRightWindow->GetTableName()); - aDragRight->SetAlias(pRightWindow->GetAliasName()); + OTableFieldDescRef aDragRight = new OTableFieldDesc(); + aDragRight->SetTabWindow(pRightWindow); + aDragRight->SetTable(pRightWindow->GetTableName()); + aDragRight->SetAlias(pRightWindow->GetAliasName()); - insertConnection(_pView,eJoinType,aDragLeft,aDragRight,bNatural); - } + insertConnection(_pView,eJoinType,aDragLeft,aDragRight,bNatural); return true; } diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx index 54c6f3b48aec..8f13193e1c41 100644 --- a/dbaccess/source/ui/tabledesign/TableRow.cxx +++ b/dbaccess/source/ui/tabledesign/TableRow.cxx @@ -130,53 +130,52 @@ namespace dbaui _rStr.ReadInt32( _rRow.m_nPos ); sal_Int32 nValue = 0; _rStr.ReadInt32( nValue ); - if ( nValue ) + if ( !nValue ) + return _rStr; + OFieldDescription* pFieldDesc = new OFieldDescription(); + _rRow.m_pActFieldDescr = pFieldDesc; + pFieldDesc->SetName(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); + pFieldDesc->SetDescription(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); + pFieldDesc->SetHelpText(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); + + _rStr.ReadInt32( nValue ); + Any aControlDefault; + switch ( nValue ) { - OFieldDescription* pFieldDesc = new OFieldDescription(); - _rRow.m_pActFieldDescr = pFieldDesc; - pFieldDesc->SetName(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); - pFieldDesc->SetDescription(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); - pFieldDesc->SetHelpText(_rStr.ReadUniOrByteString(_rStr.GetStreamCharSet())); - - _rStr.ReadInt32( nValue ); - Any aControlDefault; - switch ( nValue ) + case 1: { - case 1: - { - double nControlDefault; - _rStr.ReadDouble( nControlDefault ); - aControlDefault <<= nControlDefault; - break; - } - case 2: - aControlDefault <<= _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()); - break; + double nControlDefault; + _rStr.ReadDouble( nControlDefault ); + aControlDefault <<= nControlDefault; + break; } - - pFieldDesc->SetControlDefault(aControlDefault); - - _rStr.ReadInt32( nValue ); - pFieldDesc->SetTypeValue(nValue); - - _rStr.ReadInt32( nValue ); - pFieldDesc->SetPrecision(nValue); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetScale(nValue); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetIsNullable(nValue); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetFormatKey(nValue); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetHorJustify(static_cast(nValue)); - - _rStr.ReadInt32( nValue ); - pFieldDesc->SetAutoIncrement(nValue != 0); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetPrimaryKey(nValue != 0); - _rStr.ReadInt32( nValue ); - pFieldDesc->SetCurrency(nValue != 0); + case 2: + aControlDefault <<= _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet()); + break; } + + pFieldDesc->SetControlDefault(aControlDefault); + + _rStr.ReadInt32( nValue ); + pFieldDesc->SetTypeValue(nValue); + + _rStr.ReadInt32( nValue ); + pFieldDesc->SetPrecision(nValue); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetScale(nValue); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetIsNullable(nValue); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetFormatKey(nValue); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetHorJustify(static_cast(nValue)); + + _rStr.ReadInt32( nValue ); + pFieldDesc->SetAutoIncrement(nValue != 0); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetPrimaryKey(nValue != 0); + _rStr.ReadInt32( nValue ); + pFieldDesc->SetCurrency(nValue != 0); return _rStr; } } -- cgit