sc/source/filter/excel/excrecds.cxx | 13 +++++++------ sc/source/filter/excel/xedbdata.cxx | 6 +++--- sc/source/filter/inc/excrecds.hxx | 7 ++++++- 3 files changed, 16 insertions(+), 10 deletions(-)
New commits: commit 11fc639c0897a192f1da0c69d1f7ab683ff1208e Author: Eike Rathke <[email protected]> Date: Wed Nov 11 16:58:53 2015 +0100 TableRef: write <table><autoFilter> content to OOXML Change-Id: Iedd15feb7aaceebaa522b276cfa079afa1193bc1 diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 640e306..6613c37 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -8,6 +8,7 @@ */ #include "xedbdata.hxx" +#include "excrecds.hxx" #include "xltools.hxx" #include "dbdata.hxx" #include "document.hxx" @@ -219,9 +220,8 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry ) * When not applied but buttons hidden, Excel writes, for example, * <filterColumn colId="0" hiddenButton="1"/> */ - pTableStrm->singleElement( XML_autoFilter, - XML_ref, XclXmlUtils::ToOString(aRange), - FSEND); + ExcAutoFilterRecs aAutoFilter( rStrm.GetRoot(), aRange.aStart.Tab(), &rData); + aAutoFilter.SaveXml( rStrm); } const std::vector< OUString >& rColNames = rData.GetTableColumnNames(); commit 52e08f200e5ed525cb1ff92a13ab85d36cd7459f Author: Eike Rathke <[email protected]> Date: Wed Nov 11 14:48:02 2015 +0100 TableRef: prepare ExcAutoFilterRecs to use a defined database range Change-Id: Ic6bba6847a4877be70e157a217160caf1166fc25 diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index fc29675..a1e3acd 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -875,7 +875,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_filterColumn ); } -ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : +ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) : XclExpRoot( rRoot ), pFilterMode( nullptr ), pFilterInfo( nullptr ) @@ -885,7 +885,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : bool bFound = false; bool bAdvanced = false; - ScDBData* pData = rRoot.GetDoc().GetAnonymousDBData(nTab); + const ScDBData* pData = (pDefinedData ? pDefinedData : rRoot.GetDoc().GetAnonymousDBData(nTab)); ScRange aAdvRange; if (pData) { @@ -904,13 +904,14 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : maRef = aRange; // #i2394# built-in defined names must be sorted by containing sheet name - rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange ); + if (!pDefinedData) + rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange ); // advanced filter if( bAdvanced ) { // filter criteria, excel allows only same table - if( aAdvRange.aStart.Tab() == nTab ) + if( !pDefinedData && aAdvRange.aStart.Tab() == nTab ) rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange ); // filter destination range, excel allows only same table @@ -918,7 +919,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : { ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab ); aDestRange.aEnd.IncCol( nColCnt - 1 ); - if( aDestRange.aStart.Tab() == nTab ) + if( !pDefinedData && aDestRange.aStart.Tab() == nTab ) rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange ); } @@ -1052,7 +1053,7 @@ XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) : void XclExpFilterManager::InitTabFilter( SCTAB nScTab ) { - maFilterMap[ nScTab ].reset( new ExcAutoFilterRecs( GetRoot(), nScTab ) ); + maFilterMap[ nScTab ].reset( new ExcAutoFilterRecs( GetRoot(), nScTab, nullptr ) ); } XclExpRecordRef XclExpFilterManager::CreateRecord( SCTAB nScTab ) diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 47d4a4c..cf4b933 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -41,6 +41,7 @@ //------------------------------------------------------------------ Forwards - +class ScDBData; struct ScQueryEntry; //----------------------------------------------------------- class ExcRecord - @@ -401,7 +402,11 @@ public: class ExcAutoFilterRecs : public XclExpRecordBase, protected XclExpRoot { public: - explicit ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ); + /** @param pDefinedData + If nullptr, obtain anonymous ScDBData from sheet nTab. + Else, use defined database range; used with XclExpTables. + */ + explicit ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ); virtual ~ExcAutoFilterRecs(); void AddObjRecs(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
