LibreOffice Module sc (master) 1
excrecds.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <excrecds.hxx>
21
22#include <map>
24
25#include <svl/numformat.hxx>
26#include <sal/log.hxx>
27#include <sax/fastattribs.hxx>
28
29#include <string.h>
30
31#include <global.hxx>
32#include <document.hxx>
33#include <dbdata.hxx>
34#include <oox/export/utils.hxx>
35#include <oox/token/tokens.hxx>
36#include <queryentry.hxx>
37#include <queryparam.hxx>
38#include <sortparam.hxx>
39#include <userlist.hxx>
40#include <root.hxx>
41
42#include <xeescher.hxx>
43#include <xelink.hxx>
44#include <xename.hxx>
45#include <xlname.hxx>
46#include <xestyle.hxx>
47
48#include <xcl97rec.hxx>
49#include <tabprotection.hxx>
50#include <scitems.hxx>
51#include <attrib.hxx>
52
53using namespace ::oox;
54
55using ::com::sun::star::uno::Sequence;
56
57//--------------------------------------------------------- class ExcDummy_00 -
59 0x5c, 0x00, 0x20, 0x00, 0x04, 'C', 'a', 'l', 'c', // WRITEACCESS
60 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
61 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
62 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
63};
64const std::size_t ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData );
65
66//-------------------------------------------------------- class ExcDummy_04x -
68 0x40, 0x00, 0x02, 0x00, 0x00, 0x00, // BACKUP
69 0x8d, 0x00, 0x02, 0x00, 0x00, 0x00, // HIDEOBJ
70};
71const std::size_t ExcDummy_040::nMyLen = sizeof( ExcDummy_040::pMyData );
72
74 0x0e, 0x00, 0x02, 0x00, 0x01, 0x00, // PRECISION
75 0xda, 0x00, 0x02, 0x00, 0x00, 0x00 // BOOKBOOL
76};
77const std::size_t ExcDummy_041::nMyLen = sizeof( ExcDummy_041::pMyData );
78
79//-------------------------------------------------------- class ExcDummy_02a -
81 0x0d, 0x00, 0x02, 0x00, 0x01, 0x00, // CALCMODE
82 0x0c, 0x00, 0x02, 0x00, 0x64, 0x00, // CALCCOUNT
83 0x0f, 0x00, 0x02, 0x00, 0x01, 0x00, // REFMODE
84 0x11, 0x00, 0x02, 0x00, 0x00, 0x00, // ITERATION
85 0x10, 0x00, 0x08, 0x00, 0xfc, 0xa9, 0xf1, 0xd2, 0x4d, // DELTA
86 0x62, 0x50, 0x3f,
87 0x5f, 0x00, 0x02, 0x00, 0x01, 0x00 // SAVERECALC
88};
89const std::size_t ExcDummy_02a::nMyLen = sizeof( ExcDummy_02a::pMyData );
90
91//----------------------------------------------------------- class ExcRecord -
92
94{
97}
98
100{
101}
102
104{
105 SaveCont( rStrm );
106}
107
109{
110}
111
112//--------------------------------------------------------- class ExcEmptyRec -
113
115{
116}
117
118sal_uInt16 ExcEmptyRec::GetNum() const
119{
120 return 0;
121}
122
123std::size_t ExcEmptyRec::GetLen() const
124{
125 return 0;
126}
127
128//--------------------------------------------------------- class ExcDummyRec -
129
131{
132 rStrm.Write( GetData(), GetLen() ); // raw write mode
133}
134
135sal_uInt16 ExcDummyRec::GetNum() const
136{
137 return 0x0000;
138}
139
140//------------------------------------------------------- class ExcBoolRecord -
141
143{
144 rStrm << static_cast<sal_uInt16>(bVal ? 0x0001 : 0x0000);
145}
146
147std::size_t ExcBoolRecord::GetLen() const
148{
149 return 2;
150}
151
152//--------------------------------------------------------- class ExcBof_Base -
153
155 : nDocType(0)
156 , nVers(0)
157 , nRupBuild(0x096C) // copied from Excel
158 , nRupYear(0x07C9) // copied from Excel
159{
160}
161
162//-------------------------------------------------------------- class ExcBof -
163
165{
166 nDocType = 0x0010;
167 nVers = 0x0500;
168}
169
171{
173}
174
175sal_uInt16 ExcBof::GetNum() const
176{
177 return 0x0809;
178}
179
180std::size_t ExcBof::GetLen() const
181{
182 return 8;
183}
184
185//------------------------------------------------------------- class ExcBofW -
186
188{
189 nDocType = 0x0005;
190 nVers = 0x0500;
191}
192
194{
196}
197
198sal_uInt16 ExcBofW::GetNum() const
199{
200 return 0x0809;
201}
202
203std::size_t ExcBofW::GetLen() const
204{
205 return 8;
206}
207
208//-------------------------------------------------------------- class ExcEof -
209
210sal_uInt16 ExcEof::GetNum() const
211{
212 return 0x000A;
213}
214
215std::size_t ExcEof::GetLen() const
216{
217 return 0;
218}
219
220//--------------------------------------------------------- class ExcDummy_00 -
221
222std::size_t ExcDummy_00::GetLen() const
223{
224 return nMyLen;
225}
226
228{
229 return pMyData;
230}
231
232//-------------------------------------------------------- class ExcDummy_04x -
233
234std::size_t ExcDummy_040::GetLen() const
235{
236 return nMyLen;
237}
238
240{
241 return pMyData;
242}
243
244std::size_t ExcDummy_041::GetLen() const
245{
246 return nMyLen;
247}
248
250{
251 return pMyData;
252}
253
254//------------------------------------------------------------- class Exc1904 -
255
257{
258 const Date& rDate = rDoc.GetFormatTable()->GetNullDate();
259 bVal = (rDate == Date( 1, 1, 1904 ));
260 bDateCompatibility = (rDate != Date( 30, 12, 1899 ));
261}
262
263sal_uInt16 Exc1904::GetNum() const
264{
265 return 0x0022;
266}
267
269{
270 bool bISOIEC = ( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 );
271
272 if( bISOIEC )
273 {
274 rStrm.WriteAttributes(XML_dateCompatibility, ToPsz(bDateCompatibility));
275 }
276
277 if( !bISOIEC || bDateCompatibility )
278 {
279 rStrm.WriteAttributes(XML_date1904, ToPsz(bVal));
280 }
281}
282
283//------------------------------------------------------ class ExcBundlesheet -
284
286 m_nStrPos( STREAM_SEEK_TO_END ),
287 m_nOwnPos( STREAM_SEEK_TO_END ),
288 nGrbit( rRootData.pER->GetTabInfo().IsVisibleTab( nTabNum ) ? 0x0000 : 0x0001 ),
289 nTab( nTabNum )
290{
291}
292
294 m_nStrPos( STREAM_SEEK_TO_END ),
295 m_nOwnPos( STREAM_SEEK_TO_END ),
296 nGrbit( 0x0000 ),
297 nTab( SCTAB_GLOBAL )
298{
299}
300
302{
303 rStrm.SetSvStreamPos( m_nOwnPos );
304 rStrm.DisableEncryption();
305 rStrm << static_cast<sal_uInt32>(m_nStrPos);
306 rStrm.EnableEncryption();
307}
308
310{
311 return 0x0085;
312}
313
315 ExcBundlesheetBase( rRootData, _nTab )
316{
317 OUString sTabName = rRootData.pER->GetTabInfo().GetScTabName( _nTab );
318 OSL_ENSURE( sTabName.getLength() < 256, "ExcBundlesheet::ExcBundlesheet - table name too long" );
319 aName = OUStringToOString(sTabName, rRootData.pER->GetTextEncoding());
320}
321
323{
324 m_nOwnPos = rStrm.GetSvStreamPos();
325 rStrm << sal_uInt32(0x00000000) // dummy (stream position of the sheet)
326 << nGrbit;
327 rStrm.WriteByteString(aName); // 8 bit length, max 255 chars
328}
329
330std::size_t ExcBundlesheet::GetLen() const
331{
332 return 7 + std::min( aName.getLength(), sal_Int32(255) );
333}
334
335//--------------------------------------------------------- class ExcDummy_02 -
336
337std::size_t ExcDummy_02a::GetLen() const
338{
339 return nMyLen;
340}
341
343{
344 return pMyData;
345}
346//--------------------------------------------------------- class ExcDummy_02 -
347
350{
351 /* #i31530# set document country as UI country too -
352 needed for correct behaviour of number formats. */
353 mnUICountry = mnDocCountry = static_cast< sal_uInt16 >(
354 ::msfilter::ConvertLanguageToCountry( rRoot.GetDocLanguage() ) );
355}
356
358{
360}
361
362// XclExpWsbool ===============================================================
363
364XclExpWsbool::XclExpWsbool( bool bFitToPages )
366{
367 if( bFitToPages )
369}
370
371XclExpXmlSheetPr::XclExpXmlSheetPr( bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager ) :
372 mnScTab(nScTab), mpManager(pManager), mbFitToPage(bFitToPages), maTabColor(rTabColor) {}
373
375{
376 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
377 rWorksheet->startElement( XML_sheetPr,
378 // OOXTODO: XML_syncHorizontal,
379 // OOXTODO: XML_syncVertical,
380 // OOXTODO: XML_syncRef,
381 // OOXTODO: XML_transitionEvaluation,
382 // OOXTODO: XML_transitionEntry,
383 // OOXTODO: XML_published,
384 // OOXTODO: XML_codeName,
385 XML_filterMode, mpManager ? ToPsz(mpManager->HasFilterMode(mnScTab)) : nullptr
386 // OOXTODO: XML_enableFormatConditionsCalculation
387 );
388
389 // Note : the order of child elements is significant. Don't change the order.
390
391 // OOXTODO: XML_outlinePr
392
393 if (maTabColor != COL_AUTO)
394 rWorksheet->singleElement(XML_tabColor, XML_rgb, XclXmlUtils::ToOString(maTabColor));
395
396 rWorksheet->singleElement(XML_pageSetUpPr,
397 // OOXTODO: XML_autoPageBreaks,
398 XML_fitToPage, ToPsz(mbFitToPage));
399
400 rWorksheet->endElement( XML_sheetPr );
401}
402
403// XclExpWindowProtection ===============================================================
404
407{
408}
409
411{
412 rStrm.WriteAttributes(XML_lockWindows, ToPsz(GetBool()));
413}
414
415// XclExpDocProtection ===============================================================
416
419{
420}
421
423 XclExpProtection( bValue),
424 mnTab(nTab)
425{
426}
427
429{
430 ScDocument& rDoc = rStrm.GetRoot().GetDoc();
431 const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab);
432 if ( !pTabProtect )
433 return;
434
435 const ScOoxPasswordHash& rPH = pTabProtect->getPasswordHash();
436 // Do not write any hash attributes if there is no password.
438 if (rPH.hasPassword())
439 aPH = rPH;
440
441 Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
442 OString sHash;
443 if (aHash.getLength() >= 2)
444 {
445 sHash = OString::number(
446 ( static_cast<sal_uInt8>(aHash[0]) << 8
447 | static_cast<sal_uInt8>(aHash[1]) ),
448 16 );
449 }
450 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
451 rWorksheet->singleElement( XML_sheetProtection,
452 XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : aPH.maAlgorithmName.toUtf8().getStr(),
453 XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : aPH.maHashValue.toUtf8().getStr(),
454 XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : aPH.maSaltValue.toUtf8().getStr(),
455 XML_spinCount, aPH.mnSpinCount ? OString::number( aPH.mnSpinCount).getStr() : nullptr,
456 XML_sheet, ToPsz( true ),
457 XML_password, sHash.isEmpty()? nullptr : sHash.getStr(),
458 XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? nullptr : ToPsz( true ),
459 XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? nullptr : ToPsz( true ),
460 XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? ToPsz( false ) : nullptr,
461 XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? ToPsz( false ) : nullptr,
462 XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? ToPsz( false ) : nullptr,
463 XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? ToPsz( false ) : nullptr,
464 XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? ToPsz( false ) : nullptr,
465 XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? ToPsz( false ) : nullptr,
466 XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? ToPsz( false ) : nullptr,
467 XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? ToPsz( false ) : nullptr,
468 XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? nullptr : ToPsz( true ),
469 XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? ToPsz( false ) : nullptr,
470 XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? ToPsz( false ) : nullptr,
471 XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? ToPsz( false ) : nullptr,
472 XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ) );
473
474 const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
475 if (rProts.empty())
476 return;
477
478 rWorksheet->startElement(XML_protectedRanges);
479 for (const auto& rProt : rProts)
480 {
481 SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(),
482 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor");
483 rWorksheet->singleElement( XML_protectedRange,
484 XML_name, rProt.maTitle.isEmpty() ? nullptr : rProt.maTitle.toUtf8().getStr(),
485 XML_securityDescriptor, rProt.maSecurityDescriptorXML.isEmpty() ? nullptr : rProt.maSecurityDescriptorXML.toUtf8().getStr(),
486 /* XXX 'password' is not part of OOXML, but Excel2013
487 * writes it if loaded from BIFF, in which case
488 * 'algorithmName', 'hashValue', 'saltValue' and
489 * 'spinCount' are absent; so do we if it was present. */
490 XML_password, rProt.mnPasswordVerifier ? OString::number( rProt.mnPasswordVerifier, 16).getStr() : nullptr,
491 XML_algorithmName, rProt.maPasswordHash.maAlgorithmName.isEmpty() ? nullptr : rProt.maPasswordHash.maAlgorithmName.toUtf8().getStr(),
492 XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
493 XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
494 XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
495 XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
496 }
497 rWorksheet->endElement( XML_protectedRanges);
498}
499
500XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
502 mnHash(0x0000)
503{
504 if (aHash.getLength() >= 2)
505 {
506 mnHash = ((aHash[0] << 8) & 0xFFFF);
507 mnHash |= (aHash[1] & 0xFF);
508 }
509}
510
512{
513}
514
516{
517 rStrm << mnHash;
518}
519
522{
523}
524
526 XclExpUInt16Record( EXC_ID_AUTOFILTERINFO, static_cast< sal_uInt16 >( nScCol ) ),
527 maStartPos( rStartPos )
528{
529}
530
533 nOper( EXC_AFOPER_EQUAL )
534{
535}
536
538{
539}
540
542{
543 return pText ? (1 + pText->GetBufferSize()) : 0;
544}
545
546void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, const OUString* pT )
547{
548 nType = nTp;
549 nOper = nOp;
550 pText.reset( pT ? new XclExpString( *pT, XclStrFlags::EightBitLength ) : nullptr);
551}
552
554{
555 rStrm << nType << nOper;
557 {
558 OSL_ENSURE(pText, "ExcFilterCondition::Save() -- pText is NULL!");
559 rStrm << sal_uInt32(0) << static_cast<sal_uInt8>(pText->Len()) << sal_uInt16(0) << sal_uInt8(0);
560 }
561 else
562 rStrm << sal_uInt32(0) << sal_uInt32(0);
563}
564
565static const char* lcl_GetOperator( sal_uInt8 nOper )
566{
567 switch( nOper )
568 {
569 case EXC_AFOPER_EQUAL: return "equal";
570 case EXC_AFOPER_GREATER: return "greaterThan";
571 case EXC_AFOPER_GREATEREQUAL: return "greaterThanOrEqual";
572 case EXC_AFOPER_LESS: return "lessThan";
573 case EXC_AFOPER_LESSEQUAL: return "lessThanOrEqual";
574 case EXC_AFOPER_NOTEQUAL: return "notEqual";
575 case EXC_AFOPER_NONE:
576 default: return "**none**";
577 }
578}
579
580static OString lcl_GetValue( sal_uInt8 nType, const XclExpString* pStr )
581{
583 return XclXmlUtils::ToOString(*pStr);
584 else
585 return OString();
586}
587
589{
590 if( IsEmpty() )
591 return;
592
593 rStrm.GetCurrentStream()->singleElement( XML_customFilter,
594 XML_operator, lcl_GetOperator( nOper ),
595 XML_val, lcl_GetValue(nType, pText.get()) );
596}
597
599{
600 if( nType == EXC_AFTYPE_STRING )
601 {
602 OSL_ENSURE( pText, "ExcFilterCondition::SaveText() -- pText is NULL!" );
603 pText->WriteFlagField( rStrm );
604 pText->WriteBuffer( rStrm );
605 }
606}
607
608XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC, bool bIsEmpty ) :
610 XclExpRoot( rRoot ),
611 meType(bIsEmpty ? Empty : FilterCondition),
612 nCol( nC ),
613 bIsButtonHidden( false ),
614 nFlags( 0 ),
615 bHasBlankValue( false )
616{
617}
618
620 const OUString* pText, bool bSimple )
621{
622 if( !aCond[ 1 ].IsEmpty() )
623 return false;
624
625 sal_uInt16 nInd = aCond[ 0 ].IsEmpty() ? 0 : 1;
626
627 if( nInd == 1 )
628 nFlags |= (eConn == SC_OR) ? EXC_AFFLAG_OR : EXC_AFFLAG_AND;
629 if( bSimple )
631
632 aCond[ nInd ].SetCondition( nType, nOp, pText );
633
634 AddRecSize( aCond[ nInd ].GetTextBytes() );
635
636 return true;
637}
638
640{
641 return !aCond[0].IsEmpty();
642}
643
645{
646 const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
647
648 if (rItems.empty())
649 {
651 {
652 // tdf#123353 XLSX export
654 return false;
655 }
656 // XLS export
657 return true;
658 }
659
660 if (GetOutput() != EXC_OUTPUT_BINARY && rItems.size() > 1)
661 {
662 AddMultiValueEntry(rEntry);
663 return false;
664 }
665
666 bool bConflict = false;
667 OUString sText;
668 const ScQueryEntry::Item& rItem = rItems[0];
669 if (!rItem.maString.isEmpty())
670 {
671 sText = rItem.maString.getString();
672 switch( rEntry.eOp )
673 {
674 case SC_CONTAINS:
676 {
677 sText = "*" + sText + "*";
678 }
679 break;
680 case SC_BEGINS_WITH:
682 sText += "*";
683 break;
684 case SC_ENDS_WITH:
686 sText = "*" + sText;
687 break;
688 default:
689 {
690 //nothing
691 }
692 }
693 }
694
695 // empty/nonempty fields
696 if (rEntry.IsQueryByEmpty())
697 {
698 bConflict = !AddCondition(rEntry.eConnect, EXC_AFTYPE_EMPTY, EXC_AFOPER_NONE, nullptr, true);
699 bHasBlankValue = true;
700 }
701 else if(rEntry.IsQueryByNonEmpty())
702 bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, nullptr, true );
703 else if (rEntry.IsQueryByTextColor() || rEntry.IsQueryByBackgroundColor())
704 {
705 AddColorEntry(rEntry);
706 }
707 // other conditions
708 else
709 {
710 // top10 flags
711 sal_uInt16 nNewFlags = 0x0000;
712 switch( rEntry.eOp )
713 {
714 case SC_TOPVAL:
716 break;
717 case SC_BOTVAL:
718 nNewFlags = EXC_AFFLAG_TOP10;
719 break;
720 case SC_TOPPERC:
722 break;
723 case SC_BOTPERC:
725 break;
726 default:;
727 }
728 bool bNewTop10 = ::get_flag( nNewFlags, EXC_AFFLAG_TOP10 );
729
730 bConflict = HasTop10() && bNewTop10;
731 if( !bConflict )
732 {
733 if( bNewTop10 )
734 {
735 sal_uInt32 nIndex = 0;
736 double fVal = 0.0;
737 if (GetFormatter().IsNumberFormat(sText, nIndex, fVal))
738 {
739 if (fVal < 0) fVal = 0;
740 if (fVal >= 501) fVal = 500;
741 }
742 nFlags |= (nNewFlags | static_cast<sal_uInt16>(fVal) << 7);
743 }
744 // normal condition
745 else
746 {
747 if (GetOutput() != EXC_OUTPUT_BINARY && rEntry.eOp == SC_EQUAL)
748 {
749 AddMultiValueEntry(rEntry);
750 return false;
751 }
752
754
755 switch( rEntry.eOp )
756 {
757 case SC_EQUAL: nOper = EXC_AFOPER_EQUAL; break;
758 case SC_LESS: nOper = EXC_AFOPER_LESS; break;
759 case SC_GREATER: nOper = EXC_AFOPER_GREATER; break;
760 case SC_LESS_EQUAL: nOper = EXC_AFOPER_LESSEQUAL; break;
761 case SC_GREATER_EQUAL: nOper = EXC_AFOPER_GREATEREQUAL; break;
762 case SC_NOT_EQUAL: nOper = EXC_AFOPER_NOTEQUAL; break;
763 case SC_CONTAINS:
764 case SC_BEGINS_WITH:
765 case SC_ENDS_WITH:
766 nOper = EXC_AFOPER_EQUAL; break;
770 nOper = EXC_AFOPER_NOTEQUAL; break;
771 default:;
772 }
773 bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_STRING, nOper, &sText);
774 }
775 }
776 }
777 return bConflict;
778}
779
781{
783 const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
784 for (const auto& rItem : rItems)
785 {
786 if( rItem.maString.isEmpty() )
787 bHasBlankValue = true;
788 else
789 maMultiValues.push_back(std::make_pair(rItem.maString.getString(), rItem.meType == ScQueryEntry::ByDate));
790 }
791}
792
794{
796 const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
797 for (const auto& rItem : rItems)
798 {
799 maColorValues.push_back(
800 std::make_pair(rItem.maColor, rItem.meType == ScQueryEntry::ByBackgroundColor));
801 // Ensure that selected color(s) will be added to dxf: selection can be not in list
802 // of already added to dfx colors taken from filter range
803 if (GetDxfs().GetDxfByColor(rItem.maColor) == -1)
804 GetDxfs().AddColor(rItem.maColor);
805 }
806}
807
809{
810 rStrm << nCol << nFlags;
811 aCond[ 0 ].Save( rStrm );
812 aCond[ 1 ].Save( rStrm );
813 aCond[ 0 ].SaveText( rStrm );
814 aCond[ 1 ].SaveText( rStrm );
815}
816
818{
819 if (meType == FilterCondition && !HasCondition() && !HasTop10())
820 return;
821
822 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
823
824 std::optional<OString> sHiddenButtonValue;
825 if (bIsButtonHidden)
826 sHiddenButtonValue = "1";
827
828 rWorksheet->startElement( XML_filterColumn,
829 XML_colId, OString::number(nCol),
830 XML_hiddenButton, sHiddenButtonValue
831 );
832
833 switch (meType)
834 {
835 case FilterCondition:
836 {
837 if( HasTop10() )
838 {
839 rWorksheet->singleElement( XML_top10,
840 XML_top, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10TOP ) ),
841 XML_percent, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10PERC ) ),
842 XML_val, OString::number(nFlags >> 7)
843 // OOXTODO: XML_filterVal
844 );
845 }
846 else
847 {
848 rWorksheet->startElement(XML_customFilters, XML_and,
850 aCond[0].SaveXml(rStrm);
851 aCond[1].SaveXml(rStrm);
852 rWorksheet->endElement(XML_customFilters);
853 }
854 // OOXTODO: XML_dynamicFilter, XML_extLst, XML_filters, XML_iconFilter
855 }
856 break;
857 case ColorValue:
858 {
859 if (!maColorValues.empty())
860 {
861 Color color = maColorValues[0].first;
863
864 if (maColorValues[0].second) // is background color
865 {
866 pAttrList->add(XML_cellColor, OString::number(1));
867 }
868 else
869 {
870 pAttrList->add(XML_cellColor, OString::number(0));
871 }
872 pAttrList->add(XML_dxfId, OString::number(GetDxfs().GetDxfByColor(color)));
873 rWorksheet->singleElement(XML_colorFilter, pAttrList);
874 }
875 }
876 break;
877 case BlankValue:
878 {
879 rWorksheet->singleElement(XML_filters, XML_blank, "1");
880 }
881 break;
882 case MultiValue:
883 {
884 if( bHasBlankValue )
885 rWorksheet->startElement(XML_filters, XML_blank, "1");
886 else
887 rWorksheet->startElement(XML_filters);
888
889 for (const auto& rMultiValue : maMultiValues)
890 {
891 OString aStr = OUStringToOString(rMultiValue.first, RTL_TEXTENCODING_UTF8);
892 if( !rMultiValue.second )
893 {
894 const char* pz = aStr.getStr();
895 rWorksheet->singleElement(XML_filter, XML_val, pz);
896 }
897 else
898 {
900 sal_Int32 aDateGroup[3] = { XML_year, XML_month, XML_day };
901 sal_Int32 idx = 0;
902 for (size_t i = 0; idx >= 0 && i < 3; i++)
903 {
904 OString kw = aStr.getToken(0, '-', idx);
905 kw = kw.trim();
906 if (!kw.isEmpty())
907 {
908 pAttrList->add(aDateGroup[i], kw);
909 }
910 }
911 // TODO: date filter can only handle YYYY-MM-DD date formats, so XML_dateTimeGrouping value
912 // will be "day" as default, until date filter cannot handle HH:MM:SS.
913 pAttrList->add(XML_dateTimeGrouping, "day");
914 rWorksheet->singleElement(XML_dateGroupItem, pAttrList);
915 }
916 }
917 rWorksheet->endElement(XML_filters);
918 }
919 break;
920 // Used for constructing an empty filterColumn element for exporting the XML_hiddenButton attribute
921 case Empty: break;
922 }
923 rWorksheet->endElement( XML_filterColumn );
924}
925
926ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) :
927 XclExpRoot( rRoot ),
928 mbAutoFilter (false)
929{
930 XclExpNameManager& rNameMgr = GetNameManager();
931
932 bool bFound = false;
933 bool bAdvanced = false;
934 const ScDBData* pData = (pDefinedData ? pDefinedData : rRoot.GetDoc().GetAnonymousDBData(nTab));
935 ScRange aAdvRange;
936 if (pData)
937 {
938 bAdvanced = pData->GetAdvancedQuerySource( aAdvRange );
939 bFound = (pData->HasQueryParam() || pData->HasAutoFilter() || bAdvanced);
940 }
941 if( !bFound )
942 return;
943
944 ScQueryParam aParam;
945 pData->GetQueryParam( aParam );
946
947 ScRange aRange( aParam.nCol1, aParam.nRow1, aParam.nTab,
948 aParam.nCol2, aParam.nRow2, aParam.nTab );
949 aRange.PutInOrder();
950 SCCOL nColCnt = aRange.aEnd.Col() - aRange.aStart.Col() + 1;
951
952 maRef = aRange;
953
954 // #i2394# built-in defined names must be sorted by containing sheet name
955 if (!pDefinedData)
957
958 // advanced filter
959 if( bAdvanced )
960 {
961 // filter criteria, excel allows only same table
962 if( !pDefinedData && aAdvRange.aStart.Tab() == nTab )
963 rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange );
964
965 // filter destination range, excel allows only same table
966 if( !aParam.bInplace )
967 {
968 ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
969 aDestRange.aEnd.IncCol( nColCnt - 1 );
970 if( !pDefinedData && aDestRange.aStart.Tab() == nTab )
971 rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
972 }
973
975 }
976 // AutoFilter
977 else
978 {
979 bool bConflict = false;
980 bool bContLoop = true;
981 bool bHasOr = false;
982 SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
983 ScDocument& rDoc = rRoot.GetDoc();
984 SCROW nRow = aRange.aStart.Row();
985
986 // create AUTOFILTER records for filtered columns
987 for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < aParam.GetEntryCount()); nEntry++ )
988 {
989 const ScQueryEntry& rEntry = aParam.GetEntry( nEntry );
990
991 bContLoop = rEntry.bDoQuery;
992 if( bContLoop )
993 {
994 SCCOL nCol = static_cast<SCCOL>( rEntry.nField ) - aRange.aStart.Col();
995 auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
996 bool bIsButtonHidden = !( nFlag & ScMF::Auto );
997 XclExpAutofilter* pFilter = GetByCol( nCol );
998 pFilter->SetButtonHidden( bIsButtonHidden );
999
1000 if( nEntry > 0 )
1001 bHasOr |= (rEntry.eConnect == SC_OR);
1002
1003 bConflict = (nEntry > 1) && bHasOr;
1004 if( !bConflict )
1005 bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
1006 (nFirstField != rEntry.nField);
1007 if( !bConflict )
1008 bConflict = pFilter->AddEntry( rEntry );
1009 }
1010 }
1011
1012 sal_uInt16 nColId = 0;
1013 for ( auto nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); nCol++, nColId++ )
1014 {
1015 auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
1016 bool bIsButtonHidden = !( nFlag & ScMF::Auto );
1017 if ( bIsButtonHidden )
1018 {
1019 // Create filter column with hiddenButton=1 attribute if it doesn't exist
1020 XclExpAutofilterRef xFilter;
1021 bool bFilterFound = false;
1022 for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
1023 {
1024 xFilter = maFilterList.GetRecord( nPos );
1025 if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) )
1026 {
1027 bFilterFound = true;
1028 break;
1029 }
1030 }
1031 if ( !bFilterFound )
1032 {
1033 xFilter = new XclExpAutofilter( GetRoot(), nColId, /*bIsEmpty*/true );
1034 xFilter->SetButtonHidden( true );
1035 maFilterList.AppendRecord( xFilter );
1036 }
1037 }
1038 }
1039
1040 // additional tests for conflicts
1041 for( size_t nPos = 0, nSize = maFilterList.GetSize(); !bConflict && (nPos < nSize); ++nPos )
1042 {
1044 bConflict = xFilter->HasCondition() && xFilter->HasTop10();
1045 }
1046
1047 if( bConflict )
1049
1050 if( !maFilterList.IsEmpty() )
1052 m_pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
1053
1054 if (maFilterList.IsEmpty () && !bConflict)
1055 mbAutoFilter = true;
1056
1057 // get sort criteria
1058 {
1059 ScSortParam aSortParam;
1060 pData->GetSortParam( aSortParam );
1061
1063 if (aSortParam.bUserDef && pList && pList->size() > aSortParam.nUserIndex)
1064 {
1065 // get sorted area without headers
1067 aParam.nCol1, aParam.nRow1 + (aSortParam.bHasHeader? 1 : 0), aParam.nTab,
1068 aParam.nCol2, aParam.nRow2, aParam.nTab );
1069
1070 // get sorted columns with custom lists
1071 const ScUserListData& rData = (*pList)[aSortParam.nUserIndex];
1072
1073 // get column index and sorting direction
1074 SCCOLROW nField = 0;
1075 bool bSortAscending=true;
1076 for (const auto & rKey : aSortParam.maKeyState)
1077 {
1078 if (rKey.bDoSort)
1079 {
1080 nField = rKey.nField;
1081 bSortAscending = rKey.bAscending;
1082 break;
1083 }
1084 }
1085
1086 // remember sort criteria
1087 const ScRange aSortedColumn(
1088 nField, aParam.nRow1 + (aSortParam.bHasHeader? 1 : 0), aParam.nTab,
1089 nField, aParam.nRow2, aParam.nTab );
1090 const OUString aItemList = rData.GetString();
1091
1092 maSortCustomList.emplace_back(aSortedColumn, aItemList, !bSortAscending);
1093 }
1094 }
1095 }
1096}
1097
1099{
1100}
1101
1103{
1104 XclExpAutofilterRef xFilter;
1105 for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
1106 {
1107 xFilter = maFilterList.GetRecord( nPos );
1108 if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) )
1109 return xFilter.get();
1110 }
1111 xFilter = new XclExpAutofilter( GetRoot(), static_cast<sal_uInt16>(nCol) );
1112 maFilterList.AppendRecord( xFilter );
1113 return xFilter.get();
1114}
1115
1117{
1118 for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
1119 if( maFilterList.GetRecord( nPos )->GetCol() == static_cast<sal_uInt16>(nCol) )
1120 return true;
1121 return false;
1122}
1123
1125{
1126 if( m_pFilterInfo )
1127 {
1128 ScAddress aAddr( m_pFilterInfo->GetStartPos() );
1129 for( SCCOL nObj = 0, nCount = m_pFilterInfo->GetColCount(); nObj < nCount; nObj++ )
1130 {
1131 std::unique_ptr<XclObj> pObjRec(new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) ));
1132 GetObjectManager().AddObj( std::move(pObjRec) );
1133 aAddr.IncCol();
1134 }
1135 }
1136}
1137
1139{
1140 if( m_pFilterMode )
1141 m_pFilterMode->Save( rStrm );
1142 if( m_pFilterInfo )
1143 m_pFilterInfo->Save( rStrm );
1145}
1146
1148{
1150 return;
1151
1152 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1153 rWorksheet->startElement(XML_autoFilter, XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), maRef));
1154 // OOXTODO: XML_extLst, XML_sortState
1155 if( !maFilterList.IsEmpty() )
1157
1158 if (!maSortCustomList.empty())
1159 {
1160 rWorksheet->startElement(XML_sortState, XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), maSortRef));
1161
1162 for (const auto & rSortCriteria : maSortCustomList)
1163 {
1164 if (std::get<2>(rSortCriteria))
1165 rWorksheet->singleElement(XML_sortCondition,
1166 XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(),
1167 std::get<0>(rSortCriteria)),
1168 XML_descending, "1",
1169 XML_customList, std::get<1>(rSortCriteria).toUtf8().getStr());
1170 else
1171 rWorksheet->singleElement(XML_sortCondition,
1172 XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(),
1173 std::get<0>(rSortCriteria)),
1174 XML_customList, std::get<1>(rSortCriteria).toUtf8().getStr());
1175 }
1176
1177 rWorksheet->endElement(XML_sortState);
1178 }
1179
1180 rWorksheet->endElement( XML_autoFilter );
1181}
1182
1184{
1185 return m_pFilterMode != nullptr;
1186}
1187
1189 XclExpRoot( rRoot )
1190{
1191}
1192
1194{
1195 maFilterMap[ nScTab ] = new ExcAutoFilterRecs( GetRoot(), nScTab, nullptr );
1196}
1197
1199{
1200 XclExpTabFilterRef xRec;
1201 XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1202 if( aIt != maFilterMap.end() )
1203 {
1204 xRec = aIt->second;
1205 xRec->AddObjRecs();
1206 }
1207 return xRec;
1208}
1209
1211{
1212 XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1213 if( aIt != maFilterMap.end() )
1214 {
1215 return aIt->second->HasFilterMode();
1216 }
1217 return false;
1218}
1219
1220/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
Exc1904(const ScDocument &rDoc)
Definition: excrecds.cxx:256
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:268
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:263
bool bDateCompatibility
Definition: excrecds.hxx:229
std::vector< std::tuple< ScRange, OUString, bool > > maSortCustomList
Definition: excrecds.hxx:431
ExcAutoFilterRecs(const XclExpRoot &rRoot, SCTAB nTab, const ScDBData *pDefinedData)
Definition: excrecds.cxx:926
XclExpAutofilter * GetByCol(SCCOL nCol)
Definition: excrecds.cxx:1102
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:1147
XclExpAutofilterList maFilterList
Definition: excrecds.hxx:424
bool HasFilterMode() const
Definition: excrecds.cxx:1183
virtual void Save(XclExpStream &rStrm) override
Overwrite this method to do any operation while saving the record.
Definition: excrecds.cxx:1138
rtl::Reference< XclExpFiltermode > m_pFilterMode
Definition: excrecds.hxx:425
rtl::Reference< XclExpAutofilterinfo > m_pFilterInfo
Definition: excrecds.hxx:426
bool IsFiltered(SCCOL nCol)
Definition: excrecds.cxx:1116
virtual ~ExcAutoFilterRecs() override
Definition: excrecds.cxx:1098
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:198
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:203
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:193
sal_uInt16 nDocType
Definition: excrecds.hxx:100
sal_uInt16 nRupBuild
Definition: excrecds.hxx:102
sal_uInt16 nRupYear
Definition: excrecds.hxx:103
sal_uInt16 nVers
Definition: excrecds.hxx:101
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:175
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:180
ExcBof()
Definition: excrecds.cxx:164
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:170
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:147
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:142
sal_uInt64 m_nOwnPos
Definition: excrecds.hxx:238
sal_uInt16 nGrbit
Definition: excrecds.hxx:239
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:309
void UpdateStreamPos(XclExpStream &rStrm)
Definition: excrecds.cxx:301
sal_uInt64 m_nStrPos
Definition: excrecds.hxx:237
OString aName
Definition: excrecds.hxx:256
ExcBundlesheet(const RootData &rRootData, SCTAB nTab)
Definition: excrecds.cxx:314
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:330
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:322
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:130
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:135
virtual const sal_uInt8 * GetData() const =0
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:222
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:227
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:152
static const std::size_t nMyLen
Definition: excrecds.hxx:153
static const std::size_t nMyLen
Definition: excrecds.hxx:272
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:271
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:337
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:342
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:234
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:202
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:239
static const std::size_t nMyLen
Definition: excrecds.hxx:203
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:212
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:249
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:244
static const std::size_t nMyLen
Definition: excrecds.hxx:213
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:118
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:114
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:123
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:215
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:210
void Save(XclExpStream &rStrm)
Definition: excrecds.cxx:553
void SaveXml(XclExpXmlStream &rStrm)
Definition: excrecds.cxx:588
std::size_t GetTextBytes() const
Definition: excrecds.cxx:541
bool IsEmpty() const
Definition: excrecds.hxx:349
void SetCondition(sal_uInt8 nTp, sal_uInt8 nOp, const OUString *pT)
Definition: excrecds.cxx:546
std::unique_ptr< XclExpString > pText
Definition: excrecds.hxx:342
void SaveText(XclExpStream &rStrm)
Definition: excrecds.cxx:598
virtual sal_uInt16 GetNum() const =0
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:108
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:93
virtual std::size_t GetLen() const =0
virtual void SaveCont(XclExpStream &rStrm)
Definition: excrecds.cxx:99
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record.
Definition: excrecds.cxx:103
SCTAB Tab() const
Definition: address.hxx:283
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1928
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:310
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4778
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:288
void PutInOrder()
Definition: address.hxx:622
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
sheet protection state container
bool isOptionEnabled(Option eOption) const
virtual css::uno::Sequence< sal_Int8 > getPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2=PASSHASH_UNSPECIFIED) const override
const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const
Stores individual user-defined sort list.
Definition: userlist.hxx:33
const OUString & GetString() const
Definition: userlist.hxx:54
Collection of user-defined sort lists.
Definition: userlist.hxx:67
size_t size() const
Definition: userlist.cxx:346
const Date & GetNullDate() const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:817
ExcFilterCondition aCond[2]
Definition: excrecds.hxx:375
bool HasCondition() const
Definition: excrecds.cxx:639
XclExpAutofilter(const XclExpRoot &rRoot, sal_uInt16 nC, bool bIsEmpty=false)
Definition: excrecds.cxx:608
void SetButtonHidden(bool bValue)
Definition: excrecds.hxx:393
std::vector< std::pair<::Color, bool > > maColorValues
Definition: excrecds.hxx:377
void AddColorEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:793
sal_uInt16 nFlags
Definition: excrecds.hxx:373
FilterType meType
Definition: excrecds.hxx:370
sal_uInt16 nCol
Definition: excrecds.hxx:371
std::vector< std::pair< OUString, bool > > maMultiValues
Definition: excrecds.hxx:376
bool AddCondition(ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp, const OUString *pText, bool bSimple=false)
Definition: excrecds.cxx:619
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:808
void AddMultiValueEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:780
sal_uInt16 GetCol() const
Definition: excrecds.hxx:387
bool AddEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:644
bool HasTop10() const
Definition: excrecds.hxx:388
XclExpAutofilterinfo(const ScAddress &rStartPos, SCCOL nScCol)
Definition: excrecds.cxx:525
Record which contains a Boolean value.
Definition: xerecord.hxx:255
bool GetBool() const
Returns the Boolean value of the record.
Definition: xerecord.hxx:263
sal_uInt16 mnUICountry
Definition: excrecds.hxx:285
sal_uInt16 mnDocCountry
The UI country ID.
Definition: excrecds.hxx:286
XclExpCountry(const XclExpRoot &rRoot)
Definition: excrecds.cxx:348
virtual void WriteBody(XclExpStream &rStrm) override
The document country ID.
Definition: excrecds.cxx:357
void AddColor(Color aColor)
Definition: xestyle.cxx:3189
A record without body.
Definition: xerecord.hxx:184
Sheet filter manager.
Definition: excrecds.hxx:436
bool HasFilterMode(SCTAB nScTab)
Returns whether or not FilterMode is present.
Definition: excrecds.cxx:1210
XclExpRecordRef CreateRecord(SCTAB nScTab)
Returns a record object containing all filter records for the specified sheet.
Definition: excrecds.cxx:1198
XclExpFilterManager(const XclExpRoot &rRoot)
Definition: excrecds.cxx:1188
void InitTabFilter(SCTAB nScTab)
Creates the filter records for the specified sheet.
Definition: excrecds.cxx:1193
XclExpTabFilterMap maFilterMap
Definition: excrecds.hxx:457
Manager that stores all internal defined names (NAME records) of the document.
Definition: xename.hxx:32
sal_uInt16 InsertBuiltInName(sal_Unicode cBuiltIn, const ScRange &rRange)
Inserts a new built-in defined name, referring to the passed sheet range.
Definition: xename.cxx:809
sal_uInt16 AddObj(std::unique_ptr< XclObj > pObjRec)
Definition: xeescher.cxx:2029
sal_uInt16 mnHash
Definition: excrecds.hxx:193
XclExpPassHash(const css::uno::Sequence< sal_Int8 > &aHash)
Definition: excrecds.cxx:500
virtual ~XclExpPassHash() override
Definition: excrecds.cxx:511
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:515
XclExpProtection(bool bValue)
Definition: excrecds.cxx:417
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xerecord.hxx:382
size_t GetSize() const
Definition: xerecord.hxx:327
bool IsEmpty() const
Definition: xerecord.hxx:326
void RemoveAllRecords()
Removes all records from the list.
Definition: xerecord.hxx:372
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:375
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:348
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:333
Base class for single records with any content.
Definition: xerecord.hxx:143
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
void SetRecHeader(sal_uInt16 nRecId, std::size_t nRecSize)
Sets record ID and size with one call.
Definition: xerecord.cxx:140
void AddRecSize(std::size_t nRecSize)
Adds a size value to the record size prediction.
Definition: xerecord.hxx:165
Access to global data from other classes.
Definition: xeroot.hxx:113
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:142
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xeroot.cxx:148
XclExpDxfs & GetDxfs() const
Returns the differential formatting list.
Definition: xeroot.cxx:160
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:76
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
XclExpSheetProtection(bool bValue, SCTAB nTab)
Definition: excrecds.cxx:422
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:428
This class is used to export Excel record streams.
Definition: xestream.hxx:73
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:48
OUString GetScTabName(SCTAB nScTab) const
Returns the Calc name of the specified sheet.
Definition: xelink.cxx:808
A record with a single value of type Type.
Definition: xerecord.hxx:199
const Type & GetValue() const
Returns the value of the record.
Definition: xerecord.hxx:208
void SetValue(const Type &rValue)
Sets a new record value.
Definition: xerecord.hxx:210
XclExpWindowProtection(bool bValue)
Definition: excrecds.cxx:405
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:410
XclExpWsbool(bool bFitToPages)
Definition: excrecds.cxx:364
XclExpFilterManager * mpManager
Definition: excrecds.hxx:313
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:374
XclExpXmlSheetPr(bool bFitToPages, SCTAB nScTab, const Color &rTabColor, XclExpFilterManager *pManager)
Definition: excrecds.cxx:371
LanguageType GetDocLanguage() const
Returns the document language.
Definition: xlroot.hxx:151
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:143
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:147
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
Definition: xlroot.cxx:323
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:286
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:712
static rtl::Reference< FastAttributeList > createAttrList()
const OUString & getString() const
bool isEmpty() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
const sal_uInt16 EXC_AFFLAG_AND
Definition: excdefs.hxx:28
const sal_uInt8 EXC_AFOPER_NOTEQUAL
Definition: excdefs.hxx:53
const sal_uInt16 EXC_AFFLAG_TOP10TOP
Definition: excdefs.hxx:34
const sal_uInt16 EXC_AFFLAG_TOP10
Definition: excdefs.hxx:33
const sal_uInt16 EXC_AFFLAG_SIMPLE2
Definition: excdefs.hxx:32
const sal_uInt16 EXC_AFFLAG_TOP10PERC
Definition: excdefs.hxx:35
const sal_uInt8 EXC_AFOPER_LESS
Definition: excdefs.hxx:49
const sal_uInt16 EXC_AFFLAG_OR
Definition: excdefs.hxx:29
const sal_uInt8 EXC_AFOPER_GREATEREQUAL
Definition: excdefs.hxx:54
const sal_uInt8 EXC_AFTYPE_STRING
Definition: excdefs.hxx:41
const sal_uInt8 EXC_AFOPER_NONE
Definition: excdefs.hxx:48
const sal_uInt16 EXC_AFFLAG_ANDORMASK
Definition: excdefs.hxx:30
const sal_uInt8 EXC_AFOPER_GREATER
Definition: excdefs.hxx:52
const sal_uInt8 EXC_AFOPER_LESSEQUAL
Definition: excdefs.hxx:51
const sal_uInt16 EXC_AFFLAG_SIMPLE1
Definition: excdefs.hxx:31
const sal_uInt8 EXC_AFOPER_EQUAL
Definition: excdefs.hxx:50
const sal_uInt8 EXC_AFTYPE_NOTEMPTY
Definition: excdefs.hxx:45
const sal_uInt8 EXC_AFTYPE_EMPTY
Definition: excdefs.hxx:44
const sal_uInt8 EXC_AFTYPE_NOTUSED
Definition: excdefs.hxx:38
static const char * lcl_GetOperator(sal_uInt8 nOper)
Definition: excrecds.cxx:565
static OString lcl_GetValue(sal_uInt8 nType, const XclExpString *pStr)
Definition: excrecds.cxx:580
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
ScQueryConnect
Definition: global.hxx:853
@ SC_OR
Definition: global.hxx:855
@ SC_DOES_NOT_CONTAIN
Definition: global.hxx:845
@ SC_LESS_EQUAL
Definition: global.hxx:837
@ SC_LESS
Definition: global.hxx:835
@ SC_GREATER_EQUAL
Definition: global.hxx:838
@ SC_CONTAINS
Definition: global.hxx:844
@ SC_TOPPERC
Definition: global.hxx:842
@ SC_ENDS_WITH
Definition: global.hxx:848
@ SC_DOES_NOT_END_WITH
Definition: global.hxx:849
@ SC_BEGINS_WITH
Definition: global.hxx:846
@ SC_TOPVAL
Definition: global.hxx:840
@ SC_GREATER
Definition: global.hxx:836
@ SC_EQUAL
Definition: global.hxx:834
@ SC_BOTPERC
Definition: global.hxx:843
@ SC_NOT_EQUAL
Definition: global.hxx:839
@ SC_DOES_NOT_BEGIN_WITH
Definition: global.hxx:847
@ SC_BOTVAL
Definition: global.hxx:841
char const sHash[]
const sal_uInt16 idx[]
sal_Int32 nIndex
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
aStr
std::unique_ptr< sal_Int32[]> pData
int i
void SvStream & rStrm
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
Empty
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
#define STREAM_SEEK_TO_END
XclExpRoot * pER
Definition: root.hxx:60
OOXML password definitions: algorithmName, hashValue, saltValue, spinCount.
OUString maSaltValue
base64 encoded hash value
OUString maHashValue
"SHA-512", ...
sal_uInt32 mnSpinCount
base64 encoded salt value
OUString maAlgorithmName
bool hasPassword() const
svl::SharedString maString
Definition: queryentry.hxx:49
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:34
SCCOLROW nField
Definition: queryentry.hxx:61
bool IsQueryByNonEmpty() const
Definition: queryentry.cxx:109
ScQueryConnect eConnect
Definition: queryentry.hxx:63
bool IsQueryByTextColor() const
Definition: queryentry.cxx:132
std::vector< Item > QueryItemsType
Definition: queryentry.hxx:58
bool IsQueryByEmpty() const
Definition: queryentry.cxx:87
ScQueryOp eOp
Definition: queryentry.hxx:62
bool IsQueryByBackgroundColor() const
Definition: queryentry.cxx:153
QueryItemsType & GetQueryItems()
Definition: queryentry.hxx:75
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:116
SC_DLLPUBLIC SCSIZE GetEntryCount() const
Definition: queryparam.cxx:111
::std::vector< ScSortKeyState > maKeyState
Definition: sortparam.hxx:121
bool bHasHeader
Definition: sortparam.hxx:111
sal_uInt16 nUserIndex
Definition: sortparam.hxx:110
@ PASSHASH_XL
unsigned char sal_uInt8
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
RedlineType meType
const sal_uInt16 EXC_ID_PROTECT
Definition: xlconst.hxx:170
const sal_uInt16 EXC_ID_AUTOFILTER
Definition: xlconst.hxx:206
const sal_uInt16 EXC_ID_AUTOFILTERINFO
Definition: xlconst.hxx:203
const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS
Definition: xlconst.hxx:188
const sal_uInt16 EXC_ID_COUNTRY
Definition: xlconst.hxx:194
const SCTAB SCTAB_GLOBAL
An invalid Calc sheet index, for common use.
Definition: xlconst.hxx:74
const sal_uInt16 EXC_ID_WINDOWPROTECT
Definition: xlconst.hxx:176
const sal_uInt16 EXC_ID_PASSWORD
Definition: xlconst.hxx:173
@ EXC_OUTPUT_BINARY
Definition: xlconst.hxx:42
const sal_uInt16 EXC_ID_FILTERMODE
Definition: xlconst.hxx:197
const sal_uInt16 EXC_WSBOOL_FITTOPAGE
Definition: xlconst.hxx:186
const sal_uInt16 EXC_ID_WSBOOL
Definition: xlconst.hxx:182
const sal_Unicode EXC_BUILTIN_EXTRACT
Definition: xlname.hxx:50
const sal_Unicode EXC_BUILTIN_FILTERDATABASE
Definition: xlname.hxx:60
const sal_Unicode EXC_BUILTIN_CRITERIA
Definition: xlname.hxx:52
@ EightBitLength
Always use UCS-2 characters (default: try to compress). BIFF8 only.