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/zforlist.hxx>
26 #include <sal/log.hxx>
27 
28 #include <string.h>
29 
30 #include <global.hxx>
31 #include <document.hxx>
32 #include <dbdata.hxx>
33 #include <oox/export/utils.hxx>
34 #include <oox/token/tokens.hxx>
35 #include <queryentry.hxx>
36 #include <queryparam.hxx>
37 #include <root.hxx>
38 
39 #include <xeescher.hxx>
40 #include <xelink.hxx>
41 #include <xename.hxx>
42 #include <xlname.hxx>
43 
44 #include <xcl97rec.hxx>
45 #include <tabprotection.hxx>
46 
47 using namespace ::oox;
48 
49 using ::com::sun::star::uno::Sequence;
50 
51 //--------------------------------------------------------- class ExcDummy_00 -
53  0x5c, 0x00, 0x20, 0x00, 0x04, 'C', 'a', 'l', 'c', // WRITEACCESS
54  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
55  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
56  0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
57 };
58 const std::size_t ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData );
59 
60 //-------------------------------------------------------- class ExcDummy_04x -
62  0x40, 0x00, 0x02, 0x00, 0x00, 0x00, // BACKUP
63  0x8d, 0x00, 0x02, 0x00, 0x00, 0x00, // HIDEOBJ
64 };
65 const std::size_t ExcDummy_040::nMyLen = sizeof( ExcDummy_040::pMyData );
66 
68  0x0e, 0x00, 0x02, 0x00, 0x01, 0x00, // PRECISION
69  0xda, 0x00, 0x02, 0x00, 0x00, 0x00 // BOOKBOOL
70 };
71 const std::size_t ExcDummy_041::nMyLen = sizeof( ExcDummy_041::pMyData );
72 
73 //-------------------------------------------------------- class ExcDummy_02a -
75  0x0d, 0x00, 0x02, 0x00, 0x01, 0x00, // CALCMODE
76  0x0c, 0x00, 0x02, 0x00, 0x64, 0x00, // CALCCOUNT
77  0x0f, 0x00, 0x02, 0x00, 0x01, 0x00, // REFMODE
78  0x11, 0x00, 0x02, 0x00, 0x00, 0x00, // ITERATION
79  0x10, 0x00, 0x08, 0x00, 0xfc, 0xa9, 0xf1, 0xd2, 0x4d, // DELTA
80  0x62, 0x50, 0x3f,
81  0x5f, 0x00, 0x02, 0x00, 0x01, 0x00 // SAVERECALC
82 };
83 const std::size_t ExcDummy_02a::nMyLen = sizeof( ExcDummy_02a::pMyData );
84 
85 //----------------------------------------------------------- class ExcRecord -
86 
88 {
89  SetRecHeader( GetNum(), GetLen() );
90  XclExpRecord::Save( rStrm );
91 }
92 
94 {
95 }
96 
98 {
99  SaveCont( rStrm );
100 }
101 
103 {
104 }
105 
106 //--------------------------------------------------------- class ExcEmptyRec -
107 
108 void ExcEmptyRec::Save( XclExpStream& /*rStrm*/ )
109 {
110 }
111 
112 sal_uInt16 ExcEmptyRec::GetNum() const
113 {
114  return 0;
115 }
116 
117 std::size_t ExcEmptyRec::GetLen() const
118 {
119  return 0;
120 }
121 
122 //--------------------------------------------------------- class ExcDummyRec -
123 
125 {
126  rStrm.Write( GetData(), GetLen() ); // raw write mode
127 }
128 
129 sal_uInt16 ExcDummyRec::GetNum() const
130 {
131  return 0x0000;
132 }
133 
134 //------------------------------------------------------- class ExcBoolRecord -
135 
137 {
138  rStrm << static_cast<sal_uInt16>(bVal ? 0x0001 : 0x0000);
139 }
140 
141 std::size_t ExcBoolRecord::GetLen() const
142 {
143  return 2;
144 }
145 
146 //--------------------------------------------------------- class ExcBof_Base -
147 
149  : nDocType(0)
150  , nVers(0)
151  , nRupBuild(0x096C) // copied from Excel
152  , nRupYear(0x07C9) // copied from Excel
153 {
154 }
155 
156 //-------------------------------------------------------------- class ExcBof -
157 
159 {
160  nDocType = 0x0010;
161  nVers = 0x0500;
162 }
163 
165 {
166  rStrm << nVers << nDocType << nRupBuild << nRupYear;
167 }
168 
169 sal_uInt16 ExcBof::GetNum() const
170 {
171  return 0x0809;
172 }
173 
174 std::size_t ExcBof::GetLen() const
175 {
176  return 8;
177 }
178 
179 //------------------------------------------------------------- class ExcBofW -
180 
182 {
183  nDocType = 0x0005;
184  nVers = 0x0500;
185 }
186 
188 {
189  rStrm << nVers << nDocType << nRupBuild << nRupYear;
190 }
191 
192 sal_uInt16 ExcBofW::GetNum() const
193 {
194  return 0x0809;
195 }
196 
197 std::size_t ExcBofW::GetLen() const
198 {
199  return 8;
200 }
201 
202 //-------------------------------------------------------------- class ExcEof -
203 
204 sal_uInt16 ExcEof::GetNum() const
205 {
206  return 0x000A;
207 }
208 
209 std::size_t ExcEof::GetLen() const
210 {
211  return 0;
212 }
213 
214 //--------------------------------------------------------- class ExcDummy_00 -
215 
216 std::size_t ExcDummy_00::GetLen() const
217 {
218  return nMyLen;
219 }
220 
222 {
223  return pMyData;
224 }
225 
226 //-------------------------------------------------------- class ExcDummy_04x -
227 
228 std::size_t ExcDummy_040::GetLen() const
229 {
230  return nMyLen;
231 }
232 
234 {
235  return pMyData;
236 }
237 
238 std::size_t ExcDummy_041::GetLen() const
239 {
240  return nMyLen;
241 }
242 
244 {
245  return pMyData;
246 }
247 
248 //------------------------------------------------------------- class Exc1904 -
249 
251 {
252  const Date& rDate = rDoc.GetFormatTable()->GetNullDate();
253  bVal = (rDate == Date( 1, 1, 1904 ));
254  bDateCompatibility = (rDate != Date( 30, 12, 1899 ));
255 }
256 
257 sal_uInt16 Exc1904::GetNum() const
258 {
259  return 0x0022;
260 }
261 
263 {
264  bool bISOIEC = ( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 );
265 
266  if( bISOIEC )
267  {
268  rStrm.WriteAttributes(XML_dateCompatibility, ToPsz(bDateCompatibility));
269  }
270 
271  if( !bISOIEC || bDateCompatibility )
272  {
273  rStrm.WriteAttributes(XML_date1904, ToPsz(bVal));
274  }
275 }
276 
277 //------------------------------------------------------ class ExcBundlesheet -
278 
280  m_nStrPos( STREAM_SEEK_TO_END ),
281  m_nOwnPos( STREAM_SEEK_TO_END ),
282  nGrbit( rRootData.pER->GetTabInfo().IsVisibleTab( nTabNum ) ? 0x0000 : 0x0001 ),
283  nTab( nTabNum )
284 {
285 }
286 
288  m_nStrPos( STREAM_SEEK_TO_END ),
289  m_nOwnPos( STREAM_SEEK_TO_END ),
290  nGrbit( 0x0000 ),
291  nTab( SCTAB_GLOBAL )
292 {
293 }
294 
296 {
297  rStrm.SetSvStreamPos( m_nOwnPos );
298  rStrm.DisableEncryption();
299  rStrm << static_cast<sal_uInt32>(m_nStrPos);
300  rStrm.EnableEncryption();
301 }
302 
303 sal_uInt16 ExcBundlesheetBase::GetNum() const
304 {
305  return 0x0085;
306 }
307 
308 ExcBundlesheet::ExcBundlesheet( const RootData& rRootData, SCTAB _nTab ) :
309  ExcBundlesheetBase( rRootData, _nTab )
310 {
311  OUString sTabName = rRootData.pER->GetTabInfo().GetScTabName( _nTab );
312  OSL_ENSURE( sTabName.getLength() < 256, "ExcBundlesheet::ExcBundlesheet - table name too long" );
313  aName = OUStringToOString(sTabName, rRootData.pER->GetTextEncoding());
314 }
315 
317 {
318  m_nOwnPos = rStrm.GetSvStreamPos();
319  rStrm << sal_uInt32(0x00000000) // dummy (stream position of the sheet)
320  << nGrbit;
321  rStrm.WriteByteString(aName); // 8 bit length, max 255 chars
322 }
323 
324 std::size_t ExcBundlesheet::GetLen() const
325 {
326  return 7 + std::min( aName.getLength(), sal_Int32(255) );
327 }
328 
329 //--------------------------------------------------------- class ExcDummy_02 -
330 
331 std::size_t ExcDummy_02a::GetLen() const
332 {
333  return nMyLen;
334 }
335 
337 {
338  return pMyData;
339 }
340 //--------------------------------------------------------- class ExcDummy_02 -
341 
344 {
345  /* #i31530# set document country as UI country too -
346  needed for correct behaviour of number formats. */
347  mnUICountry = mnDocCountry = static_cast< sal_uInt16 >(
348  ::msfilter::ConvertLanguageToCountry( rRoot.GetDocLanguage() ) );
349 }
350 
352 {
353  rStrm << mnUICountry << mnDocCountry;
354 }
355 
356 // XclExpWsbool ===============================================================
357 
358 XclExpWsbool::XclExpWsbool( bool bFitToPages )
360 {
361  if( bFitToPages )
363 }
364 
365 XclExpXmlSheetPr::XclExpXmlSheetPr( bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager ) :
366  mnScTab(nScTab), mpManager(pManager), mbFitToPage(bFitToPages), maTabColor(rTabColor) {}
367 
369 {
370  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
371  rWorksheet->startElement( XML_sheetPr,
372  // OOXTODO: XML_syncHorizontal,
373  // OOXTODO: XML_syncVertical,
374  // OOXTODO: XML_syncRef,
375  // OOXTODO: XML_transitionEvaluation,
376  // OOXTODO: XML_transitionEntry,
377  // OOXTODO: XML_published,
378  // OOXTODO: XML_codeName,
379  XML_filterMode, mpManager ? ToPsz(mpManager->HasFilterMode(mnScTab)) : nullptr
380  // OOXTODO: XML_enableFormatConditionsCalculation
381  );
382 
383  // Note : the order of child elements is significant. Don't change the order.
384 
385  // OOXTODO: XML_outlinePr
386 
387  if (maTabColor != COL_AUTO)
388  rWorksheet->singleElement(XML_tabColor, XML_rgb, XclXmlUtils::ToOString(maTabColor));
389 
390  rWorksheet->singleElement(XML_pageSetUpPr,
391  // OOXTODO: XML_autoPageBreaks,
392  XML_fitToPage, ToPsz(mbFitToPage));
393 
394  rWorksheet->endElement( XML_sheetPr );
395 }
396 
397 // XclExpWindowProtection ===============================================================
398 
401 {
402 }
403 
405 {
406  rStrm.WriteAttributes(XML_lockWindows, ToPsz(GetBool()));
407 }
408 
409 // XclExpDocProtection ===============================================================
410 
413 {
414 }
415 
417  XclExpProtection( bValue),
418  mnTab(nTab)
419 {
420 }
421 
423 {
424  ScDocument& rDoc = rStrm.GetRoot().GetDoc();
425  const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab);
426  if ( pTabProtect )
427  {
428  const ScOoxPasswordHash& rPH = pTabProtect->getPasswordHash();
429  // Do not write any hash attributes if there is no password.
430  ScOoxPasswordHash aPH;
431  if (rPH.hasPassword())
432  aPH = rPH;
433 
434  Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
435  OString sHash;
436  if (aHash.getLength() >= 2)
437  {
438  sHash = OString::number(
439  ( static_cast<sal_uInt8>(aHash[0]) << 8
440  | static_cast<sal_uInt8>(aHash[1]) ),
441  16 );
442  }
443  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
444  rWorksheet->singleElement( XML_sheetProtection,
445  XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : aPH.maAlgorithmName.toUtf8().getStr(),
446  XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : aPH.maHashValue.toUtf8().getStr(),
447  XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : aPH.maSaltValue.toUtf8().getStr(),
448  XML_spinCount, aPH.mnSpinCount ? OString::number( aPH.mnSpinCount).getStr() : nullptr,
449  XML_sheet, ToPsz( true ),
450  XML_password, sHash.isEmpty()? nullptr : sHash.getStr(),
451  XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? nullptr : ToPsz( true ),
452  XML_scenarios, pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ? nullptr : ToPsz( true ),
453  XML_formatCells, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_CELLS ) ? ToPsz( false ) : nullptr,
454  XML_formatColumns, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_COLUMNS ) ? ToPsz( false ) : nullptr,
455  XML_formatRows, pTabProtect->isOptionEnabled( ScTableProtection::FORMAT_ROWS ) ? ToPsz( false ) : nullptr,
456  XML_insertColumns, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_COLUMNS ) ? ToPsz( false ) : nullptr,
457  XML_insertRows, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_ROWS ) ? ToPsz( false ) : nullptr,
458  XML_insertHyperlinks, pTabProtect->isOptionEnabled( ScTableProtection::INSERT_HYPERLINKS ) ? ToPsz( false ) : nullptr,
459  XML_deleteColumns, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_COLUMNS ) ? ToPsz( false ) : nullptr,
460  XML_deleteRows, pTabProtect->isOptionEnabled( ScTableProtection::DELETE_ROWS ) ? ToPsz( false ) : nullptr,
461  XML_selectLockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ) ? nullptr : ToPsz( true ),
462  XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? ToPsz( false ) : nullptr,
463  XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? ToPsz( false ) : nullptr,
464  XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? ToPsz( false ) : nullptr,
465  XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ) );
466 
467  const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
468  if (!rProts.empty())
469  {
470  rWorksheet->startElement(XML_protectedRanges);
471  for (const auto& rProt : rProts)
472  {
473  SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(),
474  "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF security descriptor");
475  rWorksheet->singleElement( XML_protectedRange,
476  XML_name, rProt.maTitle.isEmpty() ? nullptr : rProt.maTitle.toUtf8().getStr(),
477  XML_securityDescriptor, rProt.maSecurityDescriptorXML.isEmpty() ? nullptr : rProt.maSecurityDescriptorXML.toUtf8().getStr(),
478  /* XXX 'password' is not part of OOXML, but Excel2013
479  * writes it if loaded from BIFF, in which case
480  * 'algorithmName', 'hashValue', 'saltValue' and
481  * 'spinCount' are absent; so do we if it was present. */
482  XML_password, rProt.mnPasswordVerifier ? OString::number( rProt.mnPasswordVerifier, 16).getStr() : nullptr,
483  XML_algorithmName, rProt.maPasswordHash.maAlgorithmName.isEmpty() ? nullptr : rProt.maPasswordHash.maAlgorithmName.toUtf8().getStr(),
484  XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
485  XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
486  XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
487  XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
488  }
489  rWorksheet->endElement( XML_protectedRanges);
490  }
491  }
492 }
493 
494 XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
496  mnHash(0x0000)
497 {
498  if (aHash.getLength() >= 2)
499  {
500  mnHash = ((aHash[0] << 8) & 0xFFFF);
501  mnHash |= (aHash[1] & 0xFF);
502  }
503 }
504 
506 {
507 }
508 
510 {
511  rStrm << mnHash;
512 }
513 
516 {
517 }
518 
520  XclExpUInt16Record( EXC_ID_AUTOFILTERINFO, static_cast< sal_uInt16 >( nScCol ) ),
521  maStartPos( rStartPos )
522 {
523 }
524 
527  nOper( EXC_AFOPER_EQUAL ),
528  fVal( 0.0 )
529 {
530 }
531 
533 {
534 }
535 
537 {
538  return pText ? (1 + pText->GetBufferSize()) : 0;
539 }
540 
541 void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, const OUString* pT )
542 {
543  nType = nTp;
544  nOper = nOp;
545  fVal = fV;
546  pText.reset( pT ? new XclExpString( *pT, XclStrFlags::EightBitLength ) : nullptr);
547 }
548 
550 {
551  rStrm << nType << nOper;
552  switch( nType )
553  {
554  case EXC_AFTYPE_DOUBLE:
555  rStrm << fVal;
556  break;
557  case EXC_AFTYPE_STRING:
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  break;
561  case EXC_AFTYPE_BOOLERR:
562  rStrm << sal_uInt8(0) << static_cast<sal_uInt8>((fVal != 0) ? 1 : 0) << sal_uInt32(0) << sal_uInt16(0);
563  break;
564  default:
565  rStrm << sal_uInt32(0) << sal_uInt32(0);
566  }
567 }
568 
569 static const char* lcl_GetOperator( sal_uInt8 nOper )
570 {
571  switch( nOper )
572  {
573  case EXC_AFOPER_EQUAL: return "equal";
574  case EXC_AFOPER_GREATER: return "greaterThan";
575  case EXC_AFOPER_GREATEREQUAL: return "greaterThanOrEqual";
576  case EXC_AFOPER_LESS: return "lessThan";
577  case EXC_AFOPER_LESSEQUAL: return "lessThanOrEqual";
578  case EXC_AFOPER_NOTEQUAL: return "notEqual";
579  case EXC_AFOPER_NONE:
580  default: return "**none**";
581  }
582 }
583 
584 static OString lcl_GetValue( sal_uInt8 nType, double fVal, const XclExpString* pStr )
585 {
586  switch( nType )
587  {
588  case EXC_AFTYPE_STRING: return XclXmlUtils::ToOString( *pStr );
589  case EXC_AFTYPE_DOUBLE: return OString::number( fVal );
590  case EXC_AFTYPE_BOOLERR: return OString::number( ( fVal != 0 ? 1 : 0 ) );
591  default: return OString();
592  }
593 }
594 
596 {
597  if( IsEmpty() )
598  return;
599 
600  rStrm.GetCurrentStream()->singleElement( XML_customFilter,
601  XML_operator, lcl_GetOperator( nOper ),
602  XML_val, lcl_GetValue(nType, fVal, pText.get()) );
603 }
604 
606 {
607  if( nType == EXC_AFTYPE_STRING )
608  {
609  OSL_ENSURE( pText, "ExcFilterCondition::SaveText() -- pText is NULL!" );
610  pText->WriteFlagField( rStrm );
611  pText->WriteBuffer( rStrm );
612  }
613 }
614 
615 XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC ) :
617  XclExpRoot( rRoot ),
618  meType(FilterCondition),
619  nCol( nC ),
620  nFlags( 0 )
621 {
622 }
623 
625  double fVal, const OUString* pText, bool bSimple )
626 {
627  if( !aCond[ 1 ].IsEmpty() )
628  return false;
629 
630  sal_uInt16 nInd = aCond[ 0 ].IsEmpty() ? 0 : 1;
631 
632  if( nInd == 1 )
633  nFlags |= (eConn == SC_OR) ? EXC_AFFLAG_OR : EXC_AFFLAG_AND;
634  if( bSimple )
635  nFlags |= (nInd == 0) ? EXC_AFFLAG_SIMPLE1 : EXC_AFFLAG_SIMPLE2;
636 
637  aCond[ nInd ].SetCondition( nType, nOp, fVal, pText );
638 
639  AddRecSize( aCond[ nInd ].GetTextBytes() );
640 
641  return true;
642 }
643 
645 {
646  return !aCond[0].IsEmpty();
647 }
648 
650 {
651  const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
652  if (rItems.empty())
653  return true;
654 
655  if (GetOutput() != EXC_OUTPUT_BINARY && rItems.size() > 1)
656  {
657  AddMultiValueEntry(rEntry);
658  return false;
659  }
660 
661  bool bConflict = false;
662  OUString sText;
663  const ScQueryEntry::Item& rItem = rItems[0];
664  if (!rItem.maString.isEmpty())
665  {
666  sText = rItem.maString.getString();
667  switch( rEntry.eOp )
668  {
669  case SC_CONTAINS:
670  case SC_DOES_NOT_CONTAIN:
671  {
672  sText = "*" + sText + "*";
673  }
674  break;
675  case SC_BEGINS_WITH:
677  sText += "*";
678  break;
679  case SC_ENDS_WITH:
681  sText = "*" + sText;
682  break;
683  default:
684  {
685  //nothing
686  }
687  }
688  }
689 
690  bool bLen = sText.getLength() > 0;
691 
692  // empty/nonempty fields
693  if (rEntry.IsQueryByEmpty())
694  bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_EMPTY, EXC_AFOPER_NONE, 0.0, nullptr, true );
695  else if(rEntry.IsQueryByNonEmpty())
696  bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, 0.0, nullptr, true );
697  // other conditions
698  else
699  {
700  double fVal = 0.0;
701  sal_uInt32 nIndex = 0;
702  bool bIsNum = !bLen || GetFormatter().IsNumberFormat( sText, nIndex, fVal );
703  OUString* pText = nullptr;
704  if (!bIsNum)
705  pText = &sText;
706 
707  // top10 flags
708  sal_uInt16 nNewFlags = 0x0000;
709  switch( rEntry.eOp )
710  {
711  case SC_TOPVAL:
712  nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10TOP);
713  break;
714  case SC_BOTVAL:
715  nNewFlags = EXC_AFFLAG_TOP10;
716  break;
717  case SC_TOPPERC:
719  break;
720  case SC_BOTPERC:
721  nNewFlags = (EXC_AFFLAG_TOP10 | EXC_AFFLAG_TOP10PERC);
722  break;
723  default:;
724  }
725  bool bNewTop10 = ::get_flag( nNewFlags, EXC_AFFLAG_TOP10 );
726 
727  bConflict = HasTop10() && bNewTop10;
728  if( !bConflict )
729  {
730  if( bNewTop10 )
731  {
732  if( fVal < 0 ) fVal = 0;
733  if( fVal >= 501 ) fVal = 500;
734  nFlags |= (nNewFlags | static_cast<sal_uInt16>(fVal) << 7);
735  }
736  // normal condition
737  else
738  {
740  sal_uInt8 nOper = EXC_AFOPER_NONE;
741 
742  switch( rEntry.eOp )
743  {
744  case SC_EQUAL: nOper = EXC_AFOPER_EQUAL; break;
745  case SC_LESS: nOper = EXC_AFOPER_LESS; break;
746  case SC_GREATER: nOper = EXC_AFOPER_GREATER; break;
747  case SC_LESS_EQUAL: nOper = EXC_AFOPER_LESSEQUAL; break;
748  case SC_GREATER_EQUAL: nOper = EXC_AFOPER_GREATEREQUAL; break;
749  case SC_NOT_EQUAL: nOper = EXC_AFOPER_NOTEQUAL; break;
750  case SC_CONTAINS:
751  case SC_BEGINS_WITH:
752  case SC_ENDS_WITH:
753  nOper = EXC_AFOPER_EQUAL; break;
754  case SC_DOES_NOT_CONTAIN:
757  nOper = EXC_AFOPER_NOTEQUAL; break;
758  default:;
759  }
760  bConflict = !AddCondition( rEntry.eConnect, nType, nOper, fVal, pText );
761  }
762  }
763  }
764  return bConflict;
765 }
766 
768 {
769  meType = MultiValue;
770  const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems();
771  for (const auto& rItem : rItems)
772  maMultiValues.push_back(rItem.maString.getString());
773 }
774 
776 {
777  rStrm << nCol << nFlags;
778  aCond[ 0 ].Save( rStrm );
779  aCond[ 1 ].Save( rStrm );
780  aCond[ 0 ].SaveText( rStrm );
781  aCond[ 1 ].SaveText( rStrm );
782 }
783 
785 {
786  if (meType == FilterCondition && !HasCondition())
787  return;
788 
789  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
790 
791  rWorksheet->startElement( XML_filterColumn,
792  XML_colId, OString::number(nCol)
793  // OOXTODO: XML_hiddenButton, AutoFilter12 fHideArrow?
794  // OOXTODO: XML_showButton
795  );
796 
797  switch (meType)
798  {
799  case FilterCondition:
800  {
801  if( HasTop10() )
802  {
803  rWorksheet->singleElement( XML_top10,
804  XML_top, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10TOP ) ),
805  XML_percent, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10PERC ) ),
806  XML_val, OString::number((nFlags >> 7))
807  // OOXTODO: XML_filterVal
808  );
809  }
810 
811  rWorksheet->startElement( XML_customFilters,
812  XML_and, ToPsz((nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND) );
813  aCond[ 0 ].SaveXml( rStrm );
814  aCond[ 1 ].SaveXml( rStrm );
815  rWorksheet->endElement( XML_customFilters );
816  // OOXTODO: XLM_colorFilter, XML_dynamicFilter,
817  // XML_extLst, XML_filters, XML_iconFilter, XML_top10
818  }
819  break;
820  case MultiValue:
821  {
822  rWorksheet->startElement(XML_filters);
823  for (const auto& rMultiValue : maMultiValues)
824  {
825  OString aStr = OUStringToOString(rMultiValue, RTL_TEXTENCODING_UTF8);
826  const char* pz = aStr.getStr();
827  rWorksheet->singleElement(XML_filter, XML_val, pz);
828  }
829  rWorksheet->endElement(XML_filters);
830  }
831  break;
832  }
833  rWorksheet->endElement( XML_filterColumn );
834 }
835 
836 ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) :
837  XclExpRoot( rRoot ),
838  mbAutoFilter (false)
839 {
840  XclExpNameManager& rNameMgr = GetNameManager();
841 
842  bool bFound = false;
843  bool bAdvanced = false;
844  const ScDBData* pData = (pDefinedData ? pDefinedData : rRoot.GetDoc().GetAnonymousDBData(nTab));
845  ScRange aAdvRange;
846  if (pData)
847  {
848  bAdvanced = pData->GetAdvancedQuerySource( aAdvRange );
849  bFound = (pData->HasQueryParam() || pData->HasAutoFilter() || bAdvanced);
850  }
851  if( bFound )
852  {
853  ScQueryParam aParam;
854  pData->GetQueryParam( aParam );
855 
856  ScRange aRange( aParam.nCol1, aParam.nRow1, aParam.nTab,
857  aParam.nCol2, aParam.nRow2, aParam.nTab );
858  SCCOL nColCnt = aParam.nCol2 - aParam.nCol1 + 1;
859 
860  maRef = aRange;
861 
862  // #i2394# built-in defined names must be sorted by containing sheet name
863  if (!pDefinedData)
864  rNameMgr.InsertBuiltInName( EXC_BUILTIN_FILTERDATABASE, aRange );
865 
866  // advanced filter
867  if( bAdvanced )
868  {
869  // filter criteria, excel allows only same table
870  if( !pDefinedData && aAdvRange.aStart.Tab() == nTab )
871  rNameMgr.InsertBuiltInName( EXC_BUILTIN_CRITERIA, aAdvRange );
872 
873  // filter destination range, excel allows only same table
874  if( !aParam.bInplace )
875  {
876  ScRange aDestRange( aParam.nDestCol, aParam.nDestRow, aParam.nDestTab );
877  aDestRange.aEnd.IncCol( nColCnt - 1 );
878  if( !pDefinedData && aDestRange.aStart.Tab() == nTab )
879  rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
880  }
881 
883  }
884  // AutoFilter
885  else
886  {
887  bool bConflict = false;
888  bool bContLoop = true;
889  bool bHasOr = false;
890  SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
891 
892  // create AUTOFILTER records for filtered columns
893  for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < aParam.GetEntryCount()); nEntry++ )
894  {
895  const ScQueryEntry& rEntry = aParam.GetEntry( nEntry );
896 
897  bContLoop = rEntry.bDoQuery;
898  if( bContLoop )
899  {
900  XclExpAutofilter* pFilter = GetByCol( static_cast<SCCOL>(rEntry.nField) - aRange.aStart.Col() );
901 
902  if( nEntry > 0 )
903  bHasOr |= (rEntry.eConnect == SC_OR);
904 
905  bConflict = (nEntry > 1) && bHasOr;
906  if( !bConflict )
907  bConflict = (nEntry == 1) && (rEntry.eConnect == SC_OR) &&
908  (nFirstField != rEntry.nField);
909  if( !bConflict )
910  bConflict = pFilter->AddEntry( rEntry );
911  }
912  }
913 
914  // additional tests for conflicts
915  for( size_t nPos = 0, nSize = maFilterList.GetSize(); !bConflict && (nPos < nSize); ++nPos )
916  {
918  bConflict = xFilter->HasCondition() && xFilter->HasTop10();
919  }
920 
921  if( bConflict )
923 
924  if( !maFilterList.IsEmpty() )
926  m_pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
927 
928  if (maFilterList.IsEmpty () && !bConflict)
929  mbAutoFilter = true;
930  }
931  }
932 }
933 
935 {
936 }
937 
939 {
940  XclExpAutofilterRef xFilter;
941  for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
942  {
943  xFilter = maFilterList.GetRecord( nPos );
944  if( xFilter->GetCol() == static_cast<sal_uInt16>(nCol) )
945  return xFilter.get();
946  }
947  xFilter = new XclExpAutofilter( GetRoot(), static_cast<sal_uInt16>(nCol) );
948  maFilterList.AppendRecord( xFilter );
949  return xFilter.get();
950 }
951 
953 {
954  for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos )
955  if( maFilterList.GetRecord( nPos )->GetCol() == static_cast<sal_uInt16>(nCol) )
956  return true;
957  return false;
958 }
959 
961 {
962  if( m_pFilterInfo )
963  {
964  ScAddress aAddr( m_pFilterInfo->GetStartPos() );
965  for( SCCOL nObj = 0, nCount = m_pFilterInfo->GetColCount(); nObj < nCount; nObj++ )
966  {
967  std::unique_ptr<XclObj> pObjRec(new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) ));
968  GetObjectManager().AddObj( std::move(pObjRec) );
969  aAddr.IncCol();
970  }
971  }
972 }
973 
975 {
976  if( m_pFilterMode )
977  m_pFilterMode->Save( rStrm );
978  if( m_pFilterInfo )
979  m_pFilterInfo->Save( rStrm );
980  maFilterList.Save( rStrm );
981 }
982 
984 {
985  if( maFilterList.IsEmpty() && !mbAutoFilter )
986  return;
987 
988  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
989  rWorksheet->startElement(XML_autoFilter, XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), maRef));
990  // OOXTODO: XML_extLst, XML_sortState
991  if( !maFilterList.IsEmpty() )
992  maFilterList.SaveXml( rStrm );
993  rWorksheet->endElement( XML_autoFilter );
994 }
995 
997 {
998  return m_pFilterMode != nullptr;
999 }
1000 
1002  XclExpRoot( rRoot )
1003 {
1004 }
1005 
1007 {
1008  maFilterMap[ nScTab ] = new ExcAutoFilterRecs( GetRoot(), nScTab, nullptr );
1009 }
1010 
1012 {
1013  XclExpTabFilterRef xRec;
1014  XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1015  if( aIt != maFilterMap.end() )
1016  {
1017  xRec = aIt->second;
1018  xRec->AddObjRecs();
1019  }
1020  return xRec;
1021 }
1022 
1024 {
1025  XclExpTabFilterMap::iterator aIt = maFilterMap.find( nScTab );
1026  if( aIt != maFilterMap.end() )
1027  {
1028  return aIt->second->HasFilterMode();
1029  }
1030  return false;
1031 }
1032 
1033 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetValue(const Type &rValue)
Sets a new record value.
Definition: xerecord.hxx:211
sal_uInt16 nRupBuild
Definition: excrecds.hxx:103
void WriteAttributes(sal_Int32 nAttribute, Str &&value, Args &&...rest)
Definition: xestream.hxx:299
XclExpWindowProtection(bool bValue)
Definition: excrecds.cxx:399
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:43
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:376
virtual void SaveCont(XclExpStream &rStrm)
Definition: excrecds.cxx:93
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:215
bool HasAutoFilter() const
Definition: dbdata.hxx:204
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:698
const sal_Unicode EXC_BUILTIN_CRITERIA
Definition: xlname.hxx:53
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:146
sal_Int32 nIndex
SC_DLLPUBLIC bool HasQueryParam() const
Definition: dbdata.cxx:510
bool AddEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:649
OUString getString() const
const sal_uInt8 EXC_AFOPER_GREATER
Definition: excdefs.hxx:52
ScAddress aStart
Definition: address.hxx:500
sal_uInt16 nGrbit
Definition: excrecds.hxx:240
bool IsFiltered(SCCOL nCol)
Definition: excrecds.cxx:952
ExcBof()
Definition: excrecds.cxx:158
LanguageType GetDocLanguage() const
Returns the document language.
Definition: xlroot.hxx:150
XclExpXmlSheetPr(bool bFitToPages, SCTAB nScTab, const Color &rTabColor, XclExpFilterManager *pManager)
Definition: excrecds.cxx:365
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:221
virtual const sal_uInt8 * GetData() const =0
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:203
const sal_Unicode EXC_BUILTIN_EXTRACT
Definition: xlname.hxx:51
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:290
const sal_uInt8 EXC_AFOPER_LESSEQUAL
Definition: excdefs.hxx:51
const sal_uInt16 EXC_ID_COUNTRY
Definition: xlconst.hxx:200
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:306
void InitTabFilter(SCTAB nScTab)
Creates the filter records for the specified sheet.
Definition: excrecds.cxx:1006
const sal_uInt8 EXC_AFTYPE_NOTEMPTY
Definition: excdefs.hxx:45
This class is used to export Excel record streams.
Definition: xestream.hxx:71
const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xerecord.hxx:383
std::unique_ptr< XclExpString > pText
Definition: excrecds.hxx:344
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:153
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:404
std::unique_ptr< ContentProperties > pData
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:983
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:169
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:349
sheet protection state container
XclExpWsbool(bool bFitToPages)
Definition: excrecds.cxx:358
const Type & GetValue() const
Returns the value of the record.
Definition: xerecord.hxx:209
bool AddCondition(ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp, double fVal, const OUString *pText, bool bSimple=false)
Definition: excrecds.cxx:624
OUString maSaltValue
base64 encoded hash value
static const std::size_t nMyLen
Definition: excrecds.hxx:204
OoxmlVersion getVersion() const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:102
QueryItemsType & GetQueryItems()
Definition: queryentry.hxx:65
OUString GetScTabName(SCTAB nScTab) const
Returns the Calc name of the specified sheet.
Definition: xelink.cxx:805
XclExpPassHash(const css::uno::Sequence< sal_Int8 > &aHash)
Definition: excrecds.cxx:494
#define STREAM_SEEK_TO_END
ExcFilterCondition aCond[2]
Definition: excrecds.hxx:368
const sal_uInt16 EXC_ID_FILTERMODE
Definition: xlconst.hxx:203
sal_uInt16 GetCol() const
Definition: excrecds.hxx:380
SCCOLROW nField
Definition: queryentry.hxx:51
const sal_uInt8 EXC_AFOPER_NOTEQUAL
Definition: excdefs.hxx:53
static const std::size_t nMyLen
Definition: excrecds.hxx:154
ScAddress aEnd
Definition: address.hxx:501
void SetCondition(sal_uInt8 nTp, sal_uInt8 nOp, double fV, const OUString *pT)
Definition: excrecds.cxx:541
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:213
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:336
const sal_uInt16 EXC_AFFLAG_TOP10TOP
Definition: excdefs.hxx:34
bool IsQueryByEmpty() const
Definition: queryentry.cxx:84
rtl::Reference< XclExpFiltermode > m_pFilterMode
Definition: excrecds.hxx:416
const sal_uInt16 EXC_AFFLAG_SIMPLE2
Definition: excdefs.hxx:32
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:187
const sal_uInt8 EXC_AFTYPE_DOUBLE
Definition: excdefs.hxx:40
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:278
SvNumberFormatter & GetFormatter() const
Returns the number formatter of the Calc document.
Definition: xlroot.cxx:315
sal_uInt16 nRupYear
Definition: excrecds.hxx:104
std::vector< OUString > maMultiValues
Definition: excrecds.hxx:369
const sal_uInt8 EXC_AFTYPE_STRING
Definition: excdefs.hxx:41
void AddMultiValueEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:767
char const sHash[]
void SaveXml(XclExpXmlStream &rStrm)
Definition: excrecds.cxx:595
OUString maHashValue
"SHA-512", ...
virtual ~ExcAutoFilterRecs() override
Definition: excrecds.cxx:934
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:775
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:272
static const std::size_t nMyLen
Definition: excrecds.hxx:273
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
Access to global data from other classes.
Definition: xeroot.hxx:113
virtual void Save(XclExpStream &rStrm) override
Overwrite this method to do any operation while saving the record.
Definition: excrecds.cxx:974
bool isOptionEnabled(Option eOption) const
static const char * lcl_GetOperator(sal_uInt8 nOper)
Definition: excrecds.cxx:569
OString aName
Definition: excrecds.hxx:257
void Save(XclExpStream &rStrm)
Definition: excrecds.cxx:549
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:45
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
sal_uInt16 nDocType
Definition: excrecds.hxx:101
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:262
OUString maAlgorithmName
XclExpAutofilter(const XclExpRoot &rRoot, sal_uInt16 nC)
Definition: excrecds.cxx:615
int nCount
SC_DLLPUBLIC SCSIZE GetEntryCount() const
Definition: queryparam.cxx:119
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:124
const sal_uInt8 EXC_AFOPER_EQUAL
Definition: excdefs.hxx:50
OOXML password definitions: algorithmName, hashValue, saltValue, spinCount.
XclExpAutofilterinfo(const ScAddress &rStartPos, SCCOL nScCol)
Definition: excrecds.cxx:519
SCTAB Tab() const
Definition: address.hxx:271
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:216
const sal_uInt16 EXC_AFFLAG_AND
Definition: excdefs.hxx:28
const sal_uInt16 EXC_AFFLAG_TOP10
Definition: excdefs.hxx:33
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:910
const SCTAB SCTAB_GLOBAL
An invalid Calc sheet index, for common use.
Definition: xlconst.hxx:75
XclExpTabFilterMap maFilterMap
Definition: excrecds.hxx:445
virtual std::size_t GetLen() const =0
bool HasFilterMode(SCTAB nScTab)
Returns whether or not FilterMode is present.
Definition: excrecds.cxx:1023
virtual ~XclExpPassHash() override
Definition: excrecds.cxx:505
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:238
bool bDateCompatibility
Definition: excrecds.hxx:230
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:192
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:243
const sal_uInt8 EXC_AFOPER_NONE
Definition: excdefs.hxx:48
const sal_uInt16 EXC_ID_AUTOFILTERINFO
Definition: xlconst.hxx:209
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:141
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:784
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:438
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:108
A record with a single value of type Type.
Definition: xerecord.hxx:199
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:142
XclExpProtection(bool bValue)
Definition: excrecds.cxx:411
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:316
sal_uInt64 GetSvStreamPos() const
Returns the absolute position of the system stream.
Definition: xestream.hxx:139
Exc1904(const ScDocument &rDoc)
Definition: excrecds.cxx:250
const sal_uInt16 EXC_ID_PROTECT
Definition: xlconst.hxx:176
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:136
virtual void WriteBody(XclExpStream &rStrm) override
The document country ID.
Definition: excrecds.cxx:351
sal_uInt16 nFlags
Definition: excrecds.hxx:367
bool isEmpty() const
bool IsQueryByNonEmpty() const
Definition: queryentry.cxx:106
Manager that stores all internal defined names (NAME records) of the document.
Definition: xename.hxx:32
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:304
sal_uInt16 nVers
Definition: excrecds.hxx:102
sal_Int16 SCCOL
Definition: types.hxx:22
bool HasCondition() const
Definition: excrecds.cxx:644
sal_uInt16 mnHash
Definition: excrecds.hxx:194
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:324
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
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:73
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record.
Definition: excrecds.cxx:97
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:141
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:75
std::shared_ptr< FastSerializerHelper > FSHelperPtr
void SaveText(XclExpStream &rStrm)
Definition: excrecds.cxx:605
const sal_uInt16 EXC_AFFLAG_ANDORMASK
Definition: excdefs.hxx:30
void WriteByteString(const OString &rString)
Writes string length field and OString buffer.
Definition: xestream.cxx:328
const sal_uInt16 EXC_ID_WINDOWPROTECT
Definition: xlconst.hxx:182
svl::SharedString maString
Definition: queryentry.hxx:41
bool HasFilterMode() const
Definition: excrecds.cxx:996
XclExpRoot * pER
Definition: root.hxx:66
bool GetBool() const
Returns the Boolean value of the record.
Definition: xerecord.hxx:264
const sal_uInt8 EXC_AFOPER_LESS
Definition: excdefs.hxx:49
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:422
sal_uInt64 m_nStrPos
Definition: excrecds.hxx:238
SCCOL Col() const
Definition: address.hxx:267
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:119
bool HasTop10() const
Definition: excrecds.hxx:381
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:807
void SetSvStreamPos(sal_uInt64 nPos)
Sets position of system stream (only allowed outside of records).
Definition: xestream.cxx:368
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:129
XclExpCountry(const XclExpRoot &rRoot)
Definition: excrecds.cxx:342
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:117
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:174
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:331
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:87
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:334
bool IsEmpty() const
Definition: excrecds.hxx:351
const sal_uInt16 EXC_ID_WSBOOL
Definition: xlconst.hxx:188
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:164
const sal_uInt16 EXC_AFFLAG_SIMPLE1
Definition: excdefs.hxx:31
void SetRecHeader(sal_uInt16 nRecId, std::size_t nRecSize)
Sets record ID and size with one call.
Definition: xerecord.cxx:140
static OString lcl_GetValue(sal_uInt8 nType, double fVal, const XclExpString *pStr)
Definition: excrecds.cxx:584
const sal_uInt16 EXC_AFFLAG_OR
Definition: excdefs.hxx:29
static const std::size_t nMyLen
Definition: excrecds.hxx:214
const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS
Definition: xlconst.hxx:194
void UpdateStreamPos(XclExpStream &rStrm)
Definition: excrecds.cxx:295
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:228
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:112
#define SAL_WARN_IF(condition, area, stream)
const sal_uInt8 EXC_AFTYPE_EMPTY
Definition: excdefs.hxx:44
unsigned char sal_uInt8
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:124
A record without body.
Definition: xerecord.hxx:184
bool hasPassword() const
void RemoveAllRecords()
Removes all records from the list.
Definition: xerecord.hxx:373
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:209
Sheet filter manager.
Definition: excrecds.hxx:423
Always use UCS-2 characters (default: try to compress). BIFF8 only.
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:197
XclExpAutofilterList maFilterList
Definition: excrecds.hxx:415
std::size_t GetTextBytes() const
Definition: excrecds.cxx:536
const sal_uInt8 EXC_AFTYPE_BOOLERR
Definition: excdefs.hxx:42
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xeroot.cxx:147
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:509
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
Definition: dbdata.cxx:410
XclExpFilterManager(const XclExpRoot &rRoot)
Definition: excrecds.cxx:1001
void DisableEncryption()
Definition: xestream.cxx:363
ScQueryConnect eConnect
Definition: queryentry.hxx:53
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:303
size_t GetSize() const
Definition: xerecord.hxx:328
SC_DLLPUBLIC ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1880
const sal_uInt16 EXC_ID_AUTOFILTER
Definition: xlconst.hxx:212
ExcBundlesheet(const RootData &rRootData, SCTAB nTab)
Definition: excrecds.cxx:308
const sal_uInt8 EXC_AFOPER_GREATEREQUAL
Definition: excdefs.hxx:54
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:368
std::vector< Item > QueryItemsType
Definition: queryentry.hxx:48
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:233
XclExpRecordRef CreateRecord(SCTAB nScTab)
Returns a record object containing all filter records for the specified sheet.
Definition: excrecds.cxx:1011
SC_DLLPUBLIC bool GetAdvancedQuerySource(ScRange &rSource) const
Definition: dbdata.cxx:443
void EnableEncryption(bool bEnable=true)
Definition: xestream.cxx:358
XclExpAutofilter * GetByCol(SCCOL nCol)
Definition: excrecds.cxx:938
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:204
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:257
XclExpSheetProtection(bool bValue, SCTAB nTab)
Definition: excrecds.cxx:416
sal_uInt32 mnSpinCount
base64 encoded salt value
sal_uInt16 mnUICountry
Definition: excrecds.hxx:286
const Date & GetNullDate() const
sal_uInt16 mnDocCountry
The UI country ID.
Definition: excrecds.hxx:287
bool IsEmpty() const
Definition: xerecord.hxx:327
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
ScQueryOp eOp
Definition: queryentry.hxx:52
const sal_uInt16 EXC_WSBOOL_FITTOPAGE
Definition: xlconst.hxx:192
const sal_uInt16 EXC_ID_PASSWORD
Definition: xlconst.hxx:179
RedlineType meType
ExcAutoFilterRecs(const XclExpRoot &rRoot, SCTAB nTab, const ScDBData *pDefinedData)
Definition: excrecds.cxx:836
FilterType meType
Definition: excrecds.hxx:365
aStr
sal_uInt64 m_nOwnPos
Definition: excrecds.hxx:239
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
virtual sal_uInt16 GetNum() const =0
sal_uInt16 AddObj(std::unique_ptr< XclObj > pObjRec)
Definition: xeescher.cxx:1843
const sal_Unicode EXC_BUILTIN_FILTERDATABASE
Definition: xlname.hxx:61
Base class for single records with any content.
Definition: xerecord.hxx:143
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
Record which contains a Boolean value.
Definition: xerecord.hxx:255
rtl::Reference< XclExpAutofilterinfo > m_pFilterInfo
Definition: excrecds.hxx:417
sal_uInt16 nCol
Definition: excrecds.hxx:366
virtual css::uno::Sequence< sal_Int8 > getPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2=PASSHASH_UNSPECIFIED) const override
ScQueryConnect
Definition: global.hxx:842
void AddRecSize(std::size_t nRecSize)
Adds a size value to the record size prediction.
Definition: xerecord.hxx:166
const sal_uInt8 EXC_AFTYPE_NOTUSED
Definition: excdefs.hxx:38
XclExpFilterManager * mpManager
Definition: excrecds.hxx:314
const sal_uInt16 EXC_AFFLAG_TOP10PERC
Definition: excdefs.hxx:35