LibreOffice Module sc (master)  1
xeview.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 <xeview.hxx>
21 #include <document.hxx>
22 #include <scextopt.hxx>
23 #include <viewopti.hxx>
24 #include <xelink.hxx>
25 #include <xestyle.hxx>
26 #include <xehelper.hxx>
27 #include <xltools.hxx>
28 #include <oox/token/tokens.hxx>
29 #include <oox/export/utils.hxx>
30 
31 using namespace ::oox;
32 
33 // Workbook view settings records =============================================
34 
37  , mnFlags(0)
38  , mnTabBarSize(600)
39 {
40  const ScViewOptions& rViewOpt = rRoot.GetDoc().GetViewOptions();
44 
45  double fTabBarWidth = rRoot.GetExtDocOptions().GetDocSettings().mfTabBarWidth;
46  if( (0.0 <= fTabBarWidth) && (fTabBarWidth <= 1.0) )
47  mnTabBarSize = static_cast< sal_uInt16 >( fTabBarWidth * 1000.0 + 0.5 );
48 }
49 
51 {
52  const XclExpTabInfo& rTabInfo = rStrm.GetRoot().GetTabInfo();
53 
54  rStrm.GetCurrentStream()->singleElement( XML_workbookView,
55  // OOXTODO: XML_visibility, // ST_visibility
56  // OOXTODO: XML_minimized, // bool
57  XML_showHorizontalScroll, ToPsz( ::get_flag( mnFlags, EXC_WIN1_HOR_SCROLLBAR ) ),
58  XML_showVerticalScroll, ToPsz( ::get_flag( mnFlags, EXC_WIN1_VER_SCROLLBAR ) ),
59  XML_showSheetTabs, ToPsz( ::get_flag( mnFlags, EXC_WIN1_TABBAR ) ),
60  XML_xWindow, "0",
61  XML_yWindow, "0",
62  XML_windowWidth, OString::number(0x4000),
63  XML_windowHeight, OString::number(0x2000),
64  XML_tabRatio, OString::number(mnTabBarSize),
65  XML_firstSheet, OString::number(rTabInfo.GetFirstVisXclTab()),
66  XML_activeTab, OString::number(rTabInfo.GetDisplayedXclTab())
67  // OOXTODO: XML_autoFilterDateGrouping, // bool; AUTOFILTER12? 87Eh
68  );
69 }
70 
72 {
73  const XclExpTabInfo& rTabInfo = rStrm.GetRoot().GetTabInfo();
74 
75  rStrm << sal_uInt16( 0 ) // X position of the window
76  << sal_uInt16( 0 ) // Y position of the window
77  << sal_uInt16( 0x4000 ) // width of the window
78  << sal_uInt16( 0x2000 ) // height of the window
79  << mnFlags
80  << rTabInfo.GetDisplayedXclTab()
81  << rTabInfo.GetFirstVisXclTab()
82  << rTabInfo.GetXclSelectedCount()
83  << mnTabBarSize;
84 }
85 
86 // Sheet view settings records ================================================
87 
89  const XclTabViewData& rData, sal_uInt32 nGridColorId ) :
90  XclExpRecord( EXC_ID_WINDOW2, (rRoot.GetBiff() == EXC_BIFF8) ? 18 : 10 ),
91  maGridColor( rData.maGridColor ),
92  mnGridColorId( nGridColorId ),
93  mnFlags( 0 ),
94  maFirstXclPos( rData.maFirstXclPos ),
95  mnNormalZoom( rData.mnNormalZoom ),
96  mnPageZoom( rData.mnPageZoom )
97 {
110 }
111 
113 {
114  const XclExpRoot& rRoot = rStrm.GetRoot();
115 
116  rStrm << mnFlags
117  << maFirstXclPos;
118 
119  switch( rRoot.GetBiff() )
120  {
121  case EXC_BIFF3:
122  case EXC_BIFF4:
123  case EXC_BIFF5:
124  rStrm << maGridColor;
125  break;
126  case EXC_BIFF8:
127  rStrm << rRoot.GetPalette().GetColorIndex( mnGridColorId )
128  << sal_uInt16( 0 )
129  << mnPageZoom
130  << mnNormalZoom
131  << sal_uInt32( 0 );
132  break;
133  default: DBG_ERROR_BIFF();
134  }
135 }
136 
137 XclExpScl::XclExpScl( sal_uInt16 nZoom ) :
138  XclExpRecord( EXC_ID_SCL, 4 ),
139  mnNum( nZoom ),
140  mnDenom( 100 )
141 {
142  Shorten( 2 );
143  Shorten( 5 );
144 }
145 
146 void XclExpScl::Shorten( sal_uInt16 nFactor )
147 {
148  while( (mnNum % nFactor == 0) && (mnDenom % nFactor == 0) )
149  {
150  mnNum = mnNum / nFactor;
151  mnDenom = mnDenom / nFactor;
152  }
153 }
154 
156 {
157  OSL_ENSURE_BIFF( rStrm.GetRoot().GetBiff() >= EXC_BIFF4 );
158  rStrm << mnNum << mnDenom;
159 }
160 
162  XclExpRecord( EXC_ID_PANE, 10 ),
163  mnSplitX( rData.mnSplitX ),
164  mnSplitY( rData.mnSplitY ),
165  maSecondXclPos( rData.maSecondXclPos ),
166  mnActivePane( rData.mnActivePane ),
167  mbFrozenPanes( rData.mbFrozenPanes )
168 {
169  OSL_ENSURE( rData.IsSplit(), "XclExpPane::XclExpPane - no PANE record for unsplit view" );
170 }
171 
172 static const char* lcl_GetActivePane( sal_uInt8 nActivePane )
173 {
174  switch( nActivePane )
175  {
176  case EXC_PANE_TOPLEFT: return "topLeft";
177  case EXC_PANE_TOPRIGHT: return "topRight";
178  case EXC_PANE_BOTTOMLEFT: return "bottomLeft";
179  case EXC_PANE_BOTTOMRIGHT: return "bottomRight";
180  }
181  return "**error: lcl_GetActivePane";
182 }
183 
185 {
186  rStrm.GetCurrentStream()->singleElement( XML_pane,
187  XML_xSplit, OString::number(mnSplitX),
188  XML_ySplit, OString::number(mnSplitY),
189  XML_topLeftCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maSecondXclPos ).getStr(),
190  XML_activePane, lcl_GetActivePane( mnActivePane ),
191  XML_state, mbFrozenPanes ? "frozen" : "split" );
192 }
193 
195 {
196  rStrm << mnSplitX
197  << static_cast<sal_uInt16>( mnSplitY )
198  << maSecondXclPos
199  << mnActivePane;
200  if( rStrm.GetRoot().GetBiff() >= EXC_BIFF5 )
201  rStrm << sal_uInt8( 0 );
202 }
203 
206  mnPane( nPane )
207 {
208  if( const XclSelectionData* pSelData = rData.GetSelectionData( nPane ) )
209  maSelData = *pSelData;
210 
211  // find the cursor position in the selection list (or add it)
213  auto aIt = std::find_if(rXclSel.begin(), rXclSel.end(),
214  [this](const XclRange& rRange) { return rRange.Contains(maSelData.maXclCursor); });
215  if (aIt != rXclSel.end())
216  {
217  maSelData.mnCursorIdx = static_cast< sal_uInt16 >( std::distance(rXclSel.begin(), aIt) );
218  }
219  else
220  {
221  /* Cursor cell not found in list? (e.g. inactive pane, or removed in
222  ConvertRangeList(), because Calc cursor on invalid pos)
223  -> insert the valid Excel cursor. */
224  maSelData.mnCursorIdx = static_cast< sal_uInt16 >( rXclSel.size() );
225  rXclSel.push_back( XclRange( maSelData.maXclCursor ) );
226  }
227 }
228 
230 {
231  rStrm.GetCurrentStream()->singleElement( XML_selection,
232  XML_pane, lcl_GetActivePane( mnPane ),
233  XML_activeCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maSelData.maXclCursor ).getStr(),
234  XML_activeCellId, OString::number(maSelData.mnCursorIdx),
236 }
237 
239 {
240  rStrm << mnPane // pane for this selection
241  << maSelData.maXclCursor // cell cursor
242  << maSelData.mnCursorIdx; // index to range containing cursor
243  maSelData.maXclSelection.Write( rStrm, false );
244 }
245 
248  mrTabViewData( rTabViewData )
249 {
250 }
251 //TODO Fix savexml...
252 /*void XclExpTabBgColor::SaveXml( XclExpXmlStream& rStrm )
253 {
254 }*/
255 
257 {
259  return;
260  sal_uInt16 const rt = 0x0862; //rt
261  sal_uInt16 const grbitFrt = 0x0000; //grbit must be set to 0
262  sal_uInt32 unused = 0x00000000; //Use twice...
263  sal_uInt32 const cb = 0x00000014; // Record Size, may be larger in future...
264  sal_uInt16 const reserved = 0x0000; //trailing bits are 0
265  sal_uInt16 TabBgColorIndex;
266  XclExpPalette& rPal = rStrm.GetRoot().GetPalette();
267  TabBgColorIndex = rPal.GetColorIndex(mrTabViewData.mnTabBgColorId);
268  if (TabBgColorIndex < 8 || TabBgColorIndex > 63 ) // only numbers 8 - 63 are valid numbers
269  TabBgColorIndex = 127; //Excel specs: 127 makes excel ignore tab color information.
270  rStrm << rt << grbitFrt << unused << unused << cb << TabBgColorIndex << reserved;
271 }
272 
273 // Sheet view settings ========================================================
274 
275 namespace {
276 
278 sal_uInt16 lclGetXclZoom( tools::Long nScZoom, sal_uInt16 nDefXclZoom )
279 {
280  sal_uInt16 nXclZoom = limit_cast< sal_uInt16 >( nScZoom, EXC_ZOOM_MIN, EXC_ZOOM_MAX );
281  return (nXclZoom == nDefXclZoom) ? 0 : nXclZoom;
282 }
283 
284 } // namespace
285 
287  XclExpRoot( rRoot ),
288  mnGridColorId( XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT ) ),
289  mbHasTabSettings(false)
290 {
291  // *** sheet flags ***
292 
293  const XclExpTabInfo& rTabInfo = GetTabInfo();
294  maData.mbSelected = rTabInfo.IsSelectedTab( nScTab );
295  maData.mbDisplayed = rTabInfo.IsDisplayedTab( nScTab );
296  maData.mbMirrored = rTabInfo.IsMirroredTab( nScTab );
297 
298  const ScViewOptions& rViewOpt = GetDoc().GetViewOptions();
303 
304  // *** sheet options: cursor, selection, splits, grid color, zoom ***
305 
306  if( const ScExtTabSettings* pTabSett = GetExtDocOptions().GetTabSettings( nScTab ) )
307  {
308  mbHasTabSettings = true;
309  const ScExtTabSettings& rTabSett = *pTabSett;
311 
312  // first visible cell in top-left pane
313  if( (rTabSett.maFirstVis.Col() >= 0) && (rTabSett.maFirstVis.Row() >= 0) )
314  maData.maFirstXclPos = rAddrConv.CreateValidAddress( rTabSett.maFirstVis, false );
315 
316  // first visible cell in additional pane(s)
317  if( (rTabSett.maSecondVis.Col() >= 0) && (rTabSett.maSecondVis.Row() >= 0) )
318  maData.maSecondXclPos = rAddrConv.CreateValidAddress( rTabSett.maSecondVis, false );
319 
320  // active pane
321  switch( rTabSett.meActivePane )
322  {
327  }
328 
329  // freeze/split position
331  if( maData.mbFrozenPanes )
332  {
333  /* Frozen panes: handle split position as row/column positions.
334  #i35812# Excel uses number of visible rows/columns, Calc uses position of freeze. */
335  SCCOL nFreezeScCol = rTabSett.maFreezePos.Col();
336  if( (0 < nFreezeScCol) && (nFreezeScCol <= GetXclMaxPos().Col()) )
337  maData.mnSplitX = static_cast< sal_uInt16 >( nFreezeScCol ) - maData.maFirstXclPos.mnCol;
338  SCROW nFreezeScRow = rTabSett.maFreezePos.Row();
339  if( (0 < nFreezeScRow) && (nFreezeScRow <= GetXclMaxPos().Row()) )
340  maData.mnSplitY = static_cast< sal_uInt32 >( nFreezeScRow ) - maData.maFirstXclPos.mnRow;
341  // if both splits are left out (address overflow), remove the frozen flag
343 
344  // #i20671# frozen panes: mostright/mostbottom pane is active regardless of cursor position
347  else if( maData.HasPane( EXC_PANE_TOPRIGHT ) )
349  else if( maData.HasPane( EXC_PANE_BOTTOMLEFT ) )
351  }
352  else
353  {
354  // split window: position is in twips
355  maData.mnSplitX = static_cast<sal_uInt16>(rTabSett.maSplitPos.X());
356  maData.mnSplitY = static_cast<sal_uInt32>(rTabSett.maSplitPos.Y());
357  }
358 
359  // selection
364 
365  // grid color
366  const Color& rGridColor = rTabSett.maGridColor;
367  maData.mbDefGridColor = rGridColor == COL_AUTO;
368  if( !maData.mbDefGridColor )
369  {
370  if( GetBiff() == EXC_BIFF8 )
372  else
373  maData.maGridColor = rGridColor;
374  }
375  maData.mbShowGrid = rTabSett.mbShowGrid;
376 
377  // view mode and zoom
378  maData.mbPageMode = (GetBiff() == EXC_BIFF8) && rTabSett.mbPageMode;
379  maData.mnNormalZoom = lclGetXclZoom( rTabSett.mnNormalZoom, EXC_WIN2_NORMALZOOM_DEF );
380  maData.mnPageZoom = lclGetXclZoom( rTabSett.mnPageZoom, EXC_WIN2_PAGEZOOM_DEF );
382  }
383 
384  // Tab Bg Color
385  if ( GetBiff() == EXC_BIFF8 && !GetDoc().IsDefaultTabBgColor(nScTab) )
386  {
387  XclExpPalette& rPal = GetPalette();
390  }
391 }
392 
394 {
395  WriteWindow2( rStrm );
396  WriteScl( rStrm );
397  WritePane( rStrm );
402  WriteTabBgColor( rStrm );
403 }
404 
405 static void lcl_WriteSelection( XclExpXmlStream& rStrm, const XclTabViewData& rData, sal_uInt8 nPane )
406 {
407  if( rData.HasPane( nPane ) )
408  XclExpSelection( rData, nPane ).SaveXml( rStrm );
409 }
410 
411 static OString lcl_GetZoom( sal_uInt16 nZoom )
412 {
413  if( nZoom )
414  return OString::number( nZoom );
415  return "100";
416 }
417 
419 {
420  sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
421  rWorksheet->startElement(XML_sheetViews);
422 
423  // handle missing viewdata at embedded XLSX OLE objects
425  {
426  SCCOL nPosLeft = rStrm.GetRoot().GetDoc().GetPosLeft();
427  SCROW nPosTop = rStrm.GetRoot().GetDoc().GetPosTop();
428  if (nPosLeft > 0 || nPosTop > 0)
429  {
430  ScAddress aLeftTop(nPosLeft, nPosTop, 0);
432  maData.maFirstXclPos = rAddrConv.CreateValidAddress( aLeftTop, false );
433  }
434  }
435 
436  rWorksheet->startElement( XML_sheetView,
437  // OOXTODO: XML_windowProtection,
438  XML_showFormulas, ToPsz( maData.mbShowFormulas ),
439  XML_showGridLines, ToPsz( maData.mbShowGrid ),
440  XML_showRowColHeaders, ToPsz( maData.mbShowHeadings ),
441  XML_showZeros, ToPsz( maData.mbShowZeros ),
442  XML_rightToLeft, ToPsz( maData.mbMirrored ),
443  XML_tabSelected, ToPsz( maData.mbSelected ),
444  // OOXTODO: XML_showRuler,
445  XML_showOutlineSymbols, ToPsz( maData.mbShowOutline ),
446  XML_defaultGridColor, mnGridColorId == XclExpPalette::GetColorIdFromIndex( EXC_COLOR_WINDOWTEXT ) ? "true" : "false",
447  // OOXTODO: XML_showWhiteSpace,
448  XML_view, maData.mbPageMode ? "pageBreakPreview" : "normal", // OOXTODO: pageLayout
449  XML_topLeftCell, XclXmlUtils::ToOString( rStrm.GetRoot().GetStringBuf(), maData.maFirstXclPos ).getStr(),
450  XML_colorId, OString::number(rStrm.GetRoot().GetPalette().GetColorIndex(mnGridColorId)),
451  XML_zoomScale, lcl_GetZoom(maData.mnCurrentZoom),
452  XML_zoomScaleNormal, lcl_GetZoom(maData.mnNormalZoom),
453  // OOXTODO: XML_zoomScaleSheetLayoutView,
454  XML_zoomScalePageLayoutView, lcl_GetZoom(maData.mnPageZoom),
455  XML_workbookViewId, "0" // OOXTODO? 0-based index of document(xl/workbook.xml)/workbook/bookviews/workbookView
456  // should always be 0, as we only generate 1 such element.
457  );
458  if( maData.IsSplit() )
459  {
460  XclExpPane aPane( maData );
461  aPane.SaveXml( rStrm );
462  }
467  rWorksheet->endElement( XML_sheetView );
468  // OOXTODO: XML_extLst
469  rWorksheet->endElement( XML_sheetViews );
470 }
471 
472 // private --------------------------------------------------------------------
473 
475  const ScAddress& rCursor, const ScRangeList& rSelection )
476 {
477  if( !maData.HasPane( nPane ) )
478  return;
479 
480  XclSelectionData& rSelData = maData.CreateSelectionData( nPane );
481 
482  // first step: use top-left visible cell as cursor
483  rSelData.maXclCursor.mnCol = ((nPane == EXC_PANE_TOPLEFT) || (nPane == EXC_PANE_BOTTOMLEFT)) ?
485  rSelData.maXclCursor.mnRow = ((nPane == EXC_PANE_TOPLEFT) || (nPane == EXC_PANE_TOPRIGHT)) ?
487 
488  // second step, active pane: create actual selection data with current cursor position
489  if( nPane == maData.mnActivePane )
490  {
492  // cursor position (keep top-left pane position from above, if rCursor is invalid)
493  if( (rCursor.Col() >= 0) && (rCursor.Row() >= 0) )
494  rSelData.maXclCursor = rAddrConv.CreateValidAddress( rCursor, false );
495  // selection
496  rAddrConv.ConvertRangeList( rSelData.maXclSelection, rSelection, false );
497  }
498 }
499 
501 {
502 // #i43553# GCC 3.3 parse error
503 // XclExpWindow2( GetRoot(), maData, mnGridColorId ).Save( rStrm );
504  XclExpWindow2 aWindow2( GetRoot(), maData, mnGridColorId );
505  aWindow2.Save( rStrm );
506 }
507 
509 {
510  if( maData.mnCurrentZoom != 0 )
511  XclExpScl( maData.mnCurrentZoom ).Save( rStrm );
512 }
513 
515 {
516  if( maData.IsSplit() )
517 // #i43553# GCC 3.3 parse error
518 // XclExpPane( GetRoot(), maData ).Save( rStrm );
519  {
520  XclExpPane aPane( maData );
521  aPane.Save( rStrm );
522  }
523 }
524 
526 {
527  if( maData.HasPane( nPane ) )
528  XclExpSelection( maData, nPane ).Save( rStrm );
529 }
530 
532 {
533  if ( !maData.IsDefaultTabBgColor() )
534  XclExpTabBgColor( maData ).Save( rStrm );
535 }
536 
537 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const sal_uInt16 EXC_WIN2_FROZENNOSPLIT
Definition: xlview.hxx:60
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
Represents a PANE record containing settings for split/frozen windows.
Definition: xeview.hxx:86
bool mbPageMode
true = Frozen panes; false = split window.
Definition: xlview.hxx:135
ScExtPanePos meActivePane
Active (focused) pane.
Definition: scextopt.hxx:57
#define DBG_ERROR_BIFF()
Definition: xltools.hxx:31
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:698
XclAddress maFirstXclPos
Grid color.
Definition: xlview.hxx:123
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SCL record.
Definition: xeview.cxx:155
sal_uInt32 mnSplitY
Split X position, or number of frozen columns.
Definition: xlview.hxx:126
bool IsSelectedTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is selected and will be exported.
Definition: xelink.cxx:789
Bottom, or bottom-left pane.
Definition: scextopt.hxx:43
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:290
This class is used to export Excel record streams.
Definition: xestream.hxx:71
SCROW Row() const
Definition: address.hxx:262
OStringBuffer & GetStringBuf() const
Clean and return the OStringBuffer.
Definition: xeroot.hxx:159
XclExpPane(const XclTabViewData &rData)
Definition: xeview.cxx:161
ScAddress maCursor
The cursor position (column/row only).
Definition: scextopt.hxx:52
sal_uInt32 mnSplitY
Split X position, or frozen column.
Definition: xeview.hxx:99
const sal_uInt8 EXC_PANE_TOPRIGHT
Bottom-right pane.
Definition: xlview.hxx:73
void push_back(const XclRange &rRange)
Definition: xladdress.hxx:114
bool IsSplit() const
Returns true, if the window is split in any direction.
Definition: xlview.cxx:71
sal_uInt16 mnFlags
Color ID of grid color (>=BIFF8).
Definition: xeview.hxx:62
long Long
ScAddress maSecondVis
Top-left visible cell in add. panes (column/row only).
Definition: scextopt.hxx:54
bool mbShowOutline
true = Show zero value zells.
Definition: xlview.hxx:141
Spreadsheet grid color.
Definition: xestyle.hxx:57
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeview.cxx:184
sal_uInt32 mnTabBgColorId
Definition: xlview.hxx:143
const sal_uInt16 EXC_ID_SELECTION
Definition: xlview.hxx:35
const sal_uInt16 EXC_ZOOM_MIN
Definition: xlview.hxx:30
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SELECTION record.
Definition: xeview.cxx:238
const sal_uInt16 EXC_WIN2_MIRRORED
Definition: xlview.hxx:58
tools::Long mnNormalZoom
Zoom in percent for normal view.
Definition: scextopt.hxx:59
const ScExtDocSettings & GetDocSettings() const
Definition: scextopt.cxx:170
bool mbFrozenPanes
true = Mirrored (right-to-left) sheet.
Definition: xlview.hxx:134
const sal_uInt16 EXC_WIN2_SHOWHEADINGS
Definition: xlview.hxx:54
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:94
void Shorten(sal_uInt16 nFactor)
Tries to shorten numerator and denominator by the passed value.
Definition: xeview.cxx:146
sal_uInt32 mnRow
Definition: xladdress.hxx:33
const sal_uInt16 EXC_ID_WINDOW1
Definition: xlview.hxx:39
ReturnType limit_cast(Type nValue, ReturnType nMin, ReturnType nMax)
Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits...
Definition: ftools.hxx:62
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:276
ScRangeList maSelection
Selected cell ranges (columns/rows only).
Definition: scextopt.hxx:51
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the WINDOW2 record.
Definition: xeview.cxx:112
size_t size() const
Definition: xladdress.hxx:109
const sal_uInt16 EXC_ID_SCL
Single, top, left, or top-left pane.
Definition: xlview.hxx:79
double mfTabBarWidth
Width of the tabbar, relative to frame window width (0.0 ... 1.0).
Definition: scextopt.hxx:31
XclExpSelection(const XclTabViewData &rData, sal_uInt8 nPane)
Definition: xeview.cxx:204
FuncFlags mnFlags
Information about all parameters.
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
XclRangeList maXclSelection
Cell cursor position.
Definition: xlview.hxx:108
sal_uInt32 mnGridColorId
All view settings for a sheet.
Definition: xeview.hxx:161
Represents a SELECTION record with selection data for a pane.
Definition: xeview.hxx:106
Access to global data from other classes.
Definition: xeroot.hxx:113
const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF
Default zoom for normal view.
Definition: xlview.hxx:66
sal_uInt16 GetFirstVisXclTab() const
Returns the Excel index of the first visible sheet.
Definition: xelink.hxx:102
bool mbSelected
Active pane (with cell cursor).
Definition: xlview.hxx:131
MS Excel 4.0.
Definition: xlconst.hxx:35
const sal_uInt8 EXC_PANE_BOTTOMRIGHT
Definition: xlview.hxx:72
XclSelectionData & CreateSelectionData(sal_uInt8 nPane)
Returns read/write access to the selection data of the specified pane.
Definition: xlview.cxx:95
sal_uInt16 mnDenom
Numerator of the zoom factor.
Definition: xeview.hxx:82
const sal_uInt16 EXC_WIN2_DISPLAYED
Definition: xlview.hxx:62
const sal_uInt16 EXC_ID_PANE
Default zoom for pagebreak preview.
Definition: xlview.hxx:70
XclSelectionData maSelData
Definition: xeview.hxx:117
void WritePane(XclExpStream &rStrm) const
Definition: xeview.cxx:514
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeview.cxx:418
bool mbShowGrid
Whether or not to display gridlines.
Definition: scextopt.hxx:64
XclAddress CreateValidAddress(const ScAddress &rScPos, bool bWarn)
Returns a valid cell address by moving it into allowed dimensions.
Definition: xehelper.cxx:195
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
Definition: xestyle.cxx:763
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:910
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeview.cxx:50
Contains all settings for a selection in a single pane of a sheet.
Definition: xlview.hxx:105
const sal_uInt16 EXC_ZOOM_MAX
Definition: xlview.hxx:31
bool IsMirroredTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is displayed in right-to-left mode.
Definition: xelink.cxx:800
XclRangeVector::const_iterator end() const
Definition: xladdress.hxx:112
const sal_uInt16 EXC_WIN2_SELECTED
Definition: xlview.hxx:61
XclRangeVector::const_iterator begin() const
Definition: xladdress.hxx:111
bool mbFrozenPanes
true = Frozen panes; false = Normal splits.
Definition: scextopt.hxx:62
bool mbDefGridColor
true = Pagebreak preview; false = Normal view.
Definition: xlview.hxx:136
bool mbShowFormulas
true = Default grid color.
Definition: xlview.hxx:137
void WriteWindow2(XclExpStream &rStrm) const
Definition: xeview.cxx:500
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:36
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SHEETEXT record.
Definition: xeview.cxx:256
const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF
Definition: xlview.hxx:65
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:81
void CreateSelectionData(sal_uInt8 nPane, const ScAddress &rCursor, const ScRangeList &rSelection)
Creates selection data for the specified pane.
Definition: xeview.cxx:474
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
Definition: xestyle.cxx:778
const sal_uInt16 EXC_COLOR_WINDOWTEXT
System window background color (BIFF3-BIFF4).
Definition: xlstyle.hxx:208
XclAddress maXclCursor
Definition: xlview.hxx:107
ScExtDocOptions & GetExtDocOptions() const
Returns the extended document options.
Definition: xlroot.cxx:419
const sal_uInt16 EXC_WIN2_PAGEBREAKMODE
Definition: xlview.hxx:63
sal_Int16 SCCOL
Definition: types.hxx:22
XclExpPalette & GetPalette() const
Returns the color buffer.
Definition: xeroot.cxx:105
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the WINDOW1 record.
Definition: xeview.cxx:71
A 2D cell range address list with Excel column and row indexes.
Definition: xladdress.hxx:101
Stores all used colors in the document.
Definition: xestyle.hxx:76
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the PANE record.
Definition: xeview.cxx:194
sal_uInt16 mnPageZoom
Zoom factor for normal view.
Definition: xeview.hxx:65
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xeview.cxx:229
sal_uInt16 mnCursorIdx
Selected cell ranges.
Definition: xlview.hxx:109
virtual void Save(XclExpStream &rStrm) override
Writes all view settings records to the stream.
Definition: xeview.cxx:393
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:74
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
Stores the correct Excel sheet index for each Calc sheet.
Definition: xelink.hxx:62
MS Excel 3.0.
Definition: xlconst.hxx:34
const sal_uInt16 EXC_WIN1_TABBAR
Definition: xlview.hxx:45
static const char * lcl_GetActivePane(sal_uInt8 nActivePane)
Definition: xeview.cxx:172
Color maGridColor
Selections of all panes.
Definition: xlview.hxx:122
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:75
Color maGridColor
Grid color.
Definition: scextopt.hxx:58
sal_uInt16 mnCol
Definition: xladdress.hxx:32
const sal_uInt16 EXC_WIN2_DEFGRIDCOLOR
Definition: xlview.hxx:57
const sal_uInt16 EXC_WIN1_VER_SCROLLBAR
Definition: xlview.hxx:44
const sal_uInt16 EXC_WIN2_SHOWFORMULAS
Definition: xlview.hxx:52
sal_uInt16 mnNum
Definition: xeview.hxx:81
std::shared_ptr< FastSerializerHelper > FSHelperPtr
XclExpTabBgColor(const XclTabViewData &rTabViewData)
Definition: xeview.cxx:246
sal_uInt16 mnNormalZoom
First visible cell.
Definition: xeview.hxx:64
const sal_uInt16 EXC_WIN2_SHOWZEROS
Definition: xlview.hxx:56
Extended settings for a sheet, used in import/export filters.
Definition: scextopt.hxx:48
bool mbShowGrid
true = Show formulas instead of results.
Definition: xlview.hxx:138
Color maTabBgColor
true = Show outlines.
Definition: xlview.hxx:142
Right, or top-right pane.
Definition: scextopt.hxx:42
SCCOL Col() const
Definition: address.hxx:267
sal_uInt16 mnTabBarSize
Option flags.
Definition: xeview.hxx:43
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:119
static void lcl_WriteSelection(XclExpXmlStream &rStrm, const XclTabViewData &rData, sal_uInt8 nPane)
Definition: xeview.cxx:405
const sal_uInt16 EXC_ID_WINDOW2
Definition: xlview.hxx:50
void WriteTabBgColor(XclExpStream &rStrm) const
Definition: xeview.cxx:531
ScAddress maFreezePos
Position of frozen panes (column/row only).
Definition: scextopt.hxx:55
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1937
XclAddress maFirstXclPos
Option flags.
Definition: xeview.hxx:63
Represents an SCL record for the zoom factor of the current view of a sheet.
Definition: xeview.hxx:69
Provides functions to convert Calc cell addresses to Excel cell addresses.
Definition: xehelper.hxx:79
void WriteSelection(XclExpStream &rStrm, sal_uInt8 nPane) const
Definition: xeview.cxx:525
bool mbDisplayed
true = Sheet is selected.
Definition: xlview.hxx:132
Contains all view settings for a single sheet.
Definition: xlview.hxx:117
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:443
SCCOL GetPosLeft() const
Definition: document.hxx:867
bool HasPane(sal_uInt8 nPaneId) const
Returns true, if the specified pane (EXC_PANE_*) is available.
Definition: xlview.cxx:76
sal_Int32 SCROW
Definition: types.hxx:18
sal_uInt32 mnGridColorId
Grid color (<=BIFF5).
Definition: xeview.hxx:61
sal_uInt16 mnPageZoom
Zoom factor for normal view.
Definition: xlview.hxx:128
const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR
Definition: xlview.hxx:43
bool mbShowHeadings
true = Show cell grid.
Definition: xlview.hxx:139
#define OSL_ENSURE_BIFF(c)
Definition: xltools.hxx:32
sal_uInt16 GetXclSelectedCount() const
Returns the number of exported selected sheets.
Definition: xelink.hxx:97
const sal_uInt8 EXC_PANE_BOTTOMLEFT
Right, or top-right pane.
Definition: xlview.hxx:74
unsigned char sal_uInt8
XclExpTabViewSettings(const XclExpRoot &rRoot, SCTAB nScTab)
Creates all records containing the view settings of the specified sheet.
Definition: xeview.cxx:286
XclExpScl(sal_uInt16 nZoom)
Definition: xeview.cxx:137
Color maGridColor
Definition: xeview.hxx:60
bool IsDefaultTabBgColor() const
Tab Color default = (COL_AUTO )
Definition: xlview.hxx:143
XclExpWindow2(const XclExpRoot &rRoot, const XclTabViewData &rData, sal_uInt32 nGridColorId)
Definition: xeview.cxx:88
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version)...
Definition: xlroot.hxx:245
sal_uInt16 mnFlags
Definition: xeview.hxx:42
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
const sal_uInt8 EXC_PANE_TOPLEFT
Bottom, or bottom-left pane.
Definition: xlview.hxx:75
sal_uInt8 mnActivePane
Zoom factor for current view.
Definition: xlview.hxx:130
XclTabViewData maData
Definition: xeview.hxx:160
const sal_uInt16 EXC_WIN2_FROZEN
Definition: xlview.hxx:55
Point maSplitPos
Position of split.
Definition: scextopt.hxx:56
XclAddress maSecondXclPos
Split Y position, or frozen row.
Definition: xeview.hxx:100
sal_uInt16 mnSplitX
First visible cell in additional panes.
Definition: xlview.hxx:125
bool mbShowZeros
true = Show column/row headings.
Definition: xlview.hxx:140
sal_uInt16 GetDisplayedXclTab() const
Returns the Excel index of the active, displayed sheet.
Definition: xelink.hxx:100
const sal_uInt16 EXC_WIN2_SHOWGRID
Definition: xlview.hxx:53
static OString lcl_GetZoom(sal_uInt16 nZoom)
Definition: xeview.cxx:411
sal_uInt8 mnActivePane
First visible cell in additional panes.
Definition: xeview.hxx:101
bool mbHasTabSettings
Color identifier for grid color.
Definition: xeview.hxx:162
MS Excel 2.1.
Definition: xlconst.hxx:33
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:86
sal_uInt16 mnSplitX
Definition: xeview.hxx:98
ScAddress maFirstVis
Top-left visible cell (column/row only).
Definition: scextopt.hxx:53
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
static sal_uInt32 GetColorIdFromIndex(sal_uInt16 nIndex)
Returns the color ID representing a fixed Excel palette index (i.e.
Definition: xestyle.cxx:768
Single, top, left, or top-left pane.
Definition: scextopt.hxx:41
sal_uInt8 mnPane
Selection data.
Definition: xeview.hxx:118
const sal_uInt16 EXC_COLOR_NOTABBG
mask for tab color
Definition: xlview.hxx:85
const sal_uInt16 EXC_WIN2_SHOWOUTLINE
Definition: xlview.hxx:59
SCROW GetPosTop() const
Definition: document.hxx:869
const XclTabViewData & mrTabViewData
Definition: xeview.hxx:132
bool mbFrozenPanes
Active pane (with cell cursor).
Definition: xeview.hxx:102
const sal_uInt16 EXC_ID_SHEETEXT
Definition: xlview.hxx:83
const XclSelectionData * GetSelectionData(sal_uInt8 nPane) const
Returns the selection data, if available, otherwise 0.
Definition: xlview.cxx:89
sal_uInt16 mnCurrentZoom
Zoom factor for pagebreak preview.
Definition: xlview.hxx:129
tools::Long mnPageZoom
Zoom in percent for pagebreak preview.
Definition: scextopt.hxx:60
void Write(XclExpStream &rStrm, bool bCol16Bit=true, sal_uInt16 nCountInStream=0) const
Definition: xladdress.cxx:103
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:58
bool IsDisplayedTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is the displayed (active) sheet.
Definition: xelink.cxx:794
Represents a WINDOW2 record with general view settings for a sheet.
Definition: xeview.hxx:49
sal_uInt16 mnNormalZoom
Split Y position, or number of frozen rows.
Definition: xlview.hxx:127
bool mbPageMode
true = Pagebreak mode; false = Normal view mode.
Definition: scextopt.hxx:63
Base class for single records with any content.
Definition: xerecord.hxx:143
sal_Int16 SCTAB
Definition: types.hxx:23
XclAddress maSecondXclPos
First visible cell.
Definition: xlview.hxx:124
Text color in a form control.
Definition: xestyle.hxx:56
Bottom-right pane.
Definition: scextopt.hxx:44
bool mbMirrored
true = Sheet is displayed (active).
Definition: xlview.hxx:133
void WriteScl(XclExpStream &rStrm) const
Definition: xeview.cxx:508
XclExpWindow1(const XclExpRoot &rRoot)
Definition: xeview.cxx:35