LibreOffice Module sc (master)  1
Typedefs | Functions | Variables
vbarange.cxx File Reference
#include "vbarange.hxx"
#include <comphelper/types.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <o3tl/any.hxx>
#include <o3tl/unit_conversion.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/script/ArrayWrapper.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/vba/VBAEventId.hpp>
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
#include <com/sun/star/sheet/XDatabaseRange.hpp>
#include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
#include <com/sun/star/sheet/XGoalSeek.hpp>
#include <com/sun/star/sheet/XSheetOperation.hpp>
#include <com/sun/star/sheet/CellFlags.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/sheet/XCellAddressable.hpp>
#include <com/sun/star/table/CellContentType.hpp>
#include <com/sun/star/sheet/XCellSeries.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/sheet/XSheetCellRange.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSheetCellCursor.hpp>
#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/sheet/XNamedRanges.hpp>
#include <com/sun/star/sheet/XPrintAreas.hpp>
#include <com/sun/star/sheet/XCellRangesQuery.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/table/XTableRows.hpp>
#include <com/sun/star/table/XTableColumns.hpp>
#include <com/sun/star/table/TableSortField.hpp>
#include <com/sun/star/util/XMergeable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XNumberFormats.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/util/XReplaceable.hpp>
#include <com/sun/star/util/XSortable.hpp>
#include <com/sun/star/sheet/XCellRangeMovement.hpp>
#include <com/sun/star/sheet/FormulaResult.hpp>
#include <com/sun/star/sheet/FilterOperator2.hpp>
#include <com/sun/star/sheet/TableFilterField2.hpp>
#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <com/sun/star/sheet/FilterConnection.hpp>
#include <com/sun/star/util/TriState.hpp>
#include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
#include <com/sun/star/sheet/GeneralFunction.hpp>
#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
#include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
#include <ooo/vba/excel/XlPasteType.hpp>
#include <ooo/vba/excel/XlFindLookIn.hpp>
#include <ooo/vba/excel/XlLookAt.hpp>
#include <ooo/vba/excel/XlSearchOrder.hpp>
#include <ooo/vba/excel/XlSortOrder.hpp>
#include <ooo/vba/excel/XlYesNoGuess.hpp>
#include <ooo/vba/excel/XlSortOrientation.hpp>
#include <ooo/vba/excel/XlSortMethod.hpp>
#include <ooo/vba/excel/XlDirection.hpp>
#include <ooo/vba/excel/XlSortDataOption.hpp>
#include <ooo/vba/excel/XlDeleteShiftDirection.hpp>
#include <ooo/vba/excel/XlInsertShiftDirection.hpp>
#include <ooo/vba/excel/XlReferenceStyle.hpp>
#include <ooo/vba/excel/XlBordersIndex.hpp>
#include <ooo/vba/excel/XlPageBreak.hpp>
#include <ooo/vba/excel/XlAutoFilterOperator.hpp>
#include <ooo/vba/excel/XlAutoFillType.hpp>
#include <ooo/vba/excel/XlCellType.hpp>
#include <ooo/vba/excel/XlSpecialCellsValue.hpp>
#include <ooo/vba/excel/XlConsolidationFunction.hpp>
#include <ooo/vba/excel/XlSearchDirection.hpp>
#include <scitems.hxx>
#include <svl/srchitem.hxx>
#include <cellsuno.hxx>
#include <dbdata.hxx>
#include <docfunc.hxx>
#include <columnspanset.hxx>
#include <queryparam.hxx>
#include <sortparam.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <sc.hrc>
#include <unonames.hxx>
#include "excelvbahelper.hxx"
#include "vbaapplication.hxx"
#include "vbafont.hxx"
#include "vbacomment.hxx"
#include "vbainterior.hxx"
#include "vbacharacters.hxx"
#include "vbaborders.hxx"
#include "vbaworksheet.hxx"
#include "vbavalidation.hxx"
#include "vbahyperlinks.hxx"
#include <tabvwsh.hxx>
#include <rangelst.hxx>
#include <convuno.hxx>
#include <compiler.hxx>
#include <patattr.hxx>
#include <olinetab.hxx>
#include <transobj.hxx>
#include <queryentry.hxx>
#include <markdata.hxx>
#include <basic/sberrors.hxx>
#include <cppuhelper/implbase.hxx>
#include <global.hxx>
#include "vbastyle.hxx"
#include "vbaname.hxx"
#include <vector>
#include <vbahelper/vbacollectionimpl.hxx>
#include <com/sun/star/bridge/oleautomation/Date.hpp>
#include <tokenarray.hxx>
#include <tokenuno.hxx>
#include <memory>
Include dependency graph for vbarange.cxx:

