[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-04-13 Thread Caolán McNamara
 sc/source/ui/view/gridwin4.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit e8080c79043a7d9036f27cc24b76b7ff21c58da8
Author: Caolán McNamara 
Date:   Thu Apr 12 14:53:20 2018 +0100

Related: tdf#100925 background not getting set under X sometimes

not sure why this is the case, but it is reminiscent of rhbz#1283420 which
results in missing glyphs in some circumstances
X11CairoTextRender::getCairoContext has a hack in it for that problem, whic
forces a read from the underlying X Drawable before writing to it which 
seems
to have the effect of syncing it up.

So, just before drawing the bg, draw a glyph on it to get it synced, and 
then
overwrite it.

Change-Id: I27e8e989b91821869d8b75a59728ac513d1b
Reviewed-on: https://gerrit.libreoffice.org/52819
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 74151217831c..adb2db31a1df 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1029,7 +1029,12 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 }
 
 // paint the background
-rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
+tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground));
+//tdf#100925, rhbz#1283420, Draw some text here, to get
+//X11CairoTextRender::getCairoContext called, so that the forced read
+//from the underlying X Drawable gets it to sync.
+rDevice.DrawText(aLogicRect.BottomLeft(), " ");
+rDevice.DrawRect(aLogicRect);
 
 // paint the editeng text
 tools::Rectangle aEditRect(Point(nScrX, nScrY), 
Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-04-05 Thread Caolán McNamara
 sc/source/filter/xml/xmlcelli.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 2446ae942b2ca35c9f727fb15ef5ec8d248b55c5
Author: Caolán McNamara 
Date:   Mon Mar 26 13:44:31 2018 +0100

forcepoint #34 survive missing autostyles

Change-Id: I742816297659d614e836a8d5e8965b1c55154719
Reviewed-on: https://gerrit.libreoffice.org/51892
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 90682874db1b..38cca471876f 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -367,6 +367,8 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, 
sal_Int32 nEnd, cons
 sal_Int32 nEntryCount = xMapper->GetEntryCount();
 
 SvXMLStylesContext* pAutoStyles = GetImport().GetAutoStyles();
+if (!pAutoStyles)
+return;
 
 // Style name for text span corresponds with the name of an automatic 
style.
 const XMLPropStyleContext* pStyle = dynamic_cast(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-04-05 Thread Caolán McNamara
 sc/source/filter/excel/xichart.cxx |   18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

New commits:
commit ee9d80d6d93afe914097b3f1835777052ccd
Author: Caolán McNamara 
Date:   Mon Mar 26 12:59:14 2018 +0100

forcepoint #32 survive missing value range

Change-Id: I90315f0481bf73c4d9071959bf5408f4a2690257
Reviewed-on: https://gerrit.libreoffice.org/51886
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sc/source/filter/excel/xichart.cxx 
b/sc/source/filter/excel/xichart.cxx
index db71be8dc037..89bb10efd5a9 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -3370,15 +3370,19 @@ Reference< XAxis > XclImpChAxis::CreateAxis( const 
XclImpChTypeGroup& rTypeGroup
 {
 case cssc2::AxisType::CATEGORY:
 case cssc2::AxisType::SERIES:
-OSL_ENSURE( mxLabelRange, "Missing Label Range" );
 // #i71684# radar charts have reversed rotation direction
 if (mxLabelRange)
 mxLabelRange->Convert( aAxisProp, aScaleData, 
rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR );
+else
+SAL_WARN("sc.filter", "missing LabelRange");
 break;
 case cssc2::AxisType::REALNUMBER:
 case cssc2::AxisType::PERCENT:
 // #i85167# pie/donut charts have reversed rotation direction 
(at Y axis!)
-mxValueRange->Convert( aScaleData, rTypeInfo.meTypeCateg == 
EXC_CHTYPECATEG_PIE );
+if (mxValueRange)
+mxValueRange->Convert( aScaleData, rTypeInfo.meTypeCateg 
== EXC_CHTYPECATEG_PIE );
+else
+SAL_WARN("sc.filter", "missing ValueRange");
 break;
 default:
 OSL_FAIL( "XclImpChAxis::CreateAxis - unknown axis type" );
@@ -3427,12 +3431,18 @@ void XclImpChAxis::ConvertAxisPosition( ScfPropertySet& 
rPropSet, const XclImpCh
 {
 if( ((GetAxisType() == EXC_CHAXIS_X) && 
rTypeGroup.GetTypeInfo().mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z) )
 {
-OSL_ENSURE( mxLabelRange, "Missing Label Range" );
 if (mxLabelRange)
 mxLabelRange->ConvertAxisPosition( rPropSet, 
rTypeGroup.Is3dChart() );
+else
+SAL_WARN("sc.filter", "missing LabelRange");
 }
 else
-mxValueRange->ConvertAxisPosition( rPropSet );
+{
+if (mxValueRange)
+mxValueRange->ConvertAxisPosition( rPropSet );
+else
+SAL_WARN("sc.filter", "missing ValueRange");
+}
 }
 
 void XclImpChAxis::ReadChAxisLine( XclImpStream& rStrm )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-04-05 Thread Caolán McNamara
 sc/source/core/data/column3.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit be9e229ee147d45f110ecc1680be4068c1716c02
Author: Caolán McNamara 
Date:   Mon Mar 26 12:50:20 2018 +0100

forcepoint #31 check validity of another group range

Change-Id: I82ff3e47a033c91581b108e1685b1ff4d5865895
Reviewed-on: https://gerrit.libreoffice.org/51883
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index d3e3e24d88c5..2321e4e12907 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -3113,6 +3113,8 @@ public:
 {
 // Previous cell is a regular cell and current cell is a group.
 nRow += xCurGrp->mnLength;
+if (xCurGrp->mnLength > std::distance(it, itEnd))
+throw css::lang::IllegalArgumentException();
 std::advance(it, xCurGrp->mnLength);
 pPrev->SetCellGroup(xCurGrp);
 xCurGrp->mpTopCell = pPrev;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-03-21 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 4100c987f7c73a2e90ee8747ebc845478deff82e
Author: Eike Rathke 
Date:   Sat Mar 10 20:34:36 2018 +0100

Resolves: tdf#116324 treat jump empty path as 0 when nested

Apparently a fallout from

commit 0f45ac20cd2ab2a64c40c7d6850f333cc33feeb0
AuthorDate: Mon Jun 28 11:40:39 2010 -0400
CommitDate: Sat Nov 6 23:40:00 2010 -0400

More on fixing build by eliminating use of ScMatrixValue.

or other commits related to ScMatrix handling.

Change-Id: I10e8b58aed51cd707b1503dbbc0b369aea4a2805
(cherry picked from commit 8930f8f530b4879226a6bac55bfeb551ac9e7489)
Reviewed-on: https://gerrit.libreoffice.org/51054
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f40637f33540..666e27ebc156 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -131,8 +131,10 @@ void ScInterpreter::ScIfJump()
 else
 {
 // Treat empty and empty path as 0, but string
-// as error.
-bIsValue = (!pMat->IsString(nC, nR) || 
pMat->IsEmpty(nC, nR));
+// as error. ScMatrix::IsValueOrEmpty() returns
+// true for any empty, empty path, empty cell,
+// empty result.
+bIsValue = pMat->IsValueOrEmpty(nC, nR);
 bTrue = false;
 fVal = (bIsValue ? 0.0 : CreateDoubleError( 
FormulaError::NoValue));
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-03-21 Thread Eike Rathke
 sc/source/ui/view/viewfun2.cxx |   23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 4f7250d4bb2b86b1d50e27a72af9bb4d7b01c66a
Author: Eike Rathke 
Date:   Tue Mar 6 21:26:23 2018 +0100

Resolves: tdf#116215 separate column sums and row sums, tdf#71339 related

Change-Id: Ifc7ab0c460f521ad3be4aa2785d54a1e4ed304e5
(cherry picked from commit 9d8dcec608dde63c68b34450a95a3b168121e289)
Reviewed-on: https://gerrit.libreoffice.org/50846
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 55332765bb96..8805d11da115 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -615,7 +615,10 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool 
bSubTotal, bool bSetCursor
 SCCOL nMarkEndCol = nEndCol;
 SCROW nMarkEndRow = nEndRow;
 ScAutoSum eSum = ScAutoSumNone;
-ScRangeList aSumRangeList;
+SCROW nColSums = 0;
+SCCOL nRowSums = 0;
+SCROW nColSumsStartRow = 0;
+SCCOL nRowSumsStartCol = 0;
 
 if ( bRow )
 {
@@ -639,12 +642,15 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool 
bSubTotal, bool bSetCursor
 {
 if ( !pDoc->IsBlockEmpty( nTab, nCol, nStartRow, nCol, nSumEndRow 
) )
 {
+ScRangeList aRangeList;
 // Include the originally selected start row.
 const ScRange aRange( nCol, rRange.aStart.Row(), nTab, nCol, 
nSumEndRow, nTab );
-if ( (eSum = lcl_GetAutoSumForColumnRange( pDoc, 
aSumRangeList, aRange )) != ScAutoSumNone )
+if ( (eSum = lcl_GetAutoSumForColumnRange( pDoc, aRangeList, 
aRange )) != ScAutoSumNone )
 {
+if (++nRowSums == 1)
+nRowSumsStartCol = aRangeList[0]->aStart.Col();
 const OUString aFormula = GetAutoSumFormula(
-aSumRangeList, bSubTotal, ScAddress(nCol, nInsRow, 
nTab));
+aRangeList, bSubTotal, ScAddress(nCol, nInsRow, nTab));
 EnterData( nCol, nInsRow, nTab, aFormula );
 }
 }
@@ -673,11 +679,14 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool 
bSubTotal, bool bSetCursor
 {
 if ( !pDoc->IsBlockEmpty( nTab, nStartCol, nRow, nSumEndCol, nRow 
) )
 {
+ScRangeList aRangeList;
 // Include the originally selected start column.
 const ScRange aRange( rRange.aStart.Col(), nRow, nTab, 
nSumEndCol, nRow, nTab );
-if ( (eSum = lcl_GetAutoSumForRowRange( pDoc, aSumRangeList, 
aRange )) != ScAutoSumNone )
+if ( (eSum = lcl_GetAutoSumForRowRange( pDoc, aRangeList, 
aRange )) != ScAutoSumNone )
 {
-const OUString aFormula = GetAutoSumFormula( 
aSumRangeList, bSubTotal, ScAddress(nInsCol, nRow, nTab) );
+if (++nColSums == 1)
+nColSumsStartRow = aRangeList[0]->aStart.Row();
+const OUString aFormula = GetAutoSumFormula( aRangeList, 
bSubTotal, ScAddress(nInsCol, nRow, nTab) );
 EnterData( nInsCol, nRow, nTab, aFormula );
 }
 }
@@ -690,10 +699,10 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool 
bSubTotal, bool bSetCursor
 // original selection. All extended by end column/row where the sum is put.
 const ScRange aMarkRange(
 (eSum == ScAutoSumSum ?
- (aSumRangeList.size() == 1 ? aSumRangeList[0]->aStart.Col() : 
nStartCol) :
+ (nRowSums == 1 ? nRowSumsStartCol : nStartCol) :
  rRange.aStart.Col()),
 (eSum == ScAutoSumSum ?
- (aSumRangeList.size() == 1 ? aSumRangeList[0]->aStart.Row() : 
nStartRow) :
+ (nColSums == 1 ? nColSumsStartRow : nStartRow) :
  rRange.aStart.Row()),
 nTab, nMarkEndCol, nMarkEndRow, nTab );
 MarkRange( aMarkRange, false, bContinue );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-03-13 Thread Caolán McNamara
 sc/source/ui/inc/viewdata.hxx  |4 ++--
 sc/source/ui/view/viewdata.cxx |   12 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 05315e34c354b84409aa5e29ce9b8ce494570b52
Author: Caolán McNamara 
Date:   Mon Mar 12 12:32:52 2018 +

forcepoint #26 check input against max valid enum values

Change-Id: Ide72884c77904ae9495b5189cde086e43923e4bd
Reviewed-on: https://gerrit.libreoffice.org/51138
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 0c0613526d8f..dd9c7f144358 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -40,9 +40,9 @@ enum class ScFillMode
 MATRIX  = 4,
 };
 
-enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
+enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX, 
SC_SPLIT_MODE_MAX_ENUM = SC_SPLIT_FIX };
 
-enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, 
SC_SPLIT_BOTTOMRIGHT };
+enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, 
SC_SPLIT_BOTTOMRIGHT, SC_SPLIT_POS_MAX_ENUM = SC_SPLIT_BOTTOMRIGHT };
 enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
 enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
 
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index e0fe575a7d27..fc79f7f3e55e 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -207,13 +207,13 @@ void ScViewDataTable::ReadUserDataSequence(const 
uno::Sequence >= nTemp16;
-eHSplitMode = static_cast(nTemp16);
+if ((aSettings[i].Value >>= nTemp16) && nTemp16 <= 
ScSplitMode::SC_SPLIT_MODE_MAX_ENUM)
+eHSplitMode = static_cast(nTemp16);
 }
 else if (sName == SC_VERTICALSPLITMODE)
 {
-aSettings[i].Value >>= nTemp16;
-eVSplitMode = static_cast(nTemp16);
+if ((aSettings[i].Value >>= nTemp16) && nTemp16 <= 
ScSplitMode::SC_SPLIT_MODE_MAX_ENUM)
+eVSplitMode = static_cast(nTemp16);
 }
 else if (sName == SC_HORIZONTALSPLITPOSITION)
 {
@@ -237,8 +237,8 @@ void ScViewDataTable::ReadUserDataSequence(const 
uno::Sequence >= nTemp16;
-eWhichActive = static_cast(nTemp16);
+if ((aSettings[i].Value >>= nTemp16) && nTemp16 <= 
ScSplitPos::SC_SPLIT_POS_MAX_ENUM)
+eWhichActive = static_cast(nTemp16);
 }
 else if (sName == SC_POSITIONLEFT)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-03-13 Thread Mike Kaganski
 sc/source/ui/view/prevwsh.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 9f4bb984750887422dea4d1f6c4ef183f57b0ae5
Author: Mike Kaganski 
Date:   Mon Mar 12 10:07:06 2018 +0300

tdf#103175: Initialize DrawLayer if required

Change-Id: Ia99dd1e349e807d339dce0ead518a72a31e0fc02
Reviewed-on: https://gerrit.libreoffice.org/51096
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit de53d4690d25b9f1bbc0def6c66ce5b45b2fdc96)
Reviewed-on: https://gerrit.libreoffice.org/5
Reviewed-by: Xisco Faulí 

diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 37097ed5474e..86c1e53ff9d0 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -940,7 +940,8 @@ void ScPreviewShell::WriteUserDataSequence(uno::Sequence < 
beans::PropertyValue
 }
 
 // Common SdrModel processing
-GetDocument().GetDrawLayer()->WriteUserDataSequence(rSeq);
+if (ScDrawLayer* pDrawLayer = GetDocument().GetDrawLayer())
+pDrawLayer->WriteUserDataSequence(rSeq);
 }
 
 void ScPreviewShell::ReadUserDataSequence(const uno::Sequence < 
beans::PropertyValue >& rSeq)
@@ -967,7 +968,7 @@ void ScPreviewShell::ReadUserDataSequence(const 
uno::Sequence < beans::PropertyV
 pPreview->SetPageNo(nTemp);
 }
 // Fallback to common SdrModel processing
-else 
GetDocument().GetDrawLayer()->ReadUserDataSequenceValue(pSeq);
+else 
pDocShell->MakeDrawLayer()->ReadUserDataSequenceValue(pSeq);
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-21 Thread Aron Budea
 sc/source/filter/oox/condformatbuffer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 56e0895730fa289d72333d7b432122292e37b4c4
Author: Aron Budea 
Date:   Sun Feb 18 23:04:09 2018 +0100

for listeners the range needs to be set before the formula, tdf#115530

Change-Id: I001795fd456375c4babab2c2e505bedff03e991f
Reviewed-on: https://gerrit.libreoffice.org/49957
Reviewed-by: Aron Budea 
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 26b51c9550ef300e7685fc41eb9cde4dbbc11265)
Reviewed-on: https://gerrit.libreoffice.org/50016
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 274f062b999d..e08ed061c8d3 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1055,12 +1055,12 @@ void CondFormat::finalizeImport()
 if ( !mbReadyForFinalize )
 return;
 ScDocument& rDoc = getScDocument();
+mpFormat->SetRange(maModel.maRanges);
 maRules.forEachMem( ::finalizeImport );
 SCTAB nTab = maModel.maRanges.GetTopLeftCorner().Tab();
 sal_Int32 nIndex = getScDocument().AddCondFormat(mpFormat, nTab);
 
 rDoc.AddCondFormatData( maModel.maRanges, nTab, nIndex );
-mpFormat->SetRange(maModel.maRanges);
 }
 
 CondFormatRuleRef CondFormat::createRule()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-14 Thread Eike Rathke
 sc/source/core/data/documentimport.cxx |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit c9cfcd5f56fb2395a281df7466e5a2d9a2cf309e
Author: Eike Rathke 
Date:   Tue Feb 13 18:08:28 2018 +0100

CheckLinkFormulaNeedingCheck() for ScDocumentImport::setFormulaCell()

and ScDocumentImport::setMatrixCells()

 This is a combination of 2 commits.

CheckLinkFormulaNeedingCheck() for ScDocumentImport::setFormulaCell()

(cherry picked from commit bcd62f2050336951ad56892d6e0a42f63c59a674)

 Conflicts:
sc/source/core/data/documentimport.cxx

More CheckLinkFormulaNeedingCheck() for ScDocumentImport::setFormulaCell()

and ScDocumentImport::setMatrixCells()

(cherry picked from commit f41c14706c6bf8aa5c3df220c706669f1ec6e1f6)

 Conflicts:
sc/source/core/data/documentimport.cxx

d3303fb71889c760424459daa79feca0f2510a3c

Change-Id: I1587be914b390b2597185dd5af870d1d785010a4
Reviewed-on: https://gerrit.libreoffice.org/49735
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/documentimport.cxx 
b/sc/source/core/data/documentimport.cxx
index 95d38ee08f51..c0e4d3c9e60f 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -276,9 +277,14 @@ void ScDocumentImport::setFormulaCell(
 if (!pBlockPos)
 return;
 
+std::unique_ptr pFC =
+o3tl::make_unique(>mrDoc, rPos, rFormula, 
eGrammar);
+
+mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
+
 sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
 pBlockPos->miCellPos =
-rCells.set(pBlockPos->miCellPos, rPos.Row(), new 
ScFormulaCell(>mrDoc, rPos, rFormula, eGrammar));
+rCells.set(pBlockPos->miCellPos, rPos.Row(), pFC.release());
 }
 
 void ScDocumentImport::setFormulaCell(const ScAddress& rPos, ScTokenArray* 
pArray)
@@ -292,9 +298,14 @@ void ScDocumentImport::setFormulaCell(const ScAddress& 
rPos, ScTokenArray* pArra
 if (!pBlockPos)
 return;
 
+std::unique_ptr pFC =
+o3tl::make_unique(>mrDoc, rPos, pArray);
+
+mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
+
 sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
 pBlockPos->miCellPos =
-rCells.set(pBlockPos->miCellPos, rPos.Row(), new 
ScFormulaCell(>mrDoc, rPos, pArray));
+rCells.set(pBlockPos->miCellPos, rPos.Row(), pFC.release());
 }
 
 void ScDocumentImport::setFormulaCell(const ScAddress& rPos, ScFormulaCell* 
pCell)
@@ -308,6 +319,9 @@ void ScDocumentImport::setFormulaCell(const ScAddress& 
rPos, ScFormulaCell* pCel
 if (!pBlockPos)
 return;
 
+if (pCell)
+mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pCell->GetCode());
+
 sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
 pBlockPos->miCellPos =
 rCells.set(pBlockPos->miCellPos, rPos.Row(), pCell);
@@ -332,6 +346,8 @@ void ScDocumentImport::setMatrixCells(
 // Set the master cell.
 ScFormulaCell* pCell = new ScFormulaCell(>mrDoc, rBasePos, rArray, 
eGram, ScMatrixMode::Formula);
 
+mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pCell->GetCode());
+
 pBlockPos->miCellPos =
 rCells.set(pBlockPos->miCellPos, rBasePos.Row(), pCell);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-13 Thread Eike Rathke
 sc/source/core/data/documentimport.cxx |1 +
 sc/source/ui/docshell/impex.cxx|   11 +++
 2 files changed, 12 insertions(+)

New commits:
commit 9d751166f3cf785b8b350fcff86c2d6864f5633f
Author: Eike Rathke 
Date:   Fri Feb 9 15:17:35 2018 +0100

CheckLinkFormulaNeedingCheck() for .csv import

Change-Id: I89be713531436f10b38d38f9e0fa527db1e036cd
(cherry picked from commit c7dd72b2bd6a7988e4e1074e9a85222b53ba84ac)
Reviewed-on: https://gerrit.libreoffice.org/49501
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/documentimport.cxx 
b/sc/source/core/data/documentimport.cxx
index dd061648e485..95d38ee08f51 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -204,6 +204,7 @@ void ScDocumentImport::setAutoInput(const ScAddress& rPos, 
const OUString& rStr,
 pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, 
rPos.Row(), aCell.mfValue);
 break;
 case CELLTYPE_FORMULA:
+mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( 
*aCell.mpFormula->GetCode());
 // This formula cell instance is directly placed in the document 
without copying.
 pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, 
rPos.Row(), aCell.mpFormula);
 aCell.mpFormula = nullptr;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 2aa9e57559ac..e48096dc39ec 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1203,7 +1203,18 @@ static bool lcl_PutString(
 if ( bUseDocImport )
 rDocImport.setAutoInput(ScAddress(nCol, nRow, nTab), rStr, 
);
 else
+{
 pDoc->SetString( nCol, nRow, nTab, rStr,  );
+// ScColumn::ParseString() is strict about the first character
+// having to be '=' for formula, so we can use that here and don't
+// need to obtain the created cell for each and every value.
+if (rStr.getLength() > 1 && rStr[0] == '=')
+{
+const ScFormulaCell* pFC = pDoc->GetFormulaCell( ScAddress( 
nCol, nRow, nTab));
+if (pFC)
+pDoc->CheckLinkFormulaNeedingCheck( *pFC->GetCode());
+}
+}
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-13 Thread Eike Rathke
 sc/source/ui/docshell/impex.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6e41a2980bc8216b72d75c0d972d93a13b89fd0a
Author: Eike Rathke 
Date:   Mon Feb 12 17:02:29 2018 +0100

CheckLinkFormulaNeedingCheck() for .slk import

Change-Id: I79953cf4fd6e9e00351a3b1f1687b6024085e395
(cherry picked from commit 664c2902a6672be51c4a3163a5bf44aa2145d408)
Reviewed-on: https://gerrit.libreoffice.org/49611
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 1496e66deffd..2aa9e57559ac 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1857,6 +1857,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 const formula::FormulaGrammar::Grammar eGrammar = 
formula::FormulaGrammar::GRAM_PODF_A1;
 ScCompiler aComp( pDoc, aPos, eGrammar);
 ScTokenArray* pCode = aComp.CompileString( aText );
+pDoc->CheckLinkFormulaNeedingCheck( *pCode);
 if ( ch == 'M' )
 {
 ScMarkData aMark;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-12 Thread Laurent BP
 sc/source/ui/formdlg/formula.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 505832b92e0e2a395ef22424de33168a76bcc2c3
Author: Laurent BP 
Date:   Sat Feb 10 20:54:25 2018 +0100

tdf#72440 Abs sheet ref must be given

When resolving tdf#90799, sheet ref was forced abs
But its value must be changed.
It worked only if initial sheet = Sheet1

Change-Id: I715f93dce93beb78d767e00dd45fb9634cb173a8
Reviewed-on: https://gerrit.libreoffice.org/49548
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit d69017c8a17be21657ea7ab9d37023ee59116799)
Reviewed-on: https://gerrit.libreoffice.org/49609

diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 308b206537d0..8d44d7bc987b 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -431,8 +431,9 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, 
ScDocument* pRefDoc )
 bool bSingle = aRefData.Ref1 == aRefData.Ref2;
 if (m_CursorPos.Tab() != rRef.aStart.Tab())
 {
+// pointer-selected => absolute sheet reference
+aRefData.Ref1.SetAbsTab( rRef.aStart.Tab() );
 aRefData.Ref1.SetFlag3D(true);
-aRefData.Ref1.SetTabRel(false); // pointer-selected => 
absolute sheet reference
 }
 if (bSingle)
 aArray.AddSingleReference(aRefData.Ref1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-09 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit ec9bfbaaa642b911b121b99ff509e82c19777fc4
Author: Eike Rathke 
Date:   Wed Feb 7 22:21:51 2018 +0100

tdf#115493 postpone name resolution after unsuccessful IsNamedRange()

... for names used in named expressions when compiling during
import and collecting named expressions, to not match an arbitrary
other name.

Change-Id: I02a92747a1485b46873281de98879a89385d4622
(cherry picked from commit 30083601334279f33a3021dfe7d22970d02c8e9e)
Reviewed-on: https://gerrit.libreoffice.org/49397
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 6c3e7af0c9bf..1501d8cb03be 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4278,6 +4278,15 @@ bool ScCompiler::NextNewToken( bool bInArray )
 
 if (IsNamedRange( aUpper ))
 return true;
+
+// Compiling a named expression during collecting them in import shall
+// not match arbitrary names that otherwise if all named expressions
+// were present would be recognized as named expression. Such name will
+// flag an error below and will be recompiled in a second step later
+// with ScRangeData::CompileUnresolvedXML()
+if (meExtendedErrorDetection == EXTENDED_ERROR_DETECTION_NAME_NO_BREAK 
&& pDoc->IsImportingXML())
+break;  // while
+
 // Preserve case of file names in external references.
 bool bInvalidExternalNameRange;
 if (IsExternalNamedRange( aOrg, bInvalidExternalNameRange ))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-06 Thread Bartosz Kosiorek
 sc/source/core/tool/interpr1.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e392f847bff0321d7884daabe74d91d90f07a0bf
Author: Bartosz Kosiorek 
Date:   Tue Feb 6 00:45:32 2018 +0100

tdf#114820 Fix reading external reference for VLOOKUP and HLOOKUP

Change-Id: Iaa1307123d97a740bdaf90647e8adff224211851
Reviewed-on: https://gerrit.libreoffice.org/49263
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 5c3d0a70a0edb182714725ef920d74667feffb0e)
Reviewed-on: https://gerrit.libreoffice.org/49316

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 53122e82cb40..f40637f33540 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -6634,7 +6634,9 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
 }
 }
 break;
