summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/cell2.cxx2
-rw-r--r--sc/source/core/data/column3.cxx17
-rw-r--r--sc/source/core/data/documen3.cxx11
-rw-r--r--sc/source/core/data/dpcachetable.cxx30
-rwxr-xr-xsc/source/core/data/dptablecache.cxx34
-rw-r--r--sc/source/core/data/global2.cxx51
-rw-r--r--sc/source/core/data/table3.cxx61
-rw-r--r--sc/source/core/inc/interpre.hxx1
-rw-r--r--sc/source/core/tool/dbcolect.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx7
-rw-r--r--sc/source/core/tool/interpr4.cxx33
-rw-r--r--sc/source/filter/excel/excimp8.cxx11
-rw-r--r--sc/source/filter/html/htmlpars.cxx3
-rw-r--r--sc/source/filter/xml/sheetdata.cxx13
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx32
-rw-r--r--sc/source/ui/app/inputhdl.cxx8
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx10
-rw-r--r--sc/source/ui/dbgui/makefile.mk1
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx3
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx2
-rw-r--r--sc/source/ui/dbgui/validate.cxx2
-rw-r--r--sc/source/ui/docshell/docsh.cxx22
-rw-r--r--sc/source/ui/docshell/docsh2.cxx2
-rw-r--r--sc/source/ui/docshell/docsh5.cxx3
-rw-r--r--sc/source/ui/inc/filtdlg.hxx1
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/src/scfuncs.src22
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx9
-rwxr-xr-xsc/source/ui/unoobj/dapiuno.cxx7
-rw-r--r--sc/source/ui/unoobj/docuno.cxx16
-rw-r--r--sc/source/ui/unoobj/servuno.cxx25
-rw-r--r--sc/source/ui/view/gridwin.cxx13
32 files changed, 331 insertions, 127 deletions
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 9a3670d2a9e0..4de78c71fe79 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -996,6 +996,8 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
pDocument->RemoveFromFormulaTree( this ); // update formula count
delete pCode;
pCode = pRangeData->GetCode()->Clone();
+ // #i18937# #i110008# call MoveRelWrap, but with the old position
+ ScCompiler::MoveRelWrap(*pCode, pDocument, aOldPos, pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.UpdateSharedFormulaReference( eUpdateRefMode, aOldPos, r,
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index dc206950b3ea..22b75b8d4a6a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1467,8 +1467,9 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
}
-void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings)
+void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates)
{
+ bool bHasDates = false;
SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
String aString;
SCROW nRow = 0;
@@ -1504,6 +1505,18 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollec
nValue = 0.0;
}
+ if (pFormatter)
+ {
+ short nType = pFormatter->GetType(nFormat);
+ if ((nType & NUMBERFORMAT_DATE) && !(nType & NUMBERFORMAT_TIME))
+ {
+ // special case for date values. Disregard the time
+ // element if the number format is of date type.
+ nValue = ::rtl::math::approxFloor(nValue);
+ bHasDates = true;
+ }
+ }
+
pData = new TypedStrData( aString, nValue, SC_STRTYPE_VALUE );
}
#if 0 // DR
@@ -1522,6 +1535,8 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollec
++nIndex;
}
+
+ rHasDates = bHasDates;
}
//
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index fd2b2f1fd309..557f181c9d8f 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1263,7 +1263,8 @@ BOOL ScDocument::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol,
// GetFilterEntries - Eintraege fuer AutoFilter-Listbox
//
-BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScStrCollection& rStrings, bool bFilter )
+BOOL ScDocument::GetFilterEntries(
+ SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates)
{
if ( ValidTab(nTab) && pTab[nTab] && pDBCollection )
{
@@ -1300,11 +1301,11 @@ BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScSt
if ( bFilter )
{
- pTab[nTab]->GetFilteredFilterEntries( nCol, nStartRow, nEndRow, aParam, rStrings );
+ pTab[nTab]->GetFilteredFilterEntries( nCol, nStartRow, nEndRow, aParam, rStrings, rHasDates );
}
else
{
- pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings );
+ pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings, rHasDates );
}
return TRUE;
@@ -1319,11 +1320,11 @@ BOOL ScDocument::GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedScSt
//
BOOL ScDocument::GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
- SCTAB nTab, TypedScStrCollection& rStrings )
+ SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates )
{
if ( ValidTab(nTab) && pTab[nTab] )
{
- pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings );
+ pTab[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rStrings, rHasDates );
return TRUE;
}
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index ad5e921cb278..d97900e6b904 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -183,39 +183,9 @@ sal_Int32 ScDPCacheTable::getColSize() const
return GetCache()->GetColumnCount();
}
-namespace {
-
-/**
- * While the macro interpret level is incremented, the formula cells are
- * (semi-)guaranteed to be interpreted.
- */
-class MacroInterpretIncrementer
-{
-public:
- MacroInterpretIncrementer(ScDocument* pDoc) :
- mpDoc(pDoc)
- {
- mpDoc->IncMacroInterpretLevel();
- }
- ~MacroInterpretIncrementer()
- {
- mpDoc->DecMacroInterpretLevel();
- }
-private:
- ScDocument* mpDoc;
-};
-
-}
-
void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
bool bIgnoreEmptyRows, bool bRepeatIfEmpty )
{
- // Make sure the formula cells within the data range are interpreted
- // during this call, for this method may be called from the interpretation
- // of GETPIVOTDATA, which disables nested formula interpretation without
- // increasing the macro level.
- MacroInterpretIncrementer aMacroInc(GetCache()->GetDoc());
-
if ( mpCache == NULL )
InitNoneCache( NULL );
//check cache
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 42090e5203a2..fc9cf2b99a10 100755
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -304,7 +304,7 @@ void ScDPItemData::dump() const
DBG_TRACE1( "Numberformat= %o", nNumFormat );
DBG_TRACESTR(aString );
DBG_TRACE1( "fValue= %f", fValue );
- DBG_TRACE1( "bHasValue= %d", bHasValue ? 1:0);
+ DBG_TRACE1( "mbFlag= %d", mbFlag);
}
#endif
//End
@@ -489,8 +489,40 @@ bool ScDPTableDataCache::IsValid() const
}
// -----------------------------------------------------------------------
+
+namespace {
+
+/**
+ * While the macro interpret level is incremented, the formula cells are
+ * (semi-)guaranteed to be interpreted.
+ */
+class MacroInterpretIncrementer
+{
+public:
+ MacroInterpretIncrementer(ScDocument* pDoc) :
+ mpDoc(pDoc)
+ {
+ mpDoc->IncMacroInterpretLevel();
+ }
+ ~MacroInterpretIncrementer()
+ {
+ mpDoc->DecMacroInterpretLevel();
+ }
+private:
+ ScDocument* mpDoc;
+};
+
+}
+
+// -----------------------------------------------------------------------
bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
{
+ // Make sure the formula cells within the data range are interpreted
+ // during this call, for this method may be called from the interpretation
+ // of GETPIVOTDATA, which disables nested formula interpretation without
+ // increasing the macro level.
+ MacroInterpretIncrementer aMacroInc(pDoc);
+
//
SCROW nStartRow = rRange.aStart.Row(); // start of data
SCROW nEndRow = rRange.aEnd.Row();
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index d32ebdafbf78..3234340ae9dd 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -145,30 +145,32 @@ BOOL ScImportParam::operator==( const ScImportParam& rOther ) const
//------------------------------------------------------------------------
// struct ScQueryParam:
-ScQueryEntry::ScQueryEntry()
+ScQueryEntry::ScQueryEntry() :
+ bDoQuery(FALSE),
+ bQueryByString(FALSE),
+ bQueryByDate(false),
+ nField(0),
+ eOp(SC_EQUAL),
+ eConnect(SC_AND),
+ pStr(new String),
+ nVal(0.0),
+ pSearchParam(NULL),
+ pSearchText(NULL)
+{
+}
+
+ScQueryEntry::ScQueryEntry(const ScQueryEntry& r) :
+ bDoQuery(r.bDoQuery),
+ bQueryByString(r.bQueryByString),
+ bQueryByDate(r.bQueryByDate),
+ nField(r.nField),
+ eOp(r.eOp),
+ eConnect(r.eConnect),
+ pStr(new String(*r.pStr)),
+ nVal(r.nVal),
+ pSearchParam(NULL),
+ pSearchText(NULL)
{
- bDoQuery = FALSE;
- bQueryByString = FALSE;
- eOp = SC_EQUAL;
- eConnect = SC_AND;
- nField = 0;
- nVal = 0.0;
- pStr = new String;
- pSearchParam = NULL;
- pSearchText = NULL;
-}
-
-ScQueryEntry::ScQueryEntry(const ScQueryEntry& r)
-{
- bDoQuery = r.bDoQuery;
- bQueryByString = r.bQueryByString;
- eOp = r.eOp;
- eConnect = r.eConnect;
- nField = r.nField;
- nVal = r.nVal;
- pStr = new String(*r.pStr);
- pSearchParam = NULL;
- pSearchText = NULL;
}
ScQueryEntry::~ScQueryEntry()
@@ -185,6 +187,7 @@ ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r )
{
bDoQuery = r.bDoQuery;
bQueryByString = r.bQueryByString;
+ bQueryByDate = r.bQueryByDate;
eOp = r.eOp;
eConnect = r.eConnect;
nField = r.nField;
@@ -205,6 +208,7 @@ void ScQueryEntry::Clear()
{
bDoQuery = FALSE;
bQueryByString = FALSE;
+ bQueryByDate = false;
eOp = SC_EQUAL;
eConnect = SC_AND;
nField = 0;
@@ -223,6 +227,7 @@ BOOL ScQueryEntry::operator==( const ScQueryEntry& r ) const
{
return bDoQuery == r.bDoQuery
&& bQueryByString == r.bQueryByString
+ && bQueryByDate == r.bQueryByDate
&& eOp == r.eOp
&& eConnect == r.eConnect
&& nField == r.nField
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 09a9f41929b5..90993367dde6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -31,6 +31,7 @@
#include <rtl/math.hxx>
#include <unotools/textsearch.hxx>
#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
#include <unotools/charclass.hxx>
#include <unotools/collatorwrapper.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp>
@@ -989,6 +990,35 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
}
else
nCellVal = GetValue( static_cast<SCCOL>(rEntry.nField), nRow );
+
+ /* NOTE: lcl_PrepareQuery() prepares a filter query such that if a
+ * date+time format was queried rEntry.bQueryByDate is not set. In
+ * case other queries wanted to use this mechanism they should do
+ * the same, in other words only if rEntry.nVal is an integer value
+ * rEntry.bQueryByDate should be true and the time fraction be
+ * stripped here. */
+ if (rEntry.bQueryByDate)
+ {
+ sal_uInt32 nNumFmt = GetNumberFormat(static_cast<SCCOL>(rEntry.nField), nRow);
+ const SvNumberformat* pEntry = pDocument->GetFormatTable()->GetEntry(nNumFmt);
+ if (pEntry)
+ {
+ short nNumFmtType = pEntry->GetType();
+ /* NOTE: Omitting the check for absence of
+ * NUMBERFORMAT_TIME would include also date+time formatted
+ * values of the same day. That may be desired in some
+ * cases, querying all time values of a day, but confusing
+ * in other cases. A user can always setup a standard
+ * filter query for x >= date AND x < date+1 */
+ if ((nNumFmtType & NUMBERFORMAT_DATE) && !(nNumFmtType & NUMBERFORMAT_TIME))
+ {
+ // The format is of date type. Strip off the time
+ // element.
+ nCellVal = ::rtl::math::approxFloor(nCellVal);
+ }
+ }
+ }
+
switch (rEntry.eOp)
{
case SC_EQUAL :
@@ -1393,6 +1423,23 @@ static void lcl_PrepareQuery( ScDocument* pDoc, ScTable* pTab, ScQueryParam& rPa
sal_uInt32 nIndex = 0;
rEntry.bQueryByString = !( pDoc->GetFormatTable()->
IsNumberFormat( *rEntry.pStr, nIndex, rEntry.nVal ) );
+ if (rEntry.bQueryByDate)
+ {
+ if (!rEntry.bQueryByString && ((nIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0))
+ {
+ const SvNumberformat* pEntry = pDoc->GetFormatTable()->GetEntry(nIndex);
+ if (pEntry)
+ {
+ short nNumFmtType = pEntry->GetType();
+ if (!((nNumFmtType & NUMBERFORMAT_DATE) && !(nNumFmtType & NUMBERFORMAT_TIME)))
+ rEntry.bQueryByDate = false; // not a date only
+ }
+ else
+ rEntry.bQueryByDate = false; // what the ... not a date
+ }
+ else
+ rEntry.bQueryByDate = false; // not a date
+ }
}
else
{
@@ -1776,12 +1823,13 @@ BOOL ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL /* nEndCol *
return TRUE;
}
-void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings)
+void ScTable::GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates)
{
- aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings );
+ aCol[nCol].GetFilterEntries( nRow1, nRow2, rStrings, rHasDates );
}
-void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings )
+void ScTable::GetFilteredFilterEntries(
+ SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates )
{
// remove the entry for this column from the query parameter
ScQueryParam aParam( rParam );
@@ -1799,15 +1847,18 @@ void ScTable::GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, co
BOOL* pSpecial = new BOOL[nEntryCount];
lcl_PrepareQuery( pDocument, this, aParam, pSpecial );
-
+ bool bHasDates = false;
for ( SCROW j = nRow1; j <= nRow2; ++j )
{
if ( ValidQuery( j, aParam, pSpecial ) )
{
- aCol[nCol].GetFilterEntries( j, j, rStrings );
+ bool bThisHasDates = false;
+ aCol[nCol].GetFilterEntries( j, j, rStrings, bThisHasDates );
+ bHasDates |= bThisHasDates;
}
}
+ rHasDates = bHasDates;
delete[] pSpecial;
}
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 2394bfb56799..2075129e4f6e 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -171,6 +171,7 @@ private:
short nFuncFmtType; // NumberFormatType of a function
short nCurFmtType; // current NumberFormatType
short nRetFmtType; // NumberFormatType of an expression
+ USHORT mnStringNoValueError; // the error set in ConvertStringToValue() if no value
BOOL glSubTotal; // flag for subtotal functions
BYTE cPar; // current count of parameters
BOOL bCalcAsShown; // precision as shown
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index 4eea4db97a0a..7f94cb64c827 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -155,6 +155,7 @@ ScDBData::ScDBData( const ScDBData& rData ) :
nQueryField[i] = rData.nQueryField[i];
eQueryOp[i] = rData.eQueryOp[i];
bQueryByString[i] = rData.bQueryByString[i];
+ bQueryByDate[i] = rData.bQueryByDate[i];
pQueryStr[i] = new String( *(rData.pQueryStr[i]) );
nQueryVal[i] = rData.nQueryVal[i];
eQueryConnect[i] = rData.eQueryConnect[i];
@@ -244,6 +245,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData)
nQueryField[i] = rData.nQueryField[i];
eQueryOp[i] = rData.eQueryOp[i];
bQueryByString[i] = rData.bQueryByString[i];
+ bQueryByDate[i] = rData.bQueryByDate[i];
*pQueryStr[i] = *rData.pQueryStr[i];
nQueryVal[i] = rData.nQueryVal[i];
eQueryConnect[i] = rData.eQueryConnect[i];
@@ -512,6 +514,7 @@ void ScDBData::GetQueryParam( ScQueryParam& rQueryParam ) const
rEntry.nField = nQueryField[i];
rEntry.eOp = eQueryOp[i];
rEntry.bQueryByString = bQueryByString[i];
+ rEntry.bQueryByDate = bQueryByDate[i];
*rEntry.pStr = *pQueryStr[i];
rEntry.nVal = nQueryVal[i];
rEntry.eConnect = eQueryConnect[i];
@@ -543,6 +546,7 @@ void ScDBData::SetQueryParam(const ScQueryParam& rQueryParam)
nQueryField[i] = rEntry.nField;
eQueryOp[i] = rEntry.eOp;
bQueryByString[i] = rEntry.bQueryByString;
+ bQueryByDate[i] = rEntry.bQueryByDate;
*pQueryStr[i] = *rEntry.pStr;
nQueryVal[i] = rEntry.nVal;
eQueryConnect[i] = rEntry.eConnect;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 94cd5c1a02e9..30aa0b8aa13e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2488,7 +2488,14 @@ void ScInterpreter::ScN()
Pop();
}
else
+ {
+ // Temporarily override the ConvertStringToValue() error for
+ // GetCellValue() / GetCellValueOrZero()
+ USHORT nSErr = mnStringNoValueError;
+ mnStringNoValueError = errCellNoValue;
fVal = GetDouble();
+ mnStringNoValueError = nSErr;
+ }
if ( nGlobalError == NOTAVAILABLE || nGlobalError == errIllegalArgument )
nGlobalError = 0; // N(#NA) and N("text") are ok
if ( !nGlobalError && nErr != NOTAVAILABLE )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index ffba9aafc511..c576cd5ca6c3 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -261,7 +261,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
while (p < pStop && *p == ' ')
++p;
if (p < pStop)
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
break;
case '-':
case ':':
@@ -281,7 +281,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
while (p < pStop && *p == ' ')
++p;
if (p < pStop && !CharClass::isAsciiDigit(*p))
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
p = pLastStart;
while (p < pStop && !nGlobalError && eState < blank)
{
@@ -291,7 +291,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
{
// Maximum 2 digits per unit, except fractions.
if (p - pLastStart >= 2 && eState != fraction)
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
}
else if (p > pLastStart)
{
@@ -300,7 +300,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
{
nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32();
if (nLimit[eState] && nLimit[eState] < nUnit[eState])
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
}
pLastStart = p + 1; // hypothetical next start
// Delimiters must match, a trailing delimiter
@@ -311,11 +311,11 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
// Month must be followed by separator and
// day, no trailing blanks.
if (*p != '-' || (p+1 == pStop))
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
break;
case day:
if ((*p != 'T' || (p+1 == pStop)) && *p != ' ')
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
// Take one blank as a valid delimiter
// between date and time.
break;
@@ -323,17 +323,17 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
// Hour must be followed by separator and
// minute, no trailing blanks.
if (*p != ':' || (p+1 == pStop))
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
break;
case minute:
if ((*p != ':' || (p+1 == pStop)) && *p != ' ')
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
if (*p == ' ')
eState = done;
break;
case second:
if (((*p != ',' && *p != '.') || (p+1 == pStop)) && *p != ' ')
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
if (*p == ' ')
eState = done;
break;
@@ -344,13 +344,13 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
case done:
case blank:
case stop:
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
break;
}
eState = static_cast<State>(eState + 1);
}
else
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
++p;
}
if (eState == blank)
@@ -358,14 +358,14 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
while (p < pStop && *p == ' ')
++p;
if (p < pStop)
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
eState = stop;
}
// Month without day, or hour without minute.
if (eState == month || (eState == day && p <= pLastStart) ||
eState == hour || (eState == minute && p <= pLastStart))
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
if (!nGlobalError)
{
@@ -374,10 +374,10 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
{
nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32();
if (nLimit[eState] && nLimit[eState] < nUnit[eState])
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
}
if (bDate && nUnit[hour] > 23)
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
if (!nGlobalError)
{
if (bDate && nUnit[day] == 0)
@@ -396,7 +396,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
}
break;
default:
- SetError( errNoValue);
+ SetError( mnStringNoValueError);
}
if (nGlobalError)
fValue = 0.0;
@@ -3549,6 +3549,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
pTokenMatrixMap( NULL ),
pMyFormulaCell( pCell ),
pFormatter( pDoc->GetFormatTable() ),
+ mnStringNoValueError( errNoValue),
bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index e424ad2d95fe..45959130defc 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -271,6 +271,17 @@ void ImportExcel8::ReadBasic( void )
{
SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
bool bAsComment = !bLoadExecutable;
+ if ( !bAsComment )
+ {
+ uno::Any aGlobs;
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= pShell->GetModel();
+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
+ pShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
+ if ( pAppMgr )
+ pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
+ }
aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
}
}
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 2716dc216ed1..7b0652e7cce9 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2562,8 +2562,9 @@ void ScHTMLTable::SetDocSize( ScHTMLOrient eOrient, SCCOLROW nCellPos, SCCOLROW
while( nIndex >= rSizes.size() )
rSizes.push_back( rSizes.empty() ? 1 : (rSizes.back() + 1) );
// update size of passed position and all following
+ // #i109987# only grow, don't shrink - use the largest needed size
SCsCOLROW nDiff = nSize - ((nIndex == 0) ? rSizes.front() : (rSizes[ nIndex ] - rSizes[ nIndex - 1 ]));
- if( nDiff != 0 )
+ if( nDiff > 0 )
for( ScSizeVec::iterator aIt = rSizes.begin() + nIndex, aEnd = rSizes.end(); aIt != aEnd; ++aIt )
*aIt += nDiff;
}
diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx
index 66b1c2579dd4..947c1370fa4b 100644
--- a/sc/source/filter/xml/sheetdata.cxx
+++ b/sc/source/filter/xml/sheetdata.cxx
@@ -43,7 +43,8 @@
ScSheetSaveData::ScSheetSaveData() :
mnStartTab( -1 ),
mnStartOffset( -1 ),
- maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) )
+ maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) ),
+ mbInSupportedSave( false )
{
}
@@ -270,3 +271,13 @@ bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) cons
return true; // success
}
+bool ScSheetSaveData::IsInSupportedSave() const
+{
+ return mbInSupportedSave;
+}
+
+void ScSheetSaveData::SetInSupportedSave( bool bSet )
+{
+ mbInSupportedSave = bSet;
+}
+
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index fde7f00bb05a..f21ed7d55ac2 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -78,6 +78,8 @@
#include "globstr.hrc"
#include "scerrors.hxx"
#include "XMLExportSharedData.hxx"
+#include "docuno.hxx"
+#include "sheetdata.hxx"
#define MAP_LEN(x) x, sizeof(x) - 1
@@ -738,16 +740,23 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic
uno::Reference<embed::XStorage> xTmpStorage = rDoc.GetDocumentShell()->GetStorage();
uno::Reference<io::XStream> xSrcStream;
uno::Reference<io::XInputStream> xSrcInput;
- try
- {
- if (xTmpStorage.is())
- xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ );
- if (xSrcStream.is())
- xSrcInput = xSrcStream->getInputStream();
- }
- catch (uno::Exception&)
+
+ // #i108978# If an embedded object is saved and no events are notified, don't use the stream
+ // because without the ...DONE events, stream positions aren't updated.
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xModel)->GetSheetSaveData();
+ if (pSheetData && pSheetData->IsInSupportedSave())
{
- // stream not available (for example, password protected) - save normally (xSrcInput is null)
+ try
+ {
+ if (xTmpStorage.is())
+ xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ );
+ if (xSrcStream.is())
+ xSrcInput = xSrcStream->getInputStream();
+ }
+ catch (uno::Exception&)
+ {
+ // stream not available (for example, password protected) - save normally (xSrcInput is null)
+ }
}
pExport->SetSourceStream( xSrcInput );
@@ -755,7 +764,10 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic
pExport->SetSourceStream( uno::Reference<io::XInputStream>() );
// If there was an error, reset all stream flags, so the next save attempt will use normal saving.
- if (!bRet)
+ // #i110692# For embedded objects, the stream may be unavailable for one save operation (m_pAntiImpl)
+ // and become available again later. But after saving normally once, the stream positions aren't
+ // valid anymore, so the flags also have to be reset if the stream wasn't available.
+ if ( !bRet || !xSrcInput.is() )
{
SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 485ea4b88589..40b65ce401ad 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -189,6 +189,14 @@ handle_r1c1:
if ( (nFlags & SCA_TAB2_3D) == 0 )
aRange.aEnd.SetTab( aRange.aStart.Tab() );
+ if ( ( nFlags & ( SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2 ) ) == 0 )
+ {
+ // #i73766# if a single ref was parsed, set the same "abs" flags for ref2,
+ // so Format doesn't output a double ref because of different flags.
+ USHORT nAbsFlags = nFlags & ( SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE );
+ nFlags |= nAbsFlags << 4;
+ }
+
if (!nCount)
{
pEngine->SetUpdateMode( FALSE );
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 56878f623828..b5dd2f3242c2 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -448,24 +448,27 @@ void ScFilterDlg::UpdateValueList( USHORT nList )
SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
if (!pEntryLists[nColumn])
{
+ USHORT nOffset = GetSliderPos();
SCTAB nTab = nSrcTab;
SCROW nFirstRow = theQueryData.nRow1;
SCROW nLastRow = theQueryData.nRow2;
+ mbHasDates[nOffset+nList-1] = false;
// erstmal ohne die erste Zeile
pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
pDoc->GetFilterEntriesArea( nColumn, nFirstRow+1, nLastRow,
- nTab, *pEntryLists[nColumn] );
+ nTab, *pEntryLists[nColumn], mbHasDates[nOffset+nList-1] );
// Eintrag fuer die erste Zeile
//! Eintrag (pHdrEntry) ohne Collection erzeugen?
nHeaderPos[nColumn] = USHRT_MAX;
TypedScStrCollection aHdrColl( 1, 1 );
+ bool bDummy = false;
pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nFirstRow,
- nTab, aHdrColl );
+ nTab, aHdrColl, bDummy );
TypedStrData* pHdrEntry = aHdrColl[0];
if ( pHdrEntry )
{
@@ -1061,7 +1064,8 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, ComboBox*, pEd )
static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectEntryPos();
- rEntry.eOp = eOp;
+ rEntry.eOp = eOp;
+ rEntry.bQueryByDate = mbHasDates[nQE];
}
}
diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk
index 2d4fa71f690e..1e7000d0cb07 100644
--- a/sc/source/ui/dbgui/makefile.mk
+++ b/sc/source/ui/dbgui/makefile.mk
@@ -106,7 +106,6 @@ LIB1OBJFILES = \
$(SLO)$/expftext.obj \
$(SLO)$/fieldwnd.obj \
$(SLO)$/pvlaydlg.obj \
- $(SLO)$/pvfundlg.obj \
$(SLO)$/consdlg.obj \
$(SLO)$/imoptdlg.obj \
$(SLO)$/csvsplits.obj \
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index cde18fcc3b52..d590ffb83457 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -349,11 +349,12 @@ void ScPivotFilterDlg::UpdateValueList( USHORT nList )
SCROW nFirstRow = theQueryData.nRow1;
SCROW nLastRow = theQueryData.nRow2;
nFirstRow++;
+ bool bHasDates = false;
pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nLastRow,
- nTab, *pEntryLists[nColumn] );
+ nTab, *pEntryLists[nColumn], bHasDates );
}
TypedScStrCollection* pColl = pEntryLists[nColumn];
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 03de0b8914a3..6b04993ba0bc 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -28,6 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+#undef SC_DLLIMPLEMENTATION
+
#include "pvfundlg.hxx"
#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 5fdf386323d9..1ee02badefe1 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -581,7 +581,7 @@ void ScTPValidationValue::TidyListBoxes()
pWnd = GetChild(0);
- while( std::find( alstOrder.begin(), alstOrder.end(), pWnd ) != alstOrder.end() && NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT) ) );
+ while( std::find( alstOrder.begin(), alstOrder.end(), pWnd ) != alstOrder.end() && NULL != ( pWnd = pWnd->GetWindow( WINDOW_NEXT) ) ) ;
if ( pWnd )
{
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 821b2a6ad880..135bbcdace49 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -356,6 +356,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
}
else
aDocument.SetInsertingFromOtherDoc( FALSE );
+#if 0 // disable load of vba related libraries
// add vba globals ( if they are availabl )
uno::Any aGlobs;
uno::Sequence< uno::Any > aArgs(1);
@@ -376,7 +377,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet)
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
if ( pAppMgr )
pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-
+#endif
aDocument.SetImportingXML( FALSE );
aDocument.EnableExecuteLink( true );
aDocument.EnableUndo( TRUE );
@@ -767,19 +768,38 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( !bSuccess )
SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
}
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(true);
}
break;
+ case SFX_EVENT_SAVEASDOC:
+ case SFX_EVENT_SAVETODOC:
+ // #i108978# If no event is sent before saving, there will also be no "...DONE" event,
+ // and SAVE/SAVEAS can't be distinguished from SAVETO. So stream copying is only enabled
+ // if there is a SAVE/SAVEAS/SAVETO event first.
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(true);
+ break;
case SFX_EVENT_SAVEDOCDONE:
{
if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
{
}
UseSheetSaveEntries(); // use positions from saved file for next saving
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
}
break;
case SFX_EVENT_SAVEASDOCDONE:
// new positions are used after "save" and "save as", but not "save to"
UseSheetSaveEntries(); // use positions from saved file for next saving
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
+ break;
+ case SFX_EVENT_SAVETODOCDONE:
+ // only reset the flag, don't use the new positions
+ if (pSheetSaveData)
+ pSheetSaveData->SetInSupportedSave(false);
break;
default:
{
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 4b76c18edbe6..9e3ed217382f 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -102,6 +102,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt
InitItems();
CalcOutputFactor();
+#if 0
uno::Any aGlobs;
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= GetModel();
@@ -121,6 +122,7 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
if ( pAppMgr )
pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
+#endif
return bRet;
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 1bbf9437bc1c..061ece5efc90 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -97,8 +97,9 @@ void ScDocShell::ErrorMessage( USHORT nGlobStrId )
BOOL ScDocShell::IsEditable() const
{
// import into read-only document is possible - must be extended if other filters use api
+ // #i108547# MSOOXML filter uses "IsChangeReadOnlyEnabled" property
- return !IsReadOnly() || aDocument.IsImportingXML();
+ return !IsReadOnly() || aDocument.IsImportingXML() || aDocument.IsChangeReadOnlyEnabled();
}
void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW /* nY2 */ )
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 068a48b8d689..31e0e3a5d4b1 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -164,6 +164,7 @@ private:
ListBox* aFieldLbArr[4];
ListBox* aCondLbArr[4];
ListBox* aConnLbArr[4];
+ bool mbHasDates[MAXQUERY];
BOOL bRefreshExceptQuery[MAXQUERY];
USHORT nFieldCount;
BOOL bRefInputMode;
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 149498a8314d..4d6ef782aed6 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -215,7 +215,7 @@ private:
BOOL IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab );
void ExecFilter( ULONG nSel, SCCOL nCol, SCROW nRow,
- const String& aValue );
+ const String& aValue, bool bCheckForDates );
void FilterSelect( ULONG nSel );
void ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr );
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 18adf9883373..2f5a2d8c88fb 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -1024,7 +1024,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "An interger between 1583 and 9956, or 0 and 99 (19xx or 20xx depending on the option set).";
+ Text [ en-US ] = "An integer between 1583 and 9956, or 0 and 99 (19xx or 20xx depending on the option set).";
};
};
// -=*# Resource for function BW #*=-
@@ -1576,7 +1576,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
{
String 1 // Description
{
- Text [ en-US ] = "Calulates the arithmetically declining value of an asset (depreciation) for a specified period." ;
+ Text [ en-US ] = "Calculates the arithmetically declining value of an asset (depreciation) for a specified period." ;
};
ExtraData =
{
@@ -4064,7 +4064,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
{
String 1 // Description
{
- Text [ en-US ] = "Array transposition. Exchanges the rows and columns of an aray." ;
+ Text [ en-US ] = "Array transposition. Exchanges the rows and columns of an array." ;
};
ExtraData =
{
@@ -4724,7 +4724,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population.";
+ Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population.";
};
};
// -=*# Resource for function VARIANZEN #*=-
@@ -4820,7 +4820,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population.";
+ Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population.";
};
};
// -=*# Resource for function STABWN #*=-
@@ -4916,7 +4916,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "Value 1; value 2;.. .are 1 to 30 arguments representing a sample taken from a basic total population.";
+ Text [ en-US ] = "Value 1; value 2; ... are 1 to 30 arguments representing a sample taken from a basic total population.";
};
};
// -=*# Resource for function SUMQUADABW #*=-
@@ -6358,7 +6358,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 7 // Description of Parameter 3
{
- Text [ en-US ] = "Mode = 1calculates the one-tailed test, 2 = two-tailed distribution." ;
+ Text [ en-US ] = "Mode = 1 calculates the one-tailed test, 2 = two-tailed distribution." ;
};
};
// -=*# Resource for function TINV #*=-
@@ -7525,7 +7525,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 9 // Description of Parameter 4
{
- Text [ en-US ] = "if the value is TRUE or not given, the search column of the array must be sorted in ascending order." ;
+ Text [ en-US ] = "If the value is TRUE or not given, the search column of the array must be sorted in ascending order." ;
};
};
// -=*# Resource for function INDEX #*=-
@@ -8397,7 +8397,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
{
String 1 // Description
{
- Text [ en-US ] = "Converts a value into text." ;
+ Text [ en-US ] = "Returns a value if it is text, otherwise an empty string." ;
};
ExtraData =
{
@@ -8413,7 +8413,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "The value to be converted." ;
+ Text [ en-US ] = "The value to be checked and returned if it is text." ;
};
};
// -=*# Resource for function ERSETZEN #*=-
@@ -8709,7 +8709,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 9 // Description of Parameter 4
{
- Text [ en-US ] = "Which occurence of the old text is to be replaced." ;
+ Text [ en-US ] = "Which occurrence of the old text is to be replaced." ;
};
};
// -=*# Resource for function BASIS #*=-
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 4eddb447e8a9..d563dea095dd 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -7912,7 +7912,8 @@ void SAL_CALL ScTableSheetObj::protect( const rtl::OUString& aPassword )
{
ScUnoGuard aGuard;
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh )
+ // #i108245# if already protected, don't change anything
+ if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
{
String aString(aPassword);
ScDocFunc aFunc(*pDocSh);
@@ -7929,9 +7930,9 @@ void SAL_CALL ScTableSheetObj::unprotect( const rtl::OUString& aPassword )
{
String aString(aPassword);
ScDocFunc aFunc(*pDocSh);
- aFunc.Unprotect( GetTab_Impl(), aString, TRUE );
-
- //! Rueckgabewert auswerten, Exception oder so
+ BOOL bDone = aFunc.Unprotect( GetTab_Impl(), aString, TRUE );
+ if (!bDone)
+ throw lang::IllegalArgumentException();
}
}
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 7e23d6b2f9f5..c7bf89671161 100755
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1891,9 +1891,10 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa
String aNameString(aPropertyName);
if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) )
{
- GeneralFunction eFunction = GeneralFunction_NONE;
- if( aValue >>= eFunction )
- setFunction( eFunction );
+ // #i109350# use GetEnumFromAny because it also allows sal_Int32
+ GeneralFunction eFunction = (GeneralFunction)
+ ScUnoHelpFunctions::GetEnumFromAny( aValue );
+ setFunction( eFunction );
}
else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) )
{
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 8e857adca09c..85c17f868b0a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1392,7 +1392,8 @@ void SAL_CALL ScModelObj::enableAutomaticCalculation( sal_Bool bEnabled )
void SAL_CALL ScModelObj::protect( const rtl::OUString& aPassword ) throw(uno::RuntimeException)
{
ScUnoGuard aGuard;
- if (pDocShell)
+ // #i108245# if already protected, don't change anything
+ if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() )
{
String aString(aPassword);
@@ -1410,9 +1411,9 @@ void SAL_CALL ScModelObj::unprotect( const rtl::OUString& aPassword )
String aString(aPassword);
ScDocFunc aFunc(*pDocShell);
- aFunc.Unprotect( TABLEID_DOC, aString, TRUE );
-
- //! Rueckgabewert auswerten, Exception oder so
+ BOOL bDone = aFunc.Unprotect( TABLEID_DOC, aString, TRUE );
+ if (!bDone)
+ throw lang::IllegalArgumentException();
}
}
@@ -2074,6 +2075,13 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
}
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( SfxObjectShell::getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
+ }
+
// aggregated number formats supplier has XUnoTunnel, too
// interface from aggregated object must be obtained via queryAggregation
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 0c57963a4f12..956c659f9b15 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -65,6 +65,10 @@
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <svx/unomod.hxx>
+#include <comphelper/processfactory.hxx>
+#include <basic/basmgr.hxx>
+#include <sfx2/app.hxx>
+
using namespace ::com::sun::star;
class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
@@ -183,6 +187,7 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
{ "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
{ "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
+ { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
};
//
@@ -236,6 +241,7 @@ static const sal_Char* __FAR_DATA aOldNames[SC_SERVICE_COUNT] =
"", // SC_SERVICE_FORMULAPARS
"", // SC_SERVICE_OPCODEMAPPER
"", // SC_SERVICE_VBACODENAMEPROVIDER
+ "", // SC_SERVICE_VBAGLOBALS
};
@@ -453,6 +459,25 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
}
break;
}
+ case SC_SERVICE_VBAGLOBALS:
+ {
+ uno::Any aGlobs;
+ ScDocument* pDoc = pDocShell->GetDocument();
+ if ( pDoc )
+ {
+ if ( !pDocShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
+ {
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= pDocShell->GetModel();
+ aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
+ pDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
+ if ( pAppMgr )
+ pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
+ }
+ aGlobs >>= xRet;
+ }
+ }
}
return xRet;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b8eeb868809e..87740a88e4df 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -165,6 +165,7 @@ private:
BOOL bInit;
BOOL bCancelled;
BOOL bInSelect;
+ bool mbListHasDates;
ULONG nSel;
ScFilterBoxMode eMode;
@@ -188,6 +189,8 @@ public:
BOOL IsInInit() const { return bInit; }
void SetCancelled() { bCancelled = TRUE; }
BOOL IsInSelect() const { return bInSelect; }
+ void SetListHasDates(bool b) { mbListHasDates = b; }
+ bool HasDates() const { return mbListHasDates; }
};
//-------------------------------------------------------------------
@@ -203,6 +206,7 @@ ScFilterListBox::ScFilterListBox( Window* pParent, ScGridWindow* pGrid,
bInit( TRUE ),
bCancelled( FALSE ),
bInSelect( FALSE ),
+ mbListHasDates(false),
nSel( 0 ),
eMode( eNewMode )
{
@@ -907,7 +911,9 @@ void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect )
pFilterBox->SetSeparatorPos( nDefCount - 1 );
// get list entries
- pDoc->GetFilterEntries( nCol, nRow, nTab, aStrings, true );
+ bool bHasDates = false;
+ pDoc->GetFilterEntries( nCol, nRow, nTab, true, aStrings, bHasDates);
+ pFilterBox->SetListHasDates(bHasDates);
// check widths of numerical entries (string entries are not included)
// so all numbers are completely visible
@@ -1117,7 +1123,7 @@ void ScGridWindow::FilterSelect( ULONG nSel )
ExecDataSelect( nCol, nRow, aString );
break;
case SC_FILTERBOX_FILTER:
- ExecFilter( nSel, nCol, nRow, aString );
+ ExecFilter( nSel, nCol, nRow, aString, pFilterBox->HasDates() );
break;
case SC_FILTERBOX_SCENARIO:
pViewData->GetView()->UseScenario( aString );
@@ -1150,7 +1156,7 @@ void ScGridWindow::ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr )
void ScGridWindow::ExecFilter( ULONG nSel,
SCCOL nCol, SCROW nRow,
- const String& aValue )
+ const String& aValue, bool bCheckForDates )
{
SCTAB nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument();
@@ -1222,6 +1228,7 @@ void ScGridWindow::ExecFilter( ULONG nSel,
rNewEntry.bDoQuery = TRUE;
rNewEntry.bQueryByString = TRUE;
rNewEntry.nField = nCol;
+ rNewEntry.bQueryByDate = bCheckForDates;
if ( nSel == SC_AUTOFILTER_TOP10 )
{
rNewEntry.eOp = SC_TOPVAL;