LibreOffice Module sc (master)  1
xecontent.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 <memory>
21 #include <xecontent.hxx>
22 
23 #include <vector>
24 #include <algorithm>
25 #include <string_view>
26 
27 #include <com/sun/star/frame/XModel.hpp>
28 #include <com/sun/star/sheet/XAreaLinks.hpp>
29 #include <com/sun/star/sheet/XAreaLink.hpp>
30 #include <com/sun/star/sheet/TableValidationVisibility.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <sfx2/objsh.hxx>
33 #include <tools/urlobj.hxx>
34 #include <formula/grammar.hxx>
35 #include <scitems.hxx>
36 #include <editeng/flditem.hxx>
37 #include <document.hxx>
38 #include <validat.hxx>
39 #include <unonames.hxx>
40 #include <convuno.hxx>
41 #include <rangenam.hxx>
42 #include <tokenarray.hxx>
43 #include <stlpool.hxx>
44 #include <patattr.hxx>
45 #include <fapihelper.hxx>
46 #include <xehelper.hxx>
47 #include <xestyle.hxx>
48 #include <xename.hxx>
49 #include <xlcontent.hxx>
50 #include <xltools.hxx>
51 #include <xeformula.hxx>
52 #include <rtl/uuid.h>
53 #include <sal/log.hxx>
54 #include <oox/export/utils.hxx>
55 #include <oox/token/namespaces.hxx>
57 #include <comphelper/string.hxx>
58 
59 using namespace ::oox;
60 
61 using ::com::sun::star::uno::Reference;
62 using ::com::sun::star::uno::UNO_QUERY;
63 using ::com::sun::star::table::CellRangeAddress;
64 using ::com::sun::star::sheet::XAreaLinks;
65 using ::com::sun::star::sheet::XAreaLink;
66 
67 // Shared string table ========================================================
68 
69 namespace {
70 
72 struct XclExpHashEntry
73 {
74  const XclExpString* mpString;
75  sal_uInt32 mnSstIndex;
76  explicit XclExpHashEntry( const XclExpString* pString, sal_uInt32 nSstIndex ) :
77  mpString( pString ), mnSstIndex( nSstIndex ) {}
78 };
79 
81 struct XclExpHashEntrySWO
82 {
83  bool operator()( const XclExpHashEntry& rLeft, const XclExpHashEntry& rRight ) const
84  { return *rLeft.mpString < *rRight.mpString; }
85 };
86 
87 }
88 
93 {
94 public:
95  explicit XclExpSstImpl();
96 
98  sal_uInt32 Insert( XclExpStringRef xString );
99 
101  void Save( XclExpStream& rStrm );
102  void SaveXml( XclExpXmlStream& rStrm );
103 
104 private:
105  typedef ::std::vector< XclExpHashEntry > XclExpHashVec;
106 
107  std::vector< XclExpStringRef > maStringVector;
108  std::vector< XclExpHashVec >
110  sal_uInt32 mnTotal;
111  sal_uInt32 mnSize;
112 };
113 
114 const sal_uInt32 EXC_SST_HASHTABLE_SIZE = 2048;
115 
117  maHashTab( EXC_SST_HASHTABLE_SIZE ),
118  mnTotal( 0 ),
119  mnSize( 0 )
120 {
121 }
122 
124 {
125  OSL_ENSURE( xString, "XclExpSstImpl::Insert - empty pointer not allowed" );
126  if( !xString )
127  xString.reset( new XclExpString );
128 
129  ++mnTotal;
130  sal_uInt32 nSstIndex = 0;
131 
132  // calculate hash value in range [0,EXC_SST_HASHTABLE_SIZE)
133  sal_uInt16 nHash = xString->GetHash();
134  nHash = (nHash ^ (nHash / EXC_SST_HASHTABLE_SIZE)) % EXC_SST_HASHTABLE_SIZE;
135 
136  XclExpHashVec& rVec = maHashTab[ nHash ];
137  XclExpHashEntry aEntry( xString.get(), mnSize );
138  XclExpHashVec::iterator aIt = ::std::lower_bound( rVec.begin(), rVec.end(), aEntry, XclExpHashEntrySWO() );
139  if( (aIt == rVec.end()) || (*aIt->mpString != *xString) )
140  {
141  nSstIndex = mnSize;
142  maStringVector.push_back( xString );
143  rVec.insert( aIt, aEntry );
144  ++mnSize;
145  }
146  else
147  {
148  nSstIndex = aIt->mnSstIndex;
149  }
150 
151  return nSstIndex;
152 }
153 
155 {
156  if( maStringVector.empty() )
157  return;
158 
159  SvMemoryStream aExtSst( 8192 );
160 
161  sal_uInt32 nBucket = mnSize;
162  while( nBucket > 0x0100 )
163  nBucket /= 2;
164 
165  sal_uInt16 nPerBucket = llimit_cast< sal_uInt16 >( nBucket, 8 );
166  sal_uInt16 nBucketIndex = 0;
167 
168  // *** write the SST record ***
169 
170  rStrm.StartRecord( EXC_ID_SST, 8 );
171 
172  rStrm << mnTotal << mnSize;
173  for (auto const& elem : maStringVector)
174  {
175  if( !nBucketIndex )
176  {
177  // write bucket info before string to get correct record position
178  sal_uInt32 nStrmPos = static_cast< sal_uInt32 >( rStrm.GetSvStreamPos() );
179  sal_uInt16 nRecPos = rStrm.GetRawRecPos() + 4;
180  aExtSst.WriteUInt32( nStrmPos ) // stream position
181  .WriteUInt16( nRecPos ) // position from start of SST or CONTINUE
182  .WriteUInt16( 0 ); // reserved
183  }
184 
185  rStrm << *elem;
186 
187  if( ++nBucketIndex == nPerBucket )
188  nBucketIndex = 0;
189  }
190 
191  rStrm.EndRecord();
192 
193  // *** write the EXTSST record ***
194 
195  rStrm.StartRecord( EXC_ID_EXTSST, 0 );
196 
197  rStrm << nPerBucket;
198  rStrm.SetSliceSize( 8 ); // size of one bucket info
199  aExtSst.Seek( STREAM_SEEK_TO_BEGIN );
200  rStrm.CopyFromStream( aExtSst );
201 
202  rStrm.EndRecord();
203 }
204 
206 {
207  if( maStringVector.empty() )
208  return;
209 
211  "xl/sharedStrings.xml",
212  u"sharedStrings.xml",
213  rStrm.GetCurrentStream()->getOutputStream(),
214  "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
215  oox::getRelationship(Relationship::SHAREDSTRINGS));
216  rStrm.PushStream( pSst );
217 
218  pSst->startElement( XML_sst,
219  XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
220  XML_count, OString::number(mnTotal),
221  XML_uniqueCount, OString::number(mnSize) );
222 
223  for (auto const& elem : maStringVector)
224  {
225  pSst->startElement(XML_si);
226  elem->WriteXml( rStrm );
227  pSst->endElement( XML_si );
228  }
229 
230  pSst->endElement( XML_sst );
231 
232  rStrm.PopStream();
233 }
234 
236  mxImpl( new XclExpSstImpl )
237 {
238 }
239 
241 {
242 }
243 
244 sal_uInt32 XclExpSst::Insert( const XclExpStringRef& xString )
245 {
246  return mxImpl->Insert( xString );
247 }
248 
250 {
251  mxImpl->Save( rStrm );
252 }
253 
255 {
256  mxImpl->SaveXml( rStrm );
257 }
258 
259 // Merged cells ===============================================================
260 
262  XclExpRoot( rRoot )
263 {
264 }
265 
266 void XclExpMergedcells::AppendRange( const ScRange& rRange, sal_uInt32 nBaseXFId )
267 {
268  if( GetBiff() == EXC_BIFF8 )
269  {
270  maMergedRanges.push_back( rRange );
271  maBaseXFIds.push_back( nBaseXFId );
272  }
273 }
274 
275 sal_uInt32 XclExpMergedcells::GetBaseXFId( const ScAddress& rPos ) const
276 {
277  OSL_ENSURE( maBaseXFIds.size() == maMergedRanges.size(), "XclExpMergedcells::GetBaseXFId - invalid lists" );
278  ScfUInt32Vec::const_iterator aIt = maBaseXFIds.begin();
279  ScRangeList& rNCRanges = const_cast< ScRangeList& >( maMergedRanges );
280  for ( size_t i = 0, nRanges = rNCRanges.size(); i < nRanges; ++i, ++aIt )
281  {
282  const ScRange & rScRange = rNCRanges[ i ];
283  if( rScRange.In( rPos ) )
284  return *aIt;
285  }
286  return EXC_XFID_NOTFOUND;
287 }
288 
290 {
291  if( GetBiff() != EXC_BIFF8 )
292  return;
293 
294  XclRangeList aXclRanges;
295  GetAddressConverter().ConvertRangeList( aXclRanges, maMergedRanges, true );
296  size_t nFirstRange = 0;
297  size_t nRemainingRanges = aXclRanges.size();
298  while( nRemainingRanges > 0 )
299  {
300  size_t nRangeCount = ::std::min< size_t >( nRemainingRanges, EXC_MERGEDCELLS_MAXCOUNT );
301  rStrm.StartRecord( EXC_ID_MERGEDCELLS, 2 + 8 * nRangeCount );
302  aXclRanges.WriteSubList( rStrm, nFirstRange, nRangeCount );
303  rStrm.EndRecord();
304  nFirstRange += nRangeCount;
305  nRemainingRanges -= nRangeCount;
306  }
307 }
308 
310 {
311  size_t nCount = maMergedRanges.size();
312  if( !nCount )
313  return;
314  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
315  rWorksheet->startElement(XML_mergeCells, XML_count, OString::number(nCount));
316  for( size_t i = 0; i < nCount; ++i )
317  {
318  const ScRange & rRange = maMergedRanges[ i ];
319  rWorksheet->singleElement(XML_mergeCell, XML_ref,
320  XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), rRange));
321  }
322  rWorksheet->endElement( XML_mergeCells );
323 }
324 
325 // Hyperlinks =================================================================
326 
327 XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rUrlField, const ScAddress& rScPos ) :
329  maScPos( rScPos ),
330  mxVarData( new SvMemoryStream ),
331  mnFlags( 0 )
332 {
333  const OUString& rUrl = rUrlField.GetURL();
334  const OUString& rRepr = rUrlField.GetRepresentation();
335  INetURLObject aUrlObj( rUrl );
336  const INetProtocol eProtocol = aUrlObj.GetProtocol();
337  bool bWithRepr = !rRepr.isEmpty();
338  XclExpStream aXclStrm( *mxVarData, rRoot ); // using in raw write mode.
339 
340  // description
341  if( bWithRepr )
342  {
343  XclExpString aDescr( rRepr, XclStrFlags::ForceUnicode, 255 );
344  aXclStrm << sal_uInt32( aDescr.Len() + 1 ); // string length + 1 trailing zero word
345  aDescr.WriteBuffer( aXclStrm ); // NO flags
346  aXclStrm << sal_uInt16( 0 );
347 
349  m_Repr = rRepr;
350  }
351 
352  // file link or URL
353  if( eProtocol == INetProtocol::File || eProtocol == INetProtocol::Smb )
354  {
355  sal_uInt16 nLevel;
356  bool bRel;
357  OUString aFileName(
358  BuildFileName(nLevel, bRel, rUrl, rRoot, rRoot.GetOutput() == EXC_OUTPUT_XML_2007));
359 
360  if( eProtocol == INetProtocol::Smb )
361  {
362  // #n382718# (and #n261623#) Convert smb notation to '\\'
363  aFileName = aUrlObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
364  aFileName = aFileName.copy(4); // skip the 'smb:' part
365  aFileName = aFileName.replace('/', '\\');
366  }
367 
368  if( !bRel )
371 
372  OString aAsciiLink(OUStringToOString(aFileName,
373  rRoot.GetTextEncoding()));
374  XclExpString aLink( aFileName, XclStrFlags::ForceUnicode, 255 );
375  aXclStrm << XclTools::maGuidFileMoniker
376  << nLevel
377  << sal_uInt32( aAsciiLink.getLength() + 1 ); // string length + 1 trailing zero byte
378  aXclStrm.Write( aAsciiLink.getStr(), aAsciiLink.getLength() );
379  aXclStrm << sal_uInt8( 0 )
380  << sal_uInt32( 0xDEADFFFF );
381  aXclStrm.WriteZeroBytes( 20 );
382  aXclStrm << sal_uInt32( aLink.GetBufferSize() + 6 )
383  << sal_uInt32( aLink.GetBufferSize() ) // byte count, not string length
384  << sal_uInt16( 0x0003 );
385  aLink.WriteBuffer( aXclStrm ); // NO flags
386 
387  if (m_Repr.isEmpty())
388  m_Repr = aFileName;
389 
391 
392  if( bRel )
393  {
394  for( int i = 0; i < nLevel; ++i )
395  msTarget = "../" + msTarget;
396  }
397  else if (rRoot.GetOutput() != EXC_OUTPUT_XML_2007)
398  {
399  // xls expects the file:/// part appended ( or at least
400  // ms2007 does, ms2010 is more tolerant )
401  msTarget = "file:///" + msTarget;
402  }
403  }
404  else if( eProtocol != INetProtocol::NotValid )
405  {
406  XclExpString aUrl( aUrlObj.GetURLNoMark(), XclStrFlags::ForceUnicode, 255 );
407  aXclStrm << XclTools::maGuidUrlMoniker
408  << sal_uInt32( aUrl.GetBufferSize() + 2 ); // byte count + 1 trailing zero word
409  aUrl.WriteBuffer( aXclStrm ); // NO flags
410  aXclStrm << sal_uInt16( 0 );
411 
413  if (m_Repr.isEmpty())
414  m_Repr = rUrl;
415 
417  }
418  else if( !rUrl.isEmpty() && rUrl[0] == '#' ) // hack for #89066#
419  {
420  OUString aTextMark( rUrl.copy( 1 ) );
421 
422  sal_Int32 nSepPos = aTextMark.lastIndexOf( '!' );
423  sal_Int32 nPointPos = aTextMark.lastIndexOf( '.' );
424  // last dot is the separator, if there is no ! after it
425  if(nSepPos < nPointPos)
426  {
427  nSepPos = nPointPos;
428  aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
429  }
430 
431  if (nSepPos != -1)
432  {
433  OUString aSheetName(aTextMark.copy(0, nSepPos));
434 
435  if (aSheetName.indexOf(' ') != -1 && aSheetName[0] != '\'')
436  {
437  aTextMark = "'" + aTextMark.replaceAt(nSepPos, 0, "'");
438  }
439  }
440  else
441  aTextMark += "!A1"; // tdf#143220 link to sheet not valid without cell reference
442 
443  mxTextMark.reset( new XclExpString( aTextMark, XclStrFlags::ForceUnicode, 255 ) );
444  }
445 
446  // text mark
447  if( !mxTextMark && aUrlObj.HasMark() )
448  mxTextMark.reset( new XclExpString( aUrlObj.GetMark(), XclStrFlags::ForceUnicode, 255 ) );
449 
450  if( mxTextMark )
451  {
452  aXclStrm << sal_uInt32( mxTextMark->Len() + 1 ); // string length + 1 trailing zero word
453  mxTextMark->WriteBuffer( aXclStrm ); // NO flags
454  aXclStrm << sal_uInt16( 0 );
455 
457 
458  OUString location = XclXmlUtils::ToOUString(*mxTextMark);
459  if (!location.isEmpty() && msTarget.endsWith(OUStringConcatenation("#" + location)))
460  msTarget = msTarget.copy(0, msTarget.getLength() - location.getLength() - 1);
461  }
462 
463  SetRecSize( 32 + mxVarData->Tell() );
464 }
465 
467 {
468 }
469 
471  sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded )
472 {
473  INetURLObject aURLObject( rUrl );
474  OUString aDosName(bEncoded ? aURLObject.GetMainURL(INetURLObject::DecodeMechanism::ToIUri)
475  : aURLObject.getFSysPath(FSysStyle::Dos));
476  rnLevel = 0;
477  rbRel = rRoot.IsRelUrl();
478 
479  if( rbRel )
480  {
481  // try to convert to relative file name
482  OUString aTmpName( aDosName );
483  aDosName = INetURLObject::GetRelURL( rRoot.GetBasePath(), rUrl,
486 
487  if (aDosName.startsWith(INET_FILE_SCHEME))
488  {
489  // not converted to rel -> back to old, return absolute flag
490  aDosName = aTmpName;
491  rbRel = false;
492  }
493  else if (aDosName.startsWith("./"))
494  {
495  aDosName = aDosName.copy(2);
496  }
497  else
498  {
499  while (aDosName.startsWith("../"))
500  {
501  aDosName = aDosName.copy(3);
502  ++rnLevel;
503  }
504  }
505  }
506  return aDosName;
507 }
508 
510 {
511  sal_uInt16 nXclCol = static_cast< sal_uInt16 >( maScPos.Col() );
512  sal_uInt16 nXclRow = static_cast< sal_uInt16 >( maScPos.Row() );
513  rStrm << nXclRow << nXclRow << nXclCol << nXclCol;
514  WriteEmbeddedData( rStrm );
515 }
516 
518 {
519  rStrm << XclTools::maGuidStdLink
520  << sal_uInt32( 2 )
521  << mnFlags;
522 
524  rStrm.CopyFromStream( *mxVarData );
525 }
526 
528 {
529  OUString sId = !msTarget.isEmpty() ? rStrm.addRelation( rStrm.GetCurrentStream()->getOutputStream(),
530  oox::getRelationship(Relationship::HYPERLINK),
531  msTarget, true ) : OUString();
532  std::optional<OString> sTextMark;
533  if (mxTextMark)
534  sTextMark = XclXmlUtils::ToOString(*mxTextMark);
535  rStrm.GetCurrentStream()->singleElement( XML_hyperlink,
536  XML_ref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), maScPos),
537  FSNS( XML_r, XML_id ), sax_fastparser::UseIf(sId, !sId.isEmpty()),
538  XML_location, sTextMark,
539  // OOXTODO: XML_tooltip, from record HLinkTooltip 800h wzTooltip
540  XML_display, m_Repr );
541 }
542 
543 // Label ranges ===============================================================
544 
546  XclExpRoot( rRoot )
547 {
548  SCTAB nScTab = GetCurrScTab();
549  // row label ranges
550  FillRangeList( maRowRanges, rRoot.GetDoc().GetRowNameRangesRef(), nScTab );
551  // row labels only over 1 column (restriction of Excel97/2000/XP)
552  for ( size_t i = 0, nRanges = maRowRanges.size(); i < nRanges; ++i )
553  {
554  ScRange & rScRange = maRowRanges[ i ];
555  if( rScRange.aStart.Col() != rScRange.aEnd.Col() )
556  rScRange.aEnd.SetCol( rScRange.aStart.Col() );
557  }
558  // col label ranges
559  FillRangeList( maColRanges, rRoot.GetDoc().GetColNameRangesRef(), nScTab );
560 }
561 
563  const ScRangePairListRef& xLabelRangesRef, SCTAB nScTab )
564 {
565  for ( size_t i = 0, nPairs = xLabelRangesRef->size(); i < nPairs; ++i )
566  {
567  const ScRangePair & rRangePair = (*xLabelRangesRef)[i];
568  const ScRange& rScRange = rRangePair.GetRange( 0 );
569  if( rScRange.aStart.Tab() == nScTab )
570  rScRanges.push_back( rScRange );
571  }
572 }
573 
575 {
577  XclRangeList aRowXclRanges, aColXclRanges;
578  rAddrConv.ConvertRangeList( aRowXclRanges, maRowRanges, false );
579  rAddrConv.ConvertRangeList( aColXclRanges, maColRanges, false );
580  if( !aRowXclRanges.empty() || !aColXclRanges.empty() )
581  {
582  rStrm.StartRecord( EXC_ID_LABELRANGES, 4 + 8 * (aRowXclRanges.size() + aColXclRanges.size()) );
583  rStrm << aRowXclRanges << aColXclRanges;
584  rStrm.EndRecord();
585  }
586 }
587 
588 // Conditional formatting ====================================================
589 
591 class XclExpCFImpl : protected XclExpRoot
592 {
593 public:
594  explicit XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin );
595 
597  void WriteBody( XclExpStream& rStrm );
598  void SaveXml( XclExpXmlStream& rStrm );
599 
600 private:
608  sal_uInt32 mnFontColorId;
611  sal_Int32 mnPriority;
612  bool mbFontUsed;
615  bool mbColorUsed;
620  bool mbPattUsed;
622 };
623 
624 XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin ) :
625  XclExpRoot( rRoot ),
626  mrFormatEntry( rFormatEntry ),
627  maOrigin( aOrigin ),
628  mnFontColorId( 0 ),
630  mnOperator( EXC_CF_CMP_NONE ),
631  mnPriority( nPriority ),
632  mbFontUsed( false ),
633  mbHeightUsed( false ),
634  mbWeightUsed( false ),
635  mbColorUsed( false ),
636  mbUnderlUsed( false ),
637  mbItalicUsed( false ),
638  mbStrikeUsed( false ),
639  mbBorderUsed( false ),
640  mbPattUsed( false ),
641  mbFormula2(false)
642 {
643  // Set correct tab for maOrigin from GetValidSrcPos() of the format-entry.
644  ScAddress aValidSrcPos = mrFormatEntry.GetValidSrcPos();
645  maOrigin.SetTab(aValidSrcPos.Tab());
646 
647  /* Get formatting attributes here, and not in WriteBody(). This is needed to
648  correctly insert all colors into the palette. */
649 
650  if( SfxStyleSheetBase* pStyleSheet = GetDoc().GetStyleSheetPool()->Find( mrFormatEntry.GetStyle(), SfxStyleFamily::Para ) )
651  {
652  const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
653 
654  // font
657  mbColorUsed = ScfTools::CheckItem( rItemSet, ATTR_FONT_COLOR, true );
662  if( mbFontUsed )
663  {
664  vcl::Font aFont;
665  ScPatternAttr::GetFont( aFont, rItemSet, SC_AUTOCOL_RAW );
666  maFontData.FillFromVclFont( aFont );
668  }
669 
670  // border
671  mbBorderUsed = ScfTools::CheckItem( rItemSet, ATTR_BORDER, true );
672  if( mbBorderUsed )
673  maBorder.FillFromItemSet( rItemSet, GetPalette(), GetBiff() );
674 
675  // pattern
676  mbPattUsed = ScfTools::CheckItem( rItemSet, ATTR_BACKGROUND, true );
677  if( mbPattUsed )
678  maArea.FillFromItemSet( rItemSet, GetPalette(), true );
679  }
680 
681  // *** mode and comparison operator ***
682 
683  switch( rFormatEntry.GetOperation() )
684  {
687  break;
690  mbFormula2 = true;
691  break;
694  mbFormula2 = true;
695  break;
698  break;
701  break;
704  break;
707  break;
710  break;
713  break;
716  break;
717  default:
719  OSL_FAIL( "XclExpCF::WriteBody - unknown condition type" );
720  }
721 }
722 
724 {
725 
726  // *** formulas ***
727 
729 
730  std::unique_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateFlatCopiedTokenArray( 0 ) );
731  mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr );
732 
733  if (mbFormula2)
734  {
735  xScTokArr = mrFormatEntry.CreateFlatCopiedTokenArray( 1 );
736  mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr );
737  }
738 
739  // *** mode and comparison operator ***
740 
741  rStrm << mnType << mnOperator;
742 
743  // *** formula sizes ***
744 
745  sal_uInt16 nFmlaSize1 = mxTokArr1 ? mxTokArr1->GetSize() : 0;
746  sal_uInt16 nFmlaSize2 = mxTokArr2 ? mxTokArr2->GetSize() : 0;
747  rStrm << nFmlaSize1 << nFmlaSize2;
748 
749  // *** formatting blocks ***
750 
752  {
753  sal_uInt32 nFlags = EXC_CF_ALLDEFAULT;
754 
758 
759  // attributes used -> set flags to 0.
762 
763  rStrm << nFlags << sal_uInt16( 0 );
764 
765  if( mbFontUsed )
766  {
767  // font height, 0xFFFFFFFF indicates unused
768  sal_uInt32 nHeight = mbHeightUsed ? maFontData.mnHeight : 0xFFFFFFFF;
769  // font style: italic and strikeout
770  sal_uInt32 nStyle = 0;
773  // font color, 0xFFFFFFFF indicates unused
774  sal_uInt32 nColor = mbColorUsed ? GetPalette().GetColorIndex( mnFontColorId ) : 0xFFFFFFFF;
775  // font used flags for italic, weight, and strikeout -> 0 = used, 1 = default
776  sal_uInt32 nFontFlags1 = EXC_CF_FONT_ALLDEFAULT;
777  ::set_flag( nFontFlags1, EXC_CF_FONT_STYLE, !(mbItalicUsed || mbWeightUsed) );
779  // font used flag for underline -> 0 = used, 1 = default
780  sal_uInt32 nFontFlags3 = mbUnderlUsed ? 0 : EXC_CF_FONT_UNDERL;
781 
782  rStrm.WriteZeroBytesToRecord( 64 );
783  rStrm << nHeight
784  << nStyle
788  rStrm.WriteZeroBytesToRecord( 3 );
789  rStrm << nColor
790  << sal_uInt32( 0 )
791  << nFontFlags1
792  << EXC_CF_FONT_ESCAPEM // escapement never used -> set the flag
793  << nFontFlags3;
794  rStrm.WriteZeroBytesToRecord( 16 );
795  rStrm << sal_uInt16( 1 ); // must be 1
796  }
797 
798  if( mbBorderUsed )
799  {
800  sal_uInt16 nLineStyle = 0;
801  sal_uInt32 nLineColor = 0;
803  maBorder.FillToCF8( nLineStyle, nLineColor );
804  rStrm << nLineStyle << nLineColor << sal_uInt16( 0 );
805  }
806 
807  if( mbPattUsed )
808  {
809  sal_uInt16 nPattern = 0, nColor = 0;
811  maArea.FillToCF8( nPattern, nColor );
812  rStrm << nPattern << nColor;
813  }
814  }
815  else
816  {
817  // no data blocks at all
818  rStrm << sal_uInt32( 0 ) << sal_uInt16( 0 );
819  }
820 
821  // *** formulas ***
822 
823  if( mxTokArr1 )
824  mxTokArr1->WriteArray( rStrm );
825  if( mxTokArr2 )
826  mxTokArr2->WriteArray( rStrm );
827 }
828 
829 namespace {
830 
831 const char* GetOperatorString(ScConditionMode eMode, bool& bFrmla2)
832 {
833  const char *pRet = nullptr;
834  switch(eMode)
835  {
837  pRet = "equal";
838  break;
840  pRet = "lessThan";
841  break;
843  pRet = "greaterThan";
844  break;
846  pRet = "lessThanOrEqual";
847  break;
849  pRet = "greaterThanOrEqual";
850  break;
852  pRet = "notEqual";
853  break;
855  bFrmla2 = true;
856  pRet = "between";
857  break;
859  bFrmla2 = true;
860  pRet = "notBetween";
861  break;
863  pRet = nullptr;
864  break;
866  pRet = nullptr;
867  break;
869  pRet = "beginsWith";
870  break;
872  pRet = "endsWith";
873  break;
875  pRet = "containsText";
876  break;
878  pRet = "notContains";
879  break;
881  break;
883  default:
884  break;
885  }
886  return pRet;
887 }
888 
889 const char* GetTypeString(ScConditionMode eMode)
890 {
891  switch(eMode)
892  {
894  return "expression";
899  return "top10";
904  return "aboveAverage";
906  return "uniqueValues";
908  return "duplicateValues";
910  return "containsErrors";
912  return "notContainsErrors";
914  return "beginsWith";
916  return "endsWith";
918  return "containsText";
920  return "notContainsText";
921  default:
922  return "cellIs";
923  }
924 }
925 
926 bool IsTopBottomRule(ScConditionMode eMode)
927 {
928  switch(eMode)
929  {
934  return true;
935  default:
936  break;
937  }
938 
939  return false;
940 }
941 
942 bool IsTextRule(ScConditionMode eMode)
943 {
944  switch(eMode)
945  {
950  return true;
951  default:
952  break;
953  }
954 
955  return false;
956 }
957 
958 bool RequiresFormula(ScConditionMode eMode)
959 {
960  if (IsTopBottomRule(eMode))
961  return false;
962  else if (IsTextRule(eMode))
963  return false;
964 
965  switch (eMode)
966  {
971  return false;
972  default:
973  break;
974  }
975 
976  return true;
977 }
978 
979 bool RequiresFixedFormula(ScConditionMode eMode)
980 {
981  switch(eMode)
982  {
989  return true;
990  default:
991  break;
992  }
993 
994  return false;
995 }
996 
997 OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, std::string_view rText)
998 {
999  OStringBuffer aBuffer;
1000  XclXmlUtils::ToOString(aBuffer, rAddress);
1001  OString aPos = aBuffer.makeStringAndClear();
1002  switch (eMode)
1003  {
1005  return OString("ISERROR(" + aPos + ")") ;
1007  return OString("NOT(ISERROR(" + aPos + "))") ;
1009  return OString("LEFT(" + aPos + ",LEN(\"" + rText + "\"))=\"" + rText + "\"");
1011  return OString("RIGHT(" + aPos +",LEN(\"" + rText + "\"))=\"" + rText + "\"");
1013  return OString(OString::Concat("NOT(ISERROR(SEARCH(\"") + rText + "\"," + aPos + ")))");
1015  return OString(OString::Concat("ISERROR(SEARCH(\"") + rText + "\"," + aPos + "))");
1016  default:
1017  break;
1018  }
1019 
1020  return "";
1021 }
1022 
1023 }
1024 
1026 {
1027  bool bFmla2 = false;
1029  bool bAboveAverage = eOperation == ScConditionMode::AboveAverage ||
1030  eOperation == ScConditionMode::AboveEqualAverage;
1031  bool bEqualAverage = eOperation == ScConditionMode::AboveEqualAverage ||
1032  eOperation == ScConditionMode::BelowEqualAverage;
1033  bool bBottom = eOperation == ScConditionMode::Bottom10
1034  || eOperation == ScConditionMode::BottomPercent;
1035  bool bPercent = eOperation == ScConditionMode::TopPercent ||
1036  eOperation == ScConditionMode::BottomPercent;
1037  OUString aRank("0");
1038  if(IsTopBottomRule(eOperation))
1039  {
1040  // position and formula grammar are not important
1041  // we only store a number there
1042  aRank = mrFormatEntry.GetExpression(ScAddress(0,0,0), 0);
1043  }
1044  OString aText;
1045  if(IsTextRule(eOperation))
1046  {
1047  // we need to write the text without quotes
1048  // we have to actually get the string from
1049  // the token array for that
1050  std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
1051  if(pTokenArray->GetLen())
1052  aText = pTokenArray->FirstToken()->GetString().getString().toUtf8();
1053  }
1054 
1055  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1056  rWorksheet->startElement( XML_cfRule,
1057  XML_type, GetTypeString( mrFormatEntry.GetOperation() ),
1058  XML_priority, OString::number(mnPriority + 1),
1059  XML_operator, GetOperatorString( mrFormatEntry.GetOperation(), bFmla2 ),
1060  XML_aboveAverage, ToPsz10(bAboveAverage),
1061  XML_equalAverage, ToPsz10(bEqualAverage),
1062  XML_bottom, ToPsz10(bBottom),
1063  XML_percent, ToPsz10(bPercent),
1064  XML_rank, aRank,
1065  XML_text, aText,
1066  XML_dxfId, OString::number(GetDxfs().GetDxfId(mrFormatEntry.GetStyle())) );
1067 
1068  if (RequiresFixedFormula(eOperation))
1069  {
1070  rWorksheet->startElement(XML_formula);
1071  OString aFormula = GetFixedFormula(eOperation, maOrigin, aText);
1072  rWorksheet->writeEscaped(aFormula.getStr());
1073  rWorksheet->endElement( XML_formula );
1074  }
1075  else if(RequiresFormula(eOperation))
1076  {
1077  rWorksheet->startElement(XML_formula);
1078  std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
1080  pTokenArray.get()));
1081  rWorksheet->endElement( XML_formula );
1082  if (bFmla2)
1083  {
1084  rWorksheet->startElement(XML_formula);
1085  std::unique_ptr<ScTokenArray> pTokenArray2(mrFormatEntry.CreateFlatCopiedTokenArray(1));
1087  pTokenArray2.get()));
1088  rWorksheet->endElement( XML_formula );
1089  }
1090  }
1091  // OOXTODO: XML_extLst
1092  rWorksheet->endElement( XML_cfRule );
1093 }
1094 
1095 XclExpCF::XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin ) :
1097  XclExpRoot( rRoot ),
1098  mxImpl( new XclExpCFImpl( rRoot, rFormatEntry, nPriority, aOrigin ) )
1099 {
1100 }
1101 
1103 {
1104 }
1105 
1107 {
1108  mxImpl->WriteBody( rStrm );
1109 }
1110 
1112 {
1113  mxImpl->SaveXml( rStrm );
1114 }
1115 
1116 XclExpDateFormat::XclExpDateFormat( const XclExpRoot& rRoot, const ScCondDateFormatEntry& rFormatEntry, sal_Int32 nPriority ):
1118  XclExpRoot( rRoot ),
1119  mrFormatEntry(rFormatEntry),
1120  mnPriority(nPriority)
1121 {
1122 }
1123 
1125 {
1126 }
1127 
1128 namespace {
1129 
1130 const char* getTimePeriodString( condformat::ScCondFormatDateType eType )
1131 {
1132  switch(eType)
1133  {
1134  case condformat::TODAY:
1135  return "today";
1136  case condformat::YESTERDAY:
1137  return "yesterday";
1138  case condformat::TOMORROW:
1139  return "yesterday";
1140  case condformat::THISWEEK:
1141  return "thisWeek";
1142  case condformat::LASTWEEK:
1143  return "lastWeek";
1144  case condformat::NEXTWEEK:
1145  return "nextWeek";
1146  case condformat::THISMONTH:
1147  return "thisMonth";
1148  case condformat::LASTMONTH:
1149  return "lastMonth";
1150  case condformat::NEXTMONTH:
1151  return "nextMonth";
1152  case condformat::LAST7DAYS:
1153  return "last7Days";
1154  default:
1155  break;
1156  }
1157  return nullptr;
1158 }
1159 
1160 }
1161 
1163 {
1164  // only write the supported entries into OOXML
1165  const char* sTimePeriod = getTimePeriodString(mrFormatEntry.GetDateType());
1166  if(!sTimePeriod)
1167  return;
1168 
1169  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1170  rWorksheet->startElement( XML_cfRule,
1171  XML_type, "timePeriod",
1172  XML_priority, OString::number(mnPriority + 1),
1173  XML_timePeriod, sTimePeriod,
1174  XML_dxfId, OString::number(GetDxfs().GetDxfId(mrFormatEntry.GetStyleName())) );
1175  rWorksheet->endElement( XML_cfRule);
1176 }
1177 
1178 XclExpCfvo::XclExpCfvo(const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rAddr, bool bFirst):
1179  XclExpRoot( rRoot ),
1180  mrEntry(rEntry),
1181  maSrcPos(rAddr),
1182  mbFirst(bFirst)
1183 {
1184 }
1185 
1186 namespace {
1187 
1188 OString getColorScaleType( const ScColorScaleEntry& rEntry, bool bFirst )
1189 {
1190  switch(rEntry.GetType())
1191  {
1192  case COLORSCALE_MIN:
1193  return "min";
1194  case COLORSCALE_MAX:
1195  return "max";
1196  case COLORSCALE_PERCENT:
1197  return "percent";
1198  case COLORSCALE_FORMULA:
1199  return "formula";
1200  case COLORSCALE_AUTO:
1201  if(bFirst)
1202  return "min";
1203  else
1204  return "max";
1205  case COLORSCALE_PERCENTILE:
1206  return "percentile";
1207  default:
1208  break;
1209  }
1210 
1211  return "num";
1212 }
1213 
1214 }
1215 
1217 {
1218  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1219 
1220  OString aValue;
1222  {
1224  mrEntry.GetFormula());
1225  aValue = OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8 );
1226  }
1227  else
1228  {
1229  aValue = OString::number( mrEntry.GetValue() );
1230  }
1231 
1232  rWorksheet->startElement( XML_cfvo,
1233  XML_type, getColorScaleType(mrEntry, mbFirst),
1234  XML_val, aValue );
1235 
1236  rWorksheet->endElement( XML_cfvo );
1237 }
1238 
1240  XclExpRoot( rRoot ),
1241  mrColor( rColor )
1242 {
1243 }
1244 
1246 {
1247 }
1248 
1250 {
1251  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1252 
1253  rWorksheet->startElement(XML_color, XML_rgb, XclXmlUtils::ToOString(mrColor));
1254 
1255  rWorksheet->endElement( XML_color );
1256 }
1257 
1258 namespace {
1259 
1260 OString createHexStringFromDigit(sal_uInt8 nDigit)
1261 {
1262  OString aString = OString::number( nDigit, 16 );
1263  if(aString.getLength() == 1)
1264  aString += OString::number(0);
1265  return aString;
1266 }
1267 
1268 OString createGuidStringFromInt(sal_uInt8 nGuid[16])
1269 {
1270  OStringBuffer aBuffer;
1271  aBuffer.append('{');
1272  for(size_t i = 0; i < 16; ++i)
1273  {
1274  aBuffer.append(createHexStringFromDigit(nGuid[i]));
1275  if(i == 3|| i == 5 || i == 7 || i == 9 )
1276  aBuffer.append('-');
1277  }
1278  aBuffer.append('}');
1279  OString aString = aBuffer.makeStringAndClear();
1280  return aString.toAsciiUpperCase();
1281 }
1282 
1283 OString generateGUIDString()
1284 {
1285  sal_uInt8 nGuid[16];
1286  rtl_createUuid(nGuid, nullptr, true);
1287  return createGuidStringFromInt(nGuid);
1288 }
1289 
1290 }
1291 
1292 XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, const XclExtLstRef& xExtLst, sal_Int32& rIndex ) :
1294  XclExpRoot( rRoot )
1295 {
1296  const ScRangeList& aScRanges = rCondFormat.GetRange();
1297  GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true );
1298  if( maXclRanges.empty() )
1299  return;
1300 
1301  std::vector<XclExpExtCondFormatData> aExtEntries;
1302  ScAddress aOrigin = aScRanges.Combine().aStart;
1303  for( size_t nIndex = 0, nCount = rCondFormat.size(); nIndex < nCount; ++nIndex )
1304  if( const ScFormatEntry* pFormatEntry = rCondFormat.GetEntry( nIndex ) )
1305  {
1306  if(pFormatEntry->GetType() == ScFormatEntry::Type::Condition)
1307  maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), ++rIndex, aOrigin ) );
1308  else if(pFormatEntry->GetType() == ScFormatEntry::Type::ExtCondition)
1309  {
1310  const ScCondFormatEntry& rFormat = static_cast<const ScCondFormatEntry&>(*pFormatEntry);
1311  XclExpExtCondFormatData aExtEntry;
1312  aExtEntry.nPriority = ++rIndex;
1313  aExtEntry.aGUID = generateGUIDString();
1314  aExtEntry.pEntry = &rFormat;
1315  aExtEntries.push_back(aExtEntry);
1316  }
1317  else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale)
1318  maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) );
1319  else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar)
1320  {
1321  const ScDataBarFormat& rFormat = static_cast<const ScDataBarFormat&>(*pFormatEntry);
1322  XclExpExtCondFormatData aExtEntry;
1323  aExtEntry.nPriority = -1;
1324  aExtEntry.aGUID = generateGUIDString();
1325  aExtEntry.pEntry = &rFormat;
1326  aExtEntries.push_back(aExtEntry);
1327 
1328  maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), rFormat, ++rIndex, aExtEntry.aGUID));
1329  }
1330  else if(pFormatEntry->GetType() == ScFormatEntry::Type::Iconset)
1331  {
1332  // don't export iconSet entries that are not in OOXML
1333  const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry);
1334  bool bNeedsExt = false;
1335  switch (rIconSet.GetIconSetData()->eIconSetType)
1336  {
1337  case IconSet_3Smilies:
1338  case IconSet_3ColorSmilies:
1339  case IconSet_3Stars:
1340  case IconSet_3Triangles:
1341  case IconSet_5Boxes:
1342  {
1343  bNeedsExt = true;
1344  }
1345  break;
1346  default:
1347  break;
1348  }
1349 
1350  bNeedsExt |= rIconSet.GetIconSetData()->mbCustom;
1351 
1352  if (bNeedsExt)
1353  {
1354  XclExpExtCondFormatData aExtEntry;
1355  aExtEntry.nPriority = ++rIndex;
1356  aExtEntry.aGUID = generateGUIDString();
1357  aExtEntry.pEntry = &rIconSet;
1358  aExtEntries.push_back(aExtEntry);
1359  }
1360  else
1361  maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), rIconSet, ++rIndex ) );
1362  }
1363  else if(pFormatEntry->GetType() == ScFormatEntry::Type::Date)
1364  maCFList.AppendNewRecord( new XclExpDateFormat( GetRoot(), static_cast<const ScCondDateFormatEntry&>(*pFormatEntry), ++rIndex ) );
1365  }
1367 
1368  if(!aExtEntries.empty() && xExtLst)
1369  {
1370  XclExpExt* pParent = xExtLst->GetItem( XclExpExtDataBarType );
1371  if( !pParent )
1372  {
1373  xExtLst->AddRecord( new XclExpExtCondFormat( *xExtLst ) );
1374  pParent = xExtLst->GetItem( XclExpExtDataBarType );
1375  }
1376  static_cast<XclExpExtCondFormat*>(xExtLst->GetItem( XclExpExtDataBarType ))->AddRecord(
1377  new XclExpExtConditionalFormatting( *pParent, aExtEntries, aScRanges));
1378  }
1379 }
1380 
1382 {
1383 }
1384 
1386 {
1387  // ccf (2 bytes): An unsigned integer that specifies the count of CF records that follow this
1388  // record. MUST be greater than or equal to 0x0001, and less than or equal to 0x0003.
1389 
1390  SAL_WARN_IF( maCFList.GetSize() > 3, "sc.filter", "More than 3 conditional filters for cell(s), won't export");
1391 
1392  return !maCFList.IsEmpty() && maCFList.GetSize() <= 3 && !maXclRanges.empty();
1393 }
1394 
1396 {
1397  return !maCFList.IsEmpty() && !maXclRanges.empty();
1398 }
1399 
1401 {
1402  if( IsValidForBinary() )
1403  {
1404  XclExpRecord::Save( rStrm );
1405  maCFList.Save( rStrm );
1406  }
1407 }
1408 
1410 {
1411  OSL_ENSURE( !maCFList.IsEmpty(), "XclExpCondfmt::WriteBody - no CF records to write" );
1412  OSL_ENSURE( !maXclRanges.empty(), "XclExpCondfmt::WriteBody - no cell ranges found" );
1413 
1414  rStrm << static_cast< sal_uInt16 >( maCFList.GetSize() )
1415  << sal_uInt16( 1 )
1417  << maXclRanges;
1418 }
1419 
1421 {
1422  if( !IsValidForXml() )
1423  return;
1424 
1425  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1426  rWorksheet->startElement( XML_conditionalFormatting,
1427  XML_sqref, msSeqRef
1428  // OOXTODO: XML_pivot
1429  );
1430 
1431  maCFList.SaveXml( rStrm );
1432 
1433  rWorksheet->endElement( XML_conditionalFormatting );
1434 }
1435 
1436 XclExpColorScale::XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat, sal_Int32 nPriority ):
1437  XclExpRoot( rRoot ),
1438  mnPriority( nPriority )
1439 {
1440  const ScRange & rRange = rFormat.GetRange().front();
1441  ScAddress aAddr = rRange.aStart;
1442  for(const auto& rxColorScaleEntry : rFormat)
1443  {
1444  // exact position is not important, we allow only absolute refs
1445 
1446  XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *rxColorScaleEntry, aAddr ) );
1447  maCfvoList.AppendRecord( xCfvo );
1448  XclExpColScaleColList::RecordRefType xClo( new XclExpColScaleCol( GetRoot(), rxColorScaleEntry->GetColor() ) );
1449  maColList.AppendRecord( xClo );
1450  }
1451 }
1452 
1454 {
1455  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1456 
1457  rWorksheet->startElement( XML_cfRule,
1458  XML_type, "colorScale",
1459  XML_priority, OString::number(mnPriority + 1) );
1460 
1461  rWorksheet->startElement(XML_colorScale);
1462 
1463  maCfvoList.SaveXml(rStrm);
1464  maColList.SaveXml(rStrm);
1465 
1466  rWorksheet->endElement( XML_colorScale );
1467 
1468  rWorksheet->endElement( XML_cfRule );
1469 }
1470 
1471 XclExpDataBar::XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, const OString& rGUID):
1472  XclExpRoot( rRoot ),
1473  mrFormat( rFormat ),
1474  mnPriority( nPriority ),
1475  maGUID(rGUID)
1476 {
1477  const ScRange & rRange = rFormat.GetRange().front();
1478  ScAddress aAddr = rRange.aStart;
1479  // exact position is not important, we allow only absolute refs
1480  mpCfvoLowerLimit.reset(
1481  new XclExpCfvo(GetRoot(), *mrFormat.GetDataBarData()->mpLowerLimit, aAddr, true));
1482  mpCfvoUpperLimit.reset(
1483  new XclExpCfvo(GetRoot(), *mrFormat.GetDataBarData()->mpUpperLimit, aAddr, false));
1484 
1486 }
1487 
1489 {
1490  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1491 
1492  rWorksheet->startElement( XML_cfRule,
1493  XML_type, "dataBar",
1494  XML_priority, OString::number(mnPriority + 1) );
1495 
1496  rWorksheet->startElement( XML_dataBar,
1497  XML_showValue, ToPsz10(!mrFormat.GetDataBarData()->mbOnlyBar),
1498  XML_minLength, OString::number(sal_uInt32(mrFormat.GetDataBarData()->mnMinLength)),
1499  XML_maxLength, OString::number(sal_uInt32(mrFormat.GetDataBarData()->mnMaxLength)) );
1500 
1501  mpCfvoLowerLimit->SaveXml(rStrm);
1502  mpCfvoUpperLimit->SaveXml(rStrm);
1503  mpCol->SaveXml(rStrm);
1504 
1505  rWorksheet->endElement( XML_dataBar );
1506 
1507  // extLst entries for Excel 2010 and 2013
1508  rWorksheet->startElement(XML_extLst);
1509  rWorksheet->startElement(XML_ext,
1510  FSNS(XML_xmlns, XML_x14), rStrm.getNamespaceURL(OOX_NS(xls14Lst)),
1511  XML_uri, "{B025F937-C7B1-47D3-B67F-A62EFF666E3E}");
1512 
1513  rWorksheet->startElementNS( XML_x14, XML_id );
1514  rWorksheet->write(maGUID);
1515  rWorksheet->endElementNS( XML_x14, XML_id );
1516 
1517  rWorksheet->endElement( XML_ext );
1518  rWorksheet->endElement( XML_extLst );
1519 
1520  rWorksheet->endElement( XML_cfRule );
1521 }
1522 
1523 XclExpIconSet::XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority ):
1524  XclExpRoot( rRoot ),
1525  mrFormat( rFormat ),
1526  mnPriority( nPriority )
1527 {
1528  const ScRange & rRange = rFormat.GetRange().front();
1529  ScAddress aAddr = rRange.aStart;
1530  for (auto const& itr : rFormat)
1531  {
1532  // exact position is not important, we allow only absolute refs
1533 
1534  XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *itr, aAddr ) );
1535  maCfvoList.AppendRecord( xCfvo );
1536  }
1537 }
1538 
1540 {
1541  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1542 
1543  rWorksheet->startElement( XML_cfRule,
1544  XML_type, "iconSet",
1545  XML_priority, OString::number(mnPriority + 1) );
1546 
1548  rWorksheet->startElement( XML_iconSet,
1549  XML_iconSet, pIconSetName,
1550  XML_showValue, sax_fastparser::UseIf("0", !mrFormat.GetIconSetData()->mbShowValue),
1551  XML_reverse, sax_fastparser::UseIf("1", mrFormat.GetIconSetData()->mbReverse));
1552 
1553  maCfvoList.SaveXml( rStrm );
1554 
1555  rWorksheet->endElement( XML_iconSet );
1556  rWorksheet->endElement( XML_cfRule );
1557 }
1558 
1560  XclExpRoot( rRoot )
1561 {
1562  if( const ScConditionalFormatList* pCondFmtList = GetDoc().GetCondFormList(GetCurrScTab()) )
1563  {
1564  sal_Int32 nIndex = 0;
1565  for( const auto& rxCondFmt : *pCondFmtList)
1566  {
1567  XclExpCondfmtList::RecordRefType xCondfmtRec( new XclExpCondfmt( GetRoot(), *rxCondFmt, xExtLst, nIndex ));
1568  if( xCondfmtRec->IsValidForXml() )
1569  maCondfmtList.AppendRecord( xCondfmtRec );
1570  }
1571  }
1572 }
1573 
1575 {
1576  maCondfmtList.Save( rStrm );
1577 }
1578 
1580 {
1581  maCondfmtList.SaveXml( rStrm );
1582 }
1583 
1584 // Validation =================================================================
1585 
1586 namespace {
1587 
1589 void lclWriteDvFormula( XclExpStream& rStrm, const XclTokenArray* pXclTokArr )
1590 {
1591  sal_uInt16 nFmlaSize = pXclTokArr ? pXclTokArr->GetSize() : 0;
1592  rStrm << nFmlaSize << sal_uInt16( 0 );
1593  if( pXclTokArr )
1594  pXclTokArr->WriteArray( rStrm );
1595 }
1596 
1598 void lclWriteDvFormula( XclExpStream& rStrm, const XclExpString& rString )
1599 {
1600  // fake a formula with a single tStr token
1601  rStrm << static_cast< sal_uInt16 >( rString.GetSize() + 1 )
1602  << sal_uInt16( 0 )
1603  << EXC_TOKID_STR
1604  << rString;
1605 }
1606 
1607 const char* lcl_GetValidationType( sal_uInt32 nFlags )
1608 {
1609  switch( nFlags & EXC_DV_MODE_MASK )
1610  {
1611  case EXC_DV_MODE_ANY: return "none";
1612  case EXC_DV_MODE_WHOLE: return "whole";
1613  case EXC_DV_MODE_DECIMAL: return "decimal";
1614  case EXC_DV_MODE_LIST: return "list";
1615  case EXC_DV_MODE_DATE: return "date";
1616  case EXC_DV_MODE_TIME: return "time";
1617  case EXC_DV_MODE_TEXTLEN: return "textLength";
1618  case EXC_DV_MODE_CUSTOM: return "custom";
1619  }
1620  return nullptr;
1621 }
1622 
1623 const char* lcl_GetOperatorType( sal_uInt32 nFlags )
1624 {
1625  switch( nFlags & EXC_DV_COND_MASK )
1626  {
1627  case EXC_DV_COND_BETWEEN: return "between";
1628  case EXC_DV_COND_NOTBETWEEN: return "notBetween";
1629  case EXC_DV_COND_EQUAL: return "equal";
1630  case EXC_DV_COND_NOTEQUAL: return "notEqual";
1631  case EXC_DV_COND_GREATER: return "greaterThan";
1632  case EXC_DV_COND_LESS: return "lessThan";
1633  case EXC_DV_COND_EQGREATER: return "greaterThanOrEqual";
1634  case EXC_DV_COND_EQLESS: return "lessThanOrEqual";
1635  }
1636  return nullptr;
1637 }
1638 
1639 const char* lcl_GetErrorType( sal_uInt32 nFlags )
1640 {
1641  switch (nFlags & EXC_DV_ERROR_MASK)
1642  {
1643  case EXC_DV_ERROR_STOP: return "stop";
1644  case EXC_DV_ERROR_WARNING: return "warning";
1645  case EXC_DV_ERROR_INFO: return "information";
1646  }
1647  return nullptr;
1648 }
1649 
1650 void lcl_SetValidationText(const OUString& rText, XclExpString& rValidationText)
1651 {
1652  if ( !rText.isEmpty() )
1653  {
1654  // maximum length allowed in Excel is 255 characters
1655  if ( rText.getLength() > 255 )
1656  {
1657  OUStringBuffer aBuf( rText );
1658  rValidationText.Assign(
1659  comphelper::string::truncateToLength(aBuf, 255).makeStringAndClear() );
1660  }
1661  else
1662  rValidationText.Assign( rText );
1663  }
1664  else
1665  rValidationText.Assign( '\0' );
1666 }
1667 
1668 } // namespace
1669 
1670 XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) :
1672  XclExpRoot( rRoot ),
1673  mnFlags( 0 ),
1674  mnScHandle( nScHandle )
1675 {
1676  if( const ScValidationData* pValData = GetDoc().GetValidationEntry( mnScHandle ) )
1677  {
1678  // prompt box - empty string represented by single NUL character
1679  OUString aTitle, aText;
1680  bool bShowPrompt = pValData->GetInput( aTitle, aText );
1681  lcl_SetValidationText(aTitle, maPromptTitle);
1682  lcl_SetValidationText(aText, maPromptText);
1683 
1684  // error box - empty string represented by single NUL character
1685  ScValidErrorStyle eScErrorStyle;
1686  bool bShowError = pValData->GetErrMsg( aTitle, aText, eScErrorStyle );
1687  lcl_SetValidationText(aTitle, maErrorTitle);
1688  lcl_SetValidationText(aText, maErrorText);
1689 
1690  // flags
1691  switch( pValData->GetDataMode() )
1692  {
1693  case SC_VALID_ANY: mnFlags |= EXC_DV_MODE_ANY; break;
1694  case SC_VALID_WHOLE: mnFlags |= EXC_DV_MODE_WHOLE; break;
1696  case SC_VALID_LIST: mnFlags |= EXC_DV_MODE_LIST; break;
1697  case SC_VALID_DATE: mnFlags |= EXC_DV_MODE_DATE; break;
1698  case SC_VALID_TIME: mnFlags |= EXC_DV_MODE_TIME; break;
1700  case SC_VALID_CUSTOM: mnFlags |= EXC_DV_MODE_CUSTOM; break;
1701  default: OSL_FAIL( "XclExpDV::XclExpDV - unknown mode" );
1702  }
1703 
1704  switch( pValData->GetOperation() )
1705  {
1706  case ScConditionMode::NONE:
1715  default: OSL_FAIL( "XclExpDV::XclExpDV - unknown condition" );
1716  }
1717  switch( eScErrorStyle )
1718  {
1719  case SC_VALERR_STOP: mnFlags |= EXC_DV_ERROR_STOP; break;
1721  case SC_VALERR_INFO: mnFlags |= EXC_DV_ERROR_INFO; break;
1722  case SC_VALERR_MACRO:
1723  // set INFO for validity with macro call, delete title
1725  maErrorTitle.Assign( '\0' ); // contains macro name
1726  break;
1727  default: OSL_FAIL( "XclExpDV::XclExpDV - unknown error style" );
1728  }
1729  ::set_flag( mnFlags, EXC_DV_IGNOREBLANK, pValData->IsIgnoreBlank() );
1730  ::set_flag( mnFlags, EXC_DV_SUPPRESSDROPDOWN, pValData->GetListType() == css::sheet::TableValidationVisibility::INVISIBLE );
1731  ::set_flag( mnFlags, EXC_DV_SHOWPROMPT, bShowPrompt );
1732  ::set_flag( mnFlags, EXC_DV_SHOWERROR, bShowError );
1733 
1734  // formulas
1736 
1737  // first formula
1738  std::unique_ptr< ScTokenArray > xScTokArr = pValData->CreateFlatCopiedTokenArray( 0 );
1739  if (xScTokArr)
1740  {
1741  if( pValData->GetDataMode() == SC_VALID_LIST )
1742  {
1743  OUString aString;
1744  if( XclTokenArrayHelper::GetStringList( aString, *xScTokArr, '\n' ) )
1745  {
1746  bool bList = false;
1747  OUStringBuffer sListBuf;
1748  OUStringBuffer sFormulaBuf;
1749  sFormulaBuf.append( '"' );
1750  /* Formula is a list of string tokens -> build the Excel string.
1751  Data validity is BIFF8 only (important for the XclExpString object).
1752  Excel uses the NUL character as string list separator. */
1754  if (!aString.isEmpty())
1755  {
1756  sal_Int32 nStringIx = 0;
1757  for(;;)
1758  {
1759  const OUString aToken( aString.getToken( 0, '\n', nStringIx ) );
1760  if (aToken.indexOf(",") != -1)
1761  {
1762  sListBuf.append('"');
1763  sListBuf.append(aToken);
1764  sListBuf.append('"');
1765  bList = true;
1766  }
1767  else
1768  sListBuf.append(aToken);
1769  mxString1->Append( aToken );
1770  sFormulaBuf.append( aToken );
1771  if (nStringIx<0)
1772  break;
1773  mxString1->Append(OUString(u'\0'));
1774  sFormulaBuf.append( ',' );
1775  sListBuf.append( ',' );
1776  }
1777  }
1779 
1780  // maximum length allowed in Excel is 255 characters, and don't end with an empty token
1781  // It should be 8192 but Excel doesn't accept it for unknown reason
1782  // See also https://bugs.documentfoundation.org/show_bug.cgi?id=137167#c2 for more details
1783  sal_uInt32 nLen = sFormulaBuf.getLength();
1784  if( nLen > 256 ) // 255 + beginning quote mark
1785  {
1786  nLen = 256;
1787  if( sFormulaBuf[nLen - 1] == ',' )
1788  --nLen;
1789  sFormulaBuf.truncate(nLen);
1790  }
1791 
1792  sFormulaBuf.append( '"' );
1793  msFormula1 = sFormulaBuf.makeStringAndClear();
1794  if (bList)
1795  msList = sListBuf.makeStringAndClear();
1796  else
1797  sListBuf.remove(0, sListBuf.getLength());
1798  }
1799  else
1800  {
1801  /* All other formulas in validation are stored like conditional
1802  formatting formulas (with tRefN/tAreaN tokens as value or
1803  array class). But NOT the cell references and defined names
1804  in list validation - they are stored as reference class
1805  tokens... Example:
1806  1) Cell must be equal to A1 -> formula is =A1 -> writes tRefNV token
1807  2) List is taken from A1 -> formula is =A1 -> writes tRefNR token
1808  Formula compiler supports this by offering two different functions
1809  CreateDataValFormula() and CreateListValFormula(). */
1810  if(GetOutput() == EXC_OUTPUT_BINARY)
1811  mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_LISTVAL, *xScTokArr );
1812  else
1813  msFormula1 = XclXmlUtils::ToOUString( GetCompileFormulaContext(), pValData->GetSrcPos(),
1814  xScTokArr.get());
1815  }
1816  }
1817  else
1818  {
1819  // no list validation -> convert the formula
1820  if(GetOutput() == EXC_OUTPUT_BINARY)
1821  mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, *xScTokArr );
1822  else
1823  msFormula1 = XclXmlUtils::ToOUString( GetCompileFormulaContext(), pValData->GetSrcPos(),
1824  xScTokArr.get());
1825  }
1826  }
1827 
1828  // second formula
1829  xScTokArr = pValData->CreateFlatCopiedTokenArray( 1 );
1830  if (xScTokArr)
1831  {
1832  if(GetOutput() == EXC_OUTPUT_BINARY)
1833  mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, *xScTokArr );
1834  else
1835  msFormula2 = XclXmlUtils::ToOUString( GetCompileFormulaContext(), pValData->GetSrcPos(),
1836  xScTokArr.get());
1837  }
1838  }
1839  else
1840  {
1841  OSL_FAIL( "XclExpDV::XclExpDV - missing core data" );
1842  mnScHandle = ULONG_MAX;
1843  }
1844 }
1845 
1847 {
1848 }
1849 
1850 void XclExpDV::InsertCellRange( const ScRange& rRange )
1851 {
1852  maScRanges.Join( rRange );
1853 }
1854 
1856 {
1858  return (mnScHandle != ULONG_MAX) && !maXclRanges.empty();
1859 }
1860 
1862 {
1863  // flags and strings
1865  // condition formulas
1866  if( mxString1 )
1867  lclWriteDvFormula( rStrm, *mxString1 );
1868  else
1869  lclWriteDvFormula( rStrm, mxTokArr1.get() );
1870  lclWriteDvFormula( rStrm, mxTokArr2.get() );
1871  // cell ranges
1872  rStrm << maXclRanges;
1873 }
1874 
1876 {
1877  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1878  rWorksheet->startElement( XML_dataValidation,
1879  XML_allowBlank, ToPsz( ::get_flag( mnFlags, EXC_DV_IGNOREBLANK ) ),
1880  XML_error, XESTRING_TO_PSZ( maErrorText ),
1881  XML_errorStyle, lcl_GetErrorType(mnFlags),
1882  XML_errorTitle, XESTRING_TO_PSZ( maErrorTitle ),
1883  // OOXTODO: XML_imeMode,
1884  XML_operator, lcl_GetOperatorType( mnFlags ),
1885  XML_prompt, XESTRING_TO_PSZ( maPromptText ),
1886  XML_promptTitle, XESTRING_TO_PSZ( maPromptTitle ),
1887  // showDropDown should have been showNoDropDown - check oox/xlsx import for details
1888  XML_showDropDown, ToPsz( ::get_flag( mnFlags, EXC_DV_SUPPRESSDROPDOWN ) ),
1889  XML_showErrorMessage, ToPsz( ::get_flag( mnFlags, EXC_DV_SHOWERROR ) ),
1890  XML_showInputMessage, ToPsz( ::get_flag( mnFlags, EXC_DV_SHOWPROMPT ) ),
1891  XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), maScRanges),
1892  XML_type, lcl_GetValidationType(mnFlags) );
1893  if (!msList.isEmpty())
1894  {
1895  rWorksheet->startElement(FSNS(XML_mc, XML_AlternateContent),
1896  FSNS(XML_xmlns, XML_x12ac),rStrm.getNamespaceURL(OOX_NS(x12ac)),
1897  FSNS(XML_xmlns, XML_mc),rStrm.getNamespaceURL(OOX_NS(mce)));
1898  rWorksheet->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "x12ac");
1899  rWorksheet->startElement(FSNS(XML_x12ac, XML_list));
1900  rWorksheet->writeEscaped(msList);
1901  rWorksheet->endElement(FSNS(XML_x12ac, XML_list));
1902  rWorksheet->endElement(FSNS(XML_mc, XML_Choice));
1903  rWorksheet->startElement(FSNS(XML_mc, XML_Fallback));
1904  rWorksheet->startElement(XML_formula1);
1905  rWorksheet->writeEscaped(msFormula1);
1906  rWorksheet->endElement(XML_formula1);
1907  rWorksheet->endElement(FSNS(XML_mc, XML_Fallback));
1908  rWorksheet->endElement(FSNS(XML_mc, XML_AlternateContent));
1909  }
1910  if (msList.isEmpty() && !msFormula1.isEmpty())
1911  {
1912  rWorksheet->startElement(XML_formula1);
1913  rWorksheet->writeEscaped( msFormula1 );
1914  rWorksheet->endElement( XML_formula1 );
1915  }
1916  if( !msFormula2.isEmpty() )
1917  {
1918  rWorksheet->startElement(XML_formula2);
1919  rWorksheet->writeEscaped( msFormula2 );
1920  rWorksheet->endElement( XML_formula2 );
1921  }
1922  rWorksheet->endElement( XML_dataValidation );
1923 }
1924 
1926  XclExpRecord( EXC_ID_DVAL, 18 ),
1927  XclExpRoot( rRoot )
1928 {
1929 }
1930 
1932 {
1933 }
1934 
1935 void XclExpDval::InsertCellRange( const ScRange& rRange, sal_uLong nScHandle )
1936 {
1937  if( GetBiff() == EXC_BIFF8 )
1938  {
1939  XclExpDV& rDVRec = SearchOrCreateDv( nScHandle );
1940  rDVRec.InsertCellRange( rRange );
1941  }
1942 }
1943 
1945 {
1946  // check all records
1947  size_t nPos = maDVList.GetSize();
1948  while( nPos )
1949  {
1950  --nPos; // backwards to keep nPos valid
1951  XclExpDVRef xDVRec = maDVList.GetRecord( nPos );
1952  if( !xDVRec->Finalize() )
1953  maDVList.RemoveRecord( nPos );
1954  }
1955 
1956  // write the DVAL and the DV's
1957  if( !maDVList.IsEmpty() )
1958  {
1959  XclExpRecord::Save( rStrm );
1960  maDVList.Save( rStrm );
1961  }
1962 }
1963 
1965 {
1966  if( maDVList.IsEmpty() )
1967  return;
1968 
1969  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
1970  rWorksheet->startElement( XML_dataValidations,
1971  XML_count, OString::number(maDVList.GetSize())
1972  // OOXTODO: XML_disablePrompts,
1973  // OOXTODO: XML_xWindow,
1974  // OOXTODO: XML_yWindow
1975  );
1976  maDVList.SaveXml( rStrm );
1977  rWorksheet->endElement( XML_dataValidations );
1978 }
1979 
1981 {
1982  // test last found record
1983  if( mxLastFoundDV && (mxLastFoundDV->GetScHandle() == nScHandle) )
1984  return *mxLastFoundDV;
1985 
1986  // binary search
1987  size_t nCurrPos = 0;
1988  if( !maDVList.IsEmpty() )
1989  {
1990  size_t nFirstPos = 0;
1991  size_t nLastPos = maDVList.GetSize() - 1;
1992  bool bLoop = true;
1993  sal_uLong nCurrScHandle = ::std::numeric_limits< sal_uLong >::max();
1994  while( (nFirstPos <= nLastPos) && bLoop )
1995  {
1996  nCurrPos = (nFirstPos + nLastPos) / 2;
1997  mxLastFoundDV = maDVList.GetRecord( nCurrPos );
1998  nCurrScHandle = mxLastFoundDV->GetScHandle();
1999  if( nCurrScHandle == nScHandle )
2000  bLoop = false;
2001  else if( nCurrScHandle < nScHandle )
2002  nFirstPos = nCurrPos + 1;
2003  else if( nCurrPos )
2004  nLastPos = nCurrPos - 1;
2005  else // special case for nLastPos = -1
2006  bLoop = false;
2007  }
2008  if( nCurrScHandle == nScHandle )
2009  return *mxLastFoundDV;
2010  else if( nCurrScHandle < nScHandle )
2011  ++nCurrPos;
2012  }
2013 
2014  // create new DV record
2015  mxLastFoundDV = new XclExpDV( *this, nScHandle );
2016  maDVList.InsertRecord( mxLastFoundDV, nCurrPos );
2017  return *mxLastFoundDV;
2018 }
2019 
2021 {
2022  rStrm.WriteZeroBytes( 10 );
2023  rStrm << EXC_DVAL_NOOBJ << static_cast< sal_uInt32 >( maDVList.GetSize() );
2024 }
2025 
2026 // Web Queries ================================================================
2027 
2029  const OUString& rRangeName,
2030  const OUString& rUrl,
2031  const OUString& rSource,
2032  sal_Int32 nRefrSecs ) :
2033  maDestRange( rRangeName ),
2034  maUrl( rUrl ),
2035  // refresh delay time: seconds -> minutes
2036  mnRefresh( ulimit_cast< sal_Int16 >( (nRefrSecs + 59) / 60 ) ),
2037  mbEntireDoc( false )
2038 {
2039  // comma separated list of HTML table names or indexes
2040  OUString aNewTables;
2041  OUString aAppendTable;
2042  bool bExitLoop = false;
2043  if (!rSource.isEmpty())
2044  {
2045  sal_Int32 nStringIx = 0;
2046  do
2047  {
2048  OUString aToken( rSource.getToken( 0, ';', nStringIx ) );
2050  bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken );
2051  if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) )
2052  aNewTables = ScGlobal::addToken( aNewTables, aAppendTable, ',' );
2053  }
2054  while (nStringIx>0 && !bExitLoop);
2055  }
2056 
2057  if( !bExitLoop ) // neither HTML_all nor HTML_tables found
2058  {
2059  if( !aNewTables.isEmpty() )
2060  mxQryTables.reset( new XclExpString( aNewTables ) );
2061  else
2062  mbEntireDoc = true;
2063  }
2064 }
2065 
2067 {
2068 }
2069 
2071 {
2072  OSL_ENSURE( !mbEntireDoc || !mxQryTables, "XclExpWebQuery::Save - illegal mode" );
2073  sal_uInt16 nFlags;
2074 
2075  // QSI record
2076  rStrm.StartRecord( EXC_ID_QSI, 10 + maDestRange.GetSize() );
2077  rStrm << EXC_QSI_DEFAULTFLAGS
2078  << sal_uInt16( 0x0010 )
2079  << sal_uInt16( 0x0012 )
2080  << sal_uInt32( 0x00000000 )
2081  << maDestRange;
2082  rStrm.EndRecord();
2083 
2084  // PARAMQRY record
2085  nFlags = 0;
2086  ::insert_value( nFlags, EXC_PQRYTYPE_WEBQUERY, 0, 3 );
2087  ::set_flag( nFlags, EXC_PQRY_WEBQUERY );
2088  ::set_flag( nFlags, EXC_PQRY_TABLES, !mbEntireDoc );
2089  rStrm.StartRecord( EXC_ID_PQRY, 12 );
2090  rStrm << nFlags
2091  << sal_uInt16( 0x0000 )
2092  << sal_uInt16( 0x0001 );
2093  rStrm.WriteZeroBytes( 6 );
2094  rStrm.EndRecord();
2095 
2096  // WQSTRING record
2098  rStrm << maUrl;
2099  rStrm.EndRecord();
2100 
2101  // unknown record 0x0802
2102  rStrm.StartRecord( EXC_ID_0802, 16 + maDestRange.GetSize() );
2103  rStrm << EXC_ID_0802; // repeated record id ?!?
2104  rStrm.WriteZeroBytes( 6 );
2105  rStrm << sal_uInt16( 0x0003 )
2106  << sal_uInt32( 0x00000000 )
2107  << sal_uInt16( 0x0010 )
2108  << maDestRange;
2109  rStrm.EndRecord();
2110 
2111  // WEBQRYSETTINGS record
2113  rStrm.StartRecord( EXC_ID_WQSETT, 28 );
2114  rStrm << EXC_ID_WQSETT // repeated record id ?!?
2115  << sal_uInt16( 0x0000 )
2116  << sal_uInt16( 0x0004 )
2117  << sal_uInt16( 0x0000 )
2119  << nFlags;
2120  rStrm.WriteZeroBytes( 10 );
2121  rStrm << mnRefresh // refresh delay in minutes
2123  << sal_uInt16( 0x0000 );
2124  rStrm.EndRecord();
2125 
2126  // WEBQRYTABLES record
2127  if( mxQryTables )
2128  {
2129  rStrm.StartRecord( EXC_ID_WQTABLES, 4 + mxQryTables->GetSize() );
2130  rStrm << EXC_ID_WQTABLES // repeated record id ?!?
2131  << sal_uInt16( 0x0000 )
2132  << *mxQryTables; // comma separated list of source tables
2133  rStrm.EndRecord();
2134  }
2135 }
2136 
2138 {
2139  SCTAB nScTab = rRoot.GetCurrScTab();
2140  SfxObjectShell* pShell = rRoot.GetDocShell();
2141  if( !pShell ) return;
2142  ScfPropertySet aModelProp( pShell->GetModel() );
2143  if( !aModelProp.Is() ) return;
2144 
2145  Reference< XAreaLinks > xAreaLinks;
2146  aModelProp.GetProperty( xAreaLinks, SC_UNO_AREALINKS );
2147  if( !xAreaLinks.is() ) return;
2148 
2149  for( sal_Int32 nIndex = 0, nCount = xAreaLinks->getCount(); nIndex < nCount; ++nIndex )
2150  {
2151  Reference< XAreaLink > xAreaLink( xAreaLinks->getByIndex( nIndex ), UNO_QUERY );
2152  if( xAreaLink.is() )
2153  {
2154  CellRangeAddress aDestRange( xAreaLink->getDestArea() );
2155  if( static_cast< SCTAB >( aDestRange.Sheet ) == nScTab )
2156  {
2157  ScfPropertySet aLinkProp( xAreaLink );
2158  OUString aFilter;
2159  if( aLinkProp.GetProperty( aFilter, SC_UNONAME_FILTER ) &&
2160  (aFilter == EXC_WEBQRY_FILTER) )
2161  {
2162  // get properties
2163  OUString /*aFilterOpt,*/ aUrl;
2164  sal_Int32 nRefresh = 0;
2165 
2166 // aLinkProp.GetProperty( aFilterOpt, SC_UNONAME_FILTOPT );
2167  aLinkProp.GetProperty( aUrl, SC_UNONAME_LINKURL );
2168  aLinkProp.GetProperty( nRefresh, SC_UNONAME_REFDELAY );
2169 
2170  OUString aAbsDoc( ScGlobal::GetAbsDocName( aUrl, pShell ) );
2171  INetURLObject aUrlObj( aAbsDoc );
2172  OUString aWebQueryUrl( aUrlObj.getFSysPath( FSysStyle::Dos ) );
2173  if( aWebQueryUrl.isEmpty() )
2174  aWebQueryUrl = aAbsDoc;
2175 
2176  // find range or create a new range
2177  OUString aRangeName;
2178  ScRange aScDestRange;
2179  ScUnoConversion::FillScRange( aScDestRange, aDestRange );
2180  if( const ScRangeData* pRangeData = rRoot.GetNamedRanges().findByRange( aScDestRange ) )
2181  {
2182  aRangeName = pRangeData->GetName();
2183  }
2184  else
2185  {
2186  XclExpFormulaCompiler& rFmlaComp = rRoot.GetFormulaCompiler();
2187  XclExpNameManager& rNameMgr = rRoot.GetNameManager();
2188 
2189  // create a new unique defined name containing the range
2190  XclTokenArrayRef xTokArr = rFmlaComp.CreateFormula( EXC_FMLATYPE_WQUERY, aScDestRange );
2191  sal_uInt16 nNameIdx = rNameMgr.InsertUniqueName( aUrlObj.getBase(), xTokArr, nScTab );
2192  aRangeName = rNameMgr.GetOrigName( nNameIdx );
2193  }
2194 
2195  // create and store the web query record
2196  if( !aRangeName.isEmpty() )
2198  aRangeName, aWebQueryUrl, xAreaLink->getSourceArea(), nRefresh ) );
2199  }
2200  }
2201  }
2202  }
2203 }
2204 
2205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const sal_uInt16 EXC_ID_WQSETT
Definition: xlcontent.hxx:173
const sal_uInt32 EXC_DV_COND_NOTBETWEEN
Definition: xlcontent.hxx:125
void ConvertRangeList(XclRangeList &rXclRanges, const ScRangeList &rScRanges, bool bWarn)
Converts the passed Calc cell range list to an Excel cell range list.
Definition: xehelper.cxx:265
void FillFromVclFont(const vcl::Font &rFont)
Fills all members (except color and escapement) from the passed font.
Definition: xlstyle.cxx:204
double mnMaxLength
Maximal length of a databar in percent of cell length Value has to be in the range (0...
Definition: colorscale.hxx:177
XclTokenArrayRef mxTokArr2
Formula for first condition.
Definition: xecontent.cxx:607
static const XclGuid maGuidUrlMoniker
GUID of StdLink (HLINK record).
Definition: xltools.hxx:96
XclExpCfvoList maCfvoList
Definition: xecontent.hxx:287
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:47
bool mbFirst
Definition: xecontent.hxx:206
const sal_uInt16 EXC_WQSETT_SPECTABLES
All tables or entire document.
Definition: xlcontent.hxx:175
const sal_uInt32 EXC_DV_MODE_DECIMAL
Definition: xlcontent.hxx:115
bool mbHeightUsed
true = Any font attribute used.
Definition: xecontent.cxx:613
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:374
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1875
XclExpWebQuery(const OUString &rRangeName, const OUString &rUrl, const OUString &rSource, sal_Int32 nRefrSecs)
Constructs a web query record container with settings from Calc.
Definition: xecontent.cxx:2028
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
Definition: xestream.cxx:217
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:703
const sal_uInt16 EXC_ID_CONDFMT
Definition: xlcontent.hxx:53
const sal_uInt16 EXC_ID_LABELRANGES
Definition: xlcontent.hxx:49
sal_Int16 mnRefresh
List of source range names.
Definition: xecontent.hxx:405
XclExpRecordList< XclExpRecord > maCFList
Definition: xecontent.hxx:242
XclExpCFImplPtr mxImpl
Definition: xecontent.hxx:181
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:147
sal_Int32 nIndex
const sal_uInt8 EXC_CF_CMP_LESS
Definition: xlcontent.hxx:66
const sal_uInt32 EXC_DV_ERROR_STOP
Definition: xlcontent.hxx:135
bool mbBorderUsed
true = Font strikeout used.
Definition: xecontent.cxx:619
ScAddress aStart
Definition: address.hxx:499
const sal_uInt32 EXC_DV_COND_EQGREATER
Definition: xlcontent.hxx:130
const sal_uInt32 EXC_DV_COND_GREATER
Definition: xlcontent.hxx:128
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the DV record.
Definition: xecontent.cxx:1861
static bool GetHTMLNameFromName(const OUString &rSource, OUString &rName)
Converts a built-in range name to an HTML table name.
Definition: ftools.cxx:331
const sal_uInt8 EXC_TOKID_STR
Missing argument.
Definition: xlformula.hxx:74
static bool CheckItem(const SfxItemSet &rItemSet, sal_uInt16 nWhichId, bool bDeep)
Returns true, if the passed item set contains the item.
Definition: ftools.cxx:199
XclExpDV(const XclExpRoot &rRoot, sal_uLong nScHandle)
Definition: xecontent.cxx:1670
bool mbFontUsed
Priority of this entry; needed for oox export.
Definition: xecontent.cxx:612
ScRangeName & GetNamedRanges() const
Returns the defined names container of the Calc document.
Definition: xlroot.cxx:312
sal_uInt8 mnOperator
Type of the condition (cell/formula).
Definition: xecontent.cxx:610
MS Excel binary .xls.
Definition: xlconst.hxx:43
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:291
XclExpStringRef mxQryTables
Source document URL.
Definition: xecontent.hxx:404
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
This class is used to export Excel record streams.
Definition: xestream.hxx:72
SCROW Row() const
Definition: address.hxx:261
static const XclGuid maGuidFileMoniker
GUID of URL moniker (HLINK record).
Definition: xltools.hxx:97
static bool IsHTMLTablesName(const OUString &rSource)
Returns true, if rSource is the built-in range name for all HTML tables.
Definition: ftools.cxx:326
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xerecord.hxx:381
const ScCondDateFormatEntry & mrFormatEntry
Definition: xecontent.hxx:193
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
Definition: xestring.cxx:305
const sal_uInt16 EXC_ID_PQRY
Definition: xlcontent.hxx:158
const sal_uInt32 EXC_HLINK_BODY
Definition: xlcontent.hxx:143
sal_uInt16 GetRawRecPos() const
Returns the position inside of current record (starts by 0 in every CONTINUE).
Definition: xestream.hxx:95
virtual ~XclExpColScaleCol() override
Definition: xecontent.cxx:1245
const sal_uInt16 EXC_ID_EXTSST
Definition: xlcontent.hxx:45
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:347
const sal_uInt8 EXC_CF_TYPE_NONE
Definition: xlcontent.hxx:56
static OUString ToOUString(const char *s)
Definition: xestream.cxx:788
void Format(OUString &, ScRefFlags nFlags, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter=0, bool bFullAddressNotation=false) const
Definition: rangelst.cxx:144
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool mbReverse
Specifies whether the icons should be shown in reverse order.
Definition: colorscale.hxx:338
XclExpDVRef mxLastFoundDV
List of DV records.
Definition: xecontent.hxx:378
ScValidErrorStyle
Definition: validat.hxx:50
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
const sal_uInt32 EXC_HLINK_ABS
Contains file link or URL.
Definition: xlcontent.hxx:144
sal_uIntPtr sal_uLong
XclExpCondFormatBuffer(const XclExpRoot &rRoot, const XclExtLstRef &xExtLst)
Constructs CONDFMT and CF records containing the conditional formats of the current sheet...
Definition: xecontent.cxx:1559
const Color & mrColor
Definition: xecontent.hxx:217
double mnMinLength
Minimal length of a databar in percent of cell length Value has to be in the range [0...
Definition: colorscale.hxx:172
XclExpString maUrl
Destination range.
Definition: xecontent.hxx:403
const sal_uInt8 EXC_CF_CMP_EQUAL
Definition: xlcontent.hxx:63
Conditional format.
Definition: xlformula.hxx:165
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:285
bool FillFromItemSet(const SfxItemSet &rItemSet, XclExpPalette &rPalette, bool bStyle)
Fills the area attributes from the passed item set.
Definition: xestyle.cxx:1887
static bool IsHTMLDocName(const OUString &rSource)
Returns true, if rSource is the built-in range name for an HTML document.
Definition: ftools.cxx:321
const sal_uInt32 EXC_DV_MODE_TIME
Definition: xlcontent.hxx:118
bool mbStrikeUsed
true = Font posture used.
Definition: xecontent.cxx:618
css::uno::Reference< css::frame::XModel3 > GetModel() const
const ObjectTypeFormatEntry & mrEntry
const OUString & GetStyle() const
Definition: conditio.hxx:473
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:89
void SetRecSize(std::size_t nRecSize)
Sets a new record size prediction.
Definition: xerecord.hxx:162
static bool GetStringList(OUString &rStringList, const ScTokenArray &rScTokArr, sal_Unicode cSep)
Parses the passed formula and tries to find a string token list, i.e.
Definition: xlformula.cxx:893
aBuf
sal_uInt32 Insert(XclExpStringRef xString)
Inserts the passed string, if not already inserted, and returns the unique SST index.
Definition: xecontent.cxx:123
sal_uInt16 mnHeight
Font color.
Definition: xlstyle.hxx:290
const sal_uInt8 EXC_CF_CMP_BETWEEN
Definition: xlcontent.hxx:61
sal_uInt64 Seek(sal_uInt64 nPos)
condformat::ScCondFormatDateType GetDateType() const
Definition: conditio.hxx:512
const sal_uInt32 EXC_DV_SHOWERROR
Definition: xlcontent.hxx:109
bool mbEntireDoc
Refresh time in minutes.
Definition: xecontent.hxx:406
XclExpString maDestRange
Definition: xecontent.hxx:402
ScRange Combine() const
Definition: rangelst.cxx:1119
bool mbOnlyBar
If TRUE we only show the bar and not the value.
Definition: colorscale.hxx:182
ScAddress aEnd
Definition: address.hxx:500
bool IsValidForBinary() const
Returns true, if this conditional format contains at least one cell range and CF record.
Definition: xecontent.cxx:1385
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:95
XclFontData maFontData
Top left cell of the combined range.
Definition: xecontent.cxx:603
bool mbColorUsed
true = Font weight used.
Definition: xecontent.cxx:615
Represents a CF record that contains one condition of a conditional format.
Definition: xecontent.cxx:591
const sal_uInt32 EXC_DV_STRINGLIST
Definition: xlcontent.hxx:105
static OUString GetRelURL(OUString const &rTheBaseURIRef, OUString const &rTheAbsURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
sal_uInt16 GetSize() const
Returns the size of the token array in bytes.
Definition: xlformula.cxx:735
const sal_uInt32 EXC_DV_COND_NOTEQUAL
Definition: xlcontent.hxx:127
const ScColorScaleEntry & mrEntry
Definition: xecontent.hxx:204
ScCondFormatDateType
Definition: conditio.hxx:484
const sal_uInt8 EXC_CF_CMP_LESS_EQUAL
Definition: xlcontent.hxx:68
ScRangeList maScRanges
Definition: xecontent.hxx:336
sal_uLong mnScHandle
Miscellaneous flags.
Definition: xecontent.hxx:349
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:286
XclExpCondfmtList maCondfmtList
Definition: xecontent.hxx:305
const sal_uInt32 EXC_DV_COND_LESS
Definition: xlcontent.hxx:129
const sal_uInt32 EXC_DV_COND_EQLESS
Definition: xlcontent.hxx:131
virtual ~XclExpDval() override
Definition: xecontent.cxx:1931
Shared formula.
Definition: xlformula.hxx:164
sal_Int32 mnPriority
Definition: xecontent.hxx:259
const sal_uInt32 EXC_CF_ALLDEFAULT
Any area attribute modified?
Definition: xlcontent.hxx:79
XclExpStringRef mxString1
The error text.
Definition: xecontent.hxx:342
ScConditionMode GetOperation() const
Definition: conditio.hxx:369
const sal_uInt8 EXC_CF_CMP_NONE
Definition: xlcontent.hxx:60
Web query source range.
Definition: xlformula.hxx:170
Extends the XclCellArea struct for export.
Definition: xestyle.hxx:372
size_t size() const
Definition: xladdress.hxx:108
const sal_uInt32 EXC_DV_COND_BETWEEN
Definition: xlcontent.hxx:124
const sal_uInt16 EXC_PQRYTYPE_WEBQUERY
Source type: ODBC.
Definition: xlcontent.hxx:160
const sal_uInt16 EXC_ID_DV
Definition: xlcontent.hxx:102
Base class for ext entries.
Definition: xeextlst.hxx:36
bool mbItalicUsed
true = Font underline type used.
Definition: xecontent.cxx:617
FuncFlags mnFlags
Information about all parameters.
XclExpString maErrorTitle
The prompt text.
Definition: xecontent.hxx:340
const ScTokenArray * GetFormula() const
Definition: colorscale.cxx:215
static const char * getIconSetName(ScIconSetType eType)
const ScRangeList & GetRange() const
Definition: conditio.hxx:559
The formula compiler to create Excel token arrays from Calc token arrays.
Definition: xeformula.hxx:51
const sal_uInt32 EXC_DV_MODE_DATE
Definition: xlcontent.hxx:117
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:254
void InsertCellRange(const ScRange &rRange, sal_uLong nScHandle)
Inserts the cell range into the range list of the DV record with the specified handle.
Definition: xecontent.cxx:1935
Access to global data from other classes.
Definition: xeroot.hxx:112
const sal_uInt32 EXC_DV_MODE_CUSTOM
Definition: xlcontent.hxx:120
OUString getNamespaceURL(sal_Int32 nNSID) const
void SaveXml(XclExpXmlStream &rStrm)
Definition: xecontent.cxx:205
#define INET_FILE_SCHEME
XclExpColScaleCol(const XclExpRoot &rRoot, const Color &rColor)
Definition: xecontent.cxx:1239
static const XclGuid maGuidStdLink
Definition: xltools.hxx:95
void SaveXml(XclExpXmlStream &rStrm)
Definition: xecontent.cxx:1025
ReturnType ulimit_cast(Type nValue, ReturnType nMax)
Returns the value, if it is not greater than nMax, otherwise nMax.
Definition: ftools.hxx:53
sal_uInt16 InsertUniqueName(const OUString &rName, const XclTokenArrayRef &xTokArr, SCTAB nScTab)
Inserts a new defined name.
Definition: xename.cxx:824
OUString maUrl
const sal_uInt16 EXC_ID_MERGEDCELLS
Definition: xlcontent.hxx:32
const sal_uInt8 EXC_CF_TYPE_CELL
Definition: xlcontent.hxx:57
ScIconSetType eIconSetType
Definition: colorscale.hxx:333
int nCount
void WriteArray(XclExpStream &rStrm) const
Writes the tokens of the token array (without size field).
Definition: xlformula.cxx:781
OUString msFormula2
Formula for second condition.
Definition: xecontent.hxx:347
ScColorScaleEntryType GetType() const
Definition: colorscale.hxx:76
const sal_uInt16 EXC_ID_WQTABLES
Definition: xlcontent.hxx:182
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
Definition: xestream.cxx:921
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1149
const sal_uInt16 EXC_FONTESC_NONE
Definition: xlstyle.hxx:125
SvStream & WriteUInt32(sal_uInt32 nUInt32)
ScConditionMode
Definition: conditio.hxx:60
SCTAB Tab() const
Definition: address.hxx:270
const ScCondFormatEntry & mrFormatEntry
Definition: xecontent.cxx:601
const sal_uInt32 EXC_CF_BLOCK_AREA
Border block present?
Definition: xlcontent.hxx:84
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
Definition: xestyle.cxx:766
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1216
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
INetProtocol
ScRangeList maRowRanges
Definition: xecontent.hxx:158
XclExpDataBar(const XclExpRoot &rRoot, const ScDataBarFormat &rFormat, sal_Int32 nPriority, const OString &rGUID)
Definition: xecontent.cxx:1471
bool mbItalic
Underline style.
Definition: xlstyle.hxx:296
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:915
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1111
XclExpCfvo(const XclExpRoot &rRoot, const ScColorScaleEntry &rFormatEntry, const ScAddress &rPos, bool bFirst=true)
Definition: xecontent.cxx:1178
OUString getRelationship(Relationship eRelationship)
void SetCol(SCCOL nColP)
Definition: address.hxx:278
XclExpIconSet(const XclExpRoot &rRoot, const ScIconSetFormat &rFormat, sal_Int32 nPriority)
Definition: xecontent.cxx:1523
XclExpDxfs & GetDxfs() const
Returns the differential formatting list.
Definition: xeroot.cxx:161
size_t size() const
Definition: conditio.cxx:1772
void PopStream()
Definition: xestream.cxx:926
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1249
#define SC_UNONAME_FILTER
Definition: unonames.hxx:365
void SetSliceSize(sal_uInt16 nSize)
Sets data slice length.
Definition: xestream.cxx:131
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
Color maPositiveColor
Color for all Positive Values and if mbNeg == false also for negative ones.
Definition: colorscale.hxx:134
const sal_uInt16 EXC_PQRY_WEBQUERY
ODBC connection.
Definition: xlcontent.hxx:162
sal_uInt32 mnFlags
OOXML Formula for second condition.
Definition: xecontent.hxx:348
virtual ~XclExpSst() override
Definition: xecontent.cxx:240
void SetFinalColors(const XclExpPalette &rPalette)
Fills the mn***Color base members from the mn***ColorId members.
Definition: xestyle.cxx:1905
bool empty() const
Definition: xladdress.hxx:109
ScAddress maOrigin
Calc conditional format entry.
Definition: xecontent.cxx:602
void Save(XclExpStream &rStrm)
Writes the complete SST and EXTSST records.
Definition: xecontent.cxx:154
const sal_uInt32 EXC_CF_AREA_ALL
Background color modified?
Definition: xlcontent.hxx:78
bool mbWeightUsed
true = Font height used.
Definition: xecontent.cxx:614
ScAddress GetValidSrcPos() const
Return a position that's adjusted to allow textual representation of expressions if possible...
Definition: conditio.cxx:1331
std::vector< XclExpStringRef > maStringVector
Definition: xecontent.cxx:107
const sal_uInt32 EXC_CF_FONT_STRIKEOUT
Font posture or weight modified?
Definition: xlcontent.hxx:89
sal_uInt32 mnFontColorId
Formula for second condition.
Definition: xecontent.cxx:608
const sal_uInt16 EXC_ID_DVAL
Font escapement type modified?
Definition: xlcontent.hxx:97
const sal_uInt32 EXC_DV_MODE_LIST
Definition: xlcontent.hxx:116
const sal_uInt32 EXC_CF_BLOCK_BORDER
Alignment block present?
Definition: xlcontent.hxx:83
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the DVAL record.
Definition: xecontent.cxx:2020
sal_Int32 mnPriority
Definition: xecontent.hxx:274
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1579
const ScRangeList & GetRange() const
Definition: colorscale.cxx:437
double mnPriority
const ScFormatEntry * GetEntry(sal_uInt16 nPos) const
Definition: conditio.cxx:1786
::std::vector< XclExpHashEntry > XclExpHashVec
Definition: xecontent.cxx:105
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:285
void SetTab(SCTAB nTabP)
Definition: address.hxx:282
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1420
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
const sal_uInt32 EXC_CF_FONT_STYLE
NumberFormat String or Id?
Definition: xlcontent.hxx:88
XclExpCfvoList maCfvoList
Definition: xecontent.hxx:257
bool IsValidForXml() const
Definition: xecontent.cxx:1395
SC_DLLPUBLIC const ScRangeData * findByRange(const ScRange &rRange) const
Definition: rangenam.cxx:674
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
OUString getFSysPath(FSysStyle eStyle, sal_Unicode *pDelimiter=nullptr) const
bool mbUnderlUsed
true = Font color used.
Definition: xecontent.cxx:616
Extends the XclCellBorder struct for export.
Definition: xestyle.hxx:341
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:215
const sal_uInt8 EXC_CF_CMP_GREATER_EQUAL
Definition: xlcontent.hxx:67
void Assign(const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
Definition: xestring.cxx:111
Represents a CONDFMT record that contains all conditions of a conditional format. ...
Definition: xecontent.hxx:222
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:143
#define SC_UNO_AREALINKS
Definition: unonames.hxx:37
sal_uInt8 mnUnderline
Windows character set.
Definition: xlstyle.hxx:295
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:83
OUString msFormula1
Formula for first condition.
Definition: xecontent.hxx:344
sal_uInt64 GetSvStreamPos() const
Returns the absolute position of the system stream.
Definition: xestream.hxx:140
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
Definition: xestyle.cxx:781
const sal_uInt16 EXC_PQRY_TABLES
Web query.
Definition: xlcontent.hxx:163
int i
virtual void Save(XclExpStream &rStrm) override
Writes the CONDFMT record with following CF records, if there is valid data.
Definition: xecontent.cxx:1400
OUStringBuffer & truncateToLength(OUStringBuffer &rBuffer, sal_Int32 nLength)
OUString GetURLNoMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
XclExpDV & SearchOrCreateDv(sal_uLong nScHandle)
Searches for or creates a XclExpDV record object with the specified handle.
Definition: xecontent.cxx:1980
Manager that stores all internal defined names (NAME records) of the document.
Definition: xename.hxx:31
OString maGUID
Definition: xecontent.hxx:275
sal_Int32 mnType
#define STREAM_SEEK_TO_BEGIN
Contains all records for a web query (linked tables in an HTML document).
Definition: xecontent.hxx:387
OUString GetExpression(const ScAddress &rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt=0, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Definition: conditio.cxx:1240
std::unique_ptr< XclExpColScaleCol > mpCol
Definition: xecontent.hxx:271
const sal_uInt32 EXC_DV_ERROR_WARNING
Definition: xlcontent.hxx:136
XclExpPalette & GetPalette() const
Returns the color buffer.
Definition: xeroot.cxx:107
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
Definition: xestream.cxx:944
void RemoveRecord(size_t nPos)
Removes the record at the specified position from the list.
Definition: xerecord.hxx:368
const OUString & GetOrigName(sal_uInt16 nNameIdx) const
Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names...
Definition: xename.cxx:840
const sal_uInt32 EXC_DV_MODE_TEXTLEN
Definition: xlcontent.hxx:119
const sal_uInt32 EXC_CF_BLOCK_FONT
Font block present?
Definition: xlcontent.hxx:81
ScRangeList maColRanges
Cell range list for row labels.
Definition: xecontent.hxx:159
A 2D cell range address list with Excel column and row indexes.
Definition: xladdress.hxx:100
size_t size() const
Definition: rangelst.hxx:89
void InsertRecord(RecType *pRec, size_t nPos)
Inserts a record at the specified position into the list.
Definition: xerecord.hxx:342
const ScRange & GetRange(sal_uInt16 n) const
Definition: address.hxx:816
float u
const sal_uInt32 EXC_HLINK_MARK
Description.
Definition: xlcontent.hxx:146
const sal_uInt32 EXC_DV_IGNOREBLANK
Definition: xlcontent.hxx:106
void EndRecord()
Checks and corrects real record length.
Definition: xestream.cxx:122
virtual ~XclExpDateFormat() override
Definition: xecontent.cxx:1124
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
const ScIconSetFormatData * GetIconSetData() const
virtual ~XclExpCF() override
Definition: xecontent.cxx:1102
const OUString & GetRepresentation() const
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:143
XclExpWebQueryBuffer(const XclExpRoot &rRoot)
Definition: xecontent.cxx:2137
virtual void Save(XclExpStream &rStrm) override
Writes all needed records for this web query.
Definition: xecontent.cxx:2070
const sal_uInt8 EXC_CF_TYPE_FMLA
Definition: xlcontent.hxx:58
const sal_uInt32 EXC_DV_COND_MASK
Definition: xlcontent.hxx:123
const sal_uInt8 EXC_CF_CMP_GREATER
Definition: xlcontent.hxx:65
bool In(const ScAddress &) const
is Address& in Range?
Definition: address.hxx:732
void FillToCF8(sal_uInt16 &rnPattern, sal_uInt16 &rnColor) const
Fills the data to the passed fields of a BIFF8 CF (conditional format) record.
Definition: xestyle.cxx:1924
OString generateGUIDString()
static SC_DLLPUBLIC OUString addToken(const OUString &rTokenList, std::u16string_view rToken, sal_Unicode cSep, sal_Int32 nSepCount=1, bool bForceSep=false)
Adds the string rToken to rTokenList, using a list separator character.
Definition: global.cxx:657
#define XESTRING_TO_PSZ(s)
Definition: xestream.hxx:232
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1539
void CopyFromStream(SvStream &rInStrm, sal_uInt64 nBytes=STREAM_SEEK_TO_END)
Copies nBytes bytes from current position of the stream rInStrm.
Definition: xestream.cxx:285
std::shared_ptr< FastSerializerHelper > FSHelperPtr
virtual ~XclExpDV() override
Definition: xecontent.cxx:1846
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1162
void AppendNewRecord(RecType *pRec)
Appends a newly created record to the list.
Definition: xerecord.hxx:360
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:416
const sal_uInt32 EXC_CF_FONT_UNDERL
Default flags.
Definition: xlcontent.hxx:92
static void FillRangeList(ScRangeList &rScRanges, const ScRangePairListRef &xLabelRangesRef, SCTAB nScTab)
Fills the specified range list with all label headers of the current sheet.
Definition: xecontent.cxx:562
const sal_uInt32 EXC_CF_BORDER_ALL
Bottom border line modified?
Definition: xlcontent.hxx:74
SCCOL Col() const
Definition: address.hxx:266
void FillToCF8(sal_uInt16 &rnLine, sal_uInt32 &rnColor) const
Fills the data to the passed fields of a BIFF8 CF (conditional format) record.
Definition: xestyle.cxx:1801
XclExpColScaleColList maColList
Definition: xecontent.hxx:258
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:162
bool FillFromItemSet(const SfxItemSet &rItemSet, XclExpPalette &rPalette, XclBiff eBiff, bool bStyle=false)
Fills the border attributes from the passed item set.
Definition: xestyle.cxx:1706
const sal_uInt32 EXC_DV_SUPPRESSDROPDOWN
Definition: xlcontent.hxx:107
ReturnType llimit_cast(Type nValue, ReturnType nMin)
Returns the value, if it is not less than nMin, otherwise nMin.
Definition: ftools.hxx:48
const ScIconSetFormat & mrFormat
Definition: xecontent.hxx:288
const sal_uInt16 EXC_QSI_DEFAULTFLAGS
Definition: xlcontent.hxx:167
const OUString & GetURL() const
XclExpString maErrorText
The error title.
Definition: xecontent.hxx:341
virtual void Save(XclExpStream &rStrm) override
Writes all contained CONDFMT records with their CF records.
Definition: xecontent.cxx:1574
const sal_uInt32 EXC_XFID_NOTFOUND
Special index for "not found" state.
Definition: xlstyle.hxx:142
const sal_uInt16 EXC_ID_SST
Definition: xlcontent.hxx:44
Default string settings.
Provides functions to convert Calc cell addresses to Excel cell addresses.
Definition: xehelper.hxx:81
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const sal_uInt32 EXC_DV_COND_EQUAL
Definition: xlcontent.hxx:126
virtual void Save(XclExpStream &rStrm) override
Writes the record, if it contains at least one merged cell range.
Definition: xecontent.cxx:289
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:332
Binary representation of an Excel token array.
Definition: xlformula.hxx:376
A wrapper for a UNO property set.
Definition: fapihelper.hxx:103
XclExpDateFormat(const XclExpRoot &rRoot, const ScCondDateFormatEntry &rFormatEntry, sal_Int32 nPriority)
Definition: xecontent.cxx:1116
void InsertCellRange(const ScRange &rPos)
Inserts a new cell range into the cell range list.
Definition: xecontent.cxx:1850
std::unique_ptr< char[]> aBuffer
const sal_uInt32 EXC_DV_ERROR_MASK
Definition: xlcontent.hxx:134
void WriteZeroBytesToRecord(std::size_t nBytes)
Definition: xestream.cxx:275
sal_Int32 mnPriority
Definition: xecontent.hxx:289
sal_uInt16 Len() const
Returns the character count of the string.
Definition: xestring.hxx:118
const ScFormatEntry * pEntry
Definition: xeextlst.hxx:30
bool mbPattUsed
true = Border attribute used.
Definition: xecontent.cxx:620
XclExpCellBorder maBorder
Font formatting attributes.
Definition: xecontent.cxx:604
OUString msSeqRef
Cell ranges for this conditional format.
Definition: xecontent.hxx:244
void SetFinalColors(const XclExpPalette &rPalette)
Fills the mn***Color base members from the mn***ColorId members.
Definition: xestyle.cxx:1764
#define SC_UNONAME_LINKURL
Definition: unonames.hxx:367
#define SAL_WARN_IF(condition, area, stream)
XclRangeList maXclRanges
Calc range list with all affected cells.
Definition: xecontent.hxx:337
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:164
virtual ~XclExpCondfmt() override
Definition: xecontent.cxx:1381
unsigned char sal_uInt8
std::unique_ptr< ScColorScaleEntry, o3tl::default_delete< ScColorScaleEntry > > mpUpperLimit
Definition: colorscale.hxx:184
const sal_uInt16 EXC_WQSETT_FORMATFULL
Definition: xlcontent.hxx:179
const OUString & GetStyleName() const
Definition: conditio.hxx:514
void AppendRange(const ScRange &rRange, sal_uInt32 nBaseXFId)
Appends a new range to the list of merged cell ranges.
Definition: xecontent.cxx:266
XclExpColorScale(const XclExpRoot &rRoot, const ScColorScaleFormat &rFormat, sal_Int32 nPriority)
Definition: xecontent.cxx:1436
std::size_t GetSize() const
Returns the byte count the whole string will take on export.
Definition: xestring.cxx:249
virtual ~XclExpWebQuery() override
Definition: xecontent.cxx:2066
sal_Int32 mnPriority
Comparison operator for cell type.
Definition: xecontent.cxx:611
size_t size() const
Definition: rangelst.cxx:1236
Any maOrigin
const sal_uInt16 EXC_ID_QSI
All tables.
Definition: xlcontent.hxx:166
XclRangeList maXclRanges
List of CF records.
Definition: xecontent.hxx:243
bool HasMark() const
INetProtocol GetProtocol() const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1488
Always use UCS-2 characters (default: try to compress). BIFF8 only.
ScRangeList maMergedRanges
Definition: xecontent.hxx:88
Represents a CF record that contains one condition of a conditional format.
Definition: xecontent.hxx:167
sal_uInt16 mnWeight
Font height in twips (1/20 of a point).
Definition: xlstyle.hxx:291
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1453
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
XclExpCellArea maArea
Border formatting attributes.
Definition: xecontent.cxx:605
XclTokenArrayRef CreateFormula(XclFormulaType eType, const ScTokenArray &rScTokArr, const ScAddress *pScBasePos=nullptr, XclExpRefLog *pRefLog=nullptr)
Creates and returns the token array of a formula.
Definition: xeformula.cxx:2641
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:102
virtual void Save(XclExpStream &rStrm) override
Writes the LABELRANGES record if it contains at least one range.
Definition: xecontent.cxx:574
XclExpCondfmt(const XclExpRoot &rRoot, const ScConditionalFormat &rCondFormat, const XclExtLstRef &xExtLst, sal_Int32 &rIndex)
Definition: xecontent.cxx:1292
XclRange GetEnclosingRange() const
Definition: xladdress.cxx:72
const sal_uInt16 EXC_MERGEDCELLS_MAXCOUNT
Definition: xlcontent.hxx:33
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
const sal_uInt8 EXC_CF_CMP_NOT_BETWEEN
Definition: xlcontent.hxx:62
const sal_uInt16 EXC_ID_HLINK
Definition: xlcontent.hxx:141
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the CF record.
Definition: xecontent.cxx:1106
bool mbFormula2
true = Pattern attribute used.
Definition: xecontent.cxx:621
XclTokenArrayRef mxTokArr1
String for first condition formula.
Definition: xecontent.hxx:343
const sal_uInt16 EXC_WQSETT_ALL
Definition: xlcontent.hxx:174
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6092
const sal_uInt8 EXC_CF_CMP_NOT_EQUAL
Definition: xlcontent.hxx:64
ScfUInt32Vec maBaseXFIds
All merged cell ranges of the sheet.
Definition: xecontent.hxx:89
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
sal_uInt32 Insert(const XclExpStringRef &xString)
Inserts a new string into the table.
Definition: xecontent.cxx:244
XclExpLabelranges(const XclExpRoot &rRoot)
Fills the cell range lists with all ranges of the current sheet.
Definition: xecontent.cxx:545
size_t GetSize() const
Definition: xerecord.hxx:326
std::vector< XclExpHashVec > maHashTab
List of unique strings (in SST ID order).
Definition: xecontent.cxx:109
const ScDataBarFormatData * GetDataBarData() const
Definition: colorscale.cxx:735
XclTokenArrayRef mxTokArr1
Pattern formatting attributes.
Definition: xecontent.cxx:606
void StartRecord(sal_uInt16 nRecId, std::size_t nRecSize)
Starts a new record: writes header data, stores calculated record size.
Definition: xestream.cxx:110
const sal_uInt32 EXC_CF_FONT_ALLDEFAULT
Font cancellation modified?
Definition: xlcontent.hxx:90
sal_uInt32 mnTotal
Hashed table that manages string pointers.
Definition: xecontent.cxx:110
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the CONDFMT record.
Definition: xecontent.cxx:1409
void WriteBody(XclExpStream &rStrm)
Writes the body of the CF record.
Definition: xecontent.cxx:723
ScRange & front()
Definition: rangelst.hxx:92
const sal_uInt16 EXC_ID_WQSTRING
Definition: xlcontent.hxx:155
const sal_uInt32 EXC_DV_MODE_MASK
Definition: xlcontent.hxx:112
XclExpCF(const XclExpRoot &rRoot, const ScCondFormatEntry &rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin)
Definition: xecontent.cxx:1095
XclExpMergedcells(const XclExpRoot &rRoot)
Definition: xecontent.cxx:261
OUString GetMark(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const OUString & GetBasePath() const
Returns the base path of the imported/exported file.
Definition: xlroot.hxx:174
Provides export of the data of a DV record.
Definition: xecontent.hxx:314
Color maColor
String with styles (bold, italic).
Definition: xlstyle.hxx:289
#define EXC_WEBQRY_FILTER
UNC path.
Definition: xlcontent.hxx:152
#define SC_UNONAME_REFDELAY
Definition: unonames.hxx:369
std::unique_ptr< ScTokenArray > CreateFlatCopiedTokenArray(sal_uInt16 nPos) const
Create a flat copy using ScTokenArray copy-ctor with shared tokens.
Definition: conditio.cxx:1286
XclExpString maPromptTitle
Excel range list with all affected cells.
Definition: xecontent.hxx:338
XclExpCFImpl(const XclExpRoot &rRoot, const ScCondFormatEntry &rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin)
Definition: xecontent.cxx:624
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
Definition: xlroot.cxx:291
XclTokenArrayRef mxTokArr2
x12ac:list for first condition.
Definition: xecontent.hxx:346
std::unique_ptr< ScColorScaleEntry, o3tl::default_delete< ScColorScaleEntry > > mpLowerLimit
Definition: colorscale.hxx:185
const sal_uInt16 EXC_ID_CF
Definition: xlcontent.hxx:54
std::shared_ptr< XclExpString > XclExpStringRef
Definition: xeroot.hxx:35
virtual void Save(XclExpStream &rStrm) override
Writes the DVAL record and the DV record list.
Definition: xecontent.cxx:1944
const sal_uInt32 EXC_DV_MODE_ANY
Definition: xlcontent.hxx:113
const sal_uInt32 EXC_HLINK_DESCR
Absolute path.
Definition: xlcontent.hxx:145
virtual void Save(XclExpStream &rStrm) override
Writes the complete SST and EXTSST records.
Definition: xecontent.cxx:249
XclExpDVList maDVList
Definition: xecontent.hxx:377
sal_uInt8 mnType
Font color ID.
Definition: xecontent.cxx:609
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
bool IsEmpty() const
Definition: xerecord.hxx:325
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
const sal_uInt32 EXC_SST_HASHTABLE_SIZE
Definition: xecontent.cxx:114
void SvStream & rStrm
bool mbStrikeout
true = Italic.
Definition: xlstyle.hxx:297
XclExpString maPromptText
The prompt title.
Definition: xecontent.hxx:339
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
const sal_uInt32 EXC_DV_ERROR_INFO
Definition: xlcontent.hxx:137
const char * UseIf(const char *s, bool bUse)
const sal_uInt16 EXC_ID_0802
Flags for export.
Definition: xlcontent.hxx:170
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
XclExpDval(const XclExpRoot &rRoot)
Definition: xecontent.cxx:1925
void WriteSubList(XclExpStream &rStrm, size_t nBegin, size_t nCount, bool bCol16Bit=true, sal_uInt16 nCountInStream=0) const
Definition: xladdress.cxx:119
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
bool IsRelUrl() const
Returns true, if URLs should be stored relative to the document location.
Definition: xeroot.hxx:120
bool GetProperty(Type &rValue, const OUString &rPropName) const
Gets the specified property from the property set.
Definition: fapihelper.hxx:148
sc::CompileFormulaContext & GetCompileFormulaContext() const
Definition: xeroot.hxx:121
OUString msList
OOXML Formula for first condition.
Definition: xecontent.hxx:345
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
bool Finalize()
Converts the Calc range list to the Excel range list.
Definition: xecontent.cxx:1855
sal_Int32 mnPriority
Definition: xecontent.hxx:194
std::size_t GetBufferSize() const
Returns the byte count the character buffer will take on export.
Definition: xestring.cxx:244
ScRangePairListRef & GetRowNameRangesRef()
Definition: document.hxx:809
ScAddress maSrcPos
Definition: xecontent.hxx:205
Spreadsheet links in form controls.
Definition: xlformula.hxx:169
sal_uInt32 GetBaseXFId(const ScAddress &rPos) const
Returns the XF identifier of the top-left cell in a merged range.
Definition: xecontent.cxx:275
const sal_uInt32 EXC_DV_MODE_WHOLE
Definition: xlcontent.hxx:114
double GetValue() const
Definition: colorscale.cxx:236
XclExpSstImplPtr mxImpl
Definition: xecontent.hxx:67
const ScDataBarFormat & mrFormat
Definition: xecontent.hxx:273
Base class for single records with any content.
Definition: xerecord.hxx:141
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
const sal_uInt32 EXC_DV_SHOWPROMPT
Definition: xlcontent.hxx:108
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:309
Implementation of the SST export.
Definition: xecontent.cxx:92
const sal_uInt16 EXC_WQSETT_DEFAULTFLAGS
Specific tables.
Definition: xlcontent.hxx:176
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
Definition: xestream.cxx:258
std::unique_ptr< XclExpCfvo > mpCfvoUpperLimit
Definition: xecontent.hxx:270
ScRangePairListRef & GetColNameRangesRef()
Definition: document.hxx:808
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1964
sal_uInt32 mnSize
OUString sId
sal_uInt32 mnSize
Total count of strings (including doubles).
Definition: xecontent.cxx:111
const sal_uInt32 EXC_CF_FONT_ESCAPEM
Font underline type modified?
Definition: xlcontent.hxx:93
std::unique_ptr< XclExpCfvo > mpCfvoLowerLimit
Definition: xecontent.hxx:269