22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/sheet/XScenarios.hpp>
24#include <com/sun/star/sheet/XScenariosSupplier.hpp>
25#include <com/sun/star/sheet/XSpreadsheet.hpp>
26#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
31#include <oox/token/properties.hxx>
32#include <oox/token/tokens.hxx>
108 for(
const auto& rCell :
maCells )
119 Reference< XNameAccess > xSheetsNA(
getDocument()->getSheets(), UNO_QUERY_THROW );
124 Reference< XScenarios > xScenarios( xScenariosSupp->getScenarios(), UNO_SET_THROW );
128 Reference< XSpreadsheet > xSheet(
getSheetFromDoc( aScenName ), UNO_SET_THROW );
129 for(
const auto& rCell :
maCells )
131 if( !rCell.mbDeleted )
try
134 Reference< XCell > xCell( xSheet->getCellByPosition( rCell.maPos.Col(), rCell.maPos.Row() ), UNO_SET_THROW );
135 xCell->setFormula( rCell.maValue );
143 PropertySet aPropSet( xScenarios->getByName( aScenName ) );
204 rxSheetScens = std::make_shared<SheetScenarios>( *
this, nSheet );
205 return *rxSheetScens;
void push_back(const ScRange &rRange)
std::optional< OUString > getXString(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
std::optional< OUString > getString(sal_Int32 nAttrToken) const
std::optional< bool > getBool(sal_Int32 nAttrToken) const
static OUString getUnusedName(const css::uno::Reference< css::container::XNameAccess > &rxNameAccess, const OUString &rSuggestedName, sal_Unicode cSeparator)
bool setProperty(sal_Int32 nPropId, const Type &rValue)
container_type::mapped_type mapped_type
void forEachMem(FuncType pFunc) const
void forEachMem(FuncType pFunc) const
container_type::value_type value_type
Converter for cell addresses and cell ranges for OOXML and BIFF filters.
bool checkCellAddress(const ScAddress &rAddress, bool bTrackOverflow)
Checks the passed cell address if it fits into the spreadsheet limits.
static css::uno::Sequence< css::table::CellRangeAddress > toApiSequence(const ScRangeList &orRanges)
Converts the passed range list to a sequence of cell range addresses.
static bool convertToCellAddressUnchecked(ScAddress &orAddress, const OUString &rString, sal_Int16 nSheet)
Converts the passed string to a single cell address, without checking any sheet limits.
ScenarioBuffer(const WorkbookHelper &rHelper)
SheetScenarios & createSheetScenarios(sal_Int16 nSheet)
Creates and returns a scenario collection for the passed sheet.
SheetScenariosMap maSheetScenarios
void finalizeImport()
Creates all scenarios in the Calc document.
void finalizeImport()
Creates the scenario in the Calc document.
std::vector< ScenarioCellModel > maCells
ScenarioModel maModel
Scenario cells.
Scenario(const WorkbookHelper &rHelper, sal_Int16 nSheet, bool bIsActive)
void importInputCells(const AttributeList &rAttribs)
Imports a new cell for this scenario from an inputCells element.
sal_Int16 mnSheet
Scenario model data.
void importScenario(const AttributeList &rAttribs)
Imports a scenario definition from a scenario element.
ScenarioVector maScenarios
SheetScenariosModel maModel
SheetScenarios(const WorkbookHelper &rHelper, sal_Int16 nSheet)
void finalizeImport()
Creates all scenarios in the Calc sheet.
Scenario & createScenario()
Creates and returns a new scenario in this collection.
void importScenarios(const AttributeList &rAttribs)
Imports sheet scenario settings from a scenarios element.
Helper class to provide access to global workbook data.
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc(sal_Int32 nSheet) const
Returns a reference to the specified spreadsheet in the document model.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
A 2D cell address struct for binary filters.
OUString maComment
Name of the scenario.
bool mbActive
True = scenario is hidden.
bool mbHidden
True = input cell values locked.
bool mbLocked
Name of user created the scenario.
SheetScenariosModel()
Visible scenario.
sal_Int32 mnShown
Selected scenario.