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>
69 #include <stlpool.hxx>
96 rxProgressBar->setPosition( fPosition );
101 sal_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 )
183 mnOperator( XML_between ),
184 mnErrorStyle( XML_stop ),
185 mbShowInputMsg(
false ),
186 mbShowErrorMsg(
false ),
187 mbNoDropDown(
false ),
188 mbAllowBlank(
false )
194 static const sal_Int32 spnTypeIds[] = {
195 XML_none, XML_whole, XML_decimal, XML_list, XML_date, XML_time, XML_textLength, XML_custom };
201 static const sal_Int32 spnOperators[] = {
202 XML_between, XML_notBetween, XML_equal, XML_notEqual,
203 XML_greaterThan, XML_lessThan, XML_greaterThanOrEqual, XML_lessThanOrEqual };
209 static const sal_Int32 spnErrorStyles[] = { XML_stop, XML_warning, XML_information };
240 Reference< XCellRange >
getColumn( sal_Int32 nCol )
const;
242 Reference< XCellRange >
getRow( sal_Int32 nRow )
const;
311 void setDefaultRowSettings(
double fHeight,
bool bCustomHeight,
bool bHidden,
bool bThickTop,
bool bThickBottom );
358 void convertRows(
const std::vector<sc::ColRowSpan>& rSpans);
362 const std::vector<sc::ColRowSpan>& rSpans,
363 double fDefHeight = -1.0);
366 void convertOutlines( OutlineLevelVec& orLevels, sal_Int32 nColRow, sal_Int32 nLevel,
bool bCollapsed,
bool bRows );
368 void groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow,
bool bCollapsed,
bool bRows );
410 constexpr OUStringLiteral
gaSheetCellRanges( u
"com.sun.star.sheet.SheetCellRanges" );
414 mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
416 maSheetData( *this ),
417 maCondFormats( *this ),
419 maAutoFilters( *this ),
420 maQueryTables( *this ),
421 maSheetSett( *this ),
423 maSheetViewSett( *this ),
424 mxProgressBar( rxProgressBar ),
425 mbFastRowProgress(
false ),
426 meSheetType( eSheetType ),
427 mxSheet(getSheetFromDoc( nSheet )),
428 mbHasDefWidth(
false )
463 Reference< XCell > xCell;
466 xCell =
mxSheet->getCellByPosition( rAddress.
Col(), rAddress.
Row() );
476 Reference< XCellRange > xRange;
489 Reference< XSheetCellRanges > xRanges;
493 Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW );
504 Reference< XCellRange >
xColumn;
507 Reference< XColumnRowRange > xColRowRange(
mxSheet, UNO_QUERY_THROW );
508 Reference< XTableColumns > xColumns( xColRowRange->getColumns(), UNO_SET_THROW );
509 xColumn.set( xColumns->getByIndex( nCol ), UNO_QUERY );
519 Reference< XCellRange >
xRow;
522 Reference< XColumnRowRange > xColRowRange(
mxSheet, UNO_QUERY_THROW );
523 Reference< XTableRows > xRows( xColRowRange->getRows(), UNO_SET_THROW );
524 xRow.set( xRows->getByIndex( nRow ), UNO_QUERY );
534 Reference< XDrawPage > xDrawPage;
537 xDrawPage = Reference< XDrawPageSupplier >(
mxSheet, UNO_QUERY_THROW )->
getDrawPage();
547 OSL_ENSURE( (
maDrawPageSize.Width > 0) && (
maDrawPageSize.Height > 0),
"WorksheetGlobals::getDrawPageSize - called too early, size invalid" );
554 awt::Point aPoint( lclClampToNonNegativeInt32( aMMRect.
Left() ),
555 lclClampToNonNegativeInt32( aMMRect.
Top() ) );
561 sal_Int32 lclGetMidAddr( sal_Int32 nBegAddr, sal_Int32 nEndAddr, sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
564 return nBegAddr + 1 +
static_cast< sal_Int32
>(
static_cast< sal_Int64
>( nEndAddr - nBegAddr - 2 ) * (nSearchPos - nBegPos) / (nEndPos - nBegPos) );
567 bool lclPrepareInterval( sal_Int32 nBegAddr, sal_Int32& rnMidAddr, sal_Int32 nEndAddr,
568 sal_Int32 nBegPos, sal_Int32 nEndPos, sal_Int32 nSearchPos )
571 if( nSearchPos <= nBegPos )
573 rnMidAddr = nBegAddr;
578 if( (nSearchPos >= nEndPos) || (nBegAddr + 1 >= nEndAddr) )
580 rnMidAddr = nEndAddr;
586 rnMidAddr = lclGetMidAddr( nBegAddr, nEndAddr, nBegPos, nEndPos, nSearchPos );
590 bool lclUpdateInterval( sal_Int32& rnBegAddr, sal_Int32& rnMidAddr, sal_Int32& rnEndAddr,
591 sal_Int32& rnBegPos, sal_Int32 nMidPos, sal_Int32& rnEndPos, sal_Int32 nSearchPos )
594 if( nSearchPos < nMidPos )
597 if( rnBegAddr + 1 >= rnMidAddr )
601 rnEndAddr = rnMidAddr;
602 rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
607 if( nSearchPos > nMidPos )
610 if( rnMidAddr + 1 >= rnEndAddr )
612 rnMidAddr = rnEndAddr;
617 rnBegAddr = rnMidAddr;
618 rnMidAddr = lclGetMidAddr( rnBegAddr, rnEndAddr, rnBegPos, rnEndPos, nSearchPos );
631 sal_Int32 nBegCol = 0;
632 sal_Int32 nBegRow = 0;
633 awt::Point aBegPos( 0, 0 );
641 sal_Int32 nMidCol, nMidRow;
642 bool bLoopCols = lclPrepareInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aEndPos.X, rPosition.X );
643 bool bLoopRows = lclPrepareInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aEndPos.Y, rPosition.Y );
649 while( bLoopCols || bLoopRows )
651 bLoopCols = bLoopCols && lclUpdateInterval( nBegCol, nMidCol, nEndCol, aBegPos.X, aMidPos.X, aEndPos.X, rPosition.X );
652 bLoopRows = bLoopRows && lclUpdateInterval( nBegRow, nMidRow, nEndRow, aBegPos.Y, aMidPos.Y, aEndPos.Y, rPosition.Y );
659 if( aMidPos.X > rPosition.X ) --nMidCol;
660 if( aMidPos.Y > rPosition.Y ) --nMidRow;
667 awt::Point aBotRight( rRect.X + rRect.Width, rRect.Y + rRect.Height );
669 bool bMultiCols = aStartAddr.
Col() < aEndAddr.
Col();
670 bool bMultiRows = aStartAddr.
Row() < aEndAddr.
Row();
671 if( bMultiCols || bMultiRows )
676 if( bMultiCols && (aBotRight.X <= aEndPos.X) )
678 if( bMultiRows && (aBotRight.Y <= aEndPos.Y) )
690 aPropSet.
setProperty( PROP_IsStartOfNewPage,
true );
806 bool bInsertModel =
true;
810 ColumnModelRangeMap::iterator aIt =
maColModels.upper_bound( nFirstCol );
811 OSL_ENSURE( aIt ==
maColModels.end(),
"WorksheetGlobals::setColModel - columns are unsorted" );
813 OSL_ENSURE( (aIt ==
maColModels.end()) || (nLastCol < aIt->
first),
"WorksheetGlobals::setColModel - multiple models of the same column" );
815 nLastCol = ::std::min( nLastCol, aIt->first - 1 );
821 sal_Int32& rnLastMapCol = aIt->second.second;
822 OSL_ENSURE( rnLastMapCol < nFirstCol,
"WorksheetGlobals::setColModel - multiple models of the same column" );
823 nFirstCol = ::std::max( rnLastMapCol + 1, nFirstCol );
824 if( (rnLastMapCol + 1 == nFirstCol) && (nFirstCol <= nLastCol) && aIt->second.first.isMergeable( rModel ) )
827 rnLastMapCol = nLastCol;
828 bInsertModel =
false;
832 if( nFirstCol <= nLastCol )
867 sal_Int32 nRow = rModel.
mnRow - 1;
871 bool bInsertModel =
true;
872 bool bUnusedRow =
true;
876 RowModelRangeMap::iterator aIt =
maRowModels.upper_bound( nRow );
877 OSL_ENSURE( aIt ==
maRowModels.end(),
"WorksheetGlobals::setRowModel - rows are unsorted" );
883 sal_Int32& rnLastMapRow = aIt->second.second;
884 bUnusedRow = rnLastMapRow < nRow;
885 OSL_ENSURE( bUnusedRow,
"WorksheetGlobals::setRowModel - multiple models of the same row" );
886 if( (rnLastMapRow + 1 == nRow) && aIt->second.first.isMergeable( rModel ) )
890 bInsertModel =
false;
915 double fNewPos =
static_cast<double>(nRow - rUsedArea.
aStart.
Row() + 1.0) / (rUsedArea.
aEnd.
Row() - rUsedArea.
aStart.
Row() + 1.0);
922 if (fCurPos < fNewPos && (fNewPos - fCurPos) > 0.3)
935 getStyles().getDefaultStyleName(), SfxStyleFamily::Para));
968 std::vector<sc::ColRowSpan> aSpans;
980 if (!pDocColl->
empty())
983 for (
const auto& rxDB : rDBs)
985 if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
988 rxDB->GetArea(aRange);
1015 if( !aUrl.isEmpty() )
1016 for(
ScAddress aAddress(link.maRange.aStart.Col(), link.maRange.aStart.Row(),
getSheetIndex() ); aAddress.
Row() <= link.maRange.aEnd.Row(); aAddress.IncRow() )
1017 for( aAddress.SetCol(link.maRange.aStart.Col()); aAddress.Col() <= link.maRange.aEnd.Col(); aAddress.IncCol() )
1024 OUStringBuffer aUrlBuffer;
1025 if( !rHyperlink.
maTarget.isEmpty() )
1028 aUrlBuffer.append(
'#' ).append( rHyperlink.
maLocation );
1029 OUString aUrl = aUrlBuffer.makeStringAndClear();
1031 if( aUrl.startsWith(
"#") )
1033 sal_Int32 nSepPos = aUrl.lastIndexOf(
'!' );
1040 if (nSepPos < aUrl.getLength() - 1)
1047 aUrl = aUrl.replaceAt( nSepPos, 1, rtl::OUStringChar(
'.' ) );
1050 OUString aSheetName = aUrl.copy( 1, nSepPos - 1 );
1052 if( !aCalcName.isEmpty() )
1053 aUrl = aUrl.replaceAt( 1, nSepPos - 1, aCalcName );
1067 OUString
aStr = aCell.getString(&rDoc.
getDoc());
1071 SvxURLField aURLField(rUrl, aStr, SvxURLFormat::Repr);
1101 if( xValidation.is() )
1107 const OUString aToken =
validation.msRef.getToken( 0,
' ' );
1110 Reference<XCellRange> xDBCellRange;
1111 Reference<XCell> xCell;
1112 xDBCellRange = xSheet->getCellRangeByName( aToken );
1114 xCell = xDBCellRange->getCellByPosition( 0, 0 );
1115 Reference<XCellAddressable> xCellAddressable( xCell, UNO_QUERY_THROW );
1116 CellAddress aFirstCell = xCellAddressable->getCellAddress();
1117 Reference<XSheetCondition> xCondition( xValidation, UNO_QUERY_THROW );
1118 xCondition->setSourcePosition( aFirstCell );
1125 ValidationType
eType = ValidationType_ANY;
1128 case XML_custom: eType = ValidationType_CUSTOM;
break;
1129 case XML_date: eType = ValidationType_DATE;
break;
1130 case XML_decimal: eType = ValidationType_DECIMAL;
break;
1131 case XML_list: eType = ValidationType_LIST;
break;
1132 case XML_none: eType = ValidationType_ANY;
break;
1133 case XML_textLength: eType = ValidationType_TEXT_LEN;
break;
1134 case XML_time: eType = ValidationType_TIME;
break;
1135 case XML_whole: eType = ValidationType_WHOLE;
break;
1136 default: OSL_FAIL(
"WorksheetData::finalizeValidationRanges - unknown validation type" );
1141 ValidationAlertStyle eAlertStyle = ValidationAlertStyle_STOP;
1144 case XML_information: eAlertStyle = ValidationAlertStyle_INFO;
break;
1145 case XML_stop: eAlertStyle = ValidationAlertStyle_STOP;
break;
1146 case XML_warning: eAlertStyle = ValidationAlertStyle_WARNING;
break;
1147 default: OSL_FAIL(
"WorksheetData::finalizeValidationRanges - unknown error style" );
1149 aValProps.
setProperty( PROP_ErrorAlertStyle, eAlertStyle );
1152 sal_Int16 nVisibility =
validation.mbNoDropDown ? TableValidationVisibility::INVISIBLE : TableValidationVisibility::UNSORTED;
1153 aValProps.
setProperty( PROP_ShowList, nVisibility );
1169 Reference< XSheetCondition2 > xSheetCond( xValidation, UNO_QUERY_THROW );
1170 if( eType == ValidationType_CUSTOM )
1176 Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW );
1177 xTokens->setTokens( 0,
validation.maTokens1 );
1178 xTokens->setTokens( 1,
validation.maTokens2 );
1185 aPropSet.
setProperty( PROP_Validation, xValidation );
1192 sal_Int32 nNextCol = 0;
1200 ValueRange aColRange( ::std::max( colModel.first, nNextCol ), ::std::min( colModel.second.second, nMaxCol ) );
1202 if( nNextCol < aColRange.
mnFirst )
1207 nNextCol = aColRange.
mnLast + 1;
1233 for(
SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
1251 sal_Int32 nNextRow = 0;
1259 ValueRange aRowRange( ::std::max( rowModel.first, nNextRow ), ::std::min( rowModel.second.second, nMaxRow ) );
1261 if( nNextRow < aRowRange.
mnFirst )
1267 nNextRow = aRowRange.
mnLast + 1;
1278 const std::vector<sc::ColRowSpan>& rSpans,
double fDefHeight)
1300 for (
const auto& rSpan : rSpans)
1303 if (rSpan.mnStart <= nStartRow && nStartRow <= rSpan.mnEnd)
1305 SCROW nLast = ::std::min(nEndRow, rSpan.mnEnd);
1317 sal_Int32 nColRow, sal_Int32 nLevel,
bool bCollapsed,
bool bRows )
1322 OSL_ENSURE( nLevel >= 0,
"WorksheetGlobals::convertOutlines - negative outline level" );
1323 nLevel = ::std::max< sal_Int32 >( nLevel, 0 );
1325 sal_Int32 nSize = orLevels.size();
1326 if( nSize < nLevel )
1329 orLevels.insert(orLevels.end(), nLevel - nSize, nColRow);
1331 else if( nLevel < nSize )
1336 sal_Int32 nFirstInLevel = orLevels.back();
1337 orLevels.pop_back();
1348 Reference< XSheetOutline > xOutline(
mxSheet, UNO_QUERY_THROW );
1351 CellRangeAddress aRange(
getSheetIndex(), 0, nFirstColRow, 0, nLastColRow );
1352 xOutline->group( aRange, TableOrientation_ROWS );
1354 xOutline->hideDetail( aRange );
1358 CellRangeAddress aRange(
getSheetIndex(), nFirstColRow, 0, nLastColRow, 0 );
1359 xOutline->group( aRange, TableOrientation_COLUMNS );
1361 xOutline->hideDetail( aRange );
1373 maDrawPageSize.Width = lclClampToNonNegativeInt32( aPageSize.Width() );
1374 maDrawPageSize.Height = lclClampToNonNegativeInt32( aPageSize.Height() );
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 )
void convertColumns()
Converts column properties for all columns in the sheet.
static css::uno::Sequence< css::table::CellRangeAddress > toApiSequence(const ScRangeList &orRanges)
Converts the passed range list to a sequence of cell range addresses.
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Helper class to provide access to global workbook data.
bool isSheetRightToLeft() const
Returns true, if the sheet layout is set to right-to-left.
HyperlinkModel()
Additional tooltip text.
SCTAB getSheetIndex() const
Returns the index of the current sheet.
static WorksheetGlobalsRef constructGlobals(const WorkbookHelper &rHelper, const ISegmentProgressBarRef &rxProgressBar, WorksheetType eSheetType, SCTAB nSheet)
bool mbFastRowProgress
Sheet progress bar.
void setBaseColumnWidth(sal_Int32 nWidth)
Sets base width for all columns (without padding pixels).
void setCurrentSheetIndex(SCTAB nSheet)
Sets the index of the current Calc sheet, if filter currently processes a sheet.
awt::Size maDrawPageSize
Path to legacy VML drawing fragment.
bool HasAutoFilter() const
double scaleValue(double fValue, Unit eFromUnit, Unit eToUnit) const
Converts the passed value between the passed units.
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
ScAddress getCellAddressFromPosition(const awt::Point &rPosition) const
Returns the address of the cell that contains the passed point in 1/100 mm.
ScDocumentImport & getDocImport()
SheetDataBuffer & getSheetData() const
Returns the buffer for cell contents and cell formatting.
Reference< XDrawPage > getDrawPage() const
Returns the XDrawPage interface of the draw page of the current sheet.
constexpr auto toTwips(N number, Length from)
PageSettings & getPageSettings()
Returns the page/print settings for this sheet.
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
bool mbThickTop
True = row outline is collapsed.
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
void createSharedFormulaMapEntry(const ScAddress &rAddress, sal_Int32 nSharedId, const OUString &rTokens)
WorksheetSettings & getWorksheetSettings()
Returns the worksheet settings object.
void setColumnModel(const ColumnModel &rModel)
Sets column settings for a specific column range.
const awt::Size & getDrawPageSize() const
Returns the size of the entire drawing page in 1/100 mm.
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
bool validateCellRange(ScRange &orRange, bool bAllowOverflow, bool bTrackOverflow)
Checks the passed cell range, may try to fit it to current sheet limits.
Contains string data and a list of formatting runs for a rich formatted string.
OUString getCalcSheetName(sal_Int32 nWorksheet) const
Returns the finalized name of the specified worksheet.
SheetDataBuffer maSheetData
Cell ranges containing data validation settings.
::std::map< sal_Int32, RowModelRange > RowModelRangeMap
css::uno::Any getAnyProperty(sal_Int32 nPropId) const
bool mbHasDefWidth
Reference to the current sheet.
SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden)
WorksheetGlobals & mrSheetGlob
void finalizeImport()
Converts all imported sheet view settings.
void convertOutlines(OutlineLevelVec &orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows)
Converts outline grouping for the passed column or row.
ColumnModel()
True = column outline is collapsed.
bool mbCustomFormat
True = row has custom height.
ScDocument & getScDocument()
void extendShapeBoundingBox(const awt::Rectangle &rShapeRect)
Extends the shape bounding box by the position and size of the passed rectangle.
ExtLst & getExtLst()
returns the ExtLst entries that need to be filled
RowModel maDefRowModel
Ranges of columns sorted by first column index.
css::uno::Reference< css::table::XCellRange > getCellRange(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
void finalizeImport()
Inserts all web queries into the sheet.
SheetViewSettings & getSheetViewSettings()
Returns the view settings for this sheet.
This is very similar to ScCellValue, except that it references the original value instead of copying ...
#define STATIC_ARRAY_SELECT(array, index, def)
WorksheetSettings & getWorksheetSettings() const
Returns the worksheet settings object.
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
Accessor class to ScDocument.
ScRange maUsedArea
Reference to maximum Calc cell address from address converter.
SheetViewSettings & getSheetViewSettings() const
Returns the view settings for this sheet.
StylesBuffer & getStyles() const
Returns all cell formatting objects read from the styles substream.
void putFormulaTokens(const ScAddress &rAddress, const ApiTokenSequence &rTokens)
Inserts a formula cell directly into the Calc sheet.
void finalizeDrawings()
Imports the drawings of the sheet (DML, VML, DFF) and updates the used area.
ISegmentProgressBarRef mxFinalProgress
Progress bar for row/cell processing.
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...
void setEditCell(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
QueryTableBuffer maQueryTables
Sheet auto filters (not associated to a table).
const css::awt::Size & getDrawPageSize() const
Returns the size of the entire drawing page in 1/100 mm.
Fragment handler for a complete sheet drawing.
Reference< XSheetCellRanges > getCellRangeList(const ScRangeList &rRanges) const
Returns the XSheetCellRanges interface for the passed cell range addresses.
void setDrawingPath(const OUString &rDrawingPath)
Sets the path to the DrawingML fragment of this 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.
ViewSettings & getViewSettings() const
Returns the workbook and sheet view settings object.
void initializeWorksheetImport()
Initial conversion before importing the worksheet.
void setBiffType(sal_uInt8 nType)
Sets the passed BIFF validation type.
void finalizeValidationRanges() const
Inserts all imported data validations into their cell ranges.
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
const ScAddress & mrMaxApiPos
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
bool mbCustomHeight
Row outline level.
Reference< XSpreadsheet > mxSheet
Type of this sheet.
std::shared_ptr< WorksheetGlobals > WorksheetGlobalsRef
std::vector< ValidationModel > maValidations
Cell ranges containing hyperlinks.
void convertColumnFormat(sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId)
Converts column default cell formatting.
Stores formatting data about a page break.
bool mbCollapsed
True = row is hidden.
void setRowFormat(sal_Int32 nRow, sal_Int32 nXfId, bool bCustomFormat)
Sets default cell formatting for the specified range of rows.
WorksheetType getSheetType() const
Returns the type of this sheet.
void setVmlDrawingPath(const OUString &rVmlDrawingPath)
Sets the path to the legacy VML drawing fragment of this sheet.
::oox::core::FilterBase & getBaseFilter() const
Returns the base filter object (base class of all filters).
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.
sal_Int16 getCurrentSheetIndex() const
Returns the index of the current Calc sheet, if filter currently processes a sheet.
WorksheetType meSheetType
Progress bar for finalization.
void applyAutoFilters()
Applies autofilters from created database range ( requires finalizeImport to have run before being ca...
CommentsBuffer & getComments() const
Returns the buffer for all cell comments in this sheet.
CommentsBuffer maComments
Buffer for conditional formatting.
void finalizeDrawingImport()
double mfHeight
0-based (!) column ranges of used cells.
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
SC_DLLPUBLIC void SetColWidthOnly(SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth)
bool isValidSheet() const
Returns true, if this helper refers to an existing Calc sheet.
std::vector< HyperlinkModel > maHyperlinks
Ranges of rows sorted by first row index.
static IWorksheetProgress * getWorksheetInterface(const WorksheetGlobalsRef &xRef)
SC_DLLPUBLIC void SetRowHeightOnly(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight)
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 setCellStyleToSheet(SCTAB nTab, const ScStyleSheet &rStyle)
Apply specified cell style to an entire sheet.
CommentsBuffer & getComments()
Returns the buffer for all cell comments in this sheet.
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.
OUString getHyperlinkUrl(const HyperlinkModel &rHyperlink) const
Generates the final URL for the passed hyperlink.
awt::Rectangle maShapeBoundingBox
Current size of the drawing page in 1/100 mm.
AutoFilterBuffer maAutoFilters
Buffer for all cell comments in this sheet.
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 &)
VmlDrawingPtr mxVmlDrawing
View settings for this sheet.
::std::map< sal_Int32, ColumnModelRange > ColumnModelRangeMap
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.
ISegmentProgressBarRef mxProgressBar
Bounding box for all shapes from all drawings.
bool mbHidden
True = cells in column show phonetic settings.
bool mbCollapsed
True = column is hidden.
ISegmentProgressBarRef mxRowProgress
Do we have a progress bar thread ?
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 setDefaultColumnWidth(double fWidth)
Sets default width for all columns.
PageBreakModel()
True = manual page break.
void IncCol(SCCOL nDelta=1)
void convertRows(const std::vector< sc::ColRowSpan > &rSpans)
Converts row properties for all rows in the sheet.
virtual void setCustomRowProgress(const ISegmentProgressBarRef &rxRowProgress) override
Reference< XCellRange > getCellRange(const ScRange &rRange) const
Returns the XCellRange interface for the passed cell range address.
ExtLst & getExtLst() const
Stores settings and formatting data about a range of sheet columns.
void UpdateRowProgress(const ScRange &rUsedArea, SCROW nRow)
Update the row import progress bar.
WorksheetType getSheetType() const
Returns the type of this sheet.
std::shared_ptr< ISegmentProgressBar > ISegmentProgressBarRef
::std::pair< ColumnModel, sal_Int32 > ColumnModelRange
void insertHyperlink(const ScAddress &rAddress, const OUString &rUrl)
Inserts a hyperlinks into the specified cell.
ScDocument & getScDocument()
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
void setPageBreak(const PageBreakModel &rModel, bool bRowBreak)
Sets a column or row page break described in the passed struct.
std::unique_ptr< EditTextObject > CreateTextObject()
AutoFilterBuffer & getAutoFilters()
Returns the auto filters for the sheet.
void IncRow(SCROW nDelta=1)
void convert(const css::uno::Reference< css::text::XText > &rxText) const
Converts the string and writes it into the passed XText, replace old contents of the text object...
const Reference< XSpreadsheet > & getSheet() const
Returns the XSpreadsheet interface of the current sheet.
void insertColSpan(const ValueRange &rColSpan)
Inserts the passed column span into the row model.
SheetViewSettings maSheetViewSett
Page/print settings for this sheet.
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
void setBaseColumnWidth(sal_Int32 nWidth)
Sets base width for all columns (without padding pixels).
void finalizeImport(sal_Int16 nSheet)
Applies filter settings to a new database range object (used for sheet autofilter or advanced filter ...
ScEditEngineDefaulter & getEditEngine() const
void setVmlDrawingPath(const OUString &rVmlDrawingPath)
Sets the path to the legacy VML drawing fragment of this sheet.
css::uno::Reference< css::table::XCell > getCell(const ScAddress &rAddress) const
Returns the XCell interface for the passed cell address.
VmlDrawing & getVmlDrawing()
Returns the VML drawing page for this sheet (OOXML/BIFF12 only).
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
CondFormatBuffer maCondFormats
Buffer for cell contents and cell formatting.
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
void initializeWorksheetImport()
Initial conversion before importing the worksheet.
ExtLst maExtLst
Collection of all VML shapes.
QueryTableBuffer & getQueryTables() const
Returns the buffer for all web query tables in this sheet.
ColumnModelRangeMap maColModels
Default column formatting.
void setColumnModel(const ColumnModel &rModel)
Sets column settings for a specific range of columns.
OUString maVmlDrawingPath
Path to DrawingML fragment.
void setValidation(const ValidationModel &rModel)
Inserts the data validation settings into the spreadsheet.
RowModel()
True = row has extra space below text.
::std::vector< sal_Int32 > OutlineLevelVec
sal_Int32 mnXfId
Row height in points.
CondFormatBuffer & getCondFormats()
Returns the conditional formatting in this sheet.
css::uno::Sequence< ApiToken > ApiTokenSequence
Stores data about ranges with data validation settings.
void finalizeDrawingImport()
Final import of drawing objects.
Stores global named database ranges.
ScRange getCellRangeFromRectangle(const awt::Rectangle &rRect) const
Returns the cell range address that contains the passed rectangle in 1/100 mm.
PageSettings maPageSett
Global settings for this sheet.
void extendUsedArea(const ScAddress &rAddress)
Extends the used area of this sheet by the passed cell position.
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
ColumnModel maDefColModel
Used area of the sheet, and sheet index of the sheet.
bool isMergeable(const RowModel &rModel) const
Returns true, if this entry can be merged with the passed row range (row settings are equal)...
void setColSpans(sal_Int32 nRow, const ValueRangeSet &rColSpans)
Sets column span information for a row.
css::awt::Point getCellPosition(sal_Int32 nCol, sal_Int32 nRow) const
Returns the absolute cell position in 1/100 mm.
void setSheetUsedArea(const ScRange &rUsedArea)
Stores the used area for a specific worksheet.
void finalizeImport()
Creates a page style for the spreadsheet and sets all page properties.
const css::uno::Reference< css::sheet::XSpreadsheet > & getSheet() const
Returns the XSpreadsheet interface of the current sheet.
WorksheetGlobals(const WorkbookHelper &rHelper, const ISegmentProgressBarRef &rxProgressBar, WorksheetType eSheetType, SCTAB nSheet)
Service name for a SheetCellRanges object.
void finalizeWorksheetImport()
Final conversion after importing the worksheet.
SheetDataBuffer & getSheetData()
Returns the buffer for cell contents and cell formatting.
ValueRangeSet maColSpans
1-based (!) index of the described row.
RowModelRangeMap maRowModels
Default row formatting.
Reference< XCell > getCell(const ScAddress &rAddress) const
Returns the XCell interface for the passed cell address.
English Metric Unit (1/360,000 cm).
SCTAB getSheetIndex() const
Returns the index of the current sheet.
void insert(const ValueRange &rRange)
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.
SC_DLLPUBLIC void SetManualHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bManual)
::std::unique_ptr< VmlDrawing > VmlDrawingPtr
QueryTableBuffer & getQueryTables()
Returns the buffer for all web query tables in this sheet.
SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden)
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered)
void finalizeImport()
Converts the imported worksheet settings.
constexpr TypedWhichId< SfxStringItem > ATTR_HYPERLINK(155)
TableBuffer & getTables() const
Returns the tables collection (equivalent to Calc's database ranges).
Reference< XCellRange > getColumn(sal_Int32 nCol) const
Returns the XCellRange interface for a column.
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc(sal_Int32 nSheet) const
Returns a reference to the specified spreadsheet in the document model.
virtual ISegmentProgressBarRef getRowProgress() override
Allow the threaded importer to override our progress bar impl.
#define SAL_WARN(area, stream)
WorksheetHelper(WorksheetGlobals &rSheetGlob)
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.
VmlDrawing & getVmlDrawing() const
Returns the VML drawing page for this sheet (OOXML/BIFF12 only).
WorksheetSettings maSheetSett
Buffer for all web query tables in this sheet.
void finalizeImport()
Final processing after the sheet has been imported.
void setHyperlink(const HyperlinkModel &rModel)
Inserts the hyperlink URL into the spreadsheet.
Stores data about a hyperlink range.
Reference< XCellRange > getRow(sal_Int32 nRow) const
Returns the XCellRange interface for a row.
sal_Int32 mnLevel
Row default formatting (see mbIsFormatted).
WorksheetType
An enumeration for all types of sheets in a workbook.
void setValidation(const ValidationModel &rModel)
Inserts the data validation settings into the spreadsheet.
constexpr OUStringLiteral first
constexpr OUStringLiteral gaSheetCellRanges(u"com.sun.star.sheet.SheetCellRanges")
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
::std::pair< RowModel, sal_Int32 > RowModelRange
AutoFilterBuffer & getAutoFilters() const
Returns the auto filters for the sheet.
void setPageBreak(const PageBreakModel &rModel, bool bRowBreak)
Sets a column or row page break described in the passed struct.
const ScAddress & getMaxXlsAddress() const
Returns the biggest valid cell address in the imported/exported Excel document.
void setRowModel(const RowModel &rModel)
Sets row settings for a specific row.
void finalizeWorksheetImport()
Final conversion after importing the worksheet.
OUString maDrawingPath
List of extended elements.
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
void finalizeHyperlinkRanges()
Inserts all imported hyperlinks into their cell ranges.
bool mbThickBottom
True = row has extra space above text.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
void setRowModel(const RowModel &rModel)
Sets row settings for a specific range of rows.
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.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
FormulaBuffer & getFormulaBuffer() const
void groupColumnsOrRows(sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows)
Groups columns or rows for the given range.
bool m_bDetectedRangeSegmentation false
void setDefaultColumnWidth(double fWidth)
Sets default width for all columns.
void setBiffErrorStyle(sal_uInt8 nErrorStyle)
Sets the passed BIFF error style.
WorksheetBuffer & getWorksheets() const
Returns the worksheet buffer containing sheet names and properties.