21#include <document.hxx>
28#include <oox/token/tokens.hxx>
46 if( (0.0 <= fTabBarWidth) && (fTabBarWidth <= 1.0) )
47 mnTabBarSize =
static_cast< sal_uInt16
>( fTabBarWidth * 1000.0 + 0.5 );
54 rStrm.GetCurrentStream()->singleElement( XML_workbookView,
62 XML_windowWidth, OString::number(0x4000),
63 XML_windowHeight, OString::number(0x2000),
75 rStrm << sal_uInt16( 0 )
77 << sal_uInt16( 0x4000 )
78 << sal_uInt16( 0x2000 )
91 maGridColor( rData.maGridColor ),
92 mnGridColorId( nGridColorId ),
94 maFirstXclPos( rData.maFirstXclPos ),
95 mnNormalZoom( rData.mnNormalZoom ),
96 mnPageZoom( rData.mnPageZoom )
148 while( (
mnNum % nFactor == 0) && (
mnDenom % nFactor == 0) )
163 mnSplitX( rData.mnSplitX ),
164 mnSplitY( rData.mnSplitY ),
165 maSecondXclPos( rData.maSecondXclPos ),
166 mnActivePane( rData.mnActivePane ),
167 mbFrozenPanes( rData.mbFrozenPanes )
169 OSL_ENSURE( rData.
IsSplit(),
"XclExpPane::XclExpPane - no PANE record for unsplit view" );
174 switch( nActivePane )
181 return "**error: lcl_GetActivePane";
186 rStrm.GetCurrentStream()->singleElement( XML_pane,
187 XML_xSplit, OString::number(
mnSplitX),
188 XML_ySplit, OString::number(
mnSplitY),
197 <<
static_cast<sal_uInt16
>(
mnSplitY )
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())
231 rStrm.GetCurrentStream()->singleElement( XML_selection,
248 mrTabViewData( rTabViewData )
260 sal_uInt16
const rt = 0x0862;
261 sal_uInt16
const grbitFrt = 0x0000;
262 sal_uInt32 unused = 0x00000000;
263 sal_uInt32
const cb = 0x00000014;
264 sal_uInt16
const reserved = 0x0000;
265 sal_uInt16 TabBgColorIndex;
268 if (TabBgColorIndex < 8 || TabBgColorIndex > 63 )
269 TabBgColorIndex = 127;
270 rStrm << rt << grbitFrt << unused << unused << cb << TabBgColorIndex << reserved;
278sal_uInt16 lclGetXclZoom(
tools::Long nScZoom, sal_uInt16 nDefXclZoom )
281 return (nXclZoom == nDefXclZoom) ? 0 : nXclZoom;
289 mbHasTabSettings(false)
414 return OString::number( nZoom );
421 rWorksheet->startElement(XML_sheetViews);
426 SCCOL nPosLeft =
rStrm.GetRoot().GetDoc().GetPosLeft();
427 SCROW nPosTop =
rStrm.GetRoot().GetDoc().GetPosTop();
428 if (nPosLeft > 0 || nPosTop > 0)
430 ScAddress aLeftTop(nPosLeft, nPosTop, 0);
436 rWorksheet->startElement( XML_sheetView,
450 XML_colorId, OString::number(
rStrm.GetRoot().GetPalette().GetColorIndex(
mnGridColorId)),
455 XML_workbookViewId,
"0"
467 rWorksheet->endElement( XML_sheetView );
469 rWorksheet->endElement( XML_sheetViews );
493 if( (rCursor.
Col() >= 0) && (rCursor.
Row() >= 0) )
constexpr tools::Long Y() const
constexpr tools::Long X() const
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
const ScExtDocSettings & GetDocSettings() const
bool GetOption(ScViewOption eOpt) const
Provides functions to convert Calc cell addresses to Excel cell addresses.
XclAddress CreateValidAddress(const ScAddress &rScPos, bool bWarn)
Returns a valid cell address by moving it into allowed dimensions.
void ConvertRangeList(XclRangeList &rXclRanges, const ScRangeList &rScRanges, bool bWarn)
Converts the passed Calc cell range list to an Excel cell range list.
Stores all used colors in the document.
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
static sal_uInt32 GetColorIdFromIndex(sal_uInt16 nIndex)
Returns the color ID representing a fixed Excel palette index (i.e.
Represents a PANE record containing settings for split/frozen windows.
XclExpPane(const XclTabViewData &rData)
sal_uInt32 mnSplitY
Split X position, or frozen column.
sal_uInt8 mnActivePane
First visible cell in additional panes.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the PANE record.
bool mbFrozenPanes
Active pane (with cell cursor).
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclAddress maSecondXclPos
Split Y position, or frozen row.
Base class for single records with any content.
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Access to global data from other classes.
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
XclExpPalette & GetPalette() const
Returns the color buffer.
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Represents an SCL record for the zoom factor of the current view of a sheet.
XclExpScl(sal_uInt16 nZoom)
sal_uInt16 mnDenom
Numerator of the zoom factor.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SCL record.
void Shorten(sal_uInt16 nFactor)
Tries to shorten numerator and denominator by the passed value.
Represents a SELECTION record with selection data for a pane.
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpSelection(const XclTabViewData &rData, sal_uInt8 nPane)
sal_uInt8 mnPane
Selection data.
XclSelectionData maSelData
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SELECTION record.
This class is used to export Excel record streams.
XclExpTabBgColor(const XclTabViewData &rTabViewData)
const XclTabViewData & mrTabViewData
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SHEETEXT record.
Stores the correct Excel sheet index for each Calc sheet.
bool IsMirroredTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is displayed in right-to-left mode.
sal_uInt16 GetFirstVisXclTab() const
Returns the Excel index of the first visible sheet.
bool IsDisplayedTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is the displayed (active) sheet.
sal_uInt16 GetXclSelectedCount() const
Returns the number of exported selected sheets.
bool IsSelectedTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet is selected and will be exported.
sal_uInt16 GetDisplayedXclTab() const
Returns the Excel index of the active, displayed sheet.
virtual void SaveXml(XclExpXmlStream &rStrm) override
void WriteSelection(XclExpStream &rStrm, sal_uInt8 nPane) const
virtual void Save(XclExpStream &rStrm) override
Writes all view settings records to the stream.
void WriteScl(XclExpStream &rStrm) const
void WriteWindow2(XclExpStream &rStrm) const
sal_uInt32 mnGridColorId
All view settings for a sheet.
void WritePane(XclExpStream &rStrm) const
void CreateSelectionData(sal_uInt8 nPane, const ScAddress &rCursor, const ScRangeList &rSelection)
Creates selection data for the specified pane.
void WriteTabBgColor(XclExpStream &rStrm) const
XclExpTabViewSettings(const XclExpRoot &rRoot, SCTAB nScTab)
Creates all records containing the view settings of the specified sheet.
bool mbHasTabSettings
Color identifier for grid color.
virtual void SaveXml(XclExpXmlStream &rStrm) override
sal_uInt16 mnTabBarSize
Option flags.
XclExpWindow1(const XclExpRoot &rRoot)
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the WINDOW1 record.
Represents a WINDOW2 record with general view settings for a sheet.
sal_uInt16 mnPageZoom
Zoom factor for normal view.
XclExpWindow2(const XclExpRoot &rRoot, const XclTabViewData &rData, sal_uInt32 nGridColorId)
sal_uInt16 mnFlags
Color ID of grid color (>=BIFF8).
sal_uInt32 mnGridColorId
Grid color (<=BIFF5).
XclAddress maFirstXclPos
Option flags.
sal_uInt16 mnNormalZoom
First visible cell.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the WINDOW2 record.
A 2D cell range address list with Excel column and row indexes.
XclRangeVector::const_iterator begin() const
void push_back(const XclRange &rRange)
void Write(XclExpStream &rStrm, bool bCol16Bit=true, sal_uInt16 nCountInStream=0) const
XclRangeVector::const_iterator end() const
ScExtDocOptions & GetExtDocOptions() const
Returns the extended document options.
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version).
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
static OString ToOString(const Color &rColor)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
@ SCEXT_PANE_BOTTOMLEFT
Bottom, or bottom-left pane.
@ SCEXT_PANE_BOTTOMRIGHT
Bottom-right pane.
@ SCEXT_PANE_TOPLEFT
Single, top, left, or top-left pane.
@ SCEXT_PANE_TOPRIGHT
Right, or top-right pane.
double mfTabBarWidth
Width of the tabbar, relative to frame window width (0.0 ... 1.0).
Extended settings for a sheet, used in import/export filters.
Point maSplitPos
Position of split.
bool mbFrozenPanes
true = Frozen panes; false = Normal splits.
ScAddress maSecondVis
Top-left visible cell in add. panes (column/row only).
Color maGridColor
Grid color.
ScAddress maCursor
The cursor position (column/row only).
bool mbShowGrid
Whether or not to display gridlines.
ScExtPanePos meActivePane
Active (focused) pane.
ScRangeList maSelection
Selected cell ranges (columns/rows only).
ScAddress maFirstVis
Top-left visible cell (column/row only).
tools::Long mnPageZoom
Zoom in percent for pagebreak preview.
bool mbPageMode
true = Pagebreak mode; false = Normal view mode.
ScAddress maFreezePos
Position of frozen panes (column/row only).
tools::Long mnNormalZoom
Zoom in percent for normal view.
A 2D cell range address struct with Excel column and row indexes.
Contains all settings for a selection in a single pane of a sheet.
sal_uInt16 mnCursorIdx
Selected cell ranges.
XclRangeList maXclSelection
Cell cursor position.
Contains all view settings for a single sheet.
sal_uInt32 mnSplitY
Split X position, or number of frozen columns.
bool IsDefaultTabBgColor() const
Tab Color default = (COL_AUTO )
XclSelectionData & CreateSelectionData(sal_uInt8 nPane)
Returns read/write access to the selection data of the specified pane.
bool mbShowHeadings
true = Show cell grid.
XclAddress maSecondXclPos
First visible cell.
bool mbMirrored
true = Sheet is displayed (active).
sal_uInt16 mnSplitX
First visible cell in additional panes.
bool mbDefGridColor
true = Pagebreak preview; false = Normal view.
bool mbShowFormulas
true = Default grid color.
Color maTabBgColor
true = Show outlines.
bool mbFrozenPanes
true = Mirrored (right-to-left) sheet.
bool mbSelected
Active pane (with cell cursor).
bool IsSplit() const
Returns true, if the window is split in any direction.
XclAddress maFirstXclPos
Grid color.
sal_uInt16 mnNormalZoom
Split Y position, or number of frozen rows.
bool mbShowGrid
true = Show formulas instead of results.
sal_uInt32 mnTabBgColorId
bool mbShowOutline
true = Show zero value zells.
sal_uInt16 mnCurrentZoom
Zoom factor for pagebreak preview.
bool mbShowZeros
true = Show column/row headings.
const XclSelectionData * GetSelectionData(sal_uInt8 nPane) const
Returns the selection data, if available, otherwise 0.
bool HasPane(sal_uInt8 nPaneId) const
Returns true, if the specified pane (EXC_PANE_*) is available.
sal_uInt16 mnPageZoom
Zoom factor for normal view.
Color maGridColor
Selections of all panes.
bool mbPageMode
true = Frozen panes; false = split window.
bool mbDisplayed
true = Sheet is selected.
sal_uInt8 mnActivePane
Zoom factor for current view.
@ EXC_COLOR_GRID
Text color in a form control.
@ EXC_COLOR_TABBG
Spreadsheet grid color.
static OString lcl_GetZoom(sal_uInt16 nZoom)
static const char * lcl_GetActivePane(sal_uInt8 nActivePane)
static void lcl_WriteSelection(XclExpXmlStream &rStrm, const XclTabViewData &rData, sal_uInt8 nPane)
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
const sal_uInt16 EXC_COLOR_WINDOWTEXT
System window background color (BIFF3-BIFF4).
const sal_uInt16 EXC_WIN2_SHOWOUTLINE
const sal_uInt8 EXC_PANE_BOTTOMLEFT
Right, or top-right pane.
const sal_uInt16 EXC_WIN2_MIRRORED
const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF
Default zoom for normal view.
const sal_uInt16 EXC_ID_SCL
Single, top, left, or top-left pane.
const sal_uInt8 EXC_PANE_TOPLEFT
Bottom, or bottom-left pane.
const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF
const sal_uInt16 EXC_WIN1_TABBAR
const sal_uInt16 EXC_WIN2_SHOWGRID
const sal_uInt16 EXC_WIN1_VER_SCROLLBAR
const sal_uInt16 EXC_WIN2_DEFGRIDCOLOR
const sal_uInt16 EXC_WIN2_SHOWFORMULAS
const sal_uInt8 EXC_PANE_TOPRIGHT
Bottom-right pane.
const sal_uInt16 EXC_WIN2_PAGEBREAKMODE
const sal_uInt16 EXC_WIN2_FROZENNOSPLIT
const sal_uInt16 EXC_ZOOM_MAX
const sal_uInt16 EXC_ID_WINDOW2
const sal_uInt16 EXC_WIN2_SELECTED
const sal_uInt16 EXC_ID_PANE
Default zoom for pagebreak preview.
const sal_uInt16 EXC_WIN2_SHOWHEADINGS
const sal_uInt16 EXC_WIN2_FROZEN
const sal_uInt16 EXC_ID_SELECTION
const sal_uInt16 EXC_ZOOM_MIN
const sal_uInt16 EXC_WIN2_DISPLAYED
const sal_uInt16 EXC_COLOR_NOTABBG
mask for tab color
const sal_uInt16 EXC_ID_WINDOW1
const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR
const sal_uInt8 EXC_PANE_BOTTOMRIGHT
const sal_uInt16 EXC_WIN2_SHOWZEROS
const sal_uInt16 EXC_ID_SHEETEXT