-case svMatrix :
+case svExternalDoubleRef:
+case svExternalSingleRef:
+case svMatrix:
 {
 svl::SharedString aStr;
 const ScMatValType nType = 
GetDoubleOrStringFromMatrix(rItem.mfVal, aStr);
@@ -6651,6 +6653,7 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
 } // switch ( GetStackType() )
 return true;
 }
+
 void ScInterpreter::ScVLookup()
 {
 CalculateLookup(false);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-06 Thread Bartosz Kosiorek
 sc/source/core/tool/interpr1.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d4a41817aa86fffaa3a27265966bc8265d34dd0a
Author: Bartosz Kosiorek 
Date:   Tue Feb 6 02:10:14 2018 +0100

tdf#115162 Fix support for external reference for IFS functions

Functions SUMIFS, AVERAGEIFS, COUNTIFS, MINIFS, MAXIFS were not
supported External references.

The root cause issue, was using PopMatrix() method for:
svExternalSingleRef and svExternalDoubleRef.

PopMatrix() method only supports svMatrix, and in other
cases returns FormulaError::IllegalParameter error.

To resolve that issue, the method GetMatrix() was used.
It is properly support svMatrix, svExternalSingleRef and 
svExternalDoubleRef.

Change-Id: I3e30ca50069264a6d990b16ec668e6d0df51c6e6
Reviewed-on: https://gerrit.libreoffice.org/49264
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit b6db65752c60de7268e4f65d7fc5ac110adb2fb0)
Reviewed-on: https://gerrit.libreoffice.org/49284

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 42db756a2e01..53122e82cb40 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5431,7 +5431,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 case svExternalSingleRef:
 case svExternalDoubleRef:
 {
-pQueryMatrix = PopMatrix();
+pQueryMatrix = GetMatrix();
 if (!pQueryMatrix)
 {
 SetError( FormulaError::IllegalParameter);
@@ -5590,7 +5590,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 case svExternalSingleRef:
 case svExternalDoubleRef:
 {
-pMainMatrix = PopMatrix();
+pMainMatrix = GetMatrix();
 if (!pMainMatrix)
 {
 SetError( FormulaError::IllegalParameter);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-02-06 Thread Eike Rathke
 sc/source/core/data/documen8.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit b2b491a5c63081d6a62df07c7430b604ba06d922
Author: Eike Rathke 
Date:   Mon Feb 5 23:13:08 2018 +0100

Turn assert into SAL_WARN

In the wild there are named expressions without expression and
formula error cells without formula.

Change-Id: I11546b09173de65cebe776529edee74c549d73c8
(cherry picked from commit 951dd781743c975a7d29cc30e88e1b4a56c0b176)
Reviewed-on: https://gerrit.libreoffice.org/49259
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index ca8227058d5a..b7ccee14d2b7 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1170,7 +1170,10 @@ void ScDocument::CheckLinkFormulaNeedingCheck( const 
ScTokenArray& rCode )
 }
 else
 {
-assert(!"called with empty ScTokenArray");
+// Possible with named expression without expression like Excel
+// internal print ranges, obscure user define names, ... formula error
+// cells without formula ...
+SAL_WARN("sc.core","ScDocument::CheckLinkFormulaNeedingCheck - called 
with empty ScTokenArray");
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-30 Thread Markus Mohrhard
 sc/source/ui/view/cellsh2.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 4ac1a46f712f38fee3323e7c4ed121880469a9d3
Author: Markus Mohrhard 
Date:   Sat Aug 12 11:41:11 2017 +0200

tdf#112033: enable the xml source feature when the experimental features 
are enabled

Change-Id: I066b2927c5e22664b7a4e96549da3a02ec4c99d3
Reviewed-on: https://gerrit.libreoffice.org/41085
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 65722772f00a40b8ca8adf21e31c22295ef7d215)
Reviewed-on: https://gerrit.libreoffice.org/47696
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 91b5c5effe12..9b9910ffd776 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -1207,7 +1207,11 @@ void ScCellShell::GetDBState( SfxItemSet& rSet )
 }
 break;
 case SID_MANAGE_XML_SOURCE:
-rSet.DisableItem(nWhich);
+{
+SvtMiscOptions aMiscOptions;
+if ( !aMiscOptions.IsExperimentalMode() )
+rSet.DisableItem( nWhich );
+}
 break;
 }
 nWhich = aIter.NextWhich();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-30 Thread Vasily Melenchuk
 sc/source/ui/docshell/externalrefmgr.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 0e7c8c3a1be5c266f8ba7ad42fd9ce80beae5264
Author: Vasily Melenchuk 
Date:   Tue Jan 23 13:59:01 2018 +0300

tdf#115044: do not load external documents if it is not allowed

Referenced external document data can be loaded after user
permission from dialog or corresponding settings.

Change-Id: If3aec37c8bbdee4aebeb99c7807e87c26df8e592
Reviewed-on: https://gerrit.libreoffice.org/48398
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 8b98991a66197a71953dbb900dc3aece6b4f9e3a)
Reviewed-on: https://gerrit.libreoffice.org/48870
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index a83a4799c879..80bd63d1c89d 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2368,6 +2368,15 @@ ScDocument* 
ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
 if (!pFileName)
 return nullptr;
 
+// Do not load document until it was allowed
+SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
+if ( pDocShell )
+{
+const comphelper::EmbeddedObjectContainer& rContainer = 
pDocShell->GetEmbeddedObjectContainer();
+if ( !rContainer.getUserAllowsLinkUpdate() )
+return nullptr;
+}
+
 ScDocument* pSrcDoc = nullptr;
 ScDocShell* pShell = 
static_cast(SfxObjectShell::GetFirst(checkSfxObjectShell,
 false));
 while (pShell)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-30 Thread Eike Rathke
 sc/source/core/tool/rangenam.cxx|8 +++-
 sc/source/filter/excel/xiname.cxx   |3 +++
 sc/source/filter/oox/defnamesbuffer.cxx |2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 908854a7b281454332af434be9468ec45d420030
Author: Eike Rathke 
Date:   Mon Jan 29 18:19:33 2018 +0100

CheckLinkFormulaNeedingCheck() for named expressions

 This is a combination of 3 commits.

CheckLinkFormulaNeedingCheck() for .ods named expressions

This is specifically necessary for named expressions that are used
in conditional format formulas, for which RPN is generated at a
later stage, not during import.

(cherry picked from commit eae9648e99be53ba441d9d8207aac6f3ce211ef2)

CheckLinkFormulaNeedingCheck() for .xls named expressions

(cherry picked from commit 8512f13c42ae3fbb287a555616fe10ff04295616)

CheckLinkFormulaNeedingCheck() for .xlsx named expressions

(cherry picked from commit a1f933ee2b9e23a505d937035821e9571cf4119c)

 Conflicts:
sc/source/filter/oox/defnamesbuffer.cxx

e03cb5767c34f8157a492a6d6c3b0700d065052d
217c89822ab477a6c383d170ae739e44efd10fa3

Change-Id: I54ab8dc14f81d6b18b0d17f448187d19d8e396fc
Reviewed-on: https://gerrit.libreoffice.org/48858
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index f2aff8454dce..28ae4b1ff09e 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -64,9 +64,14 @@ ScRangeData::ScRangeData( ScDocument* pDok,
 mnMaxCol(-1)
 {
 if (!rSymbol.isEmpty())
-CompileRangeData( rSymbol, pDoc->IsImportingXML());
+{
 // Let the compiler set an error on unknown names for a subsequent
 // CompileUnresolvedXML().
+const bool bImporting = pDoc->IsImportingXML();
+CompileRangeData( rSymbol, bImporting);
+if (bImporting)
+pDoc->CheckLinkFormulaNeedingCheck( *pCode);
+}
 else
 {
 // #i63513#/#i65690# don't leave pCode as NULL.
@@ -195,6 +200,7 @@ void ScRangeData::CompileUnresolvedXML( 
sc::CompileFormulaContext& rCxt )
 // Don't let the compiler set an error for unknown names on final
 // compile, errors are handled by the interpreter thereafter.
 CompileRangeData( aSymbol, false);
+rCxt.getDoc()->CheckLinkFormulaNeedingCheck( *pCode);
 }
 }
 
diff --git a/sc/source/filter/excel/xiname.cxx 
b/sc/source/filter/excel/xiname.cxx
index 50c55ca7ae84..3b2888016111 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -265,7 +265,10 @@ void XclImpName::InsertName(const ScTokenArray* pArray)
 }
 }
 if (pData)
+{
+GetDoc().CheckLinkFormulaNeedingCheck( *pData->GetCode());
 mpScData = pData;   // cache for later use
+}
 }
 
 XclImpNameManager::XclImpNameManager( const XclImpRoot& rRoot ) :
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx 
b/sc/source/filter/oox/defnamesbuffer.cxx
index 650256c5ab69..9341b7b3c677 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -39,6 +39,7 @@
 #include "tokenarray.hxx"
 #include "tokenuno.hxx"
 #include "compiler.hxx"
+#include "document.hxx"
 
 namespace oox {
 namespace xls {
@@ -332,6 +333,7 @@ std::unique_ptr DefinedName::getScTokens(
 // after, a resulting error must be reset.
 FormulaError nErr = pArray->GetCodeError();
 aCompiler.CompileTokenArray();
+getScDocument().CheckLinkFormulaNeedingCheck( *pArray);
 pArray->DelRPN();
 pArray->SetCodeError(nErr);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-27 Thread Eike Rathke
 sc/source/core/data/conditio.cxx  |6 ++
 sc/source/core/data/documen8.cxx  |   17 +++--
 sc/source/filter/excel/xicontent.cxx  |6 ++
 sc/source/filter/oox/condformatbuffer.cxx |2 ++
 4 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit dc44111ad5965bf4179fc654b677e1e445dea2f0
Author: Eike Rathke 
Date:   Thu Jan 25 13:20:27 2018 +0100

CheckLinkFormulaNeedingCheck() for conditional format expressions

 This is a combination of 4 commits.

Prepare CheckLinkFormulaNeedingCheck() to use either RPN or tokenized code

Conditional format formulas aren't finally compiled until needed
so the check will have to operate on the tokenized expression
instead of RPN code.

(cherry picked from commit faa0305ba3d0dc698fce4915d4f3a1fb52422380)

CheckLinkFormulaNeedingCheck() for .ods conditional format expressions

(cherry picked from commit 2930ba2ac5d9423f2848b968edcd8ddc71966186)

CheckLinkFormulaNeedingCheck() for .xlsx conditional format expressions

(cherry picked from commit fef24d9f999ee54d7936900485d97ff26656f517)

CheckLinkFormulaNeedingCheck() for .xls conditional format expressions

(cherry picked from commit af2a2a0c72db312902e466c36697b5c198041e82)

45eb1ab5efa0ec9da2663f20427d2474ce300826
31ede1a23223a798141a0891deeabd8cf88fff58
afa112cc591b411d80ead48bf726788d361f6eb3

Change-Id: I68837e9bd33f125ab47b10b1a6fa18175abd1627
Reviewed-on: https://gerrit.libreoffice.org/48719
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 502d0b1e0623..db4bd1f4b8fa 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -522,6 +522,12 @@ void ScConditionEntry::CompileXML()
 Compile( GetExpression(aSrcPos, 0, 0, eTempGrammar1),
  GetExpression(aSrcPos, 1, 0, eTempGrammar2),
  aStrNmsp1, aStrNmsp2, eTempGrammar1, eTempGrammar2, true );
+
+// Importing ocDde/ocWebservice?
+if (pFormula1)
+mpDoc->CheckLinkFormulaNeedingCheck(*pFormula1);
+if (pFormula2)
+mpDoc->CheckLinkFormulaNeedingCheck(*pFormula2);
 }
 
 void ScConditionEntry::SetSrcString( const OUString& rNew )
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 9cf09ddb4c70..ca8227058d5a 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1157,8 +1157,21 @@ void ScDocument::CheckLinkFormulaNeedingCheck( const 
ScTokenArray& rCode )
 if (HasLinkFormulaNeedingCheck())
 return;
 
-if (rCode.HasOpCodeRPN(ocDde) || rCode.HasOpCodeRPN(ocWebservice))
-SetLinkFormulaNeedingCheck(true);
+// Prefer RPN over tokenized formula if available.
+if (rCode.GetCodeLen())
+{
+if (rCode.HasOpCodeRPN(ocDde) || rCode.HasOpCodeRPN(ocWebservice))
+SetLinkFormulaNeedingCheck(true);
+}
+else if (rCode.GetLen())
+{
+if (rCode.HasOpCode(ocDde) || rCode.HasOpCode(ocWebservice))
+SetLinkFormulaNeedingCheck(true);
+}
+else
+{
+assert(!"called with empty ScTokenArray");
+}
 }
 
 // TimerDelays etc.
diff --git a/sc/source/filter/excel/xicontent.cxx 
b/sc/source/filter/excel/xicontent.cxx
index 14c2ad9d0a3f..89ebcfaada63 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -662,7 +662,10 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
 rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_CondFormat );
 // formula converter owns pTokArr -> create a copy of the token array
 if( pTokArr )
+{
 xTokArr1.reset( pTokArr->Clone() );
+GetDocRef().CheckLinkFormulaNeedingCheck( *xTokArr1);
+}
 }
 
 ::std::unique_ptr< ScTokenArray > pTokArr2;
@@ -673,7 +676,10 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
 rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_CondFormat );
 // formula converter owns pTokArr -> create a copy of the token array
 if( pTokArr )
+{
 pTokArr2.reset( pTokArr->Clone() );
+GetDocRef().CheckLinkFormulaNeedingCheck( *pTokArr2);
+}
 }
 
 // *** create the Calc conditional formatting ***
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 677ddb98af26..274f062b999d 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -868,11 +868,13 @@ void CondFormatRule::finalizeImport()
 {
 pTokenArray2.reset(new ScTokenArray());
 ScTokenConversion::ConvertToTokenArray( rDoc, *pTokenArray2.get(), 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-27 Thread Eike Rathke
 sc/source/core/tool/rangelst.cxx |  164 +--
 1 file changed, 89 insertions(+), 75 deletions(-)

New commits:
commit 74812a91ff29f6968dceba093250064985c0baa7
Author: Eike Rathke 
Date:   Mon Jan 22 19:55:38 2018 +0100

Flatten ScRangeList::Join() and ScRangePairList::Join() recursion

 This is a combination of 2 commits.

Flatten ScRangeList::Join() recursion

Joining an existing list of identical ranges could end up in a
very deep (but not infinite) recursion which could lead to stack
exhaustion. Recursion is unnecessary if we re-enter the loop with
the picked range. Continuing the loop as it was done after
recursion isn't necessary either, to the contrary, as long as
there is one join try the entire list again.

Commit f6eefd96cb16a9b5607fe59bdbf9b1121c9b56e8 pointed this out
as the UBSan build runs with ulimit -s 8192

Reviewed-on: https://gerrit.libreoffice.org/48360
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit 03f429665b4d57f63b8e2862a55e5c4273bc7a2b)

Flatten ScRangePairList::Join() recursion

Similar to ScRangeList::Join() done before.

Reviewed-on: https://gerrit.libreoffice.org/48361
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit 73049e5dbf9430df077dd26bed9d01435f745544)

e513b4c72bc211c196e13761b63446174321a389

 Conflicts:
sc/source/core/tool/rangelst.cxx

Backported.

Change-Id: Ibbc542fc8ae6d1509744aa731771eb6e32a38841
Reviewed-on: https://gerrit.libreoffice.org/48411
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 19fed29aba75..f4d9170c0161 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -218,12 +218,6 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
 Append( r );
 return ;
 }
-SCCOL nCol1 = r.aStart.Col();
-SCROW nRow1 = r.aStart.Row();
-SCTAB nTab1 = r.aStart.Tab();
-SCCOL nCol2 = r.aEnd.Col();
-SCROW nRow2 = r.aEnd.Row();
-SCTAB nTab2 = r.aEnd.Tab();
 
 // One common usage is to join ranges that actually are top to bottom
 // appends but the caller doesn't exactly know about it, e.g. when invoked
@@ -236,6 +230,7 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
 
 if (!bIsInList)
 {
+const SCROW nRow1 = r.aStart.Row();
 if (nRow1 > mnMaxRowUsed + 1)
 {
 Append( r );
@@ -246,9 +241,10 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
 // Check if we can simply enlarge the last range.
 ScRange* p = maRanges.back();
 if (p->aEnd.Row() + 1 == nRow1 &&
-p->aStart.Col() == nCol1 && p->aEnd.Col() == nCol2 &&
-p->aStart.Tab() == nTab1 && p->aEnd.Tab() == nTab2)
+p->aStart.Col() == r.aStart.Col() && p->aEnd.Col() == 
r.aEnd.Col() &&
+p->aStart.Tab() == r.aStart.Tab() && p->aEnd.Tab() == 
r.aEnd.Tab())
 {
+const SCROW nRow2 = r.aEnd.Row();
 p->aEnd.SetRow( nRow2 );
 mnMaxRowUsed = nRow2;
 return;
@@ -256,43 +252,45 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
 }
 }
 
-ScRange* pOver = const_cast(); // fies aber wahr wenn 
bInList
-size_t nOldPos = 0;
-if ( bIsInList )
-{
-// Find the current position of this range.
-for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
-{
-if ( maRanges[i] == pOver )
-{
-nOldPos = i;
-break;
-}
-}
-}
 bool bJoinedInput = false;
+const ScRange* pOver = 
+
+Label_Range_Join:
 
