[ooo-build-commit] patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Dec 2 15:15:42 PST 2009
patches/dev300/apply | 15
patches/dev300/calc-r1c1-parse-fix.diff | 15
patches/dev300/calc-selection-protected-cells.diff | 155 ------
patches/dev300/calc-xls-import-array-size.diff | 289 ------------
patches/dev300/calc-xls-import-sheet-protection-fix.diff | 35 -
patches/dev300/cws-kohei04-sc.diff | 342 +++++++++++++++
6 files changed, 345 insertions(+), 506 deletions(-)
New commits:
commit c7481d23a2aa414e46a1a0163884976f752b01cd
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Dec 2 18:13:47 2009 -0500
Backported kohei04 cws, and removed patches that are in that cws.
* patches/dev300/apply:
* patches/dev300/calc-r1c1-parse-fix.diff:
* patches/dev300/calc-selection-protected-cells.diff:
* patches/dev300/calc-xls-import-array-size.diff:
* patches/dev300/calc-xls-import-sheet-protection-fix.diff: these
patches have been incorporated into kohei04, hence no longer
needed.
* patches/dev300/cws-kohei04-sc.diff: backported; it includes all
of the above patches.
diff --git a/patches/dev300/apply b/patches/dev300/apply
index c293a6d..871f0ff 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -206,6 +206,9 @@ cws-koheichart02-xmloff.diff, kohei
cws-koheicopyborder-sc.diff, kohei
cws-koheicopyborder-svx.diff, kohei
+# kohei04 cws
+cws-kohei04-sc.diff, kohei
+
[ LinuxOnly ]
# Don't stat tons of config files we don't need to read on startup
speed-configmgr.diff, i#56783, michael
@@ -809,9 +812,6 @@ calc-cursor-split-view.diff, n#433834, kohei
# shrink selection to data area before setting autofilter.
calc-autofilter-shrink-selection.diff, n#514164, kohei
-# determine in-line array sizes more reliably.
-calc-xls-import-array-size.diff, i#107339, kohei
-
# set cell format to Text when a string format is requested, and don't
# prepend ' in front of the value.
calc-html-csv-import-force-text-cell.diff, n#523414, kohei
@@ -827,9 +827,6 @@ calc-getpivotdata-force-interpret-formula.diff, n#540563, i#105940, kohei
# 2003 and 2007 happy.
calc-combo-listbox-export-fix.diff, n#540566, noelp
-# Disable context menu on non-selectable cells.
-calc-selection-protected-cells.diff, n#542024, i#107342, kohei
-
# When the cell format is 'General', automatically adjust the number of decimals
# to be displayed based on the cell value.
calc-general-type-auto-decimal-sc.diff, n#541973, i#46511, kohei
@@ -860,18 +857,12 @@ calc-string-number-decimal.diff, kohei
calc-xls-import-slanted-border-sc.diff, n#549728, i#38709, kohei
calc-xls-import-slanted-border-oox.diff, n#549728, i#38709, kohei
-# Fix incorrect import of sheet protection options.
-calc-xls-import-sheet-protection-fix.diff, n#542024, i#107340, kohei
-
# TAB key to auto-complete word and move the cell cursor.
calc-auto-tab-complete.diff, i#18748, muthusuba/kohei
# Speed up filtering performance with notes.
calc-perf-filtering-with-notes.diff, n#556927, kohei
-# Fix R1C1 parser.
-calc-r1c1-parse-fix.diff, n#557475, i#107338, kohei
-
# Support PHONETIC function to display asian phonetic guide.
# LATER: I'll take care of this later. --kohei
# calc-formula-asian-phonetic.diff, i#80764, i#80765, i#80766, kohei
diff --git a/patches/dev300/calc-r1c1-parse-fix.diff b/patches/dev300/calc-r1c1-parse-fix.diff
deleted file mode 100644
index cb28040..0000000
--- a/patches/dev300/calc-r1c1-parse-fix.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git sc/source/core/tool/address.cxx sc/source/core/tool/address.cxx
-index e85ec8d..5a1217a 100644
---- sc/source/core/tool/address.cxx
-+++ sc/source/core/tool/address.cxx
-@@ -631,7 +631,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/patches/dev300/calc-selection-protected-cells.diff b/patches/dev300/calc-selection-protected-cells.diff
deleted file mode 100644
index fa7a882..0000000
--- a/patches/dev300/calc-selection-protected-cells.diff
+++ /dev/null
@@ -1,155 +0,0 @@
-diff --git sc/source/ui/inc/gridwin.hxx sc/source/ui/inc/gridwin.hxx
-index 3ab93fd..29cd088 100644
---- sc/source/ui/inc/gridwin.hxx
-+++ sc/source/ui/inc/gridwin.hxx
-@@ -345,7 +345,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 );
- struct RectangleConverter {
-diff --git sc/source/ui/inc/hdrcont.hxx sc/source/ui/inc/hdrcont.hxx
-index 20cc822..497140f 100644
---- sc/source/ui/inc/hdrcont.hxx
-+++ sc/source/ui/inc/hdrcont.hxx
-@@ -80,7 +80,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 sc/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
-index adb2f20..1079b9d 100644
---- sc/source/ui/view/gridwin.cxx
-+++ sc/source/ui/view/gridwin.cxx
-@@ -2753,9 +2753,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;
-@@ -2850,15 +2873,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 sc/source/ui/view/hdrcont.cxx sc/source/ui/view/hdrcont.cxx
-index 89e871c..5cfe8f8 100644
---- sc/source/ui/view/hdrcont.cxx
-+++ sc/source/ui/view/hdrcont.cxx
-@@ -47,6 +47,7 @@
- #include "scmod.hxx" // Optionen
- #include "inputopt.hxx" // Optionen
- #include "gridmerg.hxx"
-+#include "document.hxx"
-
- // -----------------------------------------------------------------------
-
-@@ -655,6 +656,39 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder )
- return nHitNo;
- }
-
-+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
-+ bCellsProtected = pDoc->HasAttrib(0, nPos, nTab, MAXCOL, nPos, nTab, HASATTR_PROTECTED);
-+ else
-+ // column header
-+ bCellsProtected = pDoc->HasAttrib(nPos, 0, nTab, nPos, 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 __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
- {
- if (IsDisabled())
-@@ -665,6 +699,8 @@ void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
-
- BOOL bFound;
- SCCOLROW nHitNo = GetMousePos( rMEvt, bFound );
-+ if (!IsSelectionAllowed(nHitNo))
-+ return;
-
- if ( bFound && rMEvt.IsLeft() && ResizeAllowed() )
- {
-@@ -848,8 +884,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,
diff --git a/patches/dev300/calc-xls-import-array-size.diff b/patches/dev300/calc-xls-import-array-size.diff
deleted file mode 100644
index 444415c..0000000
--- a/patches/dev300/calc-xls-import-array-size.diff
+++ /dev/null
@@ -1,289 +0,0 @@
-diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
-index e412270..e71c60e 100644
---- sc/source/filter/excel/excform.cxx
-+++ sc/source/filter/excel/excform.cxx
-@@ -136,7 +136,7 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
- bConvert = TRUE;
-
- if( bConvert )
-- eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
-+ eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, ExcelToSc::ConvertParam(), FT_CellFormula);
-
- ScFormulaCell* pZelle = NULL;
-
-@@ -201,7 +201,8 @@ void ExcelToSc::GetDummy( const ScTokenArray*& pErgebnis )
- // if bAllowArrays is false stream seeks to first byte after <nFormulaLen>
- // otherwise it will seek to the first byte after the additional content (eg
- // inline arrays) following <nFormulaLen>
--ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT )
-+ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen,
-+ const ConvertParam& rParam, const FORMULA_TYPE eFT )
- {
- RootData& rR = GetOldRoot();
- BYTE nOp, nLen, nByte;
-@@ -472,7 +473,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
- case 0x20: // Array Constant [317 268]
- aIn >> nByte >> nUINT16;
- aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 );
-- if( bAllowArrays )
-+ if( rParam.mbAllowArrays )
- {
- SCSIZE nC = nByte ? nByte : 256;
- SCSIZE nR = nUINT16;
-diff --git sc/source/filter/excel/excform8.cxx sc/source/filter/excel/excform8.cxx
-index 4edef1a..63fe148 100644
---- sc/source/filter/excel/excform8.cxx
-+++ sc/source/filter/excel/excform8.cxx
-@@ -97,7 +97,8 @@ bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLas
-
- // if bAllowArrays is false stream seeks to first byte after <nFormulaLen>
- // otherwise it will seek to the first byte past additional content after <nFormulaLen>
--ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT )
-+ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen,
-+ const ConvertParam& rParam, const FORMULA_TYPE eFT )
- {
- BYTE nOp, nLen, nByte;
- UINT16 nUINT16;
-@@ -393,12 +394,17 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
- case 0x20: // Array Constant [317 268]
- aIn >> nByte >> nUINT16;
- aIn.Ignore( 4 );
-- if( bAllowArrays )
-+ if (rParam.mbAllowArrays)
- {
-- SCSIZE nC = nByte + 1;
-- SCSIZE nR = nUINT16 + 1;
--
-- aStack << aPool.StoreMatrix( nC, nR );
-+ SCSIZE nC = rParam.mnArrayColSize;
-+ SCSIZE nR = rParam.mnArrayRowSize;
-+ if (!nC || !nR)
-+ {
-+ // Stored array size is invalid. Get that from the formula.
-+ nC = nByte + 1;
-+ nR = nUINT16 + 1;
-+ }
-+ aStack << aPool.StoreMatrix(nC, nR);
- aExtensions.push_back( EXTENSION_ARRAY );
- }
- else
-diff --git sc/source/filter/excel/frmbase.cxx sc/source/filter/excel/frmbase.cxx
-index 42f9037..a808a96 100644
---- sc/source/filter/excel/frmbase.cxx
-+++ sc/source/filter/excel/frmbase.cxx
-@@ -258,6 +258,12 @@ void ExcelConverterBase::Reset()
- aEingPos.Set( 0, 0, 0 );
- }
-
-+ExcelConverterBase::ConvertParam::ConvertParam() :
-+ mbAllowArrays(true),
-+ mnArrayColSize(0),
-+ mnArrayRowSize(0)
-+{
-+}
-
-
-
-diff --git sc/source/filter/excel/impop.cxx sc/source/filter/excel/impop.cxx
-index b936e00..c8f397a 100644
---- sc/source/filter/excel/impop.cxx
-+++ sc/source/filter/excel/impop.cxx
-@@ -498,7 +498,9 @@ void ImportExcel::Array25( void )
-
- pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
- static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
-- pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = true;
-+ pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula);
-
- DBG_ASSERT( pErgebnis, "*ImportExcel::Array25(): ScTokenArray ist NULL!" );
-
-@@ -797,7 +799,9 @@ void ImportExcel::Shrfmla( void )
- const ScTokenArray* pErgebnis;
-
- pFormConv->Reset();
-- pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula );
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = true;
-+ pFormConv->Convert( pErgebnis, maStrm, nLenExpr, aParam, FT_SharedFormula );
-
-
- DBG_ASSERT( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray ist NULL!" );
-@@ -969,10 +973,14 @@ void ImportExcel::Array34( void )
- {
- // jetzt steht Lesemarke auf Formel, Laenge in nFormLen
- const ScTokenArray* pErgebnis;
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = true;
-+ aParam.mnArrayColSize = nLastCol - nFirstCol + 1;
-+ aParam.mnArrayRowSize = nLastRow - nFirstRow + 1;
-
- pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
- static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
-- pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
-+ pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula);
-
- DBG_ASSERT( pErgebnis, "+ImportExcel::Array34(): ScTokenArray ist NULL!" );
-
-diff --git sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
-index 24c1999..0ae264d 100644
---- sc/source/filter/excel/xicontent.cxx
-+++ sc/source/filter/excel/xicontent.cxx
-@@ -597,12 +597,15 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
- const ScAddress& rPos = maRanges.GetObject( 0 )->aStart; // assured above that maRanges is not empty
- ExcelToSc& rFmlaConv = GetOldFmlaConverter();
-
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = false;
-+
- ::std::auto_ptr< ScTokenArray > xTokArr1;
- if( nFmlaSize1 > 0 )
- {
- const ScTokenArray* pTokArr = 0;
- rFmlaConv.Reset( rPos );
-- rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName );
-+ rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, aParam, FT_RangeName );
- // formula converter owns pTokArr -> create a copy of the token array
- if( pTokArr )
- xTokArr1.reset( pTokArr->Clone() );
-@@ -613,7 +616,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
- {
- const ScTokenArray* pTokArr = 0;
- rFmlaConv.Reset( rPos );
-- rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName );
-+ rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, aParam, FT_RangeName );
- // formula converter owns pTokArr -> create a copy of the token array
- if( pTokArr )
- pTokArr2.reset( pTokArr->Clone() );
-@@ -721,6 +724,9 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
- String aErrorMessage( rStrm.ReadUniString() );
- rStrm.SetNulSubstChar(); // back to default
-
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = false;
-+
- // formula(s)
- if( rStrm.GetRecLeft() > 8 )
- {
-@@ -736,7 +742,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
- {
- const ScTokenArray* pTokArr = 0;
- rFmlaConv.Reset();
-- rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
-+ rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName );
- // formula converter owns pTokArr -> create a copy of the token array
- if( pTokArr )
- xTokArr1.reset( pTokArr->Clone() );
-@@ -751,7 +757,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
- {
- const ScTokenArray* pTokArr = 0;
- rFmlaConv.Reset();
-- rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
-+ rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName );
- // formula converter owns pTokArr -> create a copy of the token array
- if( pTokArr )
- xTokArr2.reset( pTokArr->Clone() );
-diff --git sc/source/filter/excel/xiformula.cxx sc/source/filter/excel/xiformula.cxx
-index 240358e..41ace53 100644
---- sc/source/filter/excel/xiformula.cxx
-+++ sc/source/filter/excel/xiformula.cxx
-@@ -97,7 +97,9 @@ const ScTokenArray* XclImpFmlaCompImpl::CreateFormula(
- aFmlaStrm.StartNextRecord();
- const ScTokenArray* pArray = NULL;
- GetOldFmlaConverter().Reset();
-- GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), true);
-+ ExcelToSc::ConvertParam aParam;
-+ aParam.mbAllowArrays = true;
-+ GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), aParam);
- return pArray;
- }
-
-diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
-index 72f4701..0ad70d5 100644
---- sc/source/filter/excel/xiname.cxx
-+++ sc/source/filter/excel/xiname.cxx
-@@ -180,7 +180,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- // --- name formula ---
- // JEG : double check this. It is clearly false for normal names
- // but some of the builtins (sheettitle?) might be able to handle arrays
-- rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, false, FT_RangeName );
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = false;
-+ rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName );
-
- // --- auto or advanced filter ---
- if( (GetBiff() == EXC_BIFF8) && pTokArr && bBuiltIn )
-@@ -208,7 +210,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
- else if( nFmlaSize > 0 )
- {
- // regular defined name
-- rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, true, FT_RangeName );
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = true;
-+ rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName );
- }
-
- // 4) *** create a defined name in the Calc document *** ------------------
-diff --git sc/source/filter/inc/excform.hxx sc/source/filter/inc/excform.hxx
-index e80d67c..790174b 100644
---- sc/source/filter/inc/excform.hxx
-+++ sc/source/filter/inc/excform.hxx
-@@ -62,7 +62,8 @@ public:
- ExcelToSc( const XclImpRoot& rRoot );
- virtual ~ExcelToSc();
- virtual ConvErr Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
-- bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
-+ const ConvertParam& rParam,
-+ const FORMULA_TYPE eFT = FT_CellFormula );
-
- virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
-
-@@ -138,7 +139,8 @@ public:
- ExcelToSc8( const XclImpRoot& rRoot );
- virtual ~ExcelToSc8();
-
-- virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
-+ virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen,
-+ const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula );
-
- virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
-
-diff --git sc/source/filter/inc/formel.hxx sc/source/filter/inc/formel.hxx
-index 5d3f196..58aa2f4 100644
---- sc/source/filter/inc/formel.hxx
-+++ sc/source/filter/inc/formel.hxx
-@@ -214,8 +214,17 @@ public:
- void Reset();
- void Reset( const ScAddress& rEingPos );
-
-+ struct ConvertParam
-+ {
-+ bool mbAllowArrays;
-+ SCSIZE mnArrayColSize;
-+ SCSIZE mnArrayRowSize;
-+
-+ ConvertParam();
-+ };
-+
- virtual ConvErr Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen,
-- bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
-+ const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
- virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab,
- const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
- };
-diff --git sc/source/filter/xcl97/XclImpChangeTrack.cxx sc/source/filter/xcl97/XclImpChangeTrack.cxx
-index 0b6b3e3..c20c8ac 100644
---- sc/source/filter/xcl97/XclImpChangeTrack.cxx
-+++ sc/source/filter/xcl97/XclImpChangeTrack.cxx
-@@ -210,7 +210,9 @@ void XclImpChangeTrack::ReadFormula( ScTokenArray*& rpTokenArray, const ScAddres
- // read the formula, 3D tab refs from extended data
- const ScTokenArray* pArray = NULL;
- aFmlConv.Reset( rPosition );
-- BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false, FT_CellFormula) == ConvOK); // JEG : Check This
-+ ExcelConverterBase::ConvertParam aParam;
-+ aParam.mbAllowArrays = false;
-+ BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, aParam, FT_CellFormula) == ConvOK); // JEG : Check This
- rpTokenArray = (bOK && pArray) ? new ScTokenArray( *pArray ) : NULL;
- pStrm->Ignore( 1 );
- }
diff --git a/patches/dev300/calc-xls-import-sheet-protection-fix.diff b/patches/dev300/calc-xls-import-sheet-protection-fix.diff
deleted file mode 100644
index 7126638..0000000
--- a/patches/dev300/calc-xls-import-sheet-protection-fix.diff
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
-index cfe65b4..666083d 100644
---- sc/source/filter/excel/xicontent.cxx
-+++ sc/source/filter/excel/xicontent.cxx
-@@ -1228,7 +1228,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/patches/dev300/cws-kohei04-sc.diff b/patches/dev300/cws-kohei04-sc.diff
new file mode 100644
index 0000000..cb49cdf
--- /dev/null
+++ b/patches/dev300/cws-kohei04-sc.diff
@@ -0,0 +1,342 @@
+diff --git sc/inc/scmatrix.hxx sc/inc/scmatrix.hxx
+index c557e08..5c450ac 100644
+--- sc/inc/scmatrix.hxx
++++ sc/inc/scmatrix.hxx
+@@ -106,6 +106,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 );
+@@ -178,6 +179,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 sc/source/core/tool/address.cxx sc/source/core/tool/address.cxx
+index 906b9e7..506b276 100644
+--- sc/source/core/tool/address.cxx
++++ sc/source/core/tool/address.cxx
+@@ -631,7 +631,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 sc/source/core/tool/scmatrix.cxx sc/source/core/tool/scmatrix.cxx
+index 35541bc..2686d9d 100644
+--- sc/source/core/tool/scmatrix.cxx
++++ sc/source/core/tool/scmatrix.cxx
+@@ -65,12 +65,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);
+@@ -79,6 +84,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 sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
+index 5ee0285..7e38419 100644
+--- sc/source/filter/excel/excform.cxx
++++ sc/source/filter/excel/excform.cxx
+@@ -474,10 +474,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
+@@ -1895,6 +1892,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 sc/source/filter/excel/excform8.cxx sc/source/filter/excel/excform8.cxx
+index 015f06d..f3c3f1b 100644
+--- sc/source/filter/excel/excform8.cxx
++++ sc/source/filter/excel/excform8.cxx
+@@ -395,10 +395,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 sc/source/filter/excel/tokstack.cxx sc/source/filter/excel/tokstack.cxx
+index d24dac4..7f51b39 100644
+--- sc/source/filter/excel/tokstack.cxx
++++ sc/source/filter/excel/tokstack.cxx
+@@ -740,7 +740,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;
+
+@@ -753,8 +753,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 sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
+index 7b5fb22..0470830 100644
+--- sc/source/filter/excel/xicontent.cxx
++++ sc/source/filter/excel/xicontent.cxx
+@@ -1216,7 +1216,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 sc/source/filter/inc/tokstack.hxx sc/source/filter/inc/tokstack.hxx
+index e11c280..2002da7 100644
+--- sc/source/filter/inc/tokstack.hxx
++++ sc/source/filter/inc/tokstack.hxx
+@@ -210,7 +210,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 sc/source/ui/inc/gridwin.hxx sc/source/ui/inc/gridwin.hxx
+index 4c701ad..cdf3804 100644
+--- sc/source/ui/inc/gridwin.hxx
++++ sc/source/ui/inc/gridwin.hxx
+@@ -277,7 +277,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 sc/source/ui/inc/hdrcont.hxx sc/source/ui/inc/hdrcont.hxx
+index 20cc822..497140f 100644
+--- sc/source/ui/inc/hdrcont.hxx
++++ sc/source/ui/inc/hdrcont.hxx
+@@ -80,7 +80,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 sc/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
+index 5e389ef..4076386 100644
+--- sc/source/ui/view/gridwin.cxx
++++ sc/source/ui/view/gridwin.cxx
+@@ -2696,9 +2696,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;
+@@ -2793,15 +2816,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 sc/source/ui/view/hdrcont.cxx sc/source/ui/view/hdrcont.cxx
+index c44d200..37763b2 100644
+--- sc/source/ui/view/hdrcont.cxx
++++ sc/source/ui/view/hdrcont.cxx
+@@ -47,6 +47,7 @@
+ #include "scmod.hxx" // Optionen
+ #include "inputopt.hxx" // Optionen
+ #include "gridmerg.hxx"
++#include "document.hxx"
+
+ // -----------------------------------------------------------------------
+
+@@ -655,6 +656,39 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder )
+ return nHitNo;
+ }
+
++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
++ bCellsProtected = pDoc->HasAttrib(0, nPos, nTab, MAXCOL, nPos, nTab, HASATTR_PROTECTED);
++ else
++ // column header
++ bCellsProtected = pDoc->HasAttrib(nPos, 0, nTab, nPos, 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 __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
+ {
+ if (IsDisabled())
+@@ -665,6 +699,8 @@ void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
+
+ BOOL bFound;
+ SCCOLROW nHitNo = GetMousePos( rMEvt, bFound );
++ if (!IsSelectionAllowed(nHitNo))
++ return;
+
+ if ( bFound && rMEvt.IsLeft() && ResizeAllowed() )
+ {
+@@ -848,8 +884,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,
More information about the ooo-build-commit
mailing list