28#include <rtl/math.hxx>
32#include <com/sun/star/script/ArrayWrapper.hpp>
33#include <com/sun/star/script/XTypeConverter.hpp>
34#include <com/sun/star/script/vba/VBAEventId.hpp>
35#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
36#include <com/sun/star/sheet/XDatabaseRange.hpp>
37#include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp>
38#include <com/sun/star/sheet/XGoalSeek.hpp>
39#include <com/sun/star/sheet/XSheetOperation.hpp>
40#include <com/sun/star/sheet/CellFlags.hpp>
41#include <com/sun/star/table/XColumnRowRange.hpp>
42#include <com/sun/star/sheet/XCellAddressable.hpp>
43#include <com/sun/star/table/CellContentType.hpp>
44#include <com/sun/star/sheet/XCellSeries.hpp>
45#include <com/sun/star/text/XTextRange.hpp>
46#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
47#include <com/sun/star/table/CellAddress.hpp>
48#include <com/sun/star/table/CellRangeAddress.hpp>
49#include <com/sun/star/sheet/XSpreadsheetView.hpp>
50#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
51#include <com/sun/star/sheet/XSheetCellRange.hpp>
52#include <com/sun/star/sheet/XSpreadsheet.hpp>
53#include <com/sun/star/sheet/XSheetCellCursor.hpp>
54#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
55#include <com/sun/star/sheet/XNamedRange.hpp>
56#include <com/sun/star/sheet/XNamedRanges.hpp>
57#include <com/sun/star/sheet/XPrintAreas.hpp>
58#include <com/sun/star/sheet/XCellRangesQuery.hpp>
59#include <com/sun/star/beans/XPropertySet.hpp>
60#include <com/sun/star/frame/XModel.hpp>
61#include <com/sun/star/view/XSelectionSupplier.hpp>
62#include <com/sun/star/table/XTableRows.hpp>
63#include <com/sun/star/table/XTableColumns.hpp>
64#include <com/sun/star/table/TableSortField.hpp>
65#include <com/sun/star/util/XMergeable.hpp>
66#include <com/sun/star/uno/XComponentContext.hpp>
67#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
68#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
69#include <com/sun/star/util/XNumberFormats.hpp>
70#include <com/sun/star/util/NumberFormat.hpp>
71#include <com/sun/star/util/XNumberFormatTypes.hpp>
72#include <com/sun/star/util/XReplaceable.hpp>
73#include <com/sun/star/util/XSortable.hpp>
74#include <com/sun/star/sheet/XCellRangeMovement.hpp>
75#include <com/sun/star/sheet/FormulaResult.hpp>
76#include <com/sun/star/sheet/FilterOperator2.hpp>
77#include <com/sun/star/sheet/TableFilterField2.hpp>
78#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
79#include <com/sun/star/sheet/FilterConnection.hpp>
80#include <com/sun/star/util/TriState.hpp>
82#include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
83#include <com/sun/star/sheet/XSubTotalDescriptor.hpp>
84#include <com/sun/star/sheet/GeneralFunction.hpp>
86#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
87#include <com/sun/star/sheet/XSheetAnnotations.hpp>
89#include <ooo/vba/excel/XlPasteSpecialOperation.hpp>
90#include <ooo/vba/excel/XlPasteType.hpp>
91#include <ooo/vba/excel/XlFindLookIn.hpp>
92#include <ooo/vba/excel/XlLookAt.hpp>
93#include <ooo/vba/excel/XlSearchOrder.hpp>
94#include <ooo/vba/excel/XlSortOrder.hpp>
95#include <ooo/vba/excel/XlYesNoGuess.hpp>
96#include <ooo/vba/excel/XlSortOrientation.hpp>
97#include <ooo/vba/excel/XlSortMethod.hpp>
98#include <ooo/vba/excel/XlDirection.hpp>
99#include <ooo/vba/excel/XlSortDataOption.hpp>
100#include <ooo/vba/excel/XlDeleteShiftDirection.hpp>
101#include <ooo/vba/excel/XlInsertShiftDirection.hpp>
102#include <ooo/vba/excel/XlReferenceStyle.hpp>
103#include <ooo/vba/excel/XlBordersIndex.hpp>
104#include <ooo/vba/excel/XlPageBreak.hpp>
105#include <ooo/vba/excel/XlAutoFilterOperator.hpp>
106#include <ooo/vba/excel/XlAutoFillType.hpp>
107#include <ooo/vba/excel/XlCellType.hpp>
108#include <ooo/vba/excel/XlSpecialCellsValue.hpp>
109#include <ooo/vba/excel/XlConsolidationFunction.hpp>
110#include <ooo/vba/excel/XlSearchDirection.hpp>
116#include <docfunc.hxx>
126#include <unonames.hxx>
142#include <compiler.hxx>
159#include <com/sun/star/bridge/oleautomation/Date.hpp>
160#include <tokenarray.hxx>
172const 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 };
176 nVal = nVal *
static_cast<double>(20);
177 short nTwips =
static_cast<short>(nVal);
182 double nPoints = nVal;
188 nVal = (nVal * double(100));
190 if ( ( nVal - tmp ) >= 0.5 )
192 nVal = double(tmp)/100;
196static uno::Any lcl_makeRange(
const uno::Reference< XHelperInterface >& rParent,
const uno::Reference< uno::XComponentContext >& rContext,
const uno::Any& rAny,
bool bIsRows,
bool bIsColumns )
198 uno::Reference< table::XCellRange > xCellRange(rAny, uno::UNO_QUERY_THROW);
199 return uno::Any( uno::Reference< excel::XRange >(
new ScVbaRange( rParent, rContext, xCellRange, bIsRows, bIsColumns ) ) );
202static 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 )
204 uno::Reference< excel::XRange > xRange;
205 const uno::Sequence< table::CellRangeAddress > sAddresses = xLocSheetCellRanges->getRangeAddresses();
207 if ( sAddresses.hasElements() )
209 for (
const auto& rAddress : sAddresses )
216 if ( aCellRanges.
size() == 1 )
218 uno::Reference< table::XCellRange > xTmpRange(
new ScCellRangeObj( pDoc, aCellRanges.
front() ) );
219 xRange =
new ScVbaRange( xParent, xContext, xTmpRange );
223 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj( pDoc, aCellRanges ) );
224 xRange =
new ScVbaRange( xParent, xContext, xRanges );
233 return dynamic_cast<ScCellRangesBase*
>(
mxRanges.get() );
235 return dynamic_cast<ScCellRangesBase*
>(
mxRange.get() );
236 throw uno::RuntimeException(
"General Error creating range - Unknown" );
248 throw uno::RuntimeException(
"Can't access Itemset for range" );
258 const uno::Reference< script::vba::XVBAEventProcessor >& xVBAEvents = rDoc.
GetVbaEventProcessor();
259 if( xVBAEvents.is() )
try
261 uno::Sequence< uno::Any > aArgs{
uno::Any(uno::Reference< excel::XRange >(
this )) };
262 xVBAEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_CHANGE, aArgs );
264 catch( uno::Exception& )
273 uno::Reference< table::XCellRange > m_xRange;
277 explicit SingleRangeEnumeration( uno::Reference< table::XCellRange > xRange ) : m_xRange(
std::move( xRange )), bHasMore( true ) { }
278 virtual sal_Bool SAL_CALL hasMoreElements( )
override {
return bHasMore; }
279 virtual uno::Any SAL_CALL nextElement( )
override
282 throw container::NoSuchElementException();
291class SingleRangeIndexAccess :
public ::cppu::WeakImplHelper< container::XIndexAccess,
292 container::XEnumerationAccess >
295 uno::Reference< table::XCellRange > m_xRange;
298 explicit SingleRangeIndexAccess( uno::Reference< table::XCellRange > xRange ) : m_xRange(
std::move( xRange )) {}
300 virtual ::sal_Int32 SAL_CALL getCount()
override {
return 1; }
301 virtual uno::Any SAL_CALL getByIndex( ::sal_Int32
Index )
override
304 throw lang::IndexOutOfBoundsException();
309 virtual sal_Bool SAL_CALL hasElements()
override {
return true; }
311 virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration()
override {
return new SingleRangeEnumeration( m_xRange ); }
321 RangesEnumerationImpl(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< container::XEnumeration >& xEnumeration,
bool bIsRows,
bool bIsColumns ) :
EnumerationHelperImpl( xParent, xContext, xEnumeration ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
322 virtual uno::Any SAL_CALL nextElement( )
override
324 return lcl_makeRange( m_xParent, m_xContext, m_xEnumeration->nextElement(), mbIsRows, mbIsColumns );
333 ScVbaRangeAreas(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< container::XIndexAccess >& xIndexAccess,
bool bIsRows,
bool bIsColumns ) :
ScVbaCollectionBaseImpl( xParent, xContext, xIndexAccess ), mbIsRows( bIsRows ), mbIsColumns( bIsColumns ) {}
336 virtual uno::Reference< container::XEnumeration > SAL_CALL
createEnumeration()
override;
345 virtual uno::Sequence< OUString >
getServiceNames()
override {
return uno::Sequence< OUString >(); }
351uno::Reference< container::XEnumeration > SAL_CALL
352ScVbaRangeAreas::createEnumeration()
354 uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
355 return new RangesEnumerationImpl( mxParent, mxContext, xEnumAccess->createEnumeration(), mbIsRows, mbIsColumns );
359ScVbaRangeAreas::createCollectionObject(
const uno::Any& aSource )
361 return lcl_makeRange( mxParent, mxContext, aSource, mbIsRows, mbIsColumns );
369 ScCellRangesBase* pUno =
dynamic_cast<ScCellRangesBase*
>( xIf.get() );
371 throw uno::RuntimeException(
"Failed to access underlying uno range object" );
372 return pUno->GetDocShell();
380 uno::Reference< uno::XInterface > xIf( xRange );
389 uno::Reference< uno::XInterface > xIf( xRanges );
394static uno::Reference< frame::XModel >
getModelFromXIf(
const uno::Reference< uno::XInterface >& xIf )
401static uno::Reference< frame::XModel >
getModelFromRange(
const uno::Reference< table::XCellRange >& xRange )
404 uno::Reference< uno::XInterface > xIf( xRange );
413 throw uno::RuntimeException(
"Failed to access underlying docshell from uno range object" );
423 uno::Reference< container::XIndexAccess > xIndex(
mxRanges, uno::UNO_QUERY_THROW );
424 uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
435 uno::Reference< container::XIndexAccess > xIndex(
mxRanges, uno::UNO_QUERY_THROW );
436 uno::Reference< table::XCellRange > xRange( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
445 return dynamic_cast< ScVbaRange*
>( rxRange.get() );
451 return pDocShell->GetModel();
452 throw uno::RuntimeException();
458 return pScVbaRange->getUnoModel();
459 throw uno::RuntimeException();
465 return pScRangesBase->GetRangeList();
466 throw uno::RuntimeException(
"Cannot obtain UNO range implementation object" );
472 return pScVbaRange->getScRangeList();
473 throw uno::RuntimeException(
"Cannot obtain VBA range implementation object" );
480 uno::Reference< util::XNumberFormatsSupplier > mxSupplier;
481 uno::Reference< beans::XPropertySet > mxRangeProps;
482 uno::Reference< util::XNumberFormats > mxFormats;
484 explicit NumFormatHelper(
const uno::Reference< table::XCellRange >& xRange )
487 mxRangeProps.set( xRange, uno::UNO_QUERY_THROW);
488 mxFormats = mxSupplier->getNumberFormats();
490 uno::Reference< beans::XPropertySet > getNumberProps()
493 uno::Any aValue = mxRangeProps->getPropertyValue(
"NumberFormat" );
494 aValue >>= nIndexKey;
496 if ( mxFormats.is() )
497 return mxFormats->getByKey( nIndexKey );
498 return uno::Reference< beans::XPropertySet > ();
504 return (getNumberFormat() & util::NumberFormat::LOGICAL) != 0;
509 sal_Int16
nType = getNumberFormat();
510 return (
nType & util::NumberFormat::DATETIME ) != 0;
513 OUString getNumberFormatString()
515 uno::Reference< uno::XInterface > xIf( mxRangeProps, uno::UNO_QUERY_THROW );
516 ScCellRangesBase* pUnoCellRange =
dynamic_cast<ScCellRangesBase*
>( xIf.get() );
520 SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( pUnoCellRange );
524 if ( eState == SfxItemState::DONTCARE )
528 uno::Reference< beans::XPropertySet > xNumberProps( getNumberProps(), uno::UNO_SET_THROW );
529 OUString aFormatString;
530 uno::Any aString = xNumberProps->getPropertyValue(
"FormatString" );
531 aString >>= aFormatString;
532 return aFormatString;
535 sal_Int16 getNumberFormat()
537 uno::Reference< beans::XPropertySet > xNumberProps = getNumberProps();
538 sal_Int16
nType = ::comphelper::getINT16(
539 xNumberProps->getPropertyValue(
"Type" ) );
543 void setNumberFormat(
const OUString& rFormat )
546 sal_Int32 nNewIndex = 0;
547 if( !rFormat.equalsIgnoreAsciiCase(
"General" ) )
549 lang::Locale aLocale;
550 uno::Reference< beans::XPropertySet > xNumProps = getNumberProps();
551 xNumProps->getPropertyValue(
"Locale" ) >>= aLocale;
552 nNewIndex = mxFormats->queryKey( rFormat, aLocale,
false );
553 if ( nNewIndex == -1 )
554 nNewIndex = mxFormats->addNew( rFormat, aLocale );
556 mxRangeProps->setPropertyValue(
"NumberFormat",
uno::Any( nNewIndex ) );
559 void setNumberFormat( sal_Int16
nType )
561 uno::Reference< beans::XPropertySet > xNumberProps = getNumberProps();
562 lang::Locale aLocale;
563 xNumberProps->getPropertyValue(
"Locale" ) >>= aLocale;
564 uno::Reference<util::XNumberFormatTypes> xTypes( mxFormats, uno::UNO_QUERY );
567 sal_Int32 nNewIndex = xTypes->getStandardFormat(
nType, aLocale );
568 mxRangeProps->setPropertyValue(
"NumberFormat",
uno::Any( nNewIndex ) );
576 CellPos( sal_Int32 nRow, sal_Int32 nCol, sal_Int32 nArea ):m_nRow(nRow), m_nCol(nCol), m_nArea( nArea ) {};
596 uno::Reference< excel::XRange > mxRange;
601 ColumnsRowEnumeration( uno::Reference< excel::XRange > xRange, sal_Int32 nElems ) : mxRange(std::move( xRange )), mMaxElems( nElems ), mCurElem( 0 )
605 virtual sal_Bool SAL_CALL hasMoreElements()
override {
return mCurElem < mMaxElems; }
607 virtual uno::Any SAL_CALL nextElement()
override
609 if ( !hasMoreElements() )
610 throw container::NoSuchElementException();
611 sal_Int32 vbaIndex = 1 + mCurElem++;
618 uno::WeakReference< XHelperInterface >
mxParent;
619 uno::Reference< uno::XComponentContext >
mxContext;
620 uno::Reference< XCollection > m_xAreas;
622 vCellPos::const_iterator m_it;
625 uno::Reference< table::XCellRange >
getArea( sal_Int32 nVBAIndex )
627 if ( nVBAIndex < 1 || nVBAIndex > m_xAreas->getCount() )
628 throw uno::RuntimeException();
629 uno::Reference< excel::XRange > xRange( m_xAreas->Item(
uno::Any(nVBAIndex),
uno::Any() ), uno::UNO_QUERY_THROW );
634 void populateArea( sal_Int32 nVBAIndex )
636 uno::Reference< table::XCellRange > xRange =
getArea( nVBAIndex );
637 uno::Reference< table::XColumnRowRange > xColumnRowRange(xRange, uno::UNO_QUERY_THROW );
638 sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
639 sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
640 for ( sal_Int32
i=0;
i<nRowCount; ++
i )
642 for ( sal_Int32 j=0; j<nColCount; ++j )
643 m_CellPositions.emplace_back(
i,j,nVBAIndex );
647 CellsEnumeration(
const uno::Reference< XHelperInterface >& xParent, uno::Reference< uno::XComponentContext > xContext, uno::Reference< XCollection > xAreas ):
mxParent( xParent ),
mxContext(std::move( xContext )), m_xAreas(std::move( xAreas ))
649 sal_Int32 nItems = m_xAreas->getCount();
652 populateArea(
index );
654 m_it = m_CellPositions.begin();
656 virtual sal_Bool SAL_CALL hasMoreElements()
override {
return m_it != m_CellPositions.end(); }
658 virtual uno::Any SAL_CALL nextElement()
override
660 if ( !hasMoreElements() )
661 throw container::NoSuchElementException();
662 CellPos aPos = *m_it++;
664 uno::Reference< table::XCellRange > xRangeArea =
getArea( aPos.m_nArea );
665 uno::Reference< table::XCellRange > xCellRange( xRangeArea->getCellByPosition( aPos.m_nCol, aPos.m_nRow ), uno::UNO_QUERY_THROW );
690 explicit CellValueSetter(
uno::Any aValue );
691 virtual bool processValue(
const uno::Any& aValue,
const uno::Reference< table::XCell >& xCell )
override;
692 virtual void visitNode( sal_Int32
x, sal_Int32
y,
const uno::Reference< table::XCell >& xCell )
override;
701CellValueSetter::visitNode( sal_Int32 , sal_Int32 ,
const uno::Reference< table::XCell >& xCell )
703 processValue( maValue, xCell );
707CellValueSetter::processValue(
const uno::Any& aValue,
const uno::Reference< table::XCell >& xCell )
710 bool isExtracted =
false;
711 switch ( aValue.getValueTypeClass() )
713 case uno::TypeClass_BOOLEAN:
716 if ( aValue >>= bState )
718 uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
720 xCell->setValue(
double(1) );
722 xCell->setValue(
double(0) );
723 NumFormatHelper cellNumFormat( xRange );
724 cellNumFormat.setNumberFormat( util::NumberFormat::LOGICAL );
728 case uno::TypeClass_STRING:
731 if ( aValue >>= aString )
740 if ( aString.toChar() ==
'\'' )
742 OUString aRemainder( aString.copy(1) );
743 uno::Reference< text::XTextRange > xTextRange( xCell, uno::UNO_QUERY_THROW );
744 xTextRange->setString( aRemainder );
760 double nDouble = 0.0;
761 if ( aValue >>= nDouble )
763 uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
764 NumFormatHelper cellFormat( xRange );
768 if ( cellFormat.isBooleanType() )
769 cellFormat.setNumberFormat(
"General");
770 xCell->setValue( nDouble );
789 CellValueGetter(
RangeValueType eValueType) { meValueType = eValueType; }
790 virtual void visitNode( sal_Int32 x, sal_Int32 y,
const uno::Reference< table::XCell >& xCell )
override;
798CellValueGetter::processValue(
const uno::Any& aValue )
802void CellValueGetter::visitNode( sal_Int32 , sal_Int32 ,
const uno::Reference< table::XCell >& xCell )
805 table::CellContentType eCellContentType = xCell->getType();
806 if( eCellContentType == table::CellContentType_VALUE || eCellContentType == table::CellContentType_FORMULA )
808 if ( eCellContentType == table::CellContentType_FORMULA )
811 OUString
sFormula = xCell->getFormula();
812 if ( sFormula ==
"=TRUE()" )
814 else if ( sFormula ==
"=FALSE()" )
818 uno::Reference< beans::XPropertySet > xProp( xCell, uno::UNO_QUERY_THROW );
820 sal_Int32 nResultType = sheet::FormulaResult::VALUE;
822 xProp->getPropertyValue(
"FormulaResultType2" ) >>= nResultType;
824 if ( nResultType == sheet::FormulaResult::STRING )
826 uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW);
827 aValue <<= xTextRange->getString();
830 aValue <<= xCell->getValue();
835 uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW );
836 NumFormatHelper cellFormat( xRange );
837 if ( cellFormat.isBooleanType() )
838 aValue <<= ( xCell->getValue() != 0.0 );
840 aValue <<= bridge::oleautomation::Date( xCell->getValue() );
842 aValue <<= xCell->getValue();
845 if( eCellContentType == table::CellContentType_TEXT )
847 uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW);
848 aValue <<= xTextRange->getString();
850 processValue( aValue );
855class CellFormulaValueSetter :
public CellValueSetter
863 bool processValue(
const uno::Any& aValue,
const uno::Reference< table::XCell >& xCell )
override
866 double aDblValue = 0.0;
867 if ( aValue >>= sFormula )
875 uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
876 ScCellRangesBase* pUnoRangesBase
877 =
dynamic_cast< ScCellRangesBase*
>( xIf.get() );
878 if ( pUnoRangesBase )
880 const ScRangeList& rCellRanges = pUnoRangesBase->GetRangeList();
881 if (!rCellRanges.
empty())
885 std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sFormula));
889 aCompiler.CreateStringFromTokenArray(sConverted);
895 xCell->setFormula( sFormula );
898 else if ( aValue >>= aDblValue )
900 xCell->setValue( aDblValue );
908class CellFormulaValueGetter :
public CellValueGetter
916 virtual void visitNode( sal_Int32 , sal_Int32 ,
const uno::Reference< table::XCell >& xCell )
override
919 aValue <<= xCell->getFormula();
921 if ((xCell->getType() == table::CellContentType_FORMULA)
924 uno::Reference< uno::XInterface > xIf( xCell, uno::UNO_QUERY_THROW );
925 ScCellRangesBase* pUnoRangesBase
926 =
dynamic_cast< ScCellRangesBase*
>( xIf.get() );
931 const ScRangeList& rCellRanges = pUnoRangesBase->GetRangeList();
932 if (!rCellRanges.
empty())
936 std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sVal));
938 aCompiler.SetGrammar( m_eGrammar );
940 aCompiler.CreateStringFromTokenArray(sConverted);
941 sVal =
EQUALS + sConverted;
947 processValue( aValue );
957 void processValue( sal_Int32 x, sal_Int32 y,
const uno::Any& aValue )
959 uno::Sequence< uno::Sequence< uno::Any > >& aMatrix =
const_cast<css::uno::Sequence<css::uno::Sequence<css::uno::Any>
> &>(*o3tl::doAccess<uno::Sequence<uno::Sequence<uno::Any>>>(
maValue));
960 aMatrix.getArray()[
x].getArray()[
y] = aValue;
964 Dim2ArrayValueGetter(sal_Int32 nRowCount, sal_Int32 nColCount,
ValueGetter& rValueGetter ): mValueGetter(rValueGetter)
966 uno::Sequence< uno::Sequence< uno::Any > > aMatrix;
967 aMatrix.realloc( nRowCount );
968 auto pMatrix = aMatrix.getArray();
969 for ( sal_Int32 index = 0;
index < nRowCount; ++
index )
970 pMatrix[index].realloc( nColCount );
973 void visitNode( sal_Int32 x, sal_Int32 y,
const uno::Reference< table::XCell >& xCell )
override
977 processValue( x, y, mValueGetter.
getValue() );
985constexpr OUStringLiteral
sNA =
u"#N/A";
991 uno::Sequence< uno::Any > aMatrix;
995 Dim1ArrayValueSetter(
const uno::Any& aValue,
ValueSetter& rCellValueSetter ):mCellValueSetter( rCellValueSetter )
998 nColCount = aMatrix.getLength();
1000 virtual void visitNode( sal_Int32 , sal_Int32
y,
const uno::Reference< table::XCell >& xCell )
override
1002 if (
y < nColCount )
1011 uno::Sequence< uno::Sequence< uno::Any > > aMatrix;
1013 sal_Int32 nRowCount;
1014 sal_Int32 nColCount;
1016 Dim2ArrayValueSetter(
const uno::Any& aValue,
ValueSetter& rCellValueSetter ) : mCellValueSetter( rCellValueSetter )
1019 nRowCount = aMatrix.getLength();
1020 nColCount = aMatrix[0].getLength();
1023 virtual void visitNode( sal_Int32
x, sal_Int32
y,
const uno::Reference< table::XCell >& xCell )
override
1025 if (
x < nRowCount &&
y < nColCount )
1036 virtual void process(
const uno::Reference< excel::XRange >& xRange ) = 0;
1039 ~RangeProcessor() {}
1042class RangeValueProcessor :
public RangeProcessor
1046 explicit RangeValueProcessor(
const uno::Any& rVal ):m_aVal( rVal ) {}
1047 virtual ~RangeValueProcessor() {}
1048 virtual void process(
const uno::Reference< excel::XRange >& xRange )
override
1054class RangeFormulaProcessor :
public RangeProcessor
1058 explicit RangeFormulaProcessor(
const uno::Any& rVal ):m_aVal( rVal ) {}
1059 virtual ~RangeFormulaProcessor() {}
1060 virtual void process(
const uno::Reference< excel::XRange >& xRange )
override
1062 xRange->setFormula( m_aVal );
1066class RangeCountProcessor :
public RangeProcessor
1070 RangeCountProcessor():
nCount(0){}
1071 virtual ~RangeCountProcessor() {}
1072 virtual void process(
const uno::Reference< excel::XRange >& xRange )
override
1081 uno::Reference< XCollection > m_Areas;
1083 explicit AreasVisitor( uno::Reference< XCollection > xAreas ):m_Areas(std::move( xAreas )){}
1085 void visit( RangeProcessor& processor )
1089 sal_Int32 nItems = m_Areas->getCount();
1092 uno::Reference< excel::XRange > xRange( m_Areas->Item(
uno::Any(
index),
uno::Any() ), uno::UNO_QUERY_THROW );
1093 processor.process( xRange );
1101 uno::Reference< table::XCellRange > m_xCellRange;
1105 explicit RangeHelper( uno::Reference< table::XCellRange > xCellRange ) : m_xCellRange(std::move( xCellRange ))
1107 if ( !m_xCellRange.is() )
1108 throw uno::RuntimeException();
1111 explicit RangeHelper(
const uno::Any& rCellRange )
1113 m_xCellRange.set(rCellRange, uno::UNO_QUERY_THROW);
1116 uno::Reference< sheet::XSheetCellRange > getSheetCellRange()
const
1118 return uno::Reference< sheet::XSheetCellRange >(m_xCellRange, uno::UNO_QUERY_THROW);
1121 uno::Reference< sheet::XSpreadsheet > getSpreadSheet()
const
1123 return getSheetCellRange()->getSpreadsheet();
1127 uno::Reference< table::XCellRange > getCellRangeFromSheet()
const
1129 return uno::Reference< table::XCellRange >(getSpreadSheet(), uno::UNO_QUERY_THROW );
1133 uno::Reference< sheet::XCellRangeAddressable > getCellRangeAddressable()
const
1135 return uno::Reference< sheet::XCellRangeAddressable >(m_xCellRange, ::uno::UNO_QUERY_THROW);
1140 uno::Reference< sheet::XSheetCellCursor > getSheetCellCursor()
const
1142 return uno::Reference< sheet::XSheetCellCursor >( getSpreadSheet()->createCursorByRange( getSheetCellRange() ), uno::UNO_SET_THROW );
1145 static uno::Reference< excel::XRange > createRangeFromRange(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference<uno::XComponentContext >& xContext,
1146 const uno::Reference< table::XCellRange >& xRange,
const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable )
1148 const table::CellRangeAddress aRA( xCellRangeAddressable->getRangeAddress());
1149 return uno::Reference< excel::XRange >(
new ScVbaRange( xParent, xContext,
1150 xRange->getCellRangeByPosition( aRA.StartColumn, aRA.StartRow, aRA.EndColumn, aRA.EndRow)));
1164 rResFlags = rCellRanges.
Parse( sAddress, rDoc, eConv, 0,
cDelimiter );
1176 uno::Reference< container::XNameAccess > xNameAccess( pDocSh->
GetModel()->
getPropertyValue(
"NamedRanges" ), uno::UNO_QUERY_THROW );
1179 std::vector< OUString > vNames;
1183 OUString aToken =
sName.getToken( 0,
',',
nIndex );
1184 vNames.push_back( aToken );
1187 if ( vNames.empty() )
1188 vNames.push_back(
sName );
1190 for (
const auto& rName : vNames )
1194 OUString sAddress = rName.trim();
1197 if ( !xNameAccess->hasByName( sAddress ) )
1210 if ( xNameAccess->hasByName( sAddress ) )
1212 uno::Reference< sheet::XNamedRange > xNamed( xNameAccess->getByName( sAddress ), uno::UNO_QUERY_THROW );
1213 sAddress = xNamed->getContent();
1226 for (
size_t i = 0, nRanges = aCellRanges.
size();
i < nRanges; ++
i )
1228 ScRange & rRange = aCellRanges[
i ];
1248 throw uno::RuntimeException();
1250 if ( aCellRanges.
size() == 1 )
1252 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pDocSh, aCellRanges.
front() ) );
1254 return new ScVbaRange( xFixThisParent, xContext, xRange );
1256 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj( pDocSh, aCellRanges ) );
1259 return new ScVbaRange( xFixThisParent, xContext, xRanges );
1265template<
typename RangeType >
1266table::CellRangeAddress lclGetRangeAddress(
const uno::Reference< RangeType >& rxCellRange )
1268 return uno::Reference< sheet::XCellRangeAddressable >( rxCellRange, uno::UNO_QUERY_THROW )->getRangeAddress();
1272void lclClearRange(
const uno::Reference< table::XCellRange >& rxCellRange )
1274 using namespace ::com::sun::star::sheet::CellFlags;
1276 uno::Reference< sheet::XSheetOperation > xSheetOperation( rxCellRange, uno::UNO_QUERY_THROW );
1277 xSheetOperation->clearContents( nFlags );
1281uno::Reference< sheet::XSheetCellRange > lclExpandToMerged(
const uno::Reference< table::XCellRange >& rxCellRange,
bool bRecursive )
1283 uno::Reference< sheet::XSheetCellRange > xNewCellRange( rxCellRange, uno::UNO_QUERY_THROW );
1284 uno::Reference< sheet::XSpreadsheet > xSheet( xNewCellRange->getSpreadsheet(), uno::UNO_SET_THROW );
1285 table::CellRangeAddress aNewAddress = lclGetRangeAddress( xNewCellRange );
1286 table::CellRangeAddress aOldAddress;
1290 aOldAddress = aNewAddress;
1291 uno::Reference< sheet::XSheetCellCursor > xCursor( xSheet->createCursorByRange( xNewCellRange ), uno::UNO_SET_THROW );
1294 xCursor->collapseToMergedArea();
1295 xNewCellRange.set( xCursor, uno::UNO_QUERY_THROW );
1296 aNewAddress = lclGetRangeAddress( xNewCellRange );
1299 while( bRecursive && (aOldAddress != aNewAddress) );
1300 return xNewCellRange;
1304uno::Reference< sheet::XSheetCellRangeContainer > lclExpandToMerged(
const uno::Reference< sheet::XSheetCellRangeContainer >& rxCellRanges )
1306 if( !rxCellRanges.is() )
1307 throw uno::RuntimeException(
"Missing cell ranges object" );
1308 sal_Int32
nCount = rxCellRanges->getCount();
1310 throw uno::RuntimeException(
"Missing cell ranges object" );
1315 uno::Reference< table::XCellRange > xRange( rxCellRanges->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
1316 table::CellRangeAddress aRangeAddr = lclGetRangeAddress( lclExpandToMerged( xRange,
true ) );
1325void lclExpandAndMerge(
const uno::Reference< table::XCellRange >& rxCellRange,
bool bMerge )
1327 uno::Reference< util::XMergeable > xMerge( lclExpandToMerged( rxCellRange,
true ), uno::UNO_QUERY_THROW );
1329 xMerge->merge(
false );
1334 table::CellRangeAddress aRangeAddr = lclGetRangeAddress( rxCellRange );
1335 sal_Int32 nLastColIdx = aRangeAddr.EndColumn - aRangeAddr.StartColumn;
1336 sal_Int32 nLastRowIdx = aRangeAddr.EndRow - aRangeAddr.StartRow;
1338 if( nLastColIdx > 0 )
1339 lclClearRange( rxCellRange->getCellRangeByPosition( 1, 0, nLastColIdx, 0 ) );
1341 if( nLastRowIdx > 0 )
1342 lclClearRange( rxCellRange->getCellRangeByPosition( 0, 1, nLastColIdx, nLastRowIdx ) );
1344 xMerge->merge(
true );
1348util::TriState lclGetMergedState(
const uno::Reference< table::XCellRange >& rxCellRange )
1354 table::CellRangeAddress aRangeAddr = lclGetRangeAddress( rxCellRange );
1355 uno::Reference< table::XCellRange > xTopLeft( rxCellRange->getCellRangeByPosition( 0, 0, 0, 0 ), uno::UNO_SET_THROW );
1356 uno::Reference< sheet::XSheetCellRange > xExpanded( lclExpandToMerged( xTopLeft,
false ), uno::UNO_SET_THROW );
1357 table::CellRangeAddress aExpAddr = lclGetRangeAddress( xExpanded );
1359 if( ((aExpAddr.StartColumn < aExpAddr.EndColumn) || (aExpAddr.StartRow < aExpAddr.EndRow)) &&
ScUnoConversion::Contains( aExpAddr, aRangeAddr ) )
1360 return util::TriState_YES;
1370 return bHasMerged ? util::TriState_INDETERMINATE : util::TriState_NO;
1375css::uno::Reference< excel::XRange >
1377 const uno::Reference< uno::XComponentContext >& xContext,
const OUString& sRangeName,
1380 table::CellRangeAddress refAddr;
1381 return getRangeForName( xContext, sRangeName, pDocSh, refAddr, eConv );
1387 uno::Reference< table::XCellRange > xRangeParam;
1388 switch ( aParam.getValueTypeClass() )
1390 case uno::TypeClass_STRING:
1398 if ( aCellRanges.
size() == 1 )
1400 table::CellRangeAddress aRangeAddress;
1402 return aRangeAddress;
1408 case uno::TypeClass_INTERFACE:
1410 uno::Reference< excel::XRange > xRange;
1413 xRange->getCellRange() >>= xRangeParam;
1418 throw uno::RuntimeException(
"Can't extract CellRangeAddress from type" );
1420 return lclGetRangeAddress( xRangeParam );
1424static uno::Reference< XCollection >
1425lcl_setupBorders(
const uno::Reference< excel::XRange >& xParentRange,
const uno::Reference<uno::XComponentContext>& xContext,
const uno::Reference< table::XCellRange >& xRange )
1427 uno::Reference< XHelperInterface > xParent( xParentRange, uno::UNO_QUERY_THROW );
1430 uno::Reference< XCollection > borders(
new ScVbaBorders( xParent, xContext, xRange, aPalette ) );
1435 uno::Reference< uno::XComponentContext>
const & xContext ) :
ScVbaRange_BASE(
getXSomethingFromArgs< XHelperInterface >(
args, 0 ), xContext,
getXSomethingFromArgs< beans::
XPropertySet >(
args, 1, false ),
getModelFromXIf(
getXSomethingFromArgs<
uno::
XInterface >(
args, 1 ) ), true ), mbIsRows( false ), mbIsColumns( false )
1437 mxRange.set( mxPropertySet, uno::UNO_QUERY );
1438 mxRanges.set( mxPropertySet, uno::UNO_QUERY );
1439 uno::Reference< container::XIndexAccess > xIndex;
1442 xIndex =
new SingleRangeIndexAccess( mxRange );
1444 else if ( mxRanges.is() )
1446 xIndex.set( mxRanges, uno::UNO_QUERY_THROW );
1448 m_Areas =
new ScVbaRangeAreas( mxParent, mxContext, xIndex, mbIsRows, mbIsColumns );
1451ScVbaRange::ScVbaRange(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< table::XCellRange >& xRange,
bool bIsRows,
bool bIsColumns )
1453 mbIsRows( bIsRows ),
1454 mbIsColumns( bIsColumns )
1456 if ( !xContext.is() )
1457 throw lang::IllegalArgumentException(
"context is not set ", uno::Reference< uno::XInterface >() , 1 );
1459 throw lang::IllegalArgumentException(
"range is not set ", uno::Reference< uno::XInterface >() , 1 );
1461 uno::Reference< container::XIndexAccess > xIndex(
new SingleRangeIndexAccess( xRange ) );
1462 m_Areas =
new ScVbaRangeAreas( mxParent, mxContext, xIndex, mbIsRows, mbIsColumns );
1466ScVbaRange::ScVbaRange(
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< sheet::XSheetCellRangeContainer >& xRanges,
bool bIsRows,
bool bIsColumns)
1470 uno::Reference< container::XIndexAccess > xIndex( mxRanges, uno::UNO_QUERY_THROW );
1471 m_Areas =
new ScVbaRangeAreas( xParent, mxContext, xIndex, mbIsRows, mbIsColumns );
1483 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
1494 pDocSh = range->GetDocShell();
1497 table::CellRangeAddress aRangeAddr = lclGetRangeAddress(
mxRange );
1498 sal_Int32 nRowCount = aRangeAddr.EndRow - aRangeAddr.StartRow + 1;
1499 sal_Int32 nColCount = aRangeAddr.EndColumn - aRangeAddr.StartColumn + 1;
1500 for ( sal_Int32
i=0;
i<nRowCount; ++
i )
1502 for ( sal_Int32 j=0; j<nColCount; ++j )
1504 uno::Reference< table::XCell > xCell(
mxRange->getCellByPosition( j,
i ), uno::UNO_SET_THROW );
1516 uno::Reference< table::XColumnRowRange > xColumnRowRange(
mxRange, uno::UNO_QUERY_THROW );
1523 sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount();
1524 sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
1526 Dim2ArrayValueGetter arrayGetter( nRowCount, nColCount, valueGetter );
1528 return uno::Any( script::ArrayWrapper(
false, arrayGetter.getValue() ) );
1537 if (
m_Areas->getCount() > 1 )
1539 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1540 return xRange->getValue();
1543 CellValueGetter valueGetter( eValueType );
1563 uno::TypeClass aClass = aValue.getValueTypeClass();
1564 if ( aClass == uno::TypeClass_SEQUENCE )
1572 if ( aValue.getValueTypeName().indexOf(
'[') == aValue.getValueTypeName().lastIndexOf(
'[') )
1575 Dim1ArrayValueSetter setter( aConverted, valueSetter );
1580 aConverted =
xConverter->convertTo( aValue,
cppu::UnoType<uno::Sequence< uno::Sequence< uno::Any > >>::get() );
1581 Dim2ArrayValueSetter setter( aConverted, valueSetter );
1585 catch (
const uno::Exception& )
1601 if (
m_Areas->getCount() > 1 )
1603 AreasVisitor aVisitor(
m_Areas );
1604 RangeValueProcessor valueProcessor( aValue );
1605 aVisitor.visit( valueProcessor );
1608 CellValueSetter valueSetter( aValue );
1622 using namespace ::com::sun::star::sheet::CellFlags;
1635 if (
m_Areas->getCount() > 1 )
1637 sal_Int32 nItems =
m_Areas->getCount();
1650 uno::Reference< sheet::XSheetOperation > xSheetOperation(
mxRange, uno::UNO_QUERY_THROW);
1651 xSheetOperation->clearContents( nFlags );
1664 using namespace ::com::sun::star::sheet::CellFlags;
1673 using namespace ::com::sun::star::sheet::CellFlags;
1682 if (
m_Areas->getCount() > 1 )
1684 AreasVisitor aVisitor(
m_Areas );
1685 RangeFormulaProcessor valueProcessor( rFormula );
1686 aVisitor.visit( valueProcessor );
1689 CellFormulaValueSetter formulaValueSetter( rFormula,
getScDocument(), eGram );
1690 setValue( rFormula, formulaValueSetter );
1700 if (
m_Areas->getCount() > 1 )
1702 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1703 return xRange->getFormula();
1705 CellFormulaValueGetter valueGetter(
getScDocument(), eGram );
1762 if (
m_Areas->getCount() > 1 )
1764 AreasVisitor aVisitor(
m_Areas );
1765 RangeCountProcessor valueProcessor;
1766 aVisitor.visit( valueProcessor );
1767 return valueProcessor.value();
1769 sal_Int32 rowCount = 0;
1770 sal_Int32 colCount = 0;
1771 uno::Reference< table::XColumnRowRange > xColumnRowRange(
mxRange, uno::UNO_QUERY_THROW );
1772 rowCount = xColumnRowRange->getRows()->getCount();
1773 colCount = xColumnRowRange->getColumns()->getCount();
1779 return rowCount * colCount;
1789 if (
m_Areas->getCount() > 1 )
1791 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1792 return xRange->getRow();
1794 uno::Reference< sheet::XCellAddressable > xCellAddressable(
mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
1795 return xCellAddressable->getCellAddress().Row + 1;
1805 if (
m_Areas->getCount() > 1 )
1807 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1808 return xRange->getColumn();
1810 uno::Reference< sheet::XCellAddressable > xCellAddressable(
mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
1811 return xCellAddressable->getCellAddress().Column + 1;
1817 if (
m_Areas->getCount() > 1 )
1819 sal_Int32 nItems =
m_Areas->getCount();
1827 if ( aResult != xRange->HasFormula() )
1829 aResult = xRange->HasFormula();
1830 if (
aNULL() == aResult )
1835 uno::Reference< uno::XInterface > xIf(
mxRange, uno::UNO_QUERY_THROW );
1836 ScCellRangesBase* pThisRanges =
dynamic_cast< ScCellRangesBase*
> ( xIf.get() );
1839 uno::Reference<uno::XInterface> xRanges( pThisRanges->queryFormulaCells( sheet::FormulaResult::ERROR | sheet::FormulaResult::VALUE | sheet::FormulaResult::STRING ), uno::UNO_QUERY_THROW );
1840 ScCellRangesBase* pFormulaRanges
1841 =
dynamic_cast< ScCellRangesBase*
> ( xRanges.get() );
1842 assert(pFormulaRanges);
1844 if ( pFormulaRanges->GetRangeList().empty() )
1849 if ( ( pFormulaRanges->GetRangeList().size() > 1 )
1850 || ( pFormulaRanges->GetRangeList().front().aStart != pThisRanges->GetRangeList().front().aStart )
1851 || ( pFormulaRanges->GetRangeList().front().aEnd != pThisRanges->GetRangeList().front().aEnd )
1858ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode,
double fStep,
double fEndValue )
1860 if (
m_Areas->getCount() > 1 )
1863 uno::Reference< XCollection > xCollection(
m_Areas, uno::UNO_SET_THROW );
1864 for ( sal_Int32
index = 1;
index <= xCollection->getCount(); ++
index )
1866 uno::Reference< excel::XRange > xRange( xCollection->Item(
uno::Any(
index ),
uno::Any() ), uno::UNO_QUERY_THROW );
1868 pThisRange->
fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
1874 uno::Reference< sheet::XCellSeries > xCellSeries(
mxRange, uno::UNO_QUERY_THROW );
1875 xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue );
1883 sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
1890 sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
1897 sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
1904 sheet::FillMode_SIMPLE, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF);
1914 if (
m_Areas->getCount() > 1 )
1916 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1917 return xRange->getText();
1919 uno::Reference< text::XTextRange > xTextRange(
mxRange->getCellByPosition(0,0), uno::UNO_QUERY_THROW );
1920 return xTextRange->getString();
1923uno::Reference< excel::XRange >
1926 SCROW nRowOffset = 0;
1927 SCCOL nColOffset = 0;
1928 bool bIsRowOffset = ( nRowOff >>= nRowOffset );
1929 bool bIsColumnOffset = ( nColOff >>= nColOffset );
1932 ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
1934 for (
size_t i = 0, nRanges = aCellRanges.
size();
i < nRanges; ++
i )
1936 ScRange & rRange = aCellRanges[
i ];
1937 if ( bIsColumnOffset )
1949 if ( aCellRanges.
size() > 1 )
1951 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
1956 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange));
1960uno::Reference< excel::XRange >
1967 if (
m_Areas->getCount() > 1 )
1969 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1970 return xRange->CurrentRegion();
1974 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
1975 helper.getSheetCellCursor();
1976 xSheetCellCursor->collapseToCurrentRegion();
1977 uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
1978 return RangeHelper::createRangeFromRange(
mxParent,
mxContext,
helper.getCellRangeFromSheet(), xCellRangeAddressable );
1981uno::Reference< excel::XRange >
1988 if (
m_Areas->getCount() > 1 )
1990 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
1991 return xRange->CurrentArray();
1994 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
1995 helper.getSheetCellCursor();
1996 xSheetCellCursor->collapseToCurrentArray();
1997 uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
1998 return RangeHelper::createRangeFromRange(
mxParent,
mxContext,
helper.getCellRangeFromSheet(), xCellRangeAddressable );
2008 if (
m_Areas->getCount() > 1 )
2010 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
2011 return xRange->getFormulaArray();
2019 uno::Reference< sheet::XArrayFormulaRange> xFormulaArray(
mxRange, uno::UNO_QUERY_THROW );
2020 if ( !xFormulaArray->getArrayFormula().isEmpty() )
2021 return uno::Any( xFormulaArray->getArrayFormula() );
2023 uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula(
mxRange, uno::UNO_QUERY_THROW );
2028 uno::Sequence< uno::Sequence<OUString> > aTmpSeq = xCellRangeFormula->getFormulaArray();
2029 if ( aTmpSeq.getLength() == 1 )
2032 aSingleValueOrMatrix <<= aTmpSeq[ 0 ][ 0 ];
2036 return aSingleValueOrMatrix;
2046 if (
m_Areas->getCount() > 1 )
2048 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
2049 return xRange->setFormulaArray( rFormula );
2054 uno::Reference< lang::XMultiServiceFactory > xModelFactory(
getUnoModel(), uno::UNO_QUERY_THROW );
2055 uno::Reference< sheet::XFormulaParser > xParser( xModelFactory->createInstance(
"com.sun.star.sheet.FormulaParser" ), uno::UNO_QUERY_THROW );
2056 uno::Reference< sheet::XCellRangeAddressable > xSource(
mxRange, uno::UNO_QUERY_THROW);
2058 table::CellRangeAddress aRangeAddress = xSource->getRangeAddress();
2062 table::CellAddress aAddress;
2063 aAddress.Sheet = aRangeAddress.Sheet;
2064 aAddress.Column = aRangeAddress.StartColumn;
2065 aAddress.Row = aRangeAddress.StartRow;
2068 uno::Sequence<sheet::FormulaToken> aTokens = xParser->parseFormula(
sFormula, aAddress );
2082 if (
m_Areas->getCount() > 1 )
2084 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
2090 uno::Reference< text::XTextRange > xTextRange(
mxRange, ::uno::UNO_QUERY_THROW );
2091 rString = xTextRange->getString();
2097 nIndex = rString.getLength();
2104 if (
m_Areas->getCount() > 1 )
2107 OUStringBuffer sAddress;
2108 uno::Reference< XCollection > xCollection(
m_Areas, uno::UNO_SET_THROW );
2110 for ( sal_Int32
index = 1;
index <= xCollection->getCount(); ++
index )
2112 uno::Reference< excel::XRange > xRange( xCollection->Item(
uno::Any(
index ),
uno::Any() ), uno::UNO_QUERY_THROW );
2115 sAddress.append(
",");
2119 aExternalCopy <<=
false;
2121 sAddress.append(xRange->Address( RowAbsolute, ColumnAbsolute, ReferenceStyle, aExternalCopy, RelativeTo ));
2123 return sAddress.makeStringAndClear();
2129 sal_Int32 refStyle = excel::XlReferenceStyle::xlA1;
2130 ReferenceStyle >>= refStyle;
2131 if ( refStyle == excel::XlReferenceStyle::xlR1C1 )
2139 RangeHelper thisRange(
mxRange );
2140 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
2141 ScRange aRange(
static_cast< SCCOL >( thisAddress.StartColumn ),
static_cast< SCROW >( thisAddress.StartRow ),
static_cast< SCTAB >( thisAddress.Sheet ),
static_cast< SCCOL >( thisAddress.EndColumn ),
static_cast< SCROW >( thisAddress.EndRow ),
static_cast< SCTAB >( thisAddress.Sheet ) );
2148 RowAbsolute >>= bVal;
2155 ColumnAbsolute >>= bVal;
2159 if ( External.hasValue() )
2161 bool bLocal =
false;
2162 External >>= bLocal;
2173 return aRange.
Format(rDoc, nFlags, dDetails);
2176uno::Reference < excel::XFont >
2179 uno::Reference< beans::XPropertySet > xProps(
mxRange, ::uno::UNO_QUERY );
2182 xProps.set(
mxRange, ::uno::UNO_QUERY );
2184 xProps.set(
mxRanges, ::uno::UNO_QUERY );
2192 catch( uno::Exception& )
2198uno::Reference< excel::XRange >
2205 if (
m_Areas->getCount() > 1 )
2207 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
2208 return xRange->Cells( nRowIndex, nColumnIndex );
2217uno::Reference< excel::XRange >
2219 const uno::Reference< ov::XHelperInterface >& xParent,
2220 const uno::Reference< uno::XComponentContext >& xContext,
2221 const uno::Reference< css::table::XCellRange >& xRange,
2224 sal_Int32 nRow = 0, nColumn = 0;
2226 bool bIsIndex = nRowIndex.
hasValue();
2227 bool bIsColumnIndex = nColumnIndex.
hasValue();
2233 if ( nRowIndex.
hasValue() && !( nRowIndex >>= nRow ) )
2240 bIsIndex = ( aConverted >>= nRow );
2242 catch( uno::Exception& ) {}
2245 if ( bIsColumnIndex )
2249 if ( nColumnIndex >>= sCol )
2255 throw uno::RuntimeException();
2260 if ( !( nColumnIndex >>= nColumn ) )
2267 bIsColumnIndex = ( aConverted >>= nColumn );
2269 catch( uno::Exception& ) {}
2273 RangeHelper thisRange( xRange );
2274 table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
2275 uno::Reference< table::XCellRange > xSheetRange = thisRange.getCellRangeFromSheet();
2276 if( !bIsIndex && !bIsColumnIndex )
2278 return uno::Reference< excel::XRange >(
new ScVbaRange( xParent, xContext, xRange ) );
2280 sal_Int32
nIndex = --nRow;
2281 if( bIsIndex && !bIsColumnIndex )
2283 uno::Reference< table::XColumnRowRange > xColumnRowRange(xRange, ::uno::UNO_QUERY_THROW);
2284 sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount();
2289 nRow =
nIndex / nColCount;
2290 nColumn =
nIndex % nColCount;
2294 nRow = nRow + thisRangeAddress.StartRow;
2295 nColumn = nColumn + thisRangeAddress.StartColumn;
2296 return new ScVbaRange( xParent, xContext, xSheetRange->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) );
2303 if ( !pUnoRangesBase )
2304 throw uno::RuntimeException(
"Failed to access underlying uno range object" );
2305 ScDocShell* pShell = pUnoRangesBase->GetDocShell();
2309 uno::Reference< frame::XModel >
xModel( pShell->
GetModel(), uno::UNO_SET_THROW );
2310 uno::Reference< view::XSelectionSupplier > xSelection(
xModel->getCurrentController(), uno::UNO_QUERY_THROW );
2319 uno::Reference< frame::XController >
xController(
xModel->getCurrentController(), uno::UNO_SET_THROW );
2320 uno::Reference< frame::XFrame >
xFrame(
xController->getFrame(), uno::UNO_SET_THROW );
2321 uno::Reference< awt::XWindow > xWin(
xFrame->getContainerWindow(), uno::UNO_SET_THROW );
2324 catch( uno::Exception& )
2329static bool cellInRange(
const table::CellRangeAddress& rAddr, sal_Int32 nCol, sal_Int32 nRow )
2331 return nCol >= rAddr.StartColumn && nCol <= rAddr.EndColumn &&
2332 nRow >= rAddr.StartRow && nRow <= rAddr.EndRow;
2335static void setCursor(
SCCOL nCol,
SCROW nRow,
const uno::Reference< frame::XModel >& xModel,
bool bInSel =
true )
2351 uno::Reference< table::XCellRange > xCellRange;
2354 uno::Reference< container::XIndexAccess > xIndex(
mxRanges, uno::UNO_QUERY_THROW );
2355 xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
2358 xCellRange.set(
mxRange, uno::UNO_SET_THROW );
2360 RangeHelper thisRange( xCellRange );
2361 uno::Reference< sheet::XCellRangeAddressable > xThisRangeAddress = thisRange.getCellRangeAddressable();
2362 table::CellRangeAddress thisRangeAddress = xThisRangeAddress->getRangeAddress();
2363 uno::Reference< frame::XModel >
xModel;
2370 throw uno::RuntimeException();
2373 uno::Reference< sheet::XCellRangeAddressable > xRange(
xModel->getCurrentSelection(), ::uno::UNO_QUERY);
2375 uno::Reference< sheet::XSheetCellRanges > xRanges(
xModel->getCurrentSelection(), ::uno::UNO_QUERY);
2379 const uno::Sequence< table::CellRangeAddress > nAddrs = xRanges->getRangeAddresses();
2380 for (
const auto& rAddr : nAddrs )
2382 if (
cellInRange( rAddr, thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) )
2384 setCursor(
static_cast< SCCOL >( thisRangeAddress.StartColumn ),
static_cast< SCROW >( thisRangeAddress.StartRow ),
xModel );
2391 if ( xRange.is() &&
cellInRange( xRange->getRangeAddress(), thisRangeAddress.StartColumn, thisRangeAddress.StartRow ) )
2392 setCursor(
static_cast< SCCOL >( thisRangeAddress.StartColumn ),
static_cast< SCROW >( thisRangeAddress.StartRow ),
xModel );
2400 setCursor(
static_cast< SCCOL >( thisRangeAddress.StartColumn ),
static_cast< SCROW >( thisRangeAddress.StartRow ),
xModel,
false );
2412 if (!rCellRanges.
empty())
2413 return rCellRanges.
front();
2415 table::CellRangeAddress aRA( lclGetRangeAddress(
mxRange ));
2416 return ScRange( aRA.StartColumn, aRA.StartRow, aRA.Sheet, aRA.EndColumn, aRA.EndRow, aRA.Sheet);
2419uno::Reference< excel::XRange >
2434 else if (
aIndex >>= sAddress )
2446 throw uno::RuntimeException(
"Illegal param" );
2449 throw uno::RuntimeException(
"Internal failure, illegal param" );
2451 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
2455 if (
m_Areas->getCount() > 1 )
2460uno::Reference< excel::XRange >
2476 else if (
aIndex >>= sAddress )
2488 throw uno::RuntimeException(
"Illegal param" );
2491 throw uno::RuntimeException(
"Internal failure, illegal param" );
2494 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange ) );
2508 ::std::vector< table::CellRangeAddress > aList;
2511 uno::Reference< sheet::XCellRangeAddressable > xRangeAddr(
mxRanges->getByIndex(
nIndex ), uno::UNO_QUERY_THROW );
2512 table::CellRangeAddress aAddress = xRangeAddr->getRangeAddress();
2513 if (std::any_of(aList.begin(), aList.end(),
2514 [&aAddress](
const table::CellRangeAddress& rAddress)
2515 { return ScUnoConversion::Intersects( rAddress, aAddress ); }))
2517 aList.push_back( aAddress );
2523 uno::Reference< table::XCellRange > xRange(
mxRanges->getByIndex(
nIndex ), uno::UNO_QUERY_THROW );
2524 lclExpandAndMerge( xRange, bMerge );
2530 lclExpandAndMerge(
mxRange, bMerge );
2541 uno::Reference< table::XCellRange > xRange(
mxRanges->getByIndex(
nIndex ), uno::UNO_QUERY_THROW );
2542 util::TriState eMerged = lclGetMergedState( xRange );
2546 if( eMerged != util::TriState_NO )
2554 switch( lclGetMergedState(
mxRange ) )
2556 case util::TriState_YES:
return uno::Any(
true );
2557 case util::TriState_NO:
return uno::Any(
false );
2558 default:
return aNULL();
2568 if (
m_Areas->getCount() > 1 )
2569 throw uno::RuntimeException(
"That command cannot be used on multiple selections" );
2570 uno::Reference< excel::XRange > xRange(
Destination, uno::UNO_QUERY_THROW );
2571 uno::Any aRange = xRange->getCellRange();
2572 uno::Reference< table::XCellRange > xCellRange;
2573 aRange >>= xCellRange;
2574 uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW);
2575 uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
2576 uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW );
2577 uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW);
2578 uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition(
2579 xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY_THROW );
2580 uno::Reference< sheet::XCellRangeAddressable > xSource(
mxRange, uno::UNO_QUERY);
2581 xMover->copyRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
2583 pRange->fireChangeEvent();
2595 if (
m_Areas->getCount() > 1 )
2596 throw uno::RuntimeException(
"That command cannot be used on multiple selections" );
2599 uno::Reference< excel::XRange > xRange(
Destination, uno::UNO_QUERY_THROW );
2600 uno::Reference< table::XCellRange > xCellRange( xRange->getCellRange(), uno::UNO_QUERY_THROW );
2601 uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW );
2602 uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
2603 uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW );
2604 uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW);
2605 uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition(
2606 xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY);
2607 uno::Reference< sheet::XCellRangeAddressable > xSource(
mxRange, uno::UNO_QUERY);
2608 xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() );
2622 aFormat >>= sFormat;
2623 if (
m_Areas->getCount() > 1 )
2625 sal_Int32 nItems =
m_Areas->getCount();
2629 xRange->setNumberFormat( aFormat );
2633 NumFormatHelper numFormat(
mxRange );
2634 numFormat.setNumberFormat( sFormat );
2641 if (
m_Areas->getCount() > 1 )
2643 sal_Int32 nItems =
m_Areas->getCount();
2651 if ( aResult != xRange->getNumberFormat() )
2653 aResult = xRange->getNumberFormat();
2654 if (
aNULL() == aResult )
2659 NumFormatHelper numFormat(
mxRange );
2660 OUString sFormat = numFormat.getNumberFormatString();
2661 if ( !sFormat.isEmpty() )
2666uno::Reference< excel::XRange >
2670 bool bIsRowChanged = (
RowSize >>= nRowSize ), bIsColumnChanged = ( ColumnSize >>= nColumnSize );
2671 uno::Reference< table::XColumnRowRange > xColumnRowRange(
mxRange, ::uno::UNO_QUERY_THROW);
2672 uno::Reference< sheet::XSheetCellRange > xSheetRange(
mxRange, ::uno::UNO_QUERY_THROW);
2673 uno::Reference< sheet::XSheetCellCursor > xCursor( xSheetRange->getSpreadsheet()->createCursorByRange(xSheetRange), ::uno::UNO_SET_THROW );
2675 if( !bIsRowChanged )
2676 nRowSize = xColumnRowRange->getRows()->getCount();
2677 if( !bIsColumnChanged )
2678 nColumnSize = xColumnRowRange->getColumns()->getCount();
2680 xCursor->collapseToSize( nColumnSize, nRowSize );
2681 uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xCursor, ::uno::UNO_QUERY_THROW );
2682 uno::Reference< table::XCellRange > xRange( xSheetRange->getSpreadsheet(), ::uno::UNO_QUERY_THROW );
2683 const table::CellRangeAddress aRA( xCellRangeAddressable->getRangeAddress());
2684 return new ScVbaRange(
mxParent,
mxContext, xRange->getCellRangeByPosition( aRA.StartColumn, aRA.StartRow, aRA.EndColumn, aRA.EndRow));
2690 if (
m_Areas->getCount() > 1 )
2692 sal_Int32 nItems =
m_Areas->getCount();
2696 xRange->setWrapText( aIsWrapped );
2701 uno::Reference< beans::XPropertySet > xProps(
mxRange, ::uno::UNO_QUERY_THROW );
2703 xProps->setPropertyValue(
"IsTextWrapped",
uno::Any( bIsWrapped ) );
2709 if (
m_Areas->getCount() > 1 )
2711 sal_Int32 nItems =
m_Areas->getCount();
2717 if ( aResult != xRange->getWrapText() )
2719 aResult = xRange->getWrapText();
2727 if ( eState == SfxItemState::DONTCARE )
2730 uno::Reference< beans::XPropertySet > xProps(
mxRange, ::uno::UNO_QUERY_THROW );
2731 uno::Any aValue = xProps->getPropertyValue(
"IsTextWrapped" );
2737 uno::Reference< beans::XPropertySet > xProps(
mxRange, uno::UNO_QUERY_THROW );
2740uno::Reference< excel::XRange >
2743 return Range( Cell1, Cell2,
false );
2745uno::Reference< excel::XRange >
2749 uno::Reference< table::XCellRange > xCellRange =
mxRange;
2751 if (
m_Areas->getCount() > 1 )
2753 uno::Reference< container::XIndexAccess > xIndex(
mxRanges, uno::UNO_QUERY_THROW );
2754 xCellRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
2759 RangeHelper thisRange( xCellRange );
2760 uno::Reference< table::XCellRange > xRanges = thisRange.getCellRangeFromSheet();
2761 uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRanges, uno::UNO_QUERY_THROW );
2763 uno::Reference< table::XCellRange > xReferrer =
2765 xAddressable->getRangeAddress().EndColumn,
2766 xAddressable->getRangeAddress().EndRow );
2768 xAddressable.set( xReferrer, uno::UNO_QUERY_THROW );
2771 throw uno::RuntimeException(
"Invalid Argument" );
2773 table::CellRangeAddress parentRangeAddress = xAddressable->getRangeAddress();
2781 RangeHelper referRange( xReferrer );
2782 table::CellRangeAddress referAddress = referRange.getCellRangeAddressable()->getRangeAddress();
2788 table::CellRangeAddress cell1, cell2;
2796 table::CellRangeAddress resultAddress;
2797 resultAddress.StartColumn = ( cell1.StartColumn < cell2.StartColumn ) ? cell1.StartColumn : cell2.StartColumn;
2798 resultAddress.StartRow = ( cell1.StartRow < cell2.StartRow ) ? cell1.StartRow : cell2.StartRow;
2799 resultAddress.EndColumn = std::max( cell1.EndColumn, cell2.EndColumn );
2800 resultAddress.EndRow = std::max( cell1.EndRow, cell2.EndRow );
2801 if ( bForceUseInpuRangeTab )
2806 if ( cell1.Sheet != cell2.Sheet )
2807 throw uno::RuntimeException();
2808 parentRangeAddress.Sheet = cell1.Sheet;
2815 if ( parentRangeAddress.Sheet != cell1.Sheet
2816 || parentRangeAddress.Sheet != cell2.Sheet
2818 throw uno::RuntimeException();
2832 if ( nStartX <= nEndX && nEndX <= parentAddress.
aEnd.
Col() &&
2833 nStartY <= nEndY && nEndY <= parentAddress.
aEnd.
Row() )
2836 static_cast<SCCOL>(nEndX),
static_cast<SCROW>(nEndY), parentAddress.
aEnd.
Tab() );
2860 return pVbaRange->getCellRange();
2861 throw uno::RuntimeException();
2868 case excel::XlPasteType::xlPasteComments:
2870 case excel::XlPasteType::xlPasteFormats:
2872 case excel::XlPasteType::xlPasteFormulas:
2874 case excel::XlPasteType::xlPasteFormulasAndNumberFormats :
2875 case excel::XlPasteType::xlPasteValues:
2877 case excel::XlPasteType::xlPasteValuesAndNumberFormats:
2879 case excel::XlPasteType::xlPasteColumnWidths:
2880 case excel::XlPasteType::xlPasteValidation:
2882 case excel::XlPasteType::xlPasteAll:
2883 case excel::XlPasteType::xlPasteAllExceptBorders:
2896 case excel::XlPasteSpecialOperation::xlPasteSpecialOperationAdd:
2898 case excel::XlPasteSpecialOperation::xlPasteSpecialOperationSubtract:
2900 case excel::XlPasteSpecialOperation::xlPasteSpecialOperationMultiply:
2902 case excel::XlPasteSpecialOperation::xlPasteSpecialOperationDivide:
2905 case excel::XlPasteSpecialOperation::xlPasteSpecialOperationNone:
2910 return nFormulaBits;
2915 if (
m_Areas->getCount() > 1 )
2916 throw uno::RuntimeException(
"That command cannot be used on multiple selections" );
2920 throw uno::RuntimeException(
"That command cannot be used with no ScDocShell" );
2922 uno::Reference< frame::XModel >
xModel(pShell->
GetModel(), uno::UNO_SET_THROW);
2923 uno::Reference< view::XSelectionSupplier > xSelection(
xModel->getCurrentController(), uno::UNO_QUERY_THROW );
2927 sal_Int32 nPaste = excel::XlPasteType::xlPasteAll;
2928 sal_Int32 nOperation = excel::XlPasteSpecialOperation::xlPasteSpecialOperationNone;
2929 bool bTranspose =
false;
2930 bool bSkipBlanks =
false;
2932 if (
Paste.hasValue() )
2937 SkipBlanks >>= bSkipBlanks;
2939 Transpose >>= bTranspose;
2947uno::Reference< excel::XRange >
2952 ScRangeList aCellRanges = pUnoRangesBase->GetRangeList();
2955 for (
size_t i = 0, nRanges = aCellRanges.
size();
i < nRanges; ++
i )
2957 ScRange & rRange = aCellRanges[
i ];
2969 if ( aCellRanges.
size() > 1 )
2971 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj( pUnoRangesBase->GetDocShell(), aCellRanges ) );
2976 uno::Reference< table::XCellRange > xRange(
new ScCellRangeObj( pUnoRangesBase->GetDocShell(), aRange));
2980uno::Reference< excel::XRange > SAL_CALL
2986uno::Reference< excel::XRange > SAL_CALL
2992uno::Reference< excel::XComment > SAL_CALL
2997 throw uno::RuntimeException();
3001 if(
Text.hasValue() && !(
Text >>= aNoteText) )
3002 throw uno::RuntimeException();
3003 if( aNoteText.isEmpty() )
3007 table::CellRangeAddress aRangePos = lclGetRangeAddress(
mxRange );
3008 table::CellAddress aNotePos( aRangePos.Sheet, aRangePos.StartColumn, aRangePos.StartRow );
3009 uno::Reference< sheet::XSheetCellRange > xCellRange(
mxRange, uno::UNO_QUERY_THROW );
3010 uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xCellRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
3011 uno::Reference< sheet::XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), uno::UNO_SET_THROW );
3012 xAnnos->insertNew( aNotePos, aNoteText );
3016uno::Reference< excel::XComment > SAL_CALL
3029static uno::Reference< beans::XPropertySet >
3032 uno::Reference< table::XColumnRowRange > xColRow( xCellRange, uno::UNO_QUERY_THROW );
3033 uno::Reference< beans::XPropertySet > xProps;
3035 xProps.set( xColRow->getRows(), uno::UNO_QUERY_THROW );
3037 xProps.set( xColRow->getColumns(), uno::UNO_QUERY_THROW );
3046 if (
m_Areas->getCount() > 1 )
3048 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any(sal_Int32(1)),
uno::Any() ), uno::UNO_QUERY_THROW );
3049 return xRange->getHidden();
3051 bool bIsVisible =
false;
3055 if ( !( xProps->getPropertyValue(
ISVISIBLE ) >>= bIsVisible ) )
3056 throw uno::RuntimeException(
"Failed to get IsVisible property" );
3058 catch(
const uno::Exception& e )
3061 throw css::lang::WrappedTargetRuntimeException( e.Message,
3070 if (
m_Areas->getCount() > 1 )
3072 sal_Int32 nItems =
m_Areas->getCount();
3076 xRange->setHidden( _hidden );
3087 catch(
const uno::Exception& e )
3090 throw css::lang::WrappedTargetRuntimeException( e.Message,
3098 if (
m_Areas->getCount() > 1 )
3103 xRange->Replace( What,
Replacement, LookAt, SearchOrder,
MatchCase, MatchByte, SearchFormat, ReplaceFormat );
3109 if ( What.isEmpty() )
3110 throw uno::RuntimeException(
"Range::Replace, missing params" );
3117 uno::Reference< util::XReplaceable > xReplace(
mxRange, uno::UNO_QUERY );
3118 if ( xReplace.is() )
3120 uno::Reference< util::XReplaceDescriptor > xDescriptor =
3121 xReplace->createReplaceDescriptor();
3123 xDescriptor->setSearchString( sWhat);
3129 sal_Int16 nLook = ::comphelper::getINT16( LookAt );
3130 bool bSearchWords =
false;
3131 if ( nLook == excel::XlLookAt::xlPart )
3132 bSearchWords =
false;
3133 else if ( nLook == excel::XlLookAt::xlWhole )
3134 bSearchWords =
true;
3136 throw uno::RuntimeException(
"Range::Replace, illegal value for LookAt" );
3145 sal_Int16 nSearchOrder = ::comphelper::getINT16( SearchOrder );
3146 bool bSearchByRow =
false;
3147 if ( nSearchOrder == excel::XlSearchOrder::xlByColumns )
3148 bSearchByRow =
false;
3149 else if ( nSearchOrder == excel::XlSearchOrder::xlByRows )
3150 bSearchByRow =
true;
3152 throw uno::RuntimeException(
"Range::Replace, illegal value for SearchOrder" );
3159 bool bMatchCase =
false;
3170 uno::Reference< container::XIndexAccess > xIndexAccess = xReplace->findAll( xDescriptor );
3171 xReplace->replaceAll( xDescriptor );
3172 if ( xIndexAccess.is() && xIndexAccess->getCount() > 0 )
3174 for ( sal_Int32
i = 0;
i < xIndexAccess->getCount(); ++
i )
3176 uno::Reference< table::XCellRange > xCellRange( xIndexAccess->getByIndex(
i ), uno::UNO_QUERY );
3177 if ( xCellRange.is() )
3180 uno::Reference< container::XEnumerationAccess > xEnumAccess( xRange, uno::UNO_QUERY_THROW );
3181 uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
3182 while ( xEnum->hasMoreElements() )
3184 uno::Reference< excel::XRange > xNextRange( xEnum->nextElement(), uno::UNO_QUERY_THROW );
3196uno::Reference< excel::XRange > SAL_CALL
3201 sal_Int32 nWhat = 0;
3205 if( What >>= sWhat )
3207 else if( What >>= nWhat )
3209 sWhat = OUString::number( nWhat );
3211 else if( What >>= fWhat )
3213 sWhat = OUString::number( fWhat );
3216 throw uno::RuntimeException(
"Range::Find, missing search-for-what param" );
3223 uno::Reference< util::XSearchable > xSearch(
mxRange, uno::UNO_QUERY );
3226 uno::Reference< util::XSearchDescriptor > xDescriptor = xSearch->createSearchDescriptor();
3227 xDescriptor->setSearchString( sSearch );
3230 uno::Reference< excel::XRange > xAfterRange;
3231 uno::Reference< table::XCellRange > xStartCell;
3232 if( After >>= xAfterRange )
3235 if( xAfterRange->getCount() > 1 )
3236 throw uno::RuntimeException(
"After must be a single cell." );
3237 uno::Reference< excel::XRange > xCell(
Cells(
uno::Any( xAfterRange->getRow() ),
uno::Any( xAfterRange->getColumn() ) ), uno::UNO_SET_THROW );
3238 xStartCell.set( xAfterRange->getCellRange(), uno::UNO_QUERY_THROW );
3244 sal_Int32 nLookIn = 0;
3245 if( LookIn >>= nLookIn )
3250 case excel::XlFindLookIn::xlComments :
3251 nSearchType = SvxSearchCellType::NOTE;
3253 case excel::XlFindLookIn::xlFormulas :
3254 nSearchType = SvxSearchCellType::FORMULA;
3256 case excel::XlFindLookIn::xlValues :
3257 nSearchType = SvxSearchCellType::VALUE;
3260 throw uno::RuntimeException(
"Range::Find, illegal value for LookIn." );
3263 xDescriptor->setPropertyValue(
"SearchType",
uno::Any(
static_cast<sal_uInt16
>(nSearchType) ) );
3270 sal_Int16 nLookAt = ::comphelper::getINT16( LookAt );
3271 bool bSearchWords =
false;
3272 if ( nLookAt == excel::XlLookAt::xlPart )
3273 bSearchWords =
false;
3274 else if ( nLookAt == excel::XlLookAt::xlWhole )
3275 bSearchWords =
true;
3277 throw uno::RuntimeException(
"Range::Find, illegal value for LookAt" );
3285 sal_Int16 nSearchOrder = ::comphelper::getINT16( SearchOrder );
3286 bool bSearchByRow =
false;
3287 if ( nSearchOrder == excel::XlSearchOrder::xlByColumns )
3288 bSearchByRow =
false;
3289 else if ( nSearchOrder == excel::XlSearchOrder::xlByRows )
3290 bSearchByRow =
true;
3292 throw uno::RuntimeException(
"Range::Find, illegal value for SearchOrder" );
3301 sal_Int32 nSearchDirection = 0;
3302 if( SearchDirection >>= nSearchDirection )
3304 bool bSearchBackwards =
false;
3305 if ( nSearchDirection == excel::XlSearchDirection::xlNext )
3306 bSearchBackwards =
false;
3307 else if( nSearchDirection == excel::XlSearchDirection::xlPrevious )
3308 bSearchBackwards =
true;
3310 throw uno::RuntimeException(
"Range::Find, illegal value for SearchDirection" );
3312 xDescriptor->setPropertyValue(
"SearchBackwards",
uno::Any( bSearchBackwards ) );
3317 bool bMatchCase =
false;
3322 throw uno::RuntimeException(
"Range::Find illegal value for MatchCase" );
3332 uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xDescriptor) : xSearch->findFirst( xDescriptor );
3333 uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY );
3336 if ( !xCellRange.is() && xStartCell.is() )
3338 xInterface = xSearch->findFirst( xDescriptor );
3339 xCellRange.set( xInterface, uno::UNO_QUERY );
3341 if ( xCellRange.is() )
3344 if( xResultRange.is() )
3346 return xResultRange;
3352 return uno::Reference< excel::XRange >();
3357 uno::Reference< excel::XRange > xKeyRange;
3360 xKeyRange.set(
Key, uno::UNO_QUERY_THROW );
3365 OUString sRangeName = ::comphelper::getString(
Key );
3366 table::CellRangeAddress aRefAddr;
3368 throw uno::RuntimeException(
"Range::Sort no docshell to calculate key param" );
3369 xKeyRange =
getRangeForName( xContext, sRangeName, pDocSh, aRefAddr );
3372 throw uno::RuntimeException(
"Range::Sort illegal type value for key param" );
3373 uno::Reference< table::XCellRange > xKey;
3374 xKey.set( xKeyRange->getCellRange(), uno::UNO_QUERY_THROW );
3381const OUString& sPropName )
3383 const beans::PropertyValue* pProp = std::find_if(
props.begin(),
props.end(),
3384 [&sPropName](
const beans::PropertyValue& rProp) { return rProp.Name == sPropName; });
3386 if ( pProp ==
props.end() )
3387 throw uno::RuntimeException(
"Range::Sort unknown sort property" );
3388 return static_cast<sal_Int32
>(std::distance(
props.begin(), pProp));
3394 const uno::Reference< table::XCellRange >& xColRowKey, sal_Int16 nOrder,
3395 table::TableSortField& aTableField,
bool bIsSortColumn,
bool bMatchCase )
3397 RangeHelper parentRange( xParentRange );
3398 RangeHelper colRowRange( xColRowKey );
3400 table::CellRangeAddress parentRangeAddress = parentRange.getCellRangeAddressable()->getRangeAddress();
3402 table::CellRangeAddress colRowKeyAddress = colRowRange.getCellRangeAddressable()->getRangeAddress();
3407 ( bIsSortColumn || colRowKeyAddress.StartColumn < parentRangeAddress.StartColumn ||
3408 colRowKeyAddress.StartColumn > parentRangeAddress.EndColumn )
3410 ( !bIsSortColumn || colRowKeyAddress.StartRow < parentRangeAddress.StartRow ||
3411 colRowKeyAddress.StartRow > parentRangeAddress.EndRow )
3413 throw uno::RuntimeException(
"Illegal Key param" );
3416 if ( bIsSortColumn )
3417 aTableField.Field = colRowKeyAddress.StartRow - parentRangeAddress.StartRow;
3419 aTableField.Field = colRowKeyAddress.StartColumn - parentRangeAddress.StartColumn;
3420 aTableField.IsCaseSensitive = bMatchCase;
3422 if ( nOrder == excel::XlSortOrder::xlAscending )
3423 aTableField.IsAscending =
true;
3425 aTableField.IsAscending =
false;
3431ScVbaRange::Sort(
const uno::Any& Key1,
const uno::Any& Order1,
const uno::Any& Key2,
const uno::Any& ,
const uno::Any& Order2,
const uno::Any& Key3,
const uno::Any& Order3,
const uno::Any& Header,
const uno::Any& OrderCustom,
const uno::Any& MatchCase,
const uno::Any&
Orientation,
const uno::Any& SortMethod,
const uno::Any& DataOption1,
const uno::Any& DataOption2,
const uno::Any& DataOption3 )
3434 if (
m_Areas->getCount() > 1 )
3435 throw uno::RuntimeException(
"That command cannot be used on multiple selections" );
3437 sal_Int16 nDataOption1 = excel::XlSortDataOption::xlSortNormal;
3438 sal_Int16 nDataOption2 = excel::XlSortDataOption::xlSortNormal;
3439 sal_Int16 nDataOption3 = excel::XlSortDataOption::xlSortNormal;
3443 uno::Reference< table::XCellRange > xRangeCurrent;
3452 xRangeCurrent = pRange->
mxRange;
3455 if (!xRangeCurrent.is())
3457 RangeHelper thisRange( xRangeCurrent );
3458 table::CellRangeAddress thisRangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
3461 SCTAB nTab = thisRangeAddress.Sheet;
3465 DataOption1 >>= nDataOption1;
3467 DataOption2 >>= nDataOption2;
3469 DataOption3 >>= nDataOption3;
3473 uno::Reference< table::XColumnRowRange > xColumnRowRange(xRangeCurrent, uno::UNO_QUERY_THROW );
3477 sal_Int16 nOrder1 = aSortParam.
maKeyState[0].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
3478 sal_Int16 nOrder2 = aSortParam.
maKeyState[1].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
3479 sal_Int16 nOrder3 = aSortParam.
maKeyState[2].bAscending ? excel::XlSortOrder::xlAscending : excel::XlSortOrder::xlDescending;
3482 sal_Int16 nSortMethod = excel::XlSortMethod::xlPinYin;
3486 sal_Int16 nOrientation = aSortParam.
bByRow ? excel::XlSortOrientation::xlSortColumns : excel::XlSortOrientation::xlSortRows;
3493 nOrientation = ::comphelper::getINT16(
Orientation );
3495 if ( nOrientation == excel::XlSortOrientation::xlSortRows )
3496 aSortParam.
bByRow =
false;
3498 aSortParam.
bByRow =
true;
3502 bool bIsSortColumns=
false;
3504 if ( nOrientation == excel::XlSortOrientation::xlSortRows )
3505 bIsSortColumns =
true;
3507 bool bContainsHeader =
false;
3511 nHeader = ::comphelper::getINT16(
Header );
3515 if ( nHeader == excel::XlYesNoGuess::xlGuess )
3517 bool bHasColHeader = rDoc.
HasColHeader(
static_cast< SCCOL >( thisRangeAddress.StartColumn ),
static_cast< SCROW >( thisRangeAddress.StartRow ),
static_cast< SCCOL >( thisRangeAddress.EndColumn ),
static_cast< SCROW >( thisRangeAddress.EndRow ),
static_cast< SCTAB >( thisRangeAddress.Sheet ));
3518 bool bHasRowHeader = rDoc.
HasRowHeader(
static_cast< SCCOL >( thisRangeAddress.StartColumn ),
static_cast< SCROW >( thisRangeAddress.StartRow ),
static_cast< SCCOL >( thisRangeAddress.EndColumn ),
static_cast< SCROW >( thisRangeAddress.EndRow ),
static_cast< SCTAB >( thisRangeAddress.Sheet ) );
3519 if ( bHasColHeader || bHasRowHeader )
3520 nHeader = excel::XlYesNoGuess::xlYes;
3522 nHeader = excel::XlYesNoGuess::xlNo;
3526 if ( nHeader == excel::XlYesNoGuess::xlYes )
3527 bContainsHeader =
true;
3531 nSortMethod = ::comphelper::getINT16( SortMethod );
3536 OrderCustom >>= nCustom;
3549 nOrder1 = ::comphelper::getINT16(Order1);
3550 if ( nOrder1 == excel::XlSortOrder::xlAscending )
3558 nOrder2 = ::comphelper::getINT16(Order2);
3559 if ( nOrder2 == excel::XlSortOrder::xlAscending )
3566 nOrder3 = ::comphelper::getINT16(Order3);
3567 if ( nOrder3 == excel::XlSortOrder::xlAscending )
3573 uno::Reference< table::XCellRange > xKey1;
3574 uno::Reference< table::XCellRange > xKey2;
3575 uno::Reference< table::XCellRange > xKey3;
3579 throw uno::RuntimeException(
"Range::Sort needs a key1 param" );
3586 uno::Reference< util::XSortable > xSort( xRangeCurrent, uno::UNO_QUERY_THROW );
3587 uno::Sequence< beans::PropertyValue > sortDescriptor = xSort->createSortDescriptor();
3588 auto psortDescriptor = sortDescriptor.getArray();
3591 uno::Sequence< table::TableSortField > sTableFields(1);
3592 sal_Int32 nTableIndex = 0;
3593 updateTableSortField( xRangeCurrent, xKey1, nOrder1, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
3597 sTableFields.realloc( sTableFields.getLength() + 1 );
3598 updateTableSortField( xRangeCurrent, xKey2, nOrder2, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
3602 sTableFields.realloc( sTableFields.getLength() + 1 );
3603 updateTableSortField( xRangeCurrent, xKey3, nOrder3, sTableFields.getArray()[ nTableIndex++ ], bIsSortColumns, bMatchCase );
3605 psortDescriptor[ nTableSortFieldIndex ].Value <<= sTableFields;
3608 psortDescriptor[
nIndex ].Value <<= bIsSortColumns;
3611 psortDescriptor[
nIndex ].Value <<= bContainsHeader;
3614 xSort->sort( sortDescriptor );
3621uno::Reference< excel::XRange > SAL_CALL
3624 if (
m_Areas->getCount() > 1 )
3626 uno::Reference< excel::XRange > xRange(
getArea( 0 ), uno::UNO_SET_THROW );
3640 uno::Reference< excel::XApplication > xApplication(
Application(), uno::UNO_QUERY_THROW );
3641 uno::Reference< excel::XWorksheet > sActiveSheet = xApplication->getActiveSheet();
3642 OUString sActiveCell = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
3656 aArgs.
Put( sfxAsync, sfxAsync.
Which() );
3659 sal_uInt16 nSID = 0;
3663 case excel::XlDirection::xlDown:
3664 nSID = SID_CURSORBLKDOWN;
3666 case excel::XlDirection::xlUp:
3667 nSID = SID_CURSORBLKUP;
3669 case excel::XlDirection::xlToLeft:
3670 nSID = SID_CURSORBLKLEFT;
3672 case excel::XlDirection::xlToRight:
3673 nSID = SID_CURSORBLKRIGHT;
3676 throw uno::RuntimeException(
": Invalid ColumnIndex" );
3680 pDispatcher->
Execute( nSID, SfxCallMode::SYNCHRON, aArgs );
3685 OUString sMoved = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft );
3688 uno::Reference< excel::XRange > resultCell;
3689 resultCell.set( xApplication->getActiveSheet()->Range(
uno::Any( sMoved ), aVoid ), uno::UNO_SET_THROW );
3692 uno::Reference< excel::XRange > xOldActiveCell( sActiveSheet->Range(
uno::Any( sActiveCell ), aVoid ), uno::UNO_SET_THROW );
3693 xOldActiveCell->Select();
3703 uno::Reference< sheet::XCellRangeAddressable > xAddressable(
mxRange, uno::UNO_QUERY );
3704 if ( xAddressable.is() )
3706 table::CellRangeAddress aRangeAddr = xAddressable->getRangeAddress();
3707 return ( aRangeAddr.EndColumn == aRangeAddr.StartColumn && aRangeAddr.EndRow == aRangeAddr.StartRow );
3712uno::Reference< excel::XCharacters > SAL_CALL
3716 throw uno::RuntimeException(
"Can't create Characters property for multicell range " );
3717 uno::Reference< text::XSimpleText > xSimple(
mxRange->getCellByPosition(0,0) , uno::UNO_QUERY_THROW );
3727 if (
m_Areas->getCount() > 1 )
3729 sal_Int32 nItems =
m_Areas->getCount();
3733 xRange->Delete( Shift );
3737 sheet::CellDeleteMode
mode = sheet::CellDeleteMode_NONE ;
3738 RangeHelper thisRange(
mxRange );
3739 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
3742 sal_Int32 nShift = 0;
3746 case excel::XlDeleteShiftDirection::xlShiftUp:
3747 mode = sheet::CellDeleteMode_UP;
3749 case excel::XlDeleteShiftDirection::xlShiftToLeft:
3750 mode = sheet::CellDeleteMode_LEFT;
3753 throw uno::RuntimeException(
"Illegal parameter " );
3759 bool bFullRow = ( thisAddress.StartColumn == 0 && thisAddress.EndColumn == rDoc.
MaxCol() );
3760 sal_Int32 nCols = thisAddress.EndColumn - thisAddress.StartColumn;
3761 sal_Int32 nRows = thisAddress.EndRow - thisAddress.StartRow;
3762 if (
mbIsRows || bFullRow || ( nCols >= nRows ) )
3763 mode = sheet::CellDeleteMode_UP;
3765 mode = sheet::CellDeleteMode_LEFT;
3767 uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
3768 xCellRangeMove->removeRange( thisAddress,
mode );
3776 uno::Reference< table::XColumnRowRange > xColumnRowRange(
mxRange, uno::UNO_QUERY );
3777 if ( xColumnRowRange.is() )
3778 if ( xColumnRowRange->getRows()->getCount() ||
3779 xColumnRowRange->getColumns()->getCount() )
3785uno::Reference< container::XEnumeration > SAL_CALL
3790 uno::Reference< table::XColumnRowRange > xColumnRowRange(
mxRange, uno::UNO_QUERY );
3791 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
3792 sal_Int32 nElems = 0;
3794 nElems = xColumnRowRange->getColumns()->getCount();
3796 nElems = xColumnRowRange->getRows()->getCount();
3797 return new ColumnsRowEnumeration( xRange, nElems );
3814 sal_uInt16 nWidth = rDoc.
GetOriginalWidth(
static_cast< SCCOL >( rAddress.StartColumn ),
static_cast< SCTAB >( rAddress.Sheet ) );
3824 sal_uInt16 nWidth = rDoc.
GetOriginalHeight( rAddress.StartRow, rAddress.Sheet );
3838 pRefDevice->
SetFont(aDefFont);
3846 sal_Int32 nLen =
m_Areas->getCount();
3849 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
3850 return xRange->getColumnWidth();
3853 double nColWidth = 0;
3858 RangeHelper thisRange(
mxRange );
3859 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
3860 sal_Int32 nStartCol = thisAddress.StartColumn;
3861 sal_Int32 nEndCol = thisAddress.EndColumn;
3862 sal_uInt16 nColTwips = 0;
3863 for( sal_Int32 nCol = nStartCol ; nCol <= nEndCol; ++nCol )
3865 thisAddress.StartColumn = nCol;
3867 if ( nCol == nStartCol )
3868 nColTwips = nCurTwips;
3869 if ( nColTwips != nCurTwips )
3873 if ( nColWidth != 0.0 )
3874 nColWidth = ( nColWidth / defaultCharWidth ) -
fExtraWidth;
3883 sal_Int32 nLen =
m_Areas->getCount();
3889 xRange->setColumnWidth( _columnwidth );
3893 double nColWidth = 0;
3894 _columnwidth >>= nColWidth;
3900 if ( nColWidth != 0.0 )
3902 RangeHelper thisRange(
mxRange );
3903 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
3906 std::vector<sc::ColRowSpan> aColArr(1,
sc::ColRowSpan(thisAddress.StartColumn, thisAddress.EndColumn));
3909 true, aColArr, thisAddress.Sheet,
SC_SIZE_DIRECT, nTwips,
true,
true);
3915 if (
m_Areas->getCount() > 1 )
3917 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
3918 return xRange->getWidth();
3920 uno::Reference< table::XColumnRowRange > xColRowRange(
mxRange, uno::UNO_QUERY_THROW );
3921 uno::Reference< container::XIndexAccess > xIndexAccess( xColRowRange->getColumns(), uno::UNO_QUERY_THROW );
3922 sal_Int32 nElems = xIndexAccess->getCount();
3926 uno::Reference< sheet::XCellRangeAddressable > xAddressable( xIndexAccess->getByIndex(
index ), uno::UNO_QUERY_THROW );
3927 double nTmpWidth =
getCalcColWidth( xAddressable->getRangeAddress() );
3928 nWidth += nTmpWidth;
3941uno::Reference< excel::XRange >
3945 throw uno::RuntimeException(
"No areas available" );
3960 const css::uno::Any& ColorIndex,
const css::uno::Any&
Color )
3969 case excel::XlBordersIndex::xlEdgeLeft:
3970 case excel::XlBordersIndex::xlEdgeTop:
3971 case excel::XlBordersIndex::xlEdgeBottom:
3972 case excel::XlBordersIndex::xlEdgeRight:
3979 if( Weight.hasValue() )
3981 xBorder->setWeight( Weight );
3983 if( ColorIndex.hasValue() )
3985 xBorder->setColorIndex( ColorIndex );
3987 if(
Color.hasValue() )
3989 xBorder->setColor(
Color );
3993 case excel::XlBordersIndex::xlInsideVertical:
3994 case excel::XlBordersIndex::xlInsideHorizontal:
3995 case excel::XlBordersIndex::xlDiagonalDown:
3996 case excel::XlBordersIndex::xlDiagonalUp:
4008 sal_Int32 nLen =
m_Areas->getCount();
4011 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
4012 return xRange->getRowHeight();
4017 RangeHelper thisRange(
mxRange );
4018 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4020 sal_Int32 nStartRow = thisAddress.StartRow;
4021 sal_Int32 nEndRow = thisAddress.EndRow;
4022 sal_uInt16 nRowTwips = 0;
4030 for ( sal_Int32 nRow = nStartRow ; nRow <= nEndRow; ++nRow )
4032 thisAddress.StartRow = nRow;
4034 if ( nRow == nStartRow )
4035 nRowTwips = nCurTwips;
4036 if ( nRowTwips != nCurTwips )
4047 sal_Int32 nLen =
m_Areas->getCount();
4053 xRange->setRowHeight( _rowheight );
4058 _rowheight >>= nHeight;
4060 RangeHelper thisRange(
mxRange );
4061 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4065 std::vector<sc::ColRowSpan> aRowArr(1,
sc::ColRowSpan(thisAddress.StartRow, thisAddress.EndRow));
4073 sal_Int32 nPageBreak = excel::XlPageBreak::xlPageBreakNone;
4077 RangeHelper thisRange(
mxRange );
4078 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4079 bool bColumn =
false;
4081 if (thisAddress.StartRow==0)
4091 nBreak = rDoc.
HasRowBreak(thisAddress.StartRow, thisAddress.Sheet);
4093 nBreak = rDoc.
HasColBreak(thisAddress.StartColumn, thisAddress.Sheet);
4096 nPageBreak = excel::XlPageBreak::xlPageBreakAutomatic;
4099 nPageBreak = excel::XlPageBreak::xlPageBreakManual;
4109 sal_Int32 nPageBreak = 0;
4110 _pagebreak >>= nPageBreak;
4116 RangeHelper thisRange(
mxRange );
4117 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4118 if ((thisAddress.StartColumn==0) && (thisAddress.StartRow==0))
4120 bool bColumn =
false;
4122 if (thisAddress.StartRow==0)
4125 ScAddress aAddr(
static_cast<SCCOL>(thisAddress.StartColumn), thisAddress.StartRow, thisAddress.Sheet );
4130 if ( nPageBreak == excel::XlPageBreak::xlPageBreakManual )
4132 else if ( nPageBreak == excel::XlPageBreak::xlPageBreakNone )
4140 if (
m_Areas->getCount() > 1 )
4142 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32(1) ),
uno::Any() ), uno::UNO_QUERY_THROW );
4143 return xRange->getHeight();
4146 uno::Reference< table::XColumnRowRange > xColRowRange(
mxRange, uno::UNO_QUERY_THROW );
4147 uno::Reference< container::XIndexAccess > xIndexAccess( xColRowRange->getRows(), uno::UNO_QUERY_THROW );
4148 sal_Int32 nElems = xIndexAccess->getCount();
4152 uno::Reference< sheet::XCellRangeAddressable > xAddressable( xIndexAccess->getByIndex(
index ), uno::UNO_QUERY_THROW );
4162 uno::Reference< beans::XPropertySet > xProps;
4164 xProps.set(
mxRange, uno::UNO_QUERY_THROW );
4166 xProps.set(
mxRanges, uno::UNO_QUERY_THROW );
4167 xProps->getPropertyValue(
"Position" ) >>= aPoint;
4174 if (
m_Areas->getCount() > 1 )
4175 return getArea( 0 )->getLeft();
4184 if (
m_Areas->getCount() > 1 )
4185 return getArea( 0 )->getTop();
4190static uno::Reference< sheet::XCellRangeReferrer >
getNamedRange(
const uno::Reference< uno::XInterface >& xIf,
const uno::Reference< table::XCellRange >& thisRange )
4192 uno::Reference< beans::XPropertySet > xProps( xIf, uno::UNO_QUERY_THROW );
4193 uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue(
"NamedRanges" ), uno::UNO_QUERY_THROW );
4195 const uno::Sequence< OUString > sNames = xNameAccess->getElementNames();
4197 uno::Reference< sheet::XCellRangeReferrer > xNamedRange;
4198 for (
const auto& rName : sNames )
4200 uno::Reference< sheet::XCellRangeReferrer > xName( xNameAccess->getByName( rName ), uno::UNO_QUERY );
4203 if ( thisRange == xName->getReferredCells() )
4205 xNamedRange = xName;
4213uno::Reference< excel::XName >
4216 uno::Reference< beans::XPropertySet > xProps(
getUnoModel(), uno::UNO_QUERY );
4217 uno::Reference< table::XCellRange > thisRange(
getCellRange(), uno::UNO_QUERY_THROW );
4219 uno::Reference< sheet::XCellRangeReferrer > xNamedRange =
getNamedRange( xProps, thisRange );
4221 if ( !xNamedRange.is() )
4225 RangeHelper aRange( thisRange );
4226 uno::Reference< sheet::XSpreadsheet > xSheet = aRange.getSpreadSheet();
4227 xProps.set( xSheet, uno::UNO_QUERY );
4231 if ( xProps.is() && xNamedRange.is() )
4233 uno::Reference< sheet::XNamedRanges > xNamedRanges( xProps, uno::UNO_QUERY_THROW );
4234 uno::Reference< sheet::XNamedRange > xName( xNamedRange, uno::UNO_QUERY_THROW );
4237 return uno::Reference< excel::XName >();
4240uno::Reference< excel::XWorksheet >
4245 uno::Reference< excel::XWorksheet > xSheet(
getParent(), uno::UNO_QUERY );
4248 uno::Reference< table::XCellRange > xRange =
mxRange;
4252 uno::Reference< container::XIndexAccess > xIndex(
mxRanges, uno::UNO_QUERY_THROW );
4253 xRange.set( xIndex->getByIndex( 0 ), uno::UNO_QUERY_THROW );
4256 RangeHelper rHelper(xRange);
4265uno::Reference< excel::XRange >
4283 OUString sRangeName;
4284 Cell1 >>= sRangeName;
4285 if ( Cell1.hasValue() && !Cell2.hasValue() && !sRangeName.isEmpty() )
4287 uno::Reference< beans::XPropertySet > xPropSet(
getCurrentExcelDoc(xContext), uno::UNO_QUERY_THROW );
4289 uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue(
"NamedRanges" ), uno::UNO_QUERY_THROW );
4290 uno::Reference< sheet::XCellRangeReferrer > xReferrer;
4293 xReferrer.set ( xNamed->getByName( sRangeName ), uno::UNO_QUERY );
4295 catch( uno::Exception& )
4299 if ( xReferrer.is() )
4301 uno::Reference< table::XCellRange > xRange = xReferrer->getReferredCells();
4310 uno::Reference<table::XCellRange> xSheetRange;
4314 uno::Reference<sheet::XSpreadsheetView> xView(
4317 xSheetRange.set(xView->getActiveSheet(), uno::UNO_QUERY_THROW);
4319 catch (
const uno::Exception&)
4321 return uno::Reference<excel::XRange>();
4325 return pRange->Range( Cell1, Cell2,
true );
4348 pViewData = pViewSh ? &pViewSh->
GetViewData() :
nullptr;
4382 sCriteria1 = sCriteria1.trim();
4391 if ( sCriteria1.startsWith(
EQUALS ) )
4394 rFilterField.Operator = sheet::FilterOperator2::EMPTY;
4397 rFilterField.Operator = sheet::FilterOperator2::EQUAL;
4398 sCriteria1 = sCriteria1.copy( strlen(
EQUALS) );
4401 if ( xDescProps.is() )
4402 xDescProps->setPropertyValue(
"UseRegularExpressions",
uno::Any(
true ) );
4406 else if ( sCriteria1.startsWith(
NOTEQUALS ) )
4409 rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY;
4412 rFilterField.Operator = sheet::FilterOperator2::NOT_EQUAL;
4413 sCriteria1 = sCriteria1.copy( strlen(
NOTEQUALS) );
4416 if ( xDescProps.is() )
4417 xDescProps->setPropertyValue(
"UseRegularExpressions",
uno::Any(
true ) );
4425 rFilterField.Operator = sheet::FilterOperator2::GREATER_EQUAL;
4429 sCriteria1 = sCriteria1.copy( strlen(
GREATERTHAN) );
4430 rFilterField.Operator = sheet::FilterOperator2::GREATER;
4434 else if ( sCriteria1.startsWith(
LESSTHAN ) )
4439 rFilterField.Operator = sheet::FilterOperator2::LESS_EQUAL;
4443 sCriteria1 = sCriteria1.copy( strlen(
LESSTHAN) );
4444 rFilterField.Operator = sheet::FilterOperator2::LESS;
4449 rFilterField.Operator = sheet::FilterOperator2::EQUAL;
4453 sal_Int32 nParseEnd = 0;
4454 rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
4456 if ( nParseEnd == sCriteria1.getLength() && eStatus == rtl_math_ConversionStatus_Ok )
4458 rFilterField.IsNumeric =
true;
4459 rFilterField.NumericValue = fValue;
4463 eStatus = rtl_math_ConversionStatus_Ok;
4464 fValue = ::rtl::math::stringToDouble( sCriteria1,
'.', 0, &eStatus, &nParseEnd );
4465 if ( nParseEnd == sCriteria1.getLength() && eStatus == rtl_math_ConversionStatus_Ok )
4467 rFilterField.IsNumeric =
true;
4468 rFilterField.NumericValue = fValue;
4472 rFilterField.StringValue = sCriteria1;
4479 RangeHelper thisRange(
mxRange );
4480 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4481 sal_Int16 nSheet = thisAddress.Sheet;
4483 bool bHasAuto =
false;
4485 if ( xDataBaseRange.is() )
4490 if (
m_Areas->getCount() > 1 )
4493 table::CellRangeAddress autoFiltAddress;
4497 uno::Reference< excel::XRange > xCurrent(
CurrentRegion() );
4498 if ( xCurrent.is() )
4504 throw uno::RuntimeException(
"Can't create AutoFilter" );
4505 RangeHelper currentRegion( pRange->
mxRange );
4506 autoFiltAddress = currentRegion.getCellRangeAddressable()->getRangeAddress();
4512 RangeHelper multiCellRange(
mxRange );
4513 autoFiltAddress = multiCellRange.getCellRangeAddressable()->getRangeAddress();
4518 SCCOL nStartCol = autoFiltAddress.StartColumn;
4519 SCROW nStartRow = autoFiltAddress.StartRow;
4520 SCCOL nEndCol = autoFiltAddress.EndColumn;
4521 SCROW nEndRow = autoFiltAddress.EndRow;
4522 pDocument->
GetDataArea( autoFiltAddress.Sheet, nStartCol, nStartRow, nEndCol, nEndRow,
true,
true );
4523 autoFiltAddress.StartColumn = nStartCol;
4524 autoFiltAddress.StartRow = nStartRow;
4525 autoFiltAddress.EndColumn = nEndCol;
4526 autoFiltAddress.EndRow = nEndRow;
4531 if ( xDBRanges.is() )
4533 if ( !xDBRanges->hasByTable( nSheet ) )
4534 xDBRanges->setByTable( autoFiltAddress );
4535 xDataBaseRange.set( xDBRanges->getByTable(nSheet ), uno::UNO_QUERY_THROW );
4537 if ( !xDataBaseRange.is() )
4538 throw uno::RuntimeException(
"Failed to find the autofilter placeholder range" );
4540 uno::Reference< beans::XPropertySet > xDBRangeProps( xDataBaseRange, uno::UNO_QUERY_THROW );
4542 xDBRangeProps->setPropertyValue(
"AutoFilter",
uno::Any(
true) );
4544 uno::Reference< beans::XPropertySet > xFiltProps( xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY_THROW );
4545 xFiltProps->setPropertyValue(
"ContainsHeader",
uno::Any(
true ) );
4548 sal_Int32 nField = 0;
4549 sal_Int32 nOperator = excel::XlAutoFilterOperator::xlAnd;
4551 sheet::FilterConnection nConn = sheet::FilterConnection_AND;
4552 double nCriteria1 = 0;
4554 bool bHasCritValue = Criteria1.
hasValue();
4555 bool bCritHasNumericValue =
false;
4556 if ( bHasCritValue )
4557 bCritHasNumericValue = ( Criteria1 >>= nCriteria1 );
4560 throw uno::RuntimeException();
4562 if ( !(
Field >>= nField ) )
4569 catch( uno::Exception& )
4576 if (
Field >>= nField )
4578 uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc(
4579 xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
4582 OUString sCriteria1;
4583 bool bAcceptCriteria2 =
true;
4585 uno::Sequence< sheet::TableFilterField2 > sTabFilts;
4586 sheet::TableFilterField2* pTabFilts =
nullptr;
4587 uno::Reference< beans::XPropertySet > xDescProps( xDesc, uno::UNO_QUERY_THROW );
4590 sTabFilts.realloc( 1 );
4591 pTabFilts = sTabFilts.getArray();
4592 pTabFilts[0].Operator = sheet::FilterOperator2::EQUAL;
4593 if ( !bCritHasNumericValue )
4595 Criteria1 >>= sCriteria1;
4596 if ( sCriteria1.isEmpty() )
4598 uno::Sequence< OUString > aCriteria1;
4599 Criteria1 >>= aCriteria1;
4600 sal_uInt16
nLength = aCriteria1.getLength();
4604 bAcceptCriteria2 =
false;
4606 auto pCriteria1 = aCriteria1.getArray();
4608 pTabFilts = sTabFilts.getArray();
4612 pTabFilts[
i].Connection = sheet::FilterConnection_OR;
4613 pTabFilts[
i].Field = (nField - 1);
4621 pTabFilts[0].IsNumeric = bCritHasNumericValue;
4622 if ( bHasCritValue && !sCriteria1.isEmpty() )
4630 pTabFilts[0].IsNumeric =
true;
4631 pTabFilts[0].NumericValue = nCriteria1;
4642 if ( !bCritHasNumericValue && sCriteria1.isEmpty() && ( nOperator != excel::XlAutoFilterOperator::xlOr ) && ( nOperator != excel::XlAutoFilterOperator::xlAnd ) )
4644 pTabFilts[0].IsNumeric =
true;
4645 pTabFilts[0].NumericValue = 10;
4648 switch ( nOperator )
4650 case excel::XlAutoFilterOperator::xlBottom10Items:
4651 pTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_VALUES;
4653 case excel::XlAutoFilterOperator::xlBottom10Percent:
4654 pTabFilts[0].Operator = sheet::FilterOperator2::BOTTOM_PERCENT;
4656 case excel::XlAutoFilterOperator::xlTop10Items:
4657 pTabFilts[0].Operator = sheet::FilterOperator2::TOP_VALUES;
4659 case excel::XlAutoFilterOperator::xlTop10Percent:
4660 pTabFilts[0].Operator = sheet::FilterOperator2::TOP_PERCENT;
4662 case excel::XlAutoFilterOperator::xlOr:
4663 nConn = sheet::FilterConnection_OR;
4665 case excel::XlAutoFilterOperator::xlAnd:
4666 nConn = sheet::FilterConnection_AND;
4669 throw uno::RuntimeException(
"UnknownOption" );
4674 if ( !bAll && bAcceptCriteria2 )
4676 pTabFilts[0].Connection = sheet::FilterConnection_AND;
4677 pTabFilts[0].Field = (nField - 1);
4679 uno::Sequence< OUString > aCriteria2;
4682 sTabFilts.realloc(2);
4683 pTabFilts = sTabFilts.getArray();
4684 pTabFilts[1].Field = sTabFilts[0].Field;
4685 pTabFilts[1].Connection = nConn;
4687 OUString sCriteria2;
4688 if ( Criteria2 >>= sCriteria2 )
4690 if ( !sCriteria2.isEmpty() )
4692 uno::Reference< beans::XPropertySet > xProps;
4694 pTabFilts[1].IsNumeric =
false;
4697 else if ( Criteria2 >>= aCriteria2 )
4699 sal_uInt16
nLength = aCriteria2.getLength();
4708 Criteria2 >>= pTabFilts[1].NumericValue;
4709 pTabFilts[1].IsNumeric =
true;
4710 pTabFilts[1].Operator = sheet::FilterOperator2::EQUAL;
4715 xDesc->setFilterFields2( sTabFilts );
4718 xDataBaseRange->refresh();
4730 uno::Reference< beans::XPropertySet > xDBRangeProps( xDataBaseRange, uno::UNO_QUERY_THROW );
4742 uno::Reference< sheet::XSheetFilterDescriptor2 > xSheetFilterDescriptor(
4743 xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY );
4744 if( xSheetFilterDescriptor.is() )
4745 xSheetFilterDescriptor->setFilterFields2( uno::Sequence< sheet::TableFilterField2 >() );
4747 xDBRangeProps->setPropertyValue(
"AutoFilter",
uno::Any(!bHasAuto) );
4761 sheet::CellInsertMode
mode = sheet::CellInsertMode_NONE;
4764 sal_Int32 nShift = 0;
4768 case excel::XlInsertShiftDirection::xlShiftToRight:
4769 mode = sheet::CellInsertMode_RIGHT;
4771 case excel::XlInsertShiftDirection::xlShiftDown:
4772 mode = sheet::CellInsertMode_DOWN;
4775 throw uno::RuntimeException(
"Illegal parameter " );
4781 mode = sheet::CellInsertMode_DOWN;
4783 mode = sheet::CellInsertMode_RIGHT;
4785 RangeHelper thisRange(
mxRange );
4786 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4787 uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
4788 xCellRangeMove->insertCells( thisAddress,
mode );
4797 ScRange aRange(
static_cast< SCCOL >( thisAddress.StartColumn ),
static_cast< SCROW >( thisAddress.StartRow ),
static_cast< SCTAB >( thisAddress.Sheet ),
static_cast< SCCOL >( thisAddress.EndColumn ),
static_cast< SCROW >( thisAddress.EndRow ),
static_cast< SCTAB >( thisAddress.Sheet ) );
4807 sal_Int32 nLen =
m_Areas->getCount();
4826 RangeHelper thisRange(
mxRange );
4827 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
4829 std::vector<sc::ColRowSpan> aColArr(1,
sc::ColRowSpan(thisAddress.StartColumn,thisAddress.EndColumn));
4830 bool bDirection =
true;
4834 aColArr[0].mnStart = thisAddress.StartRow;
4835 aColArr[0].mnEnd = thisAddress.EndRow;
4837 pDocShell->GetDocFunc().SetWidthOrHeight(
4838 bDirection, aColArr, thisAddress.Sheet,
SC_SIZE_OPTIMAL, 0,
true,
true);
4849 uno::Reference< excel::XWorksheet > xWorksheet(
getParent(), uno::UNO_QUERY_THROW );
4850 uno::Reference< excel::XHyperlinks > xSheetHlinks( xWorksheet->Hyperlinks(
uno::Any() ), uno::UNO_QUERY_THROW );
4852 if( !xScSheetHlinks.is() )
4853 throw uno::RuntimeException(
"Cannot obtain hyperlinks implementation object" );
4859 return uno::Any( uno::Reference< excel::XHyperlinks >( xHlinks ) );
4862css::uno::Reference< excel::XValidation > SAL_CALL
4873sal_Unicode lclGetPrefixChar(
const uno::Reference< table::XCell >& rxCell )
4883 return (rxCell->getType() == table::CellContentType_TEXT) ?
'\'' : 0;
4887sal_Unicode lclGetPrefixChar(
const uno::Reference< table::XCellRange >& rxRange )
4896 table::CellRangeAddress aRangeAddr = lclGetRangeAddress( rxRange );
4897 sal_Int32 nEndCol = aRangeAddr.EndColumn - aRangeAddr.StartColumn;
4898 sal_Int32 nEndRow = aRangeAddr.EndRow - aRangeAddr.StartRow;
4899 for( sal_Int32 nRow = 0; nRow <= nEndRow; ++nRow )
4901 for( sal_Int32 nCol = 0; nCol <= nEndCol; ++nCol )
4903 uno::Reference< table::XCell > xCell( rxRange->getCellByPosition( nCol, nRow ), uno::UNO_SET_THROW );
4904 sal_Unicode cNewPrefix = lclGetPrefixChar( xCell );
4905 if( (cNewPrefix == 0) || ((cCurrPrefix != 0) && (cNewPrefix != cCurrPrefix)) )
4907 cCurrPrefix = cNewPrefix;
4915sal_Unicode lclGetPrefixChar(
const uno::Reference< sheet::XSheetCellRangeContainer >& rxRanges )
4918 uno::Reference< container::XEnumerationAccess > xRangesEA( rxRanges, uno::UNO_QUERY_THROW );
4919 uno::Reference< container::XEnumeration > xRangesEnum( xRangesEA->createEnumeration(), uno::UNO_SET_THROW );
4920 while( xRangesEnum->hasMoreElements() )
4922 uno::Reference< table::XCellRange > xRange( xRangesEnum->nextElement(), uno::UNO_QUERY_THROW );
4923 sal_Unicode cNewPrefix = lclGetPrefixChar( xRange );
4924 if( (cNewPrefix == 0) || ((cCurrPrefix != 0) && (cNewPrefix != cCurrPrefix)) )
4926 cCurrPrefix = cNewPrefix;
4934 return uno::Any( (cPrefixChar == 0) ? OUString() : OUString( cPrefixChar ) );
4958 return lclGetPrefixVariant( lclGetPrefixChar(
mxRange ) );
4960 return lclGetPrefixVariant( lclGetPrefixChar(
mxRanges ) );
4961 throw uno::RuntimeException(
"Unexpected empty Range object" );
4970 throw uno::RuntimeException(
"Can not get Range.ShowDetail attribute " );
4973 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
helper.getSheetCellCursor();
4974 xSheetCellCursor->collapseToCurrentRegion();
4975 uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
4976 table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress();
4979 table::CellRangeAddress thisAddress =
helper.getCellRangeAddressable()->getRangeAddress();
4980 if( (thisAddress.StartRow != thisAddress.EndRow || thisAddress.EndRow != aOutlineAddress.EndRow ) &&
4981 (thisAddress.StartColumn != thisAddress.EndColumn || thisAddress.EndColumn != aOutlineAddress.EndColumn ))
4983 throw uno::RuntimeException(
"Can not set Range.ShowDetail attribute" );
4986 bool bColumn = thisAddress.StartRow != thisAddress.EndRow;
4994 const bool bShowDetail = !pEntry->
IsHidden();
5007 throw uno::RuntimeException(
"Can not set Range.ShowDetail attribute" );
5012 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor =
helper.getSheetCellCursor();
5013 xSheetCellCursor->collapseToCurrentRegion();
5014 uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
5015 table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress();
5018 table::CellRangeAddress thisAddress =
helper.getCellRangeAddressable()->getRangeAddress();
5019 if( (thisAddress.StartRow != thisAddress.EndRow || thisAddress.EndRow != aOutlineAddress.EndRow ) &&
5020 (thisAddress.StartColumn != thisAddress.EndColumn || thisAddress.EndColumn != aOutlineAddress.EndColumn ))
5022 throw uno::RuntimeException(
"Can not set Range.ShowDetail attribute" );
5027 uno::Reference< sheet::XSheetOutline > xSheetOutline(
helper.getSpreadSheet(), uno::UNO_QUERY_THROW );
5029 xSheetOutline->showDetail( aOutlineAddress );
5031 xSheetOutline->hideDetail( aOutlineAddress );
5035uno::Reference< excel::XRange > SAL_CALL
5038 uno::Reference< sheet::XSheetCellRange > xMergeShellCellRange(
mxRange->getCellRangeByPosition(0,0,0,0), uno::UNO_QUERY_THROW);
5039 uno::Reference< sheet::XSheetCellCursor > xMergeSheetCursor(xMergeShellCellRange->getSpreadsheet()->createCursorByRange( xMergeShellCellRange ), uno::UNO_SET_THROW);
5040 if( xMergeSheetCursor.is() )
5042 xMergeSheetCursor->collapseToMergedArea();
5043 uno::Reference<sheet::XCellRangeAddressable> xMergeCellAddress(xMergeSheetCursor, uno::UNO_QUERY_THROW);
5044 table::CellRangeAddress aCellAddress = xMergeCellAddress->getRangeAddress();
5045 if( aCellAddress.StartColumn ==0 && aCellAddress.EndColumn==0 &&
5046 aCellAddress.StartRow==0 && aCellAddress.EndRow==0)
5052 ScRange refRange(
static_cast< SCCOL >( aCellAddress.StartColumn ),
static_cast< SCROW >( aCellAddress.StartRow ),
static_cast< SCTAB >( aCellAddress.Sheet ),
5053 static_cast< SCCOL >( aCellAddress.EndColumn ),
static_cast< SCROW >( aCellAddress.EndRow ),
static_cast< SCTAB >( aCellAddress.Sheet ) );
5066 sal_Int32 nItems =
m_Areas->getCount();
5067 uno::Sequence< table::CellRangeAddress > printAreas( nItems );
5068 auto printAreasRange = asNonConstRange(printAreas);
5069 uno::Reference< sheet::XPrintAreas > xPrintAreas;
5074 RangeHelper thisRange( xRange->getCellRange() );
5075 table::CellRangeAddress rangeAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
5081 xPrintAreas.set( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
5083 printAreasRange[
index - 1 ] = rangeAddress;
5085 if ( pShell && xPrintAreas.is() )
5087 xPrintAreas->setPrintAreas( printAreas );
5096 uno::Reference< excel::XRange > xDest(
Destination, uno::UNO_SET_THROW );
5098 RangeHelper destRangeHelper( pRange->
mxRange );
5099 table::CellRangeAddress destAddress = destRangeHelper.getCellRangeAddressable()->getRangeAddress();
5101 RangeHelper thisRange(
mxRange );
5102 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
5113 ScRange aSourceRange( destRange );
5119 if ( sourceRange != destRange )
5139 else if ( aSourceRange.
aEnd == destRange.
aEnd )
5162 if (
Type.hasValue() )
5164 sal_Int16 nFillType = excel::XlAutoFillType::xlFillDefault;
5166 switch ( nFillType )
5168 case excel::XlAutoFillType::xlFillCopy:
5172 case excel::XlAutoFillType::xlFillDays:
5175 case excel::XlAutoFillType::xlFillMonths:
5179 case excel::XlAutoFillType::xlFillWeekdays:
5183 case excel::XlAutoFillType::xlFillYears:
5187 case excel::XlAutoFillType::xlGrowthTrend:
5190 case excel::XlAutoFillType::xlFillFormats:
5191 throw uno::RuntimeException(
"xlFillFormat not supported for AutoFill" );
5192 case excel::XlAutoFillType::xlFillValues:
5193 case excel::XlAutoFillType::xlFillSeries:
5194 case excel::XlAutoFillType::xlLinearTrend:
5197 case excel::XlAutoFillType::xlFillDefault:
5213 if ( pDocShell && pRange )
5215 RangeHelper thisRange(
mxRange );
5216 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
5217 RangeHelper changingCellRange( pRange->
mxRange );
5218 table::CellRangeAddress changingCellAddr = changingCellRange.getCellRangeAddressable()->getRangeAddress();
5220 table::CellAddress thisCell( thisAddress.Sheet, thisAddress.StartColumn, thisAddress.StartRow );
5221 table::CellAddress changingCell( changingCellAddr.Sheet, changingCellAddr.StartColumn, changingCellAddr.StartRow );
5222 sheet::GoalResult res = pDocShell->
GetModel()->
seekGoal( thisCell, changingCell, sGoal );
5223 ChangingCell->setValue(
uno::Any( res.Result ) );
5228 if ( ( res.Divergence != 0.0 ) && ( res.Result == 0.0 ) )
5242uno::Reference< excel::XRange > SAL_CALL
5249 uno::Reference< excel::XRange > xRange;
5253 xRange =
Rows( row );
5256 return Cells( row, column );
5264 if (
m_Areas->getCount() > 1 )
5271 RangeHelper thisRange(
mxRange );
5272 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
5276 uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
5277 xSheetOutline->autoOutline( thisAddress );
5286 if (
m_Areas->getCount() > 1 )
5288 sal_Int32 nItems =
m_Areas->getCount();
5292 xRange->ClearOutline();
5296 RangeHelper thisRange(
mxRange );
5297 uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
5298 xSheetOutline->clearOutline();
5304 if (
m_Areas->getCount() > 1 )
5306 table::TableOrientation nOrient = table::TableOrientation_ROWS;
5308 nOrient = table::TableOrientation_COLUMNS;
5309 RangeHelper thisRange(
mxRange );
5310 table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
5311 uno::Reference< sheet::XSheetOutline > xSheetOutline( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
5313 xSheetOutline->ungroup( thisAddress, nOrient );
5315 xSheetOutline->group( thisAddress, nOrient );
5332 uno::Reference< util::XMergeable > xMergeable( xCellRange, uno::UNO_QUERY_THROW );
5333 xMergeable->merge(_bMerge);
5338 if (
m_Areas->getCount() > 1 )
5340 sal_Int32 nItems =
m_Areas->getCount();
5344 xRange->Merge(Across);
5348 bool bAcross =
false;
5354 uno::Reference< excel::XRange > oRangeRowsImpl =
Rows(
uno::Any() );
5356 for (sal_Int32
i=1;
i <= oRangeRowsImpl->getCount();
i++)
5366 if (
m_Areas->getCount() > 1 )
5368 sal_Int32 nItems =
m_Areas->getCount();
5382 if (
m_Areas->getCount() > 1 )
5384 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32( 1 ) ),
uno::Any() ), uno::UNO_QUERY_THROW );
5385 return xRange->getStyle();
5387 uno::Reference< beans::XPropertySet > xProps(
mxRange, uno::UNO_QUERY_THROW );
5388 OUString sStyleName;
5389 xProps->getPropertyValue(
CELLSTYLE ) >>= sStyleName;
5398 if (
m_Areas->getCount() > 1 )
5400 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32( 1 ) ),
uno::Any() ), uno::UNO_QUERY_THROW );
5401 xRange->setStyle( _style );
5404 uno::Reference< beans::XPropertySet > xProps(
mxRange, uno::UNO_QUERY_THROW );
5405 uno::Reference< excel::XStyle > xStyle;
5411uno::Reference< excel::XRange >
5416 RangeHelper thisRange(
mxRange );
5419 markedRange. SetMarkArea( refRange );
5420 short nMove = bIsPrevious ? -1 : 1;
5427 rDoc.
GetNextPos( nNewX,nNewY, nTab, nMove,0,
true,
true, markedRange );
5440uno::Reference< excel::XRange > SAL_CALL
5443 if (
m_Areas->getCount() > 1 )
5445 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32( 1 ) ),
uno::Any() ) , uno::UNO_QUERY_THROW );
5446 return xRange->Next();
5451uno::Reference< excel::XRange > SAL_CALL
5454 if (
m_Areas->getCount() > 1 )
5456 uno::Reference< excel::XRange > xRange(
m_Areas->Item(
uno::Any( sal_Int32( 1 ) ),
uno::Any() ), uno::UNO_QUERY_THROW );
5457 return xRange->Previous();
5462uno::Reference< excel::XRange > SAL_CALL
5466 bool bIsMultiArea = (
m_Areas->getCount() > 1 );
5468 uno::Reference< excel::XRange > xUsedRange(
getWorksheet()->getUsedRange() );
5469 sal_Int32
nType = 0;
5470 if ( !( _oType >>=
nType ) )
5474 case excel::XlCellType::xlCellTypeSameFormatConditions:
5475 case excel::XlCellType::xlCellTypeAllValidation:
5476 case excel::XlCellType::xlCellTypeSameValidation:
5479 case excel::XlCellType::xlCellTypeBlanks:
5480 case excel::XlCellType::xlCellTypeComments:
5481 case excel::XlCellType::xlCellTypeConstants:
5482 case excel::XlCellType::xlCellTypeFormulas:
5483 case excel::XlCellType::xlCellTypeVisible:
5484 case excel::XlCellType::xlCellTypeLastCell:
5490 std::vector< table::CellRangeAddress > rangeResults;
5491 sal_Int32 nItems =
m_Areas->getCount() + 1;
5495 xRange = xRange->SpecialCells( _oType, _oValue);
5497 if ( xRange.is() && pRange )
5499 sal_Int32 nElems = pRange->
m_Areas->getCount() + 1;
5500 for ( sal_Int32 nArea = 1; nArea < nElems; ++nArea )
5502 uno::Reference< excel::XRange > xTmpRange(
m_Areas->Item(
uno::Any( nArea ),
uno::Any() ), uno::UNO_QUERY_THROW );
5503 RangeHelper rHelper( xTmpRange->getCellRange() );
5504 rangeResults.push_back( rHelper.getCellRangeAddressable()->getRangeAddress() );
5509 for (
const auto& rRangeResult : rangeResults )
5516 if ( aCellRanges.
size() == 1 )
5521 uno::Reference< sheet::XSheetCellRangeContainer > xRanges(
new ScCellRangesObj(
getScDocShell(), aCellRanges ) );
5525 else if ( bIsSingleCell )
5527 pRangeToUse =
static_cast< ScVbaRange*
>( xUsedRange.get() );
5543 if (sal_Int32 aType; aValue >>= aType)
5547 case excel::XlSpecialCellsValue::xlNumbers:
5548 return sheet::CellFlags::VALUE | sheet::CellFlags::DATETIME;
5549 case excel::XlSpecialCellsValue::xlTextValues:
5550 return sheet::CellFlags::STRING;
5551 case excel::XlSpecialCellsValue::xlLogical:
5552 return sheet::CellFlags::VALUE | sheet::CellFlags::DATETIME;
5553 case excel::XlSpecialCellsValue::xlErrors:
5559 return sheet::CellFlags::VALUE | sheet::CellFlags::STRING | sheet::CellFlags::DATETIME;
5565 sal_Int32
nType = excel::XlSpecialCellsValue::xlNumbers;
5567 sal_Int32 nRes = sheet::FormulaResult::VALUE;
5571 case excel::XlSpecialCellsValue::xlErrors:
5572 nRes= sheet::FormulaResult::ERROR;
5574 case excel::XlSpecialCellsValue::xlLogical:
5576 nRes = sheet::FormulaResult::VALUE;
5578 case excel::XlSpecialCellsValue::xlNumbers:
5579 nRes = sheet::FormulaResult::VALUE;
5581 case excel::XlSpecialCellsValue::xlTextValues:
5582 nRes = sheet::FormulaResult::STRING;
5590uno::Reference< excel::XRange >
5593 uno::Reference< excel::XRange > xRange;
5596 uno::Reference< sheet::XCellRangesQuery > xQuery(
mxRange, uno::UNO_QUERY_THROW );
5597 uno::Reference< sheet::XSheetCellRanges > xLocSheetCellRanges;
5600 case excel::XlCellType::xlCellTypeAllFormatConditions:
5601 case excel::XlCellType::xlCellTypeSameFormatConditions:
5602 case excel::XlCellType::xlCellTypeAllValidation:
5603 case excel::XlCellType::xlCellTypeSameValidation:
5608 case excel::XlCellType::xlCellTypeBlanks:
5609 xLocSheetCellRanges = xQuery->queryEmptyCells();
5611 case excel::XlCellType::xlCellTypeComments:
5612 xLocSheetCellRanges = xQuery->queryContentCells(sheet::CellFlags::ANNOTATION);
5614 case excel::XlCellType::xlCellTypeConstants:
5617 case excel::XlCellType::xlCellTypeFormulas:
5620 xLocSheetCellRanges = xQuery->queryFormulaCells(nFormulaResult);
5623 case excel::XlCellType::xlCellTypeLastCell:
5626 case excel::XlCellType::xlCellTypeVisible:
5627 xLocSheetCellRanges = xQuery->queryVisibleCells();
5633 if (xLocSheetCellRanges.is())
5638 catch (uno::Exception& )
5648 uno::Reference< sheet::XSubTotalCalculatable > xSub(
mxRange, uno::UNO_QUERY_THROW );
5649 xSub->removeSubTotals();
5657 bool bDoReplace =
false;
5658 aReplace >>= bDoReplace;
5659 bool bAddPageBreaks =
false;
5660 PageBreaks >>= bAddPageBreaks;
5662 uno::Reference< sheet::XSubTotalCalculatable> xSub(
mxRange, uno::UNO_QUERY_THROW );
5663 uno::Reference< sheet::XSubTotalDescriptor > xSubDesc = xSub->createSubTotalDescriptor(
true);
5664 uno::Reference< beans::XPropertySet > xSubDescPropertySet( xSubDesc, uno::UNO_QUERY_THROW );
5665 xSubDescPropertySet->setPropertyValue(
"InsertPageBreaks",
uno::Any( bAddPageBreaks));
5666 sal_Int32 nLen = _nTotalList.getLength();
5667 uno::Sequence< sheet::SubTotalColumn > aColumns( nLen );
5668 auto aColumnsRange = asNonConstRange(aColumns);
5669 for (
int i = 0;
i < nLen;
i++)
5671 aColumnsRange[
i].Column = _nTotalList[
i] - 1;
5674 case excel::XlConsolidationFunction::xlAverage:
5675 aColumnsRange[
i].Function = sheet::GeneralFunction_AVERAGE;
5677 case excel::XlConsolidationFunction::xlCount:
5678 aColumnsRange[
i].Function = sheet::GeneralFunction_COUNT;
5680 case excel::XlConsolidationFunction::xlCountNums:
5681 aColumnsRange[
i].Function = sheet::GeneralFunction_COUNTNUMS;
5683 case excel::XlConsolidationFunction::xlMax:
5684 aColumnsRange[
i].Function = sheet::GeneralFunction_MAX;
5686 case excel::XlConsolidationFunction::xlMin:
5687 aColumnsRange[
i].Function = sheet::GeneralFunction_MIN;
5689 case excel::XlConsolidationFunction::xlProduct:
5690 aColumnsRange[
i].Function = sheet::GeneralFunction_PRODUCT;
5692 case excel::XlConsolidationFunction::xlStDev:
5693 aColumnsRange[
i].Function = sheet::GeneralFunction_STDEV;
5695 case excel::XlConsolidationFunction::xlStDevP:
5696 aColumnsRange[
i].Function = sheet::GeneralFunction_STDEVP;
5698 case excel::XlConsolidationFunction::xlSum:
5699 aColumnsRange[
i].Function = sheet::GeneralFunction_SUM;
5701 case excel::XlConsolidationFunction::xlUnknown:
5702 aColumnsRange[
i].Function = sheet::GeneralFunction_NONE;
5704 case excel::XlConsolidationFunction::xlVar:
5705 aColumnsRange[
i].Function = sheet::GeneralFunction_VAR;
5707 case excel::XlConsolidationFunction::xlVarP:
5708 aColumnsRange[
i].Function = sheet::GeneralFunction_VARP;
5715 xSubDesc->addNew(aColumns, _nGroupBy - 1);
5716 xSub->applySubTotals(xSubDesc, bDoReplace);
5718 catch (
const uno::Exception&)
5726 const css::uno::Any& IncludeDocProperties,
const css::uno::Any& ,
const css::uno::Any& From,
5727 const css::uno::Any& To,
const css::uno::Any& OpenAfterPublish,
const css::uno::Any& )
5730 if (!pUnoRangesBase)
5731 throw uno::RuntimeException(
"Failed to access underlying uno range object");
5732 ScDocShell* pShell = pUnoRangesBase->GetDocShell();
5736 uno::Reference< frame::XModel >
xModel(pShell->
GetModel(), uno::UNO_SET_THROW);
5737 uno::Reference< excel::XApplication > xApplication(
Application(), uno::UNO_QUERY_THROW);
5740 IncludeDocProperties, From,
To, OpenAfterPublish);
5746 return "ScVbaRange";
5749uno::Sequence< OUString >
5752 return {
"ooo.vba.excel.Range" };
5758 double dResult = 0.0;
5759 uno::Reference< excel::XApplication > xApplication(
Application(), uno::UNO_QUERY_THROW );
5760 uno::Reference< script::XInvocation > xInvoc( xApplication->WorksheetFunction(), uno::UNO_QUERY_THROW );
5762 uno::Reference< excel::XRange > aRange(
this );
5763 uno::Sequence< uno::Any > Params{
uno::Any(aRange) };
5764 uno::Sequence< sal_Int16 > OutParamIndex;
5765 uno::Sequence< uno::Any > OutParam;
5766 xInvoc->invoke(
"IsError", Params, OutParamIndex, OutParam ) >>= dResult;
5767 return dResult > 0.0;
5771extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
5773 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& args)
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
unotools::WeakReference< AnimationNode > mxParent
SfxApplication * SfxGetpApp()
virtual void visitNode(sal_Int32 x, sal_Int32 y, const css::uno::Reference< css::table::XCell > &xCell)=0
virtual OUString getServiceImplName()=0
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::WeakReference< ov::XHelperInterface > mxParent
virtual css::uno::Any SAL_CALL Application() override
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
virtual css::uno::Sequence< OUString > getServiceNames()=0
double stringToDouble(std::u16string_view aString, bool bUseGroupSep, rtl_math_ConversionStatus *pStatus, sal_Int32 *pParseEnd) const
void SetFont(const vcl::Font &rNewFont)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
really derive cell from range?
void InputEnglishString(const OUString &rText)
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
SC_DLLPUBLIC void Query(const ScQueryParam &rQueryParam, const ScRange *pAdvSource, bool bRecord)
SC_DLLPUBLIC bool FillAuto(ScRange &rRange, const ScMarkData *pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, sal_uLong nCount, double fStep, double fMax, bool bRecord, bool bApi)
SC_DLLPUBLIC bool SetWidthOrHeight(bool bWidth, const std::vector< sc::ColRowSpan > &rRanges, SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord, bool bApi)
SC_DLLPUBLIC bool EnterMatrix(const ScRange &rRange, const ScMarkData *pTabMark, const ScTokenArray *pTokenArray, const OUString &rString, bool bApi, bool bEnglish, const OUString &rFormulaNmsp, const formula::FormulaGrammar::Grammar)
css::uno::Reference< css::datatransfer::XTransferable2 > const & GetClipData() const
const ScDocument & GetDocument() const
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
static ScViewData * GetViewData()
ScModelObj * GetModel() const
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
void SC_DLLPUBLIC GetSortParam(ScSortParam &rParam, SCTAB nTab)
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC sal_uInt16 GetOriginalHeight(SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC OutputDevice * GetRefDevice()
SC_DLLPUBLIC bool HasColHeader(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
const css::uno::Reference< css::script::vba::XVBAEventProcessor > & GetVbaEventProcessor() const
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
void SC_DLLPUBLIC SetSortParam(const ScSortParam &rParam, SCTAB nTab)
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
SC_DLLPUBLIC void GetNextPos(SCCOL &rCol, SCROW &rRow, SCTAB nTab, SCCOL nMovX, SCROW nMovY, bool bMarked, bool bUnprotected, const ScMarkData &rMark, SCCOL nTabStartCol=SC_TABSTART_NONE) const
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
SC_DLLPUBLIC bool HasRowHeader(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab)
SC_DLLPUBLIC sal_uInt16 GetOriginalWidth(SCCOL nCol, SCTAB nTab) const
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
SC_DLLPUBLIC void GetDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
Return the smallest area containing at least all contiguous cells having data.
static SC_DLLPUBLIC void SetSearchItem(const SvxSearchItem &rNew)
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
static SC_DLLPUBLIC const SvxSearchItem & GetSearchItem()
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
virtual css::sheet::GoalResult SAL_CALL seekGoal(const css::table::CellAddress &aFormulaPosition, const css::table::CellAddress &aVariablePosition, const OUString &aGoalValue) override
XGoalSeek.
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
const ScOutlineEntry * GetEntryByPos(size_t nLevel, SCCOLROW nPos) const
SC_DLLPUBLIC bool IsHidden() const
const ScOutlineArray & GetColArray() const
const ScOutlineArray & GetRowArray() const
static void fillFontOnly(vcl::Font &rFont, const SfxItemSet &rItemSet, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE)
Static helper function to fill a font object from the passed item set.
void push_back(const ScRange &rRange)
ScRefFlags Parse(std::u16string_view, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab=0, sal_Unicode cDelimiter=0)
void ParseRows(const ScDocument &rDoc, const OUString &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
ScRefFlags ParseCols(const ScDocument &rDoc, const OUString &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
SC_DLLPUBLIC void MoveCursorAbs(SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, bool bShift, bool bControl, bool bKeepOld=false, bool bKeepSel=false)
ScViewData & GetViewData()
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
static bool Contains(const css::table::CellRangeAddress &rApiOuter, const css::table::CellRangeAddress &rApiInner)
Returns true, if the passed range rApiInner is completely inside the passed range rApiOuter.
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
static bool getDocumentEventsEnabled()
Returns true, if VBA document events are enabled.
virtual css::uno::Any createCollectionObject(const css::uno::Any &aSource)=0
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override=0
virtual css::uno::Type SAL_CALL getElementType() override=0
Represents a collection of hyperlinks of a worksheet or of a range.
virtual OUString SAL_CALL getText() override
virtual void SAL_CALL setFormulaR1C1Local(const css::uno::Any &rFormula) override
virtual void SAL_CALL Clear() override
virtual css::uno::Any SAL_CALL getColumnWidth() override
void groupUnGroup(bool bUnGroup)
virtual ScCellRangesBase * getCellRangesBase() override
static ScVbaRange * getImplementation(const css::uno::Reference< ov::excel::XRange > &rxRange)
Returns the ScVbaRange implementation object for the passed VBA Range object.
css::uno::Reference< ov::XCollection > m_Areas
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual void SAL_CALL Insert(const css::uno::Any &Shift, const css::uno::Any &CopyOrigin) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL CurrentArray() override
ScRange obtainRangeEvenIfRangeListIsEmpty(const ScRangeList &rCellRanges) const
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Find(const css::uno::Any &What, const css::uno::Any &After, const css::uno::Any &LookIn, const css::uno::Any &LookAt, const css::uno::Any &SearchOrder, const css::uno::Any &SearchDirection, const css::uno::Any &MatchCase, const css::uno::Any &MatchByte, const css::uno::Any &SearchFormat) override
virtual void SAL_CALL FillDown() override
virtual css::uno::Any SAL_CALL getFormulaArray() override
virtual void SAL_CALL Delete(const css::uno::Any &Shift) override
virtual void SAL_CALL setPageBreak(const css::uno::Any &_pagebreak) override
virtual void SAL_CALL ClearContents() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Resize(const css::uno::Any &RowSize, const css::uno::Any &ColumnSize) override
virtual void SAL_CALL Merge(const css::uno::Any &Across) override
virtual void SAL_CALL Autofit() override
virtual css::uno::Any SAL_CALL getMergeCells() override
virtual css::uno::Any SAL_CALL getNumberFormat() override
virtual css::uno::Any SAL_CALL getCellRange() override
const ScRangeList & getScRangeList()
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Next() override
ScVbaRange(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::table::XCellRange > &xRange, bool bIsRows=false, bool bIsColumns=false)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL SpecialCells(const css::uno::Any &_oType, const css::uno::Any &_oValue) override
virtual OUString getServiceImplName() override
virtual void SAL_CALL FillLeft() override
virtual ~ScVbaRange() override
css::uno::Reference< css::table::XCellRange > mxRange
virtual void SAL_CALL ClearComments() override
virtual void SAL_CALL setStyle(const css::uno::Any &_style) override
virtual css::uno::Any SAL_CALL Hyperlinks(const css::uno::Any &aIndex) override
virtual void SAL_CALL RemoveSubtotal() override
virtual void SAL_CALL setHidden(const css::uno::Any &_hidden) override
virtual sal_Bool SAL_CALL hasElements() override
static css::uno::Reference< ov::excel::XRange > CellsHelper(const ScDocument &rDoc, const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::table::XCellRange > &xRange, const css::uno::Any &nRowIndex, const css::uno::Any &nColumnIndex)
virtual css::uno::Any SAL_CALL getRowHeight() override
css::uno::Reference< ov::excel::XRange > getEntireColumnOrRow(bool bColumn)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Offset(const css::uno::Any &nRowOffset, const css::uno::Any &nColOffset) override
void setValue(const css::uno::Any &aValue, ValueSetter &setter)
virtual css::uno::Reference< ov::excel::XComment > SAL_CALL getComment() override
virtual void SAL_CALL setFormulaLocal(const css::uno::Any &rFormula) override
SfxItemSet * getCurrentDataSet()
virtual void SAL_CALL AutoOutline() override
virtual void SAL_CALL setFormula(const css::uno::Any &rFormula) override
virtual css::uno::Reference< ov::excel::XInterior > SAL_CALL Interior() override
css::uno::Reference< ov::excel::XRange > PreviousNext(bool bIsPrevious)
virtual void SAL_CALL ExportAsFixedFormat(const css::uno::Any &Type, const css::uno::Any &FileName, const css::uno::Any &Quality, const css::uno::Any &IncludeDocProperties, const css::uno::Any &IgnorePrintAreas, const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &OpenAfterPublish, const css::uno::Any &FixedFormatExtClassPtr) override
virtual void SAL_CALL setFormulaArray(const css::uno::Any &rFormula) override
virtual css::uno::Any SAL_CALL HasFormula() override
ScCellRangeObj * getCellRangeObj()
ScDocShell * getScDocShell()
virtual void SAL_CALL ClearFormats() override
static css::uno::Reference< ov::excel::XRange > getRangeObjectForName(const css::uno::Reference< css::uno::XComponentContext > &xContext, const OUString &sRangeName, ScDocShell *pDocSh, formula::FormulaGrammar::AddressConvention eConv)
void fillSeries(css::sheet::FillDirection nFillDirection, css::sheet::FillMode nFillMode, css::sheet::FillDateMode nFillDateMode, double fStep, double fEndValue)
virtual void SAL_CALL AutoFilter(const css::uno::Any &Field, const css::uno::Any &Criteria1, const css::uno::Any &Operator, const css::uno::Any &Criteria2, const css::uno::Any &VisibleDropDown) override
css::uno::Reference< css::frame::XModel > getUnoModel()
virtual void SAL_CALL PasteSpecial(const css::uno::Any &Paste, const css::uno::Any &Operation, const css::uno::Any &SkipBlanks, const css::uno::Any &Transpose) override
virtual css::uno::Any SAL_CALL getTop() override
virtual ::sal_Int32 SAL_CALL getColumn() override
virtual css::uno::Reference< ov::excel::XValidation > SAL_CALL getValidation() override
virtual sal_Bool SAL_CALL hasError() override
virtual void SAL_CALL Subtotal(::sal_Int32 GroupBy, ::sal_Int32 Function, const css::uno::Sequence< ::sal_Int32 > &TotalList, const css::uno::Any &Replace, const css::uno::Any &PageBreaks, const css::uno::Any &SummaryBelowData) override
virtual css::uno::Any SAL_CALL getFormulaLocal() override
virtual void SAL_CALL Select() override
virtual css::uno::Any SAL_CALL getWidth() override
virtual css::uno::Any SAL_CALL getValue2() override
virtual css::uno::Reference< ov::excel::XCharacters > SAL_CALL characters(const css::uno::Any &Start, const css::uno::Any &Length) override
virtual OUString SAL_CALL Characters(const css::uno::Any &nIndex, const css::uno::Any &nCount) override
double getCalcRowHeight(const css::table::CellRangeAddress &)
static css::uno::Reference< ov::excel::XRange > ApplicationRange(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Any &Cell1, const css::uno::Any &Cell2)
virtual void SAL_CALL setFormulaR1C1(const css::uno::Any &rFormula) override
virtual css::uno::Any SAL_CALL getStyle() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL End(::sal_Int32 Direction) override
virtual css::uno::Any SAL_CALL getHidden() override
css::uno::Reference< ov::excel::XRange > SpecialCellsImpl(sal_Int32 nType, const css::uno::Any &_oValue)
css::uno::Reference< ov::XCollection > m_Borders
virtual void SAL_CALL Activate() override
virtual void SAL_CALL Sort(const css::uno::Any &Key1, const css::uno::Any &Order1, const css::uno::Any &Key2, const css::uno::Any &Type, const css::uno::Any &Order2, const css::uno::Any &Key3, const css::uno::Any &Order3, const css::uno::Any &Header, const css::uno::Any &OrderCustom, const css::uno::Any &MatchCase, const css::uno::Any &Orientation, const css::uno::Any &SortMethod, const css::uno::Any &DataOption1, const css::uno::Any &DataOption2, const css::uno::Any &DataOption3) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL CurrentRegion() override
virtual css::uno::Any SAL_CALL BorderAround(const css::uno::Any &LineStyle, const css::uno::Any &Weight, const css::uno::Any &ColorIndex, const css::uno::Any &Color) override
virtual css::uno::Any SAL_CALL Areas(const css::uno::Any &) override
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getWorksheet() override
css::uno::Reference< ov::XCollection > & getBorders()
virtual void SAL_CALL setNumberFormat(const css::uno::Any &rNumberFormat) override
css::uno::Reference< css::sheet::XSheetCellRangeContainer > mxRanges
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Previous() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Range(const css::uno::Any &Cell1, const css::uno::Any &Cell2) override
virtual void SAL_CALL setShowDetail(const css::uno::Any &aShowDetail) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Item(const css::uno::Any &row, const css::uno::Any &column) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Cells(const css::uno::Any &nRow, const css::uno::Any &nCol) override
virtual css::uno::Any SAL_CALL getLeft() override
void SAL_CALL Calculate() override
virtual css::uno::Any SAL_CALL getPageBreak() override
void visitArray(ArrayVisitor &visitor)
virtual void SAL_CALL FillUp() override
virtual void SAL_CALL setValue2(const css::uno::Any &aValue2) override
virtual css::uno::Reference< ov::excel::XComment > SAL_CALL AddComment(const css::uno::Any &Text) override
virtual css::uno::Sequence< OUString > getServiceNames() override
css::uno::Any getFormulaValue(formula::FormulaGrammar::Grammar)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Rows(const css::uno::Any &nIndex) override
virtual css::uno::Any SAL_CALL getWrapText() override
virtual css::uno::Any SAL_CALL getHeight() override
virtual css::uno::Reference< ov::excel::XName > SAL_CALL getName() override
static bool getCellRangesForAddress(ScRefFlags &rResFlags, std::u16string_view sAddress, ScDocShell *pDocSh, ScRangeList &rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter)
virtual sal_Bool SAL_CALL GoalSeek(const css::uno::Any &Goal, const css::uno::Reference< ov::excel::XRange > &ChangingCell) override
void setFormulaValue(const css::uno::Any &aValue, formula::FormulaGrammar::Grammar)
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getEntireColumn() override
virtual OUString SAL_CALL Address(const css::uno::Any &RowAbsolute, const css::uno::Any &ColumnAbsolute, const css::uno::Any &ReferenceStyle, const css::uno::Any &External, const css::uno::Any &RelativeTo) override
virtual void SAL_CALL Group() override
bool isSingleCellRange() const
virtual void SAL_CALL setWrapText(const css::uno::Any &bIsWrapped) override
virtual void SAL_CALL Copy(const css::uno::Any &Destination) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getEntireRow() override
virtual void SAL_CALL Cut(const css::uno::Any &Destination) override
virtual void SAL_CALL setRowHeight(const css::uno::Any &_rowheight) override
OUString SAL_CALL getDefaultMethodName() override
virtual void SAL_CALL UnMerge() override
css::awt::Point getPosition() const
virtual css::uno::Any SAL_CALL getFormula() override
virtual void SAL_CALL setColumnWidth(const css::uno::Any &_columnwidth) override
virtual ::sal_Int32 SAL_CALL getRow() override
virtual void SAL_CALL PrintOut(const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &Copies, const css::uno::Any &Preview, const css::uno::Any &ActivePrinter, const css::uno::Any &PrintToFile, const css::uno::Any &Collate, const css::uno::Any &PrToFileName) override
double getCalcColWidth(const css::table::CellRangeAddress &)
virtual css::uno::Any SAL_CALL getFormulaR1C1() override
virtual css::uno::Any SAL_CALL getShowDetail() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL MergeArea() override
virtual css::uno::Any SAL_CALL getPrefixCharacter() override
virtual css::uno::Any SAL_CALL getValue() override
virtual void SAL_CALL AutoFill(const css::uno::Reference< ov::excel::XRange > &Destination, const css::uno::Any &Type) override
css::uno::Reference< ov::excel::XValidation > m_xValidation
css::uno::Any DoGetValue(RangeValueType eValueType)
virtual void SAL_CALL ClearOutline() override
virtual css::uno::Any SAL_CALL Borders(const css::uno::Any &) override
virtual void SAL_CALL FillRight() override
virtual sal_Bool SAL_CALL Replace(const OUString &What, const OUString &Replacement, const css::uno::Any &LookAt, const css::uno::Any &SearchOrder, const css::uno::Any &MatchCase, const css::uno::Any &MatchByte, const css::uno::Any &SearchFormat, const css::uno::Any &ReplaceFormat) override
virtual void SAL_CALL setMergeCells(const css::uno::Any &bMerge) override
void ClearContents(sal_Int32 nFlags, bool bFireEvent)
void fireChangeEvent()
Fires a Worksheet_Change event for this range or range list.
virtual void SAL_CALL Ungroup() override
css::uno::Reference< ov::excel::XRange > getArea(sal_Int32 nIndex)
ScDocument & getScDocument()
virtual css::uno::Reference< ov::excel::XFont > SAL_CALL Font() override
virtual ::sal_Int32 SAL_CALL getCount() override
virtual css::uno::Any SAL_CALL getFormulaR1C1Local() override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Columns(const css::uno::Any &nIndex) override
ScDBFunc * GetView() const
SC_DLLPUBLIC void DeletePageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
SC_DLLPUBLIC void InsertPageBreak(bool bColumn, bool bRecord=true, const ScAddress *pPos=nullptr, bool bSetModified=true)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxDispatcher * GetDispatcher()
void SetBackward(bool bNewBackward)
void SetCellType(SvxSearchCellType nNewCellType)
void SetRowDirection(bool bNewRowDirection)
void SetWordOnly(bool bNewWordOnly)
virtual const css::uno::Any & getValue() const =0
virtual void processValue(const css::uno::Any &aValue)=0
virtual bool processValue(const css::uno::Any &aValue, const css::uno::Reference< css::table::XCell > &xCell)=0
css::uno::Type const & get()
#define TOOLS_WARN_EXCEPTION(area, stream)
std::deque< AttacherIndex_Impl > aIndex
Reference< XTypeConverter > xConverter
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
@ SPECIAL_BOOLEAN
Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
@ EDITATTR
Drawing objects.
@ STRING
Dates, times, datetime values.
@ DATETIME
Numeric values (and numeric results if InsertDeleteFlags::FORMULA is not set).
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
double getArea(const B2DPolygon &rCandidate)
double getLength(const B2DPolygon &rCandidate)
class SAL_NO_VTABLE XPropertySet
Any SAL_CALL getCaughtException()
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
uno::Reference< sheet::XUnnamedDatabaseRanges > GetUnnamedDataBaseRanges(const ScDocShell *pShell)
void implnCut(const uno::Reference< frame::XModel > &xModel)
void implnPasteSpecial(const uno::Reference< frame::XModel > &xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose)
SfxViewFrame * getViewFrame(const uno::Reference< frame::XModel > &xModel)
void ExportAsFixedFormatHelper(const uno::Reference< frame::XModel > &xModel, const css::uno::Reference< XApplication > &xApplication, const css::uno::Any &Type, const css::uno::Any &FileName, const css::uno::Any &Quality, const css::uno::Any &IncludeDocProperties, const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &OpenAfterPublish)
ScTabViewShell * getBestViewShell(const css::uno::Reference< css::frame::XModel > &xModel)
uno::Reference< sheet::XDatabaseRange > GetAutoFiltRange(const ScDocShell *pShell, sal_Int16 nSheet)
void implnCopy(const uno::Reference< frame::XModel > &xModel)
uno::Reference< XHelperInterface > getUnoSheetModuleObj(const uno::Reference< table::XCellRange > &xRange)
css::uno::Reference< T > getXSomethingFromArgs(css::uno::Sequence< css::uno::Any > const &args, sal_Int32 nPos, bool bCanBeNull=true)
VBAHELPER_DLLPUBLIC void PrintOutHelper(SfxViewShell const *pViewShell, const css::uno::Any &From, const css::uno::Any &To, const css::uno::Any &Copies, const css::uno::Any &Preview, const css::uno::Any &ActivePrinter, const css::uno::Any &PrintToFile, const css::uno::Any &Collate, const css::uno::Any &PrToFileName, bool bSelection)
VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > const & getTypeConverter(const css::uno::Reference< css::uno::XComponentContext > &xContext)
OUString VBAToRegexp(const OUString &rIn)
VBAHELPER_DLLPUBLIC OUString getAnyAsString(const css::uno::Any &pvargItem)
VBAHELPER_DLLPUBLIC bool extractBoolFromAny(const css::uno::Any &rAny)
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc(const css::uno::Reference< css::uno::XComponentContext > &xContext)
#define ERRCODE_BASIC_BAD_PARAMETER
#define ERRCODE_BASIC_METHOD_FAILED
#define ERRCODE_BASIC_NOT_IMPLEMENTED
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
Each instance of this struct represents a single filtering criteria.
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
SC_DLLPUBLIC SCSIZE GetEntryCount() const
SC_DLLPUBLIC bool RemoveEntryByField(SCCOLROW nField)
::std::vector< ScSortKeyState > maKeyState
void setValue(Type type, object value)
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
const sal_Unicode cDelimiter
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
constexpr OUStringLiteral SC_UNO_SRCHWORDS
constexpr OUStringLiteral SC_UNO_SRCHREGEXP
constexpr OUStringLiteral SC_UNO_SRCHCASE
constexpr OUStringLiteral SC_UNO_SRCHBYROW
::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE
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)
::std::vector< CellPos > vCellPos
constexpr OUStringLiteral sNA
const char GREATERTHANEQUALS[]
static ScPasteFunc getPasteFormulaBits(sal_Int32 Operation)
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< table::XCellRange > processKey(const uno::Any &Key, const uno::Reference< uno::XComponentContext > &xContext, ScDocShell *pDocSh)
static uno::Reference< frame::XModel > getModelFromRange(const uno::Reference< table::XCellRange > &xRange)
static ScDocShell * getDocShellFromRange(const uno::Reference< table::XCellRange > &xRange)
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 ScDBData * lcl_GetDBData_Impl(ScDocShell *pDocShell, sal_Int16 nSheet)
static void lcl_setTableFieldsFromCriteria(OUString &sCriteria1, const uno::Reference< beans::XPropertySet > &xDescProps, sheet::TableFilterField2 &rFilterField)
constexpr OUStringLiteral CELLSTYLE
static uno::Reference< beans::XPropertySet > getRowOrColumnProps(const uno::Reference< table::XCellRange > &xCellRange, bool bRows)
static void lcl_SetAllQueryForField(ScDocShell *pDocShell, SCCOLROW nField, sal_Int16 nSheet)
static uno::Reference< sheet::XCellRangeReferrer > getNamedRange(const uno::Reference< uno::XInterface > &xIf, const uno::Reference< table::XCellRange > &thisRange)
::cppu::WeakImplHelper< container::XEnumeration > CellsEnumeration_BASE
static bool cellInRange(const table::CellRangeAddress &rAddr, sal_Int32 nCol, sal_Int32 nRow)
static ScDocShell * getDocShellFromIf(const uno::Reference< uno::XInterface > &xIf)
static sal_Int32 getContentResultFlags(const uno::Any &aValue)
static table::CellRangeAddress getCellRangeAddressForVBARange(const uno::Any &aParam, ScDocShell *pDocSh)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScVbaRange_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &args)
static void lcl_mergeCellsOfRange(const uno::Reference< table::XCellRange > &xCellRange, bool _bMerge)
static InsertDeleteFlags getPasteFlags(sal_Int32 Paste)
static ScQueryParam lcl_GetQueryParam(ScDocShell *pDocShell, sal_Int16 nSheet)
static sal_Int32 findSortPropertyIndex(const uno::Sequence< beans::PropertyValue > &props, const OUString &sPropName)
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 double lcl_TwipsToPoints(sal_uInt16 nVal)
const sal_Int16 supportedIndexTable[]
static sal_Int32 lcl_getFormulaResultFlags(const uno::Any &aType)
static sal_uInt16 lcl_pointsToTwips(double nVal)
static ScDocument & getDocumentFromRange(const uno::Reference< table::XCellRange > &xRange)
const char LESSTHANEQUALS[]
static void setCursor(SCCOL nCol, SCROW nRow, const uno::Reference< frame::XModel > &xModel, bool bInSel=true)
constexpr OUStringLiteral ISVISIBLE
bool getScRangeListForAddress(const OUString &sName, ScDocShell *pDocSh, const ScRange &refRange, ScRangeList &aCellRanges, formula::FormulaGrammar::AddressConvention aConv)
static void lcl_SelectAll(ScDocShell *pDocShell, const ScQueryParam &aParam)
static double lcl_Round2DecPlaces(double nVal)
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 double getDefaultCharWidth(ScDocShell *pDocShell)
static ScDocShell * getDocShellFromRanges(const uno::Reference< sheet::XSheetCellRangeContainer > &xRanges)
static uno::Reference< frame::XModel > getModelFromXIf(const uno::Reference< uno::XInterface > &xIf)
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)