25#include <com/sun/star/awt/Point.hpp>
26#include <com/sun/star/awt/Size.hpp>
27#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
28#include <com/sun/star/sheet/ConditionOperator2.hpp>
29#include <com/sun/star/sheet/TableValidationVisibility.hpp>
30#include <com/sun/star/sheet/ValidationType.hpp>
31#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
32#include <com/sun/star/sheet/XCellAddressable.hpp>
33#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
34#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
35#include <com/sun/star/sheet/XSheetCondition2.hpp>
36#include <com/sun/star/sheet/XSheetOutline.hpp>
37#include <com/sun/star/sheet/XSpreadsheet.hpp>
38#include <com/sun/star/table/XColumnRowRange.hpp>
39#include <com/sun/star/text/WritingMode2.hpp>
40#include <com/sun/star/lang/XMultiServiceFactory.hpp>
41#include <osl/diagnose.h>
42#include <rtl/ustrbuf.hxx>
45#include <oox/token/properties.hxx>
46#include <oox/token/tokens.hxx>
51#include <document.hxx>
65#include <tokenarray.hxx>
68#include <stlsheet.hxx>
96 rxProgressBar->setPosition( fPosition );
101sal_Int32 lclClampToNonNegativeInt32(
tools::Long aVal )
103 if ( aVal > SAL_MAX_INT32 || aVal < 0 )
105 SAL_WARN(
"sc.filter",
"Overflow detected, " << aVal <<
" does not fit into sal_Int32, or is negative." );
108 return static_cast<sal_Int32
>( aVal );
118 mbShowPhonetic( false ),
141 mbCustomHeight( false ),
142 mbCustomFormat( false ),
143 mbShowPhonetic( false ),
145 mbCollapsed( false ),
147 mbThickBottom( false )
177 mnOperator( XML_between ),
178 mnErrorStyle( XML_stop ),
179 mbShowInputMsg( false ),
180 mbShowErrorMsg( false ),
181 mbNoDropDown( false ),
182 mbAllowBlank( false )
188 static const sal_Int32 spnTypeIds[] = {
189 XML_none, XML_whole, XML_decimal, XML_list, XML_date, XML_time, XML_textLength, XML_custom };
195 static const sal_Int32 spnOperators[] = {
196 XML_between, XML_notBetween, XML_equal, XML_notEqual,
197 XML_greaterThan, XML_lessThan, XML_greaterThanOrEqual, XML_lessThanOrEqual };
203 static const sal_Int32 spnErrorStyles[] = { XML_stop, XML_warning, XML_information };
234 Reference< XCellRange >
getColumn( sal_Int32 nCol )
const;
236 Reference< XCellRange >
getRow( sal_Int32 nRow )
const;
305 void setDefaultRowSettings(
double fHeight,
bool bCustomHeight,
bool bHidden,
bool bThickTop,
bool bThickBottom );
352 void convertRows(
const std::vector<sc::ColRowSpan>& rSpans);
356 const std::vector<sc::ColRowSpan>& rSpans,
357 double fDefHeight = -1.0);
362 void groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow,
bool bCollapsed,
bool bRows );
408 mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
410 maSheetData( *this ),
411 maCondFormats( *this ),
413 maAutoFilters( *this ),
414 maQueryTables( *this ),
415 maSheetSett( *this ),
417 maSheetViewSett( *this ),
418 mxProgressBar(
std::move( xProgressBar )),
419 mbFastRowProgress( false ),
420 meSheetType( eSheetType ),
421 mxSheet(getSheetFromDoc( nSheet )),
422 mbHasDefWidth( false )
457 Reference< XCell > xCell;
460 xCell =
mxSheet->getCellByPosition( rAddress.
Col(), rAddress.
Row() );
470 Reference< XCellRange > xRange;
483 Reference< XSheetCellRanges > xRanges;
487 Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW );
498 Reference< XCellRange >
xColumn;
501 Reference< XColumnRowRange > xColRowRange(
mxSheet, UNO_QUERY_THROW );
502 Reference< XTableColumns > xColumns( xColRowRange->getColumns(), UNO_SET_THROW );
503 xColumn.set( xColumns->getByIndex( nCol ), UNO_QUERY );
513 Reference< XCellRange > xRow;
516 Reference< XColumnRowRange > xColRowRange(
mxSheet, UNO_QUERY_THROW );
517 Reference< XTableRows > xRows( xColRowRange->getRows(), UNO_SET_THROW );
518 xRow.set( xRows->getByIndex( nRow ), UNO_QUERY );
528 Reference< XDrawPage > xDrawPage;
531 xDrawPage = Reference< XDrawPageSupplier >(
mxSheet, UNO_QUERY_THROW )->getDrawPage();
541 OSL_ENSURE( (
maDrawPageSize.Width > 0) && (
maDrawPageSize.Height > 0),
"WorksheetGlobals::getDrawPageSize - called too early, size invalid" );
548 awt::Point aPoint( lclClampToNonNegativeInt32( aMMRect.
Left() ),
549 lclClampToNonNegativeInt32( aMMRect.
Top() ) );
555sal_Int32 lclGetMidAddr( sal_Int32 nBegAddr, sal_Int32 nEndAddr, sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
558 return nBegAddr + 1 +
static_cast< sal_Int32
>(
static_cast< sal_Int64
>( nEndAddr - nBegAddr - 2 ) * (nSearchPos - nBegPos) / (nEndPos - nBegPos) );
561bool lclPrepareInterval( sal_Int32 nBegAddr, sal_Int32& rnMidAddr, sal_Int32 nEndAddr,
562 sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
565 if( nSearchPos <= nBegPos )
567 rnMidAddr = nBegAddr;
572 if( (nSearchPos >= nEndPos) || (nBegAddr + 1 >= nEndAddr) )
574 rnMidAddr = nEndAddr;
580 rnMidAddr = lclGetMidAddr( nBegAddr, nEndAddr, nBegPos, nEndPos, nSearchPos );
584bool lclUpdateInterval( sal_Int32& rnBegAddr, sal_Int32& rnMidAddr, sal_Int32& rnEndAddr,
585 sal_Int32& rnBegPos, sal_Int32 nMidPos, sal_Int32& rnEndPos, sal_Int32 nSearchPos )
588 if( nSearchPos < nMidPos )
591 if( rnBegAddr + 1 >= rnMidAddr )
595 rnEndAddr = rnMidAddr;
596 rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
601 if( nSearchPos > nMidPos )
604 if( rnMidAddr + 1 >= rnEndAddr )
606 rnMidAddr = rnEndAddr;
611 rnBegAddr = rnMidAddr;
612 rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
625 sal_Int32 nBegCol = 0;
626 sal_Int32 nBegRow = 0;
627 awt::Point aBegPos( 0, 0 );
635 sal_Int32 nMidCol, nMidRow;
636 bool bLoopCols = lclPrepareInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aEndPos.X, rPosition.X );
637 bool bLoopRows = lclPrepareInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aEndPos.Y, rPosition.Y );
643 while( bLoopCols || bLoopRows )
645 bLoopCols = bLoopCols && lclUpdateInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aMidPos.X, aEndPos.X, rPosition.X );
646 bLoopRows = bLoopRows && lclUpdateInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aMidPos.Y, aEndPos.Y, rPosition.Y );
653 if( aMidPos.X > rPosition.X ) --nMidCol;
654 if( aMidPos.Y > rPosition.Y ) --nMidRow;
661 awt::Point aBotRight( rRect.X + rRect.Width, rRect.Y + rRect.Height );
663 bool bMultiCols = aStartAddr.
Col() < aEndAddr.
Col();
664 bool bMultiRows = aStartAddr.
Row() < aEndAddr.
Row();
665 if( bMultiCols || bMultiRows )
670 if( bMultiCols && (aBotRight.X <= aEndPos.X) )
672 if( bMultiRows && (aBotRight.Y <= aEndPos.Y) )
684 aPropSet.
setProperty( PROP_IsStartOfNewPage,
true );
800 bool bInsertModel =
true;
804 ColumnModelRangeMap::iterator aIt =
maColModels.upper_bound( nFirstCol );
805 OSL_ENSURE( aIt ==
maColModels.end(),
"WorksheetGlobals::setColModel - columns are unsorted" );
807 OSL_ENSURE( (aIt ==
maColModels.end()) || (nLastCol < aIt->
first),
"WorksheetGlobals::setColModel - multiple models of the same column" );
809 nLastCol = ::std::min( nLastCol, aIt->first - 1 );
815 sal_Int32& rnLastMapCol = aIt->second.second;
816 OSL_ENSURE( rnLastMapCol < nFirstCol,
"WorksheetGlobals::setColModel - multiple models of the same column" );
817 nFirstCol = ::std::max( rnLastMapCol + 1, nFirstCol );
818 if( (rnLastMapCol + 1 == nFirstCol) && (nFirstCol <= nLastCol) && aIt->second.first.isMergeable( rModel ) )
821 rnLastMapCol = nLastCol;
822 bInsertModel =
false;
826 if( nFirstCol <= nLastCol )
861 sal_Int32 nRow = rModel.
mnRow - 1;
865 bool bInsertModel =
true;
866 bool bUnusedRow =
true;
870 RowModelRangeMap::iterator aIt =
maRowModels.upper_bound( nRow );
871 OSL_ENSURE( aIt ==
maRowModels.end(),
"WorksheetGlobals::setRowModel - rows are unsorted" );
877 sal_Int32& rnLastMapRow = aIt->second.second;
878 bUnusedRow = rnLastMapRow < nRow;
879 OSL_ENSURE( bUnusedRow,
"WorksheetGlobals::setRowModel - multiple models of the same row" );
880 if( (rnLastMapRow + 1 == nRow) && aIt->second.first.isMergeable( rModel ) )
884 bInsertModel =
false;
907 double fNewPos =
static_cast<double>(nRow - rUsedArea.
aStart.
Row() + 1.0) / (rUsedArea.
aEnd.
Row() - rUsedArea.
aStart.
Row() + 1.0);
914 if (fCurPos < fNewPos && (fNewPos - fCurPos) > 0.3)
927 getStyles().getDefaultStyleName(), SfxStyleFamily::Para));
957 std::vector<sc::ColRowSpan> aSpans;
969 if (!pDocColl->
empty())
972 for (
const auto& rxDB : rDBs)
974 if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
977 rxDB->GetArea(aRange);
1004 if( !aUrl.isEmpty() )
1005 for(
ScAddress aAddress(link.maRange.aStart.Col(), link.maRange.aStart.Row(),
getSheetIndex() ); aAddress.
Row() <= link.maRange.aEnd.Row(); aAddress.IncRow() )
1006 for( aAddress.SetCol(link.maRange.aStart.Col()); aAddress.Col() <= link.maRange.aEnd.Col(); aAddress.IncCol() )
1013 OUStringBuffer aUrlBuffer;
1014 if( !rHyperlink.
maTarget.isEmpty() )
1017 aUrlBuffer.append(
'#' ).append( rHyperlink.
maLocation );
1018 OUString aUrl = aUrlBuffer.makeStringAndClear();
1020 if( aUrl.startsWith(
"#") )
1022 sal_Int32 nSepPos = aUrl.lastIndexOf(
'!' );
1029 if (nSepPos < aUrl.getLength() - 1)
1036 aUrl = aUrl.replaceAt( nSepPos, 1, rtl::OUStringChar(
'.' ) );
1039 OUString aSheetName = aUrl.copy( 1, nSepPos - 1 );
1041 if( !aCalcName.isEmpty() )
1042 aUrl = aUrl.replaceAt( 1, nSepPos - 1, aCalcName );
1089 Reference< XPropertySet > xValidation( aPropSet.
getAnyProperty( PROP_Validation ), UNO_QUERY );
1090 if( xValidation.is() )
1096 const OUString aToken =
validation.msRef.getToken( 0,
' ' );
1099 Reference<XCellRange> xDBCellRange;
1100 Reference<XCell> xCell;
1101 xDBCellRange = xSheet->getCellRangeByName( aToken );
1103 xCell = xDBCellRange->getCellByPosition( 0, 0 );
1104 Reference<XCellAddressable> xCellAddressable( xCell, UNO_QUERY_THROW );
1105 CellAddress aFirstCell = xCellAddressable->getCellAddress();
1106 Reference<XSheetCondition> xCondition( xValidation, UNO_QUERY_THROW );
1107 xCondition->setSourcePosition( aFirstCell );
1114 ValidationType
eType = ValidationType_ANY;
1117 case XML_custom:
eType = ValidationType_CUSTOM;
break;
1118 case XML_date:
eType = ValidationType_DATE;
break;
1119 case XML_decimal:
eType = ValidationType_DECIMAL;
break;
1120 case XML_list:
eType = ValidationType_LIST;
break;
1122 case XML_textLength:
eType = ValidationType_TEXT_LEN;
break;
1123 case XML_time:
eType = ValidationType_TIME;
break;
1124 case XML_whole:
eType = ValidationType_WHOLE;
break;
1125 default: OSL_FAIL(
"WorksheetData::finalizeValidationRanges - unknown validation type" );
1130 ValidationAlertStyle eAlertStyle = ValidationAlertStyle_STOP;
1133 case XML_information: eAlertStyle = ValidationAlertStyle_INFO;
break;
1134 case XML_stop: eAlertStyle = ValidationAlertStyle_STOP;
break;
1135 case XML_warning: eAlertStyle = ValidationAlertStyle_WARNING;
break;
1136 default: OSL_FAIL(
"WorksheetData::finalizeValidationRanges - unknown error style" );
1138 aValProps.
setProperty( PROP_ErrorAlertStyle, eAlertStyle );
1141 sal_Int16 nVisibility =
validation.mbNoDropDown ? TableValidationVisibility::INVISIBLE : TableValidationVisibility::UNSORTED;
1142 aValProps.
setProperty( PROP_ShowList, nVisibility );
1158 Reference< XSheetCondition2 > xSheetCond( xValidation, UNO_QUERY_THROW );
1159 if(
eType == ValidationType_CUSTOM )
1165 Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW );
1166 xTokens->setTokens( 0,
validation.maTokens1 );
1167 xTokens->setTokens( 1,
validation.maTokens2 );
1174 aPropSet.
setProperty( PROP_Validation, xValidation );
1181 sal_Int32 nNextCol = 0;
1189 ValueRange aColRange( ::std::max( colModel.first, nNextCol ), ::std::min( colModel.second.second, nMaxCol ) );
1191 if( nNextCol < aColRange.
mnFirst )
1196 nNextCol = aColRange.
mnLast + 1;
1222 for(
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
1240 sal_Int32 nNextRow = 0;
1248 ValueRange aRowRange( ::std::max( rowModel.first, nNextRow ), ::std::min( rowModel.second.second, nMaxRow ) );
1250 if( nNextRow < aRowRange.
mnFirst )
1256 nNextRow = aRowRange.
mnLast + 1;
1267 const std::vector<sc::ColRowSpan>& rSpans,
double fDefHeight)
1289 for (
const auto& rSpan : rSpans)
1292 if (rSpan.mnStart <= nStartRow && nStartRow <= rSpan.mnEnd)
1294 SCROW nLast = ::std::min(nEndRow, rSpan.mnEnd);
1306 sal_Int32 nColRow, sal_Int32 nLevel,
bool bCollapsed,
bool bRows )
1311 OSL_ENSURE( nLevel >= 0,
"WorksheetGlobals::convertOutlines - negative outline level" );
1312 nLevel = ::std::max< sal_Int32 >( nLevel, 0 );
1314 sal_Int32 nSize = orLevels.size();
1315 if( nSize < nLevel )
1318 orLevels.insert(orLevels.end(), nLevel - nSize, nColRow);
1320 else if( nLevel < nSize )
1325 sal_Int32 nFirstInLevel = orLevels.back();
1326 orLevels.pop_back();
1337 Reference< XSheetOutline > xOutline(
mxSheet, UNO_QUERY_THROW );
1340 CellRangeAddress aRange(
getSheetIndex(), 0, nFirstColRow, 0, nLastColRow );
1341 xOutline->group( aRange, TableOrientation_ROWS );
1343 xOutline->hideDetail( aRange );
1347 CellRangeAddress aRange(
getSheetIndex(), nFirstColRow, 0, nLastColRow, 0 );
1348 xOutline->group( aRange, TableOrientation_COLUMNS );
1350 xOutline->hideDetail( aRange );
1414 aPropSet.
setProperty( PROP_TableLayout, WritingMode2::RL_TB );
1420 mrSheetGlob( rSheetGlob )
1432 WorksheetGlobalsRef xSheetGlob = std::make_shared<WorksheetGlobals>( rHelper, rxProgressBar, eSheetType, nSheet );
1433 if( !xSheetGlob->isValidSheet() )
1594 const ScAddress& rAddress,
const OUString& rValueStr, sal_Int32 nCellType )
1636 const ScAddress& rAddr, sal_Int32 nSharedId,
1637 const OUString& rCellValue, sal_Int32 nValueType )
1648 const ScAddress& rAddress, sal_Int32 nSharedId,
const OUString& rTokens )
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
std::unique_ptr< EditTextObject > CreateTextObject()
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
void IncCol(SCCOL nDelta=1)
void IncRow(SCROW nDelta=1)
Stores global named database ranges.
bool HasAutoFilter() const
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Accessor class to ScDocument.
void setEditCell(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
void setCellStyleToSheet(SCTAB nTab, const ScStyleSheet &rStyle)
Apply specified cell style to an entire sheet.
SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden)
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC void SetColWidthOnly(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC void SetRowHeightOnly(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight)
SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden)
SC_DLLPUBLIC void SetManualHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual)
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered)
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
css::uno::Any getAnyProperty(sal_Int32 nPropId) const
bool setProperty(sal_Int32 nPropId, const Type &rValue)
static css::uno::Sequence< css::table::CellRangeAddress > toApiSequence(const ScRangeList &orRanges)
Converts the passed range list to a sequence of cell range addresses.
void finalizeImport(sal_Int16 nSheet)
Applies filter settings to a new database range object (used for sheet autofilter or advanced filter ...
Fragment handler for a complete sheet drawing.
void finalizeImport()
Creates a page style for the spreadsheet and sets all page properties.
void finalizeImport()
Inserts all web queries into the sheet.
Contains string data and a list of formatting runs for a rich formatted string.
void convert(const css::uno::Reference< css::text::XText > &rxText)
Converts the string and writes it into the passed XText, replace old contents of the text object,...
Manages the cell contents and cell formatting of a sheet.
void setRowFormat(sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat)
Sets default cell formatting for the specified range of rows.
void finalizeImport()
Final processing after the sheet has been imported.
bool isSheetRightToLeft() const
Returns true, if the sheet layout is set to right-to-left.
void finalizeImport()
Converts all imported sheet view settings.
void writeCellXfToDoc(ScDocumentImport &rDoc, const ScRange &rRange, sal_Int32 nXfId) const
Writes the cell formatting attributes of the specified XF to the passed property set.
double scaleValue(double fValue, Unit eFromUnit, Unit eToUnit) const
Converts the passed value between the passed units.
void setSheetUsedArea(const ScRange &rUsedArea)
Stores the used area for a specific worksheet.
Helper class to provide access to global workbook data.
ScEditEngineDefaulter & getEditEngine() const
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc(sal_Int32 nSheet) const
Returns a reference to the specified spreadsheet in the document model.
bool importOoxFragment(const rtl::Reference< oox::core::FragmentHandler > &rxHandler)
Imports a fragment using the passed fragment handler, which contains the full path to the fragment st...
WorksheetBuffer & getWorksheets() const
Returns the worksheet buffer containing sheet names and properties.
void setCurrentSheetIndex(SCTAB nSheet)
Sets the index of the current Calc sheet, if filter currently processes a sheet.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
sal_Int16 getCurrentSheetIndex() const
Returns the index of the current Calc sheet, if filter currently processes a sheet.
StylesBuffer & getStyles() const
Returns all cell formatting objects read from the styles substream.
FormulaBuffer & getFormulaBuffer() const
ScDocument & getScDocument()
ViewSettings & getViewSettings() const
Returns the workbook and sheet view settings object.
ScDocumentImport & getDocImport()
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
OUString getCalcSheetName(sal_Int32 nWorksheet) const
Returns the finalized name of the specified worksheet.
void convertColumns()
Converts column properties for all columns in the sheet.
Reference< XSheetCellRanges > getCellRangeList(const ScRangeList &rRanges) const
Returns the XSheetCellRanges interface for the passed cell range addresses.
::std::unique_ptr< VmlDrawing > VmlDrawingPtr
void setPageBreak(const PageBreakModel &rModel, bool bRowBreak)
Sets a column or row page break described in the passed struct.
OUString getHyperlinkUrl(const HyperlinkModel &rHyperlink) const
Generates the final URL for the passed hyperlink.
void setColumnModel(const ColumnModel &rModel)
Sets column settings for a specific column range.
void finalizeHyperlinkRanges()
Inserts all imported hyperlinks into their cell ranges.
ScRange maUsedArea
Reference to maximum Calc cell address from address converter.
void extendShapeBoundingBox(const awt::Rectangle &rShapeRect)
Extends the shape bounding box by the position and size of the passed rectangle.
CommentsBuffer & getComments()
Returns the buffer for all cell comments in this sheet.
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
void finalizeWorksheetImport()
Final conversion after importing the worksheet.
void UpdateRowProgress(const ScRange &rUsedArea, SCROW nRow)
Update the row import progress bar.
std::vector< ValidationModel > maValidations
Cell ranges containing hyperlinks.
const awt::Size & getDrawPageSize() const
Returns the size of the entire drawing page in 1/100 mm.
awt::Rectangle maShapeBoundingBox
Current size of the drawing page in 1/100 mm.
virtual void setCustomRowProgress(const ISegmentProgressBarRef &rxRowProgress) override
void setValidation(const ValidationModel &rModel)
Inserts the data validation settings into the spreadsheet.
void initializeWorksheetImport()
Initial conversion before importing the worksheet.
WorksheetType getSheetType() const
Returns the type of this sheet.
VmlDrawing & getVmlDrawing()
Returns the VML drawing page for this sheet (OOXML/BIFF12 only).
QueryTableBuffer & getQueryTables()
Returns the buffer for all web query tables in this sheet.
ColumnModel maDefColModel
Used area of the sheet, and sheet index of the sheet.
ISegmentProgressBarRef mxFinalProgress
Progress bar for row/cell processing.
::std::map< sal_Int32, RowModelRange > RowModelRangeMap
::std::pair< ColumnModel, sal_Int32 > ColumnModelRange
Reference< XCellRange > getRow(sal_Int32 nRow) const
Returns the XCellRange interface for a row.
::std::vector< sal_Int32 > OutlineLevelVec
ColumnModelRangeMap maColModels
Default column formatting.
void insertHyperlink(const ScAddress &rAddress, const OUString &rUrl)
Inserts a hyperlinks into the specified cell.
std::vector< HyperlinkModel > maHyperlinks
Ranges of rows sorted by first row index.
const Reference< XSpreadsheet > & getSheet() const
Returns the XSpreadsheet interface of the current sheet.
WorksheetGlobals(const WorkbookHelper &rHelper, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, SCTAB nSheet)
Service name for a SheetCellRanges object.
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.
void setRowModel(const RowModel &rModel)
Sets row settings for a specific row.
void convertOutlines(OutlineLevelVec &orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows)
Converts outline grouping for the passed column or row.
CommentsBuffer maComments
Buffer for conditional formatting.
AutoFilterBuffer maAutoFilters
Buffer for all cell comments in this sheet.
OUString maDrawingPath
List of extended elements.
ISegmentProgressBarRef mxRowProgress
Do we have a progress bar thread ?
CondFormatBuffer maCondFormats
Buffer for cell contents and cell formatting.
void convertRows(const std::vector< sc::ColRowSpan > &rSpans)
Converts row properties for all rows in the sheet.
bool mbFastRowProgress
Sheet progress bar.
void finalizeValidationRanges() const
Inserts all imported data validations into their cell ranges.
SheetDataBuffer maSheetData
Cell ranges containing data validation settings.
Reference< XCellRange > getColumn(sal_Int32 nCol) const
Returns the XCellRange interface for a column.
Reference< XCellRange > getCellRange(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
bool isValidSheet() const
Returns true, if this helper refers to an existing Calc sheet.
void setDefaultColumnWidth(double fWidth)
Sets default width for all columns.
awt::Point getCellPosition(sal_Int32 nCol, sal_Int32 nRow) const
Returns the absolute position of the top-left corner of the cell in 1/100 mm.
PageSettings & getPageSettings()
Returns the page/print settings for this sheet.
QueryTableBuffer maQueryTables
Sheet auto filters (not associated to a table).
WorksheetType meSheetType
Progress bar for finalization.
RowModelRangeMap maRowModels
Default row formatting.
SheetViewSettings maSheetViewSett
Page/print settings for this sheet.
RowModel maDefRowModel
Ranges of columns sorted by first column index.
ExtLst & getExtLst()
returns the ExtLst entries that need to be filled
WorksheetSettings & getWorksheetSettings()
Returns the worksheet settings object.
SCTAB getSheetIndex() const
Returns the index of the current sheet.
ISegmentProgressBarRef mxProgressBar
Bounding box for all shapes from all drawings.
VmlDrawingPtr mxVmlDrawing
View settings for this sheet.
::std::map< sal_Int32, ColumnModelRange > ColumnModelRangeMap
void setHyperlink(const HyperlinkModel &rModel)
Inserts the hyperlink URL into the spreadsheet.
void setVmlDrawingPath(const OUString &rVmlDrawingPath)
Sets the path to the legacy VML drawing fragment of this sheet.
PageSettings maPageSett
Global settings for this sheet.
void finalizeDrawings()
Imports the drawings of the sheet (DML, VML, DFF) and updates the used area.
Reference< XSpreadsheet > mxSheet
Type of this sheet.
Reference< XCell > getCell(const ScAddress &rAddress) const
Returns the XCell interface for the passed cell address.
void convertColumnFormat(sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId)
Converts column default cell formatting.
OUString maVmlDrawingPath
Path to DrawingML fragment.
void groupColumnsOrRows(sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows)
Groups columns or rows for the given range.
bool mbHasDefWidth
Reference to the current sheet.
ExtLst maExtLst
Collection of all VML shapes.
void setDrawingPath(const OUString &rDrawingPath)
Sets the path to the DrawingML fragment of this sheet.
SheetDataBuffer & getSheetData()
Returns the buffer for cell contents and cell formatting.
ScAddress getCellAddressFromPosition(const awt::Point &rPosition) const
Returns the address of the cell that contains the passed point in 1/100 mm.
const ScAddress & mrMaxApiPos
awt::Size maDrawPageSize
Path to legacy VML drawing fragment.
::std::pair< RowModel, sal_Int32 > RowModelRange
AutoFilterBuffer & getAutoFilters()
Returns the auto filters for the sheet.
virtual ISegmentProgressBarRef getRowProgress() override
Allow the threaded importer to override our progress bar impl.
void setBaseColumnWidth(sal_Int32 nWidth)
Sets base width for all columns (without padding pixels).
CondFormatBuffer & getCondFormats()
Returns the conditional formatting in this sheet.
Reference< XDrawPage > getDrawPage() const
Returns the XDrawPage interface of the draw page of the current sheet.
void finalizeDrawingImport()
WorksheetSettings maSheetSett
Buffer for all web query tables in this sheet.
ScRange getCellRangeFromRectangle(const awt::Rectangle &rRect) const
Returns the cell range address that contains the passed rectangle in 1/100 mm.
SheetViewSettings & getSheetViewSettings()
Returns the view settings for this sheet.
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.
void putRichString(const ScAddress &rAddress, RichString &rString, const oox::xls::Font *pFirstPortionFont)
Inserts a rich-string cell directly into the Calc 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.
ScDocument & getScDocument()
ExtLst & getExtLst() const
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 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.
void finalizeImport()
Converts the imported worksheet settings.
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
#define STATIC_ARRAY_SELECT(array, index, def)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral first
constexpr auto toTwips(N number, Length from)
constexpr OUStringLiteral gaSheetCellRanges(u"com.sun.star.sheet.SheetCellRanges")
css::uno::Sequence< ApiToken > ApiTokenSequence
::std::map< OUString, ScDataBarFormatData * > ExtLst
@ ScreenX
English Metric Unit (1/360,000 cm).
@ Digit
Vertical screen pixels.
std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef
WorksheetType
An enumeration for all types of sheets in a workbook.
std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef
constexpr TypedWhichId< SfxStringItem > ATTR_HYPERLINK(155)
This is very similar to ScCellValue, except that it references the original value instead of copying ...
OUString getString(const ScDocument *pDoc) const
Retrieve string value.
Stores settings and formatting data about a range of sheet columns.
sal_Int32 mnLevel
Column default formatting.
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.
HyperlinkModel()
Additional tooltip text.
Stores formatting data about a page break.
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.
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW