diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | dc30b423e4091bcb8e3bcdc975744cc4361d905a (patch) | |
tree | 33840e98d9741015843df04a240a7f422fcc31f2 /dbaccess | |
parent | 2cf617e18ddb7b98e2288616b5a2ad12c5a5d0da (diff) | |
parent | ae630ba91a3083db1752d1a9d67845b97f180c3a (diff) |
merge to m67
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasecontext.hxx | 7 | ||||
-rw-r--r-- | dbaccess/source/core/misc/DatabaseDataProvider.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/controllerframe.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/databaseobjectview.cxx | 49 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 51 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx | 1 |
8 files changed, 111 insertions, 54 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx index 45e6bf5b87da..658ddacac181 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.hxx +++ b/dbaccess/source/core/dataaccess/databasecontext.hxx @@ -209,9 +209,10 @@ public: virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); - void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl ); - void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl ); - void databaseDocumentURLChange( const ::rtl::OUString& _rOldURL, const ::rtl::OUString& _rNewURL ); + void registerPrivate(const ::rtl::OUString& _sName + ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl); + void deregisterPrivate(const ::rtl::OUString& _sName); + void nameChangePrivate(const ::rtl::OUString& _sRegisteredName,const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName); void storeTransientProperties( ODatabaseModelImpl& _rModelImpl); void appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); void removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel); diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index cd16eb68a5ee..b6aff3db3240 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -584,7 +584,8 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat { xChartData->setData(uno::Sequence< uno::Sequence<double> >()); xChartData->setColumnDescriptions(uno::Sequence< ::rtl::OUString >()); - m_xInternal->deleteSequence(0); + if ( m_xInternal->hasDataByRangeRepresentation(::rtl::OUString::valueOf(sal_Int32(0))) ) + m_xInternal->deleteSequence(0); } uno::Sequence< ::rtl::OUString > aColumns; diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index ddfb583f65c9..91b0fd968afb 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1368,7 +1368,10 @@ void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErr m_aCurrentError = aInfo; } else + { + m_aCurrentError = aInfo; m_aAsyncDisplayError.Call(); + } } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx index e20f5e04b35b..491e27fc49de 100644 --- a/dbaccess/source/ui/misc/controllerframe.cxx +++ b/dbaccess/source/ui/misc/controllerframe.cxx @@ -44,6 +44,8 @@ #include <rtl/ref.hxx> #include <sfx2/objsh.hxx> #include <tools/diagnose_ex.h> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> //........................................................................ namespace dbaui @@ -77,6 +79,7 @@ namespace dbaui using ::com::sun::star::lang::DisposedException; using ::com::sun::star::lang::EventObject; using ::com::sun::star::document::XDocumentEventBroadcaster; + using ::com::sun::star::awt::XWindow; /** === end UNO using === **/ //==================================================================== @@ -125,7 +128,7 @@ namespace dbaui ,m_xDocEventBroadcaster() ,m_pListener() ,m_bActive( false ) - ,m_bLivesInTopWindow( false ) + ,m_bIsTopLevelDocumentWindow( false ) { } @@ -134,7 +137,7 @@ namespace dbaui Reference< XDocumentEventBroadcaster > m_xDocEventBroadcaster; ::rtl::Reference< FrameWindowActivationListener > m_pListener; bool m_bActive; - bool m_bLivesInTopWindow; + bool m_bIsTopLevelDocumentWindow; }; //==================================================================== @@ -208,7 +211,7 @@ namespace dbaui if ( !xCompController.is() ) return; - if ( _rData.m_bActive && _rData.m_bLivesInTopWindow ) + if ( _rData.m_bActive && _rData.m_bIsTopLevelDocumentWindow ) { // set the "current component" at the SfxObjectShell Reference< XModel > xModel( xCompController->getModel() ); @@ -288,9 +291,21 @@ namespace dbaui void ( SAL_CALL XTopWindow::*pListenerAction )( const Reference< XTopWindowListener >& ) = _bRegister ? &XTopWindow::addTopWindowListener : &XTopWindow::removeTopWindowListener; - Reference< XTopWindow > xFrameContainer( m_pData->m_xFrame->getContainerWindow(), UNO_QUERY ); + const Reference< XWindow > xContainerWindow( m_pData->m_xFrame->getContainerWindow(), UNO_SET_THROW ); if ( _bRegister ) - m_pData->m_bLivesInTopWindow = xFrameContainer.is(); + { + const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + ENSURE_OR_THROW( pContainerWindow, "no Window implementation for the frame's container window!" ); + + /*const Window* pContainerParentWindow = pContainerWindow->GetParent(); + if ( pContainerParentWindow && ( pContainerParentWindow->GetType() == WINDOW_BORDERWINDOW ) ) + pContainerParentWindow = pContainerParentWindow->GetParent(); + m_pData->m_bIsTopLevelDocumentWindow = ( pContainerParentWindow == NULL );*/ + + m_pData->m_bIsTopLevelDocumentWindow = ( pContainerWindow->GetExtendedStyle() & WB_EXT_DOCUMENT ) != 0; + } + + const Reference< XTopWindow > xFrameContainer( xContainerWindow, UNO_QUERY ); if ( xFrameContainer.is() ) (xFrameContainer.get()->*pListenerAction)( this ); } diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 7cf3c067f419..24debbe9bf7d 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -31,66 +31,30 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX #include "databaseobjectview.hxx" -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef DBACCESS_ASYNCMODALDIALOG_HXX #include "asyncmodaldialog.hxx" -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ #include <com/sun/star/frame/XDispatchProvider.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ #include <com/sun/star/frame/XFrame.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_XFRAMES_HPP_ #include <com/sun/star/frame/XFrames.hpp> -#endif -#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_ #include <com/sun/star/frame/FrameSearchFlag.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_APPLICATION_XTABLEUIPROVIDER_HPP_ #include <com/sun/star/sdb/application/XTableUIProvider.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ #include <com/sun/star/beans/NamedValue.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_ #include <com/sun/star/awt/Rectangle.hpp> -#endif /** === end UNO includes === **/ -#ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include <comphelper/sequence.hxx> -#endif -#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX #include <comphelper/namedvaluecollection.hxx> -#endif - -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include <connectivity/dbtools.hxx> -#endif - -#ifndef _OSL_DIAGNOSE_H_ #include <osl/diagnose.h> -#endif -#ifndef TOOLS_DIAGNOSE_EX_H +#include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> -#endif +#include <vcl/window.hxx> // ......................................................................... namespace dbaui @@ -183,6 +147,15 @@ namespace dbaui lArgs[nArg++] <<= aProp; m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW); + + // everything we load can be considered a "top level document", so set the respective bit at the window. + // This, amongst other things, triggers that the component in this task participates in the + // "ThisComponent"-game for the global application Basic. + const Reference< XFrame > xFrame( m_xFrameLoader, UNO_QUERY_THROW ); + const Reference< XWindow > xFrameWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + Window* pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow ); + ENSURE_OR_THROW( pContainerWindow, "no implementation access to the frame's container window!" ); + pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); } Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_QUERY_THROW ); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 82eff9c059fb..b8fd1f5f972f 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1305,6 +1305,9 @@ namespace // first extract the inner joins conditions GetInnerJoinCriteria(_pView,pNodeTmp); + // now simplify again, join are checked in ComparisonPredicate + ::connectivity::OSQLParseNode::absorptions(pNodeTmp); + pNodeTmp = pNode->getChild(1); // it could happen that pCondition is not more valid eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pNodeTmp, rLevel); @@ -1315,7 +1318,7 @@ namespace SqlParseError GetANDCriteria( OQueryDesignView* _pView, OSelectionBrowseBox* _pSelectionBrw, const ::connectivity::OSQLParseNode * pCondition, - const sal_uInt16 nLevel, + sal_uInt16& nLevel, sal_Bool bHaving, bool bAddOrOnOneLine); //------------------------------------------------------------------------------ @@ -1352,7 +1355,11 @@ namespace if ( SQL_ISRULE(pChild,search_condition) ) eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pChild,nLevel,bHaving,bAddOrOnOneLine); else - eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, bAddOrOnOneLine ? nLevel : nLevel++,bHaving, i == 0 ? false : bAddOrOnOneLine); + { + eErrorCode = GetANDCriteria(_pView,_pSelectionBrw,pChild, nLevel,bHaving, i == 0 ? false : bAddOrOnOneLine); + if ( !bAddOrOnOneLine) + nLevel++; + } } } else @@ -1386,7 +1393,7 @@ namespace SqlParseError GetANDCriteria( OQueryDesignView* _pView, OSelectionBrowseBox* _pSelectionBrw, const ::connectivity::OSQLParseNode * pCondition, - const sal_uInt16 nLevel, + sal_uInt16& nLevel, sal_Bool bHaving, bool bAddOrOnOneLine) { @@ -1400,10 +1407,18 @@ namespace // Runde Klammern if (SQL_ISRULE(pCondition,boolean_primary)) { - sal_uInt16 nLevel2 = nLevel; // check if we have to put the or criteria on one line. - bool bMustAddOrOnOneLine = CheckOrCriteria(pCondition->getChild(1),NULL); - eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pCondition->getChild(1), nLevel2,bHaving,bMustAddOrOnOneLine ); + const ::connectivity::OSQLParseNode* pSearchCondition = pCondition->getChild(1); + bool bMustAddOrOnOneLine = CheckOrCriteria(pSearchCondition,NULL); + if ( SQL_ISRULE( pSearchCondition, search_condition) ) // we have a or + { + _pSelectionBrw->DuplicateConditionLevel( nLevel); + eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(0), nLevel,bHaving,bMustAddOrOnOneLine ); + ++nLevel; + eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(2), nLevel,bHaving,bMustAddOrOnOneLine ); + } + else + eErrorCode = GetORCriteria(_pView,_pSelectionBrw,pSearchCondition, nLevel,bHaving,bMustAddOrOnOneLine ); } // Das erste Element ist (wieder) eine AND-Verknuepfung else if ( SQL_ISRULE(pCondition,boolean_term) ) @@ -1499,10 +1514,32 @@ namespace _pSelectionBrw->AddCondition(aDragLeft, sCondition, nLevel,bAddOrOnOneLine); } } + else + { + // Funktions-Bedingung parsen + ::rtl::OUString sCondition = ParseCondition(rController,pCondition,sDecimal,aLocale,1); + Reference< XConnection> xConnection = rController.getConnection(); + Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); + // the international doesn't matter I have a string + ::rtl::OUString sName; + pCondition->getChild(0)->parseNodeToPredicateStr(sName, + xConnection, + rController.getNumberFormatter(), + aLocale, + static_cast<sal_Char>(sDecimal.toChar()), + &rController.getParser().getContext()); + + OTableFieldDescRef aDragLeft = new OTableFieldDesc(); + aDragLeft->SetField(sName); + aDragLeft->SetFunctionType(FKT_OTHER); + + if ( bHaving ) + aDragLeft->SetGroupBy(sal_True); + _pSelectionBrw->AddCondition(aDragLeft, sCondition, nLevel,bAddOrOnOneLine); + } } else if( SQL_ISRULEOR2(pCondition,existence_test,unique_test) ) { - // Funktions-Bedingung parsen ::rtl::OUString aCondition = ParseCondition(rController,pCondition,sDecimal,aLocale,0); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 6b48bc528776..05c001751fef 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1836,6 +1836,32 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt } } //------------------------------------------------------------------------------ +void OSelectionBrowseBox::DuplicateConditionLevel( const sal_uInt16 nLevel) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + const sal_uInt16 nNewLevel = nLevel +1; + OTableFields& rFields = getFields(); + OTableFields::iterator aIter = rFields.begin(); + OTableFields::iterator aEnd = rFields.end(); + for(;aIter != aEnd;++aIter) + { + OTableFieldDescRef pEntry = *aIter; + + ::rtl::OUString sValue = pEntry->GetCriteria(nLevel); + if ( sValue.getLength() ) + { + pEntry->SetCriteria( nNewLevel, sValue); + if ( nNewLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1) ) + { + RowInserted( GetRowCount()-1, 1, TRUE ); + m_bVisibleRow.push_back(sal_True); + ++m_nVisibleCount; + } + m_bVisibleRow[BROW_CRIT1_ROW + nNewLevel] = sal_True; + } // if (!pEntry->GetCriteria(nLevel).getLength() ) + } // for(;aIter != getFields().end();++aIter) +} +//------------------------------------------------------------------------------ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const String& rValue, const sal_uInt16 nLevel,bool _bAddOrOnOneLine ) { Reference< XConnection> xConnection = static_cast<OQueryController&>(getDesignView()->getController()).getConnection(); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx index 1d4a188dab9d..c92ce7caf7f0 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx @@ -132,6 +132,7 @@ namespace dbaui const String& rValue, const sal_uInt16 nLevel, bool _bAddOrOnOneLine ); + void DuplicateConditionLevel( const sal_uInt16 nLevel); void AddOrder(const OTableFieldDescRef& rInfo, const EOrderDir eDir, sal_uInt32 _nCurrentPos); void ClearAll(); OTableFieldDescRef AppendNewCol( sal_uInt16 nCnt=1 ); |