-// We need to query the size of the container dynamically since its size
-// may change during the loop.
-for ( size_t i = 0; i < maRanges.size() && pOver; ++i )
+assert(pOver);
+const SCCOL nCol1 = pOver->aStart.Col();
+const SCROW nRow1 = pOver->aStart.Row();
+const SCCOL nTab1 = pOver->aStart.Tab();
+const SCCOL nCol2 = pOver->aEnd.Col();
+const SCROW nRow2 = pOver->aEnd.Row();
+const SCCOL nTab2 = pOver->aEnd.Tab();
+
+size_t nOverPos = std::numeric_limits::max();
+for (size_t i = 0; i < maRanges.size(); ++i)
 {
 ScRange* p = maRanges[i];
 if ( p == pOver )
+{
+nOverPos = i;
 continue;   // the same one, continue with the next
+}
 bool bJoined = false;
-if ( p->In( r ) )
-{   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-22 Thread Eike Rathke
 sc/source/core/data/grouptokenconverter.cxx |   13 +
 sc/source/core/tool/token.cxx   |3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 811b40327c15e197b0967393e4071f48a60af42a
Author: Eike Rathke 
Date:   Sun Dec 17 17:34:15 2017 +0100

Related: tdf#114251 disable vectorization of svDoubleRef

It doesn't work, not knowing how to handle implicit intersections
not only produces huge unnecessary matrix operations but also
delivers wrong results.

Unit test will follow as a separate commit.

Change-Id: I14982d4a53d6af57196da998e53d426502c22fec
Reviewed-on: https://gerrit.libreoffice.org/46647
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 67444cbe5dae6e24db776ab712017ad063319276)
Reviewed-on: https://gerrit.libreoffice.org/46670
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/grouptokenconverter.cxx 
b/sc/source/core/data/grouptokenconverter.cxx
index 410e3662ae78..ee93866cc2e7 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -165,6 +165,18 @@ bool ScGroupTokenConverter::convert( ScTokenArray& rCode, 
sc::FormulaLogger::Gro
 break;
 case svDoubleRef:
 {
+/* FIXME: this simply does not work, it doesn't know
+ * a) the context of implicit intersection, for which creating
+  two arrays dows not only result in huge unnecessary 
matrix
+  operations but also produces wrong results, e.g. =B:B/C:C
+ * b) when to keep a reference as a reference depending on the
+  expected parameter type, e.g. INDEX(), OFFSET() and
+  others (though that *may* be disabled by OpCode already).
+ * Until both are solved keep the reference. */
+mrGroupTokens.AddToken(*p);
+break;
+
+#if 0
 ScComplexRefData aRef = *p->GetDoubleRef();
 ScRange aAbs = aRef.toAbs(mrPos);
 
@@ -237,6 +249,7 @@ bool ScGroupTokenConverter::convert( ScTokenArray& rCode, 
sc::FormulaLogger::Gro
 //ensure that backing storage exists for our lifetime
 mxFormulaGroupContext = mrDoc.GetFormulaGroupContext();
 }
+#endif
 }
 break;
 case svIndex:
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 562d03f62394..f73c431d3316 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1549,10 +1549,11 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
 // Don't change the state.
 break;
 case svSingleRef:
-case svDoubleRef:
 // Depends on the reference state.
 meVectorState = FormulaVectorCheckReference;
 break;
+case svDoubleRef:
+// Does not work yet, see ScGroupTokenConverter::convert()
 case svError:
 case svEmptyCell:
 case svExternal:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-22 Thread Eike Rathke
 sc/source/core/data/grouptokenconverter.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 0443eb8bf5ed79d13ec1aa49ac83ed2b2e8eea54
Author: Eike Rathke 
Date:   Sat Dec 16 22:52:09 2017 +0100

Type svIndex does not necessarily mean range name, tdf#114251 related

Change-Id: I5e7930b7f93ee44fb0d6b4c86f261afde8ed2ccc
Reviewed-on: https://gerrit.libreoffice.org/46615
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit ecac94f3a6872538c19827603b52f1ed7e671a4c)
Reviewed-on: https://gerrit.libreoffice.org/46668
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/grouptokenconverter.cxx 
b/sc/source/core/data/grouptokenconverter.cxx
index 8132c1c400f1..410e3662ae78 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -241,6 +241,13 @@ bool ScGroupTokenConverter::convert( ScTokenArray& rCode, 
sc::FormulaLogger::Gro
 break;
 case svIndex:
 {
+if (p->GetOpCode() != ocName)
+{
+// May be DB-range or TableRef
+mrGroupTokens.AddToken(*p);
+break;
+}
+
 // Named range.
 ScRangeName* pNames = mrDoc.GetRangeName();
 if (!pNames)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-16 Thread Eike Rathke
 sc/source/core/tool/interpr6.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a8a8559a24d043b4b1180acb3a0ff60052be5fad
Author: Eike Rathke 
Date:   Tue Dec 19 16:28:04 2017 +0100

Resolves: tdf#114539 only pop own parameters from stack

... and not another pending one..

Change-Id: Ief5c27ccfb0b4121f2ba019e0fb8770dabbf60cf
(cherry picked from commit 4b444b4c1efc2be219e6975e30048ff616fdac0f)
Reviewed-on: https://gerrit.libreoffice.org/46801
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index c42f0f4545d3..cf0553b813b9 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -926,10 +926,11 @@ void ScInterpreter::ScRawSubtract()
 // Obtain the minuend.
 double fRes = GetDouble();
 
-while (nGlobalError == FormulaError::NONE && nParamCount-- > 1)
+while (nGlobalError == FormulaError::NONE && nParamCount > 1)
 {
 // Simple single values without matrix support.
 fRes -= GetDouble();
+--nParamCount;
 }
 while (nParamCount-- > 0)
 PopError();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-16 Thread Julien Nabet
 sc/source/ui/view/tabvwshf.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 965d2060880096f4ad6381e16ec11d58fbae2d31
Author: Julien Nabet 
Date:   Sun Jan 14 10:20:09 2018 +0100

tdf#114992: fix crash in deleting sheet

See bt:
https://bugs.documentfoundation.org/attachment.cgi?id=139087

Change-Id: Iee72385a8e5400436da72fe5e18b8cdfccad193d
Reviewed-on: https://gerrit.libreoffice.org/47850
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 1d71f886d6760e5b3eeb4a0f9aaaead0816a45aa)
Reviewed-on: https://gerrit.libreoffice.org/47860
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 03b35199c6b2..169be29ec220 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -611,7 +611,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 {
 const ScDPObject& rDPObj = (*pDPs)[i];
 const ScSheetSourceDesc* pSheetSourceDesc 
= rDPObj.GetSheetDesc();
-if 
(pSheetSourceDesc->GetSourceRange().aStart.Tab() == nSelTab)
+if (pSheetSourceDesc && 
pSheetSourceDesc->GetSourceRange().aStart.Tab() == nSelTab)
 bTabWithPivotTable = true;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-16 Thread Stephan Bergmann
 sc/source/ui/navipi/navipi.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 545d417d714bee156b45f8117486ccf5433a7dd9
Author: Stephan Bergmann 
Date:   Thu Jan 11 17:20:02 2018 +0100

Add back initialization of ScNavigatorSettings::maExpandedVec

...lost with 2ea92be9973e6892727eae37ae958863702b3658 "convert SC_CONVERT
constants to scoped enum".  And indeed, e.g., opening the document from
 through 
steps 1
and 2 in a UBSan build reports a use of an uninitialized (bad-valued) bool 
in
ScNavigatorSettings::IsExpanded.

Change-Id: If0dfadc6bd8033e61e334f59b3028ab005a892cd
Reviewed-on: https://gerrit.libreoffice.org/47767
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit fbec01b7af438fc7409c875e59be7483772b53a2)
Reviewed-on: https://gerrit.libreoffice.org/47787
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 9b2819281c02..ba81eede2d3d 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -430,6 +430,7 @@ ScNavigatorSettings::ScNavigatorSettings()
 : mnRootSelected(ScContentId::ROOT)
 , mnChildSelected(SC_CONTENT_NOCHILD)
 {
+maExpandedVec.fill(false);
 }
 
 SFX_IMPL_CHILDWINDOWCONTEXT( ScNavigatorDialogWrapper, SID_NAVIGATOR )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-12 Thread Caolán McNamara
 sc/source/ui/docshell/arealink.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 06a2ffe863501e8bef88cd0201bd5e8d73e92242
Author: Caolán McNamara 
Date:   Fri Jan 12 10:48:59 2018 +

VclPtr, missing dispose

Change-Id: I790cd8be0d461d4c82c9b1c64e334bd37115dcaf
Reviewed-on: https://gerrit.libreoffice.org/47803
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/docshell/arealink.cxx 
b/sc/source/ui/docshell/arealink.cxx
index 2b01cddb41c7..5c0bd1ecdda6 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -88,7 +88,7 @@ void ScAreaLink::Edit(vcl::Window* pParent, const 
Link& /* rEn
 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-VclPtr pDlg = 
pFact->CreateScLinkedAreaDlg(pParent);
+ScopedVclPtr 
pDlg(pFact->CreateScLinkedAreaDlg(pParent));
 OSL_ENSURE(pDlg, "Dialog create fail!");
 pDlg->InitFromOldLink( aFileName, aFilterName, aOptions, aSourceArea, 
GetRefreshDelay() );
 pImpl->m_pDialog = pDlg;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-12 Thread Caolán McNamara
 sc/source/core/tool/interpr7.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit a916fc0c0e0e8b10cb4158fa0fa173fe205d434a
Author: Caolán McNamara 
Date:   Wed Jan 10 14:27:35 2018 +

limit WEBSERVICE to http[s] protocols

and like excel...

'For protocols that aren’t supported, such as ftp:// or file://, WEBSERVICE
returns the #VALUE! error value.'

Change-Id: I0e9c6fd3426fad56a199eafac48de9b0f23914b3
Reviewed-on: https://gerrit.libreoffice.org/47776
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 738447ea16dd..025b1ba0a3d0 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -247,6 +248,14 @@ void ScInterpreter::ScWebservice()
 return;
 }
 
+INetURLObject aObj(aURI, INetProtocol::File);
+INetProtocol eProtocol = aObj.GetProtocol();
+if (eProtocol != INetProtocol::Http && eProtocol != 
INetProtocol::Https)
+{
+PushError( FormulaError::NoValue );
+return;
+}
+
 uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( 
ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), 
uno::UNO_QUERY );
 if(!xFileAccess.is())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-07 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 02a60985b4a7333f1af6ba46021b56e641355589
Author: Eike Rathke 
Date:   Wed Dec 20 19:44:51 2017 +0100

Exclude more special OpCode values from vectorization

Namely those that have some reference assigned.

Change-Id: Icd5f79612295f13d552a256233b8f1298e3e5359
(cherry picked from commit b34c0cd9ada297e9565b1a93fcaa2a96333e1881)
Reviewed-on: https://gerrit.libreoffice.org/46861
Tested-by: Eike Rathke 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 7a9db36dbb1a..562d03f62394 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1604,6 +1604,19 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
 // Named expression would need "recursive" handling of its
 // token array for vector state in
 // ScFormulaCell::InterpretFormulaGroup() and below.
+
+case ocTableRef:
+// May result in a single cell or range reference, depending on
+// context.
+
+case ocColRowName:
+// The associated reference is the name cell with which to
+// create the implicit intersection.
+
+case ocColRowNameAuto:
+// Auto column/row names lead to references computed in
+// interpreter.
+
 SAL_INFO("sc.opencl", "opcode " << 
formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
 << " disables vectorisation for formula group");
 meVectorState = FormulaVectorDisabledByOpCode;
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2018-01-07 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit 174822c33c8d35d514fbb713e6a22d20559bb034
Author: Eike Rathke 
Date:   Sun Dec 17 00:46:07 2017 +0100

Related: tdf#114251 disable ocName named expressions for vectorization

Recursive checking of their token arrays would be needed.

This solves the slowness in the non-threading case of tdf#114251
because no arrays are generated for the named ranges, which is
rather a lucky workaround than a solution.

The wrong handling of range references in general (array where
scalar is expected, no implicit intersection) still persists.

Change-Id: I57385bd95efa584108d93d724921285c97a91a45
Reviewed-on: https://gerrit.libreoffice.org/46623
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 3193e78aba75c5b38d2683d9fd8593820048e8b9)
Reviewed-on: https://gerrit.libreoffice.org/46669
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 027786958ceb..7a9db36dbb1a 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1595,6 +1595,22 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
 SAL_INFO("sc.core.formulagroup", "opcode " << 
formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
 << " disables S/W interpreter for formula group");
 meVectorState = FormulaVectorDisabledNotInSoftwareSubset;
 }
+else
+{
+// All the rest, special commands, separators, error codes, ...
+switch (eOp)
+{
+case ocName:
+// Named expression would need "recursive" handling of its
+// token array for vector state in
+// ScFormulaCell::InterpretFormulaGroup() and below.
+SAL_INFO("sc.opencl", "opcode " << 
formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
 << " disables vectorisation for formula group");
+meVectorState = FormulaVectorDisabledByOpCode;
+break;
+default:
+;   // nothing
+}
+}
 }
 
 bool ScTokenArray::ImplGetReference( ScRange& rRange, const ScAddress& rPos, 
bool bValidOnly ) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-18 Thread Eike Rathke
 sc/source/core/tool/dbdata.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ee872acfe6ae0e2fd59f2e9b5e3cecdccbae21c7
Author: Eike Rathke 
Date:   Fri Dec 15 16:27:54 2017 +0100

Resolves: tdf#113537 don't keep nEndRow=MAXROW if data ends above

Change-Id: I186034cada9718c067fa4dc7f72e2ca55ac06f83
(cherry picked from commit fa100e0abc83b876ca18b4178c44fb1dfc452a5d)
Reviewed-on: https://gerrit.libreoffice.org/46566
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 1f2e7703f271..6422c7c33c3f 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -625,7 +625,12 @@ void ScDBData::ExtendDataArea(ScDocument* pDoc)
 SCCOL nOldCol1 = nStartCol, nOldCol2 = nEndCol;
 SCROW nOldEndRow = nEndRow;
 pDoc->GetDataArea(nTable, nStartCol, nStartRow, nEndCol, nEndRow, false, 
true);
-nEndRow = std::max(nEndRow, nOldEndRow);
+// nOldEndRow==MAXROW may easily happen when selecting whole columns and
+// setting an AutoFilter (i.e. creating an anonymous database-range). We
+// certainly don't want to iterate over nearly a million empty cells, but
+// keep only an intentionally user selected range.
+if (nOldEndRow < MAXROW && nEndRow < nOldEndRow)
+nEndRow = nOldEndRow;
 if (nStartCol != nOldCol1 || nEndCol != nOldCol2)
 {
 SAL_WARN_IF( !maTableColumnNames.empty(), "sc.core", 
"ScDBData::ExtendDataArea - invalidating column names/offsets");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-12 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 51bb22f7a8f1d9fe02243aa58427d63916226793
Author: Eike Rathke 
Date:   Mon Dec 11 18:21:32 2017 +0100

Resolves: tdf#114406 treat % as the operator that it is

Regression from

commit 73c7e0921d752df53004ed55735f3ecc592f
Date:   Tue Sep 20 21:39:10 2016 +0200

sc-perf: tdf#79023 for ODFF do not call SvNumberFormatter to 
determine numeric

for ODFF, and for OOXML

commit a8a8ff59c5749bbe1f2f58ea8fd42d66e6ae2a81
Date:   Tue Sep 20 22:37:59 2016 +0200

sc-perf: tdf#79023 do not call SvNumberFormatter also for numbers 
in OOXML

Numbers followed by a percent operator like 100% were always
(wrongly) treated as one entity (by '%' having ScCharFlags::Value)
and incidentally handled by the number formatter's parser, which
so far "worked" in the sense that the correct constant number was
produced (i.e. 1 here), but the expression detail was lost.

The commits above for performance reasons when reading ODF or
OOXML files don't let a symbol pass through the number formatter's
parser anymore and the "100%" does not represent a strict number,
so lead to #NAME? error at the end.

Set the proper flags in the compiler's character table to treat
'%' as operator in all circumstances.

Change-Id: I266beb74a313c779370e5fac42f45d0fb5cdba0c
(cherry picked from commit f6b2349e880afa82f9267087fb48b6e4f8a9aa05)
Reviewed-on: https://gerrit.libreoffice.org/46255
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index b795802affb6..6c3e7af0c9bf 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -325,7 +325,7 @@ ScCompiler::Convention::Convention( 
FormulaGrammar::AddressConvention eConv )
 /* $ */ t[36] = ScCharFlags::CharWord | ScCharFlags::Word | 
ScCharFlags::CharIdent | ScCharFlags::Ident;
 if (FormulaGrammar::CONV_ODF == meConv)
 /* $ */ t[36] |= ScCharFlags::OdfNameMarker;
-/* % */ t[37] = ScCharFlags::Value;
+/* % */ t[37] = ScCharFlags::Char | ScCharFlags::WordSep | 
ScCharFlags::ValueSep;
 /* & */ t[38] = ScCharFlags::Char | ScCharFlags::WordSep | 
ScCharFlags::ValueSep;
 /* ' */ t[39] = ScCharFlags::NameSep;
 /* ( */ t[40] = ScCharFlags::Char | ScCharFlags::WordSep | 
ScCharFlags::ValueSep;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-08 Thread Jens Carl
 sc/source/ui/docshell/dbdocfun.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 1d6caa96d23eda357277faa919d24ee7af52652a
Author: Jens Carl 
Date:   Fri Dec 8 09:09:39 2017 +

Fix segfault when ScDBDocFunc::AddDBRange is called ...

multiple time with same name. ScDBCollection::NamedDBs::insert() use an
unique_ptr to hold ScDBData* and if the insert isn't a success we don't
have clean up with delete.

Change-Id: I9b24834ea2e2dfd67b07438e6c4789ad0c01b888
Reviewed-on: https://gerrit.libreoffice.org/46075
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit d51e7581d90d55b5fe9a0f175d3cbee32de51721)
Reviewed-on: https://gerrit.libreoffice.org/46092
Reviewed-by: Jens Carl 
Tested-by: Jens Carl 

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index 71426d86ea70..3cc44bb58843 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -96,7 +96,6 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const 
ScRange& rRange )
 
 if (!bOk)
 {
-delete pNew;
 delete pUndoColl;
 return false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-07 Thread Julien Nabet
 sc/source/ui/view/tabview3.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit c195e84385c8917fab6f2091cab24d33f1e2bc6f
Author: Julien Nabet 
Date:   Tue Dec 5 22:01:26 2017 +0100

tdf#114228: fix crash when deleting sheet in specific case

1. Create a brand new ods file
2. Select L12 (so cursor is obviously on sheet1 L12)
3. Create a brand new sheet (and cursor is on sheet2 A1)
4. Delete sheet2

It crashes with gtk3, see 
https://bugs.documentfoundation.org/attachment.cgi?id=138199
As indicated in 
https://bugs.documentfoundation.org/show_bug.cgi?id=114228#c5 the tab number
is wrong
Reporting cursor management later in ScTabView::SetTabNo prevents from the 
crash

Change-Id: Iea307267d2cdcf1c01f7e72f45b6a68aeef26fa1
Reviewed-on: https://gerrit.libreoffice.org/45977
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 226eb8d91d4c..c90ea34daaae 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1810,8 +1810,6 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool 
bExtendSelection, bool bSa
 // UpdateShow before SetCursor, so that UpdateAutoFillMark finds the 
correct
 // window  (is called from SetCursor)
 UpdateShow();
-aViewData.ResetOldCursor();
-SetCursor( aViewData.GetCurX(), aViewData.GetCurY(), true );
 
 SfxBindings& rBindings = aViewData.GetBindings();
 ScMarkData& rMark = aViewData.GetMarkData();
@@ -1867,6 +1865,9 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool 
bExtendSelection, bool bSa
 UpdateVisibleRange();
 
 aViewData.GetViewShell()->WindowChanged();  // if the active 
window has changed
+aViewData.ResetOldCursor();
+SetCursor( aViewData.GetCurX(), aViewData.GetCurY(), true );
+
 if ( !bUnoRefDialog )
 aViewData.GetViewShell()->DisconnectAllClients();   // important 
for floating frames
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-03 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c8556086ad8560240d6e91cfd3fefad396288e36
Author: Eike Rathke 
Date:   Sat Dec 2 15:32:06 2017 +0100

ofz#4484 another stab at mnRangeOpPosInSymbol

Commit cd0b749cc4b4f268d26639fb3c6cbf2128b2d7df still missed it by
one position behind string length.

Also move the check to end of i18n symbol parsing for all
constellations.

 Conflicts:
sc/source/core/tool/compiler.cxx

Change-Id: I7b5e1375fe711dcc3f659e558702de78893d25a5
Reviewed-on: https://gerrit.libreoffice.org/45719
Tested-by: Eike Rathke 
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 62200282b2f0..b795802affb6 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2683,9 +2683,9 @@ Label_MaskStateMachine:
 {
 SetError( FormulaError::StringOverflow );
 nLen = MAXSTRLEN-1;
-if (mnRangeOpPosInSymbol > nLen)
-mnRangeOpPosInSymbol = -1;
 }
+if (mnRangeOpPosInSymbol >= nLen)
+mnRangeOpPosInSymbol = -1;
 lcl_UnicodeStrNCpy( cSymbol, aSymbol.getStr(), nLen );
 pSym = [nLen];
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-01 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6d67cc8299f17ecd50c2257f0022de85606a15f4
Author: Caolán McNamara 
Date:   Wed Nov 29 17:05:07 2017 +

ofz#4484 don't set mnRangeOpPosInSymbol on StringOverflow case

Change-Id: I35d86c97e4fb082a676a5eeadf8375738cecd7bd
Reviewed-on: https://gerrit.libreoffice.org/45566
Reviewed-by: Eike Rathke 
Tested-by: Michael Stahl 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d4eda96b2cae..62200282b2f0 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2225,14 +2225,16 @@ Label_MaskStateMachine:
 {
 // One range operator may form Sheet1.A:A, which we need to
 // pass as one entity to IsReference().
-mnRangeOpPosInSymbol = pSym - [0];
 if( pSym == [ MAXSTRLEN-1 ] )
 {
 SetError(FormulaError::StringOverflow);
 eState = ssStop;
 }
 else
+{
+mnRangeOpPosInSymbol = pSym - [0];
 *pSym++ = c;
+}
 }
 else if ( 128 <= c || '\'' == c )
 {   // High values need reparsing with i18n,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-12-01 Thread Caolán McNamara
 sc/source/filter/excel/xlescher.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 845bcfdcede2c59c592f0894ee29aed8241fa16a
Author: Caolán McNamara 
Date:   Thu Nov 30 15:55:00 2017 +

ofz#4406 limit escher object cell area to calc's limits

Change-Id: I9b9b198f1f96c952692d052a9a527086e453779f
Reviewed-on: https://gerrit.libreoffice.org/45616
Reviewed-by: Thorsten Behrens 
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/filter/excel/xlescher.cxx 
b/sc/source/filter/excel/xlescher.cxx
index dc25c1bdc0d7..a0ce92bee5b8 100644
--- a/sc/source/filter/excel/xlescher.cxx
+++ b/sc/source/filter/excel/xlescher.cxx
@@ -146,10 +146,10 @@ tools::Rectangle XclObjAnchor::GetRect( const XclRoot& 
rRoot, SCTAB nScTab, MapU
 ScDocument& rDoc = rRoot.GetDoc();
 double fScale = lclGetTwipsScale( eMapUnit );
 tools::Rectangle aRect(
-lclGetXFromCol( rDoc, nScTab, maFirst.mnCol, mnLX, fScale ),
-lclGetYFromRow( rDoc, nScTab, maFirst.mnRow, mnTY, fScale ),
-lclGetXFromCol( rDoc, nScTab, maLast.mnCol,  mnRX + 1, fScale ),
-lclGetYFromRow( rDoc, nScTab, maLast.mnRow,  mnBY, fScale ) );
+lclGetXFromCol(rDoc, nScTab, std::min(maFirst.mnCol, MAXCOL), 
mnLX, fScale),
+lclGetYFromRow(rDoc, nScTab, std::min(maFirst.mnRow, MAXROW), 
mnTY, fScale),
+lclGetXFromCol(rDoc, nScTab, std::min(maLast.mnCol, MAXCOL),  
mnRX + 1, fScale),
+lclGetYFromRow(rDoc, nScTab, std::min(maLast.mnRow, MAXROW),  
mnBY, fScale));
 
 // adjust coordinates in mirrored sheets
 if( rDoc.IsLayoutRTL( nScTab ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-28 Thread Bartosz Kosiorek
 sc/source/filter/oox/stylesbuffer.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 3278c8f9bb040cddd15d9e7eb4991d0447cbc964
Author: Bartosz Kosiorek 
Date:   Sat Nov 25 09:51:58 2017 +0100

tdf#113271 Fix order of color's attributes import.

The order of import color is very important in case of more than one color 
attributes was provided.
This order (theme -> rgb -> indexed -> auto) is not documented
and was gathered experimentally based on MS Excel 2013.

Information about :

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.fonts(v=office.14).aspx

Information about font:
https://msdn.microsoft.com/en-us/library/ff531892(v=office.12).aspx

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.font(v=office.14).aspx

More information about color class:

https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.color(v=office.14).aspx
https://msdn.microsoft.com/en-us/library/ff532831(v=office.12).aspx

Example:
With indexed auto, colour, rgb and them,


The priority is as follows:
1. theme
2. rgb
3. indexed
4. auto

Change-Id: I7bb5ab7d7b7a52091f0130fd6f21bac44eca7408
Reviewed-on: https://gerrit.libreoffice.org/45278
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 25fca16c643e..2711df0ad34f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -266,14 +266,16 @@ void Color::setIndexed( sal_Int32 nPaletteIdx, double 
fTint )
 
 void Color::importColor( const AttributeList& rAttribs )
 {
-if( rAttribs.getBool( XML_auto, false ) )
-setAuto();
+// tdf#113271 The order of import color is very important in case of more 
than one color attributes was provided.
+// This order (theme -> rgb -> indexed -> auto) is not documented and was 
gathered experimentally based on MS Excel 2013.
+if( rAttribs.hasAttribute( XML_theme ) )
+setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_rgb ) )
 setRgb( rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
-else if( rAttribs.hasAttribute( XML_theme ) )
-setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( 
XML_tint, 0.0 ) );
 else if( rAttribs.hasAttribute( XML_indexed ) )
 setIndexed( rAttribs.getInteger( XML_indexed, -1 ), 
rAttribs.getDouble( XML_tint, 0.0 ) );
+else if( rAttribs.getBool( XML_auto, false ) )
+setAuto();
 else
 {
 OSL_FAIL( "Color::importColor - unknown color type" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-20 Thread Caolán McNamara
 sc/source/ui/app/inputwin.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit f835c36a254c76d448fe62a923fe378c3fb60144
Author: Caolán McNamara 
Date:   Fri Nov 17 12:43:00 2017 +

tdf#113894 release ctrl of ctrl+v in input line should strip formatting

Change-Id: I1cd1501d6f20765d7e5a90a9ccb07745758682d4
Reviewed-on: https://gerrit.libreoffice.org/44881
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index dc9c6a336451..0752a655f75d 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1362,13 +1362,6 @@ void ScTextWnd::MouseButtonUp( const MouseEvent& rMEvt )
 
 void ScTextWnd::Command( const CommandEvent& rCEvt )
 {
-//pass alt press/release to parent impl
-if (rCEvt.GetCommand() == CommandEventId::ModKeyChange)
-{
-Window::Command(rCEvt);
-return;
-}
-
 bInputMode = true;
 CommandEventId nCommand = rCEvt.GetCommand();
 if ( mpEditView /* && nCommand == CommandEventId::StartDrag */ )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-17 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 701e1ec3a2e38a7b0bd2cdd3511a2a50578ea74e
Author: Caolán McNamara 
Date:   Wed Nov 15 11:48:47 2017 +

ofz: special case max index for cSymbol

Change-Id: Ia5fb036196b0cff0739789e691a36d294660540b
Reviewed-on: https://gerrit.libreoffice.org/44759
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit a5550289a37950195b7a7e5b22cba79ce5b5a673)
Reviewed-on: https://gerrit.libreoffice.org/44803

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 417523ad5514..d4eda96b2cae 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3270,6 +3270,8 @@ bool ScCompiler::IsReference( const OUString& rName, 
const OUString* pErrRef )
 return true;
 // Now try with a symbol up to the range operator, rewind source
 // position.
+if (mnRangeOpPosInSymbol == MAXSTRLEN-1)
+return false;
 sal_Int32 nLen = mnRangeOpPosInSymbol;
 while (cSymbol[++nLen])
 ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-17 Thread Eike Rathke
 sc/source/filter/inc/formel.hxx |   30 +-
 1 file changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 6ba9b72cff5a761f36b2b9b892b572bc7cb5ae18
Author: Eike Rathke 
Date:   Fri Nov 10 10:52:19 2017 +0100

ofz#4123 do not read past end of file

Change-Id: I1fa3543d541ea084a43a1a11f62680fa798f5647
(cherry picked from commit 78bcc5ddca186f0009124a697184f332405d3e1e)
Reviewed-on: https://gerrit.libreoffice.org/44586
Tested-by: Eike Rathke 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index 433ba0809a94..aa7944161439 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -143,31 +143,51 @@ inline void LotusConverterBase::Ignore( const long 
nSeekRel )
 inline void LotusConverterBase::Read( sal_uInt8& nByte )
 {
 aIn.ReadUChar( nByte );
-nBytesLeft--;
+if (aIn.good())
+nBytesLeft--;
+else
+{
+// SvStream::ReadUChar() does not init a single char on failure. This
+// behaviour is even tested in a unit test.
+nByte = 0;
+nBytesLeft = -1;// bail out early
+}
 }
 
 inline void LotusConverterBase::Read( sal_uInt16& nUINT16 )
 {
 aIn.ReadUInt16( nUINT16 );
-nBytesLeft -= 2;
+if (aIn.good())
+nBytesLeft -= 2;
+else
+nBytesLeft = -1;// bail out early
 }
 
 inline void LotusConverterBase::Read( sal_Int16& nINT16 )
 {
 aIn.ReadInt16( nINT16 );
-nBytesLeft -= 2;
+if (aIn.good())
+nBytesLeft -= 2;
+else
+nBytesLeft = -1;// bail out early
 }
 
 inline void LotusConverterBase::Read( double& fDouble )
 {
 aIn.ReadDouble( fDouble );
-nBytesLeft -= 8;
+if (aIn.good())
+nBytesLeft -= 8;
+else
+nBytesLeft = -1;// bail out early
 }
 
 inline void LotusConverterBase::Read( sal_uInt32& nUINT32 )
 {
 aIn.ReadUInt32( nUINT32 );
-nBytesLeft -= 4;
+if (aIn.good())
+nBytesLeft -= 4;
+else
+nBytesLeft = -1;// bail out early
 }
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-13 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8959754d2617dad38968ca008791e6431afcbdbd
Author: Caolán McNamara 
Date:   Sun Nov 12 21:16:42 2017 +

ofz+valgrind: Conditional jump or move depends on uninitialised value

if, before lcl_UnicodeStrNCpy is called, aSymbol contains embedded
nulls then the aSymbol.getLength() and the mnRangeOpPosInSymbol value
derived from an earlier aSymbol.getLength() include the range after
the embedded null, while lcl_UnicodeStrNCpy stops at the first
embedded null leaving cSymbol with uninitialized value that
are later read from it.

Conditional jump or move depends on uninitialised value(s)
   at 0x23BFBCA0: ScCompiler::IsReference(rtl::OUString const&, 
rtl::OUString const*) (compiler.cxx:3275)
   by 0x23BFFF4C: ScCompiler::NextNewToken(bool) (compiler.cxx:4248)
   by 0x23C00D20: ScCompiler::CompileString(rtl::OUString const&) 
(compiler.cxx:4419)
   by 0x23A29FAF: ScFormulaCell::Compile(rtl::OUString const&, bool, 
formula::FormulaGrammar::Grammar) (formulacell.cxx:1118)
   by 0x23A278B7: ScFormulaCell::ScFormulaCell(ScDocument*, ScAddress 
const&, rtl::OUString const&, formula::FormulaGrammar::Grammar, ScMatrixMode) 
(formulacell.cxx:656)
   by 0x23772EC3: ScColumn::ParseString(ScCellValue&, int, short, 
rtl::OUString const&, formula::FormulaGrammar::AddressConvention, 
ScSetStringParam const*) (column3.cxx:1729)
   by 0x2377354B: ScColumn::SetString(int, short, rtl::OUString const&, 
formula::FormulaGrammar::AddressConvention, ScSetStringParam*) 
(column3.cxx:1851)
   by 0x23AE2B97: ScTable::SetString(short, int, short, rtl::OUString 
const&, ScSetStringParam*) (table2.cxx:1369)
   by 0x23897045: ScDocument::SetString(short, int, short, rtl::OUString 
const&, ScSetStringParam*) (document.cxx:3377)
   by 0x1F35F41C: ScEEImport::WriteToDocument(bool, double, 
SvNumberFormatter*, bool) (eeimpars.cxx:400)
   by 0x1F366F3B: ScFormatFilterPluginImpl::ScImportRTF(SvStream&, 
rtl::OUString const&, ScDocument*, ScRange&) (rtfimp.cxx:34)

Change-Id: Iefc6be6c3a383bd9b3cdeaa896c07e24e5100dc7
Reviewed-on: https://gerrit.libreoffice.org/44658
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 6be596c282f84a3cb3a62edccfdfbf69663cf59e)
Reviewed-on: https://gerrit.libreoffice.org/44690

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index ee014534b977..417523ad5514 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1942,7 +1942,7 @@ void ScCompiler::SetError(FormulaError nError)
 static sal_Unicode* lcl_UnicodeStrNCpy( sal_Unicode* pDst, const sal_Unicode* 
pSrc, sal_Int32 nMax )
 {
 const sal_Unicode* const pStop = pDst + nMax;
-while ( *pSrc && pDst < pStop )
+while ( pDst < pStop )
 {
 *pDst++ = *pSrc++;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-09 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit f17640a95b4c65809f8573c778a293c836a847cd
Author: Caolán McNamara 
Date:   Wed Nov 8 17:05:59 2017 +

ofz: bad mnRangeOpPosInSymbol

Change-Id: Ieae5a81a1b475fd56cce76c43dab11c2d9fcbe6c
Reviewed-on: https://gerrit.libreoffice.org/44499
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 278f69f42f19..ee014534b977 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2681,6 +2681,8 @@ Label_MaskStateMachine:
 {
 SetError( FormulaError::StringOverflow );
 nLen = MAXSTRLEN-1;
+if (mnRangeOpPosInSymbol > nLen)
+mnRangeOpPosInSymbol = -1;
 }
 lcl_UnicodeStrNCpy( cSymbol, aSymbol.getStr(), nLen );
 pSym = [nLen];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-03 Thread Eike Rathke
 sc/source/core/data/column.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 76c54edc8ee972c63da8ed1f5d6ab75ea552da46
Author: Eike Rathke 
Date:   Thu Nov 2 12:53:14 2017 +0100

Resolves: tdf#111428 swap ScColumn::mnBlkCountFormula

 This is a combination of 2 commits.

(cherry picked from commit 423df1fa929784c14e3a133c06468589fe9269cd)
(cherry picked from commit 911e2aff3cc37cb7410292728ffea05fffbfb0b3)

CellStoreEvent remembered the original ScColumn::mnBlkCountFormula,
hence after inserting a column to the left the quick check of
ScColumn::HasFormulaCell() whether there are any formula cells worked on
the swapped in count (originally the one to the right) that happens to
be empty in the scenario. Things worked correctly by accident if the
next column to the right already contained a formula cell.

c44fed96c49bea7365bf1200e06788860966795c

Change-Id: If993856ceee657736f516a81c293506041a6b7eb
Reviewed-on: https://gerrit.libreoffice.org/44210
Reviewed-by: Markus Mohrhard 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 45f211cbedd1..5a817c2f747e 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1899,6 +1899,9 @@ void ScColumn::SwapCol(ScColumn& rCol)
 maCellTextAttrs.swap(rCol.maCellTextAttrs);
 maCellNotes.swap(rCol.maCellNotes);
 
+// Swap all CellStoreEvent mdds event_func related.
+std::swap( mnBlkCountFormula, rCol.mnBlkCountFormula);
+
 // notes update caption
 UpdateNoteCaptions(0, MAXROW);
 rCol.UpdateNoteCaptions(0, MAXROW);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-11-03 Thread Caolán McNamara
 sc/source/filter/rtf/rtfparse.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 82173efd8e639f387c87763a069ddad643b447d6
Author: Caolán McNamara 
Date:   Thu Nov 2 16:48:10 2017 +

crash on loading tdf77861-3.rtf in calc rtf filter

pActDefault is either pInsDefault or a member of maDefaultList,
so clear it if its not pInsDefault at this location

 ScRTFParser::ProcToken(RtfImportInfo*) (rtfparse.cxx:332)
 ScRTFParser::RTFImportHdl(RtfImportInfo&) (rtfparse.cxx:160)
 ScRTFParser::LinkStubRTFImportHdl(void*, RtfImportInfo&) (rtfparse.cxx:155)
 Link::Call(RtfImportInfo&) const (link.hxx:84)
 EditEngine::CallRtfImportHandler(RtfImportInfo&) (editeng.cxx:2770)
 EditRTFParser::NextToken(int) (eertfpar.cxx:231)
 SvRTFParser::Continue(int) (parrtf.cxx:643)
 SvxRTFParser::Continue(int) (svxrtf.cxx:128)
 SvRTFParser::CallParser() (parrtf.cxx:574)
 SvxRTFParser::CallParser() (svxrtf.cxx:123)
 EditRTFParser::CallParser() (eertfpar.cxx:112)
 ImpEditEngine::ReadRTF(SvStream&, EditSelection) (impedit4.cxx:161)
Address is 52 bytes inside a block of size 56 free'd
 std::default_delete::operator()(ScRTFCellDefault*) const 
(unique_ptr.h:76)
 std::unique_ptr::~unique_ptr() (unique_ptr.h:239)
 void std::_Destroy >(std::unique_ptr*) (stl_construct.h:93)
 void std::_Destroy_aux::__destroy*>(std::unique_ptr*, std::unique_ptr*) (stl_construct.h:103)
 void std::_Destroy*>(std::unique_ptr*, std::unique_ptr*) (stl_construct.h:126)
 void std::_Destroy*, std::unique_ptr >(std::unique_ptr*, std::unique_ptr*, 
std::allocator >&) (stl_construct.h:151)
 std::__cxx1998::vector, 
std::allocator > 
>::_M_erase_at_end(std::unique_ptr*) (stl_vector.h:1436)
 std::__cxx1998::vector, 
std::allocator > >::clear() (stl_vector.h:1210)
 std::__debug::vector, 
std::allocator > >::clear() (vector:690)
 ScRTFParser::ProcToken(RtfImportInfo*) (rtfparse.cxx:274)
 ScRTFParser::RTFImportHdl(RtfImportInfo&) (rtfparse.cxx:160)

Change-Id: I36624a76ddb01f0d26d38f708af6b910384ad7fd
Reviewed-on: https://gerrit.libreoffice.org/44226
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sc/source/filter/rtf/rtfparse.cxx 
b/sc/source/filter/rtf/rtfparse.cxx
index d5262fd13a16..00c207174ae6 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -272,6 +272,8 @@ void ScRTFParser::ProcToken( RtfImportInfo* pInfo )
 nLastWidth = maDefaultList.back()->nTwips;
 
 nColCnt = 0;
+if (pActDefault != pInsDefault)
+pActDefault = nullptr;
 maDefaultList.clear();
 pDefMerge = nullptr;
 nRtfLastToken = pInfo->nToken;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source sc/uiconfig vcl/source

2017-11-01 Thread Caolán McNamara
 sc/source/ui/inc/tptable.hxx   |8 ++
 sc/source/ui/pagedlg/tptable.cxx   |   77 --
 sc/uiconfig/scalc/ui/sheetprintpage.ui |   97 -
 vcl/source/window/builder.cxx  |6 ++
 4 files changed, 111 insertions(+), 77 deletions(-)

New commits:
commit 19ec0aac77913ede79fc107c341c89e945309a9b
Author: Caolán McNamara 
Date:   Thu Oct 26 12:49:44 2017 +0100

Resolves: tdf#113455 Impossible to clear width/height in pages

backport with stock-item "clear" to avoid new translation

Change-Id: I88f80d417108822ceeb73c07cb49892925a2e57f
Reviewed-on: https://gerrit.libreoffice.org/43892
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx
index f3d01eef310d..3b01422a68ce 100644
--- a/sc/source/ui/inc/tptable.hxx
+++ b/sc/source/ui/inc/tptable.hxx
@@ -46,6 +46,9 @@ private:
 voidShowImage();
 
 private:
+sal_uInt16  m_nOrigScalePageWidth;
+sal_uInt16  m_nOrigScalePageHeight;
+
 VclPtr m_pBtnTopDown;
 VclPtr m_pBtnLeftRight;
 VclPtr  m_pBmpPageDir;
@@ -66,7 +69,9 @@ private:
 VclPtr m_pEdScaleAll;
 VclPtr m_pGrHeightWidth;
 VclPtrm_pEdScalePageWidth;
+VclPtrm_pCbScalePageWidth;
 VclPtrm_pEdScalePageHeight;
+VclPtrm_pCbScalePageHeight;
 VclPtr m_pBxScalePageNum;
 VclPtrm_pEdScalePageNum;
 
@@ -74,8 +79,9 @@ private:
 
 // Handler:
 DECL_LINK(PageDirHdl, Button*, void);
-DECL_LINK( PageNoHdl, Button*, void );
+DECL_LINK(PageNoHdl, Button*, void);
 DECL_LINK(ScaleHdl, ListBox&, void);
+DECL_LINK(ToggleHdl, CheckBox&, void);
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_TPTABLE_HXX
diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx
index 1190ef82fbc7..d7be1c3cf171 100644
--- a/sc/source/ui/pagedlg/tptable.cxx
+++ b/sc/source/ui/pagedlg/tptable.cxx
@@ -55,9 +55,11 @@ static bool lcl_PutScaleItem2( sal_uInt16   
nWhich,
SfxItemSet&  rCoreSet,
const SfxItemSet&rOldSet,
const ListBox&   rListBox,
-   sal_uInt16   nLBEntry,
+   sal_uInt16   nLBEntry,
const NumericField&  rEd1,
-   const NumericField&  rEd2 );
+   sal_uInt16   nOrigScalePageWidth,
+   const NumericField&  rEd2,
+   sal_uInt16   nOrigScalePageHeight );
 
 static bool lcl_PutBoolItem( sal_uInt16nWhich,
   SfxItemSet&   rCoreSet,
@@ -78,9 +80,10 @@ static bool lcl_PutBoolItem( sal_uInt16nWhich,
 #define SC_TPTABLE_SCALE_TO 1
 #define SC_TPTABLE_SCALE_TO_PAGES   2
 
-ScTablePage::ScTablePage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs ) 
:
-
-SfxTabPage( pParent, 
"SheetPrintPage","modules/scalc/ui/sheetprintpage.ui",  )
+ScTablePage::ScTablePage(vcl::Window* pParent, const SfxItemSet& rCoreAttrs)
+: SfxTabPage(pParent, 
"SheetPrintPage","modules/scalc/ui/sheetprintpage.ui", )
+, m_nOrigScalePageWidth(0)
+, m_nOrigScalePageHeight(0)
 {
 get(m_pBtnTopDown,"radioBTN_TOPDOWN");
 get(m_pBtnLeftRight,"radioBTN_LEFTRIGHT");
@@ -102,7 +105,9 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const 
SfxItemSet& rCoreAttrs ) :
 get(m_pEdScaleAll,"spinED_SCALEALL");
 get(m_pGrHeightWidth,"gridWH");
 get(m_pEdScalePageWidth,"spinED_SCALEPAGEWIDTH");
+get(m_pCbScalePageWidth,"unsetwidth");
 get(m_pEdScalePageHeight,"spinED_SCALEPAGEHEIGHT");
+get(m_pCbScalePageHeight,"unsetheight");
 get(m_pBxScalePageNum,"boxNP");
 get(m_pEdScalePageNum,"spinED_SCALEPAGENUM");
 
@@ -112,7 +117,8 @@ ScTablePage::ScTablePage( vcl::Window* pParent, const 
SfxItemSet& rCoreAttrs ) :
 m_pBtnTopDown->SetClickHdl( PAGEDIR_HDL );
 m_pBtnLeftRight->SetClickHdl( PAGEDIR_HDL );
 m_pLbScaleMode->SetSelectHdl( LINK(this,ScTablePage,ScaleHdl) );
-
+m_pCbScalePageWidth->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
+m_pCbScalePageHeight->SetToggleHdl(LINK(this, ScTablePage, ToggleHdl));
 }
 
 void ScTablePage::ShowImage()
@@ -146,7 +152,9 @@ void ScTablePage::dispose()
 m_pBxScaleAll.clear();
 m_pEdScaleAll.clear();
 m_pGrHeightWidth.clear();
+m_pCbScalePageWidth.clear();
 m_pEdScalePageWidth.clear();
+m_pCbScalePageHeight.clear();
 m_pEdScalePageHeight.clear();
 m_pBxScalePageNum.clear();
 m_pEdScalePageNum.clear();
@@ -203,10 +211,12 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet )
 /*  width==0 and height==0 is invalid state, used as "not selected".
 Dialog 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-10-27 Thread Eike Rathke
 sc/source/filter/qpro/qproform.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit d78b60fc7b7acb6675afe077968cd23586092c96
Author: Eike Rathke 
Date:   Fri Oct 27 11:39:39 2017 +0200

ofz#2947 check for input stream end

Change-Id: I48d43a358e9a8e37a3c862c310a2e4b2e756f536
Reviewed-on: https://gerrit.libreoffice.org/43937
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit b53974c1530d14eebdc561ada3ecaf8fc3b58929)
Reviewed-on: https://gerrit.libreoffice.org/43946
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/filter/qpro/qproform.cxx 
b/sc/source/filter/qpro/qproform.cxx
index 4ec3f386a338..0726f48d52e3 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -172,6 +172,14 @@ do { \
 nRef-=amt; \
 } while(false)
 
+#define SAFEREAD_OR_BREAK( aStream, i, nRef, eRet, ret ) \
+if (!aStream.good()) \
+{ \
+i = nRef-1; /* will be incremented at end of while */ \
+eRet = ret; \
+break;  /* switch */ \
+}
+
 ConvErr QProToSc::Convert( const ScTokenArray*& pArray )
 {
 sal_uInt8 nFmla[ nBufSize ], nArg;
@@ -245,6 +253,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray )
 nDLLCount = 0;
 nArgCount = 0;
 nStringCount = 0;
+ConvErr eRet = ConvErr::OK;
 
 while( i < nRef && ( nFmla[ i ] != 0x03 ) )
 {
@@ -298,14 +307,17 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray )
 
 case FT_Cref : // Single cell reference
 maIn.ReadUInt16( nNote ).ReadSChar( nCol ).ReadSChar( nPage 
).ReadUInt16( nRelBits );
+SAFEREAD_OR_BREAK( maIn, i, nRef, eRet, ConvErr::Count);
 ReadSRD( aSRD, nPage, nCol, nRelBits );
 aStack << aPool.Store( aSRD );
 break;
 
 case FT_Range: // Block reference
 maIn.ReadUInt16( nNote ).ReadSChar( nCol ).ReadSChar( nPage 
).ReadUInt16( nRelBits );
+SAFEREAD_OR_BREAK( maIn, i, nRef, eRet, ConvErr::Count);
 ReadSRD( aCRD.Ref1, nPage, nCol, nRelBits );
 maIn.ReadSChar( nCol ).ReadSChar( nPage ).ReadUInt16( nRelBits 
);
+SAFEREAD_OR_BREAK( maIn, i, nRef, eRet, ConvErr::Count);
 ReadSRD( aCRD.Ref2, nPage, nCol, nRelBits );
 // Sheet name of second corner is not displayed if identical
 if (aCRD.Ref1.IsFlag3D() && aCRD.Ref1.Tab() == aCRD.Ref2.Tab() 
&&
@@ -368,7 +380,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray )
 i++;
 }
 pArray = aPool[ aStack.Get() ];
-return ConvErr::OK;
+return eRet;
 }
 
 static const struct
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-10-22 Thread Eike Rathke
 sc/source/ui/app/inputhdl.cxx |   16 
 sc/source/ui/app/inputwin.cxx |8 +---
 sc/source/ui/inc/inputhdl.hxx |9 +++--
 3 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 99fdaf683e6403b1d8a70d48ebe0e20194017624
Author: Eike Rathke 
Date:   Thu Oct 19 19:23:01 2017 +0200

Resolves: tdf#113179 merge language attributes early, tdf#108795 follow-up

Merging attributes from table to top EditEngine has to be done
before colorizing with the range finder, as the resulting merged
default item set *overwrites* the items set.

Change-Id: I6561201de11344161f61d7d4cf6a7b79d76ba493
(cherry picked from commit 8112af3361fdf15fcf5d3177cd967e1d8d97d5f3)
Reviewed-on: https://gerrit.libreoffice.org/43572
Tested-by: Jenkins 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index ac72e1123ad1..a84291d721a5 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2020,7 +2020,8 @@ void ScInputHandler::RemoveRangeFinder()
 DeleteRangeFinder(); // Deletes the list and the labels on the table
 }
 
-bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool 
bInputActivated )
+bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool 
bInputActivated,
+ScEditEngineDefaulter* pTopEngine )
 {
 bool bNewTable = false;
 
@@ -2141,6 +2142,13 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, 
bool bFromCommand, bool bIn
 }
 }
 