Go to the source code of this file.

Typedefs

typedef ::cppu::WeakImplHelper< container::XEnumeration > CellsEnumeration_BASE
 
typedef ::std::vector< CellPos > vCellPos
 

Functions

static sal_uInt16 lcl_pointsToTwips (double nVal)
 
static double lcl_TwipsToPoints (sal_uInt16 nVal)
 
static double lcl_Round2DecPlaces (double nVal)
 
static uno::Any lcl_makeRange (const uno::Reference< XHelperInterface > &rParent, const uno::Reference< uno::XComponentContext > &rContext, const uno::Any &rAny, bool bIsRows, bool bIsColumns)
 
static uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges (const uno::Reference< XHelperInterface > &xParent, const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< sheet::XSheetCellRanges > &xLocSheetCellRanges, ScDocShell *pDoc)
 
static ScDocShellgetDocShellFromIf (const uno::Reference< uno::XInterface > &xIf)
 
static ScDocShellgetDocShellFromRange (const uno::Reference< table::XCellRange > &xRange)
 
static ScDocShellgetDocShellFromRanges (const uno::Reference< sheet::XSheetCellRangeContainer > &xRanges)
 
static uno::Reference< frame::XModel > getModelFromXIf (const uno::Reference< uno::XInterface > &xIf)
 
static uno::Reference< frame::XModel > getModelFromRange (const uno::Reference< table::XCellRange > &xRange)
 
static ScDocumentgetDocumentFromRange (const uno::Reference< table::XCellRange > &xRange)
 
constexpr OUStringLiteral STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY (u"The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again")
 
bool getScRangeListForAddress (const OUString &sName, ScDocShell *pDocSh, const ScRange &refRange, ScRangeList &aCellRanges, formula::FormulaGrammar::AddressConvention aConv)
 
static rtl::Reference< ScVbaRangegetRangeForName (const uno::Reference< uno::XComponentContext > &xContext, const OUString &sName, ScDocShell *pDocSh, const table::CellRangeAddress &pAddr, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_XL_A1)
 
static table::CellRangeAddress getCellRangeAddressForVBARange (const uno::Any &aParam, ScDocShell *pDocSh)
 
static uno::Reference< XCollection > lcl_setupBorders (const uno::Reference< excel::XRange > &xParentRange, const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< table::XCellRange > &xRange)
 
static bool cellInRange (const table::CellRangeAddress &rAddr, sal_Int32 nCol, sal_Int32 nRow)
 
static void setCursor (SCCOL nCol, SCROW nRow, const uno::Reference< frame::XModel > &xModel, bool bInSel=true)
 
static InsertDeleteFlags getPasteFlags (sal_Int32 Paste)
 
static ScPasteFunc getPasteFormulaBits (sal_Int32 Operation)
 
static uno::Reference< beans::XPropertySetgetRowOrColumnProps (const uno::Reference< table::XCellRange > &xCellRange, bool bRows)
 
static uno::Reference< table::XCellRange > processKey (const uno::Any &Key, const uno::Reference< uno::XComponentContext > &xContext, ScDocShell *pDocSh)
 
static sal_Int32 findSortPropertyIndex (const uno::Sequence< beans::PropertyValue > &props, const OUString &sPropName)
 
static void updateTableSortField (const uno::Reference< table::XCellRange > &xParentRange, const uno::Reference< table::XCellRange > &xColRowKey, sal_Int16 nOrder, table::TableSortField &aTableField, bool bIsSortColumn, bool bMatchCase)
 
static double getDefaultCharWidth (ScDocShell *pDocShell)
 
static uno::Reference< sheet::XCellRangeReferrer > getNamedRange (const uno::Reference< uno::XInterface > &xIf, const uno::Reference< table::XCellRange > &thisRange)
 
