Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "excrecds.hxx"
30 : :
31 : : #include <map>
32 : : #include <filter/msfilter/countryid.hxx>
33 : :
34 : : #include "scitems.hxx"
35 : : #include <editeng/eeitem.hxx>
36 : :
37 : : #include <sfx2/objsh.hxx>
38 : :
39 : : #include <editeng/editdata.hxx>
40 : : #include <editeng/editeng.hxx>
41 : : #include <editeng/editobj.hxx>
42 : : #include <editeng/editstat.hxx>
43 : :
44 : : #include <editeng/flditem.hxx>
45 : : #include <editeng/flstitem.hxx>
46 : :
47 : : #include <svx/algitem.hxx>
48 : : #include <editeng/boxitem.hxx>
49 : : #include <editeng/brshitem.hxx>
50 : : #include <svx/pageitem.hxx>
51 : : #include <editeng/paperinf.hxx>
52 : : #include <editeng/sizeitem.hxx>
53 : : #include <editeng/ulspitem.hxx>
54 : : #include <editeng/fhgtitem.hxx>
55 : : #include <editeng/escpitem.hxx>
56 : : #include <svl/intitem.hxx>
57 : : #include <svl/zforlist.hxx>
58 : : #include <svl/zformat.hxx>
59 : : #include <svtools/ctrltool.hxx>
60 : :
61 : :
62 : : #include <string.h>
63 : :
64 : : #include "global.hxx"
65 : : #include "globstr.hrc"
66 : : #include "docpool.hxx"
67 : : #include "patattr.hxx"
68 : : #include "cell.hxx"
69 : : #include "document.hxx"
70 : : #include "scextopt.hxx"
71 : : #include "attrib.hxx"
72 : : #include "progress.hxx"
73 : : #include "dociter.hxx"
74 : : #include "rangenam.hxx"
75 : : #include "dbdata.hxx"
76 : : #include "stlsheet.hxx"
77 : : #include "stlpool.hxx"
78 : : #include "editutil.hxx"
79 : : #include "formula/errorcodes.hxx"
80 : : #include "queryentry.hxx"
81 : : #include "queryparam.hxx"
82 : :
83 : : #include "excdoc.hxx"
84 : : #include "xeescher.hxx"
85 : : #include "xeformula.hxx"
86 : : #include "xelink.hxx"
87 : : #include "xename.hxx"
88 : : #include "xecontent.hxx"
89 : :
90 : : #include "xcl97rec.hxx"
91 : :
92 : : using namespace ::oox;
93 : :
94 : : using ::com::sun::star::uno::Sequence;
95 : : using ::rtl::OString;
96 : :
97 : : //--------------------------------------------------------- class ExcDummy_00 -
98 : : const sal_uInt8 ExcDummy_00::pMyData[] = {
99 : : 0x5c, 0x00, 0x20, 0x00, 0x04, 'C', 'a', 'l', 'c', // WRITEACCESS
100 : : 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
101 : : 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
102 : : 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
103 : : };
104 : : const sal_Size ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData );
105 : :
106 : : //-------------------------------------------------------- class ExcDummy_04x -
107 : : const sal_uInt8 ExcDummy_040::pMyData[] = {
108 : : 0x40, 0x00, 0x02, 0x00, 0x00, 0x00, // BACKUP
109 : : 0x8d, 0x00, 0x02, 0x00, 0x00, 0x00, // HIDEOBJ
110 : : };
111 : : const sal_Size ExcDummy_040::nMyLen = sizeof( ExcDummy_040::pMyData );
112 : :
113 : : const sal_uInt8 ExcDummy_041::pMyData[] = {
114 : : 0x0e, 0x00, 0x02, 0x00, 0x01, 0x00, // PRECISION
115 : : 0xda, 0x00, 0x02, 0x00, 0x00, 0x00 // BOOKBOOL
116 : : };
117 : : const sal_Size ExcDummy_041::nMyLen = sizeof( ExcDummy_041::pMyData );
118 : :
119 : : //-------------------------------------------------------- class ExcDummy_02a -
120 : : const sal_uInt8 ExcDummy_02a::pMyData[] = {
121 : : 0x0d, 0x00, 0x02, 0x00, 0x01, 0x00, // CALCMODE
122 : : 0x0c, 0x00, 0x02, 0x00, 0x64, 0x00, // CALCCOUNT
123 : : 0x0f, 0x00, 0x02, 0x00, 0x01, 0x00, // REFMODE
124 : : 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, // ITERATION
125 : : 0x10, 0x00, 0x08, 0x00, 0xfc, 0xa9, 0xf1, 0xd2, 0x4d, // DELTA
126 : : 0x62, 0x50, 0x3f,
127 : : 0x5f, 0x00, 0x02, 0x00, 0x01, 0x00 // SAVERECALC
128 : : };
129 : : const sal_Size ExcDummy_02a::nMyLen = sizeof( ExcDummy_02a::pMyData );
130 : :
131 : : //----------------------------------------------------------- class ExcRecord -
132 : :
133 : 0 : void ExcRecord::Save( XclExpStream& rStrm )
134 : : {
135 : 0 : SetRecHeader( GetNum(), GetLen() );
136 : 0 : XclExpRecord::Save( rStrm );
137 : 0 : }
138 : :
139 : 0 : void ExcRecord::SaveCont( XclExpStream& /*rStrm*/ )
140 : : {
141 : 0 : }
142 : :
143 : 0 : void ExcRecord::WriteBody( XclExpStream& rStrm )
144 : : {
145 : 0 : SaveCont( rStrm );
146 : 0 : }
147 : :
148 : 0 : void ExcRecord::SaveXml( XclExpXmlStream& /*rStrm*/ )
149 : : {
150 : 0 : }
151 : :
152 : :
153 : : //--------------------------------------------------------- class ExcEmptyRec -
154 : :
155 : 0 : void ExcEmptyRec::Save( XclExpStream& /*rStrm*/ )
156 : : {
157 : 0 : }
158 : :
159 : :
160 : 0 : sal_uInt16 ExcEmptyRec::GetNum() const
161 : : {
162 : 0 : return 0;
163 : : }
164 : :
165 : :
166 : 0 : sal_Size ExcEmptyRec::GetLen() const
167 : : {
168 : 0 : return 0;
169 : : }
170 : :
171 : : //--------------------------------------------------------- class ExcDummyRec -
172 : :
173 : 0 : void ExcDummyRec::Save( XclExpStream& rStrm )
174 : : {
175 : 0 : rStrm.Write( GetData(), GetLen() ); // raw write mode
176 : 0 : }
177 : :
178 : :
179 : 0 : sal_uInt16 ExcDummyRec::GetNum( void ) const
180 : : {
181 : 0 : return 0x0000;
182 : : }
183 : :
184 : : //------------------------------------------------------- class ExcBoolRecord -
185 : :
186 : 0 : void ExcBoolRecord::SaveCont( XclExpStream& rStrm )
187 : : {
188 [ # # ]: 0 : rStrm << (sal_uInt16)(bVal ? 0x0001 : 0x0000);
189 : 0 : }
190 : :
191 : :
192 : 0 : sal_Size ExcBoolRecord::GetLen( void ) const
193 : : {
194 : 0 : return 2;
195 : : }
196 : :
197 : :
198 : :
199 : :
200 : : //--------------------------------------------------------- class ExcBof_Base -
201 : :
202 : 0 : ExcBof_Base::ExcBof_Base() :
203 : : nRupBuild( 0x096C ), // copied from Excel
204 : 0 : nRupYear( 0x07C9 ) // copied from Excel
205 : : {
206 : 0 : }
207 : :
208 : :
209 : :
210 : : //-------------------------------------------------------------- class ExcBof -
211 : :
212 : 0 : ExcBof::ExcBof( void )
213 : : {
214 : 0 : nDocType = 0x0010;
215 : 0 : nVers = 0x0500;
216 : 0 : }
217 : :
218 : :
219 : 0 : void ExcBof::SaveCont( XclExpStream& rStrm )
220 : : {
221 : 0 : rStrm << nVers << nDocType << nRupBuild << nRupYear;
222 : 0 : }
223 : :
224 : :
225 : 0 : sal_uInt16 ExcBof::GetNum( void ) const
226 : : {
227 : 0 : return 0x0809;
228 : : }
229 : :
230 : :
231 : 0 : sal_Size ExcBof::GetLen( void ) const
232 : : {
233 : 0 : return 8;
234 : : }
235 : :
236 : :
237 : :
238 : : //------------------------------------------------------------- class ExcBofW -
239 : :
240 : 0 : ExcBofW::ExcBofW( void )
241 : : {
242 : 0 : nDocType = 0x0005;
243 : 0 : nVers = 0x0500;
244 : 0 : }
245 : :
246 : :
247 : 0 : void ExcBofW::SaveCont( XclExpStream& rStrm )
248 : : {
249 : 0 : rStrm << nVers << nDocType << nRupBuild << nRupYear;
250 : 0 : }
251 : :
252 : :
253 : :
254 : 0 : sal_uInt16 ExcBofW::GetNum( void ) const
255 : : {
256 : 0 : return 0x0809;
257 : : }
258 : :
259 : :
260 : :
261 : 0 : sal_Size ExcBofW::GetLen( void ) const
262 : : {
263 : 0 : return 8;
264 : : }
265 : :
266 : :
267 : :
268 : : //-------------------------------------------------------------- class ExcEof -
269 : :
270 : 0 : sal_uInt16 ExcEof::GetNum( void ) const
271 : : {
272 : 0 : return 0x000A;
273 : : }
274 : :
275 : :
276 : 0 : sal_Size ExcEof::GetLen( void ) const
277 : : {
278 : 0 : return 0;
279 : : }
280 : :
281 : :
282 : :
283 : : //--------------------------------------------------------- class ExcDummy_00 -
284 : :
285 : 0 : sal_Size ExcDummy_00::GetLen( void ) const
286 : : {
287 : 0 : return nMyLen;
288 : : }
289 : :
290 : :
291 : 0 : const sal_uInt8* ExcDummy_00::GetData( void ) const
292 : : {
293 : 0 : return pMyData;
294 : : }
295 : :
296 : :
297 : :
298 : : //-------------------------------------------------------- class ExcDummy_04x -
299 : :
300 : 0 : sal_Size ExcDummy_040::GetLen( void ) const
301 : : {
302 : 0 : return nMyLen;
303 : : }
304 : :
305 : :
306 : 0 : const sal_uInt8* ExcDummy_040::GetData( void ) const
307 : : {
308 : 0 : return pMyData;
309 : : }
310 : :
311 : :
312 : :
313 : :
314 : 0 : sal_Size ExcDummy_041::GetLen( void ) const
315 : : {
316 : 0 : return nMyLen;
317 : : }
318 : :
319 : :
320 : 0 : const sal_uInt8* ExcDummy_041::GetData( void ) const
321 : : {
322 : 0 : return pMyData;
323 : : }
324 : :
325 : :
326 : :
327 : : //------------------------------------------------------------- class Exc1904 -
328 : :
329 : 0 : Exc1904::Exc1904( ScDocument& rDoc )
330 : : {
331 [ # # ][ # # ]: 0 : Date* pDate = rDoc.GetFormatTable()->GetNullDate();
332 [ # # ][ # # ]: 0 : bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : false;
333 [ # # ][ # # ]: 0 : bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : false;
[ # # ]
334 : 0 : }
335 : :
336 : :
337 : 0 : sal_uInt16 Exc1904::GetNum( void ) const
338 : : {
339 : 0 : return 0x0022;
340 : : }
341 : :
342 : :
343 : 0 : void Exc1904::SaveXml( XclExpXmlStream& rStrm )
344 : : {
345 : 0 : bool bISOIEC = ( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 );
346 : :
347 [ # # ]: 0 : if( bISOIEC )
348 : : {
349 : : rStrm.WriteAttributes(
350 : : XML_dateCompatibility, XclXmlUtils::ToPsz( bDateCompatibility ),
351 : 0 : FSEND );
352 : : }
353 : :
354 [ # # ][ # # ]: 0 : if( !bISOIEC || bDateCompatibility )
355 : : {
356 : : rStrm.WriteAttributes(
357 : : XML_date1904, XclXmlUtils::ToPsz( bVal ),
358 : 0 : FSEND );
359 : : }
360 : 0 : }
361 : :
362 : :
363 : :
364 : : //------------------------------------------------------ class ExcBundlesheet -
365 : :
366 : 0 : ExcBundlesheetBase::ExcBundlesheetBase( RootData& rRootData, SCTAB nTabNum ) :
367 : : nStrPos( STREAM_SEEK_TO_END ),
368 : : nOwnPos( STREAM_SEEK_TO_END ),
369 [ # # ][ # # ]: 0 : nGrbit( rRootData.pER->GetTabInfo().IsVisibleTab( nTabNum ) ? 0x0000 : 0x0001 ),
370 [ # # ]: 0 : nTab( nTabNum )
371 : : {
372 : 0 : }
373 : :
374 : :
375 : 0 : ExcBundlesheetBase::ExcBundlesheetBase() :
376 : : nStrPos( STREAM_SEEK_TO_END ),
377 : : nOwnPos( STREAM_SEEK_TO_END ),
378 : : nGrbit( 0x0000 ),
379 : 0 : nTab( SCTAB_GLOBAL )
380 : : {
381 : 0 : }
382 : :
383 : :
384 : 0 : void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm )
385 : : {
386 : 0 : rStrm.SetSvStreamPos( nOwnPos );
387 : 0 : rStrm.DisableEncryption();
388 : 0 : rStrm << static_cast<sal_uInt32>(nStrPos);
389 : 0 : rStrm.EnableEncryption();
390 : 0 : }
391 : :
392 : :
393 : 0 : sal_uInt16 ExcBundlesheetBase::GetNum( void ) const
394 : : {
395 : 0 : return 0x0085;
396 : : }
397 : :
398 : :
399 : :
400 : :
401 : 0 : ExcBundlesheet::ExcBundlesheet( RootData& rRootData, SCTAB _nTab ) :
402 : 0 : ExcBundlesheetBase( rRootData, _nTab )
403 : : {
404 [ # # ][ # # ]: 0 : rtl::OUString sTabName = rRootData.pER->GetTabInfo().GetScTabName( _nTab );
405 : : OSL_ENSURE( sTabName.getLength() < 256, "ExcBundlesheet::ExcBundlesheet - table name too long" );
406 [ # # ]: 0 : aName = rtl::OUStringToOString(sTabName, rRootData.pER->GetTextEncoding());
407 : 0 : }
408 : :
409 : :
410 : 0 : void ExcBundlesheet::SaveCont( XclExpStream& rStrm )
411 : : {
412 : 0 : nOwnPos = rStrm.GetSvStreamPos();
413 : 0 : rStrm << (sal_uInt32) 0x00000000 // dummy (stream position of the sheet)
414 : 0 : << nGrbit;
415 : 0 : rStrm.WriteByteString(aName); // 8 bit length, max 255 chars
416 : 0 : }
417 : :
418 : :
419 : 0 : sal_Size ExcBundlesheet::GetLen() const
420 : : {
421 : 0 : return 7 + Min( aName.getLength(), (sal_Int32) 255 );
422 : : }
423 : :
424 : :
425 : : //--------------------------------------------------------- class ExcDummy_02 -
426 : :
427 : 0 : sal_Size ExcDummy_02a::GetLen( void ) const
428 : : {
429 : 0 : return nMyLen;
430 : : }
431 : :
432 : 0 : const sal_uInt8* ExcDummy_02a::GetData( void ) const
433 : : {
434 : 0 : return pMyData;
435 : : }
436 : : //--------------------------------------------------------- class ExcDummy_02 -
437 : :
438 : 0 : XclExpCountry::XclExpCountry( const XclExpRoot& rRoot ) :
439 : 0 : XclExpRecord( EXC_ID_COUNTRY, 4 )
440 : : {
441 : : /* #i31530# set document country as UI country too -
442 : : needed for correct behaviour of number formats. */
443 : : mnUICountry = mnDocCountry = static_cast< sal_uInt16 >(
444 [ # # ]: 0 : ::msfilter::ConvertLanguageToCountry( rRoot.GetDocLanguage() ) );
445 : 0 : }
446 : :
447 : 0 : void XclExpCountry::WriteBody( XclExpStream& rStrm )
448 : : {
449 : 0 : rStrm << mnUICountry << mnDocCountry;
450 : 0 : }
451 : :
452 : : // XclExpWsbool ===============================================================
453 : :
454 : 0 : XclExpWsbool::XclExpWsbool( bool bFitToPages, SCTAB nScTab, XclExpFilterManager* pManager )
455 : : : XclExpUInt16Record( EXC_ID_WSBOOL, EXC_WSBOOL_DEFAULTFLAGS )
456 : : , mnScTab( nScTab )
457 : 0 : , mpManager( pManager )
458 : : {
459 [ # # ]: 0 : if( bFitToPages )
460 : 0 : SetValue( GetValue() | EXC_WSBOOL_FITTOPAGE );
461 : 0 : }
462 : :
463 : 0 : void XclExpWsbool::SaveXml( XclExpXmlStream& rStrm )
464 : : {
465 : 0 : sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
466 : : rWorksheet->startElement( XML_sheetPr,
467 : : // OOXTODO: XML_syncHorizontal,
468 : : // OOXTODO: XML_syncVertical,
469 : : // OOXTODO: XML_syncRef,
470 : : // OOXTODO: XML_transitionEvaluation,
471 : : // OOXTODO: XML_transitionEntry,
472 : : // OOXTODO: XML_published,
473 : : // OOXTODO: XML_codeName,
474 : 0 : XML_filterMode, mpManager ? XclXmlUtils::ToPsz( mpManager->HasFilterMode( mnScTab ) ) : NULL,
475 : : // OOXTODO: XML_enableFormatConditionsCalculation,
476 [ # # ]: 0 : FSEND );
477 : : // OOXTODO: elements XML_tabColor, XML_outlinePr
478 : : rWorksheet->singleElement( XML_pageSetUpPr,
479 : : // OOXTODO: XML_autoPageBreaks,
480 : 0 : XML_fitToPage, XclXmlUtils::ToPsz( GetValue() & EXC_WSBOOL_FITTOPAGE ),
481 : 0 : FSEND );
482 : 0 : rWorksheet->endElement( XML_sheetPr );
483 : 0 : }
484 : :
485 : :
486 : : // XclExpWindowProtection ===============================================================
487 : :
488 : 0 : XclExpWindowProtection::XclExpWindowProtection(bool bValue) :
489 : 0 : XclExpBoolRecord(EXC_ID_WINDOWPROTECT, bValue)
490 : : {
491 : 0 : }
492 : :
493 : 0 : void XclExpWindowProtection::SaveXml( XclExpXmlStream& rStrm )
494 : : {
495 : : rStrm.WriteAttributes(
496 : 0 : XML_lockWindows, XclXmlUtils::ToPsz( GetBool() ),
497 : 0 : FSEND );
498 : 0 : }
499 : :
500 : : // XclExpDocProtection ===============================================================
501 : :
502 : 0 : XclExpProtection::XclExpProtection(bool bValue) :
503 : 0 : XclExpBoolRecord(EXC_ID_PROTECT, bValue)
504 : : {
505 : 0 : }
506 : :
507 : : // ============================================================================
508 : :
509 : 0 : XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
510 : : XclExpRecord(EXC_ID_PASSWORD, 2),
511 : 0 : mnHash(0x0000)
512 : : {
513 [ # # ]: 0 : if (aHash.getLength() >= 2)
514 : : {
515 : 0 : mnHash = ((aHash[0] << 8) & 0xFFFF);
516 : 0 : mnHash |= (aHash[1] & 0xFF);
517 : : }
518 : 0 : }
519 : :
520 : 0 : XclExpPassHash::~XclExpPassHash()
521 : : {
522 [ # # ]: 0 : }
523 : :
524 : 0 : void XclExpPassHash::WriteBody(XclExpStream& rStrm)
525 : : {
526 : 0 : rStrm << mnHash;
527 : 0 : }
528 : :
529 : : // ============================================================================
530 : :
531 : 0 : XclExpFiltermode::XclExpFiltermode() :
532 : 0 : XclExpEmptyRecord( EXC_ID_FILTERMODE )
533 : : {
534 : 0 : }
535 : :
536 : : // ----------------------------------------------------------------------------
537 : :
538 : 0 : XclExpAutofilterinfo::XclExpAutofilterinfo( const ScAddress& rStartPos, SCCOL nScCol ) :
539 : : XclExpUInt16Record( EXC_ID_AUTOFILTERINFO, static_cast< sal_uInt16 >( nScCol ) ),
540 [ # # ]: 0 : maStartPos( rStartPos )
541 : : {
542 : 0 : }
543 : :
544 : : // ----------------------------------------------------------------------------
545 : :
546 : 0 : ExcFilterCondition::ExcFilterCondition() :
547 : : nType( EXC_AFTYPE_NOTUSED ),
548 : : nOper( EXC_AFOPER_EQUAL ),
549 : : fVal( 0.0 ),
550 : 0 : pText( NULL )
551 : : {
552 : 0 : }
553 : :
554 : 0 : ExcFilterCondition::~ExcFilterCondition()
555 : : {
556 [ # # ]: 0 : if( pText )
557 [ # # ]: 0 : delete pText;
558 : 0 : }
559 : :
560 : 0 : sal_Size ExcFilterCondition::GetTextBytes() const
561 : : {
562 [ # # ]: 0 : return pText ? (1 + pText->GetBufferSize()) : 0;
563 : : }
564 : :
565 : 0 : void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, String* pT )
566 : : {
567 : 0 : nType = nTp;
568 : 0 : nOper = nOp;
569 : 0 : fVal = fV;
570 : :
571 [ # # ]: 0 : delete pText;
572 [ # # ][ # # ]: 0 : pText = pT ? new XclExpString( *pT, EXC_STR_8BITLENGTH ) : NULL;
573 : 0 : }
574 : :
575 : 0 : void ExcFilterCondition::Save( XclExpStream& rStrm )
576 : : {
577 : 0 : rStrm << nType << nOper;
578 [ # # # # ]: 0 : switch( nType )
579 : : {
580 : : case EXC_AFTYPE_DOUBLE:
581 : 0 : rStrm << fVal;
582 : 0 : break;
583 : : case EXC_AFTYPE_STRING:
584 : : OSL_ENSURE( pText, "ExcFilterCondition::Save() -- pText is NULL!" );
585 : 0 : rStrm << (sal_uInt32)0 << (sal_uInt8) pText->Len() << (sal_uInt16)0 << (sal_uInt8)0;
586 : 0 : break;
587 : : case EXC_AFTYPE_BOOLERR:
588 [ # # ]: 0 : rStrm << (sal_uInt8)0 << (sal_uInt8)((fVal != 0) ? 1 : 0) << (sal_uInt32)0 << (sal_uInt16)0;
589 : 0 : break;
590 : : default:
591 : 0 : rStrm << (sal_uInt32)0 << (sal_uInt32)0;
592 : : }
593 : 0 : }
594 : :
595 : 0 : static const char* lcl_GetOperator( sal_uInt8 nOper )
596 : : {
597 [ # # # # : 0 : switch( nOper )
# # # ]
598 : : {
599 : 0 : case EXC_AFOPER_EQUAL: return "equal";
600 : 0 : case EXC_AFOPER_GREATER: return "greaterThan";
601 : 0 : case EXC_AFOPER_GREATEREQUAL: return "greaterThanOrEqual";
602 : 0 : case EXC_AFOPER_LESS: return "lessThan";
603 : 0 : case EXC_AFOPER_LESSEQUAL: return "lessThanOrEqual";
604 : 0 : case EXC_AFOPER_NOTEQUAL: return "notEqual";
605 : : case EXC_AFOPER_NONE:
606 : 0 : default: return "**none**";
607 : : }
608 : : }
609 : :
610 : 0 : static OString lcl_GetValue( sal_uInt8 nType, double fVal, XclExpString* pStr )
611 : : {
612 [ # # # # ]: 0 : switch( nType )
613 : : {
614 : 0 : case EXC_AFTYPE_STRING: return XclXmlUtils::ToOString( *pStr );
615 : 0 : case EXC_AFTYPE_DOUBLE: return OString::valueOf( fVal );
616 [ # # ]: 0 : case EXC_AFTYPE_BOOLERR: return OString::valueOf( (sal_Int32) ( fVal != 0 ? 1 : 0 ) );
617 : 0 : default: return OString();
618 : : }
619 : : }
620 : :
621 : 0 : void ExcFilterCondition::SaveXml( XclExpXmlStream& rStrm )
622 : : {
623 [ # # ]: 0 : if( IsEmpty() )
624 : 0 : return;
625 : :
626 [ # # ]: 0 : rStrm.GetCurrentStream()->singleElement( XML_customFilter,
627 : : XML_operator, lcl_GetOperator( nOper ),
628 : : XML_val, lcl_GetValue( nType, fVal, pText ).getStr(),
629 [ # # ]: 0 : FSEND );
630 : : }
631 : :
632 : 0 : void ExcFilterCondition::SaveText( XclExpStream& rStrm )
633 : : {
634 [ # # ]: 0 : if( nType == EXC_AFTYPE_STRING )
635 : : {
636 : : OSL_ENSURE( pText, "ExcFilterCondition::SaveText() -- pText is NULL!" );
637 : 0 : pText->WriteFlagField( rStrm );
638 : 0 : pText->WriteBuffer( rStrm );
639 : : }
640 : 0 : }
641 : :
642 : : // ----------------------------------------------------------------------------
643 : :
644 : 0 : XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC ) :
645 : : XclExpRecord( EXC_ID_AUTOFILTER, 24 ),
646 : : XclExpRoot( rRoot ),
647 : : meType(FilterCondition),
648 : : nCol( nC ),
649 [ # # ][ # # ]: 0 : nFlags( 0 )
[ # # ]
650 : : {
651 [ # # # # ]: 0 : }
652 : :
653 : 0 : bool XclExpAutofilter::AddCondition( ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp,
654 : : double fVal, String* pText, bool bSimple )
655 : : {
656 [ # # ]: 0 : if( !aCond[ 1 ].IsEmpty() )
657 : 0 : return false;
658 : :
659 [ # # ]: 0 : sal_uInt16 nInd = aCond[ 0 ].IsEmpty() ? 0 : 1;
660 : :
661 [ # # ]: 0 : if( nInd == 1 )
662 [ # # ]: 0 : nFlags |= (eConn == SC_OR) ? EXC_AFFLAG_OR : EXC_AFFLAG_AND;
663 [ # # ]: 0 : if( bSimple )
664 [ # # ]: 0 : nFlags |= (nInd == 0) ? EXC_AFFLAG_SIMPLE1 : EXC_AFFLAG_SIMPLE2;
665 : :
666 : 0 : aCond[ nInd ].SetCondition( nType, nOp, fVal, pText );
667 : :
668 : 0 : AddRecSize( aCond[ nInd ].GetTextBytes() );
669 : :
670 : 0 : return true;
671 : : }
672 : :
673 : 0 : bool XclExpAutofilter::HasCondition() const
674 : : {
675 : 0 : return !aCond[0].IsEmpty();
676 : : }
677 : :
678 : 0 : bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
679 : : {
680 [ # # ]: 0 : const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
681 [ # # ]: 0 : if (rItems.empty())
682 : 0 : return true;
683 : :
684 [ # # ][ # # ]: 0 : if (GetOutput() != EXC_OUTPUT_BINARY && rItems.size() > 1)
[ # # ]
685 [ # # ]: 0 : return AddMultiValueEntry(rEntry);
686 : :
687 : 0 : bool bConflict = false;
688 [ # # ]: 0 : String sText;
689 [ # # ]: 0 : const ScQueryEntry::Item& rItem = rItems[0];
690 : 0 : const rtl::OUString& rQueryStr = rItem.maString;
691 [ # # ]: 0 : if (!rQueryStr.isEmpty())
692 : : {
693 [ # # ]: 0 : sText.Assign(rQueryStr);
694 [ # # # # ]: 0 : switch( rEntry.eOp )
695 : : {
696 : : case SC_CONTAINS:
697 : : case SC_DOES_NOT_CONTAIN:
698 : : {
699 [ # # ]: 0 : sText.InsertAscii( "*" , 0 );
700 [ # # ]: 0 : sText.AppendAscii( "*" );
701 : : }
702 : 0 : break;
703 : : case SC_BEGINS_WITH:
704 : : case SC_DOES_NOT_BEGIN_WITH:
705 [ # # ]: 0 : sText.AppendAscii( "*" );
706 : 0 : break;
707 : : case SC_ENDS_WITH:
708 : : case SC_DOES_NOT_END_WITH:
709 [ # # ]: 0 : sText.InsertAscii( "*" , 0 );
710 : 0 : break;
711 : : default:
712 : : {
713 : : //nothing
714 : : }
715 : : }
716 : : }
717 : :
718 : 0 : bool bLen = sText.Len() > 0;
719 : :
720 : : // empty/nonempty fields
721 [ # # ][ # # ]: 0 : if (rEntry.IsQueryByEmpty())
722 [ # # ]: 0 : bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_EMPTY, EXC_AFOPER_NONE, 0.0, NULL, true );
723 [ # # ][ # # ]: 0 : else if(rEntry.IsQueryByNonEmpty())
724 [ # # ]: 0 : bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, 0.0, NULL, true );
725 : : // other conditions
726 : : else
727 : : {
728 : 0 : double fVal = 0.0;
729 : 0 : sal_uInt32 nIndex = 0;
730 [ # # ][ # # ]: 0 : bool bIsNum = bLen ? GetFormatter().IsNumberFormat( sText, nIndex, fVal ) : true;
[ # # ]
731 [ # # ]: 0 : String* pText = bIsNum ? NULL : &sText;
732 : :
733 : : // top10 flags
734 : 0 : sal_uInt16 nNewFlags = 0x0000;
735 [ # # # # : 0 : switch( rEntry.eOp )
# ]
736 : : {
737 : : case SC_TOPVAL:
738 : 0 : nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10TOP);
739 : 0 : break;
740 : : case SC_BOTVAL:
741 : 0 : nNewFlags = EXC_AFFLAG_TOP10;
742 : 0 : break;
743 : : case SC_TOPPERC:
744 : 0 : nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10TOP | EXC_AFFLAG_TOP10PERC);
745 : 0 : break;
746 : : case SC_BOTPERC:
747 : 0 : nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10PERC);
748 : 0 : break;
749 : : default:;
750 : : }
751 : 0 : bool bNewTop10 = ::get_flag( nNewFlags, EXC_AFFLAG_TOP10 );
752 : :
753 [ # # ][ # # ]: 0 : bConflict = HasTop10() && bNewTop10;
[ # # ]
754 [ # # ]: 0 : if( !bConflict )
755 : : {
756 [ # # ]: 0 : if( bNewTop10 )
757 : : {
758 [ # # ]: 0 : if( fVal < 0 ) fVal = 0;
759 [ # # ]: 0 : if( fVal >= 501 ) fVal = 500;
760 : 0 : nFlags |= (nNewFlags | (sal_uInt16)(fVal) << 7);
761 : : }
762 : : // normal condition
763 : : else
764 : : {
765 [ # # ]: 0 : sal_uInt8 nType = bIsNum ? EXC_AFTYPE_DOUBLE : EXC_AFTYPE_STRING;
766 : 0 : sal_uInt8 nOper = EXC_AFOPER_NONE;
767 : :
768 [ # # # # : 0 : switch( rEntry.eOp )
# # # #
# ]
769 : : {
770 : 0 : case SC_EQUAL: nOper = EXC_AFOPER_EQUAL; break;
771 : 0 : case SC_LESS: nOper = EXC_AFOPER_LESS; break;
772 : 0 : case SC_GREATER: nOper = EXC_AFOPER_GREATER; break;
773 : 0 : case SC_LESS_EQUAL: nOper = EXC_AFOPER_LESSEQUAL; break;
774 : 0 : case SC_GREATER_EQUAL: nOper = EXC_AFOPER_GREATEREQUAL; break;
775 : 0 : case SC_NOT_EQUAL: nOper = EXC_AFOPER_NOTEQUAL; break;
776 : : case SC_CONTAINS:
777 : : case SC_BEGINS_WITH:
778 : : case SC_ENDS_WITH:
779 : 0 : nOper = EXC_AFOPER_EQUAL; break;
780 : : case SC_DOES_NOT_CONTAIN:
781 : : case SC_DOES_NOT_BEGIN_WITH:
782 : : case SC_DOES_NOT_END_WITH:
783 : 0 : nOper = EXC_AFOPER_NOTEQUAL; break;
784 : : default:;
785 : : }
786 [ # # ]: 0 : bConflict = !AddCondition( rEntry.eConnect, nType, nOper, fVal, pText );
787 : : }
788 : : }
789 : : }
790 [ # # ]: 0 : return bConflict;
791 : : }
792 : :
793 : 0 : bool XclExpAutofilter::AddMultiValueEntry( const ScQueryEntry& rEntry )
794 : : {
795 : 0 : meType = MultiValue;
796 [ # # ]: 0 : const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
797 : 0 : ScQueryEntry::QueryItemsType::const_iterator itr = rItems.begin(), itrEnd = rItems.end();
798 [ # # ][ # # ]: 0 : for (; itr != itrEnd; ++itr)
[ # # ]
799 [ # # ][ # # ]: 0 : maMultiValues.push_back(itr->maString);
800 : :
801 : 0 : return false;
802 : : }
803 : :
804 : 0 : void XclExpAutofilter::WriteBody( XclExpStream& rStrm )
805 : : {
806 : 0 : rStrm << nCol << nFlags;
807 : 0 : aCond[ 0 ].Save( rStrm );
808 : 0 : aCond[ 1 ].Save( rStrm );
809 : 0 : aCond[ 0 ].SaveText( rStrm );
810 : 0 : aCond[ 1 ].SaveText( rStrm );
811 : 0 : }
812 : :
813 : 0 : void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
814 : : {
815 [ # # ][ # # ]: 0 : if (meType == FilterCondition && !HasCondition())
[ # # ]
816 : 0 : return;
817 : :
818 : 0 : sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
819 : :
820 : : rWorksheet->startElement( XML_filterColumn,
821 : : XML_colId, OString::valueOf( (sal_Int32) nCol ).getStr(),
822 : : // OOXTODO: XML_hiddenButton, AutoFilter12 fHideArrow?
823 : : // OOXTODO: XML_showButton,
824 [ # # ]: 0 : FSEND );
825 : :
826 [ # # # ]: 0 : switch (meType)
827 : : {
828 : : case FilterCondition:
829 : : {
830 [ # # ]: 0 : if( HasTop10() )
831 : : {
832 : : rWorksheet->singleElement( XML_top10,
833 : 0 : XML_top, XclXmlUtils::ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10TOP ) ),
834 : 0 : XML_percent, XclXmlUtils::ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10PERC ) ),
835 : : XML_val, OString::valueOf( (sal_Int32) (nFlags >> 7 ) ).getStr(),
836 : : // OOXTODO: XML_filterVal,
837 [ # # # # ]: 0 : FSEND );
[ # # ]
838 : : }
839 : :
840 : : rWorksheet->startElement( XML_customFilters,
841 : : XML_and, XclXmlUtils::ToPsz( (nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND ),
842 : 0 : FSEND );
843 : 0 : aCond[ 0 ].SaveXml( rStrm );
844 : 0 : aCond[ 1 ].SaveXml( rStrm );
845 : 0 : rWorksheet->endElement( XML_customFilters );
846 : : // OOXTODO: XLM_colorFilter, XML_dynamicFilter,
847 : : // XML_extLst, XML_filters, XML_iconFilter, XML_top10
848 : : }
849 : 0 : break;
850 : : case MultiValue:
851 : : {
852 [ # # ]: 0 : rWorksheet->startElement(XML_filters, FSEND);
853 [ # # ][ # # ]: 0 : std::vector<rtl::OUString>::const_iterator itr = maMultiValues.begin(), itrEnd = maMultiValues.end();
854 [ # # ][ # # ]: 0 : for (; itr != itrEnd; ++itr)
855 : : {
856 [ # # ]: 0 : const char* pz = rtl::OUStringToOString(*itr, RTL_TEXTENCODING_UTF8).getStr();
857 [ # # ]: 0 : rWorksheet->singleElement(XML_filter, XML_val, pz, FSEND);
858 : : }
859 [ # # ]: 0 : rWorksheet->endElement(XML_filters);
860 : : }
861 : 0 : break;
862 : : }
863 : 0 : rWorksheet->endElement( XML_filterColumn );
864 : : }
865 : :
866 : : // ----------------------------------------------------------------------------
867 : :
868 : 0 : ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
869 : : XclExpRoot( rRoot ),
870 : : pFilterMode( NULL ),
871 : : pFilterInfo( NULL )
872 [ # # ][ # # ]: 0 : , mbAutoFilter (false)
873 : : {
874 [ # # ]: 0 : XclExpNameManager& rNameMgr = GetNameManager();
875 : :
876 : 0 : sal_Bool bFound = false;
877 : 0 : sal_Bool bAdvanced = false;
878 [ # # ]: 0 : ScDBData* pData = rRoot.GetDoc().GetAnonymousDBData(nTab);
879 : 0 : ScRange aAdvRange;
880 [ # # ]: 0 : if (pData)
881 : : {
882 [ # # ]: 0 : bAdvanced = pData->GetAdvancedQuerySource( aAdvRange );
883 [ # # ][ # # ]: 0 : bFound = (pData->HasQueryParam() || pData->HasAutoFilter() || bAdvanced);
[ # # ][ # # ]
884 : : }
885 [ # # ]: 0 : if( bFound )
886 : : {
887 [ # # ]: 0 : ScQueryParam aParam;
888 [ # # ]: 0 : pData->GetQueryParam( aParam );
889 : :
890 : : ScRange aRange( aParam.nCol1, aParam.nRow1, aParam.nTab,
891 : 0 : aParam.nCol2, aParam.nRow2, aParam.nTab );
892 : 0 : SCCOL nColCnt = aParam.nCol2 - aParam.nCol1 + 1;
893 : :
894 : 0 : maRef = aRange;
895 : :
896 : : // #i2394# built-in defined names must be sorted by containing sheet name
897 [ # # ]: 0 : rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange );
898 : :
899 : : // advanced filter
900 [ # # ]: 0 : if( bAdvanced )
901 : : {
902 : : // filter criteria, excel allows only same table
903 [ # # ]: 0 : if( aAdvRange.aStart.Tab() == nTab )
904 [ # # ]: 0 : rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange );
905 : :
906 : : // filter destination range, excel allows only same table
907 [ # # ]: 0 : if( !aParam.bInplace )
908 : : {
909 : 0 : ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
910 [ # # ]: 0 : aDestRange.aEnd.IncCol( nColCnt - 1 );
911 [ # # ]: 0 : if( aDestRange.aStart.Tab() == nTab )
912 [ # # ]: 0 : rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
913 : : }
914 : :
915 [ # # ][ # # ]: 0 : pFilterMode = new XclExpFiltermode;
916 : : }
917 : : // AutoFilter
918 : : else
919 : : {
920 : 0 : sal_Bool bConflict = false;
921 : 0 : sal_Bool bContLoop = sal_True;
922 : 0 : sal_Bool bHasOr = false;
923 [ # # ]: 0 : SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
924 : :
925 : : // create AUTOFILTER records for filtered columns
926 [ # # ][ # # ]: 0 : for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < aParam.GetEntryCount()); nEntry++ )
[ # # ][ # # ]
[ # # ]
927 : : {
928 [ # # ]: 0 : const ScQueryEntry& rEntry = aParam.GetEntry( nEntry );
929 : :
930 : 0 : bContLoop = rEntry.bDoQuery;
931 [ # # ]: 0 : if( bContLoop )
932 : : {
933 [ # # ]: 0 : XclExpAutofilter* pFilter = GetByCol( static_cast<SCCOL>(rEntry.nField) - aRange.aStart.Col() );
934 : :
935 [ # # ]: 0 : if( nEntry > 0 )
936 : 0 : bHasOr |= (rEntry.eConnect == SC_OR);
937 : :
938 [ # # ][ # # ]: 0 : bConflict = (nEntry > 1) && bHasOr;
939 [ # # ]: 0 : if( !bConflict )
940 : : bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
941 [ # # ][ # # ]: 0 : (nFirstField != rEntry.nField);
[ # # ]
942 [ # # ]: 0 : if( !bConflict )
943 [ # # ]: 0 : bConflict = pFilter->AddEntry( rEntry );
944 : : }
945 : : }
946 : :
947 : : // additional tests for conflicts
948 [ # # ][ # # ]: 0 : for( size_t nPos = 0, nSize = maFilterList.GetSize(); !bConflict && (nPos < nSize); ++nPos )
[ # # ]
949 : : {
950 [ # # ]: 0 : XclExpAutofilterRef xFilter = maFilterList.GetRecord( nPos );
951 [ # # ][ # # ]: 0 : bConflict = xFilter->HasCondition() && xFilter->HasTop10();
[ # # ]
952 [ # # ]: 0 : }
953 : :
954 [ # # ]: 0 : if( bConflict )
955 : 0 : maFilterList.RemoveAllRecords();
956 : :
957 [ # # ]: 0 : if( !maFilterList.IsEmpty() )
958 [ # # ][ # # ]: 0 : pFilterMode = new XclExpFiltermode;
959 [ # # ][ # # ]: 0 : pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
960 : :
961 [ # # ][ # # ]: 0 : if (maFilterList.IsEmpty () && !bConflict)
[ # # ]
962 : 0 : mbAutoFilter = true;
963 [ # # ]: 0 : }
964 : : }
965 : 0 : }
966 : :
967 [ # # ][ # # ]: 0 : ExcAutoFilterRecs::~ExcAutoFilterRecs()
968 : : {
969 [ # # ][ # # ]: 0 : delete pFilterMode;
970 [ # # ][ # # ]: 0 : delete pFilterInfo;
971 [ # # ]: 0 : }
972 : :
973 : 0 : XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol )
974 : : {
975 [ # # ]: 0 : XclExpAutofilterRef xFilter;
976 [ # # ]: 0 : for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
977 : : {
978 [ # # ][ # # ]: 0 : xFilter = maFilterList.GetRecord( nPos );
[ # # ]
979 [ # # ]: 0 : if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) )
980 : 0 : return xFilter.get();
981 : : }
982 [ # # ][ # # ]: 0 : xFilter.reset( new XclExpAutofilter( GetRoot(), static_cast<sal_uInt16>(nCol) ) );
[ # # ]
983 [ # # ][ # # ]: 0 : maFilterList.AppendRecord( xFilter );
[ # # ]
984 [ # # ]: 0 : return xFilter.get();
985 : : }
986 : :
987 : 0 : bool ExcAutoFilterRecs::IsFiltered( SCCOL nCol )
988 : : {
989 [ # # ]: 0 : for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
990 [ # # ]: 0 : if( maFilterList.GetRecord( nPos )->GetCol() == static_cast<sal_uInt16>(nCol) )
991 : 0 : return true;
992 : 0 : return false;
993 : : }
994 : :
995 : 0 : void ExcAutoFilterRecs::AddObjRecs()
996 : : {
997 [ # # ]: 0 : if( pFilterInfo )
998 : : {
999 : 0 : ScAddress aAddr( pFilterInfo->GetStartPos() );
1000 [ # # ][ # # ]: 0 : for( SCCOL nObj = 0, nCount = pFilterInfo->GetColCount(); nObj < nCount; nObj++ )
1001 : : {
1002 [ # # ][ # # ]: 0 : XclObj* pObjRec = new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) );
[ # # ][ # # ]
1003 [ # # ][ # # ]: 0 : GetObjectManager().AddObj( pObjRec );
1004 [ # # ]: 0 : aAddr.IncCol( 1 );
1005 : : }
1006 : : }
1007 : 0 : }
1008 : :
1009 : 0 : void ExcAutoFilterRecs::Save( XclExpStream& rStrm )
1010 : : {
1011 [ # # ]: 0 : if( pFilterMode )
1012 : 0 : pFilterMode->Save( rStrm );
1013 [ # # ]: 0 : if( pFilterInfo )
1014 : 0 : pFilterInfo->Save( rStrm );
1015 : 0 : maFilterList.Save( rStrm );
1016 : 0 : }
1017 : :
1018 : 0 : void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
1019 : : {
1020 [ # # ][ # # ]: 0 : if( maFilterList.IsEmpty() && !mbAutoFilter )
[ # # ]
1021 : 0 : return;
1022 : :
1023 : 0 : sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1024 : : rWorksheet->startElement( XML_autoFilter,
1025 : : XML_ref, XclXmlUtils::ToOString( maRef ).getStr(),
1026 [ # # ]: 0 : FSEND );
1027 : : // OOXTODO: XML_extLst, XML_sortState
1028 [ # # ]: 0 : if( !maFilterList.IsEmpty() )
1029 : 0 : maFilterList.SaveXml( rStrm );
1030 : 0 : rWorksheet->endElement( XML_autoFilter );
1031 : : }
1032 : :
1033 : 0 : bool ExcAutoFilterRecs::HasFilterMode() const
1034 : : {
1035 : 0 : return pFilterMode != NULL;
1036 : : }
1037 : :
1038 : : // ----------------------------------------------------------------------------
1039 : :
1040 : 0 : XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) :
1041 [ # # ]: 0 : XclExpRoot( rRoot )
1042 : : {
1043 : 0 : }
1044 : :
1045 : 0 : void XclExpFilterManager::InitTabFilter( SCTAB nScTab )
1046 : : {
1047 [ # # ]: 0 : maFilterMap[ nScTab ].reset( new ExcAutoFilterRecs( GetRoot(), nScTab ) );
1048 : 0 : }
1049 : :
1050 : 0 : XclExpRecordRef XclExpFilterManager::CreateRecord( SCTAB nScTab )
1051 : : {
1052 [ # # ]: 0 : XclExpTabFilterRef xRec;
1053 [ # # ]: 0 : XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1054 [ # # ]: 0 : if( aIt != maFilterMap.end() )
1055 : : {
1056 [ # # ]: 0 : xRec = aIt->second;
1057 [ # # ]: 0 : xRec->AddObjRecs();
1058 : : }
1059 [ # # ][ # # ]: 0 : return xRec;
1060 : : }
1061 : :
1062 : 0 : bool XclExpFilterManager::HasFilterMode( SCTAB nScTab )
1063 : : {
1064 [ # # ]: 0 : XclExpTabFilterRef xRec;
1065 [ # # ]: 0 : XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1066 [ # # ]: 0 : if( aIt != maFilterMap.end() )
1067 : : {
1068 : 0 : return aIt->second->HasFilterMode();
1069 : : }
1070 [ # # ]: 0 : return false;
1071 [ + - ][ + - ]: 24 : }
1072 : :
1073 : : // ============================================================================
1074 : :
1075 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|