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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_WORKSHEETHELPER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_WORKSHEETHELPER_HXX
22 
25 #include <oox/ole/olehelper.hxx>
26 #include <rangelst.hxx>
27 #include "formulabase.hxx"
28 
29 struct ScDataBarFormatData;
30 class ScDocument;
31 
32 namespace com::sun::star {
33  namespace awt { struct Point; }
34  namespace awt { struct Rectangle; }
35  namespace awt { struct Size; }
36  namespace drawing { class XDrawPage; }
37  namespace sheet { class XSpreadsheet; }
38  namespace table { class XCell; }
39  namespace table { class XCellRange; }
40 }
41 
42 namespace oox::xls {
43 
44 class AutoFilterBuffer;
45 class CommentsBuffer;
46 class CondFormatBuffer;
47 class Font;
48 class PageSettings;
49 class QueryTableBuffer;
50 class RichString;
51 class SheetDataBuffer;
52 class SheetViewSettings;
53 class VmlDrawing;
55 
56 typedef ::std::map< OUString, ScDataBarFormatData* > ExtLst;
57 
59 enum class WorksheetType
60 {
61  Work,
62  Chart,
63  Macro,
64  Dialog,
65  Empty
66 };
67 
70 {
72  double mfWidth;
73  sal_Int32 mnXfId;
74  sal_Int32 mnLevel;
75  bool mbShowPhonetic:1;
76  bool mbHidden:1;
77  bool mbCollapsed:1;
78 
79  explicit ColumnModel();
80 
82  bool isMergeable( const ColumnModel& rModel ) const;
83 };
84 
86 struct RowModel
87 {
88  sal_Int32 mnRow;
90  double mfHeight;
91  sal_Int32 mnXfId;
92  sal_Int32 mnLevel;
93  bool mbCustomHeight:1;
94  bool mbCustomFormat:1;
95  bool mbShowPhonetic:1;
96  bool mbHidden:1;
97  bool mbCollapsed:1;
98  bool mbThickTop:1;
99  bool mbThickBottom:1;
100 
101  explicit RowModel();
102 
104  void insertColSpan( const ValueRange& rColSpan );
106  bool isMergeable( const RowModel& rModel ) const;
107 };
108 
111 {
112  sal_Int32 mnColRow;
113  sal_Int32 mnMin;
114  sal_Int32 mnMax;
115  bool mbManual;
116 
117  explicit PageBreakModel();
118 };
119 
122 {
124  OUString maTooltip;
125 
126  explicit HyperlinkModel();
127 };
128 
131 {
135  OUString msRef;
136  OUString maInputTitle;
137  OUString maInputMessage;
138  OUString maErrorTitle;
139  OUString maErrorMessage;
140  sal_Int32 mnType;
141  sal_Int32 mnOperator;
142  sal_Int32 mnErrorStyle;
145  bool mbNoDropDown:1;
146  bool mbAllowBlank:1;
147 
148  explicit ValidationModel();
149 
151  void setBiffType( sal_uInt8 nType );
153  void setBiffOperator( sal_uInt8 nOperator );
155  void setBiffErrorStyle( sal_uInt8 nErrorStyle );
156 };
157 
159 typedef std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef;
160 
162 public:
163  virtual ~IWorksheetProgress() {}
165  virtual void setCustomRowProgress(
166  const ISegmentProgressBarRef &rxRowProgress ) = 0;
167 };
168 
170 {
171 public:
172  /*implicit*/ WorksheetHelper( WorksheetGlobals& rSheetGlob );
173 
174  static WorksheetGlobalsRef constructGlobals(
175  const WorkbookHelper& rHelper,
176  const ISegmentProgressBarRef& rxProgressBar,
177  WorksheetType eSheetType,
178  SCTAB nSheet );
179 
180  // horrible accessor for hidden WorksheetGlobals ...
181  static IWorksheetProgress *getWorksheetInterface( const WorksheetGlobalsRef &xRef );
182 
184  WorksheetType getSheetType() const;
186  SCTAB getSheetIndex() const;
188  const css::uno::Reference< css::sheet::XSpreadsheet >&
189  getSheet() const;
190 
192  css::uno::Reference< css::table::XCell >
193  getCell( const ScAddress& rAddress ) const;
195  css::uno::Reference< css::table::XCellRange >
196  getCellRange( const ScRange& rRange ) const;
197 
199  css::uno::Reference< css::drawing::XDrawPage >
200  getDrawPage() const;
201 
203  css::awt::Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const;
205  const css::awt::Size& getDrawPageSize() const;
206 
208  SheetDataBuffer& getSheetData() const;
212  CommentsBuffer& getComments() const;
220  PageSettings& getPageSettings() const;
224  VmlDrawing& getVmlDrawing() const;
225 
226  ExtLst& getExtLst() const;
227 
229  void setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
231  void setHyperlink( const HyperlinkModel& rModel );
233  void setValidation( const ValidationModel& rModel );
235  void setDrawingPath( const OUString& rDrawingPath );
237  void setVmlDrawingPath( const OUString& rVmlDrawingPath );
238 
240  void extendUsedArea( const ScAddress& rAddress );
242  void extendUsedArea( const ScRange& rRange );
244  void extendShapeBoundingBox( const css::awt::Rectangle& rShapeRect );
245 
248  void setBaseColumnWidth( sal_Int32 nWidth );
251  void setDefaultColumnWidth( double fWidth );
255  void setColumnModel( const ColumnModel& rModel );
256 
259  double fHeight, bool bCustomHeight,
260  bool bHidden, bool bThickTop, bool bThickBottom );
264  void setRowModel( const RowModel& rModel );
265 
267  void putRichString(
268  const ScAddress& rAddress,
269  const RichString& rString, const oox::xls::Font* pFirstPortionFont );
270 
272  void putFormulaTokens(
273  const ScAddress& rAddress, const ApiTokenSequence& rTokens );
274 
280  void finalizeDrawingImport();
281 
282  void setCellFormula( const ScAddress& rTokenAddress, const OUString& );
283 
284  void setCellFormula(
285  const ScAddress& rAddr, sal_Int32 nSharedId,
286  const OUString& rCellValue, sal_Int32 nValueType );
287 
288  void setCellArrayFormula( const ScRange& rRangeAddress, const ScAddress& rTokenAddress, const OUString& rTokenStr );
289 
291  const ScAddress& rAddress,
292  sal_Int32 nSharedId, const OUString& rTokens );
293 
294  void setCellFormulaValue(
295  const ScAddress& rAddress, const OUString& rValueStr, sal_Int32 nCellType );
296 
298 
299 
300 private:
302 };
303 
304 } // namespace oox::xls
305 
306 #endif
307 
308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
HyperlinkModel()
Additional tooltip text.
static WorksheetGlobalsRef constructGlobals(const WorkbookHelper &rHelper, const ISegmentProgressBarRef &rxProgressBar, WorksheetType eSheetType, SCTAB nSheet)
SheetDataBuffer & getSheetData() const
Returns the buffer for cell contents and cell formatting.
virtual void setCustomRowProgress(const ISegmentProgressBarRef &rxRowProgress)=0
bool mbThickTop
True = row outline is collapsed.
void createSharedFormulaMapEntry(const ScAddress &rAddress, sal_Int32 nSharedId, const OUString &rTokens)
Contains string data and a list of formatting runs for a rich formatted string.
Definition: richstring.hxx:209
exports com.sun.star. awt
WorksheetGlobals & mrSheetGlob
ColumnModel()
True = column outline is collapsed.
sal_Int32 mnMax
Start of limited break.
bool mbCustomFormat
True = row has custom height.
exports com.sun.star. table
css::uno::Reference< css::table::XCellRange > getCellRange(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
WorksheetSettings & getWorksheetSettings() const
Returns the worksheet settings object.
virtual ISegmentProgressBarRef getRowProgress()=0
SheetViewSettings & getSheetViewSettings() const
Returns the view settings for this sheet.
void putFormulaTokens(const ScAddress &rAddress, const ApiTokenSequence &rTokens)
Inserts a formula cell directly into the Calc sheet.
const css::awt::Size & getDrawPageSize() const
Returns the size of the entire drawing page in 1/100 mm.
exports com.sun.star. sheet
void setHyperlink(const HyperlinkModel &rModel)
Inserts the hyperlink URL into the spreadsheet.
CondFormatBuffer & getCondFormats() const
Returns the conditional formatting in this sheet.
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)...
bool mbShowPhonetic
True = cells in row have explicit formatting.
void setBiffType(sal_uInt8 nType)
Sets the passed BIFF validation type.
bool mbCustomHeight
Row outline level.
std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef
Stores formatting data about a page break.
OUString maTooltip
The cell area containing the hyperlink.
bool mbCollapsed
True = row is hidden.
void setVmlDrawingPath(const OUString &rVmlDrawingPath)
Sets the path to the legacy VML drawing fragment of this sheet.
void setCellArrayFormula(const ScRange &rRangeAddress, const ScAddress &rTokenAddress, const OUString &rTokenStr)
void putRichString(const ScAddress &rAddress, const RichString &rString, const oox::xls::Font *pFirstPortionFont)
Inserts a rich-string cell directly into the Calc sheet.
CommentsBuffer & getComments() const
Returns the buffer for all cell comments in this sheet.
double mfHeight
0-based (!) column ranges of used cells.
static IWorksheetProgress * getWorksheetInterface(const WorksheetGlobalsRef &xRef)
sal_Int32 mnLevel
Column default formatting.
bool isMergeable(const ColumnModel &rModel) const
Returns true, if this entry can be merged with the passed column range (column settings are equal)...
void setCellFormulaValue(const ScAddress &rAddress, const OUString &rValueStr, sal_Int32 nCellType)
Stores settings and formatting data about a sheet row.
void setBiffOperator(sal_uInt8 nOperator)
Sets the passed BIFF operator.
double mfWidth
1-based (!) range of the described columns.
sal_Int32 mnXfId
Column width in number of characters.
bool mbHidden
True = cells in row show phonetic settings.
void setCellFormula(const ScAddress &rTokenAddress, const OUString &)
css::uno::Reference< css::drawing::XDrawPage > getDrawPage() const
Returns the XDrawPage interface of the draw page of the current sheet.
void setDrawingPath(const OUString &rDrawingPath)
Sets the path to the DrawingML fragment of this sheet.
bool mbHidden
True = cells in column show phonetic settings.
bool mbCollapsed
True = column is hidden.
PageBreakModel()
True = manual page break.
Stores settings and formatting data about a range of sheet columns.
WorksheetType getSheetType() const
Returns the type of this sheet.
std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef
void setPageBreak(const PageBreakModel &rModel, bool bRowBreak)
Sets a column or row page break described in the passed struct.
void insertColSpan(const ValueRange &rColSpan)
Inserts the passed column span into the row model.
void setBaseColumnWidth(sal_Int32 nWidth)
Sets base width for all columns (without padding pixels).
css::uno::Reference< css::table::XCell > getCell(const ScAddress &rAddress) const
Returns the XCell interface for the passed cell address.
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.
::std::map< OUString, ScDataBarFormatData * > ExtLst
void initializeWorksheetImport()
Initial conversion before importing the worksheet.
QueryTableBuffer & getQueryTables() const
Returns the buffer for all web query tables in this sheet.
void setColumnModel(const ColumnModel &rModel)
Sets column settings for a specific range of columns.
void setValidation(const ValidationModel &rModel)
Inserts the data validation settings into the spreadsheet.
RowModel()
True = row has extra space below text.
sal_Int32 mnXfId
Row height in points.
css::uno::Sequence< ApiToken > ApiTokenSequence
Stores data about ranges with data validation settings.
void finalizeDrawingImport()
Final import of drawing objects.
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
bool isMergeable(const RowModel &rModel) const
Returns true, if this entry can be merged with the passed row range (row settings are equal)...
css::awt::Point getCellPosition(sal_Int32 nCol, sal_Int32 nRow) const
Returns the absolute cell position in 1/100 mm.
sal_Int32 mnMin
0-based (!) index of column/row.
const css::uno::Reference< css::sheet::XSpreadsheet > & getSheet() const
Returns the XSpreadsheet interface of the current sheet.
unsigned char sal_uInt8
ValueRangeSet maColSpans
1-based (!) index of the described row.
SCTAB getSheetIndex() const
Returns the index of the current sheet.
bool mbShowPhonetic
Column outline level.
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
Dialog sheet (BIFF5+).
WorksheetHelper(WorksheetGlobals &rSheetGlob)
VmlDrawing & getVmlDrawing() const
Returns the VML drawing page for this sheet (OOXML/BIFF12 only).
Stores data about a hyperlink range.
sal_Int32 mnLevel
Row default formatting (see mbIsFormatted).
WorksheetType
An enumeration for all types of sheets in a workbook.
AutoFilterBuffer & getAutoFilters() const
Returns the auto filters for the sheet.
void finalizeWorksheetImport()
Final conversion after importing the worksheet.
bool mbThickBottom
True = row has extra space above text.
void setRowModel(const RowModel &rModel)
Sets row settings for a specific range of rows.
sal_Int16 SCTAB
Definition: types.hxx:23
PageSettings & getPageSettings() const
Returns the page/print settings for this sheet.
Manages the cell contents and cell formatting of a sheet.
bool mbManual
End of limited break.
void setDefaultColumnWidth(double fWidth)
Sets default width for all columns.
void setBiffErrorStyle(sal_uInt8 nErrorStyle)
Sets the passed BIFF error style.