LibreOffice Module sc (master)  1
xlpivot.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 <dpsave.hxx>
21 #include <xestream.hxx>
22 #include <xistream.hxx>
23 #include <xestring.hxx>
24 #include <xlpivot.hxx>
25 #include <generalfunction.hxx>
26 #include <osl/diagnose.h>
27 #include <sal/log.hxx>
28 #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
29 #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
30 #include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
31 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
34 
35 using ::com::sun::star::sheet::DataPilotFieldOrientation;
36 
37 namespace ScDPSortMode = ::com::sun::star::sheet::DataPilotFieldSortMode;
38 namespace ScDPShowItemsMode = ::com::sun::star::sheet::DataPilotFieldShowItemsMode;
39 namespace ScDPLayoutMode = ::com::sun::star::sheet::DataPilotFieldLayoutMode;
40 namespace ScDPRefItemType = ::com::sun::star::sheet::DataPilotFieldReferenceItemType;
41 namespace ScDPGroupBy = ::com::sun::star::sheet::DataPilotFieldGroupBy;
42 
43 // Pivot cache
44 
48 {
49 }
50 
52 {
53 }
54 
56 {
58  maText.clear();
59 }
60 
61 void XclPCItem::SetText( const OUString& rText )
62 {
64  maText = rText;
65 }
66 
67 void XclPCItem::SetDouble( double fValue, const OUString& rText )
68 {
70  maText = rText;
71  mfValue = fValue;
72 }
73 
74 void XclPCItem::SetDateTime( const DateTime& rDateTime, const OUString& rText )
75 {
77  maText = rText;
78  maDateTime = rDateTime;
79 }
80 
81 void XclPCItem::SetInteger( sal_Int16 nValue )
82 {
84  maText = OUString::number(nValue);
85  mnValue = nValue;
86 }
87 
88 void XclPCItem::SetError( sal_uInt16 nError )
89 {
91  maText.clear();
92  mnError = nError;
93  switch( nError )
94  {
95  case 0x00: maText = "#nullptr!"; break;
96  case 0x07: maText = "#DIV/0!"; break;
97  case 0x0F: maText = "#VALUE!"; break;
98  case 0x17: maText = "#REF!"; break;
99  case 0x1D: maText = "#NAME?"; break;
100  case 0x24: maText = "#NUM!"; break;
101  case 0x2A: maText = "#N/A"; break;
102  default: break;
103  }
104 }
105 
106 void XclPCItem::SetBool( bool bValue, const OUString& rText )
107 {
109  maText = rText;
110  mbValue = bValue;
111 }
112 
113 bool XclPCItem::IsEqual( const XclPCItem& rItem ) const
114 {
115  if( meType == rItem.meType ) switch( meType )
116  {
117  case EXC_PCITEM_INVALID: return true;
118  case EXC_PCITEM_EMPTY: return true;
119  case EXC_PCITEM_TEXT: return maText == rItem.maText;
120  case EXC_PCITEM_DOUBLE: return mfValue == rItem.mfValue;
121  case EXC_PCITEM_DATETIME: return maDateTime == rItem.maDateTime;
122  case EXC_PCITEM_INTEGER: return mnValue == rItem.mnValue;
123  case EXC_PCITEM_BOOL: return mbValue == rItem.mbValue;
124  case EXC_PCITEM_ERROR: return mnError == rItem.mnError;
125  default: OSL_FAIL( "XclPCItem::IsEqual - unknown pivot cache item type" );
126  }
127  return false;
128 }
129 
130 bool XclPCItem::IsEmpty() const
131 {
132  return meType == EXC_PCITEM_EMPTY;
133 }
134 
135 const OUString* XclPCItem::GetText() const
136 {
137  return (meType == EXC_PCITEM_TEXT || meType == EXC_PCITEM_ERROR) ? &maText : nullptr;
138 }
139 
140 const double* XclPCItem::GetDouble() const
141 {
142  return (meType == EXC_PCITEM_DOUBLE) ? &mfValue : nullptr;
143 }
144 
146 {
147  return (meType == EXC_PCITEM_DATETIME) ? &maDateTime : nullptr;
148 }
149 
150 const sal_Int16* XclPCItem::GetInteger() const
151 {
152  return (meType == EXC_PCITEM_INTEGER) ? &mnValue : nullptr;
153 }
154 
155 const sal_uInt16* XclPCItem::GetError() const
156 {
157  return (meType == EXC_PCITEM_ERROR) ? &mnError : nullptr;
158 }
159 
160 const bool* XclPCItem::GetBool() const
161 {
162  return (meType == EXC_PCITEM_BOOL) ? &mbValue : nullptr;
163 }
164 
166 {
167  return meType;
168 }
169 
170 // Field settings =============================================================
171 
173  mnFlags( 0 ),
174  mnGroupChild( 0 ),
175  mnGroupBase( 0 ),
176  mnVisItems( 0 ),
177  mnGroupItems( 0 ),
178  mnBaseItems( 0 ),
179  mnOrigItems( 0 )
180 {
181 }
182 
184 {
185  rInfo.mnFlags = rStrm.ReaduInt16();
186  rInfo.mnGroupChild = rStrm.ReaduInt16();
187  rInfo.mnGroupBase = rStrm.ReaduInt16();
188  rInfo.mnVisItems = rStrm.ReaduInt16();
189  rInfo.mnGroupItems = rStrm.ReaduInt16();
190  rInfo.mnBaseItems = rStrm.ReaduInt16();
191  rInfo.mnOrigItems = rStrm.ReaduInt16();
192  if( rStrm.GetRecLeft() >= 3 )
193  rInfo.maName = rStrm.ReadUniString();
194  else
195  rInfo.maName.clear();
196  return rStrm;
197 }
198 
200 {
201  return rStrm
202  << rInfo.mnFlags
203  << rInfo.mnGroupChild
204  << rInfo.mnGroupBase
205  << rInfo.mnVisItems
206  << rInfo.mnGroupItems
207  << rInfo.mnBaseItems
208  << rInfo.mnOrigItems
209  << XclExpString( rInfo.maName );
210 }
211 
212 // Numeric grouping field settings ============================================
213 
216 {
217  SetNumType();
218 }
219 
221 {
223 }
224 
226 {
227  sal_Int32 nScType = 0;
228  switch( GetXclDataType() )
229  {
230  case EXC_SXNUMGROUP_TYPE_SEC: nScType = ScDPGroupBy::SECONDS; break;
231  case EXC_SXNUMGROUP_TYPE_MIN: nScType = ScDPGroupBy::MINUTES; break;
232  case EXC_SXNUMGROUP_TYPE_HOUR: nScType = ScDPGroupBy::HOURS; break;
233  case EXC_SXNUMGROUP_TYPE_DAY: nScType = ScDPGroupBy::DAYS; break;
234  case EXC_SXNUMGROUP_TYPE_MONTH: nScType = ScDPGroupBy::MONTHS; break;
235  case EXC_SXNUMGROUP_TYPE_QUART: nScType = ScDPGroupBy::QUARTERS; break;
236  case EXC_SXNUMGROUP_TYPE_YEAR: nScType = ScDPGroupBy::YEARS; break;
237  default: SAL_WARN("sc.filter", "XclPCNumGroupInfo::GetScDateType - unexpected date type " << GetXclDataType() );
238  }
239  return nScType;
240 }
241 
242 void XclPCNumGroupInfo::SetScDateType( sal_Int32 nScType )
243 {
244  sal_uInt16 nXclType = EXC_SXNUMGROUP_TYPE_NUM;
245  switch( nScType )
246  {
247  case ScDPGroupBy::SECONDS: nXclType = EXC_SXNUMGROUP_TYPE_SEC; break;
248  case ScDPGroupBy::MINUTES: nXclType = EXC_SXNUMGROUP_TYPE_MIN; break;
249  case ScDPGroupBy::HOURS: nXclType = EXC_SXNUMGROUP_TYPE_HOUR; break;
250  case ScDPGroupBy::DAYS: nXclType = EXC_SXNUMGROUP_TYPE_DAY; break;
251  case ScDPGroupBy::MONTHS: nXclType = EXC_SXNUMGROUP_TYPE_MONTH; break;
252  case ScDPGroupBy::QUARTERS: nXclType = EXC_SXNUMGROUP_TYPE_QUART; break;
253  case ScDPGroupBy::YEARS: nXclType = EXC_SXNUMGROUP_TYPE_YEAR; break;
254  default:
255  SAL_INFO("sc.filter", "unexpected date type " << nScType);
256  }
257  SetXclDataType( nXclType );
258 }
259 
261 {
262  return ::extract_value< sal_uInt16 >( mnFlags, 2, 4 );
263 }
264 
265 void XclPCNumGroupInfo::SetXclDataType( sal_uInt16 nXclType )
266 {
267  ::insert_value( mnFlags, nXclType, 2, 4 );
268 }
269 
271 {
272  rInfo.mnFlags = rStrm.ReaduInt16();
273  return rStrm;
274 }
275 
277 {
278  return rStrm << rInfo.mnFlags;
279 }
280 
281 // Base class for pivot cache fields ==========================================
282 
283 XclPCField::XclPCField( XclPCFieldType eFieldType, sal_uInt16 nFieldIdx ) :
284  meFieldType( eFieldType ),
285  mnFieldIdx( nFieldIdx )
286 {
287 }
288 
290 {
291 }
292 
294 {
296 }
297 
299 {
301 }
302 
304 {
306 }
307 
309 {
311 }
312 
314 {
316 }
317 
319 {
321 }
322 
324 {
326 }
327 
329 {
331 }
332 
334 {
336 }
337 
339 {
340  return (IsStandardField() || IsGroupField()) && ((maFieldInfo.mnGroupItems > 0) || (maFieldInfo.mnOrigItems > 0));
341 }
342 
344 {
346 }
347 
349 {
351 }
352 
353 // Pivot cache settings =======================================================
354 
357  mnSrcRecs( 0 ),
358  mnStrmId( 0xFFFF ),
360  mnBlockRecs( EXC_SXDB_BLOCKRECS ),
361  mnStdFields( 0 ),
362  mnTotalFields( 0 ),
363  mnSrcType( EXC_SXDB_SRC_SHEET )
364 {
365 }
366 
368 {
369  rInfo.mnSrcRecs = rStrm.ReaduInt32();
370  rInfo.mnStrmId = rStrm.ReaduInt16();
371  rInfo.mnFlags = rStrm.ReaduInt16();
372  rInfo.mnBlockRecs = rStrm.ReaduInt16();
373  rInfo.mnStdFields = rStrm.ReaduInt16();
374  rInfo.mnTotalFields = rStrm.ReaduInt16();
375  rStrm.Ignore( 2 );
376  rInfo.mnSrcType = rStrm.ReaduInt16();
377  rInfo.maUserName = rStrm.ReadUniString();
378  return rStrm;
379 }
380 
382 {
383  return rStrm
384  << rInfo.mnSrcRecs
385  << rInfo.mnStrmId
386  << rInfo.mnFlags
387  << rInfo.mnBlockRecs
388  << rInfo.mnStdFields
389  << rInfo.mnTotalFields
390  << sal_uInt16( 0 )
391  << rInfo.mnSrcType
392  << XclExpString( rInfo.maUserName );
393 }
394 
395 // Pivot table
396 
397 // cached name ================================================================
398 
400 {
401  sal_uInt16 nStrLen;
402  nStrLen = rStrm.ReaduInt16();
403  rCachedName.mbUseCache = nStrLen == EXC_PT_NOSTRING;
404  if( rCachedName.mbUseCache )
405  rCachedName.maName.clear();
406  else
407  rCachedName.maName = rStrm.ReadUniString( nStrLen );
408  return rStrm;
409 }
410 
411 XclExpStream& operator<<( XclExpStream& rStrm, const XclPTCachedName& rCachedName )
412 {
413  if( rCachedName.mbUseCache )
414  rStrm << EXC_PT_NOSTRING;
415  else
416  rStrm << XclExpString( rCachedName.maName, XclStrFlags::NONE, EXC_PT_MAXSTRLEN );
417  return rStrm;
418 }
419 
420 const OUString* XclPTVisNameInfo::GetVisName() const
421 {
422  return HasVisName() ? &maVisName.maName : nullptr;
423 }
424 
425 void XclPTVisNameInfo::SetVisName( const OUString& rName )
426 {
427  maVisName.maName = rName;
428  maVisName.mbUseCache = rName.isEmpty();
429 }
430 
431 // Field item settings ========================================================
432 
436  mnCacheIdx( EXC_SXVI_DEFAULT_CACHE )
437 {
438 }
439 
441 {
442  rInfo.mnType = rStrm.ReaduInt16();
443  rInfo.mnFlags = rStrm.ReaduInt16();
444  rInfo.mnCacheIdx = rStrm.ReaduInt16();
445  rStrm >> rInfo.maVisName;
446  return rStrm;
447 }
448 
450 {
451  return rStrm
452  << rInfo.mnType
453  << rInfo.mnFlags
454  << rInfo.mnCacheIdx
455  << rInfo.maVisName;
456 }
457 
458 // General field settings =====================================================
459 
461  mnAxes( EXC_SXVD_AXIS_NONE ),
462  mnSubtCount( 1 ),
463  mnSubtotals( EXC_SXVD_SUBT_DEFAULT ),
464  mnItemCount( 0 ),
465  mnCacheIdx( EXC_SXVD_DEFAULT_CACHE )
466 {
467 }
468 
469 DataPilotFieldOrientation XclPTFieldInfo::GetApiOrient( sal_uInt16 nMask ) const
470 {
471  using namespace ::com::sun::star::sheet;
472  DataPilotFieldOrientation eOrient = DataPilotFieldOrientation_HIDDEN;
473  sal_uInt16 nUsedAxes = mnAxes & nMask;
474  if( nUsedAxes & EXC_SXVD_AXIS_ROW )
475  eOrient = DataPilotFieldOrientation_ROW;
476  else if( nUsedAxes & EXC_SXVD_AXIS_COL )
477  eOrient = DataPilotFieldOrientation_COLUMN;
478  else if( nUsedAxes & EXC_SXVD_AXIS_PAGE )
479  eOrient = DataPilotFieldOrientation_PAGE;
480  else if( nUsedAxes & EXC_SXVD_AXIS_DATA )
481  eOrient = DataPilotFieldOrientation_DATA;
482  return eOrient;
483 }
484 
485 void XclPTFieldInfo::AddApiOrient( DataPilotFieldOrientation eOrient )
486 {
487  using namespace ::com::sun::star::sheet;
488  switch( eOrient )
489  {
490  case DataPilotFieldOrientation_ROW: mnAxes |= EXC_SXVD_AXIS_ROW; break;
491  case DataPilotFieldOrientation_COLUMN: mnAxes |= EXC_SXVD_AXIS_COL; break;
492  case DataPilotFieldOrientation_PAGE: mnAxes |= EXC_SXVD_AXIS_PAGE; break;
493  case DataPilotFieldOrientation_DATA: mnAxes |= EXC_SXVD_AXIS_DATA; break;
494  default:;
495  }
496 }
497 
498 //TODO: should be a Sequence<GeneralFunction> in ScDPSaveData
500 {
501  rSubtotals.clear();
502  rSubtotals.reserve( 16 );
503 
504  if( mnSubtotals & EXC_SXVD_SUBT_DEFAULT ) rSubtotals.push_back( ScGeneralFunction::AUTO );
505  if( mnSubtotals & EXC_SXVD_SUBT_SUM ) rSubtotals.push_back( ScGeneralFunction::SUM );
506  if( mnSubtotals & EXC_SXVD_SUBT_COUNT ) rSubtotals.push_back( ScGeneralFunction::COUNT );
507  if( mnSubtotals & EXC_SXVD_SUBT_AVERAGE ) rSubtotals.push_back( ScGeneralFunction::AVERAGE );
508  if( mnSubtotals & EXC_SXVD_SUBT_MAX ) rSubtotals.push_back( ScGeneralFunction::MAX );
509  if( mnSubtotals & EXC_SXVD_SUBT_MIN ) rSubtotals.push_back( ScGeneralFunction::MIN );
510  if( mnSubtotals & EXC_SXVD_SUBT_PROD ) rSubtotals.push_back( ScGeneralFunction::PRODUCT );
511  if( mnSubtotals & EXC_SXVD_SUBT_COUNTNUM ) rSubtotals.push_back( ScGeneralFunction::COUNTNUMS );
512  if( mnSubtotals & EXC_SXVD_SUBT_STDDEV ) rSubtotals.push_back( ScGeneralFunction::STDEV );
513  if( mnSubtotals & EXC_SXVD_SUBT_STDDEVP ) rSubtotals.push_back( ScGeneralFunction::STDEVP );
514  if( mnSubtotals & EXC_SXVD_SUBT_VAR ) rSubtotals.push_back( ScGeneralFunction::VAR );
515  if( mnSubtotals & EXC_SXVD_SUBT_VARP ) rSubtotals.push_back( ScGeneralFunction::VARP );
516 }
517 
519 {
521  for( const auto& rSubtotal : rSubtotals )
522  {
523  switch( rSubtotal )
524  {
537  default: break;
538  }
539  }
540 
541  mnSubtCount = 0;
542  for( sal_uInt16 nMask = 0x8000; nMask; nMask >>= 1 )
543  if( mnSubtotals & nMask )
544  ++mnSubtCount;
545 }
546 
548 {
549  // rInfo.mnCacheIdx is not part of the SXVD record
550  rInfo.mnAxes = rStrm.ReaduInt16();
551  rInfo.mnSubtCount = rStrm.ReaduInt16();
552  rInfo.mnSubtotals = rStrm.ReaduInt16();
553  rInfo.mnItemCount = rStrm.ReaduInt16();
554  rStrm >> rInfo.maVisName;
555  return rStrm;
556 }
557 
559 {
560  // rInfo.mnCacheIdx is not part of the SXVD record
561  return rStrm
562  << rInfo.mnAxes
563  << rInfo.mnSubtCount
564  << rInfo.mnSubtotals
565  << rInfo.mnItemCount
566  << rInfo.maVisName;
567 }
568 
569 // Extended field settings ====================================================
570 
573  mnSortField( EXC_SXVDEX_SORT_OWN ),
574  mnShowField( EXC_SXVDEX_SHOW_NONE ),
575  mnNumFmt(0)
576 {
577 }
578 
580 {
581  sal_Int32 nSortMode = ScDPSortMode::MANUAL;
582  if( ::get_flag( mnFlags, EXC_SXVDEX_SORT ) )
583  nSortMode = (mnSortField == EXC_SXVDEX_SORT_OWN) ? ScDPSortMode::NAME : ScDPSortMode::DATA;
584  return nSortMode;
585 }
586 
587 void XclPTFieldExtInfo::SetApiSortMode( sal_Int32 nSortMode )
588 {
589  bool bSort = (nSortMode == ScDPSortMode::NAME) || (nSortMode == ScDPSortMode::DATA);
591  if( nSortMode == ScDPSortMode::NAME )
592  mnSortField = EXC_SXVDEX_SORT_OWN; // otherwise sort field has to be set by caller
593 }
594 
596 {
598  ScDPShowItemsMode::FROM_TOP, ScDPShowItemsMode::FROM_BOTTOM );
599 }
600 
601 void XclPTFieldExtInfo::SetApiAutoShowMode( sal_Int32 nShowMode )
602 {
603  ::set_flag( mnFlags, EXC_SXVDEX_AUTOSHOW_ASC, nShowMode == ScDPShowItemsMode::FROM_TOP );
604 }
605 
607 {
608  return ::extract_value< sal_Int32 >( mnFlags, 24, 8 );
609 }
610 
611 void XclPTFieldExtInfo::SetApiAutoShowCount( sal_Int32 nShowCount )
612 {
613  ::insert_value( mnFlags, limit_cast< sal_uInt8 >( nShowCount ), 24, 8 );
614 }
615 
617 {
618  sal_Int32 nLayoutMode = ScDPLayoutMode::TABULAR_LAYOUT;
620  nLayoutMode = ::get_flag( mnFlags, EXC_SXVDEX_LAYOUT_TOP ) ?
621  ScDPLayoutMode::OUTLINE_SUBTOTALS_TOP : ScDPLayoutMode::OUTLINE_SUBTOTALS_BOTTOM;
622  return nLayoutMode;
623 }
624 
625 void XclPTFieldExtInfo::SetApiLayoutMode( sal_Int32 nLayoutMode )
626 {
627  ::set_flag( mnFlags, EXC_SXVDEX_LAYOUT_REPORT, nLayoutMode != ScDPLayoutMode::TABULAR_LAYOUT );
628  ::set_flag( mnFlags, EXC_SXVDEX_LAYOUT_TOP, nLayoutMode == ScDPLayoutMode::OUTLINE_SUBTOTALS_TOP );
629 }
630 
632 {
633  sal_uInt8 nNameLen = 0;
634  rInfo.mnFlags = rStrm.ReaduInt32();
635  rInfo.mnSortField = rStrm.ReaduInt16();
636  rInfo.mnShowField = rStrm.ReaduInt16();
637  rInfo.mnNumFmt = rStrm.ReaduInt16();
638  nNameLen = rStrm.ReaduInt8();
639 
640  rStrm.Ignore(10);
641  if (nNameLen != 0xFF)
642  // Custom field total name is used. Pick it up.
643  rInfo.mpFieldTotalName = rStrm.ReadUniString(nNameLen, 0);
644 
645  return rStrm;
646 }
647 
649 {
650  rStrm << rInfo.mnFlags
651  << rInfo.mnSortField
652  << rInfo.mnShowField
654 
655  if (rInfo.mpFieldTotalName && !rInfo.mpFieldTotalName->isEmpty())
656  {
657  OUString aFinalName = *rInfo.mpFieldTotalName;
658  if (aFinalName.getLength() >= 254)
659  aFinalName = aFinalName.copy(0, 254);
660  sal_uInt8 nNameLen = static_cast<sal_uInt8>(aFinalName.getLength());
661  rStrm << nNameLen;
662  rStrm.WriteZeroBytes(10);
663  rStrm << XclExpString(aFinalName, XclStrFlags::NoHeader);
664  }
665  else
666  {
667  rStrm << sal_uInt16(0xFFFF);
668  rStrm.WriteZeroBytes(8);
669  }
670  return rStrm;
671 }
672 
673 // Page field settings ========================================================
674 
676  mnField( 0 ),
677  mnSelItem( EXC_SXPI_ALLITEMS ),
678  mnObjId( 0xFFFF )
679 {
680 }
681 
683 {
684  rInfo.mnField = rStrm.ReaduInt16();
685  rInfo.mnSelItem = rStrm.ReaduInt16();
686  rInfo.mnObjId = rStrm.ReaduInt16();
687  return rStrm;
688 }
689 
691 {
692  return rStrm
693  << rInfo.mnField
694  << rInfo.mnSelItem
695  << rInfo.mnObjId;
696 }
697 
698 // Data field settings ========================================================
699 
701  mnField( 0 ),
702  mnAggFunc( EXC_SXDI_FUNC_SUM ),
703  mnRefType( EXC_SXDI_REF_NORMAL ),
704  mnRefField( 0 ),
705  mnRefItem( 0 ),
706  mnNumFmt( 0 )
707 {
708 }
709 
711 {
712  ScGeneralFunction eAggFunc;
713  switch( mnAggFunc )
714  {
715  case EXC_SXDI_FUNC_SUM: eAggFunc = ScGeneralFunction::SUM; break;
716  case EXC_SXDI_FUNC_COUNT: eAggFunc = ScGeneralFunction::COUNT; break;
717  case EXC_SXDI_FUNC_AVERAGE: eAggFunc = ScGeneralFunction::AVERAGE; break;
718  case EXC_SXDI_FUNC_MAX: eAggFunc = ScGeneralFunction::MAX; break;
719  case EXC_SXDI_FUNC_MIN: eAggFunc = ScGeneralFunction::MIN; break;
720  case EXC_SXDI_FUNC_PRODUCT: eAggFunc = ScGeneralFunction::PRODUCT; break;
722  case EXC_SXDI_FUNC_STDDEV: eAggFunc = ScGeneralFunction::STDEV; break;
723  case EXC_SXDI_FUNC_STDDEVP: eAggFunc = ScGeneralFunction::STDEVP; break;
724  case EXC_SXDI_FUNC_VAR: eAggFunc = ScGeneralFunction::VAR; break;
725  case EXC_SXDI_FUNC_VARP: eAggFunc = ScGeneralFunction::VARP; break;
726  default: eAggFunc = ScGeneralFunction::SUM;
727  }
728  return eAggFunc;
729 }
730 
732 {
733  switch( eAggFunc )
734  {
746  default: mnAggFunc = EXC_SXDI_FUNC_SUM;
747  }
748 }
749 
751 {
752  namespace ScDPRefType = ::com::sun::star::sheet::DataPilotFieldReferenceType;
753  sal_Int32 nRefType;
754  switch( mnRefType )
755  {
756  case EXC_SXDI_REF_DIFF: nRefType = ScDPRefType::ITEM_DIFFERENCE; break;
757  case EXC_SXDI_REF_PERC: nRefType = ScDPRefType::ITEM_PERCENTAGE; break;
758  case EXC_SXDI_REF_PERC_DIFF: nRefType = ScDPRefType::ITEM_PERCENTAGE_DIFFERENCE; break;
759  case EXC_SXDI_REF_RUN_TOTAL: nRefType = ScDPRefType::RUNNING_TOTAL; break;
760  case EXC_SXDI_REF_PERC_ROW: nRefType = ScDPRefType::ROW_PERCENTAGE; break;
761  case EXC_SXDI_REF_PERC_COL: nRefType = ScDPRefType::COLUMN_PERCENTAGE; break;
762  case EXC_SXDI_REF_PERC_TOTAL: nRefType = ScDPRefType::TOTAL_PERCENTAGE; break;
763  case EXC_SXDI_REF_INDEX: nRefType = ScDPRefType::INDEX; break;
764  default: nRefType = ScDPRefType::NONE;
765  }
766  return nRefType;
767 }
768 
769 void XclPTDataFieldInfo::SetApiRefType( sal_Int32 nRefType )
770 {
771  namespace ScDPRefType = ::com::sun::star::sheet::DataPilotFieldReferenceType;
772  switch( nRefType )
773  {
774  case ScDPRefType::ITEM_DIFFERENCE: mnRefType = EXC_SXDI_REF_DIFF; break;
775  case ScDPRefType::ITEM_PERCENTAGE: mnRefType = EXC_SXDI_REF_PERC; break;
776  case ScDPRefType::ITEM_PERCENTAGE_DIFFERENCE: mnRefType = EXC_SXDI_REF_PERC_DIFF; break;
777  case ScDPRefType::RUNNING_TOTAL: mnRefType = EXC_SXDI_REF_RUN_TOTAL; break;
778  case ScDPRefType::ROW_PERCENTAGE: mnRefType = EXC_SXDI_REF_PERC_ROW; break;
779  case ScDPRefType::COLUMN_PERCENTAGE: mnRefType = EXC_SXDI_REF_PERC_COL; break;
780  case ScDPRefType::TOTAL_PERCENTAGE: mnRefType = EXC_SXDI_REF_PERC_TOTAL;break;
781  case ScDPRefType::INDEX: mnRefType = EXC_SXDI_REF_INDEX; break;
782  default: mnRefType = EXC_SXDI_REF_NORMAL;
783  }
784 }
785 
787 {
788  sal_Int32 nRefItemType;
789  switch( mnRefItem )
790  {
791  case EXC_SXDI_PREVITEM: nRefItemType = ScDPRefItemType::PREVIOUS; break;
792  case EXC_SXDI_NEXTITEM: nRefItemType = ScDPRefItemType::NEXT; break;
793  default: nRefItemType = ScDPRefItemType::NAMED;
794  }
795  return nRefItemType;
796 }
797 
798 void XclPTDataFieldInfo::SetApiRefItemType( sal_Int32 nRefItemType )
799 {
800  switch( nRefItemType )
801  {
802  case ScDPRefItemType::PREVIOUS: mnRefItem = EXC_SXDI_PREVITEM; break;
803  case ScDPRefItemType::NEXT: mnRefItem = EXC_SXDI_NEXTITEM; break;
804  // nothing for named item reference
805  }
806 }
807 
809 {
810  rInfo.mnField = rStrm.ReaduInt16();
811  rInfo.mnAggFunc = rStrm.ReaduInt16();
812  rInfo.mnRefType = rStrm.ReaduInt16();
813  rInfo.mnRefField = rStrm.ReaduInt16();
814  rInfo.mnRefItem = rStrm.ReaduInt16();
815  rInfo.mnNumFmt = rStrm.ReaduInt16();
816  rStrm >> rInfo.maVisName;
817  return rStrm;
818 }
819 
821 {
822  return rStrm
823  << rInfo.mnField
824  << rInfo.mnAggFunc
825  << rInfo.mnRefType
826  << rInfo.mnRefField
827  << rInfo.mnRefItem
828  << rInfo.mnNumFmt
829  << rInfo.maVisName;
830 }
831 
832 // Pivot table settings =======================================================
833 
835  mnFirstHeadRow( 0 ),
836  mnCacheIdx( 0xFFFF ),
837  mnDataAxis( EXC_SXVD_AXIS_NONE ),
838  mnDataPos( EXC_SXVIEW_DATALAST ),
839  mnFields( 0 ),
840  mnRowFields( 0 ),
841  mnColFields( 0 ),
842  mnPageFields( 0 ),
843  mnDataFields( 0 ),
844  mnDataRows( 0 ),
845  mnDataCols( 0 ),
847  mnAutoFmtIdx( EXC_SXVIEW_AUTOFMT )
848 {
849 }
850 
852 {
853  sal_uInt16 nTabLen, nDataLen;
854 
855  rStrm >> rInfo.maOutXclRange;
856  rInfo.mnFirstHeadRow = rStrm.ReaduInt16();
857  rStrm >> rInfo.maDataXclPos;
858  rInfo.mnCacheIdx = rStrm.ReaduInt16();
859  rStrm.Ignore( 2 );
860  rInfo.mnDataAxis = rStrm.ReaduInt16();
861  rInfo.mnDataPos = rStrm.ReaduInt16();
862  rInfo.mnFields = rStrm.ReaduInt16();
863  rInfo.mnRowFields = rStrm.ReaduInt16();
864  rInfo.mnColFields = rStrm.ReaduInt16();
865  rInfo.mnPageFields = rStrm.ReaduInt16();
866  rInfo.mnDataFields = rStrm.ReaduInt16();
867  rInfo.mnDataRows = rStrm.ReaduInt16();
868  rInfo.mnDataCols = rStrm.ReaduInt16();
869  rInfo.mnFlags = rStrm.ReaduInt16();
870  rInfo.mnAutoFmtIdx = rStrm.ReaduInt16();
871  nTabLen = rStrm.ReaduInt16();
872  nDataLen = rStrm.ReaduInt16();
873  rInfo.maTableName = rStrm.ReadUniString( nTabLen );
874  rInfo.maDataName = rStrm.ReadUniString( nDataLen );
875  return rStrm;
876 }
877 
879 {
880  XclExpString aXclTableName( rInfo.maTableName );
881  XclExpString aXclDataName( rInfo.maDataName );
882 
883  rStrm << rInfo.maOutXclRange
884  << rInfo.mnFirstHeadRow
885  << rInfo.maDataXclPos
886  << rInfo.mnCacheIdx
887  << sal_uInt16( 0 )
888  << rInfo.mnDataAxis << rInfo.mnDataPos
889  << rInfo.mnFields
890  << rInfo.mnRowFields << rInfo.mnColFields
891  << rInfo.mnPageFields << rInfo.mnDataFields
892  << rInfo.mnDataRows << rInfo.mnDataCols
893  << rInfo.mnFlags
894  << rInfo.mnAutoFmtIdx
895  << aXclTableName.Len() << aXclDataName.Len();
896  aXclTableName.WriteFlagField( rStrm );
897  aXclTableName.WriteBuffer( rStrm );
898  aXclDataName.WriteFlagField( rStrm );
899  aXclDataName.WriteBuffer( rStrm );
900  return rStrm;
901 }
902 
903 // Extended pivot table settings ==============================================
904 
906  mnSxformulaRecs( 0 ),
907  mnSxselectRecs( 0 ),
908  mnPagePerRow( 0 ),
909  mnPagePerCol( 0 ),
911 {
912 }
913 
915 {
916  rInfo.mnSxformulaRecs = rStrm.ReaduInt16();
917  rStrm.Ignore( 6 );
918  rInfo.mnSxselectRecs = rStrm.ReaduInt16();
919  rInfo.mnPagePerRow = rStrm.ReaduInt16();
920  rInfo.mnPagePerCol = rStrm.ReaduInt16();
921  rInfo.mnFlags = rStrm.ReaduInt32();
922  return rStrm;
923 }
924 
926 {
927  return rStrm
928  << rInfo.mnSxformulaRecs
929  << EXC_PT_NOSTRING // length of alt. error text
930  << EXC_PT_NOSTRING // length of alt. empty text
931  << EXC_PT_NOSTRING // length of tag
932  << rInfo.mnSxselectRecs
933  << rInfo.mnPagePerRow
934  << rInfo.mnPagePerCol
935  << rInfo.mnFlags
936  << EXC_PT_NOSTRING // length of page field style name
937  << EXC_PT_NOSTRING // length of table style name
938  << EXC_PT_NOSTRING; // length of vacate style name
939 }
940 
941 // Pivot table autoformat settings ============================================
942 
970  mbReport( 0 ),
971  mnAutoFormat( 0 ),
972  mnGridLayout( 0x10 )
973 {
974 }
975 
976 void XclPTViewEx9Info::Init( const ScDPObject& rDPObj )
977 {
978  if( rDPObj.GetHeaderLayout() )
979  {
980  mbReport = 0;
981  mnAutoFormat = 1;
982  mnGridLayout = 0;
983  }
984  else
985  {
986  // Report1 for now
987  // TODO : sync with autoformat indices
988  mbReport = 2;
989  mnAutoFormat = 1;
990  mnGridLayout = 0x10;
991  }
992 
993  const ScDPSaveData* pData = rDPObj.GetSaveData();
994  if (pData)
995  {
996  const std::optional<OUString> & pGrandTotal = pData->GetGrandTotalName();
997  if (pGrandTotal)
998  maGrandTotalName = *pGrandTotal;
999  }
1000 }
1001 
1003 {
1004  rStrm.Ignore( 2 );
1005  rInfo.mbReport = rStrm.ReaduInt32();
1006  rStrm.Ignore( 6 );
1007  rInfo.mnAutoFormat = rStrm.ReaduInt8();
1008  rInfo.mnGridLayout = rStrm.ReaduInt8();
1009  rInfo.maGrandTotalName = rStrm.ReadUniString();
1010  return rStrm;
1011 }
1012 
1014 {
1015  return rStrm
1017  << rInfo.mbReport
1020  << rInfo.mnAutoFormat
1021  << rInfo.mnGridLayout
1023 }
1024 
1026  mbCompactMode(false)
1027 {
1028 }
1029 
1031 {
1032  rStrm.Ignore(4);
1033  sal_uInt8 sxc = rStrm.ReaduInt8();
1034  sal_uInt8 sxd = rStrm.ReaduInt8();
1035  if(sxc == 0x00 && sxd == 0x19) // SxcView / sxdVer12Info
1036  {
1037  sal_uInt32 nFlags = rStrm.ReaduInt32();
1038  rInfo.mbCompactMode = ((nFlags & 0x00000008) != 0);
1039  }
1040  return rStrm;
1041 }
1042 
1043 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 mnFlags
Definition: xlpivot.hxx:623
const sal_uInt16 EXC_SXDI_REF_RUN_TOTAL
Definition: xlpivot.hxx:194
XclPCItemType meType
Definition: xlpivot.hxx:418
sal_uInt16 mnRefItem
Index to SXVD of referred field used for the results.
Definition: xlpivot.hxx:679
void SetApiLayoutMode(sal_Int32 nLayoutMode)
Sets the layout mode represented by the passed API constant.
Definition: xlpivot.cxx:625
const sal_uInt32 EXC_SXVDEX_SORT
Definition: xlpivot.hxx:334
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:43
bool IsStdGroupField() const
Returns true, if this field is a grouping field.
Definition: xlpivot.cxx:303
XclPTInfo()
Index to pivot table autoformat.
Definition: xlpivot.cxx:834
const sal_uInt16 EXC_SXVDEX_FORMAT_NONE
Definition: xlpivot.hxx:345
const sal_uInt16 EXC_SXFIELD_16BIT
Definition: xlpivot.hxx:229
sal_uInt16 mnRefType
Data aggregation function.
Definition: xlpivot.hxx:677
sal_uInt16 mnFlags
Type of the item (e.g. data, function, grand total).
Definition: xlpivot.hxx:578
function is determined automatically.
A name for various pivot table info structs.
Definition: xlpivot.hxx:548
const sal_uInt16 EXC_SXDI_FUNC_STDDEVP
Definition: xlpivot.hxx:186
XclPTFieldInfo()
Index into cache for field name (not part of record).
Definition: xlpivot.cxx:460
bool IsGroupField() const
Returns true, if this field is a grouping field of any type.
Definition: xlpivot.cxx:318
XclPCInfo()
Name of user who last modified the cache.
Definition: xlpivot.cxx:356
void SetApiAggFunc(ScGeneralFunction eAggFunc)
Sets the aggregation function represented by the passed API enum.
Definition: xlpivot.cxx:731
const double * GetDouble() const
Returns pointer to value, if the item type is 'double', otherwise 0.
Definition: xlpivot.cxx:140
const OUString * GetVisName() const
Returns the name, if set explicitly (maVisName.mbUseCache is false).
Definition: xlpivot.cxx:420
Pivot table autoformat settings (SXVIEWEX9 record).
Definition: xlpivot.hxx:752
const sal_uInt16 EXC_PT_AUTOFMT_ZERO
Definition: xlpivot.hxx:64
ReturnType get_flagvalue(Type nBitField, Type nMask, ReturnType nSet, ReturnType nUnset)
Returns nSet, if at least one bit of nMask is set in nBitField, otherwise nUnset. ...
Definition: ftools.hxx:78
void SetScDateType(sal_Int32 nScType)
Definition: xlpivot.cxx:242
const sal_uInt16 EXC_SXNUMGROUP_TYPE_QUART
Definition: xlpivot.hxx:286
const sal_uInt16 EXC_SXDI_FUNC_STDDEV
Definition: xlpivot.hxx:185
const sal_uInt16 EXC_SXVIEW_DEFAULTFLAGS
Definition: xlpivot.hxx:103
std::optional< OUString > mpFieldTotalName
Definition: xlpivot.hxx:627
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MIN
Definition: xlpivot.hxx:282
This class is used to export Excel record streams.
Definition: xestream.hxx:71
sal_uInt16 mnSrcType
Number of all fields (standard, grouped, calculated).
Definition: xlpivot.hxx:534
SC_DLLPUBLIC const std::optional< OUString > & GetGrandTotalName() const
Definition: dpsave.cxx:771
XclPTViewEx9Info()
classic : 10 08 00 00 00 00 00 00 20 00 00 00 01 00 00 00 00 default : 10 08 00 00 00 00 00 00 20 00 ...
Definition: xlpivot.cxx:969
XclPCFieldType
Specifies the type of a pivot cache field.
Definition: xlpivot.hxx:81
void WriteBuffer(XclExpStream &rStrm) const
Writes the raw character buffer.
Definition: xestring.cxx:304
void SetError(sal_uInt16 nError)
Sets the item to 'error' type and adds the passed Excel error code.
Definition: xlpivot.cxx:88
std::unique_ptr< ContentProperties > pData
bool mbUseCache
The visible name, if used.
Definition: xlpivot.hxx:551
sal_uInt16 mnAggFunc
Base field for this data info.
Definition: xlpivot.hxx:676
sal_uInt16 mnRefField
Result reference type.
Definition: xlpivot.hxx:678
const sal_uInt16 EXC_SXPI_ALLITEMS
Definition: xlpivot.hxx:173
Extended information about a pivot table (SXEX record).
Definition: xlpivot.hxx:735
const sal_uInt16 EXC_SXDI_PREVITEM
Definition: xlpivot.hxx:200
sal_Int32 GetApiLayoutMode() const
Returns the API constant representing the layout mode.
Definition: xlpivot.cxx:616
const sal_uInt16 EXC_SXNUMGROUP_TYPE_YEAR
Definition: xlpivot.hxx:287
void SetDateTime(const DateTime &rDateTime, const OUString &rText=OUString())
Sets the item to 'date/time' type and adds the passed date.
Definition: xlpivot.cxx:74
Contains data for a pivot cache field (SXFIELD record).
Definition: xlpivot.hxx:436
sal_uInt8 mnAutoFormat
2 for report* fmts ?
Definition: xlpivot.hxx:755
const sal_uInt32 EXC_SXVDEX_LAYOUT_TOP
Definition: xlpivot.hxx:340
const bool * GetBool() const
Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0.
Definition: xlpivot.cxx:160
sal_Int16 mnValue
Value of a floating-point item.
Definition: xlpivot.hxx:424
const sal_uInt16 EXC_SXVI_DEFAULTFLAGS
Definition: xlpivot.hxx:155
sal_uInt16 mnColFields
Number of row fields.
Definition: xlpivot.hxx:718
XclPCItem()
Definition: xlpivot.cxx:45
void SetApiRefItemType(sal_Int32 nRefItemType)
Sets the result reference item type represented by the passed API constant.
Definition: xlpivot.cxx:798
sal_uInt16 mnCacheIdx
Several flags.
Definition: xlpivot.hxx:579
virtual ~XclPCItem()
Definition: xlpivot.cxx:51
sal_uInt16 mnGroupItems
Number of visible items for this field.
Definition: xlpivot.hxx:443
Numeric grouping field.
Definition: xlpivot.hxx:86
void SetText(const OUString &rText)
Sets the item to 'text' type and adds the passed text.
Definition: xlpivot.cxx:61
void GetSubtotals(XclPTSubtotalVec &rSubtotals) const
Returns a vector of all set subtotal functions.
Definition: xlpivot.cxx:499
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:93
const sal_uInt16 EXC_SXVD_AXIS_COL
Definition: xlpivot.hxx:113
DateTime maDateTime
Text representation of the item.
Definition: xlpivot.hxx:420
XclAddress maDataXclPos
Output range.
Definition: xlpivot.hxx:711
numerical values are counted.
const sal_uInt16 EXC_PT_NOSTRING
Definition: xlpivot.hxx:42
Standard field without grouping.
Definition: xlpivot.hxx:84
const sal_uInt16 EXC_SXVDEX_SHOW_NONE
Definition: xlpivot.hxx:344
void SetSubtotals(const XclPTSubtotalVec &rSubtotals)
Sets the subtotal functions contained in the passed sequence.
Definition: xlpivot.cxx:518
sum of all numerical values is calculated.
sal_uInt16 mnGroupChild
Various flags.
Definition: xlpivot.hxx:440
const sal_uInt16 EXC_SXDI_REF_PERC_TOTAL
Definition: xlpivot.hxx:197
const sal_uInt16 EXC_SXDI_REF_PERC_DIFF
Definition: xlpivot.hxx:193
void SetBool(bool bValue, const OUString &rText=OUString())
Sets the item to 'boolean' type and adds the passed Boolean value.
Definition: xlpivot.cxx:106
void Init(const ScDPObject &rDPObj)
Definition: xlpivot.cxx:976
void SetApiSortMode(sal_Int32 nSortMode)
Sets the sorting mode represented by the passed API constant.
Definition: xlpivot.cxx:587
sal_uInt16 mnFlags
Number of columns containing data.
Definition: xlpivot.hxx:723
sal_uInt16 mnVisItems
Base field if this field contains grouping info.
Definition: xlpivot.hxx:442
const sal_uInt16 EXC_SXVI_TYPE_DATA
Definition: xlpivot.hxx:140
product of all numerical values is calculated.
sal_Int32 GetApiSortMode() const
Returns the API constant representing the sorting mode.
Definition: xlpivot.cxx:579
const sal_uInt16 EXC_SXVD_SUBT_COUNTNUM
Definition: xlpivot.hxx:127
const sal_uInt16 EXC_SXVD_SUBT_STDDEV
Definition: xlpivot.hxx:128
const sal_uInt16 EXC_SXVD_SUBT_DEFAULT
Definition: xlpivot.hxx:120
sal_uInt32 mbReport
Definition: xlpivot.hxx:754
XclPTDataFieldInfo()
Number format of the results.
Definition: xlpivot.cxx:700
FuncFlags mnFlags
Information about all parameters.
ScGeneralFunction GetApiAggFunc() const
Returns the API enum representing the aggregation function.
Definition: xlpivot.cxx:710
sal_uInt16 mnFields
Position of data fields.
Definition: xlpivot.hxx:716
Special state, not used in Excel files.
Definition: xlpivot.hxx:71
const sal_uInt16 EXC_SXDI_FUNC_MIN
Definition: xlpivot.hxx:182
const sal_uInt16 EXC_SXDI_FUNC_VAR
Definition: xlpivot.hxx:187
Contains data for a numeric grouping field (SXNUMGROUP record).
Definition: xlpivot.hxx:456
sal_uInt16 mnSubtCount
Flags for axes this field is part of.
Definition: xlpivot.hxx:595
const sal_uInt32 EXC_PT_AUTOFMT_FLAGS
Definition: xlpivot.hxx:65
const sal_uInt16 EXC_SXDB_DEFAULTFLAGS
Definition: xlpivot.hxx:212
sal_uInt16 mnStdFields
Records in a source database block.
Definition: xlpivot.hxx:532
Contains extended data for a pivot table field (SXVDEX record).
Definition: xlpivot.hxx:621
sal_uInt16 mnDataRows
Number of data fields.
Definition: xlpivot.hxx:721
const sal_uInt16 EXC_SXVD_AXIS_DATA
Definition: xlpivot.hxx:115
void AddApiOrient(css::sheet::DataPilotFieldOrientation eOrient)
Adds the axis orientation represented by the passed API enum.
Definition: xlpivot.cxx:485
sal_uInt16 mnDataFields
Number of page fields.
Definition: xlpivot.hxx:720
const sal_uInt16 EXC_SXNUMGROUP_TYPE_HOUR
Definition: xlpivot.hxx:283
Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unfo...
const sal_uInt16 EXC_SXNUMGROUP_TYPE_DAY
Definition: xlpivot.hxx:284
String data.
Definition: xlpivot.hxx:73
16-bit integer value.
Definition: xlpivot.hxx:76
const sal_uInt32 EXC_SXVDEX_LAYOUT_REPORT
Definition: xlpivot.hxx:338
const sal_uInt16 EXC_SXNUMGROUP_AUTOMAX
Definition: xlpivot.hxx:279
sal_uInt16 mnCacheIdx
First heading row.
Definition: xlpivot.hxx:713
variance is calculated based on the entire population.
sal_uInt16 mnShowField
Index to data field sorting bases on.
Definition: xlpivot.hxx:625
sal_Int32 GetScDateType() const
Definition: xlpivot.cxx:225
sal_uInt16 mnGroupBase
Field containing grouping info for this field.
Definition: xlpivot.hxx:441
OUString maGrandTotalName
0 == gridlayout, 0x10 == modern
Definition: xlpivot.hxx:757
const sal_uInt16 EXC_SXVD_SUBT_NONE
Definition: xlpivot.hxx:119
Contains data for a pivot table page field (part of SXPI record).
Definition: xlpivot.hxx:658
Standard grouping field.
Definition: xlpivot.hxx:85
void SetInteger(sal_Int16 nValue)
Sets the item to 'integer' type and adds the passed value.
Definition: xlpivot.cxx:81
sal_uInt16 mnNumFmt
Index to SXVI of referred item of the used field.
Definition: xlpivot.hxx:680
First date grouping field (opt. with child grouping field).
Definition: xlpivot.hxx:87
const sal_uInt16 EXC_SXDI_NEXTITEM
Definition: xlpivot.hxx:201
sal_uInt16 mnField
Definition: xlpivot.hxx:660
XclPTCachedName maVisName
Definition: xlpivot.hxx:562
::std::vector< ScGeneralFunction > XclPTSubtotalVec
Definition: xlpivot.hxx:589
const sal_uInt16 EXC_SXNUMGROUP_TYPE_NUM
Definition: xlpivot.hxx:288
const sal_uInt16 EXC_SXVD_SUBT_MIN
Definition: xlpivot.hxx:125
const DateTime * GetDateTime() const
Returns pointer to date, if the item type is 'date/time', otherwise 0.
Definition: xlpivot.cxx:145
sal_uInt16 mnStrmId
Records in source database.
Definition: xlpivot.hxx:529
const sal_uInt16 EXC_SXDI_REF_INDEX
Definition: xlpivot.hxx:198
const OUString * GetText() const
Returns pointer to text, if the item type is 'text', otherwise 0.
Definition: xlpivot.cxx:135
sal_uInt16 mnPagePerRow
Number of SXSELECT records.
Definition: xlpivot.hxx:739
maximum value of all numerical values is calculated.
bool GetHeaderLayout() const
Definition: dpobject.hxx:147
Floating-point value.
Definition: xlpivot.hxx:74
Contains data for a pivot table field (SXVD record).
Definition: xlpivot.hxx:592
const sal_uInt16 EXC_SXVD_SUBT_SUM
Definition: xlpivot.hxx:121
sal_uInt16 mnFlags
Definition: xlpivot.hxx:458
void SetXclDataType(sal_uInt16 nXclType)
Definition: xlpivot.cxx:265
const sal_uInt16 EXC_SXVIEW_DATALAST
Definition: xlpivot.hxx:105
const sal_uInt16 EXC_SXDI_FUNC_COUNTNUM
Definition: xlpivot.hxx:184
const sal_uInt32 EXC_SXEX_DEFAULTFLAGS
Definition: xlpivot.hxx:313
const sal_uInt16 EXC_SXDI_REF_NORMAL
Definition: xlpivot.hxx:190
sal_uInt16 mnOrigItems
Number of items in the base field.
Definition: xlpivot.hxx:445
standard deviation is calculated based on the entire population.
const sal_uInt16 EXC_SXFIELD_HASCHILD
Definition: xlpivot.hxx:227
sal_uInt16 mnFlags
Stream identifier.
Definition: xlpivot.hxx:530
void SetApiAutoShowCount(sal_Int32 nShowCount)
Sets the number of items to be shown in AutoShow mode.
Definition: xlpivot.cxx:611
const sal_uInt16 EXC_SXVDEX_SORT_OWN
Definition: xlpivot.hxx:343
bool HasVisName() const
The displayed name of the item.
Definition: xlpivot.hxx:565
const sal_uInt16 EXC_SXDI_FUNC_COUNT
Definition: xlpivot.hxx:179
sal_uInt32 mnSrcRecs
Definition: xlpivot.hxx:528
Additional date grouping field.
Definition: xlpivot.hxx:88
sal_uInt16 mnBlockRecs
Flags for the cache.
Definition: xlpivot.hxx:531
average of all numerical values is calculated.
bool IsEmpty() const
Returns true, if the item type is 'empty'.
Definition: xlpivot.cxx:130
sal_Int32 mnType
DateTime maDateTime
const sal_uInt16 EXC_SXNUMGROUP_AUTOMIN
Definition: xlpivot.hxx:278
sal_uInt16 GetXclDataType() const
Definition: xlpivot.cxx:260
const sal_uInt16 EXC_SXDI_FUNC_MAX
Definition: xlpivot.hxx:181
sal_uInt16 mnSubtotals
Number of subtotal functions.
Definition: xlpivot.hxx:596
sal_uInt16 mnDataCols
Number of rows containing data.
Definition: xlpivot.hxx:722
const sal_uInt16 EXC_SXNUMGROUP_TYPE_MONTH
Definition: xlpivot.hxx:285
XclPCField(XclPCFieldType eFieldType, sal_uInt16 nFieldIdx)
Definition: xlpivot.cxx:283
const sal_uInt16 EXC_SXVD_SUBT_VAR
Definition: xlpivot.hxx:130
sal_uInt16 mnSelItem
Base field for this page info.
Definition: xlpivot.hxx:661
XclExpStream & operator<<(XclExpStream &rStrm, const XclPCFieldInfo &rInfo)
Definition: xlpivot.cxx:199
sal_uInt16 mnRowFields
Number of all fields.
Definition: xlpivot.hxx:717
sal_uInt16 mnPageFields
Number of column fields.
Definition: xlpivot.hxx:719
Contains data for a pivot table data item (SXVI record).
Definition: xlpivot.hxx:575
Calculated field.
Definition: xlpivot.hxx:89
sal_uInt16 mnSortField
Several flags and number of items for AutoShow.
Definition: xlpivot.hxx:624
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:73
sal_uInt16 mnType
Definition: xlpivot.hxx:577
ScDPSaveData * GetSaveData() const
Definition: dpobject.hxx:141
void SetEmpty()
Sets the item to 'empty' type.
Definition: xlpivot.cxx:55
const sal_uInt16 EXC_SXVD_SUBT_AVERAGE
Definition: xlpivot.hxx:123
const sal_Int16 * GetInteger() const
Returns pointer to integer, if the item type is 'integer', otherwise 0.
Definition: xlpivot.cxx:150
sal_uInt16 mnDataPos
Orientation of data fields.
Definition: xlpivot.hxx:715
const sal_uInt16 EXC_SXDI_REF_PERC_ROW
Definition: xlpivot.hxx:195
const sal_uInt16 EXC_SXDI_FUNC_PRODUCT
Definition: xlpivot.hxx:183
sal_Int32 GetApiRefItemType() const
Returns the API constant representing the result reference item type.
Definition: xlpivot.cxx:786
Contains data for a pivot table data field (SXDI record).
Definition: xlpivot.hxx:673
XclPCItemType
Data type of a pivot cache item.
Definition: xlpivot.hxx:68
XclPTPageFieldInfo()
Escher object ID of dropdown listbox.
Definition: xlpivot.cxx:675
bool mbCompactMode
Definition: xlpivot.hxx:769
const sal_uInt32 EXC_SXVDEX_AUTOSHOW_ASC
Definition: xlpivot.hxx:337
XclPCItemType GetType() const
Returns the type of the item.
Definition: xlpivot.cxx:165
bool IsGroupChildField() const
Returns true, if this field is a child field in a grouping (it has a base field). ...
Definition: xlpivot.cxx:328
Empty cell.
Definition: xlpivot.hxx:72
const sal_uInt16 EXC_SXDI_FUNC_AVERAGE
Definition: xlpivot.hxx:180
XclPCNumGroupInfo()
Various flags.
Definition: xlpivot.cxx:214
sal_uInt16 ReaduInt16()
Definition: xistream.cxx:648
const sal_uInt16 EXC_SXVD_AXIS_PAGE
Definition: xlpivot.hxx:114
XclPTExtInfo()
Flags for the entire pivot table.
Definition: xlpivot.cxx:905
XclRange maOutXclRange
The visible name of the data field.
Definition: xlpivot.hxx:710
OUString maName
Definition: xlpivot.hxx:550
bool IsStandardField() const
Returns true, if this is a standard field build directly from source data.
Definition: xlpivot.cxx:298
const sal_uInt16 EXC_SXVD_DEFAULT_CACHE
Definition: xlpivot.hxx:133
Boolean value.
Definition: xlpivot.hxx:77
bool Has16BitIndexes() const
Returns true, if the item indexes in the SXINDEXLIST record are stored as 16-bit values.
Definition: xlpivot.cxx:348
sal_uInt16 mnTotalFields
Number of standard pivot cache fields.
Definition: xlpivot.hxx:533
bool IsGroupBaseField() const
Returns true, if this field has a child field in a grouping.
Definition: xlpivot.cxx:323
XclPCFieldInfo maFieldInfo
Definition: xlpivot.hxx:516
sal_uInt16 mnPagePerCol
Number of page fields per row.
Definition: xlpivot.hxx:740
std::size_t GetRecLeft()
Returns remaining data size of the whole record without record headers.
Definition: xistream.cxx:581
OUString ReadUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Reads ext.
Definition: xistream.cxx:886
virtual ~XclPCField()
Definition: xlpivot.cxx:289
const sal_uInt16 EXC_SXVD_SUBT_STDDEVP
Definition: xlpivot.hxx:129
OUString maDataName
The name of the pivot table.
Definition: xlpivot.hxx:709
const sal_uInt16 EXC_SXDI_FUNC_SUM
Definition: xlpivot.hxx:178
const sal_uInt32 EXC_SXVDEX_DEFAULTFLAGS
Definition: xlpivot.hxx:341
sal_uInt16 Len() const
Returns the character count of the string.
Definition: xestring.hxx:114
const sal_uInt16 EXC_SXDI_REF_DIFF
Definition: xlpivot.hxx:191
sal_uInt16 mnSxformulaRecs
Definition: xlpivot.hxx:737
Contains data for a pivot cache (SXDB record).
Definition: xlpivot.hxx:526
const sal_uInt16 * GetError() const
Returns pointer to error code, if the item type is 'error', otherwise 0.
Definition: xlpivot.cxx:155
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
Definition: xistream.cxx:795
unsigned char sal_uInt8
sal_uInt8 ReaduInt8()
Definition: xistream.cxx:616
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2, which causes some type-safety issues.
#define SAL_INFO(area, stream)
const sal_uInt16 EXC_SXVD_SUBT_MAX
Definition: xlpivot.hxx:124
const sal_uInt16 EXC_SXFIELD_POSTPONE
Definition: xlpivot.hxx:225
variance is calculated based on a sample.
sal_Int32 GetApiRefType() const
Returns the API constant representing the result reference type.
Definition: xlpivot.cxx:750
all values, including non-numerical values, are counted.
Contains data for a pivot table (SXVIEW record).
Definition: xlpivot.hxx:706
sal_uInt16 mnFlags
Name of the pivot cache field.
Definition: xlpivot.hxx:439
const sal_uInt16 EXC_PT_MAXSTRLEN
Definition: xlpivot.hxx:43
void insert_value(Type &rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount)
Inserts a value into a bitfield.
Definition: ftools.hxx:100
Additional pivot table settings (SXADDL record).
Definition: xlpivot.hxx:767
OUString maText
Type of the item.
Definition: xlpivot.hxx:419
const sal_uInt16 EXC_SXVI_DEFAULT_CACHE
Definition: xlpivot.hxx:161
sal_uInt16 mnObjId
Index to selected item.
Definition: xlpivot.hxx:662
Date/time.
Definition: xlpivot.hxx:75
XclImpStream & operator>>(XclImpStream &rStrm, XclPCFieldInfo &rInfo)
Definition: xlpivot.cxx:183
css::sheet::DataPilotFieldOrientation GetApiOrient(sal_uInt16 nMask) const
Returns the API enum representing the orientation (first of row/col/page/data).
Definition: xlpivot.cxx:469
sal_uInt16 mnError
Value of an integer item.
Definition: xlpivot.hxx:425
sal_uInt16 mnSxselectRecs
Number of SXFORMULA records.
Definition: xlpivot.hxx:738
void SetApiRefType(sal_Int32 nRefType)
Sets the result reference type represented by the passed API constant.
Definition: xlpivot.cxx:769
minimum value of all numerical values is calculated.
standard deviation is calculated based on a sample.
void SetVisName(const OUString &rName)
Sets the visible name and enables usage of cache if name is empty.
Definition: xlpivot.cxx:425
bool HasPostponedItems() const
Returns true, if the items are stored separately after the last field.
Definition: xlpivot.cxx:343
bool IsDateGroupField() const
Returns true, if this field is a date/time grouping field.
Definition: xlpivot.cxx:313
const sal_uInt16 EXC_SXVD_AXIS_NONE
Definition: xlpivot.hxx:111
void SetApiAutoShowMode(sal_Int32 nShowMode)
Sets the AutoShow mode represented by the passed API constant.
Definition: xlpivot.cxx:601
bool HasOrigItems() const
Returns true, if the field is based on a column in the source data area.
Definition: xlpivot.cxx:333
#define SAL_WARN(area, stream)
sal_Int32 GetApiAutoShowCount() const
Returns the number of items to be shown in AutoShow mode.
Definition: xlpivot.cxx:606
bool HasInlineItems() const
Returns true, if any items are stored after the SXFIELD record.
Definition: xlpivot.cxx:338
XclPCFieldInfo()
Number of original source data items.
Definition: xlpivot.cxx:172
bool mbValue
Error code of an error item.
Definition: xlpivot.hxx:426
const sal_uInt16 EXC_SXVD_AXIS_ROW
Definition: xlpivot.hxx:112
const sal_uInt16 EXC_SXDB_SRC_SHEET
Definition: xlpivot.hxx:216
bool IsNumGroupField() const
Returns true, if this field is a numeric grouping field.
Definition: xlpivot.cxx:308
sal_uInt16 mnField
Definition: xlpivot.hxx:675
OUString maTableName
Definition: xlpivot.hxx:708
const sal_uInt16 EXC_SXVIEW_AUTOFMT
Definition: xlpivot.hxx:106
const sal_uInt16 EXC_SXVD_SUBT_VARP
Definition: xlpivot.hxx:131
const sal_uInt16 EXC_SXDI_REF_PERC_COL
Definition: xlpivot.hxx:196
bool IsEqual(const XclPCItem &rItem) const
Returns true, if the passed term equals this item.
Definition: xlpivot.cxx:113
const sal_uInt16 EXC_SXNUMGROUP_TYPE_SEC
Definition: xlpivot.hxx:281
This class is used to import record oriented streams.
Definition: xistream.hxx:278
void SetDouble(double fValue, const OUString &rText=OUString())
Sets the item to 'double' type and adds the passed value.
Definition: xlpivot.cxx:67
sal_uInt16 mnBaseItems
Number of special items in a grouping field.
Definition: xlpivot.hxx:444
XclPTItemInfo()
Index into cache for item name.
Definition: xlpivot.cxx:433
XclPCFieldType meFieldType
Pivot cache field info (SXFIELD record).
Definition: xlpivot.hxx:517
bool IsSupportedField() const
Returns true, if the type of the field is supported by Calc.
Definition: xlpivot.cxx:293
OUString maName
Definition: xlpivot.hxx:438
sal_uInt32 ReaduInt32()
Definition: xistream.cxx:684
const sal_uInt16 EXC_SXVD_SUBT_PROD
Definition: xlpivot.hxx:126
void WriteFlagField(XclExpStream &rStrm) const
Writes the string flags field (1 byte).
Definition: xestring.cxx:279
RedlineType meType
sal_uInt32 mnFlags
Number of page fields per column.
Definition: xlpivot.hxx:741
const sal_uInt16 EXC_SXDI_REF_PERC
Definition: xlpivot.hxx:192
const sal_uInt16 EXC_PT_AUTOFMT_HEADER
Definition: xlpivot.hxx:63
const sal_uInt16 EXC_SXDB_BLOCKRECS
Definition: xlpivot.hxx:214
const sal_uInt16 EXC_SXDI_FUNC_VARP
Definition: xlpivot.hxx:188
OUString maUserName
Database type.
Definition: xlpivot.hxx:535
sal_uInt16 mnItemCount
Bitfield for subtotal functions.
Definition: xlpivot.hxx:597
sal_uInt16 mnAxes
Definition: xlpivot.hxx:594
sal_uInt16 mnFirstHeadRow
First cell containing data.
Definition: xlpivot.hxx:712
const sal_uInt16 EXC_SXVD_SUBT_COUNT
Definition: xlpivot.hxx:122
double mfValue
Definition: xlpivot.hxx:423
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
Definition: xestream.cxx:256
sal_Int32 GetApiAutoShowMode() const
Returns the API constant representing the AutoShow mode.
Definition: xlpivot.cxx:595
sal_uInt16 mnAutoFmtIdx
Flags for the entire pivot table.
Definition: xlpivot.hxx:724
sal_uInt8 mnGridLayout
AutoFormat ID.
Definition: xlpivot.hxx:756
Represents a data item of any type in a pivot cache.
Definition: xlpivot.hxx:367
sal_uInt16 mnDataAxis
0-based index of the pivot cache.
Definition: xlpivot.hxx:714
sal_uInt16 mnNumFmt
Index to data field AutoShow bases on.
Definition: xlpivot.hxx:626