+if (pTopEngine)
+{
+// Necessary to sync SvxAutoCorrect behavior. This has to be
+// done before InitRangeFinder() below.
+MergeLanguageAttributes( *pTopEngine);
+}
+
 //  UpdateSpellSettings enables online spelling if needed
 //  -> also call if attributes are unchanged
 UpdateSpellSettings( true ); // uses pLastPattern
@@ -2272,7 +2280,7 @@ bool ScInputHandler::DataChanging( sal_Unicode cTyped, 
bool bFromCommand )
 bInOwnChange = true; // disable ModifyHdl (reset in DataChanged)
 
 if ( eMode == SC_INPUT_NONE )
-return StartTable( cTyped, bFromCommand, false );
+return StartTable( cTyped, bFromCommand, false, nullptr );
 else
 return false;
 }
@@ -2488,7 +2496,7 @@ void ScInputHandler::InvalidateAttribs()
 
 // --- public methods 
 
-void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText )
+void ScInputHandler::SetMode( ScInputMode eNewMode, const OUString* pInitText, 
ScEditEngineDefaulter* pTopEngine )
 {
 if ( eMode == eNewMode )
 return;
@@ -2519,7 +2527,7 @@ void ScInputHandler::SetMode( ScInputMode eNewMode, const 
OUString* pInitText )
 {
 if (eOldMode == SC_INPUT_NONE) // not if switching between modes
 {
-if (StartTable(0, false, eMode == SC_INPUT_TABLE))
+if (StartTable(0, false, eMode == SC_INPUT_TABLE, pTopEngine))
 {
 if (pActiveViewSh)
 pActiveViewSh->GetViewData().GetDocShell()->PostEditView( 
mpEditEngine.get(), aCursorPos );
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 6ef5adab11c2..dc9c6a336451 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1108,13 +1108,7 @@ void ScTextWnd::StartEditEngine()
 
 ScInputHandler* pHdl = mpViewShell->GetInputHandler();
 if (pHdl)
-{
-bool bStarting = !pHdl->IsEditMode();
-pHdl->SetMode(SC_INPUT_TOP);
-if (bStarting)
-// necessary to sync SvxAutoCorrect behavior
-pHdl->MergeLanguageAttributes( *mpEditEngine);
-}
+pHdl->SetMode(SC_INPUT_TOP, nullptr, mpEditEngine.get());
 
 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
 if (pViewFrm)
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index b4c98b3edc2b..2e632f2d60fd 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -128,9 +128,13 @@ private:
  *   for text or number.
  * @param bInputActivated true if the cell input mode is activated (via
  *F2), false otherwise.
+ * @param pTopEngine top window input line EditEngine. If not nullptr then
+ *   some default attributes are merged to it from the
+ *   table EditEngine.
  * @return true if the new edit mode has been started.
  */
-boolStartTable( sal_Unicode cTyped, bool bFromCommand, bool 
bInputActivated );
+boolStartTable( sal_Unicode cTyped, bool bFromCommand, bool 
bInputActivated,
+ScEditEngineDefaulter* pTopEngine );
 void   

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-10-16 Thread Eike Rathke
 sc/source/filter/xml/xmlcelli.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 714ef78b8dd60020a70d2ffc364d737503c49992
Author: Eike Rathke 
Date:   Mon Oct 2 16:13:34 2017 +0200

Resolves: tdf#112780 no ResetDirty() after SetHybridEmptyDisplayedAsString()

Change-Id: Idea5c1bd8e8577eaf90fc47d39f88c79963c422b
(cherry picked from commit df778416981ab02d42182e5c2e46dc09ba2e2a3c)
Reviewed-on: https://gerrit.libreoffice.org/43047
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 43e51e653886..90682874db1b 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1014,8 +1014,13 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
 pFCell->SetHybridDouble(fValue);
 if (mbPossibleEmptyDisplay && fValue == 0.0)
+{
+// Needs to be recalculated to propagate, otherwise would be
+// propagated as empty string. So don't ResetDirty().
 pFCell->SetHybridEmptyDisplayedAsString();
-pFCell->ResetDirty();
+}
+else
+pFCell->ResetDirty();
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-10-01 Thread Eike Rathke
 sc/source/filter/oox/sheetdatabuffer.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit ffeaa487a9ba67eee816016e50b6092abb217003
Author: Eike Rathke 
Date:   Sat Sep 30 20:31:34 2017 +0200

Resolves: tdf#100822 use sax::Converter::parseDateTime() for 'd' ISO 8601 
date

Instead of squeezing the string through the locale dependent
number parser (which should force '.' Time100SecSeparator for 'T'
ISO 8601 but apparently doesn't yet) that is a bottle neck anyway.

Change-Id: I70f74e680322a715c9cc658c8be033620d9798e3
(cherry picked from commit 5374c04a89e1720490a3625dfd95406c2d60c0cd)
Reviewed-on: https://gerrit.libreoffice.org/42970
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 585a8a1bbcf6..e5ee2cf637fc 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -48,6 +48,7 @@
 #include "documentimport.hxx"
 #include "formulabuffer.hxx"
 #include 
+#include 
 
 namespace oox {
 namespace xls {
@@ -206,15 +207,17 @@ void SheetDataBuffer::setErrorCell( const CellModel& 
rModel, sal_uInt8 nErrorCod
 
 void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& 
rDateString )
 {
-ScDocument& rDoc = getScDocument();
-SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-
-double fValue = 0.0;
-sal_uInt32 nFormatIndex = 0;
-bool bValid = pFormatter->IsNumberFormat( rDateString, nFormatIndex, 
fValue );
+css::util::DateTime aDateTime;
+if (!sax::Converter::parseDateTime( aDateTime, nullptr, rDateString))
+{
+SAL_WARN("sc.filter", "SheetDataBuffer::setDateCell - could not parse: 
" << rDateString);
+// At least don't lose data.
+setStringCell( rModel, rDateString);
+return;
+}
 
-if(bValid)
-setValueCell( rModel, fValue );
+double fSerial = getUnitConverter().calcSerialFromDateTime( aDateTime);
+setValueCell( rModel, fSerial);
 }
 
 void SheetDataBuffer::createSharedFormula(const ScAddress& rAddr, const 
ApiTokenSequence& rTokens)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-28 Thread Eike Rathke
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8d6dd32d58494cc21c32bc3c4798fdd4593bde08
Author: Eike Rathke 
Date:   Wed Sep 27 18:58:07 2017 +0200

Resolves: tdf#112523 do not use anything Ascii in UI context

Change-Id: I0854f7b1e6e0bf51d8b4c7d846fad9b0ff25e763
(cherry picked from commit 86910087fa41956aad6a22943bfbeb158e205dcd)
Reviewed-on: https://gerrit.libreoffice.org/42871
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index cc702882c72e..ac72e1123ad1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1300,7 +1300,7 @@ namespace {
 
 bool needToExtendSelection(const OUString& rSelectedText, const OUString& 
rInsertText)
 {
-return !rInsertText.startsWithIgnoreAsciiCase(rSelectedText);
+return !ScGlobal::GetpTransliteration()->isMatch( rSelectedText, 
rInsertText);
 }
 
 void completeFunction( EditView* pView, const OUString& rInsert, bool& 
rParInserted )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-25 Thread Caolán McNamara
 sc/source/ui/view/gridwin.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 9602a07fe0cd3f1b9d78279629393ec1d173ebca
Author: Caolán McNamara 
Date:   Sun Sep 24 19:15:41 2017 +0100

tdf#112388 make aComboButton release its ScGridWindow outputdevice

Change-Id: I938e36dda7fbc3b769b3fba8fd9a7d5d9b8e248c
Reviewed-on: https://gerrit.libreoffice.org/42716
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit eaf7d58ef57daa7580057b38625cd9a96ffe2a43)
Reviewed-on: https://gerrit.libreoffice.org/42724
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index ef859a001a6a..620df7c4b99f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -507,6 +507,7 @@ void ScGridWindow::dispose()
 mpNoteMarker.reset();
 mpAutoFilterPopup.disposeAndClear();
 mpDPFieldPopup.disposeAndClear();
+aComboButton.SetOutputDevice(nullptr);
 
 vcl::Window::dispose();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-18 Thread Caolán McNamara
 sc/source/ui/docshell/impex.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 13e0a30a00fb5c5bc3873a2422dea080236361af
Author: Caolán McNamara 
Date:   Mon Sep 18 15:40:16 2017 +0100

ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early

Change-Id: I91fcd2571e528201e01467f3bcdbbff30cdfb50c
Reviewed-on: https://gerrit.libreoffice.org/42425
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 62b6663d50bf..1496e66deffd 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1893,9 +1893,19 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 {
 case 'X':
 nCol = static_cast(OUString(p).toInt32()) + 
nStartCol - 1;
+if (nCol < 0 || MAXCOL < nCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;X invalid nCol=" << nCol);
+nCol = std::max( 0, std::min( 
nCol, MAXCOL));
+}
 break;
 case 'Y':
 nRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRow < 0 || MAXROW < nRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;Y invalid nRow=" << nRow);
+nRow = std::max( 0, std::min( 
nRow, MAXROW));
+}
 break;
 case 'P' :
 if ( bData )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-15 Thread Eike Rathke
 sc/source/core/data/documen7.cxx |3 ++-
 sc/source/core/data/table5.cxx   |   15 ---
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit de4a0f769501b0b79b05e007ae340af344017dd0
Author: Eike Rathke 
Date:   Thu Aug 24 19:33:32 2017 +0200

Resolves: tdf#93171 follow-up, notify dependents of subtotal formula cells

Track ScHiddenRowsChanged collected cells and broadcast with ScDataChanged.

Change-Id: Id41d2731585f6749533319bf42ad655a845ecf30
(cherry picked from commit c84332184a5de3e4180514cf6e3282597ffe5dd6)
Reviewed-on: https://gerrit.libreoffice.org/41530
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 8ab7e6014266..913b9cf0c055 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -559,7 +559,8 @@ void ScDocument::TrackFormulas( SfxHintId nHintId )
 if (!pBASM)
 return;
 
-if (pBASM->IsInBulkBroadcast() && !IsFinalTrackFormulas() && nHintId == 
SfxHintId::ScDataChanged)
+if (pBASM->IsInBulkBroadcast() && !IsFinalTrackFormulas() &&
+(nHintId == SfxHintId::ScDataChanged || nHintId == 
SfxHintId::ScHiddenRowsChanged))
 {
 SetTrackFormulasPending();
 return;
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 81ad0057e68b..d65632536262 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -40,6 +40,7 @@
 #include "globalnames.hxx"
 #include "scmod.hxx"
 #include "printopt.hxx"
+#include "bcaslot.hxx"
 
 #include 
 
@@ -593,9 +594,17 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, 
bool bHidden)
 {
 if (IsStreamValid())
 SetStreamValid(false);
-for (SCCOL i = 0; i < aCol.size(); i++)
-{
-aCol[i].BroadcastRows(nStartRow, nEndRow, 
SfxHintId::ScHiddenRowsChanged);
+
+{   // Scoped bulk broadcast.
+// Only subtotal formula cells will accept the notification of
+// SfxHintId::ScHiddenRowsChanged, leaving the bulk will track
+// those and broadcast SfxHintId::ScDataChanged to notify all
+// dependents.
+ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), 
SfxHintId::ScDataChanged);
+for (SCCOL i = 0; i < aCol.size(); i++)
+{
+aCol[i].BroadcastRows(nStartRow, nEndRow, 
SfxHintId::ScHiddenRowsChanged);
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-15 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |8 ++--
 sc/source/core/tool/scmatrix.cxx |8 
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 09b4b50ef5bfe1b7d963ae70071d4e8ce20f361d
Author: Eike Rathke 
Date:   Mon Sep 4 12:57:16 2017 +0200

Resolves: tdf#103734 propagate error from matrix to MIN()/MAX()

(cherry picked from commit 9e694c747954078442d47d3d7bd1d4db283b96ff)

 Conflicts:
sc/source/core/tool/interpr1.cxx

Backported.

Change-Id: I1ebc5baf4957ef9e3d1477b803cf7fee02754360
Reviewed-on: https://gerrit.libreoffice.org/41883
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c27e4c2ede86..42db756a2e01 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3509,7 +3509,9 @@ void ScInterpreter::ScMin( bool bTextAsZero )
 SetError(FormulaError::IllegalParameter);
 }
 }
-if ( nVal < nMin  )
+if (!rtl::math::isFinite(nVal))
+PushError( GetDoubleErrorValue( nVal));
+else if ( nVal < nMin  )
 PushDouble(0.0);
 else
 PushDouble(nMin);
@@ -3604,7 +3606,9 @@ void ScInterpreter::ScMax( bool bTextAsZero )
 SetError(FormulaError::IllegalParameter);
 }
 }
-if ( nVal > nMax  )
+if (!rtl::math::isFinite(nVal))
+PushError( GetDoubleErrorValue( nVal));
+else if ( nVal > nMax  )
 PushDouble(0.0);
 else
 PushDouble(nMax);
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 0a3dca7cb12d..c4309474db68 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1388,6 +1388,10 @@ struct MaxOp
 static double init() { return -std::numeric_limits::max(); }
 static double compare(double left, double right)
 {
+if (!rtl::math::isFinite(left))
+return left;
+if (!rtl::math::isFinite(right))
+return right;
 return std::max(left, right);
 }
 
@@ -1406,6 +1410,10 @@ struct MinOp
 static double init() { return std::numeric_limits::max(); }
 static double compare(double left, double right)
 {
+if (!rtl::math::isFinite(left))
+return left;
+if (!rtl::math::isFinite(right))
+return right;
 return std::min(left, right);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-15 Thread Eike Rathke
 sc/source/ui/cctrl/checklistmenu.cxx |   41 +--
 sc/source/ui/inc/checklistmenu.hxx   |2 -
 2 files changed, 31 insertions(+), 12 deletions(-)

New commits:
commit 7f208a5287a6eda301b0c3c797d5e21181ce27d2
Author: Eike Rathke 
Date:   Thu Sep 7 22:00:59 2017 +0200

Resolves: tdf#112258 correctly pick items from AutoFilter selection

 This is a combination of 2 commits.

Resolves: tdf#112258 correctly pick items from AutoFilter selection

Combining only one child with one parent to lookup is not sufficient if we 
have
year,month,day chains. The entire chain is needed.

Regression from

commit 2a39dc74724d3648ff76aa900edfebe0dd19b296
Date:   Thu Jun 1 18:27:13 2017 +0200

tdf#108259 Fix nested checkbox handling in autofilter popup

and

commit 511fb8e80d298d42f5c45e7410bf64f2a25b441e
Date:   Wed May 31 10:59:42 2017 +0200

tdf#108259 Enable autofilter with many different values

which combined landed in 5.4 as

commit 0163957ef808cffa332c2ddd3267409c5ae1494a
Date:   Wed May 31 10:59:42 2017 +0200

tdf#108259 Enable autofilter with many different values

This on the other hand makes the change of these doubtful, as for each leaf
item the concatenation and the lookup has to be done. Something to be
investigated.

(cherry picked from commit bece4b6715cfec8eaaa6ee97bade92521d1e2d18)

If children then insert only if a child is selected, tdf#112258 follow-up

Otherwise the chain down to the parent would be pickable, though in 
practice it
doesn't have a consequence as only leaves are picked. However, inserting to 
the
set can be avoided.

(cherry picked from commit fd5ac4c4f5de9ef475156dafcba1b37a56b5cb8d)

6a6b63b2d7c031a2dd13d8cc7d98f15e1f946298

Change-Id: I07fd6367bb8da2adab94a43c45fe88391179f496
Reviewed-on: https://gerrit.libreoffice.org/42085
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 8b43361e8ced..c6657cbab41e 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1639,14 +1639,18 @@ void ScCheckListBox::Init()
 SetNodeDefaultImages();
 }
 
-void ScCheckListBox::GetRecursiveChecked(SvTreeListEntry* pEntry, 
std::unordered_set& vOut, SvTreeListEntry* pParent)
+void ScCheckListBox::GetRecursiveChecked( SvTreeListEntry* pEntry, 
std::unordered_set& vOut,
+OUString& rLabel )
 {
 if (GetCheckButtonState(pEntry) == SvButtonState::Checked)
 {
-// we have to hash both parent and child together
-OUString aName = GetEntryText(pEntry);
-if (pParent) aName += GetEntryText(pParent);
-vOut.insert(aName);
+// We have to hash parents and children together.
+// Per convention for easy access in getResult()
+// "child;parent;grandparent" while descending.
+if (rLabel.isEmpty())
+rLabel = GetEntryText(pEntry);
+else
+rLabel = GetEntryText(pEntry) + ";" + rLabel;
 }
 
 if (pEntry->HasChildren())
@@ -1654,10 +1658,14 @@ void 
ScCheckListBox::GetRecursiveChecked(SvTreeListEntry* pEntry, std::unordered
 const SvTreeListEntries& rChildren = pEntry->GetChildEntries();
 for (auto& rChild : rChildren)
 {
-GetRecursiveChecked(rChild.get(), vOut, pEntry);
+OUString aLabel = rLabel;
+GetRecursiveChecked( rChild.get(), vOut, aLabel);
+if (!aLabel.isEmpty() && aLabel != rLabel)
+vOut.insert( aLabel);
 }
+// Let the caller not add the parent alone.
+rLabel.clear();
 }
-
 }
 
 std::unordered_set ScCheckListBox::GetAllChecked()
@@ -1667,7 +1675,10 @@ std::unordered_set 
ScCheckListBox::GetAllChecked()
 SvTreeListEntry* pEntry = GetEntry(nRootPos);
 while (pEntry)
 {
-GetRecursiveChecked(pEntry, vResults, nullptr);
+OUString aLabel;
+GetRecursiveChecked( pEntry, vResults, aLabel);
+if (!aLabel.isEmpty())
+vResults.insert( aLabel);
 pEntry = GetEntry(++nRootPos);
 }
 
@@ -1952,9 +1963,17 @@ void ScCheckListMenuWindow::getResult(ResultType& 
rResult)
 if (aLabel.isEmpty())
 aLabel = ScGlobal::GetRscString(STR_EMPTYDATA);
 
-bool bState = vCheckeds.find(maMembers[i].mpParent ?
-
aLabel.copy(0).concat(maChecks->GetEntryText(maMembers[i].mpParent)) :
-aLabel) != vCheckeds.end();
+/* TODO: performance-wise this looks 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-14 Thread Eike Rathke
 sc/source/ui/docshell/impex.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c5dbd79f37cb76a638af2c409acb200ea4ef5ffc
Author: Eike Rathke 
Date:   Thu Aug 31 15:26:35 2017 +0200

SYLK import: init nRefCol,nRefRow with start col,row instead of 1,1

So in a malformed document that does not specify ;X;Y;C;R before ;M a 1x1
matrix formula is created at nStartCol,nStartRow instead of 2x2

Change-Id: Idcc0f9d8c65bb142587fa6419af6f4dcb6209a0e
(cherry picked from commit 13787b61d2fa4ef5e61a41e4bb0424a870dc03bf)
Reviewed-on: https://gerrit.libreoffice.org/42279
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index f1e74326e3f0..62b6663d50bf 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1729,8 +1729,8 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 OString aByteLine;
 SCCOL nCol = nStartCol;
 SCROW nRow = nStartRow;
-SCCOL nRefCol = 1;
-SCROW nRefRow = 1;
+SCCOL nRefCol = nCol;
+SCROW nRefRow = nRow;
 rStrm.Seek( nOldPos );
 for( ;; )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-14 Thread Eike Rathke
 sc/source/ui/docshell/impex.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 29d72cac593d130e291aabb58685c0f6b7ffc59a
Author: Eike Rathke 
Date:   Thu Sep 14 14:30:08 2017 +0200

ofz#3362 SYLK import: check ;X;Y;C;R col/row validity early

Change-Id: I37d5ce67f975b6b89c4b8a9baefae2467da2eb84
(cherry picked from commit 34ac0f9a0376b43bcff78a49ccaf4caa34c8c990)
Reviewed-on: https://gerrit.libreoffice.org/42277
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 70288a814c8b..f1e74326e3f0 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1753,15 +1753,35 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 {
 case 'X':
 nCol = static_cast(OUString(p).toInt32()) + 
nStartCol - 1;
+if (nCol < 0 || MAXCOL < nCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;X invalid nCol=" << nCol);
+nCol = std::max( 0, std::min( 
nCol, MAXCOL));
+}
 break;
 case 'Y':
 nRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRow < 0 || MAXROW < nRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;Y invalid nRow=" << nRow);
+nRow = std::max( 0, std::min( 
nRow, MAXROW));
+}
 break;
 case 'C':
 nRefCol = 
static_cast(OUString(p).toInt32()) + nStartCol - 1;
+if (nRefCol < 0 || MAXCOL < nRefCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;C invalid nRefCol=" << nRefCol);
+nRefCol = std::max( 0, std::min( 
nRefCol, MAXCOL));
+}
 break;
 case 'R':
 nRefRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRefRow < 0 || MAXROW < nRefRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;R invalid nRefRow=" << nRefRow);
+nRefRow = std::max( 0, std::min( 
nRefRow, MAXROW));
+}
 break;
 case 'K':
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-07 Thread Dennis Francis
 sc/source/ui/inc/undocell.hxx  |1 +
 sc/source/ui/undo/undocell.cxx |   12 
 2 files changed, 13 insertions(+)

New commits:
commit f69cdbe0252a2c70a2a7db1157b06a3041bd39ad
Author: Dennis Francis 
Date:   Wed Aug 30 18:14:15 2017 +0530

tdf#107952: Move cursor to changed cell after undo/redo in ScUndoSetCell

Change-Id: Id9f2ba2ed2d77f03c9bd56c41b958aa23921da0d
Reviewed-on: https://gerrit.libreoffice.org/42014
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit f2c29539d52095ea7b914b20ef7f564469d2aa96)
Reviewed-on: https://gerrit.libreoffice.org/42036
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
index 2eca5ee23328..65a9ea6f22d8 100644
--- a/sc/source/ui/inc/undocell.hxx
+++ b/sc/source/ui/inc/undocell.hxx
@@ -158,6 +158,7 @@ public:
 private:
 void SetChangeTrack();
 void SetValue( const ScCellValue& rVal );
+void MoveCursorToCell();
 
 private:
 ScAddress maPos;
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 0050bb6eeae3..a087a20d79c1 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -389,6 +389,7 @@ void ScUndoSetCell::Undo()
 {
 BeginUndo();
 SetValue(maOldValue);
+MoveCursorToCell();
 pDocShell->PostPaintCell(maPos);
 
 ScDocument& rDoc = pDocShell->GetDocument();
@@ -403,6 +404,7 @@ void ScUndoSetCell::Redo()
 {
 BeginRedo();
 SetValue(maNewValue);
+MoveCursorToCell();
 pDocShell->PostPaintCell(maPos);
 SetChangeTrack();
 EndRedo();
@@ -471,6 +473,16 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal )
 }
 }
 
+void ScUndoSetCell::MoveCursorToCell()
+{
+ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+if ( pViewShell )
+{
+pViewShell->SetTabNo( maPos.Tab() );
+pViewShell->MoveCursorAbs( maPos.Col(), maPos.Row(), SC_FOLLOW_JUMP, 
false, false );
+}
+}
+
 ScUndoPageBreak::ScUndoPageBreak( ScDocShell* pNewDocShell,
 SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab,
 bool bNewColumn, bool bNewInsert ) :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-01 Thread Eike Rathke
 sc/source/core/tool/parclass.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b78f39f487e70aec6170e186160fb0b7df862198
Author: Eike Rathke 
Date:   Thu Aug 31 17:22:31 2017 +0200

Classify ocPercentSign as Array capable

Actually it's implemented in RPN as Array 100 ocDiv, and ocDiv is Array
capable. Not being classified as Array capable resulted in ArraySize times
matrix-Div being executed, effectively ArraySize*ArraySize div operations.

Change-Id: I23366b5aa9c146cc59dc880f2a561348f7977329
(cherry picked from commit 1897812ed4ab11409de8a58a75c3b631332ba92d)
Reviewed-on: https://gerrit.libreoffice.org/41763
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 1c48eae27a88..b2bb2be6de55 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -167,6 +167,7 @@ const ScParameterClassification::RawData 
ScParameterClassification::pRawData[] =
 { ocOffset,  {{ Reference, Value, Value, Value, Value  
  }, 0, Reference }},
 { ocOr,  {{ Reference  
  }, 1, Value }},
 { ocPearson, {{ ForceArray, ForceArray 
  }, 0, Value }},
+{ ocPercentSign, {{ Array  
  }, 0, Value }},
 { ocPercentile,  {{ Reference, Value   
  }, 0, Value }},
 { ocPercentile_Exc,  {{ Reference, Value   
  }, 0, Value }},
 { ocPercentile_Inc,  {{ Reference, Value   
  }, 0, Value }},
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-09-01 Thread Dennis Francis
 sc/source/ui/vba/vbarange.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 980fbcaf9de67013b1e72806de7746543040d48e
Author: Dennis Francis 
Date:   Tue Aug 29 15:32:14 2017 +0530

tdf#111939: Fallback to getting view data from best view shell...

...when ScDocShell::GetViewData() returns nullptr. This is needed
when a macro is run from the macro editor window instead of running
the macro from Tools menu in the Calc window.

Change-Id: I89c23c2ec08e8e9907f02eb1389236111530058b
Reviewed-on: https://gerrit.libreoffice.org/41733
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit c864fc9eab79d0b24036588cf8fc37ef51bd1907)
Reviewed-on: https://gerrit.libreoffice.org/41757
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 151403fa1f31..dbe33eed468d 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4257,6 +4257,12 @@ static void lcl_SelectAll( ScDocShell* pDocShell, 
ScQueryParam& aParam )
 if ( pDocShell )
 {
 ScViewData* pViewData = ScDocShell::GetViewData();
+if ( !pViewData )
+{
+ScTabViewShell* pViewSh = pDocShell->GetBestViewShell( true );
+pViewData = pViewSh ? >GetViewData() : nullptr;
+}
+
 if ( pViewData )
 {
 pViewData->GetView()->Query( aParam, nullptr, true );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-31 Thread Dennis Francis
 sc/source/ui/view/tabvwsh5.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 8c8b7e0d7ae16f238089e857f2549d6de058cf2e
Author: Dennis Francis 
Date:   Tue Aug 22 12:42:23 2017 +0530

tdf#97548: Do not set anchor flag on starting formula mode in a cell

Change-Id: I4d9699fa3106f7a575ad1afa3a36371344719d09
Reviewed-on: https://gerrit.libreoffice.org/41564
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit 0cf19169b634dcc164e028adf1f51f8849c5f884)
Reviewed-on: https://gerrit.libreoffice.org/41600
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index bee5f1501dd7..bc4e7fad8791 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -226,11 +226,7 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 if (!bRefMode)
 StopRefMode();
 else
-{
 GetSelEngine()->Reset();
-GetFunctionSet().SetAnchorFlag(true);
-//  AnchorFlag, so immediately Control can appended
-}
 }
 break;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-24 Thread Eike Rathke
 sc/source/core/tool/scmatrix.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 9bedb5caae9cb4b535b9fc370480c1b4f5cd70f6
Author: Eike Rathke 
Date:   Mon Aug 21 15:49:41 2017 +0200

Resolves: tdf#111943 really really limit the match, tdf#108292 follow-up

getRemainingCount() could deliver a wrapped around overflow value if mnIndex
was already greater than the end index, which could happen if when/for
non-matching larger block sizes were added, and if then a match was found
behind those blocks a non-requested/unexpected index was returned, which in
turn led to the assert() being hit in ScInterpreter::CalculateLookup(). In
non-debug could result in an invalid block position access.

This happened with the bug case document of tdf#111943 which in master can 
be
loaded.

Also, the start and end index are not dynamic and don't have to be 
recalculated
each time, so make them const; column argument values are unused after.

(cherry picked from commit 25b3806ac509006573e669acc33643af3bd77380)

Change-Id: Ic294cade4e8e7828bee394e5ade61d7127be6bbb
Reviewed-on: https://gerrit.libreoffice.org/41396
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 659e22fa064a..0a3dca7cb12d 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1267,24 +1267,25 @@ template
 class WalkAndMatchElements : public 
std::unary_function
 {
 Type maMatchValue;
-MatrixImplType::size_pair_type maSize;
-size_t mnCol1;
-size_t mnCol2;
+const size_t mnStartIndex;
+const size_t mnStopIndex;
 size_t mnResult;
 size_t mnIndex;
 
 public:
 WalkAndMatchElements(Type aMatchValue, const 
MatrixImplType::size_pair_type& aSize, size_t nCol1, size_t nCol2) :
 maMatchValue(aMatchValue),
-maSize(aSize),
-mnCol1(nCol1),
-mnCol2(nCol2),
+mnStartIndex( nCol1 * aSize.row ),
+mnStopIndex( (nCol2 + 1) * aSize.row ),
 mnResult(ResultNotSet),
 mnIndex(0) {}
 
 size_t getMatching() const { return mnResult; }
 
-size_t getRemainingCount() const { return ((mnCol2 + 1) * maSize.row) - 
mnIndex; }
+size_t getRemainingCount() const
+{
+return mnIndex < mnStopIndex ? mnStopIndex - mnIndex : 0;
+}
 
 size_t compare(const MatrixImplType::element_block_node_type& node) const;
 
@@ -1295,7 +1296,7 @@ public:
 return;
 
 // limit lookup to the requested columns
-if ((mnCol1 * maSize.row) <= mnIndex && getRemainingCount() > 0)
+if (mnStartIndex <= mnIndex && getRemainingCount() > 0)
 {
 mnResult = compare(node);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-23 Thread Dennis Francis
 sc/source/ui/unoobj/chart2uno.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit afd5b4b7eda6171817f5fa1a426d4c11a1a734c9
Author: Dennis Francis 
Date:   Tue Aug 8 17:17:46 2017 +0530

tdf#86019: Use ChartDataRowSource_COLUMNS as the chart...

...data row source if there is atleast a sequence along a
column.

Change-Id: I24838a704d31f83fa51efa2eb44b489affe86f35
Reviewed-on: https://gerrit.libreoffice.org/41202
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit b2cb3196868deb499bb91fc9bdbe6c8f7d1e9033)
Reviewed-on: https://gerrit.libreoffice.org/41244
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 432724da0b68..ae1f4f42b7a7 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1892,9 +1892,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
ScChart2DataProvider::detectArgum
 if (!bRowSourceAmbiguous)
 {
 bRowSourceDetected = true;
-eRowSource = ( nDataInRows > 0
-   ? chart::ChartDataRowSource_ROWS
-   : chart::ChartDataRowSource_COLUMNS );
+eRowSource = ( nDataInCols > 0
+   ? chart::ChartDataRowSource_COLUMNS
+   : chart::ChartDataRowSource_ROWS );
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-23 Thread Noel Grandin
 sc/source/core/data/table5.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 47d3917662ab1f3e3dde93b283a8513fadc8cacc
Author: Noel Grandin 
Date:   Wed Aug 23 08:54:01 2017 +0200

fix bug in ScTable::LastHiddenColRow

found by inspection, noticed that the for loop is not actually using
it's index variable

introduced in

commit b3579d71c6536ab1d03cc47249d582a574fd054a
koheirowlimitperf: #i109369# #i109373# #i109384# #i109385# #i109386#
million, and integrated lots of speed optimization and bug fixes to
ensure Calc remains usable after the row limit increase.

Change-Id: Icfee19ddb051e8d4333ed4c91d384379bf49
Reviewed-on: https://gerrit.libreoffice.org/41439
Reviewed-by: Julien Nabet 
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit 4feccde59797200f8a5f640b452a411f903e604a)
Reviewed-on: https://gerrit.libreoffice.org/41446
Reviewed-by: Eike Rathke 
Tested-by: Noel Grandin 

diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index c7a3b7938b68..81ad0057e68b 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -764,8 +764,8 @@ SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool 
bCol) const
 {
 for (SCCOL i = nCol+1; i <= MAXCOL; ++i)
 {
-if (!ColHidden(nCol))
-return nCol - 1;
+if (!ColHidden(i))
+return i - 1;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-18 Thread Julien Nabet
 sc/source/core/tool/interpr7.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 6abbad3c44809d9f8116992475c5efcaafc23dbf
Author: Julien Nabet 
Date:   Sat Aug 12 12:34:46 2017 +0200

tdf#109104: respect RFC3986 for newlines in ScEncodeURL

Quotation of RFC3986:
A percent-encoded octet is encoded as a character
triplet, consisting of the percent character "%" followed by the two
hexadecimal digits representing that octet's numeric value
So test the length of the return of OString::number and add "0" if needed

ScEncodeURL was added with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=25434372bf56e0ebdb7e7d47ab3c14c68211509f

Thank you to Bele (the bugtracker reporter) for code pointer!

Change-Id: I8df102eb38b31933c6ebb15bb25c125b423f722b
Reviewed-on: https://gerrit.libreoffice.org/41086
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit dabba2e3368c2e2ae4ab03ddcfc667e13f89841d)
Reviewed-on: https://gerrit.libreoffice.org/41278
Tested-by: Julien Nabet 

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 0d8af3173ed2..738447ea16dd 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -325,7 +325,14 @@ void ScInterpreter::ScEncodeURL()
 else
 {
 aUrlBuf.append( '%' );
-aUrlBuf.append( OString::number( static_cast( c 
), 16 ).toAsciiUpperCase() );
+OString convertedChar = OString::number( static_cast( c ), 16 ).toAsciiUpperCase();
+// RFC 3986 indicates:
+// "A percent-encoded octet is encoded as a character triplet,
+// consisting of the percent character "%" followed by the two 
hexadecimal digits
+// representing that octet's numeric value"
+if (convertedChar.getLength() == 1)
+aUrlBuf.append("0");
+aUrlBuf.append(convertedChar);
 }
 }
 PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-11 Thread Dennis Francis
 sc/source/ui/app/inputwin.cxx |   55 +++---
 1 file changed, 36 insertions(+), 19 deletions(-)

New commits:
commit 0aaa81b2760dde7e84c85b8caacc20552910ffe9
Author: Dennis Francis 
Date:   Tue Jul 25 17:11:47 2017 +0530

tdf#71409: Pre-create sum/equal and ok/cancel buttons...

in the sc formula bar at the start instead of adding/
removing them to/from vcl ToolBox when required.
To maintain the functionality, do hide/show and
enable/disable the button pairs (sum/equal, ok/cancel)
during mode switch. This solves the excess a11y events
problem of tdf#71409 because this patch get rid of
the usages of vcl's Toolbox::Remove() and its accessibility
module dependencies which seems to be the root cause.

Change-Id: Ib953fb64d25a4b83018eca6a88223c7236c2f72e
Reviewed-on: https://gerrit.libreoffice.org/40479
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit 561cae8e81913940e4af86901ec46a484669c597)
Reviewed-on: https://gerrit.libreoffice.org/40827
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 70957b3aa601..dcc5ce7ec654 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -190,8 +190,10 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, 
SfxBindings* pBind ) :
 InsertItem  (SID_INPUT_FUNCTION, 
Image(BitmapEx(RID_BMP_INPUT_FUNCTION)), ToolBoxItemBits::NONE, 2);
 InsertItem  (SID_INPUT_SUM,  Image(BitmapEx(RID_BMP_INPUT_SUM)), 
ToolBoxItemBits::NONE, 3);
 InsertItem  (SID_INPUT_EQUAL,Image(BitmapEx(RID_BMP_INPUT_EQUAL)), 
ToolBoxItemBits::NONE, 4);
-InsertSeparator (5);
-InsertWindow(7, , ToolBoxItemBits::NONE, 6);
+InsertItem  (SID_INPUT_CANCEL,   
Image(BitmapEx(RID_BMP_INPUT_CANCEL)), ToolBoxItemBits::NONE, 5);
+InsertItem  (SID_INPUT_OK,   Image(BitmapEx(RID_BMP_INPUT_OK)), 
ToolBoxItemBits::NONE, 6);
+InsertSeparator (7);
+InsertWindow(7, , ToolBoxItemBits::NONE, 8);
 
 aWndPos   ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
 aWndPos   ->SetHelpId   (HID_INSWIN_POS);
@@ -208,6 +210,18 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, 
SfxBindings* pBind ) :
 SetItemText (SID_INPUT_EQUAL, aTextEqual);
 SetHelpId   (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
 
+SetItemText ( SID_INPUT_CANCEL, aTextCancel );
+SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
+
+SetItemText ( SID_INPUT_OK, aTextOk );
+SetHelpId   ( SID_INPUT_OK, HID_INSWIN_OK );
+
+EnableItem( SID_INPUT_CANCEL, false );
+EnableItem( SID_INPUT_OK, false );
+
+HideItem( SID_INPUT_CANCEL );
+HideItem( SID_INPUT_OK );
+
 SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
 
 aWndPos   ->Show();
@@ -504,14 +518,16 @@ void ScInputWindow::SetOkCancelMode()
 
 if (!bIsOkCancelMode)
 {
-RemoveItem( 3 ); // Remove SID_INPUT_SUM and SID_INPUT_EQUAL
-RemoveItem( 3 );
-InsertItem( SID_INPUT_CANCEL, Image(BitmapEx(RID_BMP_INPUT_CANCEL)), 
ToolBoxItemBits::NONE, 3 );
-InsertItem( SID_INPUT_OK, Image(BitmapEx(RID_BMP_INPUT_OK)), 
ToolBoxItemBits::NONE, 4 );
-SetItemText ( SID_INPUT_CANCEL, aTextCancel );
-SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
-SetItemText ( SID_INPUT_OK, aTextOk );
-SetHelpId   ( SID_INPUT_OK, HID_INSWIN_OK );
+EnableItem  ( SID_INPUT_SUM,   false );
+EnableItem  ( SID_INPUT_EQUAL, false );
+HideItem( SID_INPUT_SUM );
+HideItem( SID_INPUT_EQUAL );
+
+ShowItem( SID_INPUT_CANCEL, true );
+ShowItem( SID_INPUT_OK, true );
+EnableItem  ( SID_INPUT_CANCEL, true );
+EnableItem  ( SID_INPUT_OK, true );
+
 bIsOkCancelMode = true;
 }
 }
@@ -524,15 +540,16 @@ void ScInputWindow::SetSumAssignMode()
 
 if (bIsOkCancelMode)
 {
-// Remove SID_INPUT_CANCEL, and SID_INPUT_OK
-RemoveItem( 3 );
-RemoveItem( 3 );
-InsertItem( SID_INPUT_SUM,   Image(BitmapEx(RID_BMP_INPUT_SUM)),   
ToolBoxItemBits::NONE, 3 );
-InsertItem( SID_INPUT_EQUAL, Image(BitmapEx(RID_BMP_INPUT_EQUAL)), 
ToolBoxItemBits::NONE, 4 );
-SetItemText ( SID_INPUT_SUM,   aTextSum );
-SetHelpId   ( SID_INPUT_SUM,   HID_INSWIN_SUMME );
-SetItemText ( SID_INPUT_EQUAL, aTextEqual );
-SetHelpId   ( SID_INPUT_EQUAL, HID_INSWIN_FUNC );
+EnableItem  ( SID_INPUT_CANCEL, false );
+EnableItem  ( SID_INPUT_OK, false );
+HideItem( SID_INPUT_CANCEL );
+HideItem( SID_INPUT_OK );
+
+ShowItem( SID_INPUT_SUM,true );
+ShowItem( SID_INPUT_EQUAL,  true );
+  

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-07 Thread Dennis Francis
 sc/source/ui/view/viewfun2.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 5b121b12b50c0db8f5b68616cd8ad95baf91b4f4
Author: Dennis Francis 
Date:   Thu Aug 3 14:27:46 2017 +0530

tdf#109859: Update the view data of new document when...

...a set of sheets are copied to a new spreadsheet document.

Change-Id: I47642b4aa2543c193328d9515564bfbacf044bbc
Reviewed-on: https://gerrit.libreoffice.org/40764
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
(cherry picked from commit bc6f56e4bb27f802e90303073ba5e2a676baa39b)
Reviewed-on: https://gerrit.libreoffice.org/40828
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index b51dbbe1acda..55332765bb96 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2775,7 +2775,12 @@ void ScViewFunc::MoveTable(
 if ( pDestDoc->IsChartListenerCollectionNeedsUpdate() )
 pDestDoc->UpdateChartListenerCollection();
 
-pDestDoc->DeleteTab(static_cast(TheTabs.size()));   // old 
first table
+SCTAB nNumTabsInserted = static_cast(TheTabs.size());
+pDestShell->Broadcast( ScTablesHint( SC_TABS_INSERTED, 0, 
nNumTabsInserted ) );
+
+pDestDoc->DeleteTab( nNumTabsInserted );   // old first table
+pDestShell->Broadcast( ScTablesHint( SC_TAB_DELETED, 
nNumTabsInserted ) );
+
 if (pDestViewSh)
 {
 // Make sure to clear the cached page view after sheet
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-07 Thread Caolán McNamara
 sc/source/ui/view/drawvie4.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2e191b82881a1bc06aee73de85452eaf867d1041
Author: Caolán McNamara 
Date:   Fri Aug 4 16:53:23 2017 +0100

coverity#1416135 Dereference after null check

and

coverity#1416137 Dereference after null check

since...

commit 04461743d75f8cffb5906ab52d772089c44a7780
Date:   Fri Jul 21 13:12:20 2017 +0530

tdf#108887 : Move the code of ScDrawView::CheckOle()...

maybe this check is simply reversed seeing as

bool bCalcSourceRanges = pRanges && pDoc;

and after this line pRanges and pDoc are unconditionally
dereferenced

Change-Id: Ie3ed3054d2f31ddbc70895a4e6997395ca7de8b5
Reviewed-on: https://gerrit.libreoffice.org/40772
Tested-by: Jenkins 
Reviewed-by: Dennis Francis 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 30f384b5bd2d8ec7f50ad0c85c43611313044f8c)
Reviewed-on: https://gerrit.libreoffice.org/40818

diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index cc7c59c621f0..ed192aaee1d6 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -245,7 +245,7 @@ void getOleSourceRanges(const SdrMarkList& rMarkList, bool& 
rAnyOle, bool& rOneO
 }
 }
 
-if( bCalcSourceRanges )
+if (!bCalcSourceRanges)
 return;
 
 // Compile all range representation strings into ranges.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-01 Thread Caolán McNamara
 sc/source/ui/undo/undotab.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit eeff6a8f70184aa55f95bd8897a6ed8e125ad72f
Author: Caolán McNamara 
Date:   Tue Aug 1 11:34:22 2017 +0100

Related: tdf#109856 redo 'insert multiple tabs after' inserts too many tabs

Change-Id: I50e8941408343f8fa9acf017d7c195279952916d
Reviewed-on: https://gerrit.libreoffice.org/40627
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 9323e066978f..45a37dd1c079 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -224,7 +224,6 @@ void ScUndoInsertTables::Redo()
 
 pDocShell->SetInUndo( true );   //! BeginRedo
 bDrawIsInUndo = true;
-pViewShell->SetTabNo(nTab);
 pViewShell->InsertTables( aNameList, nTab, 
static_cast(aNameList.size()),false );
 
 bDrawIsInUndo = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-08-01 Thread Caolán McNamara
 sc/source/core/data/document.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fbfa25a14164abe77f11323cdf3249f8b1d528ea
Author: Caolán McNamara 
Date:   Tue Aug 1 09:16:28 2017 +0100

Resolves: tdf#109856 undo 'insert multiple tabs after' doesn't work

Change-Id: I534536358b2a949667c1c258bf27e13763c0de57
Reviewed-on: https://gerrit.libreoffice.org/40621
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e597ae4485cf..ee5f7699dd01 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -785,7 +785,7 @@ void ScDocument::ClearTabs()
 bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
 {
 bool bValid = false;
-if (ValidTab(nTab) && (nTab + nSheets) < static_cast(maTabs.size()))
+if (ValidTab(nTab) && (nTab + nSheets) <= 
static_cast(maTabs.size()))
 {
 if (maTabs[nTab])
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-31 Thread Dennis Francis
 sc/source/ui/view/drawvie4.cxx |  119 +
 1 file changed, 51 insertions(+), 68 deletions(-)

New commits:
commit 5b7a08939986da68b44d92099c7a9ac47351675c
Author: Dennis Francis 
Date:   Fri Jul 21 13:12:20 2017 +0530

tdf#108887 : Move the code of ScDrawView::CheckOle()...

to getOleSourceRanges( renamed from getChartSourceRanges)
and optionally calculate source ranges to avoid code
duplication and do OLE detection as done in
CheckOle() which was working well before the commit
c55d52262ea1d5f869a9528fd051ee19e687f1cc.

Matching test cases (in uitest) coming up soon in another commit.

Change-Id: I64a12eef02afb488bed4bc8de1a18823c89128bb
Reviewed-on: https://gerrit.libreoffice.org/40278
Tested-by: Jenkins 
Reviewed-by: Jean-Baptiste Faure 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 04461743d75f8cffb5906ab52d772089c44a7780)
Reviewed-on: https://gerrit.libreoffice.org/40579

diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index c7967a0fe5ba..cc7c59c621f0 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -53,39 +53,6 @@ using namespace com::sun::star;
 
 Point aDragStartDiff;
 
-void ScDrawView::CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& 
rOneOle )
-{
-rAnyOle = rOneOle = false;
-const size_t nCount = rMarkList.GetMarkCount();
-for (size_t i=0; iGetMarkedSdrObj();
-sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
-if (nSdrObjKind == OBJ_OLE2)
-{
-rAnyOle = true;
-rOneOle = (nCount == 1);
-break;
-}
-else if ( dynamic_cast( pObj) !=  nullptr )
-{
-SdrObjListIter aIter( *pObj, SdrIterMode::DeepNoGroups );
-SdrObject* pSubObj = aIter.Next();
-while (pSubObj)
-{
-if ( pSubObj->GetObjIdentifier() == OBJ_OLE2 )
-{
-rAnyOle = true;
-// rOneOle remains sal_False - a group isn't treated like 
a single OLE object
-return;
-}
-pSubObj = aIter.Next();
-}
-}
-}
-}
-
 void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos )
 {
 if ( AreObjectsMarked() )
@@ -198,79 +165,89 @@ void getRangeFromErrorBar(const uno::Reference< 
chart2::XChartDocument >& rChart
 }
 }
 
-bool getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector& 
rRangeRep)
+void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector& 
rRangeRep)
 {
 if (!rObj.IsChart())
 // not a chart object.
-return false;
+return;
 
 uno::Reference xObj = rObj.GetObjRef();
 if (!xObj.is())
-return false;
+return;
 
 uno::Reference xCompSupp(xObj, uno::UNO_QUERY);
 if (!xCompSupp.is())
-return false;
+return;
 
 uno::Reference 
xChartDoc(xCompSupp->getComponent(), uno::UNO_QUERY);
 if (!xChartDoc.is())
-return false;
+return;
 
 if(xChartDoc->hasInternalDataProvider())
-return true;
+return;
 
 getRangeFromErrorBar(xChartDoc, rRangeRep);
 
 uno::Reference xDataSource(xChartDoc, 
uno::UNO_QUERY);
 if (!xDataSource.is())
-return true;
+return;
 
 // Get all data sources used in this chart.
 getRangeFromDataSource(xDataSource, rRangeRep);
 
-return true;
+return;
 }
 
 // Get all cell ranges that are referenced by the selected chart objects.
-bool getChartSourceRanges(ScDocument* pDoc, const SdrMarkList& rObjs, 
std::vector& rRanges)
+void getOleSourceRanges(const SdrMarkList& rMarkList, bool& rAnyOle, bool& 
rOneOle, std::vector* pRanges = nullptr, ScDocument* pDoc = nullptr )
 {
+bool bCalcSourceRanges = pRanges && pDoc;
 std::vector aRangeReps;
-bool bAnyOle = false, bRet = false;
-for (size_t i = 0, n = rObjs.GetMarkCount(); i < n; ++i)
+rAnyOle = rOneOle = false;
+const size_t nCount = rMarkList.GetMarkCount();
+for (size_t i=0; iGetMarkedSdrObj();
-if (!pObj)
+SdrObject* pObj = pMark->GetMarkedSdrObj();
+if ( !pObj )
 continue;
 
-switch (pObj->GetObjIdentifier())
+sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
+if (nSdrObjKind == OBJ_OLE2)
+{
+rAnyOle = true;
+rOneOle = (nCount == 1);
+if ( bCalcSourceRanges )
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-28 Thread Caolán McNamara
 sc/source/ui/Accessibility/AccessibleDocument.cxx |   24 +++-
 sc/source/ui/inc/tabvwsh.hxx  |1 
 sc/source/ui/unoobj/viewuno.cxx   |   61 +++---
 3 files changed, 44 insertions(+), 42 deletions(-)

New commits:
commit 1e796e4471ceb577b6a5bd577b2571231ae6fcf1
Author: Caolán McNamara 
Date:   Thu Jul 27 15:41:16 2017 +0100

Resolves: tdf#106872 only request selected shapes

that way we can avoid the super slow code path for filtered
rows when we only care about selected shapes

Change-Id: I175fa841e406dbbe7075296f2e0a0e79fa115fb7
Reviewed-on: https://gerrit.libreoffice.org/40496
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 192d97cdf091af08a492416824918ea447bfb16f)

Related: tdf#106872 factor out getting selected shapes

Change-Id: I765c482a41e9681a1eb145c1833cc94f35a27db3
(cherry picked from commit 221dae68df80298e81e6e6549636f3528f5c8bc3)
Reviewed-on: https://gerrit.libreoffice.org/40515
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 102779633ddd..cf493d5ec34f 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -333,7 +333,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* 
pAccessibleDocument, Sc
 {
 if (mpAccessibleDocument)
 
xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
-uno::Reference xShapes 
(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 mnShapesSelected = xShapes->getCount();
 }
@@ -350,7 +350,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* 
pAccessibleDocument, Sc
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 FindSelectedShapesChanges(xShapes);
 }
@@ -644,8 +644,8 @@ bool ScChildrenShapes::IsSelected(sal_Int32 nIndex,
 #if OSL_DEBUG_LEVEL > 0 // test whether it is truly selected by a slower method
 uno::Reference< drawing::XShape > xReturnShape;
 bool bDebugResult(false);
-uno::Reference xIndexAccess;
-xSelectionSupplier->getSelection() >>= xIndexAccess;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xIndexAccess(xShapes, 
uno::UNO_QUERY);
 
 if (xIndexAccess.is())
 {
@@ -680,7 +680,7 @@ bool ScChildrenShapes::SelectionChanged()
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 
 bResult = FindSelectedShapesChanges(xShapes);
 
@@ -701,8 +701,7 @@ void ScChildrenShapes::Select(sal_Int32 nIndex)
 uno::Reference xShape;
 if (!IsSelected(nIndex, xShape) && maZOrderedShapes[nIndex]->bSelectable)
 {
-uno::Reference xShapes;
-xSelectionSupplier->getSelection() >>= xShapes;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 
 if (!xShapes.is())
 xShapes = drawing::ShapeCollection::create(
@@ -770,9 +769,8 @@ void ScChildrenShapes::SelectAll()
 
 void ScChildrenShapes::FillShapes(std::vector < uno::Reference < 
drawing::XShape > >& rShapes) const
 {
-uno::Reference xIndexAccess;
-xSelectionSupplier->getSelection() >>= xIndexAccess;
-
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xIndexAccess(xShapes, 
uno::UNO_QUERY);
 if (xIndexAccess.is())
 {
 sal_uInt32 nCount(xIndexAccess->getCount());
@@ -857,8 +855,7 @@ void ScChildrenShapes::Deselect(sal_Int32 nChildIndex)
 {
 if (xShape.is())
 {
-uno::Reference xShapes;
-xSelectionSupplier->getSelection() >>= xShapes;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 xShapes->remove(xShape);
 
@@ -1244,7 +1241,8 @@ void ScChildrenShapes::AddShape(const 
uno::Reference& xShape, b
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xEnumAcc(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xEnumAcc(xShapes, 
uno::UNO_QUERY);
 if (xEnumAcc.is())
 {
 uno::Reference xEnum = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-28 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 42e3ad2ef6e0add0c61165e3374d9021043ef1e4
Author: Caolán McNamara 
Date:   Fri Jul 28 11:53:46 2017 +0100

ofz: survive missing macro support

Change-Id: Ica9c66fe09f7340f76f62e536527dc63b3735d90
(cherry picked from commit aa529a1957fce324c500753039ae7766b8dcf6a6)
Reviewed-on: https://gerrit.libreoffice.org/40522
Reviewed-by: Eike Rathke 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index b5d15641d897..278f69f42f19 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3338,6 +3338,9 @@ bool ScCompiler::IsMacro( const OUString& rName )
 return false;
 }
 
+if (!pObj)
+return false;
+
 // ODFF recommends to store user-defined functions prefixed with "USER.",
 // use only unprefixed name if encountered. BASIC doesn't allow '.' in a
 // function name so a function "USER.FOO" could not exist, and macro check
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-27 Thread Caolán McNamara
 sc/source/ui/Accessibility/AccessibleDocument.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1d9a30bac4ba69ddee34f40427ba24a4d83a1f72
Author: Caolán McNamara 
Date:   Thu Jul 27 15:07:06 2017 +0100

Related: tdf#106872 amount of a11y selection listeners constantly grows

so it gets progressively slower

Change-Id: Ib53c69231c902d064b939be096e0dbeab2f0fc71
Reviewed-on: https://gerrit.libreoffice.org/40491
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index b367101ea151..102779633ddd 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -380,6 +380,8 @@ ScChildrenShapes::~ScChildrenShapes()
 if (pDrawBC)
 EndListening(*pDrawBC);
 }
+if (mpAccessibleDocument && xSelectionSupplier.is())
+
xSelectionSupplier->removeSelectionChangeListener(mpAccessibleDocument);
 }
 
 void ScChildrenShapes::SetDrawBroadcaster()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-20 Thread Eike Rathke
 sc/source/ui/view/viewfunc.cxx |   26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 6622ea7365fbf1b425e5f90667dd7e6466fd0293
Author: Eike Rathke 
Date:   Mon Jul 17 11:36:29 2017 +0200

Resolves: tdf#75650 reset boolean number format to General for new formula

Change-Id: Iec2feefcbb5a92c64f182d93b4055fc009dbe1e5
(cherry picked from commit 1c1783864a356a4394f80dec28db939f4cf572cd)
Reviewed-on: https://gerrit.libreoffice.org/40052
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index ca21a561fed8..90f3b5996a53 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -508,10 +508,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 {
 i = *itr;
 aPos.SetTab( i );
-sal_uLong nIndex = (sal_uLong) static_cast( 
pDoc->GetAttr(
-nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
-if ( pFormatter->GetType( nIndex ) == 
css::util::NumberFormat::TEXT ||
- ( ( rString[0] == '+' || rString[0] == '-' ) && nError != 
FormulaError::NONE && rString == aFormula ) )
+const sal_uInt32 nIndex = static_cast( 
pDoc->GetAttr(
+nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
+const sal_Int16 nType = pFormatter->GetType( nIndex);
+if (nType == css::util::NumberFormat::TEXT ||
+((rString[0] == '+' || rString[0] == '-') && nError != 
FormulaError::NONE && rString == aFormula))
 {
 if ( pData )
 {
@@ -531,6 +532,23 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 if(pCell->GetCode()->IsHyperLink())
 pCell->GetCode()->SetHyperLink(false);
 }
+if (nType == css::util::NumberFormat::LOGICAL)
+{
+// Reset to General so the actual format can be determined
+// after the cell has been interpreted. A sticky boolean
+// number format is highly likely unwanted.. see tdf#75650.
+// General of same locale as current number format.
+const SvNumberformat* pEntry = pFormatter->GetEntry( 
nIndex);
+const LanguageType nLang = (pEntry ? pEntry->GetLanguage() 
: ScGlobal::eLnge);
+const sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
css::util::NumberFormat::NUMBER, nLang);
+ScPatternAttr aPattern( pDoc->GetPool());
+aPattern.GetItemSet().Put( SfxUInt32Item( 
ATTR_VALUE_FORMAT, nFormat));
+ScMarkData aMark;
+aMark.SelectTable( i, true);
+aMark.SetMarkArea( ScRange( ScAddress( nCol, nRow, i)));
+rFunc.ApplyAttributes( aMark, aPattern, false);
+bNumFmtChanged = true;
+}
 rFunc.SetFormulaCell(aPos, pCell, true);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-20 Thread Eike Rathke
 sc/source/core/data/document.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 3c4b67ac73aae4f44938c296d1a54ff68c6e2ae8
Author: Eike Rathke 
Date:   Thu Jul 6 17:06:14 2017 +0200

Blind fix tdf#108612 explicitly checking for and against clipboard document

 This is a combination of 2 commits.

Attempt to blind fix tdf#108612 explicitly checking for clipboard document

It seems that for some yet unknown reason in an (un)certain constellation
ScDocument::IsClipboardSource() returns true because ScModule::GetClipDoc()
does not return the clipboard document but the actual document instead, so
destroying the clipboard document executes 
ScDocument::ClosingClipboardSource()
and (or in earlier versions) ScDocument::ForgetNoteCaptions() on the actual
document instead.

Check also that ScDocument::bIsClip is set, hopefully curing the symptom, 
the
real cause is something else.

(cherry picked from commit d5020f35aec54f0241fa58557dc6caadc149f5a9)

Another attempt to blind fix tdf#108612

Oddly in that scenario on Windows there are two clipboard documents alive 
when
destroying one, so the destroyed one erroneously is said to be a clipboard
source and then detachs the comments' caption information.

There's no legit case where a clipboard document could actually be the real
original source of another clipboard document, so bail out if the caller
already is one.

(cherry picked from commit 52e09f2c03f7cc024b2973c4806283c324fc23df)

0f8d240d8ec13bf91b77176dc6439a541cf14eaa

Change-Id: I5ffd0706592d2737808e7004630a56c53115295b
Reviewed-on: https://gerrit.libreoffice.org/40249
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0aff3b5e9469..e597ae4485cf 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2522,8 +2522,11 @@ void ScDocument::SetClipParam(const ScClipParam& rParam)
 
 bool ScDocument::IsClipboardSource() const
 {
+if (bIsClip)
+return false;
+
 ScDocument* pClipDoc = ScModule::GetClipDoc();
-return xPoolHelper.is() && pClipDoc && pClipDoc->xPoolHelper.is() &&
+return pClipDoc && pClipDoc->bIsClip && pClipDoc->xPoolHelper.is() && 
xPoolHelper.is() &&
 xPoolHelper->GetDocPool() == pClipDoc->xPoolHelper->GetDocPool();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-20 Thread Eike Rathke
 sc/source/ui/unoobj/filtuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e059303c2dc6ecac5247c315f5b452d346512c12
Author: Eike Rathke 
Date:   Wed Jul 19 21:24:06 2017 +0200

Fix crash when saving new spreadsheet as dBase/.dbf, tdf#108789 follow-up

... as there is no input stream.

Regression from

commit 7f1465a9599e9665159dd2d823a6e9064cca5703
Date:   Sun Jun 25 17:21:45 2017 +0200

Change-Id: Ib97a4878fe8cf28e5d0f1dc6cc07800ea1635e68
(cherry picked from commit 22ae038a56b85e86219922c2759544545f2d813d)
Reviewed-on: https://gerrit.libreoffice.org/40207
Reviewed-by: Lionel Elie Mamane 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 65de5d10b4e9..e98155e7688d 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -72,7 +72,7 @@ namespace
 
 charsetSource load_CharSet(rtl_TextEncoding , bool bExport, 
SvStream* dbf_Stream)
 {
-if (dbfReadCharset(nCharSet, dbf_Stream))
+if (dbf_Stream && dbfReadCharset(nCharSet, dbf_Stream))
 {
 return charsetSource::charset_from_file;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-19 Thread Dennis Francis
 sc/source/ui/view/drawvie4.cxx |   33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 013cc39448b00a450d040ddc8828aa9ab3004e3d
Author: Dennis Francis 
Date:   Mon Jul 17 12:32:02 2017 +0530

tdf#108881 : do not assume that chart objects always...

...have data ranges associated with it. Empty charts do not
have data ranges. Reverts the part of

c55d52262ea1d5f869a9528fd051ee19e687f1cc

which makes this assumption.

Matching test cases (in uitest) coming up soon in another commit.

Change-Id: I60f0f03a8c937ecfdff95047bdfeeb7733eff4a4
Reviewed-on: https://gerrit.libreoffice.org/40057
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 4d783c45062d030d278c076d7817b9589fa77d91)
Reviewed-on: https://gerrit.libreoffice.org/40200

diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 5a5ac3de2b23..c7967a0fe5ba 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -198,41 +198,44 @@ void getRangeFromErrorBar(const uno::Reference< 
chart2::XChartDocument >& rChart
 }
 }
 
-void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector& 
rRangeRep)
+bool getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector& 
rRangeRep)
 {
 if (!rObj.IsChart())
 // not a chart object.
-return;
+return false;
 
 uno::Reference xObj = rObj.GetObjRef();
 if (!xObj.is())
-return;
+return false;
 
 uno::Reference xCompSupp(xObj, uno::UNO_QUERY);
 if (!xCompSupp.is())
-return;
+return false;
 
 uno::Reference 
xChartDoc(xCompSupp->getComponent(), uno::UNO_QUERY);
 if (!xChartDoc.is())
-return;
+return false;
 
 if(xChartDoc->hasInternalDataProvider())
-return;
+return true;
 
 getRangeFromErrorBar(xChartDoc, rRangeRep);
 
 uno::Reference xDataSource(xChartDoc, 
uno::UNO_QUERY);
 if (!xDataSource.is())
-return;
+return true;
 
 // Get all data sources used in this chart.
 getRangeFromDataSource(xDataSource, rRangeRep);
+
+return true;
 }
 
 // Get all cell ranges that are referenced by the selected chart objects.
-void getChartSourceRanges(ScDocument* pDoc, const SdrMarkList& rObjs, 
std::vector& rRanges)
+bool getChartSourceRanges(ScDocument* pDoc, const SdrMarkList& rObjs, 
std::vector& rRanges)
 {
 std::vector aRangeReps;
+bool bAnyOle = false, bRet = false;
 for (size_t i = 0, n = rObjs.GetMarkCount(); i < n; ++i)
 {
 const SdrMark* pMark = rObjs.GetMark(i);
@@ -246,7 +249,8 @@ void getChartSourceRanges(ScDocument* pDoc, const 
SdrMarkList& rObjs, std::vecto
 switch (pObj->GetObjIdentifier())
 {
 case OBJ_OLE2:
-getRangeFromOle2Object(static_cast(*pObj), 
aRangeReps);
+bRet = getRangeFromOle2Object(static_cast(*pObj), aRangeReps);
+bAnyOle = bAnyOle || bRet;
 break;
 case OBJ_GRUP:
 {
@@ -256,7 +260,8 @@ void getChartSourceRanges(ScDocument* pDoc, const 
SdrMarkList& rObjs, std::vecto
 if (pSubObj->GetObjIdentifier() != OBJ_OLE2)
 continue;
 
-getRangeFromOle2Object(static_cast(*pSubObj), aRangeReps);
+bRet = getRangeFromOle2Object(static_cast(*pSubObj), aRangeReps);
+bAnyOle = bAnyOle || bRet;
 }
 
 }
@@ -280,6 +285,8 @@ void getChartSourceRanges(ScDocument* pDoc, const 
SdrMarkList& rObjs, std::vecto
 else if (aAddr.Parse(*it, pDoc, pDoc->GetAddressConvention()) & 
ScRefFlags::VALID)
 rRanges.push_back(aAddr);
 }
+
+return bAnyOle;
 }
 
 class InsertTabIndex : public std::unary_function
@@ -351,11 +358,11 @@ void ScDrawView::DoCopy()
 {
 const SdrMarkList& rMarkList = GetMarkedObjectList();
 std::vector aRanges;
-getChartSourceRanges(pDoc, rMarkList, aRanges);
+bool bAnyOle = getChartSourceRanges(pDoc, rMarkList, aRanges);
 
 // update ScGlobal::xDrawClipDocShellRef
-ScDrawLayer::SetGlobalDrawPersist( 
ScTransferObj::SetDrawClipDoc(!aRanges.empty()) );
-if (ScGlobal::xDrawClipDocShellRef.is())
+ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle 
) );
+if (ScGlobal::xDrawClipDocShellRef.is() && !aRanges.empty())
 {
 // Copy data referenced by the chart objects to the draw clip
 // document. We need to do this before GetMarkedObjModel() below.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-09 Thread Sean Stangl
 sc/source/filter/html/htmlexp.cxx |   15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit d4d34ae87c6135b075c59adeb09739d1647aa4bb
Author: Sean Stangl 
Date:   Sat Jul 8 22:33:48 2017 -0700

tdf#79304 - Handle CrossedOutItems in HTML export.

Change-Id: I766fedb34737a1a7815693bf496fa08c08f492b1
Reviewed-on: https://gerrit.libreoffice.org/39719
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 2f2eba56d1f8ec5cdcadb4852e8856858477c008)
Reviewed-on: https://gerrit.libreoffice.org/39721
Tested-by: Jenkins 

diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 6372fee39669..ab254556feef 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -975,6 +976,9 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB 
nTab )
 const SvxUnderlineItem& rUnderlineItem = static_cast(
 pAttr->GetItem( ATTR_FONT_UNDERLINE, pCondItemSet ) );
 
+const SvxCrossedOutItem& rCrossedOutItem = static_cast(
+pAttr->GetItem( ATTR_FONT_CROSSEDOUT, pCondItemSet ) );
+
 const SvxColorItem& rColorItem = static_cast( 
pAttr->GetItem(
 ATTR_FONT_COLOR, pCondItemSet ) );
 
@@ -993,10 +997,11 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 else
 aBgColor = rBrushItem.GetColor();
 
-bool bBold  = ( WEIGHT_BOLD <= rWeightItem.GetWeight() );
-bool bItalic= ( ITALIC_NONE != rPostureItem.GetPosture() );
-bool bUnderline = ( LINESTYLE_NONE  != rUnderlineItem.GetLineStyle() );
-bool bSetFontColor  = ( COL_AUTO!= 
rColorItem.GetValue().GetColor() );  // default is AUTO now
+bool bBold  = ( WEIGHT_BOLD  <= rWeightItem.GetWeight() );
+bool bItalic= ( ITALIC_NONE  != rPostureItem.GetPosture() );
+bool bUnderline = ( LINESTYLE_NONE   != rUnderlineItem.GetLineStyle() 
);
+bool bCrossedOut= ( STRIKEOUT_SINGLE <= rCrossedOutItem.GetStrikeout() 
);
+bool bSetFontColor  = ( COL_AUTO != 
rColorItem.GetValue().GetColor() );  // default is AUTO now
 bool bSetFontName   = ( aHTMLStyle.aFontFamilyName  != 
rFontItem.GetFamilyName() );
 sal_uInt16 nSetFontSizeNumber = 0;
 sal_uInt32 nFontHeight = rFontHeightItem.GetHeight();
@@ -1098,6 +1103,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 if ( bBold )TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
 if ( bItalic )  TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
 if ( bUnderline )   TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
+if ( bCrossedOut )  TAG_ON( OOO_STRING_SVTOOLS_HTML_strikethrough );
 
 if ( bSetFont )
 {
@@ -1195,6 +1201,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 WriteGraphEntry( pGraphEntry );
 
 if ( bSetFont ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
+if ( bCrossedOut )  TAG_OFF( OOO_STRING_SVTOOLS_HTML_strikethrough );
 if ( bUnderline )   TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
 if ( bItalic )  TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
 if ( bBold )TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-06 Thread Eike Rathke
 sc/source/ui/formdlg/formula.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 9c9954570519f2607cf261ff19801e4a167d607b
Author: Eike Rathke 
Date:   Wed Jul 5 18:52:14 2017 +0200

Display string results in the Function Wizard quoted

To distinguish number strings from numeric results.

Change-Id: I68e044e839b2d5d2e87835dd0002f42aa0fc8192
(cherry picked from commit 14f562b109042ebde90261f93952b4c730e1427d)
Reviewed-on: https://gerrit.libreoffice.org/39608
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index cbaf4dd74165..308b206537d0 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -338,13 +338,16 @@ bool ScFormulaDlg::calculateValue( const OUString& 
rStrExp, OUString& rStrResult
 {
 SvNumberFormatter& aFormatter = *(m_pDoc->GetFormatTable());
 Color* pColor;
-if ( pFCell->IsValue() )
+if (pFCell->IsMatrix())
+{
+rStrResult = pFCell->GetString().getString();
+}
+else if (pFCell->IsValue())
 {
 double n = pFCell->GetValue();
 sal_uLong nFormat = aFormatter.GetStandardFormat( n, 0,
 pFCell->GetFormatType(), ScGlobal::eLnge );
-aFormatter.GetOutputString( n, nFormat,
-rStrResult,  );
+aFormatter.GetOutputString( n, nFormat, rStrResult,  );
 }
 else
 {
@@ -352,6 +355,11 @@ bool ScFormulaDlg::calculateValue( const OUString& 
rStrExp, OUString& rStrResult
 pFCell->GetFormatType(), ScGlobal::eLnge);
 aFormatter.GetOutputString( pFCell->GetString().getString(), 
nFormat,
 rStrResult,  );
+// Indicate it's a string, so a number string doesn't look numeric.
+// Escape embedded quotation marks first by doubling them, as
+// usual. Actually the result can be copy-pasted from the result
+// box as literal into a formula expression.
+rStrResult = "\"" + rStrResult.replaceAll( "\"", "\"\"") + "\"";
 }
 
 ScRange aTestRange;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-03 Thread Markus Mohrhard
 sc/source/ui/docshell/docsh4.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 967fd3e7a6e37495be17c2dfa62e05944cfa6af8
Author: Markus Mohrhard 
Date:   Wed Jun 28 02:15:04 2017 +0200

handle SID_ENCRYPTIONDATA for shared password protected docs, tdf#56173

Change-Id: Iadfe880b7be3186410a08568844d8812f176005d
Reviewed-on: https://gerrit.libreoffice.org/39332
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 669c12d59b6131f44945f166c77ae98df52ebb9e)
Reviewed-on: https://gerrit.libreoffice.org/39336
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 1cd085e0b3aa..bc4a8a8df386 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2441,6 +2441,13 @@ uno::Reference< frame::XModel > 
ScDocShell::LoadSharedDocument()
 aArgs[1].Name = "Password";
 aArgs[1].Value <<= pPasswordItem->GetValue();
 }
+const SfxUnoAnyItem* pEncryptionItem = 
SfxItemSet::GetItem(GetMedium()->GetItemSet(), 
SID_ENCRYPTIONDATA, false);
+if (pEncryptionItem)
+{
+aArgs.realloc(aArgs.getLength() + 1);
+aArgs[aArgs.getLength() - 1].Name = "EncryptionData";
+aArgs[aArgs.getLength() - 1].Value = 
pEncryptionItem->GetValue();
+}
 }
 
 xModel.set(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-03 Thread Markus Mohrhard
 sc/source/filter/oox/pagesettings.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7b1abc47af7a64ab8d3204cb85f173f0023da3ff
Author: Markus Mohrhard 
Date:   Wed Jun 28 04:16:51 2017 +0200

always import page scaling, tdf#65848

Change-Id: If5bad2336443280dd33d750b1b2749a06f2b5101
Reviewed-on: https://gerrit.libreoffice.org/39334
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit fef72f9623bac7f9aa50b4f2606e6ec6282cfe1f)
Reviewed-on: https://gerrit.libreoffice.org/39339
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/oox/pagesettings.cxx 
b/sc/source/filter/oox/pagesettings.cxx
index beeea7b352e5..fe5ff212e341 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -911,7 +911,7 @@ void PageSettingsConverter::writePageSettingsProperties(
 else
 {
 // scale may be 0 which indicates uninitialized
-sal_Int16 nScale = (rModel.mbValidSettings && (rModel.mnScale > 0)) ? 
getLimitedValue< sal_Int16, sal_Int32 >( rModel.mnScale, 10, 400 ) : 100;
+sal_Int16 nScale = (rModel.mnScale > 0) ? getLimitedValue< sal_Int16, 
sal_Int32 >( rModel.mnScale, 10, 400 ) : 100;
 rPropSet.setProperty( PROP_PageScale, nScale );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-03 Thread Markus Mohrhard
 sc/source/core/data/documen7.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 448024d6b63b45e5c5f403ed2e909059ddcb09bd
Author: Markus Mohrhard 
Date:   Fri Jun 30 13:59:57 2017 +0200

pBASM can be nullptr in copy docs, e.g. during insert sheet from doc

Found through 
http://crashreport.libreoffice.org/stats/crash_details/3bd264ba-ec12-476a-9bb4-e832caca3445

Change-Id: I0a4e6dddca61a2538c0fe6bbc51770a9886c464d
Reviewed-on: https://gerrit.libreoffice.org/39411
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit caf1ddedbef77ac648d8b8b35978a0613aa77da6)
Reviewed-on: https://gerrit.libreoffice.org/39423
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 1dc49fd5b2e7..8ab7e6014266 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -556,6 +556,9 @@ void ScDocument::FinalTrackFormulas( SfxHintId nHintId )
  */
 void ScDocument::TrackFormulas( SfxHintId nHintId )
 {
+if (!pBASM)
+return;
+
 if (pBASM->IsInBulkBroadcast() && !IsFinalTrackFormulas() && nHintId == 
SfxHintId::ScDataChanged)
 {
 SetTrackFormulasPending();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-07-01 Thread Eike Rathke
 sc/source/ui/view/viewdata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aaa0d9af02ad7484377f946d528cdbfc51483c9d
Author: Eike Rathke 
Date:   Wed Jun 28 18:51:16 2017 +0200

Resolves: tdf#108796 let ScViewData::InsertTabs() insert the correct amount

... at the correct position. This only ever worked by chance, if at all, and
now surfaced after

commit 73dec49802ef8fc42c5719efaa42a33cde68e569
Date:   Tue Mar 7 10:46:12 2017 +0100

Change-Id: I9bd0aeb5a471bd644c1497306effe9045c1daa97
(cherry picked from commit c9591f3b6153614c9849b8afbdcacbecc99c1f7c)
Reviewed-on: https://gerrit.libreoffice.org/39373
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 789e84c17e46..e0fe575a7d27 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -527,7 +527,7 @@ void ScViewData::InsertTab( SCTAB nTab )
 
 void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
 {
-if( nTab+nNewSheets >= static_cast(maTabData.size()))
+if (nTab >= static_cast(maTabData.size()))
 maTabData.resize(nTab+nNewSheets, nullptr);
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-27 Thread Caolán McNamara
 sc/source/ui/cctrl/cbuttonw.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 92921cfec5a41bffe16426cbf0511accddda6f2c
Author: Caolán McNamara 
Date:   Fri Jun 23 16:17:29 2017 +0100

Resolves: tdf#108708 set a min width for calc dropdown combobox button

Change-Id: I002350170cf30a3347ed0c4e4885109ef194458e
Reviewed-on: https://gerrit.libreoffice.org/39179
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/cctrl/cbuttonw.cxx b/sc/source/ui/cctrl/cbuttonw.cxx
index e559ea185f25..f922e545d71a 100644
--- a/sc/source/ui/cctrl/cbuttonw.cxx
+++ b/sc/source/ui/cctrl/cbuttonw.cxx
@@ -43,9 +43,8 @@ void ScDDComboBoxButton::SetOutputDevice( OutputDevice* 
pOutputDevice )
 
 void ScDDComboBoxButton::SetOptSizePixel()
 {
-aBtnSize = pOut->LogicToPixel( Size(0,11), MapUnit::MapAppFont );
-//aBtnSize.Width() = GetSystemMetrics( SM_CXVSCROLL ) - 1; // Win SDK 
function
-aBtnSize.Width() = 
pOut->GetSettings().GetStyleSettings().GetScrollBarSize();
+aBtnSize = pOut->LogicToPixel(Size(8, 11), MapUnit::MapAppFont);
+aBtnSize.Width() = std::max(aBtnSize.Width(), 
pOut->GetSettings().GetStyleSettings().GetScrollBarSize());
 }
 
 void ScDDComboBoxButton::Draw( const Point& rAt,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-24 Thread Julien Nabet
 sc/source/ui/docshell/docsh.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 611299a16f9b21914d37788b700af0e0ba9a5aa0
Author: Julien Nabet 
Date:   Sat Jun 24 16:02:51 2017 +0200

Related tdf#40713, use DecodeMechanism::Unambiguous

Change-Id: I73221fb6c127903398a7faae48d5247339ec8d7f
Reviewed-on: https://gerrit.libreoffice.org/39215
Reviewed-by: Lionel Elie Mamane 
Tested-by: Jenkins 

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 69a724d44b55..69b399a0c355 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2382,7 +2382,7 @@ bool ScDocShell::ConvertTo( SfxMedium  )
 
 // tdf#40713: don't lose dbt file
 // if aDbtFile corresponds exactly to aTmpFile, we just have 
to return
-if (aDbtFile.GetMainURL( INetURLObject::DecodeMechanism::NONE 
) == aTmpFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ))
+if (aDbtFile.GetMainURL( 
INetURLObject::DecodeMechanism::Unambiguous ) == aTmpFile.GetMainURL( 
INetURLObject::DecodeMechanism::Unambiguous ))
 return bRet;
 
 if ( IsDocument( aDbtFile ) && !KillFile( aDbtFile ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-24 Thread Julien Nabet
 sc/source/ui/docshell/docsh.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit a8dc650eaae7d35b944b62560056bda0423d3f96
Author: Julien Nabet 
Date:   Fri Jun 23 23:55:50 2017 +0200

tdf#40713: dBASE, don't lose dbt file

if aDbtFile corresponds exactly to aTmpFile, we just have to return

Change-Id: I1dde8efbe01838dc94f6025d5b81f5aee01932ac
Reviewed-on: https://gerrit.libreoffice.org/39189
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
(cherry picked from commit 36d91a65ab2db0c4c81e09771f6b44e1905122a0)
Reviewed-on: https://gerrit.libreoffice.org/39195
Reviewed-by: Muthu Subramanian K 

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 77db8cd073f4..69a724d44b55 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2379,6 +2379,12 @@ bool ScDocShell::ConvertTo( SfxMedium  )
 const SfxStringItem* pNameItem = 
rMed.GetItemSet()->GetItem( SID_FILE_NAME );
 INetURLObject aDbtFile( pNameItem->GetValue(), 
INetProtocol::File );
 aDbtFile.setExtension("dbt");
+
+// tdf#40713: don't lose dbt file
+// if aDbtFile corresponds exactly to aTmpFile, we just have 
to return
+if (aDbtFile.GetMainURL( INetURLObject::DecodeMechanism::NONE 
) == aTmpFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ))
+return bRet;
+
 if ( IsDocument( aDbtFile ) && !KillFile( aDbtFile ) )
 bRet = false;
 if ( bRet && !MoveFile( aTmpFile, aDbtFile ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-22 Thread Eike Rathke
 sc/source/core/tool/scmatrix.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 6a4343a9925dbc5a75b7aeb5dfd4fde21124492f
Author: Eike Rathke 
Date:   Wed Jun 21 23:42:25 2017 +0200

Resolves: tdf#108292 WalkAndMatchElements: really limit the match

... to the columns queried, not just when entering an mdds node. Otherwise 
it
would return an unexpected index, plus bailing out early spares unnecessary
comparisons for the rest of a node block.

Regression of

commit 3fed166279377f7ad702b8911899243b8adff3bf
Date:   Fri Aug 16 16:29:38 2013 +0200

that started to use

commit 7334f8db6f6004d48e2dbf014f27878a7ae21eb1
Date:   Fri Aug 16 16:29:27 2013 +0200

with its bad implementation.

Just that VLOOKUP on a matrix with a larger block of same typed data as the
query *and* a match in an excess column seems to be rare..

Change-Id: Ia4ef3fd56490de82910d5aa13a84be2de851f9b0
(cherry picked from commit d3b77628efc72d857c63c8fb91d7ed2b499ac860)
Reviewed-on: https://gerrit.libreoffice.org/39081
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 5baa7de82e58..659e22fa064a 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1284,6 +1284,8 @@ public:
 
 size_t getMatching() const { return mnResult; }
 
+size_t getRemainingCount() const { return ((mnCol2 + 1) * maSize.row) - 
mnIndex; }
+
 size_t compare(const MatrixImplType::element_block_node_type& node) const;
 
 void operator() (const MatrixImplType::element_block_node_type& node)
@@ -1293,7 +1295,7 @@ public:
 return;
 
 // limit lookup to the requested columns
-if ((mnCol1 * maSize.row) <= mnIndex && mnIndex < ((mnCol2 + 1) * 
maSize.row))
+if ((mnCol1 * maSize.row) <= mnIndex && getRemainingCount() > 0)
 {
 mnResult = compare(node);
 }
@@ -1314,7 +1316,8 @@ size_t WalkAndMatchElements::compare(const 
MatrixImplType::element_block
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, nCount++)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (*it == maMatchValue)
 {
@@ -1329,7 +1332,8 @@ size_t WalkAndMatchElements::compare(const 
MatrixImplType::element_block
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, ++nCount)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (int(*it) == maMatchValue)
 {
@@ -1359,7 +1363,8 @@ size_t 
WalkAndMatchElements::compare(const MatrixImplType::el
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, ++nCount)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (it->getDataIgnoreCase() == 
maMatchValue.getDataIgnoreCase())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-21 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   59 ++
 1 file changed, 59 insertions(+)

New commits:
commit e074090cea379716096d7025a62ad1c756b4d14f
Author: Eike Rathke 
Date:   Wed Jun 21 19:42:36 2017 +0200

Resolves: tdf#108671 mark named expression single reference #REF! if deleted

Probably broken already since

commit f77c9d5b3cb65d9c2e2417f60bec1113feac50e1
Date:   Mon Jul 29 14:47:07 2013 -0400

Change-Id: If90a959d000a1bf5ab0804deb22d5cfad413ea5e
(cherry picked from commit 6580e171ad054dca38f55822e67a400191cecdf5)
Reviewed-on: https://gerrit.libreoffice.org/39071
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 91100ef32c15..027786958ceb 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3657,6 +3657,65 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 case svSingleRef:
 {
 ScSingleRefData& rRef = *p->GetSingleRef();
+if (rCxt.mnRowDelta < 0)
+{
+// row(s) deleted.
+
+if (rRef.IsRowRel())
+// Don't modify relative references in names.
+break;
+
+ScAddress aAbs = rRef.toAbs(rPos);
+
+if (aAbs.Col() < rCxt.maRange.aStart.Col() || 
rCxt.maRange.aEnd.Col() < aAbs.Col())
+// column of the reference is not in the 
deleted column range.
+break;
+
+if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || 
aAbs.Tab() < rCxt.maRange.aStart.Tab())
+// wrong tables
+break;
+
+const SCROW nDelStartRow = 
rCxt.maRange.aStart.Row() + rCxt.mnRowDelta;
+const SCROW nDelEndRow = nDelStartRow - 
rCxt.mnRowDelta - 1;
+
+if (nDelStartRow <= aAbs.Row() && aAbs.Row() <= 
nDelEndRow)
+{
+// This reference is deleted.
+rRef.SetRowDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+}
+else if (rCxt.mnColDelta < 0)
+{
+// column(s) deleted.
+
+if (rRef.IsColRel())
+// Don't modify relative references in names.
+break;
+
+ScAddress aAbs = rRef.toAbs(rPos);
+
+if (aAbs.Row() < rCxt.maRange.aStart.Row() || 
rCxt.maRange.aEnd.Row() < aAbs.Row())
+// row of the reference is not in the deleted 
row range.
+break;
+
+if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || 
aAbs.Tab() < rCxt.maRange.aStart.Tab())
+// wrong tables
+break;
+
+const SCCOL nDelStartCol = 
rCxt.maRange.aStart.Col() + rCxt.mnColDelta;
+const SCCOL nDelEndCol = nDelStartCol - 
rCxt.mnColDelta - 1;
+
+if (nDelStartCol <= aAbs.Col() && aAbs.Col() <= 
nDelEndCol)
+{
+// This reference is deleted.
+rRef.SetColDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+}
+
 if (adjustSingleRefInName(rRef, rCxt, rPos, nullptr))
 aRes.mbReferenceModified = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-21 Thread Eike Rathke
 sc/source/ui/view/viewdata.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 1fa02810cb946733a22519e8df0c8a2608fcd084
Author: Eike Rathke 
Date:   Wed Jun 21 17:42:42 2017 +0200

Resolves: tdf#108654 check nTabNo against maTabData size

ScViewData::DeleteTab() and DeleteTabs() never did that and worked by 
accident
for which commit 73dec49802ef8fc42c5719efaa42a33cde68e569 removed the
grounding..

Change-Id: I95460cd017d558c073df7891551d0251009dc1d4
(cherry picked from commit 87cbbdc98d78c3c15f7161de6fec93d8680ee1de)
Reviewed-on: https://gerrit.libreoffice.org/39066
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 54fc06227563..789e84c17e46 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -546,6 +546,11 @@ void ScViewData::DeleteTab( SCTAB nTab )
 delete maTabData.at(nTab);
 
 maTabData.erase(maTabData.begin() + nTab);
+if (static_cast(nTabNo) >= maTabData.size())
+{
+EnsureTabDataSize(1);
+nTabNo = maTabData.size() - 1;
+}
 UpdateCurrentTab();
 mpMarkData->DeleteTab( nTab );
 }
@@ -559,6 +564,11 @@ void ScViewData::DeleteTabs( SCTAB nTab, SCTAB nSheets )
 }
 
 maTabData.erase(maTabData.begin() + nTab, maTabData.begin()+ nTab+nSheets);
+if (static_cast(nTabNo) >= maTabData.size())
+{
+EnsureTabDataSize(1);
+nTabNo = maTabData.size() - 1;
+}
 UpdateCurrentTab();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-21 Thread Eike Rathke
 sc/source/ui/view/viewdata.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 031bca731e914b309d59cc685839d14786bb615c
Author: Eike Rathke 
Date:   Wed Jun 21 17:45:46 2017 +0200

Assert that nTabNo fits maTabData, tdf#108654 related

Change-Id: I30b95f69a71317896d86e36b1b926c703f1539d1
(cherry picked from commit 0fed0829a601aaed6134bbc689b394e38c830605)
Reviewed-on: https://gerrit.libreoffice.org/39067
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index f4daf380d684..54fc06227563 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -502,6 +502,7 @@ ScViewData::~ScViewData()
 
 void ScViewData::UpdateCurrentTab()
 {
+assert(0 <= nTabNo && static_cast(nTabNo) < maTabData.size());
 pThisTab = maTabData[nTabNo];
 while (!pThisTab)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-16 Thread Eike Rathke
 sc/source/ui/view/viewfun2.cxx |   56 ++---
 1 file changed, 36 insertions(+), 20 deletions(-)

New commits:
commit 53437b4db7e8f61155aea0a6e215f67c333bfaab
Author: Eike Rathke 
Date:   Fri Jun 16 15:06:18 2017 +0200

Resolves: tdf#71339 include selected top/left empty rows/columns in AutoSum

 This is a combination of 3 commits.

Resolves: tdf#71339 include selected top/left empty rows/columns in AutoSum

Keep the exclusion for determining the direction, but include them in the 
final
formula result and selection.

(cherry picked from commit 9c0cd667da908ec1dde193c83d7d69a31b43e934)

But not empty top/left in AutoSum of SUMs final selection, tdf#71339

This was even more confusing than previously..

(cherry picked from commit b3947785202ac263671113d6c9fd57d3ce6208d5)

9cbdd05e9b59662dfde4a08422d0d2846849719f

For AutoSum up to next sum mark/select the resulting range, tdf#71339

(cherry picked from commit f83d8ae84584c0967e2346566d21d65d6d7a432f)

b543b4a84305467e8a9ce34bdc2c6a211f399cad

Change-Id: Ic752229bad17ac25de9ef598f3da32e0fd257fd1
Reviewed-on: https://gerrit.libreoffice.org/38886
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 17feb727fb0f..b51dbbe1acda 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -292,13 +292,13 @@ static bool lcl_FindNextSumEntryInRow( ScDocument* pDoc, 
SCCOL& nCol, SCROW nRow
 return eSkip == ScAutoSumSum && nCol < nTmp;
 }
 
-static bool lcl_GetAutoSumForColumnRange( ScDocument* pDoc, ScRangeList& 
rRangeList, const ScRange& rRange )
+static ScAutoSum lcl_GetAutoSumForColumnRange( ScDocument* pDoc, ScRangeList& 
rRangeList, const ScRange& rRange )
 {
 const ScAddress aStart = rRange.aStart;
 const ScAddress aEnd = rRange.aEnd;
 if ( aStart.Col() != aEnd.Col() )
 {
-return false;
+return ScAutoSumNone;
 }
 
 const SCTAB nTab = aEnd.Tab();
@@ -306,7 +306,7 @@ static bool lcl_GetAutoSumForColumnRange( ScDocument* pDoc, 
ScRangeList& rRangeL
 SCROW nEndRow = aEnd.Row();
 SCROW nStartRow = nEndRow;
 SCCOLROW nExtend = 0;
-const ScAutoSum eSum = lcl_IsAutoSumData( pDoc, nCol, nEndRow, nTab, 
DIR_TOP, nExtend /*out*/ );
+ScAutoSum eSum = lcl_IsAutoSumData( pDoc, nCol, nEndRow, nTab, DIR_TOP, 
nExtend /*out*/ );
 
 if ( eSum == ScAutoSumSum )
 {
@@ -325,23 +325,25 @@ static bool lcl_GetAutoSumForColumnRange( ScDocument* 
pDoc, ScRangeList& rRangeL
 else
 {
 while ( nStartRow > aStart.Row() &&
-lcl_IsAutoSumData( pDoc, nCol, nStartRow-1, nTab, DIR_TOP, 
nExtend /*out*/ ) != ScAutoSumSum )
+(eSum = lcl_IsAutoSumData( pDoc, nCol, nStartRow-1, nTab, 
DIR_TOP, nExtend /*out*/ )) != ScAutoSumSum )
 {
 --nStartRow;
 }
 rRangeList.Append( ScRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab 
) );
+if (eSum == ScAutoSumNone)
+eSum = ScAutoSumData;
 }
 
-return true;
+return eSum;
 }
 
-static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, ScRangeList& 
rRangeList, const ScRange& rRange )
+static ScAutoSum lcl_GetAutoSumForRowRange( ScDocument* pDoc, ScRangeList& 
rRangeList, const ScRange& rRange )
 {
 const ScAddress aStart = rRange.aStart;
 const ScAddress aEnd = rRange.aEnd;
 if ( aStart.Row() != aEnd.Row() )
 {
-return false;
+return ScAutoSumNone;
 }
 
 const SCTAB nTab = aEnd.Tab();
@@ -349,7 +351,7 @@ static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, 
ScRangeList& rRangeList
 SCCOL nEndCol = aEnd.Col();
 SCCOL nStartCol = nEndCol;
 SCCOLROW nExtend = 0;
-const ScAutoSum eSum = lcl_IsAutoSumData( pDoc, nEndCol, nRow, nTab, 
DIR_LEFT, nExtend /*out*/ );
+ScAutoSum eSum = lcl_IsAutoSumData( pDoc, nEndCol, nRow, nTab, DIR_LEFT, 
nExtend /*out*/ );
 
 if ( eSum == ScAutoSumSum )
 {
@@ -368,14 +370,16 @@ static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, 
ScRangeList& rRangeList
 else
 {
 while ( nStartCol > aStart.Col() &&
-lcl_IsAutoSumData( pDoc, nStartCol-1, nRow, nTab, DIR_LEFT, 
nExtend /*out*/ ) != ScAutoSumSum )
+(eSum = lcl_IsAutoSumData( pDoc, nStartCol-1, nRow, nTab, 
DIR_LEFT, nExtend /*out*/ )) != ScAutoSumSum )
 {
 --nStartCol;
 }
 rRangeList.Append( ScRange( nStartCol, nRow, nTab, nEndCol, nRow, nTab 
) );
+if (eSum == ScAutoSumNone)
+eSum = ScAutoSumData;
 }
 
-return true;
+return eSum;
 }
 
 bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
@@ -610,6 +614,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool 
bSubTotal, bool bSetCursor
 
 SCCOL 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-15 Thread Eike Rathke
 sc/source/core/tool/interpr7.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 134c9a76690d17a1a8a3c339ef4ef8cbe0b8841d
Author: Eike Rathke 
Date:   Thu Jun 15 12:06:00 2017 +0200

Ensure all cases push an error return, tdf#104989 related (not the cause)

A formula cell in matrix context could have no dimensions.. (which is the 
cause
but elsewhere).

Change-Id: I1a04f9808d8f5c802789e3db77052351b24c24c7
(cherry picked from commit e6abe9c3d06d6776e05bef93b5e6f87b403ea967)
Reviewed-on: https://gerrit.libreoffice.org/38831
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 8b3e5375545b..0d8af3173ed2 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -83,6 +83,11 @@ void ScInterpreter::ScFilterXML()
 
 }
 }
+if (!nMatCols || !nMatRows)
+{
+PushNoValue();
+return;
+}
 
 OUString aXPathExpression = GetString().getString();
 OUString aString = GetString().getString();
@@ -124,6 +129,7 @@ void ScInterpreter::ScFilterXML()
 switch(pXPathObj->type)
 {
 case XPATH_UNDEFINED:
+PushNoValue();
 break;
 case XPATH_NODESET:
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-15 Thread Eike Rathke
 sc/source/ui/unoobj/funcuno.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit df5b20f737d4f56f86a6d19f509e13294c313d89
Author: Eike Rathke 
Date:   Thu Jun 15 13:05:16 2017 +0200

Resolves: tdf#104989 a matrix/array formula cell needs to have dimensions

Most spreadsheet functions don't need it, but some may.

Change-Id: I954acaa0a64c4dac8d15acd5b3f404019a7e0bce
(cherry picked from commit 033d018a3a1d345d61f3c4dc4da693cdd4004dea)
Reviewed-on: https://gerrit.libreoffice.org/38830
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 81e13bde7bd8..c3b66b9d447f 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -592,6 +592,8 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const 
OUString& aName,
 pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
 mbArray ? ScMatrixMode::Formula : ScMatrixMode::NONE );
 pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula);
+if (mbArray && pFormula)
+pFormula->SetMatColsRows(1,1);  // the cell dimensions (only one 
cell)
 
 //  call GetMatrix before GetErrCode because GetMatrix always 
recalculates
 //  if there is no matrix result
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-12 Thread Julien Nabet
 sc/source/ui/unoobj/scdetect.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3c453321813b538d575ce35f9e980dd7dad68679
Author: Julien Nabet 
Date:   Sun Jun 11 12:57:31 2017 +0200

tdf#106423: dbase file can have no records

Regression from 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=4e3ff19b33c84557fd20e68960499933b4e52638
tdf#84834 sc: stricter type detection for dBASE files

Log test file from tdf#84834 still opens in Writer as expected

Change-Id: Ibf5a0f586e3a132455d2363e61e5cc7ea249002d
Reviewed-on: https://gerrit.libreoffice.org/38660
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 57ae8834c8313354477117b65d87c86407f6bf82)
Reviewed-on: https://gerrit.libreoffice.org/38691
Reviewed-by: Lionel Elie Mamane 
Tested-by: Julien Nabet 

diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 24715d9aad80..cd3ec9d2a750 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -241,7 +241,8 @@ static bool lcl_MayBeDBase( SvStream& rStream )
 }
 
 // tdf#84834 sanity check of size
-if (0 == nRecords || nSize < nHeaderLen + nRecords * 
sal_uInt64(nRecordSize))
+// tdf#106423: a dbf file can have 0 record, so no need to check nRecords
+if (nSize < nHeaderLen + nRecords * sal_uInt64(nRecordSize))
 return false;
 
 // Last byte of header must be 0x0d, this is how it's specified.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-09 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 23514c32eef813b23cae99df709fe74882f90bef
Author: Eike Rathke 
Date:   Thu Jun 8 21:27:20 2017 +0200

With reference lists there can be more than 255 queries

(cherry picked from commit c479912ffc48e1db1671333f09c041a081c600a3)

 Conflicts:
sc/source/core/tool/interpr1.cxx

Backported.

Change-Id: Ia5dc32fbcd8ad738d5ec0f20cc233b58fcadc882
Reviewed-on: https://gerrit.libreoffice.org/38583
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index a9d4a36cd8c2..c27e4c2ede86 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5309,7 +5309,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 sal_uInt8 nParamCount = GetByte();
 sal_uInt8 nQueryCount = nParamCount / 2;
 
-std::vector aResArray;
+std::vector aResArray;
 size_t nRowSize = 0;
 size_t nColSize = 0;
 double fVal = 0.0;
@@ -5522,7 +5522,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 return;
 }
 
-std::vector::iterator itRes = aResArray.begin(), 
itResEnd = aResArray.end();
+std::vector::iterator itRes = aResArray.begin(), 
itResEnd = aResArray.end();
 std::vector::const_iterator itThisRes = 
aResValues.begin();
 for (; itRes != itResEnd; ++itRes, ++itThisRes)
 *itRes += *itThisRes;
@@ -5635,7 +5635,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 return;
 }
 
-std::vector::const_iterator itRes = 
aResArray.begin(), itResEnd = aResArray.end();
+std::vector::const_iterator itRes = 
aResArray.begin(), itResEnd = aResArray.end();
 std::vector::const_iterator itMain = 
aMainValues.begin();
 for (; itRes != itResEnd; ++itRes, ++itMain)
 {
@@ -5662,7 +5662,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 }
 else
 {
-std::vector::const_iterator itRes = 
aResArray.begin();
+std::vector::const_iterator itRes = 
aResArray.begin();
 for (size_t nCol = 0; nCol < nColSize; ++nCol)
 {
 for (size_t nRow = 0; nRow < nRowSize; ++nRow, ++itRes)
@@ -5696,7 +5696,7 @@ void ScInterpreter::IterateParametersIfs( 
sc::ParamIfsResult& rRes )
 }
 else
 {
-std::vector::const_iterator itRes = aResArray.begin(), 
itResEnd = aResArray.end();
+std::vector::const_iterator itRes = aResArray.begin(), 
itResEnd = aResArray.end();
 for (; itRes != itResEnd; ++itRes)
 if (*itRes == nQueryCount)
 ++rRes.mfCount;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-08 Thread Eike Rathke
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 430e2d0d087ec981e59e0962bc029717481ee753
Author: Eike Rathke 
Date:   Thu Jun 8 20:39:00 2017 +0200

Add '~' reference union/list operator to range finder delimiters

... so formula expressions using it actually get the ranges highlighted.

Change-Id: Ibb0d2b49101e62b1f219a14d1669a501a450aaf4
(cherry picked from commit 27c5f2586821546ee8281bafb8b5f478ae015ac1)
Reviewed-on: https://gerrit.libreoffice.org/38580
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 3647a5633502..dfbd1c43bbb3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -299,7 +299,7 @@ void ScInputHandler::InitRangeFinder( const OUString& 
rFormula )
 ScDocument& rDoc = pDocSh->GetDocument();
 const sal_Unicode cSheetSep = lcl_getSheetSeparator();
 
-OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !\"");
+OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"");
 // delimiters (in addition to ScEditUtil): only characters that are
 // allowed in formulas next to references and the quotation mark (so
 // string constants can be skipped)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source

2017-06-07 Thread Gulsah Kose
 sc/source/core/data/document.cxx |   23 +--
 sc/source/ui/view/tabview3.cxx   |1 +
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 81e7ef8d3941de527f21c1508389c9e09518680b
Author: Gulsah Kose 
Date:   Thu Jun 1 16:02:53 2017 +0300

tdf#108098 Correct detection of MIXED state.

Change-Id: I212b908b8b7b2e8933dd5f923b0a2d8890bceed6
Signed-off-by: Gulsah Kose 
Reviewed-on: https://gerrit.libreoffice.org/38310
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 57bdb06703ecf233d12304d4e71e1f40d29da327)
Reviewed-on: https://gerrit.libreoffice.org/38537

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9d68bb5a5564..0aff3b5e9469 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6518,7 +6518,9 @@ void ScDocument::ForgetNoteCaptions( const ScRangeList& 
rRanges, bool bPreserveD
 
 CommentCaptionState ScDocument::GetAllNoteCaptionsState( const ScRangeList& 
rRanges )
 {
-CommentCaptionState aOldState, aState = CommentCaptionState::ALLHIDDEN; 
//because of Werror=maybe-uninitialized
+CommentCaptionState aTmpState = CommentCaptionState::ALLHIDDEN;
+CommentCaptionState aState = CommentCaptionState::ALLHIDDEN;
+bool bFirstControl = true;
 std::vector aNotes;
 
 for (size_t i = 0, n = rRanges.size(); i < n; ++i)
@@ -6528,18 +6530,19 @@ CommentCaptionState 
ScDocument::GetAllNoteCaptionsState( const ScRangeList& rRan
 for( SCTAB nTab = pRange->aStart.Tab(); nTab <= pRange->aEnd.Tab(); 
++nTab )
 {
 aState = maTabs[nTab]->GetAllNoteCaptionsState( *pRange, aNotes );
+
 if (aState == CommentCaptionState::MIXED)
 return aState;
 
-if (nTab - 1 >= 0)  // it is possible that a range is ALLSHOWN, 
another range is ALLHIDDEN,
-{   // we have to detect that situation as mixed.
-aOldState = maTabs[nTab-1]->GetAllNoteCaptionsState( *pRange, 
aNotes );
-
-if (aState != aOldState)
-{
-aState = CommentCaptionState::MIXED;
-return aState;
-}
+if (bFirstControl)  // it is possible that a 
range is ALLSHOWN, another range is ALLHIDDEN,
+{   // we have to detect that 
situation as mixed.
+aTmpState = aState;
+bFirstControl = false;
+}
+else if(aTmpState != aState)
+{
+aState = CommentCaptionState::MIXED;
+return aState;
 }
 }
 }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 390e8ef37a53..226eb8d91d4c 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -485,6 +485,7 @@ void ScTabView::SelectionChanged()
 rBindings.Invalidate( FID_HIDE_NOTE );
 rBindings.Invalidate( FID_SHOW_ALL_NOTES );
 rBindings.Invalidate( FID_HIDE_ALL_NOTES );
+rBindings.Invalidate( SID_TOGGLE_NOTES );
 rBindings.Invalidate( SID_DELETE_NOTE );
 rBindings.Invalidate( SID_ROWCOL_SELCOUNT );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >