Skip to content

Alteroffice pivot 2026 05#60

Closed
dddmityaMD wants to merge 3 commits into
LibreOffice:masterfrom
dddmityaMD:alteroffice-pivot-2026-05
Closed

Alteroffice pivot 2026 05#60
dddmityaMD wants to merge 3 commits into
LibreOffice:masterfrom
dddmityaMD:alteroffice-pivot-2026-05

Conversation

@dddmityaMD
Copy link
Copy Markdown

No description provided.

dddmityaMD added 3 commits May 7, 2026 10:18
Fixes pivot-table import gaps surfaced by Russian SED-generated xlsx
files (Tessa, Directum, EOS, etc.). All changes are in OOXML/BIFF12
import + xlsx export paths.

Issues addressed:

* captionNotEqual filter import (was: only XML_count "top10" handled,
  every other filter type silently dropped). Now hides members per
  pivottablebuffer.cxx PivotTableFilter::finalizeImport. Excel hides
  them; LO matches.
* dxf <alignment> import (was: gated behind #if 0 in stylesfragment.cxx;
  Dxf::importAlignment never implemented). Now wraps/horizontals/
  verticals from <dxf> blocks reach pivot label cells.
* x14:fillDownLabels extension (was: token absent, extLst dispatcher
  never descended into pivotField extensions). Adds tokens.txt entry,
  extLst SAX arms, model field, calls SetRepeatItemLabels.
* defaultSubtotal="0" honour (was: empty UNO PROP_Subtotals sequence
  did not flip bSubTotalDefault). Bypass via direct
  ScDPSaveDimension::SetSubTotals({}). Mirrors BIFF importer.
* countA/count export inversion (was: xepivotxml.cxx mapped
  ScGeneralFunction::COUNT to "count" but LO's COUNT == count-all ==
  OOXML "countA"). Round-trip-stable now.
* pivotField name= attribute import (was: silently dropped; long cache
  field name shown instead of friendly name). Now SetLayoutName from
  <pivotField name="...">.
* rowHeaderCaption / colHeaderCaption import (was: parsed into
  PTDefinitionModel but never read). Now stored on ScDPSaveData and
  consumed by MultiFieldCell.
* preserveFormatting attribute (was: parsed but never read; pivot
  rebuild wiped pre-existing cellXf alignment items). Now snapshot+
  restore on the OOXML side.
* show* default values (was: pivotTableStyleInfo flags defaulted to
  false; ECMA-376 says showRowHeaders/showColHeaders default true).
  Now reads with correct defaults.
* extLst URI catch-all telemetry: SAL_WARN on dropped extension URIs.

These fix the OOXML side of the pipeline. The render-side (output)
fixes that consume these are in the following commit.

Change-Id: I23addb3b1df3b79064f2930c156bae481828736e
Render-side corrections that consume the OOXML model populated by
the preceding commit. Touches ScDPOutput, ScDPObject, the dxf-apply
path in PivotTableFormatOutput, and the pivot field-button / popup
controls in dpcontrol and gridwin2.

Issues addressed:

* Column-shift bug (mbCompact moved into ScDPOutLevelData). Was: a
  parallel std::vector<bool> maRowCompactFlags was populated in
  cache-field-iteration order, then mpRowFields was sorted by
  mnDimPos but the flags vector was NOT sorted alongside, breaking
  the parallel-array invariant. Five call sites in dpoutput.cxx
  read the wrong flag for the wrong field. Symptom: row labels
  shifted right by one column and long-text content cells truncated
  in narrow columns. Fix: drop the parallel vector, embed mbCompact
  on each ScDPOutLevelData so it survives the sort.
* Missing column header row. Was: outputRowHeader short-circuited
  when any single row field was compact (mbHasCompactRowField=true)
  — wrote one MultiFieldCell at field 0 and skipped captions for
  other fields. Now: per-field FieldCell for non-compact fields,
  MultiFieldCell only for the leading compact run.
* dxf format apply path. Was: PivotTableFormatOutput::evaluateMatches
  dropped FormatType::Label entries that fell back to maybe-matches,
  silently. Excel's label-only formats with partial-reference
  selectors apply to every label cell whose explicitly-referenced
  fields match — unreferenced row fields are wildcards. Fix:
  treat unreferenced fields as wildcards in checkForMatchingLines.
