LibreOffice Module sc (master) 1
worksheethelper.hxx
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#pragma once
21
24#include <oox/ole/olehelper.hxx>
25#include <rangelst.hxx>
26#include "formulabase.hxx"
27
29class ScDocument;
30
31namespace com::sun::star {
32 namespace awt { struct Point; }
33 namespace awt { struct Rectangle; }
34 namespace awt { struct Size; }
35 namespace drawing { class XDrawPage; }
36 namespace sheet { class XSpreadsheet; }
37 namespace table { class XCell; }
38 namespace table { class XCellRange; }
39}
40
41namespace oox::xls {
42
43class AutoFilterBuffer;
44class CommentsBuffer;
45class CondFormatBuffer;
46class Font;
47class PageSettings;
48class QueryTableBuffer;
49class RichString;
50class SheetDataBuffer;
51class SheetViewSettings;
52class VmlDrawing;
53class WorksheetSettings;
54
55typedef ::std::map< OUString, ScDataBarFormatData* > ExtLst;
56
58enum class WorksheetType
59{
60 Work,
61 Chart,
62 Macro,
63 Dialog,
64 Empty
65};
66
69{
71 double mfWidth;
72 sal_Int32 mnXfId;
73 sal_Int32 mnLevel;
75 bool mbHidden:1;
76 bool mbCollapsed:1;
77
78 explicit ColumnModel();
79
81 bool isMergeable( const ColumnModel& rModel ) const;
82};
83
86{
87 sal_Int32 mnRow;
88 double mfHeight;
89 sal_Int32 mnXfId;
90 sal_Int32 mnLevel;
94 bool mbHidden:1;
95 bool mbCollapsed:1;
96 bool mbThickTop:1;
98
99 explicit RowModel();
100
102 bool isMergeable( const RowModel& rModel ) const;
103};
104
107{
108 sal_Int32 mnColRow;
109 sal_Int32 mnMin;
110 sal_Int32 mnMax;
111 bool mbManual;
112
113 explicit PageBreakModel();
114};
115
118{
120 OUString maTooltip;
121
122 explicit HyperlinkModel();
123};
124
127{
131 OUString msRef;
132 OUString maInputTitle;
134 OUString maErrorTitle;
136 sal_Int32 mnType;
137 sal_Int32 mnOperator;
138 sal_Int32 mnErrorStyle;
143
144 explicit ValidationModel();
145
149 void setBiffOperator( sal_uInt8 nOperator );
151 void setBiffErrorStyle( sal_uInt8 nErrorStyle );
152};
153
154class WorksheetGlobals;
155typedef std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef;
156
158public:
162 const ISegmentProgressBarRef &rxRowProgress ) = 0;
163};
164
166{
167public:
168 /*implicit*/ WorksheetHelper( WorksheetGlobals& rSheetGlob );
169
171 const WorkbookHelper& rHelper,
172 const ISegmentProgressBarRef& rxProgressBar,
173 WorksheetType eSheetType,
174 SCTAB nSheet );
175
176 // horrible accessor for hidden WorksheetGlobals ...
178
182 SCTAB getSheetIndex() const;
184 const css::uno::Reference< css::sheet::XSpreadsheet >&
185 getSheet() const;
186
188 css::uno::Reference< css::table::XCell >
189 getCell( const ScAddress& rAddress ) const;
191 css::uno::Reference< css::table::XCellRange >
192 getCellRange( const ScRange& rRange ) const;
193
195 css::uno::Reference< css::drawing::XDrawPage >
196 getDrawPage() const;
197
199 css::awt::Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const;
201 const css::awt::Size& getDrawPageSize() const;
202
220 VmlDrawing& getVmlDrawing() const;
221
222 ExtLst& getExtLst() const;
223
225 void setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
227 void setHyperlink( const HyperlinkModel& rModel );
229 void setValidation( const ValidationModel& rModel );
231 void setDrawingPath( const OUString& rDrawingPath );
233 void setVmlDrawingPath( const OUString& rVmlDrawingPath );
234
236 void extendUsedArea( const ScAddress& rAddress );
238 void extendUsedArea( const ScRange& rRange );
240 void extendShapeBoundingBox( const css::awt::Rectangle& rShapeRect );
241
244 void setBaseColumnWidth( sal_Int32 nWidth );
247 void setDefaultColumnWidth( double fWidth );
251 void setColumnModel( const ColumnModel& rModel );
252
255 double fHeight, bool bCustomHeight,
256 bool bHidden, bool bThickTop, bool bThickBottom );
260 void setRowModel( const RowModel& rModel );
261
263 void putRichString(
264 const ScAddress& rAddress,
265 RichString& rString,
266 const oox::xls::Font* pFirstPortionFont,
267 bool bSingleLine = false);
268
270 void putFormulaTokens(
271 const ScAddress& rAddress, const ApiTokenSequence& rTokens );
272
279
280 void setCellFormula( const ScAddress& rTokenAddress, const OUString& );
281
282 void setCellFormula(
283 const ScAddress& rAddr, sal_Int32 nSharedId,
284 const OUString& rCellValue, sal_Int32 nValueType );
285
286 void setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr );
287
289 const ScAddress& rAddress,
290 sal_Int32 nSharedId, const OUString& rTokens );
291
293 const ScAddress& rAddress, const OUString& rValueStr, sal_Int32 nCellType );
294
296
297
298private:
300};
301
302} // namespace oox::xls
303
304/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ISegmentProgressBarRef getRowProgress()=0
virtual void setCustomRowProgress(const ISegmentProgressBarRef &rxRowProgress)=0
Contains string data and a list of formatting runs for a rich formatted string.
Definition: richstring.hxx:207
Manages the cell contents and cell formatting of a sheet.
Helper class to provide access to global workbook data.
PageSettings & getPageSettings() const
Returns the page/print settings for this sheet.
css::awt::Point getCellPosition(sal_Int32 nCol, sal_Int32 nRow) const
Returns the absolute cell position in 1/100 mm.
void extendShapeBoundingBox(const css::awt::Rectangle &rShapeRect)
Extends the shape bounding box by the position and size of the passed rectangle (in 1/100 mm).
VmlDrawing & getVmlDrawing() const
Returns the VML drawing page for this sheet (OOXML/BIFF12 only).
void setCellFormula(const ScAddress &rTokenAddress, const OUString &)
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
CondFormatBuffer & getCondFormats() const
Returns the conditional formatting in this sheet.
const css::awt::Size & getDrawPageSize() const
Returns the size of the entire drawing page in 1/100 mm.
WorksheetType getSheetType() const
Returns the type of this sheet.
void setPageBreak(const PageBreakModel &rModel, bool bRowBreak)
Sets a column or row page break described in the passed struct.
void finalizeDrawingImport()
Final import of drawing objects.
WorksheetGlobals & mrSheetGlob
WorksheetSettings & getWorksheetSettings() const
Returns the worksheet settings object.
void setDrawingPath(const OUString &rDrawingPath)
Sets the path to the DrawingML fragment of this sheet.
SheetDataBuffer & getSheetData() const
Returns the buffer for cell contents and cell formatting.
static WorksheetGlobalsRef constructGlobals(const WorkbookHelper &rHelper, const ISegmentProgressBarRef &rxProgressBar, WorksheetType eSheetType, SCTAB nSheet)
void createSharedFormulaMapEntry(const ScAddress &rAddress, sal_Int32 nSharedId, const OUString &rTokens)
void setDefaultColumnWidth(double fWidth)
Sets default width for all columns.
SCTAB getSheetIndex() const
Returns the index of the current sheet.
void putRichString(const ScAddress &rAddress, RichString &rString, const oox::xls::Font *pFirstPortionFont, bool bSingleLine=false)
Inserts a rich-string cell directly into the Calc sheet.
void setColumnModel(const ColumnModel &rModel)
Sets column settings for a specific range of columns.
void setCellArrayFormula(const ScRange &rRangeAddress, const ScAddress &rTokenAddress, const OUString &rTokenStr)
void setBaseColumnWidth(sal_Int32 nWidth)
Sets base width for all columns (without padding pixels).
void finalizeWorksheetImport()
Final conversion after importing the worksheet.
WorksheetHelper(WorksheetGlobals &rSheetGlob)
void putFormulaTokens(const ScAddress &rAddress, const ApiTokenSequence &rTokens)
Inserts a formula cell directly into the Calc sheet.
const css::uno::Reference< css::sheet::XSpreadsheet > & getSheet() const
Returns the XSpreadsheet interface of the current sheet.
css::uno::Reference< css::drawing::XDrawPage > getDrawPage() const
Returns the XDrawPage interface of the draw page of the current sheet.
void setValidation(const ValidationModel &rModel)
Inserts the data validation settings into the spreadsheet.
CommentsBuffer & getComments() const
Returns the buffer for all cell comments in this sheet.
AutoFilterBuffer & getAutoFilters() const
Returns the auto filters for the sheet.
SheetViewSettings & getSheetViewSettings() const
Returns the view settings for this sheet.
void setRowModel(const RowModel &rModel)
Sets row settings for a specific range of rows.
void initializeWorksheetImport()
Initial conversion before importing the worksheet.
css::uno::Reference< css::table::XCell > getCell(const ScAddress &rAddress) const
Returns the XCell interface for the passed cell address.
void setVmlDrawingPath(const OUString &rVmlDrawingPath)
Sets the path to the legacy VML drawing fragment of this sheet.
QueryTableBuffer & getQueryTables() const
Returns the buffer for all web query tables in this sheet.
static IWorksheetProgress * getWorksheetInterface(const WorksheetGlobalsRef &xRef)
void setHyperlink(const HyperlinkModel &rModel)
Inserts the hyperlink URL into the spreadsheet.
void setCellFormulaValue(const ScAddress &rAddress, const OUString &rValueStr, sal_Int32 nCellType)
void setDefaultRowSettings(double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom)
Sets default height and hidden state for all unused rows in the sheet.
css::uno::Reference< css::table::XCellRange > getCellRange(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
@ table
css::uno::Sequence< ApiToken > ApiTokenSequence
::std::map< OUString, ScDataBarFormatData * > ExtLst
std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef
WorksheetType
An enumeration for all types of sheets in a workbook.
std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef
Empty
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
Stores settings and formatting data about a range of sheet columns.
sal_Int32 mnLevel
Column default formatting.
bool mbShowPhonetic
Column outline level.
bool mbHidden
True = cells in column show phonetic settings.
bool isMergeable(const ColumnModel &rModel) const
Returns true, if this entry can be merged with the passed column range (column settings are equal).
sal_Int32 mnXfId
Column width in number of characters.
ColumnModel()
True = column outline is collapsed.
double mfWidth
1-based (!) range of the described columns.
bool mbCollapsed
True = column is hidden.
Stores data about a hyperlink range.
OUString maTooltip
The cell area containing the hyperlink.
HyperlinkModel()
Additional tooltip text.
Stores formatting data about a page break.
sal_Int32 mnMax
Start of limited break.
sal_Int32 mnMin
0-based (!) index of column/row.
bool mbManual
End of limited break.
PageBreakModel()
True = manual page break.
Stores settings and formatting data about a sheet row.
double mfHeight
1-based (!) index of the described row.
bool mbCustomHeight
Row outline level.
sal_Int32 mnLevel
Row default formatting (see mbIsFormatted).
bool mbCollapsed
True = row is hidden.
bool mbThickBottom
True = row has extra space above text.
sal_Int32 mnXfId
Row height in points.
bool mbShowPhonetic
True = cells in row have explicit formatting.
bool mbCustomFormat
True = row has custom height.
bool mbThickTop
True = row outline is collapsed.
bool isMergeable(const RowModel &rModel) const
Returns true, if this entry can be merged with the passed row range (row settings are equal).
bool mbHidden
True = cells in row show phonetic settings.
RowModel()
True = row has extra space below text.
Stores data about ranges with data validation settings.
void setBiffType(sal_uInt8 nType)
Sets the passed BIFF validation type.
void setBiffOperator(sal_uInt8 nOperator)
Sets the passed BIFF operator.
void setBiffErrorStyle(sal_uInt8 nErrorStyle)
Sets the passed BIFF error style.
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22