static ScDBDatalcl_GetDBData_Impl (ScDocShell *pDocShell, sal_Int16 nSheet)
 
static void lcl_SelectAll (ScDocShell *pDocShell, const ScQueryParam &aParam)
 
static ScQueryParam lcl_GetQueryParam (ScDocShell *pDocShell, sal_Int16 nSheet)
 
static void lcl_SetAllQueryForField (ScDocShell *pDocShell, SCCOLROW nField, sal_Int16 nSheet)
 
static void lcl_setTableFieldsFromCriteria (OUString &sCriteria1, const uno::Reference< beans::XPropertySet > &xDescProps, sheet::TableFilterField2 &rFilterField)
 
static void lcl_mergeCellsOfRange (const uno::Reference< table::XCellRange > &xCellRange, bool _bMerge)
 
static sal_Int32 lcl_getFormulaResultFlags (const uno::Any &aType)
 
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScVbaRange_get_implementation (css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
 

Variables

const double fExtraWidth = 182.0 / 256.0
 
const sal_Int16 supportedIndexTable [] = { excel::XlBordersIndex::xlEdgeLeft, excel::XlBordersIndex::xlEdgeTop, excel::XlBordersIndex::xlEdgeBottom, excel::XlBordersIndex::xlEdgeRight, excel::XlBordersIndex::xlDiagonalDown, excel::XlBordersIndex::xlDiagonalUp, excel::XlBordersIndex::xlInsideVertical, excel::XlBordersIndex::xlInsideHorizontal }
 
constexpr OUStringLiteral ISVISIBLE = u"IsVisible"
 
const char EQUALS [] = "="
 
const char NOTEQUALS [] = "<>"
 
const char GREATERTHAN [] = ">"
 
const char GREATERTHANEQUALS [] = ">="
 
const char LESSTHAN [] = "<"
 
const char LESSTHANEQUALS [] = "<="
 
constexpr OUStringLiteral CELLSTYLE = u"CellStyle"
 
constexpr OUStringLiteral sNA = u"#N/A"
 

Typedef Documentation

typedef ::cppu::WeakImplHelper< container::XEnumeration > CellsEnumeration_BASE

Definition at line 580 of file vbarange.cxx.

typedef ::std::vector< CellPos > vCellPos

Definition at line 581 of file vbarange.cxx.

Function Documentation

SAL_DLLPUBLIC_EXPORT css::uno::XInterface* Calc_ScVbaRange_get_implementation ( css::uno::XComponentContext *  context,
css::uno::Sequence< css::uno::Any > const &  args 
)

Definition at line 5661 of file vbarange.cxx.

static bool cellInRange ( const table::CellRangeAddress &  rAddr,
sal_Int32  nCol,
sal_Int32  nRow 
)
static

Definition at line 2289 of file vbarange.cxx.

Referenced by ScVbaRange::Activate().

static sal_Int32 findSortPropertyIndex ( const uno::Sequence< beans::PropertyValue > &  props,
const OUString &  sPropName 
)
static
Exceptions
uno::RuntimeException

Definition at line 3330 of file vbarange.cxx.

Referenced by ScVbaRange::Sort().

static table::CellRangeAddress getCellRangeAddressForVBARange ( const uno::Any aParam,
ScDocShell pDocSh 
)
static
Exceptions
uno::RuntimeException

Definition at line 1372 of file vbarange.cxx.

References ScUnoConversion::FillApiRange(), ScRangeList::front(), getScRangeListForAddress(), and ScRangeList::size().

Referenced by ScVbaRange::Address().

static double getDefaultCharWidth ( ScDocShell pDocShell)
static
static ScDocShell* getDocShellFromIf ( const uno::Reference< uno::XInterface > &  xIf)
static
Exceptions
uno::RuntimeException

Definition at line 363 of file vbarange.cxx.

References ScCellRangesBase::GetDocShell().

Referenced by getDocShellFromRange(), getDocShellFromRanges(), and getModelFromXIf().

static ScDocShell* getDocShellFromRange ( const uno::Reference< table::XCellRange > &  xRange)
static
static ScDocShell* getDocShellFromRanges ( const uno::Reference< sheet::XSheetCellRangeContainer > &  xRanges)
static
Exceptions
uno::RuntimeException

Definition at line 382 of file vbarange.cxx.

References getDocShellFromIf().

static ScDocument& getDocumentFromRange ( const uno::Reference< table::XCellRange > &  xRange)
static
static uno::Reference< frame::XModel > getModelFromRange ( const uno::Reference< table::XCellRange > &  xRange)
static
Exceptions
uno::RuntimeException

Definition at line 397 of file vbarange.cxx.

References getModelFromXIf().

Referenced by ScVbaRange::Cut(), and ScVbaRange::End().

static uno::Reference< frame::XModel > getModelFromXIf ( const uno::Reference< uno::XInterface > &  xIf)
static
Exceptions
uno::RuntimeException

Definition at line 390 of file vbarange.cxx.

References getDocShellFromIf(), and SfxObjectShell::GetModel().

Referenced by getModelFromRange().

static uno::Reference< sheet::XCellRangeReferrer > getNamedRange ( const uno::Reference< uno::XInterface > &  xIf,
const uno::Reference< table::XCellRange > &  thisRange 
)
static

Definition at line 4124 of file vbarange.cxx.

Referenced by ScVbaRange::getName().

static InsertDeleteFlags getPasteFlags ( sal_Int32  Paste)
static

Definition at line 2816 of file vbarange.cxx.

References ALL, ATTRIB, DATETIME, FORMULA, NONE, NOTE, SPECIAL_BOOLEAN, STRING, and VALUE.

Referenced by ScVbaRange::PasteSpecial().

static ScPasteFunc getPasteFormulaBits ( sal_Int32  Operation)
static

Definition at line 2843 of file vbarange.cxx.

References ADD, DIV, MUL, NONE, and SUB.

Referenced by ScVbaRange::PasteSpecial().

static rtl::Reference<ScVbaRange> getRangeForName ( const uno::Reference< uno::XComponentContext > &  xContext,
const OUString &  sName,
ScDocShell pDocSh,
const table::CellRangeAddress &  pAddr,
formula::FormulaGrammar::AddressConvention  eConv = formula::FormulaGrammar::CONV_XL_A1 
)
static
static uno::Reference< beans::XPropertySet > getRowOrColumnProps ( const uno::Reference< table::XCellRange > &  xCellRange,
bool  bRows 
)
static
Exceptions
uno::RuntimeException

Definition at line 2980 of file vbarange.cxx.

Referenced by ScVbaRange::getHidden(), and ScVbaRange::setHidden().

bool getScRangeListForAddress ( const OUString &  sName,
ScDocShell pDocSh,
const ScRange refRange,
ScRangeList aCellRanges,
formula::FormulaGrammar::AddressConvention  aConv = formula::FormulaGrammar::CONV_XL_A1 
)
static ScDBData* lcl_GetDBData_Impl ( ScDocShell pDocShell,
sal_Int16  nSheet 
)
static

Definition at line 4263 of file vbarange.cxx.

References ScDocument::GetAnonymousDBData(), and ScDocShell::GetDocument().

Referenced by lcl_GetQueryParam().

static sal_Int32 lcl_getFormulaResultFlags ( const uno::Any aType)
static
Exceptions
script::BasicErrorException

Definition at line 5471 of file vbarange.cxx.

References ERRCODE_BASIC_BAD_PARAMETER, and nType.

Referenced by ScVbaRange::SpecialCellsImpl().

static ScQueryParam lcl_GetQueryParam ( ScDocShell pDocShell,
sal_Int16  nSheet 
)
static
static uno::Any lcl_makeRange ( const uno::Reference< XHelperInterface > &  rParent,
const uno::Reference< uno::XComponentContext > &  rContext,
const uno::Any rAny,
bool  bIsRows,
bool  bIsColumns 
)
static

Definition at line 191 of file vbarange.cxx.

static uno::Reference< excel::XRange > lcl_makeXRangeFromSheetCellRanges ( const uno::Reference< XHelperInterface > &  xParent,
const uno::Reference< uno::XComponentContext > &  xContext,
const uno::Reference< sheet::XSheetCellRanges > &  xLocSheetCellRanges,
ScDocShell pDoc 
)
static
static void lcl_mergeCellsOfRange ( const uno::Reference< table::XCellRange > &  xCellRange,
bool  _bMerge 
)
static
Exceptions
uno::RuntimeException

Definition at line 5259 of file vbarange.cxx.

Referenced by ScVbaRange::Merge(), and ScVbaRange::UnMerge().

static sal_uInt16 lcl_pointsToTwips ( double  nVal)
static

Definition at line 169 of file vbarange.cxx.

Referenced by ScVbaRange::setColumnWidth(), and ScVbaRange::setRowHeight().

static double lcl_Round2DecPlaces ( double  nVal)
static
static void lcl_SelectAll ( ScDocShell pDocShell,
const ScQueryParam aParam 
)
static
static void lcl_SetAllQueryForField ( ScDocShell pDocShell,
SCCOLROW  nField,
sal_Int16  nSheet 
)
static
static void lcl_setTableFieldsFromCriteria ( OUString &  sCriteria1,
const uno::Reference< beans::XPropertySet > &  xDescProps,
sheet::TableFilterField2 &  rFilterField 
)
static
static uno::Reference< XCollection > lcl_setupBorders ( const uno::Reference< excel::XRange > &  xParentRange,
const uno::Reference< uno::XComponentContext > &  xContext,
const uno::Reference< table::XCellRange > &  xRange 
)
static
Exceptions
uno::RuntimeException

Definition at line 1412 of file vbarange.cxx.

References getDocumentFromRange(), and ScDocument::GetDocumentShell().

Referenced by ScVbaRange::getBorders().

static double lcl_TwipsToPoints ( sal_uInt16  nVal)
static
static uno::Reference< table::XCellRange > processKey ( const uno::Any Key,
const uno::Reference< uno::XComponentContext > &  xContext,
ScDocShell pDocSh 
)
static

Definition at line 3305 of file vbarange.cxx.

References cppu::UnoType< class >::get(), and getRangeForName().

Referenced by ScVbaRange::Sort().

static void setCursor ( SCCOL  nCol,
SCROW  nRow,
const uno::Reference< frame::XModel > &  xModel,
bool  bInSel = true 
)
static
constexpr OUStringLiteral STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY ( u"The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again"  )
static void updateTableSortField ( const uno::Reference< table::XCellRange > &  xParentRange,
const uno::Reference< table::XCellRange > &  xColRowKey,
sal_Int16  nOrder,
table::TableSortField &  aTableField,
bool  bIsSortColumn,
bool  bMatchCase 
)
static
Exceptions
uno::RuntimeException

Definition at line 3343 of file vbarange.cxx.

Referenced by ScVbaRange::Sort().

Variable Documentation

constexpr OUStringLiteral CELLSTYLE = u"CellStyle"

Definition at line 677 of file vbarange.cxx.

const char EQUALS[] = "="

Definition at line 670 of file vbarange.cxx.

const double fExtraWidth = 182.0 / 256.0

Definition at line 165 of file vbarange.cxx.

Referenced by ScVbaRange::getColumnWidth(), and ScVbaRange::setColumnWidth().

const char GREATERTHAN[] = ">"

Definition at line 672 of file vbarange.cxx.

const char GREATERTHANEQUALS[] = ">="

Definition at line 673 of file vbarange.cxx.

constexpr OUStringLiteral ISVISIBLE = u"IsVisible"

Definition at line 669 of file vbarange.cxx.

const char LESSTHAN[] = "<"

Definition at line 674 of file vbarange.cxx.

const char LESSTHANEQUALS[] = "<="

Definition at line 675 of file vbarange.cxx.

const char NOTEQUALS[] = "<>"

Definition at line 671 of file vbarange.cxx.

constexpr OUStringLiteral sNA = u"#N/A"

Definition at line 971 of file vbarange.cxx.

const sal_Int16 supportedIndexTable[] = { excel::XlBordersIndex::xlEdgeLeft, excel::XlBordersIndex::xlEdgeTop, excel::XlBordersIndex::xlEdgeBottom, excel::XlBordersIndex::xlEdgeRight, excel::XlBordersIndex::xlDiagonalDown, excel::XlBordersIndex::xlDiagonalUp, excel::XlBordersIndex::xlInsideVertical, excel::XlBordersIndex::xlInsideHorizontal }

Definition at line 167 of file vbarange.cxx.

Referenced by ScVbaRange::BorderAround().