summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/address.hxx6
-rw-r--r--sc/inc/cell.hxx9
-rw-r--r--sc/inc/compiler.hxx2
-rw-r--r--sc/inc/datauno.hxx11
-rw-r--r--sc/inc/externalrefmgr.hxx37
-rw-r--r--sc/inc/global.hxx8
-rw-r--r--sc/inc/pch/precompiled_sc.hxx3
-rw-r--r--sc/inc/progress.hxx11
-rw-r--r--sc/inc/refdata.hxx21
-rw-r--r--sc/inc/table.hxx35
10 files changed, 127 insertions, 16 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 7ba5aa9c1f32..f1859be15fcf 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -791,12 +791,14 @@ template< typename T > void PutInOrder( T& nStart, T& nEnd )
bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString,
SCTAB nDefTab, ScRefAddress& rRefAddress,
- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1);
+ const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
+ ScAddress::ExternalInfo* pExtInfo = NULL );
bool ConvertDoubleRef(ScDocument* pDoc, const String& rRefString,
SCTAB nDefTab, ScRefAddress& rStartRefAddress,
ScRefAddress& rEndRefAddress,
- const ScAddress::Details& rDetails = ScAddress::detailsOOOa1);
+ const ScAddress::Details& rDetails = ScAddress::detailsOOOa1,
+ ScAddress::ExternalInfo* pExtInfo = NULL );
/// append alpha representation of column to buffer
SC_DLLPUBLIC void ScColToAlpha( rtl::OUStringBuffer& rBuffer, SCCOL nCol);
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index e04ec9af50ab..10de035abf7c 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -387,6 +387,15 @@ public:
inline USHORT GetSeenInIteration() const { return nSeenInIteration; }
BOOL HasOneReference( ScRange& r ) const;
+ /* Checks if the formula contains reference list that can be
+ expressed by one reference (like A1;A2;A3:A5 -> A1:A5). The
+ reference list is not required to be sorted (i.e. A3;A1;A2 is
+ still recognized as A1:A3), but no overlapping is allowed.
+ If one reference is recognized, the rRange is filled.
+
+ It is similar to HasOneReference(), but more general.
+ */
+ bool HasRefListExpressibleAsOneReference(ScRange& rRange) const;
BOOL HasRelNameReference() const;
BOOL HasColRowName() const;
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 155630a97ac2..9f245322fdb7 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -311,9 +311,11 @@ private:
const CharClass* pCharClass; // which character classification is used for parseAnyToken
USHORT mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double)
SCsTAB nMaxTab; // last sheet in document
+ sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol
const Convention *pConv;
bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE
bool mbExtendedErrorDetection;
+ bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis
BOOL NextNewToken(bool bInArray = false);
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 405d49e2a6b2..a93bfc341573 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -50,6 +50,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -340,8 +341,9 @@ public:
// to uno, all three look the same
-class ScFilterDescriptorBase : public cppu::WeakImplHelper3<
+class ScFilterDescriptorBase : public cppu::WeakImplHelper4<
com::sun::star::sheet::XSheetFilterDescriptor,
+ com::sun::star::sheet::XSheetFilterDescriptor2,
com::sun::star::beans::XPropertySet,
com::sun::star::lang::XServiceInfo >,
public SfxListener
@@ -368,6 +370,13 @@ public:
::com::sun::star::sheet::TableFilterField >& aFilterFields )
throw(::com::sun::star::uno::RuntimeException);
+ // XSheetFilterDescriptor2
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField2 > SAL_CALL
+ getFilterFields2() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFilterFields2( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::sheet::TableFilterField2 >& aFilterFields )
+ throw(::com::sun::star::uno::RuntimeException);
+
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo()
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 07c8a6a6697f..9b12dba52f1f 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -132,15 +132,27 @@ public:
class Table
{
public:
+
+ enum ReferencedFlag
+ {
+ UNREFERENCED,
+ REFERENCED_MARKED, // marked as referenced during store to file
+ REFERENCED_PERMANENT // permanently marked, e.g. from within interpreter
+ };
+
Table();
~Table();
SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0);
TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const;
bool hasRow( SCROW nRow ) const;
- /// A temporary state used only during store to file.
- bool isReferenced() const;
+ /** Set/clear referenced status flag only if current status is not
+ REFERENCED_PERMANENT. */
void setReferenced( bool bReferenced );
+ /// Unconditionally set the reference status flag.
+ void setReferencedFlag( ReferencedFlag eFlag );
+ ReferencedFlag getReferencedFlag() const;
+ bool isReferenced() const;
/// Obtain a sorted vector of rows.
void getAllRows(::std::vector<SCROW>& rRows) const;
/// Obtain a sorted vector of columns.
@@ -148,8 +160,8 @@ public:
void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const;
private:
- RowsDataType maRows;
- bool mbReferenced;
+ RowsDataType maRows;
+ ReferencedFlag meReferenced;
};
typedef ::boost::shared_ptr<Table> TableTypeRef;
@@ -219,9 +231,16 @@ public:
* Set a table as referenced, used only during store-to-file.
* @returns <TRUE/> if ALL tables of ALL documents are marked.
*/
- bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName );
+ bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent );
void setAllCacheTableReferencedStati( bool bReferenced );
bool areAllCacheTablesReferenced() const;
+
+ /**
+ * Set a table as permanently referenced, to be called if not in
+ * mark-during-store-to-file cycle.
+ */
+ void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
+
private:
struct ReferencedStatus
{
@@ -497,10 +516,16 @@ public:
* Set a table as referenced, used only during store-to-file.
* @returns <TRUE/> if ALL tables of ALL external documents are marked.
*/
- bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName );
+ bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
void setAllCacheTableReferencedStati( bool bReferenced );
/**
+ * Set a table as permanently referenced, to be called if not in
+ * mark-during-store-to-file cycle.
+ */
+ void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets );
+
+ /**
* @returns <TRUE/> if setAllCacheTableReferencedStati(false) was called,
* <FALSE/> if setAllCacheTableReferencedStati(true) was called.
*/
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 76f5fd665033..e329f477d824 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -728,7 +728,13 @@ enum ScQueryOp
SC_TOPVAL,
SC_BOTVAL,
SC_TOPPERC,
- SC_BOTPERC
+ SC_BOTPERC,
+ SC_CONTAINS,
+ SC_DOES_NOT_CONTAIN,
+ SC_BEGINS_WITH,
+ SC_DOES_NOT_BEGIN_WITH,
+ SC_ENDS_WITH,
+ SC_DOES_NOT_END_WITH
};
// -----------------------------------------------------------------------
diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx
index db4e87d3cdb7..b905bb19db03 100644
--- a/sc/inc/pch/precompiled_sc.hxx
+++ b/sc/inc/pch/precompiled_sc.hxx
@@ -36,6 +36,7 @@
#include <algorithm>
#include <assert.h>
+#include <deque>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -49,6 +50,8 @@
#include <new>
#include <cfloat>
+#include <boost/bind.hpp>
+
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b3dpolygon.hxx>
#include <basegfx/polygon/b3dpolypolygon.hxx>
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index b30cf6d9dc70..c7706c2bc26b 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -36,6 +36,17 @@
class ScDocument;
+/*
+ * #i102566
+ * Drawing a progress bar update is not cheap, so if we draw it on every
+ * percentage change of 200 calculations we get one progress draw per 2
+ * calculations which is slower than doing the calculations themselves. So as a
+ * rough guide only do an update per MIN_NO_CODES_PER_PROGRESS_UPDATE
+ * calculations
+ */
+#define MIN_NO_CODES_PER_PROGRESS_UPDATE 100
+
+
class SC_DLLPUBLIC ScProgress
{
private:
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 6a51d66fdc07..12f29943fce0 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -109,6 +109,8 @@ struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) int
inline BOOL IsRelName() const { return Flags.bRelName; }
inline BOOL Valid() const;
+ /// In external references nTab is -1
+ inline bool ValidExternal() const;
void SmartRelAbs( const ScAddress& rPos );
void CalcRelFromAbs( const ScAddress& rPos );
@@ -147,6 +149,13 @@ inline BOOL ScSingleRefData::Valid() const
nTab >= 0 && nTab <= MAXTAB;
}
+inline bool ScSingleRefData::ValidExternal() const
+{
+ return nCol >= 0 && nCol <= MAXCOL &&
+ nRow >= 0 && nRow <= MAXROW &&
+ nTab == -1;
+}
+
struct ScComplexRefData // Complex reference (a range) into the sheet
{
@@ -181,6 +190,10 @@ struct ScComplexRefData // Complex reference (a range) into the sheet
{ return Ref1.IsDeleted() || Ref2.IsDeleted(); }
inline BOOL Valid() const
{ return Ref1.Valid() && Ref2.Valid(); }
+ /** In external references nTab is -1 for the start tab and -1 for the end
+ tab if one sheet, or >=0 if more than one sheets. */
+ inline bool ValidExternal() const;
+
/// Absolute references have to be up-to-date when calling this!
void PutInOrder();
inline BOOL operator==( const ScComplexRefData& r ) const
@@ -192,4 +205,12 @@ struct ScComplexRefData // Complex reference (a range) into the sheet
ScComplexRefData& Extend( const ScComplexRefData & rRef, const ScAddress & rPos );
};
+inline bool ScComplexRefData::ValidExternal() const
+{
+ return Ref1.ValidExternal() &&
+ Ref2.nCol >= 0 && Ref2.nCol <= MAXCOL &&
+ Ref2.nRow >= 0 && Ref2.nRow <= MAXROW &&
+ Ref2.nTab >= Ref1.nTab;
+}
+
#endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7d9bf90a3d81..8b2227d48dbb 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -267,16 +267,28 @@ public:
void GetString( SCCOL nCol, SCROW nRow, String& rString );
void GetInputString( SCCOL nCol, SCROW nRow, String& rString );
double GetValue( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetValue( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetValue( rPos.Row() ) :
+ 0.0;
+ }
double GetValue( SCCOL nCol, SCROW nRow );
void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
BOOL bAsciiExport = FALSE );
CellType GetCellType( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetCellType( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetCellType( rPos.Row() ) :
+ CELLTYPE_NONE;
+ }
CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
ScBaseCell* GetCell( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetCell( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetCell( rPos.Row() ) :
+ NULL;
+ }
ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
@@ -378,7 +390,11 @@ public:
SCCOL nEndCol, SCROW nEndRow ) const;
USHORT GetErrCode( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetErrCode( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
+ 0;
+ }
//UNUSED2008-05 USHORT GetErrCode( SCCOL nCol, SCROW nRow ) const;
void ResetChanged( const ScRange& rRange );
@@ -454,7 +470,11 @@ public:
const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
ULONG GetNumberFormat( const ScAddress& rPos ) const
- { return aCol[rPos.Col()].GetNumberFormat( rPos.Row() ); }
+ {
+ return ValidColRow(rPos.Col(),rPos.Row()) ?
+ aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
+ 0;
+ }
ULONG GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
void MergeSelectionPattern( ScMergePatternState& rState,
const ScMarkData& rMark, BOOL bDeep ) const;
@@ -473,7 +493,10 @@ public:
void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE )
- { aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); }
+ {
+ if (ValidColRow(rPos.Col(),rPos.Row()))
+ aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
+ }
void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, BOOL bPutToPool = FALSE );
void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
const ScPatternAttr& rPattern, short nNewType );