summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/attarray.hxx2
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/rangelst.hxx4
-rw-r--r--sc/inc/scmatrix.hxx7
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/attarray.cxx40
-rw-r--r--sc/source/core/data/column.cxx2
-rw-r--r--sc/source/core/data/document.cxx12
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sc/source/core/tool/address.cxx4
-rw-r--r--sc/source/core/tool/rangelst.cxx31
-rw-r--r--sc/source/core/tool/scmatrix.cxx13
-rw-r--r--sc/source/filter/excel/excform.cxx6
-rw-r--r--sc/source/filter/excel/excform8.cxx5
-rw-r--r--sc/source/filter/excel/tokstack.cxx5
-rw-r--r--sc/source/filter/excel/xicontent.cxx24
-rw-r--r--sc/source/filter/inc/tokstack.hxx2
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx9
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx3
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/inc/hdrcont.hxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx30
-rw-r--r--sc/source/ui/view/hdrcont.cxx61
24 files changed, 183 insertions, 95 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 6d7b7f48c2d7..c82d607577bf 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -148,7 +148,7 @@ public:
BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
BOOL bLeft, BOOL bRight ) const;
- BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
SCCOL& rPaintCol, SCROW& rPaintRow,
BOOL bRefresh, BOOL bAttrs );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 5692ab1e3b13..85567a2a656d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -142,7 +142,7 @@ public:
//UNUSED2009-05 BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const;
- BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
SCCOL& rPaintCol, SCROW& rPaintRow,
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c053c27047d4..84c1eb9ce69f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -824,9 +824,9 @@ public:
BOOL IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
BOOL IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
- SC_DLLPUBLIC BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
- SC_DLLPUBLIC BOOL HasAttrib( const ScRange& rRange, USHORT nMask );
+ SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+ SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask );
+ SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, USHORT nMask );
void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab,
const SvxBorderLine** ppLeft,
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 2350cea085f0..51555decaa5b 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -55,10 +55,10 @@ public:
USHORT Parse( const String&, ScDocument* = NULL,
USHORT nMask = SCA_VALID,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
- char cDelimiter = 0 );
+ sal_Unicode cDelimiter = 0 );
void Format( String&, USHORT nFlags = 0, ScDocument* = NULL,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
- char cDelimiter = 0 ) const;
+ sal_Unicode cDelimiter = 0 ) const;
void Join( const ScRange&, BOOL bIsInList = FALSE );
BOOL UpdateReference( UpdateRefMode, ScDocument*,
const ScRange& rWhere,
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 494ab86b0c74..9857d675b7ab 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -103,6 +103,7 @@ class SC_DLLPUBLIC ScMatrix
void ResetIsString();
void DeleteIsString();
void CreateMatrix( SCSIZE nC, SCSIZE nR);
+ void Clear();
// pStr may be NULL, bFlag MUST NOT be 0
void PutStringEntry( const String* pStr, BYTE bFlag, SCSIZE nIndex );
@@ -175,6 +176,12 @@ public:
/** Clone the matrix. */
ScMatrix* Clone() const;
+ /**
+ * Resize the matrix to specified new dimension. Note that this operation
+ * clears all stored values.
+ */
+ void Resize( SCSIZE nC, SCSIZE nR);
+
/** Clone the matrix and extend it to the new size. nNewCols and nNewRows
MUST be at least of the size of the original matrix. */
ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7811d6aa50b6..0311c5093c4c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -469,7 +469,7 @@ public:
const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
//UNUSED2009-05 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
- BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
+ bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const;
BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const;
BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
SCCOL& rEndCol, SCROW& rEndRow,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 67be752fd8c8..53df13b4cd62 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1228,13 +1228,13 @@ BOOL ScAttrArray::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
// Testen, ob Bereich bestimmtes Attribut enthaelt
-BOOL ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
+bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
{
SCSIZE nStartIndex;
SCSIZE nEndIndex;
Search( nRow1, nStartIndex );
Search( nRow2, nEndIndex );
- BOOL bFound = FALSE;
+ bool bFound = false;
for (SCSIZE i=nStartIndex; i<=nEndIndex && !bFound; i++)
{
@@ -1244,46 +1244,46 @@ BOOL ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
const ScMergeAttr* pMerge =
(const ScMergeAttr*) &pPattern->GetItem( ATTR_MERGE );
if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & ( HASATTR_OVERLAPPED | HASATTR_NOTOVERLAPPED | HASATTR_AUTOFILTER ) )
{
const ScMergeFlagAttr* pMergeFlag =
(const ScMergeFlagAttr*) &pPattern->GetItem( ATTR_MERGE_FLAG );
if ( (nMask & HASATTR_OVERLAPPED) && pMergeFlag->IsOverlapped() )
- bFound = TRUE;
+ bFound = true;
if ( (nMask & HASATTR_NOTOVERLAPPED) && !pMergeFlag->IsOverlapped() )
- bFound = TRUE;
+ bFound = true;
if ( (nMask & HASATTR_AUTOFILTER) && pMergeFlag->HasAutoFilter() )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_LINES )
{
const SvxBoxItem* pBox =
(const SvxBoxItem*) &pPattern->GetItem( ATTR_BORDER );
if ( pBox->GetLeft() || pBox->GetRight() || pBox->GetTop() || pBox->GetBottom() )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_SHADOW )
{
const SvxShadowItem* pShadow =
(const SvxShadowItem*) &pPattern->GetItem( ATTR_SHADOW );
if ( pShadow->GetLocation() != SVX_SHADOW_NONE )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_CONDITIONAL )
{
const SfxUInt32Item* pConditional =
(const SfxUInt32Item*) &pPattern->GetItem( ATTR_CONDITIONAL );
if ( pConditional->GetValue() != 0 )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_PROTECTED )
{
const ScProtectionAttr* pProtect =
(const ScProtectionAttr*) &pPattern->GetItem( ATTR_PROTECTION );
if ( pProtect->GetProtection() || pProtect->GetHideCell() )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_ROTATE )
{
@@ -1293,21 +1293,21 @@ BOOL ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
// (see ScPatternAttr::GetCellOrientation)
INT32 nAngle = pRotate->GetValue();
if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_NEEDHEIGHT )
{
if (pPattern->GetCellOrientation() != SVX_ORIENTATION_STANDARD)
- bFound = TRUE;
+ bFound = true;
else if (((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK )).GetValue())
- bFound = TRUE;
+ bFound = true;
else if ((SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern->
GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK)
- bFound = TRUE;
+ bFound = true;
else if (((const SfxUInt32Item&)pPattern->GetItem( ATTR_CONDITIONAL )).GetValue())
- bFound = TRUE;
+ bFound = true;
else if (((const SfxInt32Item&)pPattern->GetItem( ATTR_ROTATE_VALUE )).GetValue())
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & ( HASATTR_SHADOW_RIGHT | HASATTR_SHADOW_DOWN ) )
{
@@ -1316,17 +1316,17 @@ BOOL ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
SvxShadowLocation eLoc = pShadow->GetLocation();
if ( nMask & HASATTR_SHADOW_RIGHT )
if ( eLoc == SVX_SHADOW_TOPRIGHT || eLoc == SVX_SHADOW_BOTTOMRIGHT )
- bFound = TRUE;
+ bFound = true;
if ( nMask & HASATTR_SHADOW_DOWN )
if ( eLoc == SVX_SHADOW_BOTTOMLEFT || eLoc == SVX_SHADOW_BOTTOMRIGHT )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_RTL )
{
const SvxFrameDirectionItem& rDirection =
(const SvxFrameDirectionItem&) pPattern->GetItem( ATTR_WRITINGDIR );
if ( rDirection.GetValue() == FRMDIR_HORI_RIGHT_TOP )
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_RIGHTORCENTER )
{
@@ -1334,7 +1334,7 @@ BOOL ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
SvxCellHorJustify eHorJust = (SvxCellHorJustify)
((const SvxHorJustifyItem&) pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue();
if ( eHorJust == SVX_HOR_JUSTIFY_RIGHT || eHorJust == SVX_HOR_JUSTIFY_CENTER )
- bFound = TRUE;
+ bFound = true;
}
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 49ae4a98b1c6..ee670d5ba0ef 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -244,7 +244,7 @@ BOOL ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
//UNUSED2009-05 }
-BOOL ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
+bool ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
{
return pAttrArray->HasAttrib( nRow1, nRow2, nMask );
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index aff95f1f777f..9cf68e3e309d 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3907,7 +3907,7 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark,
}
-BOOL ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
+bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, USHORT nMask )
{
if ( nMask & HASATTR_ROTATE )
@@ -3961,16 +3961,16 @@ BOOL ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
}
if (!nMask)
- return FALSE;
+ return false;
- BOOL bFound = FALSE;
+ bool bFound = false;
for (SCTAB i=nTab1; i<=nTab2 && !bFound; i++)
if (pTab[i])
{
if ( nMask & HASATTR_RTL )
{
if ( GetEditTextDirection(i) == EE_HTEXTDIR_R2L ) // sheet default
- bFound = TRUE;
+ bFound = true;
}
if ( nMask & HASATTR_RIGHTORCENTER )
{
@@ -3979,7 +3979,7 @@ BOOL ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
// That way, ScAttrArray::HasAttrib doesn't have to handle RTL sheets.
if ( IsLayoutRTL(i) )
- bFound = TRUE;
+ bFound = true;
}
if ( !bFound )
@@ -3989,7 +3989,7 @@ BOOL ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
return bFound;
}
-BOOL ScDocument::HasAttrib( const ScRange& rRange, USHORT nMask )
+bool ScDocument::HasAttrib( const ScRange& rRange, USHORT nMask )
{
return HasAttrib( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(),
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 7da9bbe8edcf..2163c3154d6a 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1190,9 +1190,9 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, S
}
-BOOL ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const
+bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const
{
- BOOL bFound=FALSE;
+ bool bFound = false;
for (SCCOL i=nCol1; i<=nCol2 && !bFound; i++)
bFound |= aCol[i].HasAttrib( nRow1, nRow2, nMask );
return bFound;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 509a9fe293fb..ccbecd52d9f2 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -634,7 +634,9 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
{
const sal_Unicode* pTmp = NULL;
String aExternDocName, aStartTabName, aEndTabName;
- USHORT nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB2;
+ USHORT nFlags = SCA_VALID | SCA_VALID_TAB;
+ // Keep in mind that nFlags2 gets left-shifted by 4 bits before being merged.
+ USHORT nFlags2 = SCA_VALID_TAB;
#if 0
{
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index d0dd8ec9c163..a631ff3c3fbb 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -41,7 +41,7 @@
#include "document.hxx"
#include "refupdat.hxx"
#include "rechead.hxx"
-
+#include "compiler.hxx"
// === ScRangeList ====================================================
@@ -58,32 +58,14 @@ void ScRangeList::RemoveAll()
Clear();
}
-static void defaultDelimiter( char& cDelimiter, formula::FormulaGrammar::AddressConvention eConv)
-{
- if( cDelimiter == 0)
- {
- switch( eConv )
- {
- default :
- case formula::FormulaGrammar::CONV_OOO :
- cDelimiter = ';';
- break;
-
- case formula::FormulaGrammar::CONV_XL_A1 :
- case formula::FormulaGrammar::CONV_XL_R1C1 :
- cDelimiter = ',';
- break;
- }
- }
-}
-
USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
formula::FormulaGrammar::AddressConvention eConv,
- char cDelimiter )
+ sal_Unicode cDelimiter )
{
if ( rStr.Len() )
{
- defaultDelimiter( cDelimiter, eConv);
+ if (!cDelimiter)
+ cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
nMask |= SCA_VALID; // falls das jemand vergessen sollte
USHORT nResult = (USHORT)~0; // alle Bits setzen
@@ -123,11 +105,12 @@ USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
void ScRangeList::Format( String& rStr, USHORT nFlags, ScDocument* pDoc,
formula::FormulaGrammar::AddressConvention eConv,
- char cDelimiter ) const
+ sal_Unicode cDelimiter ) const
{
rStr.Erase();
- defaultDelimiter( cDelimiter, eConv);
+ if (!cDelimiter)
+ cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
ULONG nCnt = Count();
for ( ULONG nIdx = 0; nIdx < nCnt; nIdx++ )
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 326fda49eb30..fbb859b64ebf 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -62,12 +62,17 @@ void ScMatrix::CreateMatrix(SCSIZE nC, SCSIZE nR) // nur fuer ctor
mnNonValue = 0;
}
-ScMatrix::~ScMatrix()
+void ScMatrix::Clear()
{
DeleteIsString();
delete [] pMat;
}
+ScMatrix::~ScMatrix()
+{
+ Clear();
+}
+
ScMatrix* ScMatrix::Clone() const
{
ScMatrix* pScMat = new ScMatrix( nColCount, nRowCount);
@@ -76,6 +81,12 @@ ScMatrix* ScMatrix::Clone() const
return pScMat;
}
+void ScMatrix::Resize( SCSIZE nC, SCSIZE nR)
+{
+ Clear();
+ CreateMatrix(nC, nR);
+}
+
ScMatrix* ScMatrix::CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows ) const
{
ScMatrix* pScMat = new ScMatrix( nNewCols, nNewRows);
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 5642c098027e..0652363e8822 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -471,10 +471,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 );
if( bAllowArrays )
{
- SCSIZE nC = nByte ? nByte : 256;
- SCSIZE nR = nUINT16;
-
- aStack << aPool.StoreMatrix( nC, nR );
+ aStack << aPool.StoreMatrix();
aExtensions.push_back( EXTENSION_ARRAY );
}
else
@@ -1892,6 +1889,7 @@ void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn )
if( NULL != pMatrix )
{
+ pMatrix->Resize(nCols, nRows);
pMatrix->GetDimensions( nC, nR);
if( nC != nCols || nR != nRows )
{
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 608d65dfc801..148b1542913a 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -392,10 +392,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
aIn.Ignore( 4 );
if( bAllowArrays )
{
- SCSIZE nC = nByte + 1;
- SCSIZE nR = nUINT16 + 1;
-
- aStack << aPool.StoreMatrix( nC, nR );
+ aStack << aPool.StoreMatrix();
aExtensions.push_back( EXTENSION_ARRAY );
}
else
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 8685f404543a..b61a844d02a5 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -737,7 +737,7 @@ const TokenId TokenPool::StoreNlf( const ScSingleRefData& rTr )
return ( const TokenId ) nElementAkt;
}
-const TokenId TokenPool::StoreMatrix( SCSIZE nC, SCSIZE nR )
+const TokenId TokenPool::StoreMatrix()
{
ScMatrix* pM;
@@ -750,8 +750,7 @@ const TokenId TokenPool::StoreMatrix( SCSIZE nC, SCSIZE nR )
pElement[ nElementAkt ] = nP_MatrixAkt;
pType[ nElementAkt ] = T_Matrix;
- pM = new ScMatrix( nC, nR );
- pM->FillDouble( 0., 0,0, nC-1, nR-1 );
+ pM = new ScMatrix( 0, 0 );
pM->IncRef( );
ppP_Matrix[ nP_MatrixAkt ] = pM;
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index e095ef987615..fb1eb9a3bf44 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -1213,7 +1213,29 @@ void XclImpSheetProtectBuffer::ReadProtect( XclImpStream& rStrm, SCTAB nTab )
void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
{
- rStrm.Ignore(19);
+ rStrm.Ignore(12);
+
+ // feature type can be either 2 or 4. If 2, this record stores flag for
+ // enhanced protection, whereas if 4 it stores flag for smart tag.
+ sal_uInt16 nFeatureType;
+ rStrm >> nFeatureType;
+ if (nFeatureType != 2)
+ // We currently only support import of enhanced protection data.
+ return;
+
+ rStrm.Ignore(1); // always 1
+
+ // The flag size specifies the size of bytes that follows that stores
+ // feature data. If -1 it depends on the feature type imported earlier.
+ // For enhanced protection data, the size is always 4. For the most xls
+ // documents out there this value is almost always -1.
+ sal_Int32 nFlagSize;
+ rStrm >> nFlagSize;
+ if (nFlagSize != -1)
+ return;
+
+ // There are actually 4 bytes to read, but the upper 2 bytes currently
+ // don't store any bits.
sal_uInt16 nOptions;
rStrm >> nOptions;
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index 80c94c729270..06a37639be89 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -207,7 +207,7 @@ class TokenPool
const TokenId Store( const DefTokenId eId, const String& rName );
// 4 externals (e.g. AddIns, Makros...)
const TokenId StoreNlf( const ScSingleRefData& rTr );
- const TokenId StoreMatrix( SCSIZE nC, SCSIZE nR );
+ const TokenId StoreMatrix();
const TokenId StoreExtName( sal_uInt16 nFileId, const String& rName );
const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 8609bfcbfb0a..03de0b8914a3 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -739,9 +739,12 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, USHOR
const ScDPSaveDimension* pDimension = pSaveData ? pSaveData->GetExistingDimensionByName(aName) : 0;
if ( !pDimension || (pDimension->GetOrientation() != nOrient) )
{
- const OUString* pLayoutName = pDimension->GetLayoutName();
- if (pLayoutName)
- aName = *pLayoutName;
+ if (pDimension)
+ {
+ const OUString* pLayoutName = pDimension->GetLayoutName();
+ if (pLayoutName)
+ aName = *pLayoutName;
+ }
maLbDims.InsertEntry( aName );
maNameIndexMap.insert(DimNameIndexMap::value_type(aName, nDim));
}
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index e0721fc47f50..f648a1484e8e 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -526,7 +526,8 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
ScRangeList aRanges;
aMultiMark.FillRangeListWithMarks( &aRanges, FALSE );
String aStr;
- aRanges.Format( aStr, SCR_ABS_3D, pViewSh->GetViewData()->GetDocument() );
+ ScDocument* pDocument = pViewSh->GetViewData()->GetDocument();
+ aRanges.Format( aStr, SCR_ABS_3D, pDocument, pDocument->GetAddressConvention() );
aRangeString = aStr;
// get "total" range for positioning
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0f8e479f6e54..149498a8314d 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -273,7 +273,7 @@ private:
void PasteSelection( const Point& rPosPixel );
- void SelectForContextMenu( const Point& rPosPixel );
+ void SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, SCsROW nCellY );
void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects );
diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx
index 02a4df09afd2..ec4dd49705d1 100644
--- a/sc/source/ui/inc/hdrcont.hxx
+++ b/sc/source/ui/inc/hdrcont.hxx
@@ -77,7 +77,7 @@ private:
long GetScrPos( SCCOLROW nEntryNo );
SCCOLROW GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder );
-
+ bool IsSelectionAllowed(SCCOLROW nPos) const;
void ShowDragHelp();
void DoPaint( SCCOLROW nStart, SCCOLROW nEnd );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index cd55e4f72c34..1b5c5d1fe5e5 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2689,9 +2689,32 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
if ( bMouse )
{
+ SCsCOL nCellX = -1;
+ SCsROW nCellY = -1;
+ pViewData->GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY);
+ ScDocument* pDoc = pViewData->GetDocument();
+ SCTAB nTab = pViewData->GetTabNo();
+ const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ bool bSelectAllowed = true;
+ if ( pProtect && pProtect->isProtected() )
+ {
+ // This sheet is protected. Check if a context menu is allowed on this cell.
+ bool bCellProtected = pDoc->HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HASATTR_PROTECTED);
+ bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if (bCellProtected)
+ bSelectAllowed = bSelProtected;
+ else
+ bSelectAllowed = bSelUnprotected;
+ }
+ if (!bSelectAllowed)
+ // Selecting this cell is not allowed, neither is context menu.
+ return;
+
// #i18735# First select the item under the mouse pointer.
// This can change the selection, and the view state (edit mode, etc).
- SelectForContextMenu( aPosPixel );
+ SelectForContextMenu( aPosPixel, nCellX, nCellY );
}
BOOL bDone = FALSE;
@@ -2786,15 +2809,12 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
}
}
-void ScGridWindow::SelectForContextMenu( const Point& rPosPixel )
+void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, SCsROW nCellY )
{
// #i18735# if the click was outside of the current selection,
// the cursor is moved or an object at the click position selected.
// (see SwEditWin::SelectMenuPosition in Writer)
- SCsCOL nCellX;
- SCsROW nCellY;
- pViewData->GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nCellX, nCellY );
ScTabView* pView = pViewData->GetView();
ScDrawView* pDrawView = pView->GetScDrawView();
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 511463db8a10..6c389d496b73 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -44,6 +44,7 @@
#include "scmod.hxx" // Optionen
#include "inputopt.hxx" // Optionen
#include "gridmerg.hxx"
+#include "document.hxx"
// -----------------------------------------------------------------------
@@ -120,7 +121,7 @@ void ScHeaderControl::SetWidth( long nNew )
}
}
-__EXPORT ScHeaderControl::~ScHeaderControl()
+ScHeaderControl::~ScHeaderControl()
{
}
@@ -262,7 +263,7 @@ void ScHeaderControl::DrawShadedRect( long nStart, long nEnd, const Color& rBase
// Paint
//
-void __EXPORT ScHeaderControl::Paint( const Rectangle& rRect )
+void ScHeaderControl::Paint( const Rectangle& rRect )
{
// fuer VCL ist es wichtig, wenig Aufrufe zu haben, darum werden die aeusseren
// Linien zusammengefasst
@@ -652,7 +653,46 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder )
return nHitNo;
}
-void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
+bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const
+{
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ if (!pViewSh)
+ return false;
+
+ ScViewData* pViewData = pViewSh->GetViewData();
+ USHORT nTab = pViewData->GetTabNo();
+ ScDocument* pDoc = pViewData->GetDocument();
+ const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ bool bSelectAllowed = true;
+ if ( pProtect && pProtect->isProtected() )
+ {
+ // This sheet is protected. Check if a context menu is allowed on this cell.
+ bool bCellsProtected = false;
+ if (bVertical)
+ {
+ // row header
+ SCROW nRPos = static_cast<SCROW>(nPos);
+ bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, MAXCOL, nRPos, nTab, HASATTR_PROTECTED);
+ }
+ else
+ {
+ // column header
+ SCCOL nCPos = static_cast<SCCOL>(nPos);
+ bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, MAXROW, nTab, HASATTR_PROTECTED);
+ }
+
+ bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+ bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+
+ if (bCellsProtected)
+ bSelectAllowed = bSelProtected;
+ else
+ bSelectAllowed = bSelUnprotected;
+ }
+ return bSelectAllowed;
+}
+
+void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
{
if (IsDisabled())
return;
@@ -662,6 +702,8 @@ void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
BOOL bFound;
SCCOLROW nHitNo = GetMousePos( rMEvt, bFound );
+ if (!IsSelectionAllowed(nHitNo))
+ return;
if ( bFound && rMEvt.IsLeft() && ResizeAllowed() )
{
@@ -717,7 +759,7 @@ void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
}
}
-void __EXPORT ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
+void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( IsDisabled() )
return;
@@ -770,7 +812,7 @@ void __EXPORT ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt )
}
}
-void __EXPORT ScHeaderControl::MouseMove( const MouseEvent& rMEvt )
+void ScHeaderControl::MouseMove( const MouseEvent& rMEvt )
{
if ( IsDisabled() )
{
@@ -820,7 +862,7 @@ void ScHeaderControl::Tracking( const TrackingEvent& rTEvt )
MouseMove( rTEvt.GetMouseEvent() );
}
-void __EXPORT ScHeaderControl::Command( const CommandEvent& rCEvt )
+void ScHeaderControl::Command( const CommandEvent& rCEvt )
{
USHORT nCmd = rCEvt.GetCommand();
if ( nCmd == COMMAND_CONTEXTMENU )
@@ -845,8 +887,11 @@ void __EXPORT ScHeaderControl::Command( const CommandEvent& rCEvt )
MouseEvent aMEvt( rCEvt.GetMousePosPixel() );
BOOL bBorder;
SCCOLROW nPos = GetMousePos( aMEvt, bBorder );
- USHORT nTab = pViewData->GetTabNo();
+ if (!IsSelectionAllowed(nPos))
+ // Selecting this cell is not allowed, neither is context menu.
+ return;
+ SCTAB nTab = pViewData->GetTabNo();
ScRange aNewRange;
if ( bVertical )
aNewRange = ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab,
@@ -935,7 +980,7 @@ void ScHeaderControl::ShowDragHelp()
}
}
-void __EXPORT ScHeaderControl::RequestHelp( const HelpEvent& rHEvt )
+void ScHeaderControl::RequestHelp( const HelpEvent& rHEvt )
{
// Wenn eigene QuickHelp angezeigt wird, nicht durch RequestHelp
// wieder wegnehmen lassen