diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-07-09 14:49:18 +0200 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2010-07-09 14:49:18 +0200 |
commit | 06611b0b7584e21c9b876c20d35850e8fefcf093 (patch) | |
tree | b99c9d1493ea667063c1f2db63a3372791bb06a3 /dbaccess | |
parent | 2141676620130121da7590eda02a235199f527d8 (diff) |
dba33g: #i112213# handle chart import for columns
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/RowSetCache.cxx | 23 | ||||
-rw-r--r-- | dbaccess/source/core/inc/DatabaseDataProvider.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/misc/DatabaseDataProvider.cxx | 34 |
3 files changed, 45 insertions, 14 deletions
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index 72cb67209e9f..92e29ac784ba 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -158,14 +158,21 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs, try { Reference< XResultSetUpdate> xUp(_xRs,UNO_QUERY_THROW); - xUp->moveToInsertRow(); - xUp->cancelRowUpdates(); - _xRs->beforeFirst(); - m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; - m_pCacheSet = new WrappedResultSet(); - m_xCacheSet = m_pCacheSet; - m_pCacheSet->construct(_xRs,i_sRowSetFilter); - return; + Reference< XPropertySet> xProp(_xRs,UNO_QUERY); + Reference< XPropertySetInfo > xPropInfo = xProp->getPropertySetInfo(); + sal_Bool bBookmarkable = xPropInfo->hasPropertyByName(PROPERTY_ISBOOKMARKABLE) && + any2bool(xProp->getPropertyValue(PROPERTY_ISBOOKMARKABLE)) && Reference< XRowLocate >(_xRs, UNO_QUERY).is(); + if ( bBookmarkable ) + { + xUp->moveToInsertRow(); + xUp->cancelRowUpdates(); + _xRs->beforeFirst(); + m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE; + m_pCacheSet = new WrappedResultSet(); + m_xCacheSet = m_pCacheSet; + m_pCacheSet->construct(_xRs,i_sRowSetFilter); + return; + } } catch(const Exception& ex) { diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx index 7ed69f467f7e..e1ceb4dde6f2 100644 --- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx +++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx @@ -201,7 +201,7 @@ private: void impl_fillRowSet_throw(); void impl_executeRowSet_throw(::osl::ResettableMutexGuard& _rClearForNotifies); bool impl_fillParameters_nothrow( ::osl::ResettableMutexGuard& _rClearForNotifies); - void impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories); + void impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >& i_aColumnNames); void impl_invalidateParameter_nothrow(); ::com::sun::star::uno::Any impl_getNumberFormatKey_nothrow(const ::rtl::OUString & _sRangeRepresentation) const; diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index c45f9f98b8a0..da6289e472c0 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -204,6 +204,7 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat if ( createDataSourcePossible(_aArguments) ) { sal_Bool bHasCategories = sal_True; + uno::Sequence< uno::Sequence< ::rtl::OUString > > aColumnNames; const beans::PropertyValue* pArgIter = _aArguments.getConstArray(); const beans::PropertyValue* pArgEnd = pArgIter + _aArguments.getLength(); for(;pArgIter != pArgEnd;++pArgIter) @@ -211,7 +212,11 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat if ( pArgIter->Name.equalsAscii("HasCategories") ) { pArgIter->Value >>= bHasCategories; - break; + + } + else if ( pArgIter->Name.equalsAscii("ComplexColumnDescriptions") ) + { + pArgIter->Value >>= aColumnNames; } } bool bRet = false; @@ -221,7 +226,7 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat { impl_fillRowSet_throw(); impl_executeRowSet_throw(aClearForNotifies); - impl_fillInternalDataProvider_throw(bHasCategories); + impl_fillInternalDataProvider_throw(bHasCategories,aColumnNames); bRet = true; } catch(const uno::Exception& /*e*/) @@ -574,7 +579,7 @@ void DatabaseDataProvider::impl_executeRowSet_throw(::osl::ResettableMutexGuard& m_xRowSet->execute(); } // ----------------------------------------------------------------------------- -void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories) +void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCategories,const uno::Sequence< uno::Sequence< ::rtl::OUString > >& i_aColumnNames) { // clear the data before fill the new one uno::Reference< chart::XChartDataArray> xChartData(m_xInternal,uno::UNO_QUERY); @@ -586,11 +591,30 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat m_xInternal->deleteSequence(0); } - uno::Sequence< ::rtl::OUString > aColumns; uno::Reference< sdbcx::XColumnsSupplier> xColSup(m_xRowSet,uno::UNO_QUERY_THROW); uno::Reference< container::XNameAccess > xColumns = xColSup->getColumns(); - if ( xColumns.is() ) + uno::Sequence< ::rtl::OUString > aColumns; + if ( i_aColumnNames.getLength() ) + { + if ( _bHasCategories ) + { + aColumns.realloc(1); + aColumns[0] = xColumns->getElementNames()[0]; + } + for(sal_Int32 i = 0 ; i < i_aColumnNames.getLength();++i) + { + if ( i_aColumnNames[i].getLength() ) + { + sal_Int32 nCount = aColumns.getLength(); + aColumns.realloc(nCount+1); + aColumns[nCount] = i_aColumnNames[i][0]; + } + } + } + else + { aColumns = xColumns->getElementNames(); + } // fill the data uno::Reference< sdbc::XResultSet> xRes(m_xRowSet,uno::UNO_QUERY_THROW); uno::Reference< sdbc::XRow> xRow(m_xRowSet,uno::UNO_QUERY_THROW); |