1 From dbbc704be2e16870e267781369f1eeb0b787623b Mon Sep 17 00:00:00 2001
2 From: Jan Nieuwenhuizen <janneke@gnu.org>
3 Date: Mon, 11 May 2009 16:02:14 +0200
4 Subject: [PATCH] OOXML: export autoFilter if it set, even if details are empty. Fixes n#497559.
6 * Modified sc/source/filter/xlsx/excrecds.hxx
7 * Modified sc/source/filter/xlsx/xlsx-excrecds.cxx
9 sc/source/filter/xlsx/excrecds.hxx | 1 +
10 sc/source/filter/xlsx/xlsx-excrecds.cxx | 9 +++++++--
11 2 files changed, 8 insertions(+), 2 deletions(-)
13 diff --git sc/source/filter/xlsx/excrecds.hxx sc/source/filter/xlsx/excrecds.hxx
14 index 6ad0f71..57744dc 100644
15 --- sc/source/filter/xlsx/excrecds.hxx
16 +++ sc/source/filter/xlsx/excrecds.hxx
17 @@ -488,6 +488,7 @@ private:
18 XclExpFiltermode* pFilterMode;
19 XclExpAutofilterinfo* pFilterInfo;
24 // ----------------------------------------------------------------------------
25 diff --git sc/source/filter/xlsx/xlsx-excrecds.cxx sc/source/filter/xlsx/xlsx-excrecds.cxx
26 index 6bf8e9e..171009a 100644
27 --- sc/source/filter/xlsx/xlsx-excrecds.cxx
28 +++ sc/source/filter/xlsx/xlsx-excrecds.cxx
29 @@ -883,6 +883,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
33 + , mbAutoFilter (false)
35 ScDBCollection& rDBColl = GetDatabaseRanges();
36 XclExpNameManager& rNameMgr = GetNameManager();
37 @@ -983,6 +984,9 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
38 if( !maFilterList.IsEmpty() )
39 pFilterMode = new XclExpFiltermode;
40 pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
42 + if (maFilterList.IsEmpty () && !bConflict)
43 + mbAutoFilter = true;
47 @@ -1040,7 +1044,7 @@ void ExcAutoFilterRecs::Save( XclExpStream& rStrm )
49 void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
51 - if( maFilterList.IsEmpty() )
52 + if( maFilterList.IsEmpty() && !mbAutoFilter )
55 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
56 @@ -1048,7 +1052,8 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
57 XML_ref, XclXmlUtils::ToOString( maRef ).getStr(),
59 // OOXTODO: XML_extLst, XML_sortState
60 - maFilterList.SaveXml( rStrm );
61 + if( !maFilterList.IsEmpty() )
62 + maFilterList.SaveXml( rStrm );
63 rWorksheet->endElement( XML_autoFilter );