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 )
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 ) );
145 aPropSet.setProperty( PROP_CopyBack,
false );
146 aPropSet.setProperty( PROP_CopyStyles,
false );
147 aPropSet.setProperty( PROP_CopyFormulas,
false );
150 aPropSet.setProperty( PROP_ShowBorder,
false );
151 aPropSet.setProperty( PROP_PrintBorder,
false );
204 rxSheetScens = std::make_shared<SheetScenarios>( *
this, nSheet );
205 return *rxSheetScens;
static css::uno::Sequence< css::table::CellRangeAddress > toApiSequence(const ScRangeList &orRanges)
Converts the passed range list to a sequence of cell range addresses.
Helper class to provide access to global workbook data.
bool checkCellAddress(const ScAddress &rAddress, bool bTrackOverflow)
Checks the passed cell address if it fits into the spreadsheet limits.
OptValue< bool > getBool(sal_Int32 nAttrToken) const
void finalizeImport()
Creates all scenarios in the Calc sheet.
Scenario & createScenario()
Creates and returns a new scenario in this collection.
A 2D cell address struct for binary filters.
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
ScenarioModel maModel
Scenario cells.
void finalizeImport()
Creates the scenario in the Calc document.
bool mbLocked
Name of user created the scenario.
OptValue< OUString > getString(sal_Int32 nAttrToken) const
std::vector< ScenarioCellModel > maCells
void forEachMem(FuncType pFunc) const
Scenario(const WorkbookHelper &rHelper, sal_Int16 nSheet, bool bIsActive)
void push_back(const ScRange &rRange)
bool mbHidden
True = input cell values locked.
container_type::value_type value_type
const css::uno::Reference< css::sheet::XSpreadsheetDocument > & getDocument() const
Returns a reference to the source/target spreadsheet document model.
container_type::mapped_type mapped_type
void importScenario(const AttributeList &rAttribs)
Imports a scenario definition from a scenario element.
void importInputCells(const AttributeList &rAttribs)
Imports a new cell for this scenario from an inputCells element.
SheetScenarios & createSheetScenarios(sal_Int16 nSheet)
Creates and returns a scenario collection for the passed sheet.
static OUString getUnusedName(const css::uno::Reference< css::container::XNameAccess > &rxNameAccess, const OUString &rSuggestedName, sal_Unicode cSeparator)
sal_Int32 mnShown
Selected scenario.
ScenarioBuffer(const WorkbookHelper &rHelper)
void importScenarios(const AttributeList &rAttribs)
Imports sheet scenario settings from a scenarios element.
Converter for cell addresses and cell ranges for OOXML and BIFF filters.
void finalizeImport()
Creates all scenarios in the Calc document.
SheetScenariosModel maModel
SheetScenarios(const WorkbookHelper &rHelper, sal_Int16 nSheet)
ScenarioVector maScenarios
OUString maComment
Name of the scenario.
bool mbActive
True = scenario is hidden.
SheetScenariosMap maSheetScenarios
css::uno::Reference< css::sheet::XSpreadsheet > getSheetFromDoc(sal_Int32 nSheet) const
Returns a reference to the specified spreadsheet in the document model.
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.
SheetScenariosModel()
Visible scenario.
sal_Int16 mnSheet
Scenario model data.
void forEachMem(FuncType pFunc) const
bool setProperty(sal_Int32 nPropId, const Type &rValue)
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.