* preserveFormatting (P0c) snapshot+restore on the core side. The
  oox-side preserve at PivotTable::finalizeImport already existed,
  but the runtime path (gridwin2.cxx → ScDBDocFunc::UpdatePivotTable
  → ScDPObject::Output) didn't snapshot. Adds an alignment-only
  snapshot in ScDPObject::Output before the wipe and restore after.
* Renderer button-cell wrap shrink. output2.cxx::GetOutputArea was
  forcing bFit on every cell even when wrapText was set, clipping
  multi-line text. Now skips bFit for break cells.
* Filter-funnel button cue. dpcontrol.cxx::drawPopupButton no longer
  overpaints the popup arrow — corner Excel-blue marker added when
  HiddenMember flag is set. RGB(0,112,192) explicit.
* Field-selector dropdown filter cue. checklistmenu.{hxx,cxx} +
  gridwin2.cxx propagate filter status back to the field-button;
  visible suffix on filtered field labels.
* Click-no-rebuild guard. gridwin.hxx + gridwin2.cxx — clicking a
  pivot button no longer triggers a full rebuild when the dimension
  hasn't changed.

The pivot-style applicator and ScTableStyle storage refactor (which
also touches some of these files) is in the next commit.

Change-Id: Ic12295c7ea8c9c24b4244b62e5be1f3062e533b7
Implements full Excel parity for OOXML <pivotTableStyleInfo> on xlsx
pivots. Adds a new module ScDPPivotStyle that resolves the named
table style from the document, expands its tableStyleElement entries
to cell ranges according to ScDPOutput's geometry tracking, and
applies the corresponding dxfs in Excel's documented application
order (most-general to most-specific).

Components:

* New module sc/source/core/data/dppivotstyle.{hxx,cxx} (~440 LoC).
  Inputs: ScDPSaveData::getStyleInfo(), ScDPOutput's row/column role
  data (subtotal levels, grand-total ranges, blank rows, pure-data
  ranges), ScTableStyles::GetTableStyle(name). Wired from
  ScDPObject::Output after mpOutput->Output() returns and before
  the alignment-preservation re-apply.

* ScTableStyle storage refactor (sc/inc/tablestyle.hxx,
  sc/source/core/data/tablestyle.cxx). Migrated from 11 explicit
  std::unique_ptr<ScPatternAttr> members + parallel switch-cases
  to std::map<ScTableStyleElement, std::unique_ptr<ScPatternAttr>>.
  Required to add 18 new enum values (16 pivot-specific element
  types + firstTotalCell + lastTotalCell) without touching every
  per-member accessor and dispatcher. Public accessors
  (GetSetPatterns, GetFillItem, GetBoxItem, GetFontItemSet) are
  source-compatible; no caller changes.

* Stripe row-index computation excludes SUBTOTAL/BLANK/HEADER/PAGE
  rows from the stripe counter, matching Excel's behaviour where
  stripes interrupt across subtotals but don't count subtotal
  rows toward the stripe pattern.

* Subheading / subtotal level mod-3 cycling for pivots nested
  beyond three levels (per ECMA-376 §18.18.83 + Excel observed
  behaviour).

* Excel application order (per ECMA-376 §18.8.43): wholeTable →
  column stripes → row stripes → first/lastColumn → row/col
  subheadings → subtotals → blankRow → pageField labels/values →
  headerRow → totalRow → corner cells.

Export: sc/source/filter/excel/xestyle.cxx adds the 18 new enum
values to aTableStyleElementToOOXML so save-side serialisation
matches the new import-side coverage.

The applicator is opt-in per pivot via the existing
<pivotTableStyleInfo> name attribute; it is a no-op for pivots
that don't carry a style reference.

Change-Id: Ifcb69a3091a9c966f9918c6d3b3a8bab4453518c
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Thank you for your contribution. We use GitHub as a read-only mirror, so please submit your patch into our own code review system: https://wiki.documentfoundation.org/Development/GetInvolved

@github-actions github-actions Bot closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant