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

2014-12-20 Thread Eike Rathke
 sc/inc/scmatrix.hxx  |2 
 sc/source/core/tool/scmatrix.cxx |   96 +--
 2 files changed, 53 insertions(+), 45 deletions(-)

New commits:
commit b5ab92248e80a3ff8869a7e731ab70a948531280
Author: Eike Rathke er...@redhat.com
Date:   Thu Dec 11 16:39:58 2014 +0100

resolved fdo#87237 propagate error values through matrix comparisons

Apparently introduced with 8e8b43a03e77dd251876c1de0ac06eeeb09192cd the
comparison results were stored as boolean values, effectively discarding
any infinite double values and error values encoded as NaN values.

(cherry picked from commit 3c405ff82fcc9f8f044833420485c54658064636)

Change-Id: I1fb6f46894a0bee02a37e28b7e6cc84f8c051f28
Reviewed-on: https://gerrit.libreoffice.org/13441
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 1db1641..0833c4d 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -202,7 +202,7 @@ public:
 ScMatrix(SCSIZE nC, SCSIZE nR);
 ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal);
 
-ScMatrix( size_t nC, size_t nR, const std::vectorbool rInitVals );
+ScMatrix( size_t nC, size_t nR, const std::vectordouble rInitVals );
 
 /** Clone the matrix. */
 ScMatrix* Clone() const;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 4f210a8..2e31ec8 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -69,51 +69,63 @@ typedef mdds::multi_type_matrixcustom_string_trait 
MatrixImplType;
 
 namespace {
 
-struct ElemEqualZero : public unary_functiondouble, bool
+struct ElemEqualZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val == 0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val == 0.0 ? 1.0 : 0.0;
 }
 };
 
-struct ElemNotEqualZero : public unary_functiondouble, bool
+struct ElemNotEqualZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val != 0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val != 0.0 ? 1.0 : 0.0;
 }
 };
 
-struct ElemGreaterZero : public unary_functiondouble, bool
+struct ElemGreaterZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val  0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val  0.0 ? 1.0 : 0.0;
 }
 };
 
-struct ElemLessZero : public unary_functiondouble, bool
+struct ElemLessZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val  0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val  0.0 ? 1.0 : 0.0;
 }
 };
 
-struct ElemGreaterEqualZero : public unary_functiondouble, bool
+struct ElemGreaterEqualZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val = 0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val = 0.0 ? 1.0 : 0.0;
 }
 };
 
-struct ElemLessEqualZero : public unary_functiondouble, bool
+struct ElemLessEqualZero : public unary_functiondouble, double
 {
-bool operator() (double val) const
+double operator() (double val) const
 {
-return val = 0.0;
+if (!::rtl::math::isFinite(val))
+return val;
+return val = 0.0 ? 1.0 : 0.0;
 }
 };
 
@@ -122,7 +134,7 @@ class CompareMatrixElemFunc : 
std::unary_functionMatrixImplType::element_block_
 {
 static _Comp maComp;
 
-std::vectorbool maNewMatValues;
+std::vectordouble maNewMatValues; // double instead of bool to 
transport error values
 size_t mnRow;
 size_t mnCol;
 public:
@@ -144,13 +156,6 @@ public:
 for (; it != itEnd; ++it)
 {
 double fVal = *it;
-if (!rtl::math::isFinite(fVal))
-{
-/* FIXME: this silently skips an error instead of 
propagating it! */
-maNewMatValues.push_back(false);
-continue;
-}
-
 maNewMatValues.push_back(maComp(fVal));
 }
 }
@@ -172,7 +177,7 @@ public:
 case mdds::mtm::element_empty:
 default:
 // Fill it with false.
-maNewMatValues.resize(maNewMatValues.size() + node.size, 
false);
+maNewMatValues.resize(maNewMatValues.size() + node.size, 0.0);
 }
 

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

2014-12-02 Thread Eike Rathke
 sc/inc/column.hxx   |2 
 sc/inc/document.hxx |2 
 sc/inc/refhint.hxx  |   18 ++
 sc/inc/table.hxx|2 
 sc/source/core/data/column.cxx  |   17 ++
 sc/source/core/data/document.cxx|5 
 sc/source/core/data/formulacell.cxx |   10 +
 sc/source/core/data/table2.cxx  |4 
 sc/source/core/data/table3.cxx  |  245 +++-
 sc/source/core/tool/refhint.cxx |6 
 sc/source/ui/docshell/dbdocfun.cxx  |2 
 11 files changed, 219 insertions(+), 94 deletions(-)

New commits:
commit f70bfe9d6ba27944935865eed731c6fc07649a1a
Author: Eike Rathke er...@redhat.com
Date:   Mon Dec 1 23:56:44 2014 +0100

fdo#86762 re-establish listeners to move cell broadcasters

... for UpdateReferenceOnSort=false

(cherry picked from commit 6c2111f17089eb667bf526561d7667d17825e822)

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

fdo#86762 broadcast also empty cells after sort

(cherry picked from commit 08793e08c7e9cefe594c49130f782725e386c463)

Conflicts:
sc/inc/column.hxx
sc/source/core/data/column.cxx
sc/source/core/data/document.cxx
sc/source/core/data/table2.cxx
sc/source/ui/docshell/dbdocfun.cxx

fdo#86762 re-establish listeners on moved broadcasters

...  also in SortReorderByColumn() similar to SortReorderByRow()

(cherry picked from commit e119f3883513aeaa49f332362620e955dc8b453f)

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

e275a754c530d6039ed14304900dd71416f36e46
7665dcc90d70fcf3b08bef0adb9ab6aaff1cdcdf

Change-Id: Id90288660e317d6e47ee01ee3b5ff9058cfa18df
Reviewed-on: https://gerrit.libreoffice.org/13275
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4bda39d..86d39ab 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -334,7 +334,7 @@ public:
 bool IsFormulaDirty( SCROW nRow ) const;
 
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext rCxt );
-voidSetDirty( SCROW nRow1, SCROW nRow2 );
+voidSetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells = 
false );
 voidSetDirtyVar();
 voidSetDirtyAfterLoad();
 voidSetTableOpDirty( const ScRange );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 44107b4..1d744a2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -994,7 +994,7 @@ public:
 voidResetChanged( const ScRange rRange );
 
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext rCxt );
-voidSetDirty( const ScRange );
+voidSetDirty( const ScRange, bool bIncludeEmptyCells = false 
);
 voidSetTableOpDirty( const ScRange );  // for Interpreter 
TableOp
 voidInterpretDirtyCells( const ScRangeList rRanges );
 SC_DLLPUBLIC void CalcAll();
diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx
index 6ccda8b..9ff8d30 100644
--- a/sc/inc/refhint.hxx
+++ b/sc/inc/refhint.hxx
@@ -21,7 +21,9 @@ public:
 enum Type {
 Moved,
 ColumnReordered,
-RowReordered
+RowReordered,
+StartListening,
+StopListening
 };
 
 private:
@@ -95,6 +97,20 @@ public:
 SCCOL getEndColumn() const;
 };
 
+class RefStartListeningHint : public RefHint
+{
+public:
+RefStartListeningHint();
+virtual ~RefStartListeningHint();
+};
+
+class RefStopListeningHint : public RefHint
+{
+public:
+RefStopListeningHint();
+virtual ~RefStopListeningHint();
+};
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 480cc2c..5d39f32 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -521,7 +521,7 @@ public:
 voidResetChanged( const ScRange rRange );
 
 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext rCxt );
-voidSetDirty( const ScRange );
+voidSetDirty( const ScRange, bool bIncludeEmptyCells = false );
 voidSetDirtyAfterLoad();
 voidSetDirtyVar();
 voidSetTableOpDirty( const ScRange );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 10da725..c014e00 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3055,14 +3055,27 @@ void ScColumn::SetAllFormulasDirty( const 
sc::SetFormulaDirtyContext rCxt )
 sc::ProcessFormula(maCells, aFunc);
 }
 
-void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2 )
+void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells )
 {
 // broadcasts everything within the range, with FormulaTracking
 sc::AutoCalcSwitch aSwitch(*pDocument, false);
 
 SetDirtyOnRangeHandler aHdl(*this);
 sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aHdl, aHdl);
-aHdl.broadcast();
+if 

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

2014-11-25 Thread Eike Rathke
 sc/inc/column.hxx   |   12 +++-
 sc/source/core/data/column4.cxx |   10 ++
 sc/source/core/data/table3.cxx  |3 ++-
 3 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit e44d09160038c7cf661e23885a0997d54ca01752
Author: Eike Rathke er...@redhat.com
Date:   Mon Nov 17 22:44:56 2014 +0100

fdo#83765 do not update references in SortReorderByColumn() if disabled

Similar to SortReorderByRow()

(cherry picked from commit 115a4b7ca36f65d93070d2e81048320d202e87a3)

Conflicts:
sc/inc/column.hxx

Change-Id: I2d2fe243c91a663b14e5bd75ee30225d1b8073da
Reviewed-on: https://gerrit.libreoffice.org/13117
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 66cd524..4bda39d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -575,18 +575,20 @@ public:
 
 /**
  * Reset column position of formula cells within specified row range.
- * Reference positions are also adjusted to reflect the new position so
- * that the formula cells still reference the same cells or ranges after
- * the the position change.  The position of a formula cell before the
- * call is interpreted as the old position of that cell.
+ * If bUpdateRefs==true then reference positions are also adjusted to
+ * reflect the new position so that the formula cells still reference the
+ * same cells or ranges after the the position change.
+ * The position of a formula cell before the call is interpreted as the old
+ * position of that cell.
  *
  * Caller needs to ensure that no formula groups cross the top and bottom
  * row boundaries.
  *
  * @param nRow1 top row boundary
  * @param nRow2 bottom row boundary
+ * @param bUpdateRefs whether to adjust references
  */
-void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2 );
+void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs 
);
 
 void SplitFormulaGroupByRelativeRef( const ScRange rBoundRange );
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 8b46e74..568b5b64 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -439,8 +439,9 @@ namespace {
 class FormulaColPosSetter
 {
 SCCOL mnCol;
+bool  mbUpdateRefs;
 public:
-FormulaColPosSetter( SCCOL nCol ) : mnCol(nCol) {}
+FormulaColPosSetter( SCCOL nCol, bool bUpdateRefs ) : mnCol(nCol), 
mbUpdateRefs(bUpdateRefs) {}
 
 void operator() ( size_t nRow, ScFormulaCell* pCell )
 {
@@ -451,7 +452,8 @@ public:
 ScAddress aOldPos = pCell-aPos;
 pCell-aPos.SetCol(mnCol);
 pCell-aPos.SetRow(nRow);
-pCell-GetCode()-AdjustReferenceOnMovedOrigin(aOldPos, 
pCell-aPos);
+if (mbUpdateRefs)
+pCell-GetCode()-AdjustReferenceOnMovedOrigin(aOldPos, 
pCell-aPos);
 }
 else
 {
@@ -463,9 +465,9 @@ public:
 
 }
 
-void ScColumn::ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2 )
+void ScColumn::ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool 
bUpdateRefs )
 {
-FormulaColPosSetter aFunc(nCol);
+FormulaColPosSetter aFunc(nCol, bUpdateRefs);
 sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc);
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d646678..99d6239 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -716,8 +716,9 @@ void ScTable::SortReorderByColumn(
 }
 
 // Reset formula cell positions which became out-of-sync after column 
reordering.
+bool bUpdateRefs = pArray-IsUpdateRefs();
 for (SCCOL nCol = nStart; nCol = nLast; ++nCol)
-aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2);
+aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2, bUpdateRefs);
 
 // Set up column reorder map (for later broadcasting of reference updates).
 sc::ColRowReorderMapType aColMap;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-25 Thread Eike Rathke
 sc/inc/tokenarray.hxx   |6 +
 sc/source/core/data/column4.cxx |2 +
 sc/source/core/data/table3.cxx  |4 +++
 sc/source/core/tool/token.cxx   |   43 
 4 files changed, 55 insertions(+)

New commits:
commit 094b19c2759c8ecc88b38d37047e9ac2de9b68ee
Author: Eike Rathke er...@redhat.com
Date:   Mon Nov 24 23:29:32 2014 +0100

fix fdo#79441 again and keep references to other sheets during sort

... also if other references are not updated. References to other sheets
are never to be treated as relative during sort, they are always
absolute, even if they have relative row/column part references.

Broken again during the big sort mess. Even if there was a unit test,
which didn't help as it got disabled / adapted to the change..

(cherry picked from commit f0e7364603c9566bc158303c515c3274ccba62ca)

Backported.

Change-Id: Ic0e61c5e1cb0728e20725c29e450ab0eb55c3305
Reviewed-on: https://gerrit.libreoffice.org/13118
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index fbb613c..75451e1 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -208,6 +208,12 @@ public:
 void AdjustReferenceOnMovedOrigin( const ScAddress rOldPos, const 
ScAddress rNewPos );
 
 /**
+ * Adjust all internal references on base position change if they point to
+ * a sheet other than the one of rOldPos.
+ */
+void AdjustReferenceOnMovedOriginIfOtherSheet( const ScAddress rOldPos, 
const ScAddress rNewPos );
+
+/**
  * Clear sheet deleted flag from internal reference tokens if the sheet
  * index falls within specified range.  Note that when a reference is on a
  * sheet that's been deleted, its referenced sheet index retains the
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 568b5b64..10bec05 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -454,6 +454,8 @@ public:
 pCell-aPos.SetRow(nRow);
 if (mbUpdateRefs)
 pCell-GetCode()-AdjustReferenceOnMovedOrigin(aOldPos, 
pCell-aPos);
+else
+
pCell-GetCode()-AdjustReferenceOnMovedOriginIfOtherSheet(aOldPos, 
pCell-aPos);
 }
 else
 {
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 99d6239..e49a4dc 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -870,6 +870,10 @@ void ScTable::SortReorderByRow(
 pNew-CopyAllBroadcasters(*rCell.maCell.mpFormula);
 pNew-GetCode()-AdjustReferenceOnMovedOrigin(aOldPos, 
aCellPos);
 }
+else
+{
+
pNew-GetCode()-AdjustReferenceOnMovedOriginIfOtherSheet(aOldPos, aCellPos);
+}
 
 sc::CellStoreType::iterator itBlk = 
rCellStore.push_back(pNew);
 }
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 03ecc49..f561614 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3548,6 +3548,49 @@ void ScTokenArray::AdjustReferenceOnMovedOrigin( const 
ScAddress rOldPos, const
 }
 }
 
+void ScTokenArray::AdjustReferenceOnMovedOriginIfOtherSheet( const ScAddress 
rOldPos, const ScAddress rNewPos )
+{
+FormulaToken** p = pCode;
+FormulaToken** pEnd = p + static_castsize_t(nLen);
+for (; p != pEnd; ++p)
+{
+bool bAdjust = false;
+switch ((*p)-GetType())
+{
+case svExternalSingleRef:
+bAdjust = true; // always
+// fallthru
+case svSingleRef:
+{
+ScToken* pToken = static_castScToken*(*p);
+ScSingleRefData rRef = pToken-GetSingleRef();
+ScAddress aAbs = rRef.toAbs(rOldPos);
+if (!bAdjust)
+bAdjust = (aAbs.Tab() != rOldPos.Tab());
+if (bAdjust)
+rRef.SetAddress(aAbs, rNewPos);
+}
+break;
+case svExternalDoubleRef:
+bAdjust = true; // always
+// fallthru
+case svDoubleRef:
+{
+ScToken* pToken = static_castScToken*(*p);
+ScComplexRefData rRef = pToken-GetDoubleRef();
+ScRange aAbs = rRef.toAbs(rOldPos);
+if (!bAdjust)
+bAdjust = (rOldPos.Tab()  aAbs.aStart.Tab() || 
aAbs.aEnd.Tab()  rOldPos.Tab());
+if (bAdjust)
+rRef.SetRange(aAbs, rNewPos);
+}
+break;
+default:
+;
+}
+}
+}
+
 namespace {
 
 void clearTabDeletedFlag( ScSingleRefData 

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

2014-08-22 Thread Eike Rathke
 sc/inc/types.hxx |8 
 sc/source/core/data/bcaslot.cxx  |   36 ++--
 sc/source/core/data/documen7.cxx |2 -
 sc/source/core/data/table3.cxx   |   67 +--
 sc/source/core/inc/bcaslot.hxx   |6 ++-
 sc/source/core/tool/token.cxx|2 +
 6 files changed, 111 insertions(+), 10 deletions(-)

New commits:
commit 2d8d35f9f74102b800a3b777a5e3d79dce283ae9
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 14 23:36:47 2014 +0200

correct references after sort, fdo#79441

5c6ee09126631342939ae8766fe36083d8c011e3 introduced a different
algorithm for reference handling during sort. Unfortunately that clashed
with the SC_CLONECELL_ADJUST3DREL introduced a little earlier resulting
in relative 3D references effectively being adjusted twice.

Furthermore, in-sort-range range references to one row (or column) were
not adapted to the move at all if the formula within the range listened
only to ranges and not a single cell. Added collecting and adjusting
area listeners for this.

Last but not least, external (relative) references need to be treated
the same as internal 3D references, making them point to the same
location after the sort.

(cherry picked from commit 69adec3ec051ff94f600ab899506ca9d645a8b56)

Conflicts:
sc/inc/types.hxx
sc/source/core/data/bcaslot.cxx

Plus necessary parts of 27182231acd3a0c9898a8dba78b76dc8a827b4c0 related
to bcaslot changes.

Change-Id: I492768b525f95f1c43d1c6e7a63a36cce093fa5a
Reviewed-on: https://gerrit.libreoffice.org/10930
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx
index 732ff19..5226463 100644
--- a/sc/inc/types.hxx
+++ b/sc/inc/types.hxx
@@ -100,6 +100,14 @@ struct RangeMatrix
 
 typedef boost::unordered_mapSCCOLROW,SCCOLROW ColRowReorderMapType;
 
+enum AreaOverlapType
+{
+AreaInside,
+AreaPartialOverlap,
+OneRowInsideArea,
+OneColumnInsideArea
+};
+
 }
 
 #endif
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 2dfc9a7..1eff597 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -446,7 +446,8 @@ void ScBroadcastAreaSlot::EraseArea( 
ScBroadcastAreas::iterator rIter )
 }
 }
 
-void ScBroadcastAreaSlot::GetAllListeners( const ScRange rRange, 
std::vectorsc::AreaListener rListeners )
+void ScBroadcastAreaSlot::GetAllListeners(
+const ScRange rRange, std::vectorsc::AreaListener rListeners, 
sc::AreaOverlapType eType )
 {
 for (ScBroadcastAreas::const_iterator aIter( aBroadcastAreaTbl.begin()),
 aIterEnd( aBroadcastAreaTbl.end()); aIter != aIterEnd; ++aIter )
@@ -456,8 +457,32 @@ void ScBroadcastAreaSlot::GetAllListeners( const ScRange 
rRange, std::vectorsc
 
 ScBroadcastArea* pArea = (*aIter).mpArea;
 const ScRange rAreaRange = pArea-GetRange();
-if (!rRange.In(rAreaRange))
-continue;
+
+switch (eType)
+{
+case sc::AreaInside:
+if (!rRange.In(rAreaRange))
+// The range needs to be fully inside specified range.
+continue;
+break;
+case sc::AreaPartialOverlap:
+if (!rRange.Intersects(rAreaRange) || rRange.In(rAreaRange))
+// The range needs to be only partially overlapping.
+continue;
+break;
+case sc::OneRowInsideArea:
+if (rAreaRange.aStart.Row() != rAreaRange.aEnd.Row() || 
!rRange.In(rAreaRange))
+// The range needs to be one single row and fully inside
+// specified range.
+continue;
+break;
+case sc::OneColumnInsideArea:
+if (rAreaRange.aStart.Col() != rAreaRange.aEnd.Col() || 
!rRange.In(rAreaRange))
+// The range needs to be one single column and fully inside
+// specified range.
+continue;
+break;
+}
 
 SvtBroadcaster::ListenersType rLst = 
pArea-GetBroadcaster().GetAllListeners();
 SvtBroadcaster::ListenersType::iterator itLst = rLst.begin(), itLstEnd 
= rLst.end();
@@ -1000,7 +1025,8 @@ void ScBroadcastAreaSlotMachine::FinallyEraseAreas( 
ScBroadcastAreaSlot* pSlot )
 maAreasToBeErased.swap( aCopy);
 }
 
-std::vectorsc::AreaListener ScBroadcastAreaSlotMachine::GetAllListeners( 
const ScRange rRange )
+std::vectorsc::AreaListener ScBroadcastAreaSlotMachine::GetAllListeners(
+const ScRange rRange, sc::AreaOverlapType eType )
 {
 std::vectorsc::AreaListener aRet;
 
@@ -1017,7 +1043,7 @@ std::vectorsc::AreaListener 
ScBroadcastAreaSlotMachine::GetAllListeners( const
 while ( nOff = nEnd )
 {
  

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

2014-08-13 Thread Kohei Yoshida
 sc/inc/column.hxx|1 
 sc/inc/table.hxx |5 
 sc/source/core/data/column.cxx   |   27 --
 sc/source/core/data/column4.cxx  |3 ++
 sc/source/core/data/documen7.cxx |   40 +--
 sc/source/core/data/table2.cxx   |7 --
 sc/source/core/data/table7.cxx   |   10 +
 7 files changed, 52 insertions(+), 41 deletions(-)

New commits:
commit 5f9e7ee1cc330f3b08596db0d13ad01e4dea7880
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Jul 30 11:02:31 2014 -0400

fdo#80501: Ensure that we notify each listener only once.

Change-Id: If2ce4643ff58c7c2ba326d749698dd5196a108dc
(cherry picked from commit b2ee0235e88dc4da715b5766295ed88f27974fbd)
Reviewed-on: https://gerrit.libreoffice.org/10647
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 8962422..66cd524 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -478,7 +478,6 @@ public:
 voidStartNeededListeners(); // only for cells where 
NeedsListening()==true
 voidSetDirtyIfPostponed();
 void BroadcastRecalcOnRefMove();
-void BroadcastRefMoved( const sc::RefMovedHint rHint );
 void TransferListeners( ScColumn rDestCol, SCROW nRow1, SCROW nRow2, 
SCROW nRowDelta );
 void CollectListeners( std::vectorSvtListener* rListeners, SCROW nRow1, 
SCROW nRow2 );
 
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 9d36a1e..191a360 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -927,10 +927,7 @@ public:
  */
 void BroadcastRecalcOnRefMove();
 
-/**
- * Broadcast all listeners of specified range that the range have moved.
- */
-void BroadcastRefMoved( const sc::RefMovedHint rHint );
+void CollectListeners( std::vectorSvtListener* rListeners, SCCOL nCol1, 
SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
 
 void TransferListeners(
 ScTable rDestTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 2d0a018..10da725 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3119,33 +3119,6 @@ void ScColumn::BroadcastRecalcOnRefMove()
 
 namespace {
 
-class BroadcastRefMovedHandler
-{
-const sc::RefMovedHint mrHint;
-public:
-BroadcastRefMovedHandler( const sc::RefMovedHint rHint ) : mrHint(rHint) 
{}
-
-void operator() ( size_t, SvtBroadcaster* p )
-{
-p-Broadcast(mrHint);
-}
-};
-
-}
-
-void ScColumn::BroadcastRefMoved( const sc::RefMovedHint rHint )
-{
-const ScRange rRange = rHint.getRange();
-SCROW nRow1 = rRange.aStart.Row();
-SCROW nRow2 = rRange.aEnd.Row();
-
-// Notify all listeners within specified rows.
-BroadcastRefMovedHandler aFunc(rHint);
-sc::ProcessBroadcaster(maBroadcasters.begin(), maBroadcasters, nRow1, 
nRow2, aFunc);
-}
-
-namespace {
-
 class TransferListenersHandler
 {
 public:
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index bf3b817..d1aacdd 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -533,6 +533,9 @@ public:
 
 void ScColumn::CollectListeners( std::vectorSvtListener* rListeners, SCROW 
nRow1, SCROW nRow2 )
 {
+if (nRow2  nRow1 || !ValidRow(nRow1) || !ValidRow(nRow2))
+return;
+
 ListenerCollector aFunc(rListeners);
 sc::ProcessBroadcaster(maBroadcasters.begin(), maBroadcasters, nRow1, 
nRow2, aFunc);
 }
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 02a75fb..a960c5a 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -130,6 +130,22 @@ void ScDocument::BroadcastCells( const ScRange rRange, 
sal_uLong nHint )
 BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED));
 }
 
+namespace {
+
+class RefMovedNotifier : std::unary_functionSvtListener*, void
+{
+const sc::RefMovedHint mrHint;
+public:
+RefMovedNotifier( const sc::RefMovedHint rHint ) : mrHint(rHint) {}
+
+void operator() ( SvtListener* p )
+{
+p-Notify(mrHint);
+}
+};
+
+}
+
 void ScDocument::BroadcastRefMoved( const sc::RefMovedHint rHint )
 {
 if (!pBASM)
@@ -150,6 +166,28 @@ void ScDocument::BroadcastRefMoved( const 
sc::RefMovedHint rHint )
 }
 }
 
+// Collect all listeners listening into the range.
+std::vectorSvtListener* aListeners;
+for (SCTAB nTab = rSrcRange.aStart.Tab(); nTab = rSrcRange.aEnd.Tab(); 
++nTab)
+{
+ScTable* pTab = FetchTable(nTab);
+if (!pTab)
+continue;
+
+pTab-CollectListeners(
+aListeners,
+rSrcRange.aStart.Col(), rSrcRange.aStart.Row(),
+rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row());
+}
+
+// Remove any duplicate listener entries.  We must ensure that we notify
+// each unique 

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

2014-07-29 Thread Kohei Yoshida
 sc/inc/column.hxx   |6 ++--
 sc/inc/document.hxx |8 +
 sc/inc/formulacell.hxx  |1 
 sc/inc/table.hxx|6 ++--
 sc/source/core/data/column2.cxx |   22 ---
 sc/source/core/data/column4.cxx |   43 +-
 sc/source/core/data/documen4.cxx|   11 ---
 sc/source/core/data/document10.cxx  |   17 ++--
 sc/source/core/data/formulacell.cxx |   51 
 sc/source/core/data/table4.cxx  |6 
 sc/source/core/data/table7.cxx  |   11 ++-
 sc/source/ui/docshell/dbdocfun.cxx  |   14 -
 sc/source/ui/docshell/docfunc.cxx   |4 +-
 sc/source/ui/docshell/docsh5.cxx|4 +-
 sc/source/ui/undo/undocell.cxx  |2 -
 sc/source/ui/undo/undodat.cxx   |8 ++---
 sc/source/ui/undo/undorangename.cxx |2 -
 sc/source/ui/unoobj/nameuno.cxx |2 -
 sc/source/ui/view/dbfunc.cxx|4 +-
 sc/source/ui/view/viewfunc.cxx  |2 -
 20 files changed, 85 insertions(+), 139 deletions(-)

New commits:
commit 155af162b260ee49e1c6603baa2c2a96d6e93b67
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Jul 28 21:34:40 2014 -0400

fdo#79578: Properly update formulas upon change in db collection.

Update it to handle formula groups correctly.

(cherry picked from commit 300845922eec7a28bc1da337acd21f138685d759)

Conflicts:
sc/source/ui/docshell/dbdocfun.cxx
sc/source/ui/docshell/docfunc.cxx
sc/source/ui/docshell/docsh5.cxx
sc/source/ui/undo/undocell.cxx
sc/source/ui/undo/undodat.cxx
sc/source/ui/unoobj/nameuno.cxx
sc/source/ui/view/viewfunc.cxx
sc/source/ui/view/dbfunc.cxx

Change-Id: I009a7fcf3d3fb17ef6951c50534ca6bc1fffc259
Reviewed-on: https://gerrit.libreoffice.org/10605
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 1cac044..8962422 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -373,9 +373,12 @@ public:
 void PreprocessRangeNameUpdate(
 sc::EndListeningContext rEndListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
-void PostprocessRangeNameUpdate(
+void CompileHybridFormula(
 sc::StartListeningContext rStartListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
+void PreprocessDBDataUpdate(
+sc::EndListeningContext rEndListenCxt, sc::CompileFormulaContext 
rCompileCxt );
+
 const SfxPoolItem*  GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
 const ScPatternAttr*GetPattern( SCROW nRow ) const;
 const ScPatternAttr*GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow 
) const;
@@ -480,7 +483,6 @@ public:
 void CollectListeners( std::vectorSvtListener* rListeners, SCROW nRow1, 
SCROW nRow2 );
 
 void CompileDBFormula( sc::CompileFormulaContext rCxt );
-void CompileDBFormula( sc::CompileFormulaContext rCxt, bool 
bCreateFormulaString );
 void CompileColRowNameFormula( sc::CompileFormulaContext rCxt );
 
 sal_Int32   GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, 
rtl_TextEncoding eCharSet ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c901af5..9d365cc 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -516,11 +516,8 @@ public:
  * Call this immediately before updating all named ranges.
  */
 SC_DLLPUBLIC void PreprocessRangeNameUpdate();
-
-/**
- * Call this immediately after all named ranges have been updated.
- */
-SC_DLLPUBLIC void PostprocessRangeNameUpdate();
+SC_DLLPUBLIC void PreprocessDBDataUpdate();
+SC_DLLPUBLIC void CompileHybridFormula();
 
 SCTAB   GetMaxTableNumber() { return 
static_castSCTAB(maTabs.size()) - 1; }
 voidSetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = 
nNumber; }
@@ -1967,7 +1964,6 @@ public:
 voidStartTrackTimer();
 
 voidCompileDBFormula();
-voidCompileDBFormula( bool bCreateFormulaString );
 voidCompileColRowNameFormula();
 
 /** Maximum string length of a column, e.g. for dBase export.
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 9c7cd10..0a43f49 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -310,7 +310,6 @@ public:
 boolIsRunning() const;
 voidSetRunning( bool bVal );
 void CompileDBFormula( sc::CompileFormulaContext rCxt );
-void CompileDBFormula( sc::CompileFormulaContext rCxt, bool 
bCreateFormulaString );
 void CompileColRowNameFormula( sc::CompileFormulaContext rCxt );
 ScFormulaCell*  GetPrevious() const;
 ScFormulaCell*  GetNext() const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index f8928de..9d36a1e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -864,9 +864,12 @@ public:
 

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

2014-07-28 Thread Kohei Yoshida
 sc/inc/table.hxx   |1 +
 sc/source/core/data/table3.cxx |8 
 sc/source/core/data/table7.cxx |8 
 3 files changed, 17 insertions(+)

New commits:
commit 290d0d779551b84dfa42e0c026ce4d7c0f00ea7a
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sun Jul 27 14:35:37 2014 -0400

fdo#81617: Split formula groups at sort range boundaries.

Otherwise, partially sorting a range may crash, or at best incorrectly
update formula references.

Change-Id: Iefcb86d205d83ccc5b684048bfd9aadabf6e13eb
(cherry picked from commit a3fc7f20089062afa4f778e70ba8be84032a30a7)
Reviewed-on: https://gerrit.libreoffice.org/10583
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 97ee720..f8928de 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -888,6 +888,7 @@ public:
 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow2 );
 formula::VectorRefArray FetchVectorRefArray( SCCOL nCol, SCROW nRow1, 
SCROW nRow2 );
 
+void SplitFormulaGroups( SCCOL nCol, std::vectorSCROW rRows );
 void UnshareFormulaCells( SCCOL nCol, std::vectorSCROW rRows );
 void RegroupFormulaCells( SCCOL nCol );
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 31cfe2e..3b63f7e 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -755,6 +755,14 @@ void ScTable::SortReorderByRow(
 ScSortInfoArray::RowsType* pRows = pArray-GetDataRows();
 assert(pRows); // In sort-by-row mode we must have data rows already 
populated.
 
+// Split formula groups at the sort range boundaries (if applicable).
+std::vectorSCROW aRowBounds;
+aRowBounds.reserve(2);
+aRowBounds.push_back(nRow1);
+aRowBounds.push_back(nRow2+1);
+for (SCCOL nCol = nCol1; nCol = nCol2; ++nCol)
+SplitFormulaGroups(nCol, aRowBounds);
+
 // Cells in the data rows only reference values in the document. Make
 // a copy before updating the document.
 
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index f3528dd..b427617 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -79,6 +79,14 @@ bool ScTable::HasUniformRowHeight( SCROW nRow1, SCROW nRow2 
) const
 return nRow2 = aData.mnRow2;
 }
 
+void ScTable::SplitFormulaGroups( SCCOL nCol, std::vectorSCROW rRows )
+{
+if (!ValidCol(nCol))
+return;
+
+sc::SharedFormulaUtil::splitFormulaCellGroups(aCol[nCol].maCells, rRows);
+}
+
 void ScTable::UnshareFormulaCells( SCCOL nCol, std::vectorSCROW rRows )
 {
 if (!ValidCol(nCol))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-07-14 Thread Eike Rathke
 sc/inc/formulacell.hxx  |2 +-
 sc/source/core/data/formulacell.cxx |4 ++--
 sc/source/core/data/table3.cxx  |3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 2d5e4e5a551ac7c2329f21327ff4c4aa8582d154
Author: Eike Rathke er...@redhat.com
Date:   Fri Jul 11 18:35:39 2014 +0200

resolved fdo#79441 keep 3D references intact during sort

Change-Id: I9e96d8e7cb99a3c280dd24495eefb9efd6d10888
(cherry picked from commit e463de2a56453a0d2cb0b5b58e96f7639f37cdd1)
Reviewed-on: https://gerrit.libreoffice.org/10240
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 326c4b8..2d25c9b 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -160,7 +160,7 @@ public:
 ~ScFormulaCell();
 
 ScFormulaCell* Clone() const;
-ScFormulaCell* Clone( const ScAddress rPos ) const;
+ScFormulaCell* Clone( const ScAddress rPos, int nCloneFlags ) const;
 
 ScFormulaCell( ScDocument* pDoc, const ScAddress rPos );
 
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index d4324a3..1397372 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -837,9 +837,9 @@ ScFormulaCell* ScFormulaCell::Clone() const
 return new ScFormulaCell(*this, *pDocument, aPos);
 }
 
-ScFormulaCell* ScFormulaCell::Clone( const ScAddress rPos ) const
+ScFormulaCell* ScFormulaCell::Clone( const ScAddress rPos, int nCloneFlags ) 
const
 {
-return new ScFormulaCell(*this, *pDocument, rPos);
+return new ScFormulaCell(*this, *pDocument, rPos, nCloneFlags);
 }
 
 size_t ScFormulaCell::GetHash() const
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 5fceab2..6a169ef 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -682,7 +682,8 @@ void ScTable::SortReorderByRow( ScSortInfoArray* pArray, 
ScProgress* pProgress )
 {
 assert(rCell.mpAttr);
 size_t n = rCellStore.size();
-sc::CellStoreType::iterator itBlk = 
rCellStore.push_back(rCell.maCell.mpFormula-Clone(aCellPos));
+sc::CellStoreType::iterator itBlk = rCellStore.push_back( 
rCell.maCell.mpFormula-Clone(
+aCellPos, SC_CLONECELL_DEFAULT | 
SC_CLONECELL_ADJUST3DREL));
 
 // Join the formula cells as we fill the container.
 size_t nOffset = n - itBlk-position;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-17 Thread Kohei Yoshida
 sc/inc/unonames.hxx  |2 +
 sc/source/ui/unoobj/chart2uno.cxx|   12 +++
 xmloff/source/chart/SchXMLExport.cxx |   38 +--
 3 files changed, 42 insertions(+), 10 deletions(-)

New commits:
commit 5b606507e4cbb2b579c90461a9d433bfe9c5cdf1
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Jun 12 11:24:30 2014 -0400

fdo#77506: More reliable way to determine label strings.

Not beautiful, but doable.

(cherry picked from commit a2a1a59a448420a858724371c4a339f75ebe8c1e)

Conflicts:
sc/source/ui/unoobj/chart2uno.cxx
xmloff/source/chart/SchXMLExport.cxx

Change-Id: I6f3b00d620e7d7d19cc05ec4239deeb14d0d5201
Reviewed-on: https://gerrit.libreoffice.org/9757
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index ff4cf93..025fed9 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -654,6 +654,8 @@
 #define SC_UNONAME_INCLUDEHIDDENCELLS   IncludeHiddenCells
 #define SC_UNONAME_HIDDENVALUES HiddenValues
 #define SC_UNONAME_USE_INTERNAL_DATA_PROVIDER UseInternalDataProvider
+#define SC_UNONAME_HAS_STRING_LABEL HasStringLabel
+#define SC_UNONAME_TIME_BASED   TimeBased
 
 // Solver
 #define SC_UNONAME_TIMEOUT  Timeout
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 093dbbe..10e47d0 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3499,6 +3499,18 @@ uno::Any SAL_CALL ScChart2DataSequence::getPropertyValue(
 BuildDataCache();
 aRet = m_aHiddenValues;
 }
+else if (rPropertyName == SC_UNONAME_HAS_STRING_LABEL)
+{
+// Read-only property.  It returns whether or not the label value is a
+// direct user input, rather than an indirect reference.
+bool bHasStringLabel = false;
+if (m_pTokens-size() == 1)
+{
+const ScToken rToken = *(*m_pTokens)[0];
+bHasStringLabel = rToken.GetType() == formula::svString;
+}
+aRet = bHasStringLabel;
+}
 else
 throw beans::UnknownPropertyException();
 // TODO: support optional properties
diff --git a/xmloff/source/chart/SchXMLExport.cxx 
b/xmloff/source/chart/SchXMLExport.cxx
index 2de23c6..1647e33 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2588,7 +2588,6 @@ void SchXMLExportHelper_Impl::exportSeries(
 
 OUString aFirstXDomainRange;
 OUString aFirstYDomainRange;
-bool modifyLabelRange = false;
 
 std::vector XMLPropertyState  aPropertyStates;
 
@@ -2734,17 +2733,36 @@ void SchXMLExportHelper_Impl::exportSeries(
 // #i75297# allow empty series, export 
empty range to have all ranges on import
 mrExport.AddAttribute( 
XML_NAMESPACE_CHART, XML_VALUES_CELL_RANGE_ADDRESS, OUString());
 
-if( xLabelSeq.is()) {
+if (xLabelSeq.is())
+{
+// Check if the label is direct string 
value rather than a reference.
+bool bHasString = false;
+uno::Referencebeans::XPropertySet 
xLSProp(xLabelSeq, uno::UNO_QUERY);
+if (xLSProp.is())
+{
+try
+{
+
xLSProp-getPropertyValue(HasStringLabel) = bHasString;
+}
+catch (const 
beans::UnknownPropertyException) {}
+}
+
 OUString aRange = 
xLabelSeq-getSourceRangeRepresentation();
-if ( nSeriesIdx == 0  
aRange.equalsAscii(label 1))
-modifyLabelRange = true;
-if (modifyLabelRange)
-aRange = label  + 
OUString::number(aRange.copy( OUString(label).getLength()).toInt32() - 1);
-mrExport.AddAttribute( 
XML_NAMESPACE_CHART, XML_LABEL_CELL_ADDRESS,
-   lcl_ConvertRange(
-   aRange,
-   xNewDoc ));
+
+if (bHasString)
+{
+mrExport.AddAttribute(
+XML_NAMESPACE_CHART, 
XML_LABEL_CELL_ADDRESS, aRange);
+

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

2014-05-23 Thread Kohei Yoshida
 sc/inc/sc.hrc  |1 
 sc/sdi/cellsh.sdi  |1 
 sc/sdi/scalc.sdi   |   25 +++-
 sc/source/ui/app/scdll.cxx |2 
 sc/source/ui/dialogs/searchresults.cxx |   68 +++--
 sc/source/ui/inc/searchresults.hxx |   34 ++--
 sc/source/ui/view/cellsh1.cxx  |   15 +++
 sc/source/ui/view/tabvwsh.cxx  |3 +
 sc/source/ui/view/viewfun2.cxx |   14 +-
 9 files changed, 144 insertions(+), 19 deletions(-)

New commits:
commit dbbbf51bcc54e99611e809d4615be1d9f110d01a
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri May 23 11:24:24 2014 -0400

fdo#79011: Properly implement the search results dialog as modeless.

It's unfortunate that adding a modeless dialog is such a pain.  But we
still need to implemenet this properly else we'll leak at best, or end
up with tons of weird bugs at worst.

(cherry picked from commit 81c492ef18b04cc283561018d69818cbca7f83ef)

Conflicts:
sc/inc/sc.hrc
sc/sdi/cellsh.sdi
sc/sdi/scalc.sdi
sc/source/ui/view/cellsh1.cxx
sc/source/ui/view/tabvwsh.cxx

Change-Id: Ie03260f288fad76f994d0ca6a8b1feeade299ffd
Reviewed-on: https://gerrit.libreoffice.org/9451
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 4c72f1c..8e517ae 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -267,6 +267,7 @@
 #define SID_COVARIANCE_DIALOG   (SC_MESSAGE_START + 75)
 #define SID_EXPONENTIAL_SMOOTHING_DIALOG(SC_MESSAGE_START + 76)
 #define SID_MOVING_AVERAGE_DIALOG   (SC_MESSAGE_START + 77)
+#define SID_SEARCH_RESULTS_DIALOG   (SC_MESSAGE_START + 78)
 
 // functions
 
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 2fe1237..41d57bc 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -158,6 +158,7 @@ interface CellSelection
 SID_COVARIANCE_DIALOG   [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
 SID_EXPONENTIAL_SMOOTHING_DIALOG[ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
 SID_MOVING_AVERAGE_DIALOG   [ ExecMethod = ExecuteEdit; 
StateMethod = GetBlockState; ]
+SID_SEARCH_RESULTS_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = 
GetBlockState; ]
 SID_MARKDATAAREA[ ExecMethod = ExecuteMove; StateMethod = 
GetStateCursor; ]
 SID_MARKARRAYFORMULA [ ExecMethod = ExecuteMove; StateMethod = 
GetStateCursor; ]
 SID_SETINPUTMODE[ ExecMethod = ExecuteMove; StateMethod = 
GetStateCursor; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index f4bba08..18e5483 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3159,7 +3159,30 @@ SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER
 GroupId = GID_OPTIONS;
 ]
 
-//--
+SfxVoidItem SearchResultsDialog SID_SEARCH_RESULTS_DIALOG
+()
+[
+/* flags: */
+AutoUpdate = FALSE,
+Cachable = Cachable,
+FastCall = FALSE,
+HasCoreId = FALSE,
+HasDialog = TRUE,
+ReadOnlyDoc = TRUE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Synchron;
+
+/* config: */
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+StatusBarConfig = FALSE,
+ToolBoxConfig = TRUE,
+GroupId = GID_OPTIONS;
+]
+
 SfxVoidItem ValidityReference SID_VALIDITY_REFERENCE
 ()
 [
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 84f5823..0cd68ff 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -73,6 +73,7 @@
 
 #include docpool.hxx
 #include appoptio.hxx
+#include searchresults.hxx
 
 // Controls
 
@@ -291,6 +292,7 @@ void ScDLL::Init()
 ScSpellDialogChildWindow::RegisterChildWindow(false, pMod);
 
 ScValidityRefChildWin::RegisterChildWindow(false, pMod);
+sc::SearchResultsDlgWrapper::RegisterChildWindow(false, pMod);
 
 //  Edit-Engine-Felder, soweit nicht schon in OfficeApplication::Init
 
diff --git a/sc/source/ui/dialogs/searchresults.cxx 
b/sc/source/ui/dialogs/searchresults.cxx
index 3b27a2a..1f8ee01 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -11,14 +11,19 @@
 
 #include svtools/simptabl.hxx
 #include svtools/treelistentry.hxx
+#include sfx2/bindings.hxx
+#include sfx2/dispatch.hxx
 #include dociter.hxx
 #include document.hxx
 #include rangeutl.hxx
 #include tabvwsh.hxx
+#include sc.hrc
 
-SearchResults::SearchResults(ScDocument *pDoc) :
-ModelessDialog(NULL, SearchResultsDialog, 
modules/scalc/ui/searchresults.ui)
-, mpDoc(pDoc)
+namespace sc {
+
+SearchResultsDlg::SearchResultsDlg( SfxBindings* _pBindings, Window* pParent, 
sal_uInt16 nId ) :
+ModelessDialog(pParent, SearchResultsDialog, 
modules/scalc/ui/searchresults.ui),
+mpBindings(_pBindings), 

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

2014-05-08 Thread Kohei Yoshida
 sc/inc/columnspanset.hxx  |8 +
 sc/source/core/data/columnspanset.cxx |   47 ++
 sc/source/ui/inc/undobase.hxx |   13 +
 sc/source/ui/inc/undoblk.hxx  |4 ++
 sc/source/ui/undo/undobase.cxx|   45 +++-
 sc/source/ui/undo/undoblk3.cxx|   12 +++-
 sc/source/ui/view/viewfunc.cxx|   32 ---
 7 files changed, 155 insertions(+), 6 deletions(-)

New commits:
commit 23e43dfd8a4b26a9adee87e5274b82a6d1d84a57
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat May 3 00:50:46 2014 -0400

fdo#78062: Broadcast only on non-empty cells within deleted range.

We don't want to broadcast over the whole selected range, which may be
the whole sheet which is well over 1 billion cells !

(cherry picked from commit af7df25bcc8bc95462e2b3bf8c003d035111a479)

Conflicts:
sc/source/ui/inc/undobase.hxx
sc/source/ui/undo/undobase.cxx

Change-Id: I7c139ce5efe09312cf824e35f0efe551184032eb
Reviewed-on: https://gerrit.libreoffice.org/9240
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 62e96a8..c12f13e 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -39,8 +39,10 @@ struct RowSpan
  */
 class ColumnSpanSet : boost::noncopyable
 {
+public:
 typedef mdds::flat_segment_treeSCROW, bool ColumnSpansType;
 
+private:
 struct ColumnType
 {
 ColumnSpansType maSpans;
@@ -81,6 +83,12 @@ public:
 void set(SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, bool bVal);
 void set(const ScRange rRange, bool bVal);
 
+/**
+ * Scan specified range in a specified sheet and mark all non-empty cells
+ * with specified boolean value.
+ */
+void scan(const ScDocument rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow2, bool bVal);
+
 void executeAction(Action ac) const;
 void executeColumnAction(ScDocument rDoc, ColumnAction ac) const;
 };
diff --git a/sc/source/core/data/columnspanset.cxx 
b/sc/source/core/data/columnspanset.cxx
index efa51b5..7bc517b 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -20,6 +20,29 @@
 
 namespace sc {
 
+namespace {
+
+class ColumnScanner
+{
+ColumnSpanSet::ColumnSpansType mrRanges;
+bool mbVal;
+public:
+ColumnScanner(ColumnSpanSet::ColumnSpansType rRanges, bool bVal) :
+mrRanges(rRanges), mbVal(bVal) {}
+
+void operator() (const sc::CellStoreType::value_type node, size_t 
nOffset, size_t nDataSize)
+{
+if (node.type == sc::element_type_empty)
+return;
+
+size_t nRow = node.position + nOffset;
+size_t nEndRow = nRow + nDataSize; // Last row of current block plus 1
+mrRanges.insert_back(nRow, nEndRow, mbVal);
+}
+};
+
+}
+
 RowSpan::RowSpan(SCROW nRow1, SCROW nRow2) : mnRow1(nRow1), mnRow2(nRow2) {}
 
 ColumnSpanSet::ColumnType::ColumnType(SCROW nStart, SCROW nEnd, bool bInit) :
@@ -94,6 +117,30 @@ void ColumnSpanSet::set(const ScRange rRange, bool bVal)
 }
 }
 
+void ColumnSpanSet::scan(
+const ScDocument rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2, bool bVal)
+{
+if (!ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2))
+return;
+
+if (nCol1  nCol2 || nRow1  nRow2)
+return;
+
+const ScTable* pTab = rDoc.FetchTable(nTab);
+if (!pTab)
+return;
+
+for (SCCOL nCol = nCol1; nCol = nCol2; ++nCol)
+{
+ColumnType rCol = getColumn(nTab, nCol);
+
+const CellStoreType rSrcCells = pTab-aCol[nCol].maCells;
+
+ColumnScanner aScanner(rCol.maSpans, bVal);
+ParseBlock(rSrcCells.begin(), rSrcCells, aScanner, nRow1, nRow2);
+}
+}
+
 void ColumnSpanSet::executeAction(Action ac) const
 {
 for (size_t nTab = 0; nTab  maDoc.size(); ++nTab)
diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 5c9df4b..fd84303 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -24,6 +24,9 @@
 #include global.hxx
 #include address.hxx
 #include docsh.hxx
+#include columnspanset.hxx
+
+#include boost/ptr_container/ptr_map.hpp
 
 class ScDocument;
 class ScDocShell;
@@ -39,6 +42,8 @@ class ScSimpleUndo: public SfxUndoAction
 
 public:
 TYPEINFO();
+typedef boost::ptr_mapSCTAB,sc::ColumnSpanSet DataSpansType;
+
 ScSimpleUndo( ScDocShell* pDocSh );
 virtual ~ScSimpleUndo();
 
@@ -59,6 +64,14 @@ protected:
 
 void BroadcastChanges( const ScRange rRange );
 
+/**
+ * Broadcast changes on specified spans.
+ *
+ * @param rSpans container that specifies all spans whose changes need to
+ *   be broadcasted.
+ */
+

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

2014-05-08 Thread Eike Rathke
 sc/inc/consoli.hxx  |7 ++---
 sc/source/core/tool/consoli.cxx |   52 ++--
 2 files changed, 22 insertions(+), 37 deletions(-)

New commits:
commit 948728a4159a8ba74ecc663373d31f1840fed9ac
Author: Eike Rathke er...@redhat.com
Date:   Fri May 9 00:11:06 2014 +0200

resolve fdo#77509 memory corruption / crash in Consolidate

Regression introduced with c81dec478ab0618f2acd2580654a93d3a7185444
memcpy some sizeof(OUString) is doomed to fail.

Change-Id: I81dc9cc7eaf02607ed05b4d284a7e5e462eeeb0a
(cherry picked from commit e891afeccba8f20f8bdaeacb20f2215cfcb1abfd)
Reviewed-on: https://gerrit.libreoffice.org/9282
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us

diff --git a/sc/inc/consoli.hxx b/sc/inc/consoli.hxx
index 9ae5060..e93ea8a 100644
--- a/sc/inc/consoli.hxx
+++ b/sc/inc/consoli.hxx
@@ -80,11 +80,10 @@ private:
 double**ppCount;
 double**ppSumSqr;
 ScReferenceList**   ppRefs;
-OUString*   mpColHeaders;
-OUString*   mpRowHeaders;
+::std::vectorOUString maColHeaders;
+::std::vectorOUString maRowHeaders;
+::std::vectorOUString maTitles;
 SCSIZE  nDataCount;
-SCSIZE  nTitleCount;
-OUString*   mpTitles;
 SCSIZE**ppTitlePos;
 sal_BoolbCornerUsed;
 OUStringaCornerText;// only for bColByName  
bRowByName
diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx
index 3dbe8f9..c2a5121 100644
--- a/sc/source/core/tool/consoli.cxx
+++ b/sc/source/core/tool/consoli.cxx
@@ -70,16 +70,9 @@ void ScReferenceList::AddEntry( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 }
 
 template typename T 
-static void lcl_AddString( OUString* pData, T nCount, const OUString 
rInsert )
+static void lcl_AddString( ::std::vectorOUString rData, T nCount, const 
OUString rInsert )
 {
-OUString* pOldData = pData;
-pData = new OUString[ nCount+1 ];
-if (pOldData)
-{
-memcpy( pData, pOldData, nCount * sizeof(OUString) );
-delete[] pOldData;
-}
-pData[nCount] = rInsert;
+rData.push_back( rInsert);
 ++nCount;
 }
 
@@ -95,11 +88,7 @@ ScConsData::ScConsData() :
 ppCount(NULL),
 ppSumSqr(NULL),
 ppRefs(NULL),
-mpColHeaders(NULL),
-mpRowHeaders(NULL),
 nDataCount(0),
-nTitleCount(0),
-mpTitles(NULL),
 ppTitlePos(NULL),
 bCornerUsed(false)
 {
@@ -140,16 +129,12 @@ void ScConsData::DeleteData()
 DELETEARR( ppSumSqr,nColCount );
 DELETEARR( ppUsed,  nColCount );// erst nach ppRefs !!!
 DELETEARR( ppTitlePos, nRowCount );
-delete[] mpColHeaders;
-mpColHeaders = NULL;
-delete[] mpRowHeaders;
-mpRowHeaders = NULL;
-delete[] mpTitles;
-mpTitles = NULL;
-nTitleCount = 0;
+::std::vectorOUString().swap( maColHeaders);
+::std::vectorOUString().swap( maRowHeaders);
+::std::vectorOUString().swap( maTitles);
 nDataCount = 0;
 
-if (bColByName) nColCount = 0;  // sonst stimmt 
mpColHeaders nicht
+if (bColByName) nColCount = 0;  // sonst stimmt 
maColHeaders nicht
 if (bRowByName) nRowCount = 0;
 
 bCornerUsed = false;
@@ -256,10 +241,10 @@ void ScConsData::AddFields( ScDocument* pSrcDoc, SCTAB 
nTab,
 {
 bool bFound = false;
 for (SCSIZE i=0; inColCount  !bFound; i++)
-if ( mpColHeaders[i] == aTitle )
+if ( maColHeaders[i] == aTitle )
 bFound = true;
 if (!bFound)
-lcl_AddString( mpColHeaders, nColCount, aTitle );
+lcl_AddString( maColHeaders, nColCount, aTitle );
 }
 }
 }
@@ -273,10 +258,10 @@ void ScConsData::AddFields( ScDocument* pSrcDoc, SCTAB 
nTab,
 {
 bool bFound = false;
 for (SCSIZE i=0; inRowCount  !bFound; i++)
-if ( mpRowHeaders[i] == aTitle )
+if ( maRowHeaders[i] == aTitle )
 bFound = true;
 if (!bFound)
-lcl_AddString( mpRowHeaders, nRowCount, aTitle );
+lcl_AddString( maRowHeaders, nRowCount, aTitle );
 }
 }
 }
@@ -289,7 +274,8 @@ void ScConsData::AddName( const OUString rName )
 
 if (bReference)
 {
-lcl_AddString( mpTitles, nTitleCount, rName );
+maTitles.push_back( rName);
+size_t nTitleCount = maTitles.size();
 
 for (nArrY=0; nArrYnRowCount; nArrY++)
 {
@@ -528,7 +514,7 @@ void ScConsData::AddData( ScDocument* pSrcDoc, SCTAB nTab,
 {
 bool bFound = false;
 for (SCSIZE i=0; inColCount  !bFound; i++)
-if ( mpColHeaders[i] == aTitle )
+  

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

2014-05-06 Thread Kohei Yoshida
 sc/inc/document.hxx  |9 +
 sc/source/core/data/document.cxx |   20 +++-
 sc/source/ui/app/transobj.cxx|2 +-
 3 files changed, 21 insertions(+), 10 deletions(-)

New commits:
commit b26b9606efa30c0a44e20dcf638fbd1e27f05089
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon May 5 15:22:15 2014 -0400

fdo#78054: Initialize drawing layer when the document contains notes.

Don't be fooled even when the document doesn't have a drawing layer
initialized.  Sometimes a note creates caption on demand later, but if
the drawing layer isn't there the caption will not get created, which
ultimately causes this crash.

(cherry picked from commit fe451fb94a33c914c0a7c1265c013d9704af850a)

Conflicts:
sc/inc/document.hxx

Change-Id: I37f4902fa84de91c9f793dc352127d9345a725e3
Reviewed-on: https://gerrit.libreoffice.org/9254
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 365cffd..339bbb0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -919,10 +919,11 @@ public:
 SC_DLLPUBLIC ScPostIt*   GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
 void SetNote(const ScAddress rPos, ScPostIt* 
pNote);
 void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, 
ScPostIt* pNote);
-bool HasNote(const ScAddress rPos);
-bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
-SC_DLLPUBLIC boolHasColNotes(SCCOL nCol, SCTAB nTab);
-SC_DLLPUBLIC boolHasTabNotes(SCTAB nTab);
+bool HasNote(const ScAddress rPos) const;
+bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) 
const;
+SC_DLLPUBLIC boolHasColNotes(SCCOL nCol, SCTAB nTab) const;
+SC_DLLPUBLIC boolHasTabNotes(SCTAB nTab) const;
+bool HasNotes() const;
 SC_DLLPUBLIC ScPostIt*   ReleaseNote(const ScAddress rPos);
 SC_DLLPUBLIC ScPostIt*   GetOrCreateNote(const ScAddress rPos);
 SC_DLLPUBLIC ScPostIt*   CreateNote(const ScAddress rPos);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bc66735..8c69412 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6109,21 +6109,21 @@ void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB 
nTab, ScPostIt* pNote)
 return maTabs[nTab]-aCol[nCol].SetCellNote(nRow, pNote);
 }
 
-bool ScDocument::HasNote(const ScAddress rPos)
+bool ScDocument::HasNote(const ScAddress rPos) const
 {
 return HasNote(rPos.Col(), rPos.Row(), rPos.Tab());
 }
-bool ScDocument::HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab)
+bool ScDocument::HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const
 {
-ScPostIt* pNote = maTabs[nTab]-aCol[nCol].GetCellNote(nRow);
+const ScPostIt* pNote = maTabs[nTab]-aCol[nCol].GetCellNote(nRow);
 return pNote != NULL;
 }
-bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab)
+bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const
 {
 return maTabs[nTab]-aCol[nCol].HasCellNotes();
 }
 
-bool ScDocument::HasTabNotes(SCTAB nTab)
+bool ScDocument::HasTabNotes(SCTAB nTab) const
 {
 bool hasNotes = false;
 for (SCCOL nCol=0; nColMAXCOLCOUNT  !hasNotes; ++nCol)
@@ -6132,6 +6132,16 @@ bool ScDocument::HasTabNotes(SCTAB nTab)
 return hasNotes;
 }
 
+bool ScDocument::HasNotes() const
+{
+for (SCTAB i = 0; i = MAXTAB; ++i)
+{
+if (HasTabNotes(i))
+return true;
+}
+return false;
+}
+
 ScPostIt* ScDocument::ReleaseNote(const ScAddress rPos)
 {
 ScTable* pTab = FetchTable(rPos.Tab());
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index b2187d5..ec6bb4a 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -643,7 +643,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
 }
 }
 
-if ( pDoc-GetDrawLayer() )
+if (pDoc-GetDrawLayer() || pDoc-HasNotes())
 pDocSh-MakeDrawLayer();
 
 //  cell range is copied to the original position, but on the first 
sheet
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-06 Thread Kohei Yoshida
 sc/inc/formulacell.hxx|2 +-
 sc/inc/formularesult.hxx  |2 +-
 sc/source/core/data/formulacell.cxx   |2 +-
 sc/source/core/tool/formularesult.cxx |2 +-
 sc/source/filter/orcus/interface.cxx  |3 ++-
 sc/source/filter/xml/xmlcelli.cxx |7 +--
 6 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit bc74773e8c5d62f4fe932366f1fae5bebbd19f65
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue May 6 18:25:56 2014 -0400

fdo#77990: Intern strings for hybrid strings during import.

Change-Id: I269497cac645e486ac08bb2b011df1b5b23dc021
(cherry picked from commit 1899bd0c3b8a16ede2de0125e762b23ba013d81f)
Reviewed-on: https://gerrit.libreoffice.org/9264
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index ff84ae4..326c4b8 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -339,7 +339,7 @@ public:
 If for whatever reason you have to use both, SetHybridDouble() and
 SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
 for performance reasons.*/
-void SetHybridString( const OUString r );
+void SetHybridString( const svl::SharedString r );
 /** For import only: set a temporary formula string to be compiled later.
 If for whatever reason you have to use both, SetHybridDouble() and
 SetHybridString() or SetHybridFormula(), use SetHybridDouble() first
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index 3708c8a..1391244 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -196,7 +196,7 @@ public:
 /** Should only be used by import filters, best in the order
 SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only
 SetHybridFormula() for formula string to be compiled later. */
-SC_DLLPUBLIC void SetHybridString( const OUString  rStr );
+SC_DLLPUBLIC void SetHybridString( const svl::SharedString  rStr );
 
 /** Should only be used by import filters, best in the order
 SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 9eccadb..3f3b18b 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2075,7 +2075,7 @@ void ScFormulaCell::SetHybridDouble( double n )
 aResult.SetHybridDouble( n);
 }
 
-void ScFormulaCell::SetHybridString( const OUString r )
+void ScFormulaCell::SetHybridString( const svl::SharedString r )
 {
 aResult.SetHybridString( r);
 }
diff --git a/sc/source/core/tool/formularesult.cxx 
b/sc/source/core/tool/formularesult.cxx
index 35d5818..0237253 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -554,7 +554,7 @@ void ScFormulaResult::SetHybridDouble( double f )
 }
 }
 
-void ScFormulaResult::SetHybridString( const OUString  rStr )
+void ScFormulaResult::SetHybridString( const svl::SharedString rStr )
 {
 // Obtain values before changing anything.
 double f = GetDouble();
diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index cd1ad91..ec4b0df 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -20,6 +20,7 @@
 
 #include formula/token.hxx
 #include tools/datetime.hxx
+#include svl/sharedstringpool.hxx
 
 #include com/sun/star/task/XStatusIndicator.hpp
 
@@ -288,7 +289,7 @@ void ScOrcusSheet::set_formula_result(os::row_t row, 
os::col_t col, const char*
 return;
 }
 OUString aResult( p, n, RTL_TEXTENCODING_UTF8);
-pCell-SetHybridString(aResult);
+
pCell-SetHybridString(mrDoc.getDoc().GetSharedStringPool().intern(aResult));
 }
 
 void ScOrcusSheet::set_shared_formula(
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index e40a527..41e6111 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -86,6 +86,7 @@
 #include editeng/langitem.hxx
 #include svx/unoapi.hxx
 #include svl/languageoptions.hxx
+#include svl/sharedstringpool.hxx
 #include svtools/miscopt.hxx
 #include sax/tools/converter.hxx
 
@@ -1021,7 +1022,8 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
 if( !IsPossibleErrorString() )
 {
-pFCell-SetHybridString( *maStringValue );
+ScDocument* pDoc = rXMLImport.GetDocument();
+
pFCell-SetHybridString(pDoc-GetSharedStringPool().intern(*maStringValue));
 pFCell-ResetDirty();
 }
 }
@@ -1062,7 +1064,8 @@ void ScXMLTableRowCellContext::PutTextCell( const 
ScAddress rCurrentPos,
 {
 if (bDoIncrement  !IsPossibleErrorString())
 {
-

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

2014-05-01 Thread Kohei Yoshida
 sc/inc/listenercontext.hxx  |7 +--
 sc/source/core/data/column.cxx  |9 +++--
 sc/source/core/data/listenercontext.cxx |9 +
 sc/source/core/tool/token.cxx   |8 ++--
 4 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit a7699355d355a1817fc16b4832f96a3a9e17d5df
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu May 1 12:16:12 2014 -0400

fdo#77806: Use the common block position set for start and end listening.

Else an invalid iterator may result, which would eventually leads to a
crash.

Change-Id: Ie909de61244d661c72a3450cc69b29fbb218a248
(cherry picked from commit 7fbe0f56192f7e106c560646d37fbb93b69b0446)
Reviewed-on: https://gerrit.libreoffice.org/9225
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/listenercontext.hxx b/sc/inc/listenercontext.hxx
index 501f1d2..c485246 100644
--- a/sc/inc/listenercontext.hxx
+++ b/sc/inc/listenercontext.hxx
@@ -15,6 +15,7 @@
 
 #include boost/noncopyable.hpp
 #include boost/scoped_ptr.hpp
+#include boost/shared_ptr.hpp
 
 class ScDocument;
 class ScTokenArray;
@@ -27,9 +28,10 @@ class ColumnBlockPositionSet;
 class StartListeningContext : boost::noncopyable
 {
 ScDocument mrDoc;
-boost::scoped_ptrColumnBlockPositionSet mpSet;
+boost::shared_ptrColumnBlockPositionSet mpSet;
 public:
 StartListeningContext(ScDocument rDoc);
+StartListeningContext(ScDocument rDoc, const 
boost::shared_ptrColumnBlockPositionSet pSet);
 ScDocument getDoc();
 
 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
@@ -39,12 +41,13 @@ class EndListeningContext : boost::noncopyable
 {
 ScDocument mrDoc;
 ColumnSpanSet maSet;
-boost::scoped_ptrColumnBlockPositionSet mpPosSet;
+boost::shared_ptrColumnBlockPositionSet mpPosSet;
 ScTokenArray* mpOldCode;
 ScAddress maPosDelta; // Add this to get the old position prior to the 
move.
 
 public:
 EndListeningContext(ScDocument rDoc, ScTokenArray* pOldCode = NULL);
+EndListeningContext(ScDocument rDoc, const 
boost::shared_ptrColumnBlockPositionSet pSet, ScTokenArray* pOldCode = NULL);
 
 void setPositionDelta( const ScAddress rDelta );
 
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 99d2626..6c3e2a9 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2239,9 +2239,14 @@ class UpdateRefOnNonCopy : 
std::unary_functionsc::FormulaGroupEntry, void
 // Perform end-listening, start-listening, and dirtying on all
 // formula cells in the group.
 
-sc::StartListeningContext aStartCxt(mpCxt-mrDoc);
+// Make sure that the start and end listening contexts share the
+// same block position set, else an invalid iterator may ensue.
+boost::shared_ptrsc::ColumnBlockPositionSet pPosSet(
+new sc::ColumnBlockPositionSet(mpCxt-mrDoc));
+
+sc::StartListeningContext aStartCxt(mpCxt-mrDoc, pPosSet);
+sc::EndListeningContext aEndCxt(mpCxt-mrDoc, pPosSet, 
pOldCode.get());
 
-sc::EndListeningContext aEndCxt(mpCxt-mrDoc, pOldCode.get());
 aEndCxt.setPositionDelta(
 ScAddress(-mpCxt-mnColDelta, -mpCxt-mnRowDelta, 
-mpCxt-mnTabDelta));
 
diff --git a/sc/source/core/data/listenercontext.cxx 
b/sc/source/core/data/listenercontext.cxx
index add75a2..dcdffac 100644
--- a/sc/source/core/data/listenercontext.cxx
+++ b/sc/source/core/data/listenercontext.cxx
@@ -16,6 +16,10 @@ namespace sc {
 StartListeningContext::StartListeningContext(ScDocument rDoc) :
 mrDoc(rDoc), mpSet(new ColumnBlockPositionSet(rDoc)) {}
 
+StartListeningContext::StartListeningContext(
+ScDocument rDoc, const boost::shared_ptrColumnBlockPositionSet pSet) :
+mrDoc(rDoc), mpSet(pSet) {}
+
 ScDocument StartListeningContext::getDoc()
 {
 return mrDoc;
@@ -30,6 +34,11 @@ EndListeningContext::EndListeningContext(ScDocument rDoc, 
ScTokenArray* pOldCod
 mrDoc(rDoc), maSet(false), mpPosSet(new ColumnBlockPositionSet(rDoc)),
 mpOldCode(pOldCode), maPosDelta(0,0,0) {}
 
+EndListeningContext::EndListeningContext(
+ScDocument rDoc, const boost::shared_ptrColumnBlockPositionSet pSet, 
ScTokenArray* pOldCode) :
+mrDoc(rDoc), maSet(false), mpPosSet(pSet),
+mpOldCode(pOldCode), maPosDelta(0,0,0) {}
+
 void EndListeningContext::setPositionDelta( const ScAddress rDelta )
 {
 maPosDelta = rDelta;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 9089a62..65ed7ad 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2799,13 +2799,17 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
 sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 const sc::RefUpdateContext rCxt, const 

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

2014-05-01 Thread Kohei Yoshida
 sc/inc/address.hxx  |   13 --
 sc/inc/column.hxx   |   20 
 sc/inc/refhint.hxx  |   20 
 sc/inc/table.hxx|1 
 sc/inc/tokenarray.hxx   |   20 
 sc/inc/types.hxx|   15 +++
 sc/source/core/data/column.cxx  |   60 -
 sc/source/core/data/column4.cxx |  129 +
 sc/source/core/data/formulacell.cxx |   24 -
 sc/source/core/data/table3.cxx  |   95 -
 sc/source/core/tool/refhint.cxx |   25 +
 sc/source/core/tool/token.cxx   |  160 +---
 12 files changed, 467 insertions(+), 115 deletions(-)

New commits:
commit 5797fd7662d09a9f0f1ee3bf06204b5c4a6397ac
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu May 1 01:15:02 2014 -0400

fdo#78079: Re-work sort by column to get it to do the right thing.

Also fixed reference update problem.

(cherry picked from commit 3c4fb52d8fc89fe43983991ed2339295b2e0ef8c)

Conflicts:
sc/inc/column.hxx

Change-Id: I06e6115ef969a011fdd5c92d5eb1927fb7ae789b
Reviewed-on: https://gerrit.libreoffice.org/9220
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 608a505..b4ab629 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -27,6 +27,7 @@
 
 #include limits
 #include scdllapi.h
+#include types.hxx
 #include formula/grammar.hxx
 
 #include com/sun/star/uno/Sequence.hxx
@@ -39,18 +40,6 @@ namespace com { namespace sun { namespace star {
 
 class ScDocument;
 
-// The typedefs
-typedef sal_Int32 SCROW;
-typedef sal_Int16 SCCOL;
-typedef sal_Int16 SCTAB;
-typedef sal_Int32 SCCOLROW; /// a type capable of holding either SCCOL or 
SCROW
-
-// temporarily signed typedefs
-typedef sal_Int32 SCsROW;
-typedef sal_Int16 SCsCOL;
-typedef sal_Int16 SCsTAB;
-typedef sal_Int32 SCsCOLROW;
-
 /** size_t typedef to be able to find places where code was changed from USHORT
 to size_t and is used to read/write from/to streams. */
 typedef size_t SCSIZE;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 53ca5cc..bfc7a54 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -182,7 +182,7 @@ public:
 
 voidDelete( SCROW nRow );
 voidFreeAll();
-voidSwapCell( SCROW nRow, ScColumn rCol);
+void Swap( ScColumn rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
 
 boolHasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
 boolHasAttribSelection( const ScMarkData rMark, sal_uInt16 nMask ) 
const;
@@ -473,6 +473,7 @@ public:
 void BroadcastRecalcOnRefMove();
 void BroadcastRefMoved( const sc::RefMovedHint rHint );
 void TransferListeners( ScColumn rDestCol, SCROW nRow1, SCROW nRow2, 
SCROW nRowDelta );
+void CollectListeners( std::vectorSvtListener* rListeners, SCROW nRow1, 
SCROW nRow2 );
 
 void CompileDBFormula( sc::CompileFormulaContext rCxt );
 void CompileDBFormula( sc::CompileFormulaContext rCxt, bool 
bCreateFormulaString );
@@ -567,6 +568,23 @@ public:
  */
 void RegroupFormulaCells();
 
+/**
+ * Reset column position of formula cells within specified row range.
+ * Reference positions are also adjusted to reflect the new position so
+ * that the formula cells still reference the same cells or ranges after
+ * the the position change.  The position of a formula cell before the
+ * call is interpreted as the old position of that cell.
+ *
+ * Caller needs to ensure that no formula groups cross the top and bottom
+ * row boundaries.
+ *
+ * @param nRow1 top row boundary
+ * @param nRow2 bottom row boundary
+ */
+void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2 );
+
+void SplitFormulaGroupByRelativeRef( const ScRange rBoundRange );
+
 #if DEBUG_COLUMN_STORAGE
 void DumpFormulaGroups() const;
 #endif
diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx
index ec56735..3ffe861 100644
--- a/sc/inc/refhint.hxx
+++ b/sc/inc/refhint.hxx
@@ -18,7 +18,7 @@ namespace sc {
 class RefHint : public SfxSimpleHint
 {
 public:
-enum Type { Moved };
+enum Type { Moved, ColumnReordered };
 
 private:
 Type meType;
@@ -55,6 +55,24 @@ public:
 const ScAddress getDelta() const;
 };
 
+class RefColReorderHint : public RefHint
+{
+const sc::ColReorderMapType mrColMap;
+SCTAB mnTab;
+SCROW mnRow1;
+SCROW mnRow2;
+
+public:
+RefColReorderHint( const sc::ColReorderMapType rColMap, SCTAB nTab, SCROW 
nRow1, SCROW nRow2 );
+virtual ~RefColReorderHint();
+
+const sc::ColReorderMapType getColMap() const;
+
+SCTAB getTab() const;
+SCROW getStartRow() const;
+SCROW getEndRow() const;
+};
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 108637b..ba7745d 

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

2014-04-27 Thread Kohei Yoshida
 sc/inc/tokenarray.hxx  |2 +
 sc/source/core/tool/token.cxx  |   46 +
 sc/source/filter/excel/excform.cxx |4 ++-
 sc/source/filter/excel/impop.cxx   |1 
 4 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit da739f729223908516deb1c2564d0713231abb5b
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Apr 25 23:21:22 2014 -0400

fdo#76611: Wrap reference addresses at max boundaries.

When importing shared formula tokens.

Change-Id: I7e1a05a78c3a93330476516e0459cffb668e3f66
(cherry picked from commit c6c286f14468d341f5fd88edc39a37175a1b6caa)
Reviewed-on: https://gerrit.libreoffice.org/9167
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index bc63154..3c7d7e8 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -205,6 +205,8 @@ public:
  */
 OUString CreateString( sc::TokenStringContext rCxt, const ScAddress rPos 
) const;
 
+void WrapReference( const ScAddress rPos, SCCOL nMaxCol, SCROW nMaxRow );
+
 #if DEBUG_FORMULA_COMPILER
 void Dump() const;
 #endif
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 320c42e..0e0f8fd 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3752,6 +3752,52 @@ OUString ScTokenArray::CreateString( 
sc::TokenStringContext rCxt, const ScAddre
 return aBuf.makeStringAndClear();
 }
 
+namespace {
+
+void wrapAddress( ScAddress rPos, SCCOL nMaxCol, SCROW nMaxRow )
+{
+if (rPos.Col()  nMaxCol)
+rPos.SetCol(rPos.Col() - nMaxCol - 1);
+if (rPos.Row()  nMaxRow)
+rPos.SetRow(rPos.Row() - nMaxRow - 1);
+}
+
+}
+
+void ScTokenArray::WrapReference( const ScAddress rPos, SCCOL nMaxCol, SCROW 
nMaxRow )
+{
+FormulaToken** p = pCode;
+FormulaToken** pEnd = p + static_castsize_t(nLen);
+for (; p != pEnd; ++p)
+{
+switch ((*p)-GetType())
+{
+case svSingleRef:
+{
+ScToken* pToken = static_castScToken*(*p);
+ScSingleRefData rRef = pToken-GetSingleRef();
+ScAddress aAbs = rRef.toAbs(rPos);
+wrapAddress(aAbs, nMaxCol, nMaxRow);
+rRef.SetAddress(aAbs, rPos);
+}
+break;
+case svDoubleRef:
+{
+ScToken* pToken = static_castScToken*(*p);
+ScComplexRefData rRef = pToken-GetDoubleRef();
+ScRange aAbs = rRef.toAbs(rPos);
+wrapAddress(aAbs.aStart, nMaxCol, nMaxRow);
+wrapAddress(aAbs.aEnd, nMaxCol, nMaxRow);
+aAbs.PutInOrder();
+rRef.SetRange(aAbs, rPos);
+}
+break;
+default:
+;
+}
+}
+}
+
 #if DEBUG_FORMULA_COMPILER
 void ScTokenArray::Dump() const
 {
diff --git a/sc/source/filter/excel/excform.cxx 
b/sc/source/filter/excel/excform.cxx
index 1f1336e..b609e28 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -128,7 +128,8 @@ void ImportExcel::Formula(
 const ScTokenArray* pSharedCode = 
pFormConv-GetSharedFormula(aRefPos);
 if (pSharedCode)
 {
-ScFormulaCell* pCell = new ScFormulaCell(pD, aScPos, 
*pSharedCode);
+ScFormulaCell* pCell = new ScFormulaCell(pD, aScPos, 
pSharedCode-Clone());
+pCell-GetCode()-WrapReference(aScPos, EXC_MAXCOL8, 
EXC_MAXROW8);
 rDoc.getDoc().EnsureTable(aScPos.Tab());
 rDoc.setFormulaCell(aScPos, pCell);
 pCell-SetNeedNumberFormat(false);
@@ -156,6 +157,7 @@ void ImportExcel::Formula(
 if (pResult)
 {
 pCell = new ScFormulaCell(rDoc.getDoc(), aScPos, *pResult);
+pCell-GetCode()-WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
 rDoc.getDoc().EnsureTable(aScPos.Tab());
 rDoc.setFormulaCell(aScPos, pCell);
 SetLastFormula(aScPos.Col(), aScPos.Row(), fCurVal, nXF, pCell);
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 913d1ba..312da25 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -882,6 +882,7 @@ void ImportExcel::Shrfmla( void )
 ScDocumentImport rDoc = GetDocImport();
 
 ScFormulaCell* pCell = new ScFormulaCell(pD, aPos, *pErgebnis);
+pCell-GetCode()-WrapReference(aPos, EXC_MAXCOL8, EXC_MAXROW8);
 rDoc.getDoc().EnsureTable(aPos.Tab());
 rDoc.setFormulaCell(aPos, pCell);
 pCell-SetNeedNumberFormat(false);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-25 Thread Kohei Yoshida
 sc/inc/column.hxx  |3 ++-
 sc/inc/table.hxx   |3 ++-
 sc/source/core/data/column4.cxx|   11 ---
 sc/source/core/data/document10.cxx |3 ++-
 sc/source/core/data/table7.cxx |5 +++--
 5 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 160bcf5357fb565b2f27f8b12e75d408f939e069
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Apr 24 21:49:45 2014 -0400

fdo#77728: Don't forget to start listening after the named range update.

Change-Id: I7a4160db0dd2b9ac2c98402bb6110c548e879b3d
(cherry picked from commit 36e0d770928f71c932db5dea9f04645f65222ea6)
Reviewed-on: https://gerrit.libreoffice.org/9156
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index d77fc18..092ec06 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -369,7 +369,8 @@ public:
 void PreprocessRangeNameUpdate(
 sc::EndListeningContext rEndListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
-void PostprocessRangeNameUpdate( sc::CompileFormulaContext rCompileCxt );
+void PostprocessRangeNameUpdate(
+sc::StartListeningContext rStartListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
 const SfxPoolItem*  GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
 const ScPatternAttr*GetPattern( SCROW nRow ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index c9b..108637b 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -856,7 +856,8 @@ public:
 void PreprocessRangeNameUpdate(
 sc::EndListeningContext rEndListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
-void PostprocessRangeNameUpdate( sc::CompileFormulaContext rCompileCxt );
+void PostprocessRangeNameUpdate(
+sc::StartListeningContext rStartListenCxt, sc::CompileFormulaContext 
rCompileCxt );
 
 ScConditionalFormatList* GetCondFormList();
 const ScConditionalFormatList* GetCondFormList() const;
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 1855278..baa00e0 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -202,11 +202,13 @@ public:
 class PostRangeNameUpdateHandler
 {
 ScDocument* mpDoc;
+sc::StartListeningContext mrStartListenCxt;
 sc::CompileFormulaContext mrCompileFormulaCxt;
 
 public:
-PostRangeNameUpdateHandler( ScDocument* pDoc, sc::CompileFormulaContext 
rCompileCxt ) :
+PostRangeNameUpdateHandler( ScDocument* pDoc, sc::StartListeningContext 
rStartListenCxt, sc::CompileFormulaContext rCompileCxt ) :
 mpDoc(pDoc),
+mrStartListenCxt(rStartListenCxt),
 mrCompileFormulaCxt(rCompileCxt) {}
 
 void operator() ( sc::FormulaGroupEntry rEntry )
@@ -234,6 +236,7 @@ public:
 {
 ScFormulaCell* p = *pp;
 p-SyncSharedCode();
+p-StartListeningTo(mrStartListenCxt);
 p-SetDirty();
 }
 }
@@ -254,6 +257,7 @@ public:
 aComp2.CompileTokenArray();
 
 pCell-SetCode(pNewCode);
+pCell-StartListeningTo(mrStartListenCxt);
 pCell-SetDirty();
 }
 }
@@ -272,12 +276,13 @@ void ScColumn::PreprocessRangeNameUpdate(
 std::for_each(aGroups.begin(), aGroups.end(), aFunc);
 }
 
-void ScColumn::PostprocessRangeNameUpdate( sc::CompileFormulaContext 
rCompileCxt )
+void ScColumn::PostprocessRangeNameUpdate(
+sc::StartListeningContext rStartListenCxt, sc::CompileFormulaContext 
rCompileCxt )
 {
 // Collect all formula groups.
 std::vectorsc::FormulaGroupEntry aGroups = GetFormulaGroupEntries();
 
-PostRangeNameUpdateHandler aFunc(pDocument, rCompileCxt);
+PostRangeNameUpdateHandler aFunc(pDocument, rStartListenCxt, rCompileCxt);
 std::for_each(aGroups.begin(), aGroups.end(), aFunc);
 }
 
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index 0c9e7ed..a4ede21 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -59,12 +59,13 @@ void ScDocument::PreprocessRangeNameUpdate()
 
 void ScDocument::PostprocessRangeNameUpdate()
 {
+sc::StartListeningContext aStartListenCxt(*this);
 sc::CompileFormulaContext aCompileCxt(this);
 TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
 for (; it != itEnd; ++it)
 {
 ScTable* p = *it;
-p-PostprocessRangeNameUpdate(aCompileCxt);
+p-PostprocessRangeNameUpdate(aStartListenCxt, aCompileCxt);
 }
 }
 
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index b5ebc12..2e6aad1 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -49,10 +49,11 @@ void ScTable::PreprocessRangeNameUpdate(
 aCol[i].PreprocessRangeNameUpdate(rEndListenCxt, 

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

2014-04-16 Thread Kohei Yoshida
 sc/inc/scopetools.hxx  |9 
 sc/source/core/tool/scopetools.cxx |   11 +
 sc/source/ui/inc/output.hxx|2 
 sc/source/ui/view/output2.cxx  |   76 -
 4 files changed, 80 insertions(+), 18 deletions(-)

New commits:
commit 4321ca5a3ca78e4a6e6c3654dbab825036bb60e3
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Apr 15 14:37:47 2014 -0400

fdo#75665: Truncate string when clipped on screen.

This improves performance of text layouting by HarfBuzz for very long 
strings.
HarfBuzz's layout algorithm appears to be more expensive than ICU's.

(cherry picked from commit 087a79db1272858f107656c5ca3c6efb45680986)
(cherry picked from commit 6fa4d31d6a7e363285f22d4c0012521d10073652)
(cherry picked from commit 8e50a6c7b1cb9481cce42c71ff07e921fb4292d0)
(cherry picked from commit 21fc47e115530780ad45ae64e8076dc5e9fedb5e)

Conflicts:
sc/inc/scopetools.hxx
sc/source/core/tool/scopetools.cxx
sc/source/ui/view/output2.cxx

Change-Id: Ic9738b7b8f0f1a29c51c83b147763118939b90ef
Reviewed-on: https://gerrit.libreoffice.org/9057
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx
index 3544b79..802aea1 100644
--- a/sc/inc/scopetools.hxx
+++ b/sc/inc/scopetools.hxx
@@ -35,6 +35,15 @@ public:
 ~ExpandRefsSwitch();
 };
 
+class SC_DLLPUBLIC IdleSwitch
+{
+ScDocument mrDoc;
+bool mbOldValue;
+public:
+IdleSwitch(ScDocument rDoc, bool bEnableIdle);
+~IdleSwitch();
+};
+
 }
 
 #endif
diff --git a/sc/source/core/tool/scopetools.cxx 
b/sc/source/core/tool/scopetools.cxx
index af65cff..6f423d0 100644
--- a/sc/source/core/tool/scopetools.cxx
+++ b/sc/source/core/tool/scopetools.cxx
@@ -34,6 +34,17 @@ ExpandRefsSwitch::~ExpandRefsSwitch()
 mrDoc.SetExpandRefs(mbOldValue);
 }
 
+IdleSwitch::IdleSwitch(ScDocument rDoc, bool bEnableIdle) :
+mrDoc(rDoc), mbOldValue(rDoc.IsIdleEnabled())
+{
+mrDoc.EnableIdle(bEnableIdle);
+}
+
+IdleSwitch::~IdleSwitch()
+{
+mrDoc.EnableIdle(mbOldValue);
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 03952a8..a34dab6 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -70,6 +70,8 @@ private:
 Rectangle   maAlignRect;
 Rectangle   maClipRect;
 longmnColWidth;
+longmnLeftClipLength; /// length of the string getting cut off 
on the left.
+longmnRightClipLength; /// length of the string getting cut 
off on the right.
 boolmbLeftClip;
 boolmbRightClip;
 };
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 544e737..75739d4 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -60,6 +60,7 @@
 #include markdata.hxx
 #include stlsheet.hxx
 #include spellcheckcontext.hxx
+#include scopetools.hxx
 
 #include com/sun/star/i18n/DirectionProperty.hpp
 #include comphelper/string.hxx
@@ -1245,8 +1246,8 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, 
long nPosX, long nPosY
 --nMergeSizeX;  // leave out the grid horizontally, also for alignment 
(align between grid lines)
 
 rParam.mnColWidth = nMergeSizeX; // store the actual column width.
+rParam.mnLeftClipLength = rParam.mnRightClipLength = 0;
 
-//
 // construct the rectangles using logical left/right values (justify is 
called at the end)
 //
 
@@ -1338,6 +1339,8 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, 
long nPosX, long nPosY
 
 rParam.mbLeftClip = ( nLeftMissing  0 );
 rParam.mbRightClip = ( nRightMissing  0 );
+rParam.mnLeftClipLength = nLeftMissing;
+rParam.mnRightClipLength = nRightMissing;
 }
 else
 {
@@ -1451,9 +1454,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
 
 vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, 
mpDev-GetExtOutDevData() );
 
-bool bWasIdleEnabled = mpDoc-IsIdleEnabled();
-mpDoc-EnableIdle(false);
-
+sc::IdleSwitch aIdleSwitch(*mpDoc, false);
 ScDrawStringsVars aVars( this, bPixelToLogic );
 
 sal_Bool bProgress = false;
@@ -1485,6 +1486,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
 // before processing the cell value.
 ::boost::ptr_vectorScPatternAttr aAltPatterns;
 
+std::vectorsal_Int32 aDX;
 long nPosY = nScrY;
 for (SCSIZE nArrY=1; nArrY+1nArrCount; nArrY++)
 {
@@ -2030,25 +2032,64 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
 //  aufgezeichnet werden (fuer nicht-proportionales 
Resize):
 
 OUString aString = aVars.GetString();
-if (bMetaFile || pFmtDevice 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc

2014-04-16 Thread Markus Mohrhard
 sc/inc/scopetools.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit cc45204a7a286cef32fc7faf266dc2da235c1ae2
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Thu Apr 17 02:19:53 2014 +0200

missing header include

Change-Id: I5bb1f1f5a457d4d390318fc793b15df078423c8c

diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx
index 802aea1..40f1dec 100644
--- a/sc/inc/scopetools.hxx
+++ b/sc/inc/scopetools.hxx
@@ -10,6 +10,8 @@
 #ifndef SC_SCOPETOOLS_HXX
 #define SC_SCOPETOOLS_HXX
 
+#include scdllapi.h
+
 class ScDocument;
 
 namespace sc {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-15 Thread Kohei Yoshida
 sc/inc/cellform.hxx|3 ++
 sc/source/core/tool/cellform.cxx   |   32 +
 sc/source/filter/xml/XMLExportIterator.cxx |3 +-
 sc/source/filter/xml/XMLExportIterator.hxx |4 ++-
 sc/source/filter/xml/xmlexprt.cxx  |9 ++--
 5 files changed, 47 insertions(+), 4 deletions(-)

New commits:
commit eec62f3d823048c9b3b767cb7de72650a40b73cd
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Apr 15 10:12:58 2014 -0400

fdo#76409: Write output cell string to text:p element when saving to ods.

The change was made by accident.

Change-Id: Ife2461b0fca6e3ea5a65d72d985d1e0976737b5a
(cherry picked from commit a0752fa4246dc71b64907c679657a1af3cb617e1)
Reviewed-on: https://gerrit.libreoffice.org/9014
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index 1f6b13a..caea246 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -54,6 +54,9 @@ public:
 static void GetInputString(
 ScRefCellValue rCell, sal_uLong nFormat, OUString rString, 
SvNumberFormatter rFormatter,
 const ScDocument* pDoc );
+
+static OUString GetOutputString(
+ScDocument rDoc, const ScAddress rPos, ScRefCellValue rCell );
 };
 
 #endif
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 6a23ba2..d96430a 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -29,6 +29,7 @@
 #include cellvalue.hxx
 #include formula/errorcodes.hxx
 #include sc.hrc
+#include editutil.hxx
 
 // STATIC DATA
 // Err527 Workaround
@@ -266,4 +267,35 @@ void ScCellFormat::GetInputString(
 rString = aString;
 }
 
+OUString ScCellFormat::GetOutputString( ScDocument rDoc, const ScAddress 
rPos, ScRefCellValue rCell )
+{
+if (rCell.isEmpty())
+return EMPTY_OUSTRING;
+
+OUString aVal;
+
+if (rCell.meType == CELLTYPE_EDIT)
+{
+//  GetString an der EditCell macht Leerzeichen aus Umbruechen,
+//  hier werden die Umbrueche aber gebraucht
+const EditTextObject* pData = rCell.mpEditText;
+if (pData)
+{
+ScFieldEditEngine rEngine = rDoc.GetEditEngine();
+rEngine.SetText(*pData);
+aVal = rEngine.GetText(LINEEND_LF);
+}
+//  Edit-Zellen auch nicht per NumberFormatter formatieren
+//  (passend zur Ausgabe)
+}
+else
+{
+//  wie in GetString am Dokument (column)
+Color* pColor;
+sal_uLong nNumFmt = rDoc.GetNumberFormat(rPos);
+aVal = GetString(rDoc, rPos, nNumFmt, pColor, *rDoc.GetFormatTable());
+}
+return aVal;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx 
b/sc/source/filter/xml/XMLExportIterator.cxx
index afc05fd..57d03c4 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -657,10 +657,11 @@ void ScMyNotEmptyCellsIterator::UpdateAddress( 
table::CellAddress rAddress )
 }
 }
 
-void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell rMyCell, 
table::CellAddress rAddress )
+void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell rMyCell, const 
table::CellAddress rAddress )
 {
 rMyCell.maBaseCell.clear();
 rMyCell.aCellAddress = rAddress;
+ScUnoConversion::FillScAddress(rMyCell.maCellAddress, 
rMyCell.aCellAddress);
 
 if( (nCellCol == rAddress.Column)  (nCellRow == rAddress.Row) )
 {
diff --git a/sc/source/filter/xml/XMLExportIterator.hxx 
b/sc/source/filter/xml/XMLExportIterator.hxx
index 857f98c..71d4b58 100644
--- a/sc/source/filter/xml/XMLExportIterator.hxx
+++ b/sc/source/filter/xml/XMLExportIterator.hxx
@@ -294,6 +294,8 @@ public:
 // contains data to export for the current cell position
 struct ScMyCell
 {
+ScAddress maCellAddress; /// Use this instead of the UNO one.
+
 com::sun::star::table::CellAddress  aCellAddress;
 com::sun::star::table::CellRangeAddress aMergeRange;
 com::sun::star::table::CellRangeAddress aMatrixRange;
@@ -355,7 +357,7 @@ class ScMyNotEmptyCellsIterator : boost::noncopyable
 SCTAB   nCurrentTable;
 
 voidUpdateAddress( 
::com::sun::star::table::CellAddress rAddress );
-voidSetCellData( ScMyCell rMyCell, 
::com::sun::star::table::CellAddress rAddress );
+void SetCellData( ScMyCell rMyCell, const css::table::CellAddress 
rAddress );
 
 voidHasAnnotation( ScMyCell aCell );
 public:
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index c2ab4b2..0f157a1 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -64,6 +64,7 @@
 #include datastream.hxx
 #include documentlinkmgr.hxx
 #include 

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

2014-04-14 Thread Kohei Yoshida
 sc/inc/document.hxx|1 +
 sc/source/core/data/documen2.cxx   |2 +-
 sc/source/core/data/document.cxx   |6 ++
 sc/source/core/data/document10.cxx |7 +++
 4 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit bb1bea8e01f899e43da4372fc4121e387d60102c
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Apr 14 11:23:23 2014 -0400

fdo#77209: Share string pool with clip documents.

We do the same with undo documents, and it will only make sense to do
the same with clip documents as well.  Also, put the sharing part into
a common method (for ease of tracking).

(cherry picked from commit 8f403051968298fbabd61de82fbb6a77762c83cc)

Conflicts:
sc/inc/document.hxx

Change-Id: I342b22d95374ee06d16318a66ffea0ac5b42621c
Reviewed-on: https://gerrit.libreoffice.org/9005
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index b4e86f3..8c8cbf1 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2123,6 +2123,7 @@ private: // CLOOK-Impl-methods
 
 std::map SCTAB, ScSortParam  mSheetSortParams;
 
+void SharePooledResources( ScDocument* pSrcDoc );
 };
 inline void ScDocument::GetSortParam( ScSortParam rParam, SCTAB nTab )
 {
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index daa4e2a..eb3eab2 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -478,7 +478,7 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
 
 Clear();
 
-xPoolHelper = pSourceDoc-xPoolHelper;
+SharePooledResources(pSourceDoc);
 
 //  bedingte Formate / Gueltigkeiten
 //! Vorlagen kopieren?
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 90128ef..bc66735 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1831,8 +1831,7 @@ void ScDocument::InitUndoSelected( ScDocument* pSrcDoc, 
const ScMarkData rTabSe
 {
 Clear();
 
-xPoolHelper = pSrcDoc-xPoolHelper;
-
+SharePooledResources(pSrcDoc);
 
 OUString aString;
 for (SCTAB nTab = 0; nTab = rTabSelection.GetLastSelected(); nTab++)
@@ -1867,8 +1866,7 @@ void ScDocument::InitUndo( ScDocument* pSrcDoc, SCTAB 
nTab1, SCTAB nTab2,
 Clear();
 
 // Undo document shares its pooled resources with the source document.
-xPoolHelper = pSrcDoc-xPoolHelper;
-mpCellStringPool = pSrcDoc-mpCellStringPool;
+SharePooledResources(pSrcDoc);
 
 if (pSrcDoc-pShell-GetMedium())
 maFileURL = 
pSrcDoc-pShell-GetMedium()-GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index ba95499..823f992 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -16,6 +16,7 @@
 #include editutil.hxx
 #include listenercontext.hxx
 #include tokenstringcontext.hxx
+#include poolhelp.hxx
 
 // Add totally brand-new methods to this source file.
 
@@ -67,4 +68,10 @@ void ScDocument::PostprocessRangeNameUpdate()
 }
 }
 
+void ScDocument::SharePooledResources( ScDocument* pSrcDoc )
+{
+xPoolHelper = pSrcDoc-xPoolHelper;
+mpCellStringPool = pSrcDoc-mpCellStringPool;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-03-26 Thread Kohei Yoshida
 sc/inc/tokenarray.hxx   |2 
 sc/source/core/data/column.cxx  |   15 +++-
 sc/source/core/data/formulacell.cxx |2 
 sc/source/core/tool/token.cxx   |  135 
 4 files changed, 108 insertions(+), 46 deletions(-)

New commits:
commit 0568f9f55b0054629e86561e96e78ecf13a8df5f
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Mar 25 22:34:18 2014 -0400

fdo#74322: Handle moving of named ranges correctly.

But named ranges are adjusted if and only if the references are absolute.

Change-Id: I6c5287b413884b045f1a798c6c6683aa17863f24
(cherry picked from commit 003a27a14d5cf65fe0b528b6d6015e37a64dbb8e)
Reviewed-on: https://gerrit.libreoffice.org/8756
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 58ff8d4..5b3e080 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -164,6 +164,8 @@ public:
  */
 sc::RefUpdateResult AdjustReferenceInName( const sc::RefUpdateContext 
rCxt, const ScAddress rPos );
 
+sc::RefUpdateResult AdjustReferenceInMovedName( const 
sc::RefUpdateContext rCxt, const ScAddress rPos );
+
 /**
  * Adjust all references on sheet deletion.
  *
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 7a448fd..518766d 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2529,8 +2529,21 @@ class UpdateRefOnNonCopy : 
std::unary_functionFormulaGroup, void
 bRecalcOnMove = aPos != aOldPos;
 
 sc::RefUpdateResult aRes = pCode-AdjustReferenceOnMove(*mpCxt, 
aOldPos, aPos);
-if (aRes.mbReferenceModified || bRecalcOnMove)
+
+if (aRes.mbReferenceModified || aRes.mbNameModified || bRecalcOnMove)
 {
+sc::AutoCalcSwitch(mpCxt-mrDoc, false);
+
+if (aRes.mbNameModified)
+{
+// We need to re-compile the token array when a range name is
+// modified, to correctly reflect the new references in the
+// name.
+ScCompiler aComp(mpCxt-mrDoc, aPos, *pCode);
+aComp.SetGrammar(mpCxt-mrDoc.GetGrammar());
+aComp.CompileTokenArray();
+}
+
 // Perform end-listening, start-listening, and dirtying on all
 // formula cells in the group.
 
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index eb40441..10c4c14 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2801,7 +2801,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
 {
 // Update cell or range references.
 sc::RefUpdateResult aRes = pCode-AdjustReferenceOnMove(rCxt, aOldPos, 
aPos);
-bRefModified = aRes.mbReferenceModified;
+bRefModified = aRes.mbReferenceModified || aRes.mbNameModified;
 bValChanged = aRes.mbValueChanged;
 }
 
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 77cc06d..5618ed38 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2634,6 +2634,19 @@ bool expandRangeByEdge( const sc::RefUpdateContext 
rCxt, ScRange rRefRange, co
 return false;
 }
 
+bool isNameModified( const sc::UpdatedRangeNames rUpdatedNames, SCTAB 
nOldTab, const formula::FormulaToken rToken )
+{
+if (rToken.GetOpCode() != ocName)
+return false;
+
+SCTAB nTab = -1;
+if (!rToken.IsGlobal())
+nTab = nOldTab;
+
+// Check if this named expression has been modified.
+return rUpdatedNames.isNameUpdated(nTab, rToken.GetIndex());
+}
+
 }
 
 sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const 
sc::RefUpdateContext rCxt, const ScAddress rOldPos )
@@ -2772,17 +2785,8 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
 break;
 case svIndex:
 {
-const formula::FormulaToken* pToken = *p;
-if (pToken-GetOpCode() == ocName)
-{
-SCTAB nTab = -1;
-if (!pToken-IsGlobal())
-nTab = rOldPos.Tab();
-
-// Check if this named expression has been modified.
-if (rCxt.maUpdatedNames.isNameUpdated(nTab, 
pToken-GetIndex()))
-aRes.mbNameModified = true;
-}
+if (isNameModified(rCxt.maUpdatedNames, rOldPos.Tab(), **p))
+aRes.mbNameModified = true;
 }
 break;
 default:
@@ -2837,6 +2841,12 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 rRef.SetRange(aAbs, rNewPos);
 }
 break;
+case svIndex:
+{
+if (isNameModified(rCxt.maUpdatedNames, 

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

2014-03-25 Thread Kohei Yoshida
 sc/inc/column.hxx|3 +
 sc/inc/document.hxx  |2 +
 sc/inc/table.hxx |2 +
 sc/source/core/data/column.cxx   |   21 +--
 sc/source/core/data/column3.cxx  |   69 +++
 sc/source/core/data/documen2.cxx |   12 ++
 sc/source/core/data/table2.cxx   |8 
 7 files changed, 113 insertions(+), 4 deletions(-)

New commits:
commit 572fdb94ecf3dfea6a6f787398efa4e4c54b4718
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Mar 22 09:47:11 2014 -0400

fdo#76470: Avoid joining new formula cells individually.

Instead, insert the formula cells in the group first, then only try to join
the top and bottom cells afterward. Otherwise the grouping would get messed
up and a problem would ensue.

(cherry picked from commit 474b2ea601f7fa2f1fbeae0f169ff5b8abc965be)

Conflicts:
sc/inc/column.hxx

Change-Id: I4fdd5326c029032a636d8225b5fb16cbde427c7d
Reviewed-on: https://gerrit.libreoffice.org/8716
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e6a69e1..33a1bf7 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -291,6 +291,8 @@ public:
 ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell );
 ScFormulaCell* SetFormulaCell( sc::ColumnBlockPosition rBlockPos, SCROW 
nRow, ScFormulaCell* pCell );
 
+bool SetFormulaCells( SCROW nRow, std::vectorScFormulaCell* rCells );
+
 svl::SharedString GetSharedString( SCROW nRow ) const;
 
 void SetRawString( SCROW nRow, const OUString rStr, bool bBroadcast = 
true );
@@ -555,6 +557,7 @@ private:
 sc::CellStoreType::iterator GetPositionToInsert( const 
sc::CellStoreType::iterator it, SCROW nRow );
 void ActivateNewFormulaCell( const sc::CellStoreType::iterator itPos, 
SCROW nRow, ScFormulaCell rCell, bool bJoin = true );
 void ActivateNewFormulaCell( const sc::CellStoreType::position_type aPos, 
ScFormulaCell rCell, bool bJoin = true );
+void AttachNewFormulaCells( const sc::CellStoreType::position_type aPos, 
size_t nLength );
 void BroadcastNewCell( SCROW nRow );
 bool UpdateScriptType( sc::CellTextAttr rAttr, SCROW nRow, 
sc::CellStoreType::iterator itr );
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 04ffa47..809689b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -839,6 +839,8 @@ public:
  */
 SC_DLLPUBLIC ScFormulaCell* SetFormulaCell( const ScAddress rPos, 
ScFormulaCell* pCell );
 
+bool SetFormulaCells( const ScAddress rPos, std::vectorScFormulaCell* 
rCells );
+
 SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
 SCCOL nCol2, SCROW nRow2,
 const ScMarkData rMark,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index eda54721..77e5996 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -345,6 +345,8 @@ public:
  */
 ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* 
pCell );
 
+bool SetFormulaCells( SCCOL nCol, SCROW nRow, std::vectorScFormulaCell* 
rCells );
+
 svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
 
 voidSetValue( SCCOL nCol, SCROW nRow, const double rVal );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 7914fdf..7a448fd 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -43,6 +43,7 @@
 #include refupdatecontext.hxx
 #include listenercontext.hxx
 #include refhint.hxx
+#include stlalgorithm.hxx
 
 #include svl/poolcach.hxx
 #include svl/zforlist.hxx
@@ -2553,21 +2554,33 @@ class UpdateRefOnNonCopy : 
std::unary_functionFormulaGroup, void
 
 void fillUndoDoc( const ScAddress rOldPos, SCROW nLength, const 
ScTokenArray rOldCode )
 {
-if (!mpUndoDoc)
+if (!mpUndoDoc || nLength = 0)
 return;
 
 // Insert the old formula group into the undo document.
 ScAddress aUndoPos = rOldPos;
 ScFormulaCell* pFC = new ScFormulaCell(mpUndoDoc, aUndoPos, 
rOldCode.Clone());
-ScFormulaCellGroupRef xGroup = pFC-CreateCellGroup(nLength, false);
 
-mpUndoDoc-SetFormulaCell(aUndoPos, pFC);
+if (nLength == 1)
+{
+mpUndoDoc-SetFormulaCell(aUndoPos, pFC);
+return;
+}
+
+std::vectorScFormulaCell* aCells;
+aCells.reserve(nLength);
+ScFormulaCellGroupRef xGroup = pFC-CreateCellGroup(nLength, false);
+aCells.push_back(pFC);
 aUndoPos.IncRow();
 for (SCROW i = 1; i  nLength; ++i, aUndoPos.IncRow())
 {
 pFC = new ScFormulaCell(mpUndoDoc, aUndoPos, xGroup);
-mpUndoDoc-SetFormulaCell(aUndoPos, pFC);
+aCells.push_back(pFC);
 }
+
+if (!mpUndoDoc-SetFormulaCells(rOldPos, aCells))

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

2014-03-20 Thread Kohei Yoshida
 sc/inc/formulacell.hxx   |4 
 sc/source/core/data/formulacell.cxx  |   10 --
 sc/source/core/opencl/formulagroupcl.cxx |5 +
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit bb75460ad23edcf23cded63e554c611bded2dd04
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Mar 20 09:54:35 2014 -0400

Disable kernel pre-compilation for now.

Change-Id: I8ba765a4d89618f301572c5fd9931f86d87af10d
(cherry picked from commit 5d4f525da7f560f85c2ce18f1ca1570d3cc53a50)
(cherry picked from commit e0d936ef7b7fd6b57cdd5ccadddcbd84bd4bb359)
Reviewed-on: https://gerrit.libreoffice.org/8680
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 8548867..2d696c3 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -34,6 +34,8 @@
 
 #include formularesult.hxx
 
+#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0
+
 namespace sc {
 
 class CLBuildKernelThread;
@@ -78,8 +80,10 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable
 ScDocument rDoc, const ScAddress rPos, 
formula::FormulaGrammar::Grammar eGram );
 void compileOpenCLKernel();
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 static int snCount;
 static rtl::Referencesc::CLBuildKernelThread sxCompilationThread;
+#endif
 };
 
 inline void intrusive_ptr_add_ref(const ScFormulaCellGroup *p)
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 395adfd..eb40441 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -55,8 +55,6 @@
 
 #include boost/scoped_ptr.hpp
 
-#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 1
-
 using namespace formula;
 
 #ifdef USE_MEMPOOL
@@ -388,6 +386,7 @@ void adjustDBRange(ScToken* pToken, ScDocument rNewDoc, 
const ScDocument* pOldD
 
 }
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 //  The mutex to synchronize access to the OpenCL compilation thread.
 static osl::Mutex getOpenCLCompilationThreadMutex()
 {
@@ -407,6 +406,7 @@ static osl::Mutex getOpenCLCompilationThreadMutex()
 
 int ScFormulaCellGroup::snCount = 0;
 rtl::Referencesc::CLBuildKernelThread 
ScFormulaCellGroup::sxCompilationThread;
+#endif
 
 ScFormulaCellGroup::ScFormulaCellGroup() :
 mnRefCount(0),
@@ -420,6 +420,7 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
 meCalcState(sc::GroupCalcEnabled),
 meKernelState(sc::OpenCLKernelNone)
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
 {
 osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
@@ -430,10 +431,12 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
 sxCompilationThread-launch();
 }
 }
+#endif
 }
 
 ScFormulaCellGroup::~ScFormulaCellGroup()
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
 {
 osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
@@ -446,17 +449,20 @@ ScFormulaCellGroup::~ScFormulaCellGroup()
 sxCompilationThread.clear();
 }
 }
+#endif
 delete mpCode;
 delete mpCompiledFormula;
 }
 
 void ScFormulaCellGroup::scheduleCompilation()
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 meKernelState = sc::OpenCLKernelCompilationScheduled;
 sc::CLBuildKernelWorkItem aWorkItem;
 aWorkItem.meWhatToDo = sc::CLBuildKernelWorkItem::COMPILE;
 aWorkItem.mxGroup = this;
 sxCompilationThread-push(aWorkItem);
+#endif
 }
 
 void ScFormulaCellGroup::setCode( const ScTokenArray rCode )
diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 0f6fb22..ec5c4bf 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3426,6 +3426,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( 
ScDocument rDoc,
 DynamicKernel *pKernel = NULL;
 boost::scoped_ptrDynamicKernel pLocalKernel;
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 if (xGroup-meKernelState == sc::OpenCLKernelCompilationScheduled ||
 xGroup-meKernelState == sc::OpenCLKernelBinaryCreated)
 {
@@ -3443,6 +3444,10 @@ bool FormulaGroupInterpreterOpenCL::interpret( 
ScDocument rDoc,
 pKernel = static_castDynamicKernel*(createCompiledFormula(rDoc, 
rTopPos, *xGroup, rCode));
 pLocalKernel.reset(pKernel); // to be deleted when done.
 }
+#else
+pKernel = static_castDynamicKernel*(createCompiledFormula(rDoc, rTopPos, 
*xGroup, rCode));
+pLocalKernel.reset(pKernel); // to be deleted when done.
+#endif
 
 if (!pKernel)
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-03-13 Thread Kohei Yoshida
 sc/inc/column.hxx|3 +-
 sc/inc/document.hxx  |8 +++--
 sc/inc/refupdatecontext.hxx  |   14 +
 sc/inc/table.hxx |3 +-
 sc/inc/tokenarray.hxx|   12 
 sc/source/core/data/column.cxx   |   18 ++--
 sc/source/core/data/documen2.cxx |7 +++-
 sc/source/core/data/documen3.cxx |8 ++---
 sc/source/core/data/document.cxx |   34 --
 sc/source/core/data/refupdatecontext.cxx |3 ++
 sc/source/core/data/table2.cxx   |9 ++
 sc/source/core/tool/token.cxx|   46 +++
 sc/source/ui/docshell/dbdocimp.cxx   |4 ++
 sc/source/ui/docshell/docsh.cxx  |   14 ++---
 sc/source/ui/docshell/docsh5.cxx |5 ++-
 sc/source/ui/undo/refundo.cxx|   10 --
 sc/source/ui/undo/undotab.cxx|8 ++---
 sc/source/ui/view/spelldialog.cxx|8 +++--
 sc/source/ui/view/viewfun4.cxx   |6 +++-
 19 files changed, 174 insertions(+), 46 deletions(-)

New commits:
commit 3da21555accb654a3185bdac5532304ac6ce5b34
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Mar 12 21:53:34 2014 -0400

fdo#75977: Clear sheet deleted flags for affected references when undoing.

This will allow formula cells to restore deleted references when they get
recalculated.  With this change, SetDirty() that previosly took no argument
has been renamed to SetAllFormulasDirty(), and it now takes one argument 
that
stores context information.

(cherry picked from commit 18909ddb30db7ca9416ee2bfb0503753e877f002)

Conflicts:
sc/inc/document.hxx
sc/source/ui/docshell/docsh5.cxx
sc/source/ui/view/spelldialog.cxx

Change-Id: If0de5dc1737a2722b6d61a87644b10a4f921edc5
Reviewed-on: https://gerrit.libreoffice.org/8564
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 07da1ca..756b4c4 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -57,6 +57,7 @@ class EditTextIterator;
 struct NoteEntry;
 class DocumentStreamAccess;
 class CompileFormulaContext;
+struct SetFormulaDirtyContext;
 
 }
 
@@ -321,7 +322,7 @@ public:
 
 bool IsFormulaDirty( SCROW nRow ) const;
 
-voidSetDirty();
+void SetAllFormulasDirty( const sc::SetFormulaDirtyContext rCxt );
 voidSetDirty( SCROW nRow1, SCROW nRow2 );
 voidSetDirtyVar();
 voidSetDirtyAfterLoad();
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ed2626a..9603ae5 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -73,6 +73,7 @@ struct NoteEntry;
 struct FormulaGroupContext;
 class DocumentStreamAccess;
 class DocumentLinkManager;
+struct SetFormulaDirtyContext;
 
 }
 
@@ -614,8 +615,9 @@ public:
 void SetTabNameOnLoad(SCTAB nTab, const OUString rName);
 void InvalidateStreamOnSave();
 
-SC_DLLPUBLIC bool   InsertTab( SCTAB nPos, const OUString rName,
-bool bExternalDocument = false );
+SC_DLLPUBLIC bool InsertTab(
+SCTAB nPos, const OUString rName, bool bExternalDocument = false, 
bool bUndoDeleteTab = false );
+
 SC_DLLPUBLIC bool   InsertTabs( SCTAB nPos, const 
std::vectorOUString rNames,
 bool bExternalDocument = false, bool 
bNamesValid = false );
 SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets );
@@ -975,7 +977,7 @@ public:
 
 voidResetChanged( const ScRange rRange );
 
-voidSetDirty();
+void SetAllFormulasDirty( const sc::SetFormulaDirtyContext rCxt );
 voidSetDirty( const ScRange );
 voidSetTableOpDirty( const ScRange );  // for Interpreter 
TableOp
 voidInterpretDirtyCells( const ScRangeList rRanges );
diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx
index c8e52d8..bd87792 100644
--- a/sc/inc/refupdatecontext.hxx
+++ b/sc/inc/refupdatecontext.hxx
@@ -130,6 +130,20 @@ struct RefUpdateMoveTabContext
 SCTAB getNewTab(SCTAB nOldTab) const;
 };
 
+struct SetFormulaDirtyContext
+{
+SCTAB mnTabDeletedStart;
+SCTAB mnTabDeletedEnd;
+
+/**
+ * When true, go through all reference tokens and clears sheet deleted
+ * flag if its corresponding index falls within specified sheet range.
+ */
+bool mbClearTabDeletedFlag;
+
+SetFormulaDirtyContext();
+};
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 4aab32e..4f30cae 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -69,6 +69,7 @@ struct RefUpdateMoveTabContext;
 struct NoteEntry;
 class DocumentStreamAccess;
 class CompileFormulaContext;
+struct SetFormulaDirtyContext;
 
 }
 
@@ -509,7 +510,7 

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

2014-03-06 Thread Kohei Yoshida
 sc/inc/formulagroup.hxx  |3 ++
 sc/source/core/data/formulacell.cxx  |   44 ---
 sc/source/core/tool/formulagroup.cxx |4 +++
 3 files changed, 23 insertions(+), 28 deletions(-)

New commits:
commit f62b4b6e45aa20b1b97d2ec0a0da5f9beb738d46
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Mar 5 18:47:07 2014 -0500

Fix incorrect group calc state check.

And the code in the else block is pretty dangerous as it passes an empty
token array to the group interpreter whose effect is entirely unpredictable.

Also, declare the destructor of CompiledFormula class to be virtual as it
serves as a base class for DynamicKernel.

Change-Id: I4e191550a4437ad6ebac55fcdeee4f3654722ff1
(cherry picked from commit 95637452609260c97d8e5aaa7500531bb458a8bc)
Reviewed-on: https://gerrit.libreoffice.org/8468
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 602c4a4..a3f1891 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -81,6 +81,9 @@ struct FormulaGroupContext : boost::noncopyable
  */
 class SC_DLLPUBLIC CompiledFormula
 {
+public:
+CompiledFormula();
+virtual ~CompiledFormula();
 };
 
 /**
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index d733525..71d55f7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3678,38 +3678,26 @@ bool ScFormulaCell::InterpretFormulaGroup()
 if (mxGroup-mbInvariant  false)
 return InterpretInvariantFormulaGroup();
 
-if (mxGroup-meCalcState == sc::GroupCalcEnabled)
-{
-ScTokenArray aCode;
-ScAddress aTopPos = aPos;
-aTopPos.SetRow(mxGroup-mpTopCell-aPos.Row());
-ScGroupTokenConverter aConverter(aCode, *pDocument, *this, 
mxGroup-mpTopCell-aPos);
-if (!aConverter.convert(*pCode))
-{
-SAL_INFO(sc.opencl, conversion of group   this   failed, 
disabling);
-mxGroup-meCalcState = sc::GroupCalcDisabled;
-return false;
-}
-mxGroup-meCalcState = sc::GroupCalcRunning;
-if (!sc::FormulaGroupInterpreter::getStatic()-interpret(*pDocument, 
mxGroup-mpTopCell-aPos, mxGroup, aCode))
-{
-SAL_INFO(sc.opencl, interpreting group   mxGroup   (state 
  mxGroup-meCalcState  ) failed, disabling);
-mxGroup-meCalcState = sc::GroupCalcDisabled;
-return false;
-}
-mxGroup-meCalcState = sc::GroupCalcEnabled;
+ScTokenArray aCode;
+ScAddress aTopPos = aPos;
+aTopPos.SetRow(mxGroup-mpTopCell-aPos.Row());
+ScGroupTokenConverter aConverter(aCode, *pDocument, *this, 
mxGroup-mpTopCell-aPos);
+if (!aConverter.convert(*pCode))
+{
+SAL_INFO(sc.opencl, conversion of group   this   failed, 
disabling);
+mxGroup-meCalcState = sc::GroupCalcDisabled;
+return false;
 }
-else
+
+mxGroup-meCalcState = sc::GroupCalcRunning;
+if (!sc::FormulaGroupInterpreter::getStatic()-interpret(*pDocument, 
mxGroup-mpTopCell-aPos, mxGroup, aCode))
 {
-ScTokenArray aDummy;
-if (!sc::FormulaGroupInterpreter::getStatic()-interpret(*pDocument, 
mxGroup-mpTopCell-aPos, mxGroup, aDummy))
-{
-SAL_INFO(sc.opencl, interpreting group   mxGroup   (state 
  mxGroup-meCalcState  ) failed, disabling);
-mxGroup-meCalcState = sc::GroupCalcDisabled;
-return false;
-}
+SAL_INFO(sc.opencl, interpreting group   mxGroup   (state  
 mxGroup-meCalcState  ) failed, disabling);
+mxGroup-meCalcState = sc::GroupCalcDisabled;
+return false;
 }
 
+mxGroup-meCalcState = sc::GroupCalcEnabled;
 return true;
 }
 
diff --git a/sc/source/core/tool/formulagroup.cxx 
b/sc/source/core/tool/formulagroup.cxx
index f58f7dc..a611298 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -277,6 +277,10 @@ void fillMatrix( ScMatrix rMat, size_t nCol, const 
double* pNums, rtl_uString**
 
 }
 
+CompiledFormula::CompiledFormula() {}
+
+CompiledFormula::~CompiledFormula() {}
+
 FormulaGroupInterpreterSoftware::FormulaGroupInterpreterSoftware() : 
FormulaGroupInterpreter()
 {
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc

2014-03-05 Thread Kohei Yoshida
 sc/inc/formulagroup.hxx |4 +-
 sc/inc/stlalgorithm.hxx |   79 
 2 files changed, 82 insertions(+), 1 deletion(-)

New commits:
commit 5e34a3236258f47374c34e5c7ab92fde9b981bb7
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Feb 26 16:29:27 2014 -0500

Ensure that numeric array storage is aligned to 256-byte boundary.

OpenCL devices require this else we would get a performance hit.

(cherry picked from commit 03f7a342011a4f69cfcbec7af3e4f1a2e835618b)
(cherry picked from commit 757856e9275d19e2c7a3673d10fa8963fb9fbeb3)

Change-Id: Ie69e07dc5d9b62abad5cc39d1f30e1d770c56758
Reviewed-on: https://gerrit.libreoffice.org/8466
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 3834e49..602c4a4 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -13,6 +13,7 @@
 #include address.hxx
 #include types.hxx
 #include platforminfo.hxx
+#include stlalgorithm.hxx
 
 #include svl/sharedstringpool.hxx
 
@@ -28,7 +29,8 @@ namespace sc {
 
 struct FormulaGroupContext : boost::noncopyable
 {
-typedef std::vectordouble NumArrayType;
+typedef AlignedAllocatordouble,256 DoubleAllocType;
+typedef std::vectordouble, DoubleAllocType NumArrayType;
 typedef std::vectorrtl_uString* StrArrayType;
 typedef boost::ptr_vectorNumArrayType NumArrayStoreType;
 typedef boost::ptr_vectorStrArrayType StrArrayStoreType;
diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx
index fb5509f..f788667 100644
--- a/sc/inc/stlalgorithm.hxx
+++ b/sc/inc/stlalgorithm.hxx
@@ -11,6 +11,10 @@
 #define __SC_STLALGORITHM_HXX__
 
 #include functional
+#include limits
+
+#include stdlib.h
+#include malloc.h
 
 /**
  * Function object to allow deleting instances stored in STL containers as
@@ -25,6 +29,81 @@ struct ScDeleteObjectByPtr : public 
::std::unary_functionT*, void
 }
 };
 
+namespace sc {
+
+/**
+ * Custom allocator for STL container to ensure that the base address of
+ * allocated storage is aligned to a specified boundary.
+ */
+templatetypename T, size_t _Alignment
+class AlignedAllocator
+{
+public:
+typedef T value_type;
+typedef size_t size_type;
+typedef std::ptrdiff_t difference_type;
+
+typedef T* pointer;
+typedef const T* const_pointer;
+typedef T* void_pointer;
+
+typedef T reference;
+typedef const T const_reference;
+
+templatetypename _Type2
+struct rebind
+{
+typedef AlignedAllocator_Type2,_Alignment other;
+};
+
+AlignedAllocator() {}
+~AlignedAllocator() {}
+
+templatetypename _Type2
+AlignedAllocator(const AlignedAllocator_Type2,_Alignment) {}
+
+void construct(T* p, const value_type val) { new(p) value_type(val); }
+void destroy(T* p) { p-~value_type(); }
+
+size_type max_size() const
+{
+return std::numeric_limitssize_type::max() / sizeof(value_type);
+}
+
+bool operator== (const AlignedAllocator) const { return true; }
+bool operator!= (const AlignedAllocator) const { return false; }
+
+pointer allocate(size_type n)
+{
+if (!n)
+return NULL;
+
+size_type size = n*sizeof(value_type);
+#ifdef WNT
+return _aligned_malloc(size, _Alignment);
+#elif defined __ANDROID__
+return memalign(align, size);
+#else
+void* ptr;
+int err = posix_memalign(ptr, _Alignment, size);
+if (err)
+ptr = NULL;
+return (pointer)ptr;
+#endif
+}
+
+void deallocate(pointer p, size_type)
+{
+#ifdef WNT
+_aligned_free(p);
+#else
+free(p);
+#endif
+}
+};
+
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc

2014-03-05 Thread Kohei Yoshida
 sc/inc/stlalgorithm.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b3bc4e283fc941c6f8c334de31fd34031afa0fef
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Mar 5 12:28:21 2014 -0500

Oopsy.

Change-Id: Ie961fca03b99ec14f401462da56dd4110ea5518c
Reviewed-on: https://gerrit.libreoffice.org/8467
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx
index f788667..d2beaa6 100644
--- a/sc/inc/stlalgorithm.hxx
+++ b/sc/inc/stlalgorithm.hxx
@@ -82,7 +82,7 @@ public:
 #ifdef WNT
 return _aligned_malloc(size, _Alignment);
 #elif defined __ANDROID__
-return memalign(align, size);
+return memalign(_Alignment, size);
 #else
 void* ptr;
 int err = posix_memalign(ptr, _Alignment, size);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc

2014-03-05 Thread Kohei Yoshida
 sc/inc/stlalgorithm.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e83598ae9e55e5f3fd21faa296f0e81df1ddca4b
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Mar 5 13:58:56 2014 -0500

Build fix on Windows.

Change-Id: Icbd46d5bc72bdc07490dd45b3d29a4400a66119f

diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx
index d2beaa6..5cc22f2 100644
--- a/sc/inc/stlalgorithm.hxx
+++ b/sc/inc/stlalgorithm.hxx
@@ -80,9 +80,9 @@ public:
 
 size_type size = n*sizeof(value_type);
 #ifdef WNT
-return _aligned_malloc(size, _Alignment);
+return (pointer)_aligned_malloc(size, _Alignment);
 #elif defined __ANDROID__
-return memalign(_Alignment, size);
+return (pointer)memalign(_Alignment, size);
 #else
 void* ptr;
 int err = posix_memalign(ptr, _Alignment, size);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc

2014-03-05 Thread Kohei Yoshida
 sc/inc/stlalgorithm.hxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 6a2d5f7f42406487ca2c77ed1c17856c5a4b47b8
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Mar 5 15:35:33 2014 -0500

Build fix for OSX.

Change-Id: I63613c40a5a947625c449fcd52ca129af116c900

diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx
index 5cc22f2..fb2b35b 100644
--- a/sc/inc/stlalgorithm.hxx
+++ b/sc/inc/stlalgorithm.hxx
@@ -14,7 +14,9 @@
 #include limits
 
 #include stdlib.h
+#if defined(WNT) || defined (__ANDROID__)
 #include malloc.h
+#endif
 
 /**
  * Function object to allow deleting instances stored in STL containers as
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-03-03 Thread Kohei Yoshida
 sc/inc/formulacell.hxx  |   22 ---
 sc/source/core/data/column.cxx  |  109 ++--
 sc/source/core/data/formulacell.cxx |6 +
 sc/source/core/tool/compiler.cxx|4 -
 sc/source/core/tool/token.cxx   |   31 ++
 5 files changed, 144 insertions(+), 28 deletions(-)

New commits:
commit cb83b334e489a4ec1cc067145c3f64b129475e7f
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Feb 28 21:25:01 2014 -0500

fdo#75053: Adjust reference update on shift for formula groups.

This is similar to my earlier fix for reference update on moving of
cells.

Change-Id: I592599507bfcab12f611eeae7b56c99da6c31919
(cherry picked from commit f32df2d590d0ee14f09664934457ba9e8de8cbe6)
Reviewed-on: https://gerrit.libreoffice.org/8403
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 7e40ddd..7361b66 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -132,14 +132,6 @@ private:
 };
 voidInterpretTail( ScInterpretTailParameter );
 
-bool UpdatePosOnShift( const sc::RefUpdateContext rCxt );
-
-/**
- * Update reference in response to cell insertion or deletion.
- */
-bool UpdateReferenceOnShift(
-const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc, const 
ScAddress* pUndoCellPos );
-
 /**
  * Update reference in response to cell copy-n-paste.
  */
@@ -213,6 +205,7 @@ public:
 void ResetDirty();
 bool NeedsListening() const;
 void SetNeedsListening( bool bVar );
+void SetNeedsDirty( bool bVar );
 void SetNeedNumberFormat( bool bVal );
 short GetFormatType() const;
 voidCompile(const OUString rFormula,
@@ -247,6 +240,19 @@ public:
 const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc = NULL, const 
ScAddress* pUndoCellPos = NULL );
 
 /**
+ * Shift the position of formula cell as part of reference update.
+ *
+ * @return true if the position has shifted, false otherwise.
+ */
+bool UpdatePosOnShift( const sc::RefUpdateContext rCxt );
+
+/**
+ * Update reference in response to cell insertion or deletion.
+ */
+bool UpdateReferenceOnShift(
+const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc, const 
ScAddress* pUndoCellPos );
+
+/**
  * Update reference in response to cell move.
  */
 bool UpdateReferenceOnMove(
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index db8cf96..e573def 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2428,6 +2428,68 @@ class UpdateRefOnNonCopy : 
std::unary_functionFormulaGroup, void
 ScDocument* mpUndoDoc;
 bool mbUpdated;
 
+void updateRefOnShift( FormulaGroup rGroup )
+{
+if (!rGroup.mbShared)
+{
+ScAddress aUndoPos(mnCol, rGroup.mnRow, mnTab);
+mbUpdated |= rGroup.mpCell-UpdateReferenceOnShift(*mpCxt, 
mpUndoDoc, aUndoPos);
+return;
+}
+
+// Update references of a formula group.
+ScFormulaCell** pp = rGroup.mpCells;
+ScFormulaCell** ppEnd = pp + rGroup.mnLength;
+ScFormulaCell* pTop = *pp;
+ScTokenArray* pCode = pTop-GetCode();
+boost::scoped_ptrScTokenArray pOldCode(pCode-Clone());
+ScAddress aOldPos = pTop-aPos;
+
+// Run this before the position gets updated.
+sc::RefUpdateResult aRes = pCode-AdjustReferenceOnShift(*mpCxt, 
aOldPos);
+
+if (pTop-UpdatePosOnShift(*mpCxt))
+{
+// Update the positions of all formula cells.
+for (++pp; pp != ppEnd; ++pp) // skip the top cell.
+{
+ScFormulaCell* pFC = *pp;
+pFC-aPos.Move(mpCxt-mnColDelta, mpCxt-mnRowDelta, 
mpCxt-mnTabDelta);
+}
+
+if (pCode-IsRecalcModeOnRefMove())
+aRes.mbValueChanged = true;
+}
+
+if (aRes.mbReferenceModified)
+{
+sc::StartListeningContext aStartCxt(mpCxt-mrDoc);
+sc::EndListeningContext aEndCxt(mpCxt-mrDoc, pOldCode.get());
+aEndCxt.setPositionDelta(
+ScAddress(-mpCxt-mnColDelta, -mpCxt-mnRowDelta, 
-mpCxt-mnTabDelta));
+
+for (pp = rGroup.mpCells; pp != ppEnd; ++pp)
+{
+ScFormulaCell* p = *pp;
+p-EndListeningTo(aEndCxt);
+p-SetNeedsListening(true);
+}
+
+mbUpdated = true;
+
+fillUndoDoc(aOldPos, rGroup.mnLength, *pOldCode);
+}
+
+if (aRes.mbValueChanged)
+{
+for (pp = rGroup.mpCells; pp != ppEnd; ++pp)
+{
+ScFormulaCell* p = *pp;
+p-SetNeedsDirty(true);
+}
+}
+}
+

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

2014-02-27 Thread Kohei Yoshida
 sc/inc/address.hxx |6 +++---
 sc/inc/compiler.hxx|   10 +-
 sc/inc/tokenuno.hxx|2 +-
 sc/source/core/tool/address.cxx|   12 ++--
 sc/source/core/tool/compiler.cxx   |   14 +-
 sc/source/filter/oox/formulabuffer.cxx |   21 ++---
 6 files changed, 34 insertions(+), 31 deletions(-)

New commits:
commit 86af0776a09fd49cbd8339350e3b699100c0142a
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Feb 24 16:02:20 2014 -0500

fdo#75304: Set external reference info to ScCompiler.

And remove this excessive const fetish which was unfortunately necessary to
get this to compile.  Setting the container const is good enough.

Change-Id: I2c6cc55a88643a68e065c4518cdf069c247f4f02
(cherry picked from commit 4917cebdb988223be47b0f1a82241ade643bc675)
Reviewed-on: https://gerrit.libreoffice.org/8212
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index f764e08..608a505 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -286,7 +286,7 @@ public:
   const Details rDetails = detailsOOOa1,
   ExternalInfo* pExtInfo = NULL,
   const ::com::sun::star::uno::Sequence
-const ::com::sun::star::sheet::ExternalLinkInfo  * 
pExternalLinks = NULL );
+com::sun::star::sheet::ExternalLinkInfo* pExternalLinks = 
NULL );
 
 SC_DLLPUBLIC OUString Format( sal_uInt16 = 0, const ScDocument* = NULL,
  const Details rDetails = detailsOOOa1) const;
@@ -450,7 +450,7 @@ public:
   const ScAddress::Details rDetails = ScAddress::detailsOOOa1,
   ScAddress::ExternalInfo* pExtInfo = NULL,
   const ::com::sun::star::uno::Sequence
-const ::com::sun::star::sheet::ExternalLinkInfo  * 
pExternalLinks = NULL );
+com::sun::star::sheet::ExternalLinkInfo* pExternalLinks = 
NULL );
 
 SC_DLLPUBLIC sal_uInt16 ParseAny( const OUString, ScDocument* = NULL,
  const ScAddress::Details rDetails = 
ScAddress::detailsOOOa1 );
@@ -483,7 +483,7 @@ public:
 OUString rExternDocName, OUString rStartTabName, OUString 
rEndTabName, sal_uInt16 nFlags,
 bool bOnlyAcceptSingle,
 const ::com::sun::star::uno::Sequence
-const ::com::sun::star::sheet::ExternalLinkInfo  * 
pExternalLinks = NULL );
+com::sun::star::sheet::ExternalLinkInfo* pExternalLinks = 
NULL );
 
 SC_DLLPUBLIC OUString Format(sal_uInt16 = 0, const ScDocument* = NULL,
  const ScAddress::Details rDetails = ScAddress::detailsOOOa1) 
const;
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 78f896e..b88ecd5 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -254,7 +254,7 @@ public:
 virtual bool parseExternalName( const OUString rSymbol, OUString 
rFile, OUString rName,
 const ScDocument* pDoc,
 const ::com::sun::star::uno::Sequence
-const ::com::sun::star::sheet::ExternalLinkInfo  * 
pExternalLinks ) const = 0;
+com::sun::star::sheet::ExternalLinkInfo* pExternalLinks ) 
const = 0;
 
 virtual OUString makeExternalNameStr( const OUString rFile, const 
OUString rName ) const = 0;
 
@@ -318,7 +318,7 @@ private:
 SvNumberFormatter* mpFormatter;
 
 // For CONV_XL_OOX, may be set via API by MOOXML filter.
-::com::sun::star::uno::Sequence const 
::com::sun::star::sheet::ExternalLinkInfo  maExternalLinks;
+com::sun::star::uno::Sequencecom::sun::star::sheet::ExternalLinkInfo 
maExternalLinks;
 
 sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol
 OUStringaFormula;   // formula source code
@@ -431,9 +431,9 @@ private:
 public:
 
 /// Set external link info for ScAddress::CONV_XL_OOX.
-inline  voidSetExternalLinks(
-const ::com::sun::star::uno::Sequence
-const ::com::sun::star::sheet::ExternalLinkInfo   rLinks )
+void SetExternalLinks(
+const ::com::sun::star::uno::Sequence
+com::sun::star::sheet::ExternalLinkInfo rLinks )
 {
 maExternalLinks = rLinks;
 }
diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx
index 4287405..408298d 100644
--- a/sc/inc/tokenuno.hxx
+++ b/sc/inc/tokenuno.hxx
@@ -56,7 +56,7 @@ class ScFormulaParserObj : public ::cppu::WeakImplHelper3
 {
 private:
 ::com::sun::star::uno::Sequence const 
::com::sun::star::sheet::FormulaOpCodeMapEntry  maOpCodeMapping;
-::com::sun::star::uno::Sequence const 
::com::sun::star::sheet::ExternalLinkInfo  maExternalLinks;
+::com::sun::star::uno::Sequencecom::sun::star::sheet::ExternalLinkInfo 
maExternalLinks;
 

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

2014-02-26 Thread Kohei Yoshida
 sc/inc/formulacell.hxx  |   12 -
 sc/inc/listenercontext.hxx  |   11 +
 sc/inc/refupdatecontext.hxx |   18 ++
 sc/source/core/data/column.cxx  |  234 +++-
 sc/source/core/data/formulacell.cxx |   17 +-
 sc/source/core/data/listenercontext.cxx |   24 +++
 sc/source/core/tool/token.cxx   |   17 +-
 sc/source/ui/inc/undoblk.hxx|5 
 sc/source/ui/undo/undoblk.cxx   |   19 +-
 9 files changed, 293 insertions(+), 64 deletions(-)

New commits:
commit df9206c4ad9227029f85caa84df358e66ecafe9d
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Feb 25 12:53:33 2014 -0500

fdo#75386: Totally fix reference update during range move.

It was just not working at all due to multiple reasons.  The
reference update needed to be reworked for formula groups such that
the token array is adjusted only for the top cell but all formula cells
still needed to be processed afterwards.  The bound check also needed
to be done against the old range prior to the move, not the new range
after the move.

During undo, the paint had to be deferred until after the two calls to
DoUndo() else the formula cells would get re-calculated before the
values were placed back to their old positions, causing them to mis-
calculate wrong values.

Change-Id: Iba66f80a413e0539cac5ab619226cd6f7a04f317
(cherry picked from commit 79d03eb090a5f88863c1004ef8b7f483cbecb69d)
Reviewed-on: https://gerrit.libreoffice.org/8352
Reviewed-by: Andras Timar andras.ti...@collabora.com
Tested-by: Andras Timar andras.ti...@collabora.com

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index e901c6e..7e40ddd 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -141,12 +141,6 @@ private:
 const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc, const 
ScAddress* pUndoCellPos );
 
 /**
- * Update reference in response to cell move.
- */
-bool UpdateReferenceOnMove(
-const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc, const 
ScAddress* pUndoCellPos );
-
-/**
  * Update reference in response to cell copy-n-paste.
  */
 bool UpdateReferenceOnCopy(
@@ -252,6 +246,12 @@ public:
 bool UpdateReference(
 const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc = NULL, const 
ScAddress* pUndoCellPos = NULL );
 
+/**
+ * Update reference in response to cell move.
+ */
+bool UpdateReferenceOnMove(
+const sc::RefUpdateContext rCxt, ScDocument* pUndoDoc, const 
ScAddress* pUndoCellPos );
+
 voidTransposeReference();
 voidUpdateTranspose( const ScRange rSource, const ScAddress 
rDest,
 ScDocument* pUndoDoc );
diff --git a/sc/inc/listenercontext.hxx b/sc/inc/listenercontext.hxx
index 1e7d067..c0260ef 100644
--- a/sc/inc/listenercontext.hxx
+++ b/sc/inc/listenercontext.hxx
@@ -17,6 +17,7 @@
 #include boost/scoped_ptr.hpp
 
 class ScDocument;
+class ScTokenArray;
 
 namespace sc {
 
@@ -39,9 +40,17 @@ class EndListeningContext : boost::noncopyable
 ScDocument mrDoc;
 ColumnSpanSet maSet;
 boost::scoped_ptrColumnBlockPositionSet mpPosSet;
+ScTokenArray* mpOldCode;
+ScAddress maPosDelta; // Add this to get the old position prior to the 
move.
+
 public:
-EndListeningContext(ScDocument rDoc);
+EndListeningContext(ScDocument rDoc, ScTokenArray* pOldCode = NULL);
+
+void setPositionDelta( const ScAddress rDelta );
+
 ScDocument getDoc();
+ScTokenArray* getOldCode();
+ScAddress getOldPosition( const ScAddress rPos ) const;
 
 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
 
diff --git a/sc/inc/refupdatecontext.hxx b/sc/inc/refupdatecontext.hxx
index ba0beed..c8e52d8 100644
--- a/sc/inc/refupdatecontext.hxx
+++ b/sc/inc/refupdatecontext.hxx
@@ -55,7 +55,8 @@ struct RefUpdateContext
 /**
  * Range of cells that are about to be moved for insert/delete/move modes.
  * For copy mode, it's the destination range of cells that are about to be
- * pasted.
+ * pasted.  When moving a range of cells, it's the destination range, not
+ * the source range.
  */
 ScRange maRange;
 
@@ -77,8 +78,23 @@ struct RefUpdateContext
 
 struct RefUpdateResult
 {
+/**
+ * When this flag is true, the result of the formula needs to be
+ * re-calculated either because it contains a reference that's been
+ * deleted, or the size of a range reference has changed.
+ */
 bool mbValueChanged;
+
+/**
+ * This flag indicates whether any reference in the token array has been
+ * modified.
+ */
 bool mbReferenceModified;
+
+/**
+ * When this flag is true, it indicates that the token array contains a
+ * range name that's been updated.
+ */
 bool mbNameModified;
 
 RefUpdateResult();
diff --git 

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

2014-02-26 Thread Kohei Yoshida
 sc/inc/document.hxx  |4 +++-
 sc/source/core/data/document.cxx |3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 4274001144adeb0b0a1e7da05d52c1bedbe899e5
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Feb 24 13:10:17 2014 -0500

fdo#75259: Let undo document share its string pool with the source doc.

We already do that for the pool helper.  It would only make sense to do
it for shared strings as well.

Change-Id: I813d262799af6f0c1d3fa12246ad973f852ac199
(cherry picked from commit e752620bf593af8839831f693ec21bb02a8b23d6)
Reviewed-on: https://gerrit.libreoffice.org/8210
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f26c3c7..ed2626a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -46,6 +46,8 @@
 #include vector
 #include boost/ptr_container/ptr_vector.hpp
 #include boost/scoped_ptr.hpp
+#include boost/shared_ptr.hpp
+
 #include markdata.hxx
 
 namespace editeng { class SvxBorderLine; }
@@ -257,7 +259,7 @@ private:
 
 rtl::ReferenceScPoolHelper xPoolHelper;
 
-boost::scoped_ptrsvl::SharedStringPool mpCellStringPool;
+boost::shared_ptrsvl::SharedStringPool mpCellStringPool;
 boost::scoped_ptrsc::FormulaGroupContext mpFormulaGroupCxt;
 mutable boost::scoped_ptrsc::DocumentLinkManager mpDocLinkMgr;
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ec2c21a..ab39965 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1852,7 +1852,10 @@ void ScDocument::InitUndo( ScDocument* pSrcDoc, SCTAB 
nTab1, SCTAB nTab2,
 {
 Clear();
 
+// Undo document shares its pooled resources with the source document.
 xPoolHelper = pSrcDoc-xPoolHelper;
+mpCellStringPool = pSrcDoc-mpCellStringPool;
+
 if (pSrcDoc-pShell-GetMedium())
 maFileURL = 
pSrcDoc-pShell-GetMedium()-GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-25 Thread Kohei Yoshida
 sc/inc/linkuno.hxx   |6 --
 sc/source/filter/xml/xmlexternaltabi.cxx |8 +++-
 sc/source/ui/unoobj/linkuno.cxx  |   26 --
 3 files changed, 27 insertions(+), 13 deletions(-)

New commits:
commit 5a13bf7bc741aeb7543b9ff736563b89c086d4fd
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Feb 25 20:40:04 2014 -0500

fdo#72041: Intern strings as we populate the external cache.

This commit covers ods import and UNO API layer.

Change-Id: I3ad1b7cfefe49575694e2351bcba6e5733b009d2
(cherry picked from commit 5706ff70dbb18d03e396fd484bd1392dbcefb6c7)
Reviewed-on: https://gerrit.libreoffice.org/8350
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/linkuno.hxx b/sc/inc/linkuno.hxx
index b5788e8..0e9e235 100644
--- a/sc/inc/linkuno.hxx
+++ b/sc/inc/linkuno.hxx
@@ -492,7 +492,7 @@ public:
 class ScExternalSheetCacheObj : public cppu::WeakImplHelper1 
::com::sun::star::sheet::XExternalSheetCache 
 {
 public:
-explicit ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef pTable, 
size_t nIndex);
+explicit ScExternalSheetCacheObj(ScDocShell* pDocShell, 
ScExternalRefCache::TableTypeRef pTable, size_t nIndex);
 ~ScExternalSheetCacheObj();
 
 // XExternalSheetCache
@@ -518,6 +518,7 @@ private:
 ScExternalSheetCacheObj(const ScExternalSheetCacheObj);
 
 private:
+ScDocShell* mpDocShell;
 ScExternalRefCache::TableTypeRef mpTable;
 size_t mnIndex;
 };
@@ -525,7 +526,7 @@ private:
 class ScExternalDocLinkObj : public cppu::WeakImplHelper1 
::com::sun::star::sheet::XExternalDocLink 
 {
 public:
-ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
+ScExternalDocLinkObj(ScDocShell* pDocShell, ScExternalRefManager* pRefMgr, 
sal_uInt16 nFileId);
 ~ScExternalDocLinkObj();
 
 // XExternalDocLink
@@ -564,6 +565,7 @@ public:
 throw (::com::sun::star::uno::RuntimeException);
 
 private:
+ScDocShell* mpDocShell;
 ScExternalRefManager*   mpRefMgr;
 sal_uInt16  mnFileId;
 };
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx 
b/sc/source/filter/xml/xmlexternaltabi.cxx
index d4ef04e..c34b622 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -24,7 +24,9 @@
 
 #include token.hxx
 #include document.hxx
+#include documentimport.hxx
 
+#include svl/sharedstringpool.hxx
 #include xmloff/nmspmap.hxx
 #include xmloff/xmlnmspe.hxx
 #include xmloff/xmltoken.hxx
@@ -376,7 +378,11 @@ void ScXMLExternalRefCellContext::EndElement()
 if (mbIsNumeric)
 aToken.reset(new formula::FormulaDoubleToken(mfCellValue));
 else
-aToken.reset(new formula::FormulaStringToken(maCellString));
+{
+ScDocument rDoc = mrScImport.GetDoc().getDoc();
+svl::SharedString aSS = 
rDoc.GetSharedStringPool().intern(maCellString);
+aToken.reset(new formula::FormulaStringToken(aSS));
+}
 
 sal_uInt32 nNumFmt = mnNumberFormat = 0 ? 
static_castsal_uInt32(mnNumberFormat) : 0;
 mrExternalRefInfo.mpCacheTable-setCell(
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 2d19a46..6f86506 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -20,6 +20,7 @@
 #include svl/smplhint.hxx
 #include sfx2/linkmgr.hxx
 #include vcl/svapp.hxx
+#include svl/sharedstringpool.hxx
 
 #include linkuno.hxx
 #include miscuno.hxx
@@ -1469,7 +1470,8 @@ uno::Reference sheet::XDDELink  
ScDDELinksObj::addDDELink(
 
 // 
 
-ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef
 pTable, size_t nIndex) :
+ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScDocShell* pDocShell, 
ScExternalRefCache::TableTypeRef pTable, size_t nIndex) :
+mpDocShell(pDocShell),
 mpTable(pTable),
 mnIndex(nIndex)
 {
@@ -1492,7 +1494,11 @@ void SAL_CALL 
ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nR
 if (rValue = fVal)
 pToken.reset(new FormulaDoubleToken(fVal));
 else if (rValue = aVal)
-pToken.reset(new FormulaStringToken(aVal));
+{
+svl::SharedStringPool rPool = 
mpDocShell-GetDocument()-GetSharedStringPool();
+svl::SharedString aSS = rPool.intern(aVal);
+pToken.reset(new FormulaStringToken(aSS));
+}
 else
 // unidentified value type.
 return;
@@ -1571,8 +1577,8 @@ sal_Int32 SAL_CALL 
ScExternalSheetCacheObj::getTokenIndex()
 
 // 
 
-ScExternalDocLinkObj::ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, 
sal_uInt16 nFileId) :
-mpRefMgr(pRefMgr), 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/Library_sc.mk sc/source

2014-02-25 Thread Kohei Yoshida
 sc/Library_sc.mk|3 
 sc/inc/clipcontext.hxx  |   40 ++-
 sc/inc/column.hxx   |6 +
 sc/inc/document.hxx |2 
 sc/inc/table.hxx|2 
 sc/source/core/data/clipcontext.cxx |   57 
 sc/source/core/data/column3.cxx |   55 
 sc/source/core/data/column4.cxx |  123 
 sc/source/core/data/document.cxx|   15 +++-
 sc/source/core/data/document10.cxx  |   44 
 sc/source/core/data/table7.cxx  |   44 
 sc/source/ui/view/viewfun3.cxx  |3 
 12 files changed, 355 insertions(+), 39 deletions(-)

New commits:
commit 166e2775d80b7e45ab258a4175d7b9e8a15a5dba
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Feb 6 14:11:43 2014 -0500

fdo#74573: Delete ranges that are non-empty before pasting from clipboard.

The conditional formatting part is still not working. But other bits
appear to be working now.

Also, adjust handling of mix document aka paste functions with this
change.  When using paste function (add, subtract, etc), the behavior
between the 'skip empty' flag on and off makes no difference.  Let's
set the flag to off when paste function is used.

(cherry picked from commit 0c12aa670b83b76241077dfb8bc21f40a55b1667)
(cherry picked from commit 2f55cee39379a76920f3a4fb14e6c2774093bfcd)
(cherry picked from commit cdc8ebf9646e773351c91039a62f2414c7b02105)

Conflicts:
sc/inc/clipcontext.hxx
sc/inc/column.hxx
sc/inc/document.hxx
sc/inc/table.hxx
sc/source/core/data/clipcontext.cxx
sc/source/core/data/column4.cxx
sc/source/core/data/document10.cxx
sc/source/core/data/table7.cxx

Change-Id: I67724ba923c9260b2c14464e4123b8445712dbaf
Reviewed-on: https://gerrit.libreoffice.org/7906
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index efdea71..58d8048 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -104,6 +104,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/column \
 sc/source/core/data/column2 \
 sc/source/core/data/column3 \
+sc/source/core/data/column4 \
 sc/source/core/data/columniterator \
 sc/source/core/data/columnset \
 sc/source/core/data/columnspanset \
@@ -123,6 +124,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/documen8 \
 sc/source/core/data/documen9 \
 sc/source/core/data/document \
+sc/source/core/data/document10 \
 sc/source/core/data/documentimport \
 sc/source/core/data/documentstreamaccess \
 sc/source/core/data/dpdimsave \
@@ -179,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/table4 \
 sc/source/core/data/table5 \
 sc/source/core/data/table6 \
+sc/source/core/data/table7 \
 sc/source/core/data/tabprotection \
 sc/source/core/data/types \
 sc/source/core/data/userdat \
diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx
index dd63ba6..dca1fed 100644
--- a/sc/inc/clipcontext.hxx
+++ b/sc/inc/clipcontext.hxx
@@ -18,6 +18,7 @@
 #include boost/scoped_ptr.hpp
 
 class ScDocument;
+class ScConditionalFormatList;
 
 namespace sc {
 
@@ -39,18 +40,34 @@ public:
 
 class CopyFromClipContext : public ClipContextBase
 {
+SCCOL mnDestCol1;
+SCCOL mnDestCol2;
+SCROW mnDestRow1;
+SCROW mnDestRow2;
 SCTAB mnTabStart;
 SCTAB mnTabEnd;
 ScDocument* mpRefUndoDoc;
 ScDocument* mpClipDoc;
-sal_uInt16  mnInsertFlag;
-boolmbAsLink:1;
-boolmbSkipAttrForEmptyCells:1;
-boolmbCloneNotes;
+sal_uInt16 mnInsertFlag;
+sal_uInt16 mnDeleteFlag;
+ScConditionalFormatList* mpCondFormatList;
+bool mbAsLink:1;
+bool mbSkipAttrForEmptyCells:1;
+bool mbCloneNotes;
+bool mbTableProtected:1;
 
 CopyFromClipContext(); // disabled
 
 public:
+
+struct Range
+{
+SCCOL mnCol1;
+SCCOL mnCol2;
+SCROW mnRow1;
+SCROW mnRow2;
+};
+
 CopyFromClipContext(ScDocument rDoc,
 ScDocument* pRefUndoDoc, ScDocument* pClipDoc, sal_uInt16 nInsertFlag,
 bool bAsLink, bool bSkipAttrForEmptyCells);
@@ -62,12 +79,25 @@ public:
 SCTAB getTabStart() const;
 SCTAB getTabEnd() const;
 
+void setDestRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
+Range getDestRange() const;
+
 ScDocument* getUndoDoc();
 ScDocument* getClipDoc();
 sal_uInt16 getInsertFlag() const;
+
+void setDeleteFlag( sal_uInt16 nFlag );
+sal_uInt16 getDeleteFlag() const;
+
+void setCondFormatList( ScConditionalFormatList* pCondFormatList );
+ScConditionalFormatList* getCondFormatList();
+
+void 

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

2014-02-19 Thread Kohei Yoshida
 sc/inc/column.hxx   |2 
 sc/inc/mtvcellfunc.hxx  |   11 +++
 sc/source/core/data/column2.cxx |  111 +---
 3 files changed, 50 insertions(+), 74 deletions(-)

New commits:
commit f0b4fe210200a3620cf05f30242771b01d991658
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Feb 17 12:20:57 2014 -0500

fdo#75032: Handle note copying correctly.

(cherry picked from commit 575e88da278f536ebfb6562dfd98f341240afec4)

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

Change-Id: Iae37ac86889d7a25f25e6dd0b69f724107c6798a
Reviewed-on: https://gerrit.libreoffice.org/8089
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index c6db640..529f84f 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -167,6 +167,8 @@ public:
 const sc::CellStoreType GetCellStore() const { return maCells; }
 sc::CellTextAttrStoreType GetCellAttrStore() { return maCellTextAttrs; }
 const sc::CellTextAttrStoreType GetCellAttrStore() const { return 
maCellTextAttrs; }
+sc::CellNoteStoreType GetCellNoteStore() { return maCellNotes; }
+const sc::CellNoteStoreType GetCellNoteStore() const { return 
maCellNotes; }
 
 ScRefCellValue GetCellValue( SCROW nRow ) const;
 ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator 
itPos, size_t nOffset ) const;
diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx
index fc6d2dc..d5e7921 100644
--- a/sc/inc/mtvcellfunc.hxx
+++ b/sc/inc/mtvcellfunc.hxx
@@ -166,6 +166,17 @@ void ProcessNote(CellNoteStoreType rStore, _Func rFunc)
 ProcessElements1CellNoteStoreType, cellnote_block, _Func, 
FuncElseNoOpsize_t (rStore, rFunc, aElse);
 }
 
+templatetypename _Func
+typename CellNoteStoreType::const_iterator
+ParseNote(
+const CellNoteStoreType::const_iterator itPos, const CellNoteStoreType 
rStore,
+SCROW nStart, SCROW nEnd, _Func rFunc)
+{
+FuncElseNoOpsize_t aElse;
+return ParseElements1CellNoteStoreType, cellnote_block, _Func, 
FuncElseNoOpsize_t (
+itPos, rStore, nStart, nEnd, rFunc, aElse);
+}
+
 templatetypename _FuncElem
 typename CellNoteStoreType::iterator
 ProcessNote(
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 1d28780..ae1a722 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1798,85 +1798,48 @@ void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, 
SCROW nRow2, ScColumn r
 }
 }
 
-void ScColumn::CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn 
rDestCol, bool bCloneCaption, SCROW nRowOffsetDest) const
-{
-SCCOL nDestCol = rDestCol.GetCol();
-SCTAB nDestTab = rDestCol.GetTab();
-
-rDestCol.maCellNotes.set_empty(nRow1 + nRowOffsetDest, nRow2 + 
nRowOffsetDest); // Empty the destination range first.
+namespace {
 
-sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), 
itBlkEnd = maCellNotes.end();
+class CopyCellNotesHandler
+{
+ScColumn mrDestCol;
+sc::CellNoteStoreType mrDestNotes;
+sc::CellNoteStoreType::iterator miPos;
+SCTAB mnSrcTab;
+SCCOL mnSrcCol;
+SCTAB mnDestTab;
+SCCOL mnDestCol;
+SCROW mnDestOffset; /// Add this to the source row position to get the 
destination row.
+bool mbCloneCaption;
 
-// Locate the top row position.
-size_t nOffsetInBlock = 0;
-size_t nBlockStart = 0, nBlockEnd = 0, nRowPos = 
static_castsize_t(nRow1);
-for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd)
-{
-nBlockEnd = nBlockStart + itBlk-size;
-if (nBlockStart = nRowPos  nRowPos  nBlockEnd)
-{
-// Found.
-nOffsetInBlock = nRowPos - nBlockStart;
-break;
-}
+public:
+CopyCellNotesHandler( const ScColumn rSrcCol, ScColumn rDestCol, SCROW 
nDestOffset, bool bCloneCaption ) :
+mrDestCol(rDestCol),
+mrDestNotes(rDestCol.GetCellNoteStore()),
+miPos(mrDestNotes.begin()),
+mnSrcTab(rSrcCol.GetTab()),
+mnSrcCol(rSrcCol.GetCol()),
+mnDestTab(rDestCol.GetTab()),
+mnDestCol(rDestCol.GetCol()),
+mnDestOffset(nDestOffset),
+mbCloneCaption(bCloneCaption) {}
+
+void operator() ( size_t nRow, const ScPostIt* p )
+{
+SCROW nDestRow = nRow + mnDestOffset;
+ScAddress aSrcPos(mnSrcCol, nRow, mnSrcTab);
+ScAddress aDestPos(mnDestCol, nDestRow, mnDestTab);
+miPos = mrDestNotes.set(miPos, nDestRow, p-Clone(aSrcPos, 
mrDestCol.GetDoc(), aDestPos, mbCloneCaption));
 }
+};
 
-if (itBlk == itBlkEnd)
-// Specified range not found. Bail out.
-return;
-
-nRowPos = static_castsize_t(nRow2); // End row position.
-
-// Keep copying until we hit the end row position.
-sc::cellnote_block::const_iterator itData, itDataEnd;
-for (; itBlk != 

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

2014-02-17 Thread Kohei Yoshida
 sc/inc/tokenstringcontext.hxx  |1 +
 sc/source/core/tool/compiler.cxx   |1 +
 sc/source/core/tool/tokenstringcontext.cxx |6 ++
 sc/source/filter/xml/xmlexprt.cxx  |   20 +---
 sc/source/filter/xml/xmlexprt.hxx  |7 +++
 5 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit fc7d5cfe5611a90beb16c15cc0a2304ef2c15acc
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Feb 15 10:12:52 2014 -0500

fdo#74512: Fix the ODS export as well.

Change-Id: I54a2b2f405f9172d2ec5646346ef4e8a7ae27cb2
(cherry picked from commit 9a5ce676ede4828db0acde5db79d91320575ec08)
Reviewed-on: https://gerrit.libreoffice.org/8074
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/tokenstringcontext.hxx b/sc/inc/tokenstringcontext.hxx
index 3740f60..aa61ada 100644
--- a/sc/inc/tokenstringcontext.hxx
+++ b/sc/inc/tokenstringcontext.hxx
@@ -56,6 +56,7 @@ class CompileFormulaContext
 
 public:
 CompileFormulaContext( ScDocument* pDoc );
+CompileFormulaContext( ScDocument* pDoc, formula::FormulaGrammar::Grammar 
eGram );
 
 formula::FormulaGrammar::Grammar getGrammar() const;
 void setGrammar( formula::FormulaGrammar::Grammar eGram );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 13b3a85..22a5035 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1628,6 +1628,7 @@ void ScCompiler::CheckTabQuotes( OUString rString,
 case FormulaGrammar::CONV_XL_A1 :
 case FormulaGrammar::CONV_XL_R1C1 :
 case FormulaGrammar::CONV_XL_OOX :
+case FormulaGrammar::CONV_ODF :
 if( bNeedsQuote )
 {
 const OUString one_quote('\'');
diff --git a/sc/source/core/tool/tokenstringcontext.cxx 
b/sc/source/core/tool/tokenstringcontext.cxx
index 203d36a..7586a31 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -114,6 +114,12 @@ CompileFormulaContext::CompileFormulaContext( ScDocument* 
pDoc ) :
 updateTabNames();
 }
 
+CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc, 
formula::FormulaGrammar::Grammar eGram ) :
+mpDoc(pDoc), meGram(eGram)
+{
+updateTabNames();
+}
+
 void CompileFormulaContext::updateTabNames()
 {
 // Fetch all sheet names.
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 62c0da4..d5c025d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -63,6 +63,7 @@
 #include arealink.hxx
 #include datastream.hxx
 #include documentlinkmgr.hxx
+#include tokenstringcontext.hxx
 
 #include xmloff/xmltoken.hxx
 #include xmloff/xmlnmspe.hxx
@@ -3175,21 +3176,26 @@ void ScXMLExport::WriteCell(ScMyCell aCell, sal_Int32 
nEqualCellCount)
 {
 if (aCell.maBaseCell.meType == CELLTYPE_FORMULA)
 {
-OUStringBuffer sFormula;
 ScFormulaCell* pFormulaCell = aCell.maBaseCell.mpFormula;
 if (!bIsMatrix || (bIsMatrix  bIsFirstMatrixCell))
 {
-const formula::FormulaGrammar::Grammar eGrammar = 
pDoc-GetStorageGrammar();
-sal_uInt16 nNamespacePrefix = (eGrammar == 
formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
-pFormulaCell-GetFormula(sFormula, eGrammar);
-OUString sOUFormula(sFormula.makeStringAndClear());
+if (!mpCompileFormulaCxt)
+{
+const formula::FormulaGrammar::Grammar eGrammar = 
pDoc-GetStorageGrammar();
+mpCompileFormulaCxt.reset(new 
sc::CompileFormulaContext(pDoc, eGrammar));
+}
+
+OUString aFormula = 
pFormulaCell-GetFormula(*mpCompileFormulaCxt);
+sal_uInt16 nNamespacePrefix =
+(mpCompileFormulaCxt-getGrammar() == 
formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
+
 if (!bIsMatrix)
 {
-AddAttribute(sAttrFormula, 
GetNamespaceMap().GetQNameByKey( nNamespacePrefix, sOUFormula, false ));
+AddAttribute(sAttrFormula, 
GetNamespaceMap().GetQNameByKey(nNamespacePrefix, aFormula, false));
 }
 else
 {
-AddAttribute(sAttrFormula, 
GetNamespaceMap().GetQNameByKey( nNamespacePrefix, sOUFormula.copy(1, 
sOUFormula.getLength() - 2), false ));
+AddAttribute(sAttrFormula, 
GetNamespaceMap().GetQNameByKey(nNamespacePrefix, aFormula.copy(1, 

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

2014-02-12 Thread Kohei Yoshida
 sc/inc/document.hxx  |5 +++--
 sc/qa/unit/ucalc_formula.cxx |   36 
 sc/source/core/data/column2.cxx  |4 ++--
 sc/source/core/data/documen7.cxx |2 +-
 sc/source/core/data/document.cxx |4 ++--
 sc/source/ui/docshell/docsh.cxx  |2 +-
 sc/source/ui/docshell/docsh3.cxx |2 +-
 sc/source/ui/view/gridwin4.cxx   |2 +-
 8 files changed, 47 insertions(+), 10 deletions(-)

New commits:
commit 3f7a491c646a14fb03172d14b421a780e73508c9
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Feb 11 13:28:47 2014 -0500

Ensure that vector array has a numeric array of NaN's for empty range.

With this change, we ensure that mpNumArray is never NULL even when the
range consists entirely of empty cells.  For an empty range, mpNumArray
will be non-NULL and filled with NaN's while mpStrArray will be NULL.

P.S. We need to backport this because without this, the existing OpenCL
code could lead to a crash during OpenCL enabled calculations.

(cherry picked from commit 2ec3127da35933fc6d5ac47ecedd0267f67c1d62)

Change-Id: If5cead26ebe917af150cf7e39e17afe3f310beb7
Reviewed-on: https://gerrit.libreoffice.org/8021
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 505746f..3ac1089 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2035,9 +2035,10 @@ public:
 formula::VectorRefArray FetchVectorRefArray( const ScAddress rPos, SCROW 
nLength );
 
 /**
- * Called whenever the value of a cell inside the document is modified.
+ * Call this before any operations that might trigger one or more formula
+ * cells to get calculated.
  */
-void CellContentModified();
+void ClearFormulaContext();
 
 SvtBroadcaster* GetBroadcaster( const ScAddress rPos );
 const SvtBroadcaster* GetBroadcaster( const ScAddress rPos ) const;
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index b07fffc..c798cbb 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -470,6 +470,42 @@ void Test::testFetchVectorRefArray()
 CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
 CPPUNIT_ASSERT_MESSAGE(Unexpected string cell., equals(aArray, 0, 5.0));
 
+// Clear everything and start over.
+clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,MAXROW,0));
+m_pDoc-ClearFormulaContext();
+
+// Totally empty range in a totally empty column (Column A).
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(0,0,0), 3); // A1:A3
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[0]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[1]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[2]));
+
+// Totally empty range in a non-empty column (Column B).
+m_pDoc-SetString(ScAddress(1,10,0), Some text); // B11
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(1,0,0), 3); // B1:B3
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[0]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[1]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[2]));
+
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(1,12,0), 3); // B13:B15
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[0]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[1]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[2]));
+
+// These values come from a cache because of the call above.
+aArray = m_pDoc-FetchVectorRefArray(ScAddress(1,1,0), 3); // B2:B4
+CPPUNIT_ASSERT_MESSAGE(Array should have a numeric array., 
aArray.mpNumericArray);
+CPPUNIT_ASSERT_MESSAGE(Array should NOT have a string array., 
!aArray.mpStringArray);
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[0]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[1]));
+CPPUNIT_ASSERT(rtl::math::isNan(aArray.mpNumericArray[2]));
+
 m_pDoc-DeleteTab(0);
 }
 
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 4f4ee06..1d28780 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2730,7 +2730,7 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( 
SCROW nRow1, SCROW nRow2
 if (pColArray)
 {
 const 

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

2014-02-11 Thread Kohei Yoshida
 sc/inc/mtvfunctions.hxx|2 +-
 sc/source/core/data/column.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 517cf1185e5e3fd4eaedf6b49ffecbd957317bbb
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Feb 10 22:34:35 2014 -0500

fdo#74209: This search algorithm had another issue. This fixes it.

When the search range was i.e. 1-3, and the match was found at 5, the old
code would return 5 when in fact it should have failed.  This change would
honor the end position and limit the search within specified search range.

Change-Id: If12a92fd3930ad128a5b0699a1addd96fb3a8eba
(cherry picked from commit 1da03a88a98b50633d61557de27e4c0702a665eb)
Reviewed-on: https://gerrit.libreoffice.org/7988
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/mtvfunctions.hxx b/sc/inc/mtvfunctions.hxx
index 6955d21..fdf79fa 100644
--- a/sc/inc/mtvfunctions.hxx
+++ b/sc/inc/mtvfunctions.hxx
@@ -618,7 +618,7 @@ FindElement2(
 break;
 default:
 {
-ElseRetType aRet = rFuncElse(*it, nOffset);
+ElseRetType aRet = rFuncElse(*it, nOffset, nDataSize);
 if (aRet.second)
 return PositionType(it, aRet.first);
 }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 487e3a0..47ef9cb 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2985,20 +2985,20 @@ public:
 return const_castScFormulaCell*(p)-IsMultilineResult();
 }
 
-std::pairsize_t,bool operator() (const sc::CellStoreType::value_type 
node, size_t nOffset)
+std::pairsize_t,bool operator() (const sc::CellStoreType::value_type 
node, size_t nOffset, size_t nDataSize)
 {
 typedef std::pairsize_t,bool RetType;
 
 if (node.type == sc::element_type_empty)
 return RetType(0, false);
 
-for (size_t i = nOffset; i  node.size; ++i)
+for (size_t i = 0; i  nDataSize; ++i)
 {
-SCROW nRow = node.position + i;
+SCROW nRow = node.position + i + nOffset;
 sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, 
nRow, nRow, miCellPos);
 if (IsAmbiguousScriptNonZero(nScriptType))
 // Return the offset from the first row.
-return RetType(i, true);
+return RetType(i+nOffset, true);
 }
 
 return RetType(0, false);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-06 Thread Kohei Yoshida
 sc/inc/column.hxx  |   17 +-
 sc/inc/compiler.hxx|   10 +
 sc/inc/formulacell.hxx |   21 ++-
 sc/inc/rangenam.hxx|   15 +-
 sc/inc/table.hxx   |   17 +-
 sc/inc/tokenstringcontext.hxx  |   19 +++
 sc/source/core/data/column.cxx |   48 
 sc/source/core/data/column2.cxx|   46 ---
 sc/source/core/data/documen2.cxx   |4 
 sc/source/core/data/documen4.cxx   |   13 +-
 sc/source/core/data/document.cxx   |   16 +-
 sc/source/core/data/formulacell.cxx|  172 +
 sc/source/core/data/table2.cxx |   20 +--
 sc/source/core/data/table4.cxx |   20 ++-
 sc/source/core/tool/compiler.cxx   |   36 ++
 sc/source/core/tool/rangenam.cxx   |   11 +
 sc/source/core/tool/tokenstringcontext.cxx |   43 +++
 17 files changed, 410 insertions(+), 118 deletions(-)

New commits:
commit 99a835ca644d69241cba9d7e4c4a315a4a3ea652
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Feb 4 10:19:47 2014 -0500

fdo#74516: Avoid excessive building of escaped sheet names.

The old code would build an array of escaped sheet names for all sheets
on evevery invokation of ScCompiler, which unfortunately slowed down these
compile all formula cells type methods, such as CompileAll(), CompileXML()
etc.  Let's avoid that and build or re-build the list only when necessary.

Conflicts:
sc/inc/column.hxx
sc/inc/table.hxx
sc/source/core/data/document.cxx
sc/source/core/tool/compiler.cxx

Change-Id: Iabf7c2374b728b6701da3aae7835cca2157f6c96
Reviewed-on: https://gerrit.libreoffice.org/7861
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 414f40d..9eef085 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -56,6 +56,7 @@ struct RefUpdateMoveTabContext;
 class EditTextIterator;
 struct NoteEntry;
 class DocumentStreamAccess;
+class CompileFormulaContext;
 
 }
 
@@ -321,11 +322,11 @@ public:
 voidSetDirtyAfterLoad();
 voidSetTableOpDirty( const ScRange );
 voidCalcAll();
-voidCalcAfterLoad();
-voidCompileAll();
-voidCompileXML( ScProgress rProgress );
+void CalcAfterLoad( sc::CompileFormulaContext rCxt );
+void CompileAll( sc::CompileFormulaContext rCxt );
+void CompileXML( sc::CompileFormulaContext rCxt, ScProgress rProgress );
 
-bool CompileErrorCells(sal_uInt16 nErrCode);
+bool CompileErrorCells( sc::CompileFormulaContext rCxt, sal_uInt16 
nErrCode );
 
 voidResetChanged( SCROW nStartRow, SCROW nEndRow );
 
@@ -449,10 +450,10 @@ public:
 voidSetDirtyIfPostponed();
 void BroadcastRecalcOnRefMove();
 
-voidCompileDBFormula();
-voidCompileDBFormula( bool bCreateFormulaString );
-voidCompileNameFormula( bool bCreateFormulaString );
-voidCompileColRowNameFormula();
+void CompileDBFormula( sc::CompileFormulaContext rCxt );
+void CompileDBFormula( sc::CompileFormulaContext rCxt, bool 
bCreateFormulaString );
+void CompileNameFormula( sc::CompileFormulaContext rCxt, bool 
bCreateFormulaString );
+void CompileColRowNameFormula( sc::CompileFormulaContext rCxt );
 
 sal_Int32   GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, 
rtl_TextEncoding eCharSet ) const;
 xub_StrLen  GetMaxNumberStringLen( sal_uInt16 nPrecision,
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index a8757e7..78f896e 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -78,6 +78,12 @@ class ScRangeData;
 class ScExternalRefManager;
 class ScTokenArray;
 
+namespace sc {
+
+class CompileFormulaContext;
+
+}
+
 // constants and data types internal to compiler
 
 /*
@@ -362,8 +368,12 @@ private:
 static void InitCharClassEnglish();
 
 public:
+ScCompiler( sc::CompileFormulaContext rCxt, const ScAddress rPos );
+
 ScCompiler( ScDocument* pDocument, const ScAddress);
 
+ScCompiler( sc::CompileFormulaContext rCxt, const ScAddress rPos, 
ScTokenArray rArr );
+
 ScCompiler( ScDocument* pDocument, const ScAddress,ScTokenArray rArr);
 
 virtual ~ScCompiler();
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 68c620c..e901c6e 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -44,6 +44,7 @@ struct RefUpdateContext;
 struct RefUpdateInsertTabContext;
 struct RefUpdateDeleteTabContext;
 struct RefUpdateMoveTabContext;
+class CompileFormulaContext;
 
 }
 
@@ -205,6 +206,8 @@ public:
 voidGetFormula( OUStringBuffer rBuffer,
 const formula::FormulaGrammar::Grammar = 
formula::FormulaGrammar::GRAM_DEFAULT ) const;

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

2014-02-06 Thread Kohei Yoshida
 sc/inc/mtvfunctions.hxx|2 +-
 sc/source/core/data/column.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 25cb5355ce259c29d481eb9c76a4fab53d03e4cb
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Feb 3 14:42:30 2014 -0500

fdo#72470: Correctly calculate the first edit cell row position.

Else it could go into an infinite loop.

Change-Id: I269cd118dcb3ab83ea8a2243576a360d3d4bc142
(cherry picked from commit 3e2ffb053f9749c6f6990c5ce8f47dc63ea7c148)
Reviewed-on: https://gerrit.libreoffice.org/7831
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/mtvfunctions.hxx b/sc/inc/mtvfunctions.hxx
index 3c2a940..6955d21 100644
--- a/sc/inc/mtvfunctions.hxx
+++ b/sc/inc/mtvfunctions.hxx
@@ -618,7 +618,7 @@ FindElement2(
 break;
 default:
 {
-ElseRetType aRet = rFuncElse(it-type, nTopRow, nDataSize);
+ElseRetType aRet = rFuncElse(*it, nOffset);
 if (aRet.second)
 return PositionType(it, aRet.first);
 }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 0b10328..e358588 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2966,16 +2966,16 @@ public:
 return const_castScFormulaCell*(p)-IsMultilineResult();
 }
 
-std::pairsize_t,bool operator() (mdds::mtv::element_t type, size_t 
nTopRow, size_t nDataSize)
+std::pairsize_t,bool operator() (const sc::CellStoreType::value_type 
node, size_t nOffset)
 {
 typedef std::pairsize_t,bool RetType;
 
-if (type == sc::element_type_empty)
+if (node.type == sc::element_type_empty)
 return RetType(0, false);
 
-for (size_t i = 0; i  nDataSize; ++i)
+for (size_t i = nOffset; i  node.size; ++i)
 {
-SCROW nRow = nTopRow + i;
+SCROW nRow = node.position + i;
 sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, 
nRow, nRow, miCellPos);
 if (IsAmbiguousScriptNonZero(nScriptType))
 // Return the offset from the first row.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-06 Thread Kohei Yoshida
 sc/inc/column.hxx|2 ++
 sc/inc/document.hxx  |2 +-
 sc/inc/mtvcellfunc.hxx   |   10 ++
 sc/inc/table.hxx |3 +++
 sc/source/core/data/column.cxx   |2 +-
 sc/source/core/data/column2.cxx  |   28 
 sc/source/core/data/document.cxx |   31 ++-
 sc/source/core/data/table2.cxx   |   17 +
 sc/source/ui/undo/undoblk.cxx|1 +
 9 files changed, 85 insertions(+), 11 deletions(-)

New commits:
commit a0fe08c6862f5debaa375cc35c6bcec64f1008dc
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Feb 5 19:21:22 2014 -0500

fdo#74556: Correctly handle note captions life cycles.

When copying notes to clipboard, we don't clone captions but leave them
pointing to the original captions objects. Also, during undo and redo,
we need to clear all caption pointers to prevent them from being deleted
when the ScPostIt objects get deleted. The undo and redo of caption objects
are handled in the drawing layer afterwards.

Also, Have ReleaseNote() really release note rather than destroying it.

(cherry picked from commit fe5d604ecf6de4935c622e0e95efc085c4a3cbfd)
(cherry picked from commit bc504b5adfaeeac0b910b89b0c98ae564f1ff5b8)

Change-Id: Ia1da7784d04a2183f21813b6914e78161aad39d7
Reviewed-on: https://gerrit.libreoffice.org/7887
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9eef085..c6db640 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -502,8 +502,10 @@ public:
 void SetCellNote( SCROW nRow, ScPostIt* pNote);
 bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
 
+ScPostIt* ReleaseNote( SCROW nRow );
 size_t GetNoteCount() const;
 void CreateAllNoteCaptions();
+void ForgetNoteCaptions( SCROW nRow1, SCROW nRow2 );
 SCROW GetNotePosition( size_t nIndex ) const;
 void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const;
 void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, 
std::vectorsc::NoteEntry rNotes ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4a96709..505746f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -906,7 +906,6 @@ public:
 SC_DLLPUBLIC boolHasColNotes(SCCOL nCol, SCTAB nTab);
 SC_DLLPUBLIC boolHasTabNotes(SCTAB nTab);
 SC_DLLPUBLIC ScPostIt*   ReleaseNote(const ScAddress rPos);
-SC_DLLPUBLIC ScPostIt*   ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB 
nTab);
 SC_DLLPUBLIC ScPostIt*   GetOrCreateNote(const ScAddress rPos);
 SC_DLLPUBLIC ScPostIt*   CreateNote(const ScAddress rPos);
 size_t CountNotes() const;
@@ -917,6 +916,7 @@ public:
  * code uses sdr objects to export note data.
  */
 void CreateAllNoteCaptions();
+void ForgetNoteCaptions( const ScRangeList rRanges );
 
 ScAddress GetNotePosition( size_t nIndex ) const;
 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx
index 793f2db..fc6d2dc 100644
--- a/sc/inc/mtvcellfunc.hxx
+++ b/sc/inc/mtvcellfunc.hxx
@@ -166,6 +166,16 @@ void ProcessNote(CellNoteStoreType rStore, _Func rFunc)
 ProcessElements1CellNoteStoreType, cellnote_block, _Func, 
FuncElseNoOpsize_t (rStore, rFunc, aElse);
 }
 
+templatetypename _FuncElem
+typename CellNoteStoreType::iterator
+ProcessNote(
+const CellNoteStoreType::iterator it, CellNoteStoreType rStore, SCROW 
nRow1, SCROW nRow2, _FuncElem rFuncElem)
+{
+FuncElseNoOpsize_t aElse;
+return ProcessElements1
+CellNoteStoreType, cellnote_block, _FuncElem, FuncElseNoOpsize_t 
(it, rStore, nRow1, nRow2, rFuncElem, aElse);
+}
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 3049698..f6164ce 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -381,9 +381,12 @@ public:
 
 ScPostIt*   GetNote(const SCCOL nCol, const SCROW nRow);
 
+ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
+
 size_t GetNoteCount( SCCOL nCol ) const;
 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
 void CreateAllNoteCaptions();
+void ForgetNoteCaptions( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2 );
 
 void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const;
 void GetNotesInRange( const ScRange rRange, std::vectorsc::NoteEntry 
rNotes ) const;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index e358588..5e85ace 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1278,7 +1278,7 @@ class CopyToClipHandler
 
 void duplicateNotes(SCROW nStartRow, size_t nDataSize )
 {
-mrSrcCol.DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestPos);
+

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

2014-02-06 Thread Kohei Yoshida
 sc/inc/global.hxx   |4 
 sc/source/core/data/column2.cxx |   22 ++
 sc/source/filter/excel/colrowst.cxx |4 ++--
 3 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit 0003e02b1c96e01607924873697a52fb813343ac
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Jan 30 22:43:05 2014 -0500

Keep the standard row height situation under control.

With this change, applying cell attributes to default cells will
no longer change the row heights inadvertently.

Without this, applying background colors to cells, pasting to a
range of cells etc would make the row heights slightly shorter
which is 1) odd, and 2) causes all sorts of rendering issues because
internally we assume these actions wouldn't change the row heights.

Change-Id: I57c3546e1725c5e8b37696242e9642b1617f59c3
(cherry picked from commit 29b322ea0c40423a39efe2f6c2c85a7d2108c512)
Reviewed-on: https://gerrit.libreoffice.org/7774
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 9babb88..c7ef429 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -131,10 +131,6 @@ const SCSIZE MAXSUBTOTAL= 3;
 /* standard row height: text + margin - 
STD_ROWHEIGHT_DIFF */
 #define STD_ROWHEIGHT_DIFF  23
 
-/// use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT !
-
-#define STD_ROW_HEIGHT  (12.8 * TWIPS_PER_POINT)/* 256 Twips, 0.45 cm 
*/
-
 namespace sc
 {
 inline long TwipsToHMM( long nTwips ) { return (nTwips * 127 + 36) / 
72; }
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 04f127f..018052f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -725,10 +725,11 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
 
 static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr rPattern, 
sal_uInt16 nFontHeightId )
 {
-sal_uInt16 nHeight = (sal_uInt16) ((const SvxFontHeightItem) 
rPattern.GetItem(nFontHeightId)).GetHeight();
-const SvxMarginItem* pMargin = (const SvxMarginItem*) 
rPattern.GetItem(ATTR_MARGIN);
-nHeight += nHeight / 5;
-//  for 10pt gives 240
+const SvxFontHeightItem rFontHeight =
+static_castconst SvxFontHeightItem(rPattern.GetItem(nFontHeightId));
+
+sal_uInt16 nHeight = rFontHeight.GetHeight();
+nHeight *= 1.18;
 
 if ( ((const SvxEmphasisMarkItem)rPattern.
 GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != 
EMPHASISMARK_NONE )
@@ -738,19 +739,16 @@ static sal_uInt16 lcl_GetAttribHeight( const 
ScPatternAttr rPattern, sal_uInt16
 nHeight += nHeight / 4;
 }
 
-if ( nHeight + 240  ScGlobal::nDefFontHeight )
-{
-nHeight = sal::static_int_castsal_uInt16( nHeight + 
ScGlobal::nDefFontHeight );
-nHeight -= 240;
-}
+const SvxMarginItem rMargin =
+static_castconst SvxMarginItem(rPattern.GetItem(ATTR_MARGIN));
 
-//  Standard height: TextHeight + margin - 23
-//  - 257 for Windows
+nHeight += rMargin.GetTopMargin() + rMargin.GetBottomMargin();
 
 if (nHeight  STD_ROWHEIGHT_DIFF)
 nHeight -= STD_ROWHEIGHT_DIFF;
 
-nHeight += pMargin-GetTopMargin() + pMargin-GetBottomMargin();
+if (nHeight  ScGlobal::nStdRowHeight)
+nHeight = ScGlobal::nStdRowHeight;
 
 return nHeight;
 }
diff --git a/sc/source/filter/excel/colrowst.cxx 
b/sc/source/filter/excel/colrowst.cxx
index bc43a1e..dc6eae0 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -50,7 +50,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot 
rRoot ) :
 maHiddenRows(0, MAXROWCOUNT, false),
 mnLastScRow( -1 ),
 mnDefWidth( STD_COL_WIDTH ),
-mnDefHeight( static_cast sal_uInt16 ( STD_ROW_HEIGHT ) ),
+mnDefHeight( static_cast sal_uInt16 ( ScGlobal::nStdRowHeight ) ),
 mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ),
 mbHasStdWidthRec( false ),
 mbHasDefHeight( false ),
@@ -117,7 +117,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 
nDefHeight, sal_uInt16 nFlag
 mnDefRowFlags = nFlags;
 if( mnDefHeight == 0 )
 {
-mnDefHeight = static_cast sal_uInt16 ( STD_ROW_HEIGHT );
+mnDefHeight = static_cast sal_uInt16 ( ScGlobal::nStdRowHeight );
 ::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN );
 }
 mbHasDefHeight = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-03 Thread Kohei Yoshida
 sc/inc/column.hxx|1 +
 sc/inc/document.hxx  |6 ++
 sc/inc/mtvcellfunc.hxx   |7 +++
 sc/inc/table.hxx |1 +
 sc/source/core/data/column2.cxx  |   23 +++
 sc/source/core/data/document.cxx |   11 +++
 sc/source/core/data/table2.cxx   |6 ++
 sc/source/filter/xml/xmlwrap.cxx |2 ++
 8 files changed, 57 insertions(+)

New commits:
commit 17593b3e00c4d73a1985dfc1fae976d211aee007
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sun Feb 2 13:21:35 2014 -0500

fdo#74325: Ensure that all note objects have an sdr object before exporting.

Otherwise, if a note hasn't been displayed at least once before saving
that note would not get saved.  In the future, we should modify the export
code to not rely on SdrObject to check the presence of note.

Change-Id: Ib7ca3ac00a0c9cdd3a01facda7af479ef172afbe
(cherry picked from commit 018500a73f3b1082b6662b7c123dfe5158ae5752)
Reviewed-on: https://gerrit.libreoffice.org/7782
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 67d7572..414f40d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -502,6 +502,7 @@ public:
 bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
 
 size_t GetNoteCount() const;
+void CreateAllNoteCaptions();
 SCROW GetNotePosition( size_t nIndex ) const;
 void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const;
 void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, 
std::vectorsc::NoteEntry rNotes ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1f8ced4..4a96709 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -912,6 +912,12 @@ public:
 size_t CountNotes() const;
 size_t GetNoteCount( SCTAB nTab, SCCOL nCol ) const;
 
+/**
+ * Ensure that all note objects have an associated sdr object.  The export
+ * code uses sdr objects to export note data.
+ */
+void CreateAllNoteCaptions();
+
 ScAddress GetNotePosition( size_t nIndex ) const;
 SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
 
diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx
index c54d02e..793f2db 100644
--- a/sc/inc/mtvcellfunc.hxx
+++ b/sc/inc/mtvcellfunc.hxx
@@ -159,6 +159,13 @@ FindFormulaEditText(const CellStoreType rStore, SCROW 
nRow1, SCROW nRow2, _Func
 return FindElement2CellStoreType, edittext_block, formula_block, _Func, 
_Func(rStore, nRow1, nRow2, rFunc, rFunc);
 }
 
+templatetypename _Func
+void ProcessNote(CellNoteStoreType rStore, _Func rFunc)
+{
+FuncElseNoOpsize_t aElse;
+ProcessElements1CellNoteStoreType, cellnote_block, _Func, 
FuncElseNoOpsize_t (rStore, rFunc, aElse);
+}
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 2e1cfd5..f067658 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -382,6 +382,7 @@ public:
 
 size_t GetNoteCount( SCCOL nCol ) const;
 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
+void CreateAllNoteCaptions();
 
 void GetAllNoteEntries( std::vectorsc::NoteEntry rNotes ) const;
 void GetNotesInRange( const ScRange rRange, std::vectorsc::NoteEntry 
rNotes ) const;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 20d3ee7..6aef111 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1229,6 +1229,29 @@ size_t ScColumn::GetNoteCount() const
 return nCount;
 }
 
+namespace {
+
+class NoteCaptionCreator
+{
+ScAddress maPos;
+public:
+NoteCaptionCreator( SCTAB nTab, SCCOL nCol ) : maPos(nCol,0,nTab) {}
+
+void operator() ( size_t nRow, ScPostIt* p )
+{
+maPos.SetRow(nRow);
+p-GetOrCreateCaption(maPos);
+}
+};
+
+}
+
+void ScColumn::CreateAllNoteCaptions()
+{
+NoteCaptionCreator aFunc(nTab, nCol);
+sc::ProcessNote(maCellNotes, aFunc);
+}
+
 SCROW ScColumn::GetNotePosition( size_t nIndex ) const
 {
 // Return the row position of the nth note in the column.
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 11b6507..6bbe835 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6188,6 +6188,17 @@ size_t ScDocument::GetNoteCount( SCTAB nTab, SCCOL nCol 
) const
 return pTab-GetNoteCount(nCol);
 }
 
+void ScDocument::CreateAllNoteCaptions()
+{
+TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
+for (; it != itEnd; ++it)
+{
+ScTable* p = *it;
+if (p)
+p-CreateAllNoteCaptions();
+}
+}
+
 ScAddress ScDocument::GetNotePosition( size_t nIndex ) const
 {
 for (size_t nTab = 0; nTab  maTabs.size(); ++nTab)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index ce4871a..e81a5e2 100644
--- 

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

2014-01-30 Thread Kohei Yoshida
 sc/inc/document.hxx  |2 ++
 sc/source/core/data/documen7.cxx |   24 
 sc/source/ui/docshell/impex.cxx  |   19 +++
 sc/source/ui/inc/impex.hxx   |2 ++
 sc/source/ui/undo/undobase.cxx   |   20 +---
 sc/source/ui/view/viewfun5.cxx   |1 +
 6 files changed, 45 insertions(+), 23 deletions(-)

New commits:
commit 383e5543593848cbd1458d5c5dad5e7b7b17ee09
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Jan 29 11:42:27 2014 -0500

fdo#74014: More on broadcasting at appropriate places.

Also, call PostDataChanged() to re-paint re-calculated formula cells,
and brodcast only when pasting, not during file import.

(cherry picked from commit 8a36879eaf0977448b113c2239014d2e2b7ab258)
(cherry picked from commit 3d869cda8db03820dea8c4ba463eb155d05e933b)

Conflicts:
sc/source/core/data/documen7.cxx
sc/source/ui/undo/undobase.cxx
sc/qa/unit/ucalc.cxx

Change-Id: I63161329d4bfe937f754773fd68c37e3836c4950
Reviewed-on: https://gerrit.libreoffice.org/7727
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 65d573f..665fb35 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1809,6 +1809,8 @@ public:
  */
 voidBroadcast( const ScHint rHint );
 
+void BroadcastCells( const ScRange rRange, sal_uLong nHint );
+
 /// only area, no cell broadcast
 voidAreaBroadcast( const ScHint rHint );
 /// only areas in range, no cell broadcasts
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 7dd9821..210d87b 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -104,6 +104,30 @@ void ScDocument::Broadcast( const ScHint rHint )
 }
 }
 
+void ScDocument::BroadcastCells( const ScRange rRange, sal_uLong nHint )
+{
+CellContentModified();
+
+ScBulkBroadcast aBulkBroadcast(pBASM);
+
+ScHint aHint(nHint, ScAddress());
+ScAddress rPos = aHint.GetAddress();
+for (SCTAB nTab = rRange.aStart.Tab(); nTab = rRange.aEnd.Tab(); ++nTab)
+{
+rPos.SetTab(nTab);
+for (SCCOL nCol = rRange.aStart.Col(); nCol = rRange.aEnd.Col(); 
++nCol)
+{
+rPos.SetCol(nCol);
+for (SCROW nRow = rRange.aStart.Row(); nRow = rRange.aEnd.Row(); 
++nRow)
+{
+rPos.SetRow(nRow);
+Broadcast(aHint);
+}
+}
+}
+
+BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED));
+}
 
 void ScDocument::AreaBroadcast( const ScHint rHint )
 {
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 1ca265e..5b58b4e 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -88,7 +88,7 @@ ScImportExport::ScImportExport( ScDocument* p )
   bFormulas( false ), bIncludeFiltered( true ),
   bAll( true ), bSingle( true ), bUndo( false ),
   bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
-  mbApi( true ), mExportTextOptions()
+  mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
 {
 pUndoDoc = NULL;
 pExtOptions = NULL;
@@ -104,7 +104,7 @@ ScImportExport::ScImportExport( ScDocument* p, const 
ScAddress rPt )
   bFormulas( false ), bIncludeFiltered( true ),
   bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ),
   bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
-  mbApi( true ), mExportTextOptions()
+  mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
 {
 pUndoDoc = NULL;
 pExtOptions = NULL;
@@ -121,7 +121,7 @@ ScImportExport::ScImportExport( ScDocument* p, const 
ScRange r )
   bFormulas( false ), bIncludeFiltered( true ),
   bAll( false ), bSingle( false ), bUndo( pDocSh != NULL ),
   bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
-  mbApi( true ), mExportTextOptions()
+  mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
 {
 pUndoDoc = NULL;
 pExtOptions = NULL;
@@ -139,7 +139,7 @@ ScImportExport::ScImportExport( ScDocument* p, const 
OUString rPos )
   bFormulas( false ), bIncludeFiltered( true ),
   bAll( false ), bSingle( true ), bUndo( pDocSh != NULL ),
   bOverflowRow( false ), bOverflowCol( false ), bOverflowCell( false ),
-  mbApi( true ), mExportTextOptions()
+  mbApi( true ), mbImportBroadcast(false), mExportTextOptions()
 {
 pUndoDoc = NULL;
 pExtOptions = NULL;
@@ -946,6 +946,12 @@ bool ScImportExport::Text2Doc( SvStream rStrm )
 }
 
 EndPaste();
+if (bOk  mbImportBroadcast)
+{
+pDoc-BroadcastCells(aRange, SC_HINT_DATACHANGED);
+pDocSh-PostDataChanged();
+}
+
 return bOk;
 }
 
@@ -1483,6 

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

2014-01-30 Thread Kohei Yoshida
 sc/inc/column.hxx|5 +++--
 sc/inc/document.hxx  |4 ++--
 sc/inc/table.hxx |2 +-
 sc/source/core/data/column.cxx   |4 ++--
 sc/source/core/data/column3.cxx  |   12 
 sc/source/core/data/document.cxx |9 +
 sc/source/core/data/table2.cxx   |4 ++--
 sc/source/ui/undo/undoblk.cxx|5 -
 8 files changed, 27 insertions(+), 18 deletions(-)

New commits:
commit 92346fb7714ca7c6a467771d8a8b01305c1b17d1
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Jan 29 14:00:47 2014 -0500

fdo#74014: Broadcast changes during undo and redo after paste.

Change-Id: I271bbba5e5eb70e48274a4a062d125456af8ff6c
(cherry picked from commit f5d8029a456c2c708cbc2b67f2d7875540dff1ab)
Reviewed-on: https://gerrit.libreoffice.org/7728
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 032ef8e..67d7572 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -213,7 +213,8 @@ public:
 bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
 voidInsertRow( SCROW nStartRow, SCSIZE nSize );
 voidDeleteRow( SCROW nStartRow, SCSIZE nSize );
-voidDeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag 
);
+void DeleteArea(
+SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag, bool bBroadcast = 
true );
 void CopyToClip(
 sc::CopyToClipContext rCxt, SCROW nRow1, SCROW nRow2, ScColumn 
rColumn ) const;
 void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn rDestCol);
@@ -408,7 +409,7 @@ public:
 voidRemoveProtected( SCROW nStartRow, SCROW nEndRow );
 
 SCsROW  ApplySelectionCache( SfxItemPoolCache* pCache, const 
ScMarkData rMark, ScEditDataArray* pDataArray = NULL );
-voidDeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark 
);
+void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark, bool 
bBroadcast );
 
 voidClearSelectionItems( const sal_uInt16* pWhich, const 
ScMarkData rMark );
 voidChangeSelectionIndent( bool bIncrement, const ScMarkData 
rMark );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 665fb35..1f8ced4 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1441,8 +1441,8 @@ public:
 
 SC_DLLPUBLIC voidApplySelectionPattern( const ScPatternAttr 
rAttr, const ScMarkData rMark,
ScEditDataArray* pDataArray = NULL 
);
-voidDeleteSelection( sal_uInt16 nDelFlag, const ScMarkData 
rMark );
-voidDeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const 
ScMarkData rMark );
+void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark, bool 
bBroadcast = true );
+void DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const 
ScMarkData rMark, bool bBroadcast = true );
 
 SC_DLLPUBLIC void   SetColWidth( SCCOL nCol, SCTAB nTab, 
sal_uInt16 nNewWidth );
 SC_DLLPUBLIC void   SetColWidthOnly( SCCOL nCol, SCTAB nTab, 
sal_uInt16 nNewWidth );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7877a1c..2e1cfd5 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -622,7 +622,7 @@ public:
 boolRemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, 
SCROW nEndRow, sal_Int16 nFlags );
 
 voidApplySelectionCache( SfxItemPoolCache* pCache, const 
ScMarkData rMark, ScEditDataArray* pDataArray = NULL );
-voidDeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark 
);
+void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark, bool 
bBroadcast = true );
 
 voidClearSelectionItems( const sal_uInt16* pWhich, const 
ScMarkData rMark );
 voidChangeSelectionIndent( bool bIncrement, const ScMarkData 
rMark );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8c6102f..7771f0e 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -484,7 +484,7 @@ void ScColumn::ClearSelectionItems( const sal_uInt16* 
pWhich,const ScMarkData r
 }
 
 
-void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark )
+void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData rMark, 
bool bBroadcast )
 {
 SCROW nTop;
 SCROW nBottom;
@@ -493,7 +493,7 @@ void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const 
ScMarkData rMark )
 {
 ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
 while (aMarkIter.Next( nTop, nBottom ))
-DeleteArea(nTop, nBottom, nDelFlag);
+DeleteArea(nTop, nBottom, nDelFlag, bBroadcast);
 }
 }
 
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 798d544..54b53f2 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -574,7 +574,8 @@ 

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

2014-01-27 Thread Kohei Yoshida
 sc/inc/mtvelements.hxx  |2 +-
 sc/source/core/data/column2.cxx |   19 ---
 2 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit b5f9c2be36f935f0009c2d7c40f7fadebf0b7ef8
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Jan 24 21:29:54 2014 -0500

Stop leaking all ScPostIt instances.

And re-implement correct swapping of two ScPostIt instances during
sort.

(cherry picked from commit ab05317c79f665bcf9d5cff7b8312ce6963ff969)

Change-Id: Ifbf120aae594342ae0b7c5760f771c53092c8022
Reviewed-on: https://gerrit.libreoffice.org/7641
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 0fcafde..3eb5527 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -65,7 +65,7 @@ const mdds::mtv::element_t element_type_empty = 
mdds::mtv::element_type_empty;
 
 /// Custom element blocks.
 
-typedef mdds::mtv::default_element_blockelement_type_cellnote, ScPostIt* 
cellnote_block;
+typedef mdds::mtv::noncopyable_managed_element_blockelement_type_cellnote, 
ScPostIt cellnote_block;
 typedef mdds::mtv::noncopyable_managed_element_blockelement_type_broadcaster, 
SvtBroadcaster broadcaster_block;
 typedef mdds::mtv::default_element_blockelement_type_celltextattr, 
CellTextAttr celltextattr_block;
 typedef mdds::mtv::default_element_blockelement_type_string, 
svl::SharedString string_block;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ad16dd4..20d3ee7 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1902,8 +1902,6 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
 if (aPos2.first == maCellNotes.end())
 return;
 
-ScPostIt* aNote;
-
 sc::CellNoteStoreType::iterator it1 = aPos1.first, it2 = aPos2.first;
 if (it1-type == it2-type)
 {
@@ -1917,10 +1915,10 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
 sc::cellnote_block::at(*it2-data, aPos2.second));
 
 //update Note caption with position
-aNote = sc::cellnote_block::at(*it1-data, aPos1.second);
-aNote-UpdateCaptionPos(ScAddress(nCol,nRow2,nTab));
-aNote = sc::cellnote_block::at(*it2-data, aPos2.second);
-aNote-UpdateCaptionPos(ScAddress(nCol,nRow1,nTab));
+ScPostIt* pNote = sc::cellnote_block::at(*it1-data, aPos1.second);
+pNote-UpdateCaptionPos(ScAddress(nCol,nRow2,nTab));
+pNote = sc::cellnote_block::at(*it2-data, aPos2.second);
+pNote-UpdateCaptionPos(ScAddress(nCol,nRow1,nTab));
 
 return;
 }
@@ -1931,19 +1929,18 @@ void ScColumn::SwapCellNotes( SCROW nRow1, SCROW nRow2 )
 // row 1 is empty while row 2 is non-empty.
 ScPostIt* pVal2 = sc::cellnote_block::at(*it2-data, aPos2.second);
 it1 = maCellNotes.set(it1, nRow1, pVal2);
-maCellNotes.set_empty(it1, nRow2, nRow2);
+maCellNotes.release(it1, nRow2, pVal2);
 pVal2-UpdateCaptionPos(ScAddress(nCol,nRow1,nTab)); //update Note 
caption with position
 
 return;
 }
 
 // row 1 is non-empty while row 2 is empty.
-ScPostIt* pVal1 = sc::cellnote_block::at(*it1-data, aPos1.second);
-it1 = maCellNotes.set_empty(it1, nRow1, nRow1);
+ScPostIt* pVal1 = NULL;
+it1 = maCellNotes.release(it1, nRow1, pVal1);
+assert(pVal1);
 maCellNotes.set(it1, nRow2, pVal1);
 pVal1-UpdateCaptionPos(ScAddress(nCol,nRow1,nTab)); //update Note 
caption with position
-
-CellStorageModified();
 }
 
 SvtBroadcaster* ScColumn::GetBroadcaster(SCROW nRow)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-26 Thread Eike Rathke
 sc/inc/column.hxx   |2 +-
 sc/inc/formulacell.hxx  |3 +++
 sc/inc/table.hxx|6 +++---
 sc/source/core/data/column.cxx  |8 
 sc/source/core/data/document.cxx|   30 --
 sc/source/core/data/formulacell.cxx |   36 ++--
 sc/source/core/data/table2.cxx  |4 ++--
 7 files changed, 51 insertions(+), 38 deletions(-)

New commits:
commit d2982b9fd66f56553acd32bec806bafcdf8c8322
Author: Eike Rathke er...@redhat.com
Date:   Thu Jan 23 22:40:16 2014 +0100

resolved fdo#71598 postpone SetDirty during Insert/Delete

... until after all listeners are re-established.

Change-Id: I9f6036d4bcc9206191959a88ed5439b9860ca268
(cherry picked from commit 20b7476142f75b49d10a75e48429a94cff0cec32)
Reviewed-on: https://gerrit.libreoffice.org/7623
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 16caa5e..032ef8e 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -445,7 +445,7 @@ public:
 voidMoveListeners( SvtBroadcaster rSource, SCROW nDestRow );
 voidStartAllListeners();
 voidStartNeededListeners(); // only for cells where 
NeedsListening()==true
-voidSetRelNameDirty();
+voidSetDirtyIfPostponed();
 void BroadcastRecalcOnRefMove();
 
 voidCompileDBFormula();
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index dbb52e4..68c620c 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -121,6 +121,7 @@ private:
 boolbTableOpDirty  : 1; // Dirty flag for TableOp
 boolbNeedListening : 1; // Listeners need to be re-established 
after UpdateReference
 boolmbNeedsNumberFormat : 1; // set the calculated number 
format as hard number format
+boolmbPostponedDirty : 1;   // if cell needs to be set dirty 
later
 
 enum ScInterpretTailParameter
 {
@@ -371,6 +372,8 @@ public:
 SCROW GetSharedLength() const;
 ScTokenArray* GetSharedCode();
 const ScTokenArray* GetSharedCode() const;
+
+bool IsPostponedDirty() const;
 };
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index c2b8549..7877a1c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -879,10 +879,10 @@ public:
 void StartNeededListeners();
 
 /**
- * Mark dirty those formula cells that has named ranges with relative
- * references.
+ * Mark formula cells dirty that have the mbPostponedDirty flag set or
+ * contain named ranges with relative references.
  */
-void SetRelNameDirty();
+void SetDirtyIfPostponed();
 
 /**
  * Broadcast dirty formula cells that contain functions such as CELL(),
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index aafb314..007e9e3 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2806,11 +2806,11 @@ struct SetDirtyAfterLoadHandler
 }
 };
 
-struct SetRelNameDirtyHandler
+struct SetDirtyIfPostponedHandler
 {
 void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
 {
-if (pCell-HasRelNameReference())
+if (pCell-IsPostponedDirty() || pCell-HasRelNameReference())
 pCell-SetDirty();
 }
 };
@@ -3144,10 +3144,10 @@ public:
 
 }
 
-void ScColumn::SetRelNameDirty()
+void ScColumn::SetDirtyIfPostponed()
 {
 sc::AutoCalcSwitch aSwitch(*pDocument, false);
-SetRelNameDirtyHandler aFunc;
+SetDirtyIfPostponedHandler aFunc;
 sc::ProcessFormula(maCells, aFunc);
 }
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 1bd256e..c9f14cf 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1168,12 +1168,12 @@ struct StartNeededListenersHandler : 
std::unary_functionScTable*, void
 }
 };
 
-struct SetRelNameDirtyHandler : std::unary_functionScTable*, void
+struct SetDirtyIfPostponedHandler : std::unary_functionScTable*, void
 {
 void operator() (ScTable* p)
 {
 if (p)
-p-SetRelNameDirty();
+p-SetDirtyIfPostponed();
 }
 };
 
@@ -1263,12 +1263,13 @@ bool ScDocument::InsertRow( SCCOL nStartCol, SCTAB 
nStartTab,
 for (; it != maTabs.end(); ++it)
 if (*it)
 (*it)-StartNeededListeners();
-// at least all cells using range names pointing relative
-// to the moved range must recalculate
+// At least all cells using range names pointing relative to the
+// moved range must be recalculated, and all cells marked postponed
+// dirty.
 it = maTabs.begin();
 for (; it != maTabs.end(); ++it)
 

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

2014-01-15 Thread Kohei Yoshida
 sc/inc/columnspanset.hxx  |   18 +-
 sc/inc/markdata.hxx   |8 
 sc/source/core/data/column2.cxx   |2 +-
 sc/source/core/data/column3.cxx   |8 
 sc/source/core/data/columnspanset.cxx |4 +++-
 sc/source/core/data/markdata.cxx  |   21 +
 sc/source/ui/view/viewfun2.cxx|   24 
 sc/source/ui/view/viewfunc.cxx|2 +-
 8 files changed, 59 insertions(+), 28 deletions(-)

New commits:
commit adce7994e9cecf761381c87bc8ff77320077f894
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Jan 14 10:55:02 2014 -0500

fdo#73606: Avoid excessive and unnecessary heap allocation of array objects.

This is a leftover from the 1 million row conversion we did years ago.

Change-Id: Ib50819ed51c7017bcc559bfc8b6062ff46615d09
(cherry picked from commit df9243626b39742a9a148bea95796f8824fee68a)
Reviewed-on: https://gerrit.libreoffice.org/7425
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 98533e2..62e96a8 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -25,6 +25,14 @@ namespace sc {
 
 struct ColumnBlockConstPosition;
 
+struct RowSpan
+{
+SCROW mnRow1;
+SCROW mnRow2;
+
+RowSpan(SCROW nRow1, SCROW nRow2);
+};
+
 /**
  * Structure that stores segments of boolean flags per column, and perform
  * custom action on those segments.
@@ -85,15 +93,7 @@ class SingleColumnSpanSet
 public:
 typedef mdds::flat_segment_treeSCROW, bool ColumnSpansType;
 
-struct Span
-{
-SCROW mnRow1;
-SCROW mnRow2;
-
-Span(SCROW nRow1, SCROW nRow2) : mnRow1(nRow1), mnRow2(nRow2) {}
-};
-
-typedef std::vectorSpan SpansType;
+typedef std::vectorRowSpan SpansType;
 
 SingleColumnSpanSet();
 
diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx
index 75937ed..943419d 100644
--- a/sc/inc/markdata.hxx
+++ b/sc/inc/markdata.hxx
@@ -26,6 +26,12 @@
 
 #include set
 
+namespace sc {
+
+struct RowSpan;
+
+}
+
 class ScMarkArray;
 class ScRangeList;
 
@@ -103,6 +109,8 @@ public:
 SCCOLROWGetMarkColumnRanges( SCCOLROW* pRanges );
 SCCOLROWGetMarkRowRanges( SCCOLROW* pRanges );
 
+void GetMarkedRowSpans( SCTAB nTab, std::vectorsc::RowSpan rSpans );
+
 boolIsColumnMarked( SCCOL nCol ) const;
 boolIsRowMarked( SCROW nRow ) const;
 boolIsAllMarked( const ScRange rRange ) const; // Multi
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 2adf63c..ad16dd4 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -618,7 +618,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
 }
 else
 // Select the entire column if no selection exists.
-aMarkedSpans.push_back(sc::SingleColumnSpanSet::Span(0, MAXROW));
+aMarkedSpans.push_back(sc::RowSpan(0, MAXROW));
 
 sal_uInt16 nWidth = static_castsal_uInt16(nOldWidth*nPPTX);
 bool bFound = false;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 850a904..7675271 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -198,7 +198,7 @@ public:
 mrDoc(rDoc),
 maHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab)) {}
 
-void operator() (const sc::SingleColumnSpanSet::Span rSpan)
+void operator() (const sc::RowSpan rSpan)
 {
 SCROW nRow1 = rSpan.mnRow1, nRow2 = rSpan.mnRow2;
 maHint.GetAddress().SetRow(nRow1);
@@ -556,7 +556,7 @@ public:
 EmptyCells(sc::ColumnBlockPosition rPos, ScColumn rColumn) :
 mrColumn(rColumn), mrPos(rPos) {}
 
-void operator() (const sc::SingleColumnSpanSet::Span rSpan)
+void operator() (const sc::RowSpan rSpan)
 {
 sc::CellStoreType rCells = mrColumn.GetCellStore();
 
@@ -651,7 +651,7 @@ bool ScColumn::InitBlockPosition( 
sc::ColumnBlockConstPosition rBlockPos ) cons
 
 namespace {
 
-class CopyAttrArrayByRange : 
std::unary_functionsc::SingleColumnSpanSet::Span, void
+class CopyAttrArrayByRange : std::unary_functionsc::RowSpan, void
 {
 ScAttrArray mrDestAttrArray;
 ScAttrArray mrSrcAttrArray;
@@ -660,7 +660,7 @@ public:
 CopyAttrArrayByRange(ScAttrArray rDestAttrArray, ScAttrArray 
rSrcAttrArray, long nRowOffset) :
 mrDestAttrArray(rDestAttrArray), mrSrcAttrArray(rSrcAttrArray), 
mnRowOffset(nRowOffset) {}
 
-void operator() (const sc::SingleColumnSpanSet::Span rSpan)
+void operator() (const sc::RowSpan rSpan)
 {
 mrDestAttrArray.CopyAreaSafe(
 rSpan.mnRow1+mnRowOffset, rSpan.mnRow2+mnRowOffset, mnRowOffset, 
mrSrcAttrArray);
diff --git a/sc/source/core/data/columnspanset.cxx 
b/sc/source/core/data/columnspanset.cxx
index f8c7813..efa51b5 100644
--- 

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

2014-01-11 Thread Kohei Yoshida
 sc/inc/scextopt.hxx|7 +++
 sc/source/ui/view/scextopt.cxx |   12 
 sc/source/ui/view/viewdata.cxx |4 
 3 files changed, 23 insertions(+)

New commits:
commit 697005cdb9adb375afb499beca68246251713578
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Jan 10 15:10:23 2014 -0500

fdo#73484: Ensure that we import all tab settings from Excel.

The old code would not import settings of the last sheet if maTabData was
not large enough before the loop begins. Enlarge maTabData ahead of time
to ensure we load all tab settings.

Change-Id: I9093a93ef26ccba9fef06a8929d1d86311f5c55d
(cherry picked from commit 3e87471b6815a3cad48cab2ef81073bad5453c56)
Reviewed-on: https://gerrit.libreoffice.org/7382
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx
index a4893cf..bcdaa2c 100644
--- a/sc/inc/scextopt.hxx
+++ b/sc/inc/scextopt.hxx
@@ -96,6 +96,13 @@ public:
 
 /** @return read access to the settings of a sheet, if extant; otherwise 
0. */
 const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
+
+/**
+ * @return index of the last sheet that has settings, or -1 if no tab
+ * settings are present.
+ */
+SCTAB GetLastTab() const;
+
 /** @return read/write access to the settings of a sheet, may create a new 
struct. */
 ScExtTabSettings   GetOrCreateTabSettings( SCTAB nTab );
 
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 4390d46..800f523 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -68,6 +68,8 @@ public:
 const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
 ScExtTabSettings   GetOrCreateTabSettings( SCTAB nTab );
 
+SCTAB GetLastTab() const;
+
 private:
 typedef ::boost::shared_ptr ScExtTabSettings  ScExtTabSettingsRef;
 typedef ::std::map SCTAB, ScExtTabSettingsRef ScExtTabSettingsMap;
@@ -109,6 +111,11 @@ ScExtTabSettings 
ScExtTabSettingsCont::GetOrCreateTabSettings( SCTAB nTab )
 return *rxTabSett;
 }
 
+SCTAB ScExtTabSettingsCont::GetLastTab() const
+{
+return maMap.empty() ? -1 : maMap.rbegin()-first;
+}
+
 void ScExtTabSettingsCont::CopyFromMap( const ScExtTabSettingsMap rMap )
 {
 maMap.clear();
@@ -183,6 +190,11 @@ const ScExtTabSettings* ScExtDocOptions::GetTabSettings( 
SCTAB nTab ) const
 return mxImpl-maTabSett.GetTabSettings( nTab );
 }
 
+SCTAB ScExtDocOptions::GetLastTab() const
+{
+return mxImpl-maTabSett.GetLastTab();
+}
+
 ScExtTabSettings ScExtDocOptions::GetOrCreateTabSettings( SCTAB nTab )
 {
 return mxImpl-maTabSett.GetOrCreateTabSettings( nTab );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 4e3e065..414f07f 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2466,6 +2466,10 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions 
rDocOpt )
 pView-SetPendingRelTabBarWidth( rDocSett.mfTabBarWidth );
 
 // sheet settings
+SCTAB nLastTab = rDocOpt.GetLastTab();
+if (static_castSCTAB(maTabData.size()) = nLastTab)
+maTabData.resize(nLastTab+1);
+
 for( SCTAB nTab = 0; nTab  static_castSCTAB(maTabData.size()); ++nTab )
 {
 if( const ScExtTabSettings* pTabSett = rDocOpt.GetTabSettings( nTab ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-08 Thread Kohei Yoshida
 sc/inc/dputil.hxx |2 +-
 sc/source/core/data/dpdimsave.cxx |4 ++--
 sc/source/core/data/dpgroup.cxx   |2 +-
 sc/source/core/data/dputil.cxx|   13 -
 4 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 06a5bad8e1feb1972059d4f9c4d89eb59ae43ae2
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Jan 7 22:13:07 2014 -0500

fdo#72774: Generate correct group items for the year group.

This changes bring it back to the same algorithm used in 3.5.

Change-Id: I16855cef1de133a1f886baa823d5b0d2b148e781
(cherry picked from commit c2e88a32314012afb799e321ec1d658f99f71781)
Reviewed-on: https://gerrit.libreoffice.org/7305
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx
index e4ed831..9568e95 100644
--- a/sc/inc/dputil.hxx
+++ b/sc/inc/dputil.hxx
@@ -45,7 +45,7 @@ public:
 SvNumberFormatter* pFormatter);
 
 static sal_Int32 getDatePartValue(
-double fValue, const ScDPNumGroupInfo rInfo, sal_Int32 nDatePart,
+double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart,
 SvNumberFormatter* pFormatter);
 
 static OUString getDisplayedMeasureName(const OUString rName, 
ScSubTotalFunc eFunc);
diff --git a/sc/source/core/data/dpdimsave.cxx 
b/sc/source/core/data/dpdimsave.cxx
index d200971..3f51268 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -337,8 +337,8 @@ void fillDateGroupDimension(
 {
 case sheet::DataPilotFieldGroupBy::YEARS:
 nStart = ScDPUtil::getDatePartValue(
-fSourceMin, rDateInfo, sheet::DataPilotFieldGroupBy::YEARS, 
pFormatter);
-nEnd = ScDPUtil::getDatePartValue(fSourceMax, rDateInfo, 
sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
+fSourceMin, NULL, sheet::DataPilotFieldGroupBy::YEARS, 
pFormatter);
+nEnd = ScDPUtil::getDatePartValue(fSourceMax, NULL, 
sheet::DataPilotFieldGroupBy::YEARS, pFormatter);
 break;
 case sheet::DataPilotFieldGroupBy::QUARTERS: nStart = 1; nEnd = 4;   
break;
 case sheet::DataPilotFieldGroupBy::MONTHS:   nStart = 1; nEnd = 12;  
break;
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index f79a740..e5da799 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -911,7 +911,7 @@ void ScDPGroupTableData::FillGroupValues(vectorSCROW 
rItems, const vectorlon
 {
 SvNumberFormatter* pFormatter = pDoc-GetFormatTable();
 sal_Int32 nPartValue = ScDPUtil::getDatePartValue(
-pData-GetValue(), *pNumInfo, nDatePart, pFormatter);
+pData-GetValue(), pNumInfo, nDatePart, pFormatter);
 
 ScDPItemData aItem(nDatePart, nPartValue);
 rItems[i] = pCache-GetIdByItemData(nColumn, aItem);
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index e21b2a8..03f585c 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -290,16 +290,19 @@ OUString ScDPUtil::getNumGroupName(
 }
 
 sal_Int32 ScDPUtil::getDatePartValue(
-double fValue, const ScDPNumGroupInfo rInfo, sal_Int32 nDatePart,
+double fValue, const ScDPNumGroupInfo* pInfo, sal_Int32 nDatePart,
 SvNumberFormatter* pFormatter)
 {
 // Start and end are inclusive
 // (End date without a time value is included, with a time value it's not)
 
-if (fValue  rInfo.mfStart  !rtl::math::approxEqual(fValue, 
rInfo.mfStart))
-return ScDPItemData::DateFirst;
-if (fValue  rInfo.mfEnd  !rtl::math::approxEqual(fValue, rInfo.mfEnd))
-return ScDPItemData::DateLast;
+if (pInfo)
+{
+if (fValue  pInfo-mfStart  !rtl::math::approxEqual(fValue, 
pInfo-mfStart))
+return ScDPItemData::DateFirst;
+if (fValue  pInfo-mfEnd  !rtl::math::approxEqual(fValue, 
pInfo-mfEnd))
+return ScDPItemData::DateLast;
+}
 
 sal_Int32 nResult = 0;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-08 Thread Kohei Yoshida
 sc/inc/globalnames.hxx |4 
 sc/source/core/tool/formulagroup.cxx   |3 ++-
 sc/source/ui/optdlg/calcoptionsdlg.cxx |   15 +--
 3 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit ea38aead924caeae9d51dec5246fef27f4fa456e
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Jan 8 14:43:39 2014 -0500

fdo#73408: Make the software interpreter selection stick in the UI.

Change-Id: I136a98fadbde82a7a585df9a5691f884c0362699
(cherry picked from commit 4b5a98942cd3ebcdacd4d66fb2bd61211fcfe7bc)
Reviewed-on: https://gerrit.libreoffice.org/7323
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index a7f0053..336bee6 100644
--- a/sc/inc/globalnames.hxx
+++ b/sc/inc/globalnames.hxx
@@ -23,6 +23,10 @@
 // set (in nScriptType) if type has not been determined yet
 #define SC_SCRIPTTYPE_UNKNOWN 0x08
 
+// Device name used to represent the software group interpreter for OpenCL
+// mode. This string gets stored in use configuration as the device name.
+#define OPENCL_SOFTWARE_DEVICE_CONFIG_NAME Software
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/formulagroup.cxx 
b/sc/source/core/tool/formulagroup.cxx
index ab60336..f58f7dc 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -16,6 +16,7 @@
 #include compiler.hxx
 #include interpre.hxx
 #include scmatrix.hxx
+#include globalnames.hxx
 
 #include formula/vectortoken.hxx
 #include rtl/bootstrap.hxx
@@ -593,7 +594,7 @@ void 
FormulaGroupInterpreter::fillOpenCLInfo(std::vectorOpenclPlatformInfo rP
 bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString rDeviceId, 
bool bAutoSelect, bool bForceEvaluation)
 {
 bool bOpenCLEnabled = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled;
-if(!bOpenCLEnabled || rDeviceId == Software)
+if (!bOpenCLEnabled || rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)
 {
 if(msInstance)
 {
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx 
b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index eefb7f6..79ca879 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -16,6 +16,7 @@
 
 #if HAVE_FEATURE_OPENCL
 #include formulagroup.hxx
+#include globalnames.hxx
 #endif
 
 namespace {
@@ -200,7 +201,7 @@ void ScCalcOptionsDialog::fillOpenclList()
 {
 mpOpenclInfoList-SetUpdateMode(false);
 mpOpenclInfoList-Clear();
-mpOpenclInfoList-InsertEntry(maSoftware);
+SvTreeListEntry* pSoftwareEntry = 
mpOpenclInfoList-InsertEntry(maSoftware);
 
 OUString aStoredDevice = maConfig.maOpenCLDevice;
 
@@ -225,10 +226,12 @@ void ScCalcOptionsDialog::fillOpenclList()
 
 mpOpenclInfoList-SetUpdateMode(true);
 mpOpenclInfoList-GetModel()-GetView(0)-SelectAll(false, false);
-if(pSelectedEntry)
-{
-mpOpenclInfoList-GetModel()-GetView(0)-Select(pSelectedEntry);
-}
+
+if (pSelectedEntry)
+mpOpenclInfoList-Select(pSelectedEntry);
+else if (aStoredDevice == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)
+mpOpenclInfoList-Select(pSoftwareEntry);
+
 SelectedDeviceChanged();
 }
 
@@ -404,7 +407,7 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
 OUString aDevice = 
dynamic_castSvLBoxString*(pEntry-GetItem(1))-GetText();
 // use english string for configuration
 if(aDevice == maSoftware)
-aDevice = Software;
+aDevice = OPENCL_SOFTWARE_DEVICE_CONFIG_NAME;
 
 maConfig.maOpenCLDevice = aDevice;
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-03 Thread Eike Rathke
 sc/inc/dociter.hxx  |2 +-
 sc/source/core/data/dociter.cxx |   22 +++---
 2 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit d16363aa6c8d7a01f9579f7f062a2d005fa1a854
Author: Eike Rathke er...@redhat.com
Date:   Fri Jan 3 23:19:24 2014 +0100

resolved fdo#72949 evaluate criteria on the query range

... and not on the result vector if that isn't included.
Actually implements a TODO introduced with
c008dc483f8c6840803983e7e351cec6fdd32070

Change-Id: Ic6c7ae70651aca21f22f10f76f94eb8690536bef
(cherry picked from commit a7d6e1f3eb60e4b73092dfe3f21501b4d150f041)

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 3a83f0a..846bb11 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -111,7 +111,7 @@ public:
 private:
 static const sc::CellStoreType* GetColumnCellStore(ScDocument rDoc, SCTAB 
nTab, SCCOL nCol);
 static const ScAttrArray* GetAttrArrayByCol(ScDocument rDoc, SCTAB nTab, 
SCCOL nCol);
-static bool IsQueryValid(ScDocument rDoc, const ScQueryParam rParam, 
SCTAB nTab, SCROW nRow, ScRefCellValue rCell);
+static bool IsQueryValid(ScDocument rDoc, const ScQueryParam rParam, 
SCTAB nTab, SCROW nRow, ScRefCellValue* pCell);
 
 class DataAccess
 {
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index dab4a10..0fd07c7 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -330,11 +330,11 @@ const ScAttrArray* 
ScDBQueryDataIterator::GetAttrArrayByCol(ScDocument rDoc, SC
 }
 
 bool ScDBQueryDataIterator::IsQueryValid(
-ScDocument rDoc, const ScQueryParam rParam, SCTAB nTab, SCROW nRow, 
ScRefCellValue rCell)
+ScDocument rDoc, const ScQueryParam rParam, SCTAB nTab, SCROW nRow, 
ScRefCellValue* pCell)
 {
 if (nTab = rDoc.GetTableCount())
 OSL_FAIL(try to access index out of bounds, FIX IT);
-return rDoc.maTabs[nTab]-ValidQuery(nRow, rParam, rCell);
+return rDoc.maTabs[nTab]-ValidQuery(nRow, rParam, pCell);
 }
 
 // 
@@ -376,10 +376,11 @@ bool 
ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value rValue)
 // Start with the current row position, and find the first row position
 // that satisfies the query.
 
-// TODO: The following line nFirstQueryField is supposed to be used some
-// way. Find out how it's supposed to be used and fix this bug.
+// If the query starts in the same column as the result vector we can
+// prefetch the cell which saves us one fetch in the success case.
+SCCOLROW nFirstQueryField = mpParam-GetEntry(0).nField;
+ScRefCellValue aCell;
 
-// SCCOLROW nFirstQueryField = mpParam-GetEntry(0).nField;
 while (true)
 {
 if (maCurPos.first == mpCells-end() || nRow  mpParam-nRow2)
@@ -396,10 +397,17 @@ bool 
ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value rValue)
 continue;
 }
 
-ScRefCellValue aCell = sc::toRefCell(maCurPos.first, maCurPos.second);
+ScRefCellValue* pCell = NULL;
+if (nCol == static_castSCCOL(nFirstQueryField))
+{
+aCell = sc::toRefCell(maCurPos.first, maCurPos.second);
+pCell = aCell;
+}
 
-if (ScDBQueryDataIterator::IsQueryValid(*mpDoc, *mpParam, nTab, nRow, 
aCell))
+if (ScDBQueryDataIterator::IsQueryValid(*mpDoc, *mpParam, nTab, nRow, 
pCell))
 {
+if (!pCell)
+aCell = sc::toRefCell(maCurPos.first, maCurPos.second);
 switch (aCell.meType)
 {
 case CELLTYPE_VALUE:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-12-11 Thread Kohei Yoshida
 sc/inc/refreshtimerprotector.hxx|3 ++-
 sc/source/filter/excel/xestream.cxx |   14 ++
 sc/source/ui/docshell/docsh.cxx |3 ++-
 sc/source/ui/inc/docsh.hxx  |5 +++--
 4 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 3e2dff3a18e52c153b3bebd2fa0f4aee7f3f671b
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Dec 11 12:19:44 2013 -0500

Let's use a status indicator while exporting to xlsx.

And reduce header dependency on docsh.hxx which a lot of files include
directly or indirectly...

Change-Id: I2de25380f8b634456e0add940fbb775ac11414cd
(cherry picked from commit da1392934e043bfd12b94dab7b874ddf940f097b)

diff --git a/sc/inc/refreshtimerprotector.hxx b/sc/inc/refreshtimerprotector.hxx
index d2169cd..679586d 100644
--- a/sc/inc/refreshtimerprotector.hxx
+++ b/sc/inc/refreshtimerprotector.hxx
@@ -11,10 +11,11 @@
 #define SC_REFRESHTIMERPROTECTOR_HXX
 
 #include sal/config.h
+#include scdllapi.h
 
 class ScRefreshTimerControl;
 
-class ScRefreshTimerProtector
+class SC_DLLPUBLIC ScRefreshTimerProtector
 {
 ScRefreshTimerControl * const * ppControl;
 
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 2232f2c..af7aa78 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -39,6 +39,8 @@
 #include compiler.hxx
 #include formulacell.hxx
 #include tokenarray.hxx
+#include refreshtimerprotector.hxx
+#include globstr.hrc
 
 #include ../../ui/inc/docsh.hxx
 #include ../../ui/inc/viewdata.hxx
@@ -53,6 +55,8 @@
 #include sfx2/objsh.hxx
 #include sfx2/app.hxx
 
+#include com/sun/star/task/XStatusIndicator.hpp
+
 #define DEBUG_XL_ENCRYPTION 0
 
 using ::com::sun::star::embed::XStorage;
@@ -64,6 +68,7 @@ using ::com::sun::star::uno::XInterface;
 using ::utl::OStreamWrapper;
 using ::std::vector;
 
+using namespace com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::lang;
@@ -1089,6 +1094,12 @@ bool XclExpXmlStream::exportDocument() throw()
 {
 ScDocShell* pShell = getDocShell();
 ScDocument* pDoc = pShell-GetDocument();
+ScRefreshTimerProtector aProt(pDoc-GetRefreshTimerControlAddress());
+
+uno::Referencetask::XStatusIndicator xStatusIndicator = 
getStatusIndicator();
+
+xStatusIndicator-start(ScGlobal::GetRscString(STR_SAVE_DOC), 100);
+
 // NOTE: Don't use SotStorage or SvStream any more, and never call
 // SfxMedium::GetOutStream() anywhere in the xlsx export filter code!
 // Instead, write via XOutputStream instance.
@@ -1120,10 +1131,13 @@ bool XclExpXmlStream::exportDocument() throw()
 // destruct at the end of the block
 {
 ExcDocument aDocRoot( aRoot );
+xStatusIndicator-setValue(10);
 aDocRoot.ReadDoc();
+xStatusIndicator-setValue(40);
 aDocRoot.WriteXml( *this );
 }
 
+xStatusIndicator-end();
 mpRoot = NULL;
 return true;
 }
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0760425..1904f1b 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -108,6 +108,7 @@
 
 #include docshimp.hxx
 #include sizedev.hxx
+#include refreshtimerprotector.hxx
 
 #include officecfg/Office/Calc.hxx
 #include comphelper/processfactory.hxx
@@ -3024,7 +3025,7 @@ void ScDocShell::UseSheetSaveEntries()
 ScDocShellModificator::ScDocShellModificator( ScDocShell rDS )
 :
 rDocShell( rDS ),
-aProtector( rDS.GetDocument()-GetRefreshTimerControlAddress() )
+mpProtector(new 
ScRefreshTimerProtector(rDS.GetDocument()-GetRefreshTimerControlAddress()))
 {
 ScDocument* pDoc = rDocShell.GetDocument();
 bAutoCalcShellDisabled = pDoc-IsAutoCalcShellDisabled();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 818a63f..7e10390 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -33,15 +33,16 @@
 #include appoptio.hxx
 #include formulaopt.hxx
 #include shellids.hxx
-#include refreshtimerprotector.hxx
 #include optutil.hxx
 #include docuno.hxx
 
 #include boost/unordered_map.hpp
+#include boost/scoped_ptr.hpp
 #include cppuhelper/implbase1.hxx
 
 #include config_telepathy.h
 
+class ScRefreshTimerProtector;
 class ScEditEngineDefaulter;
 class SfxStyleSheetBasePool;
 class SfxStyleSheetHint;
@@ -462,7 +463,7 @@ SV_IMPL_REF(ScDocShell)
 class SC_DLLPUBLIC ScDocShellModificator
 {
 ScDocShell rDocShell;
-ScRefreshTimerProtector aProtector;
+boost::scoped_ptrScRefreshTimerProtector mpProtector;
 boolbAutoCalcShellDisabled;
 boolbIdleEnabled;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-12-06 Thread Kohei Yoshida
 sc/inc/dpobject.hxx  |6 
 sc/inc/dpoutput.hxx  |   21 -
 sc/source/core/data/dpobject.cxx |  441 +++
 sc/source/core/tool/interpr2.cxx |   23 +-
 4 files changed, 466 insertions(+), 25 deletions(-)

New commits:
commit a125b9da3035a584ffd2203f2b3c71c972b8bd4c
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Dec 6 10:43:38 2013 -0500

fdo#69518: Correctly handle the old constraint syntax.

We apparently support this syntax for ODF-backward compatibility.

To fix this, I resurrected ScDPObject::ParseFilters() which was removed as
unused, adjusted it for the String-OUString change, and changed the filter
data structure to the UNO one rather than using the old one we no longer use
elsewhere.

Change-Id: If52b38aaa1e8b208fb0ef9d92a6e853decdf43e3
(cherry picked from commit 1d85c8df2fb9cb25fc524485339ae9f11e8da676)

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index b2f6e38..1683480 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -183,6 +183,12 @@ public:
 const OUString rDataFieldName,
 std::vectorcom::sun::star::sheet::DataPilotFieldFilter rFilters);
 
+bool ParseFilters(
+OUString rDataFieldName,
+std::vectorcom::sun::star::sheet::DataPilotFieldFilter rFilters,
+std::vectorcom::sun::star::sheet::GeneralFunction rFilterFuncs,
+const OUString rFilterList );
+
 void GetMemberResultNames(ScDPUniqueStringSet rNames, long nDimension);
 
 voidToggleDetails(const 
::com::sun::star::sheet::DataPilotTableHeaderData rElemDesc, ScDPObject* 
pDestObj);
diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx
index 293d937..7b38c7e 100644
--- a/sc/inc/dpoutput.hxx
+++ b/sc/inc/dpoutput.hxx
@@ -41,29 +41,8 @@ namespace com { namespace sun { namespace star { namespace 
sheet {
 
 class Rectangle;
 class ScDocument;
-
 struct ScDPOutLevelData;
 
-
-struct ScDPGetPivotDataField
-{
-OUString maFieldName;
-com::sun::star::sheet::GeneralFunction meFunction;
-
-bool   mbValIsStr;
-OUString maValStr;
-double mnValNum;
-
-ScDPGetPivotDataField() :
-meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
-mbValIsStr( false ),
-mnValNum( 0.0 )
-{
-}
-};
-
-
-
 class ScDPOutput
 {
 private:
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 4dca258..83532e2 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1400,6 +1400,447 @@ void 
ScDPObject::GetMemberResultNames(ScDPUniqueStringSet rNames, long nDimensi
 pOutput-GetMemberResultNames(rNames, nDimension);// used only with 
table data - level not needed
 }
 
+namespace {
+
+bool dequote( const OUString rSource, sal_Int32 nStartPos, sal_Int32 
rEndPos, OUString rResult )
+{
+// nStartPos has to point to opening quote
+
+bool bRet = false;
+const sal_Unicode cQuote = '\'';
+
+if (rSource[nStartPos] == cQuote)
+{
+OUStringBuffer aBuffer;
+sal_Int32 nPos = nStartPos + 1;
+const sal_Int32 nLen = rSource.getLength();
+
+while ( nPos  nLen )
+{
+const sal_Unicode cNext = rSource[nPos];
+if ( cNext == cQuote )
+{
+if (nPos+1  nLen  rSource[nPos+1] == cQuote)
+{
+// double quote is used for an embedded quote
+aBuffer.append( cNext );// append one quote
+++nPos; // skip the next one
+}
+else
+{
+// end of quoted string
+rResult = aBuffer.makeStringAndClear();
+rEndPos = nPos + 1; // behind closing quote
+return true;
+}
+}
+else
+aBuffer.append( cNext );
+
+++nPos;
+}
+// no closing quote before the end of the string - error (bRet still 
false)
+}
+
+return bRet;
+}
+
+struct ScGetPivotDataFunctionEntry
+{
+const sal_Char* pName;
+sheet::GeneralFunction  eFunc;
+};
+
+bool parseFunction( const OUString rList, sal_Int32 nStartPos, sal_Int32 
rEndPos, sheet::GeneralFunction rFunc )
+{
+static const ScGetPivotDataFunctionEntry aFunctions[] =
+{
+// our names
+{ Sum,sheet::GeneralFunction_SUM   },
+{ Count,  sheet::GeneralFunction_COUNT },
+{ Average,sheet::GeneralFunction_AVERAGE   },
+{ Max,sheet::GeneralFunction_MAX   },
+{ Min,sheet::GeneralFunction_MIN   },
+{ Product,sheet::GeneralFunction_PRODUCT   },
+{ CountNums,  sheet::GeneralFunction_COUNTNUMS },
+{ StDev,  sheet::GeneralFunction_STDEV },
+{ StDevp, 

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

2013-12-06 Thread Kohei Yoshida
 sc/inc/dpobject.hxx  |3 ++
 sc/source/core/data/dpobject.cxx |   49 ++-
 2 files changed, 46 insertions(+), 6 deletions(-)

New commits:
commit 4e57eaaaccb114b03849521d5a1a88da4b110236
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Fri Dec 6 19:44:21 2013 -0500

fdo#66984: Define an assignment operator to prevent double deletion.

The code path was assigning one ScDPObject to another via assignment,
but we didn't define one. So we were using the compiler generated
assignment which only shallow-copies data members, which ultimately
caused double-deletion of one of its data members.

Change-Id: Ie98d0789e51aebff683dbcc0e533a9a0a87943d5
(cherry picked from commit bd976e5b070ec68a4f842190db4d0c1ea0e93428)

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 1683480..9bdb123 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -118,11 +118,14 @@ public:
 ScDPObject(const ScDPObject r);
 ~ScDPObject();
 
+ScDPObject operator= (const ScDPObject r);
+
 void EnableGetPivotData(bool b);
 
 voidSetAllowMove(bool bSet);
 
 voidInvalidateData();
+void Clear();
 void ClearTableData();
 void ReloadGroupTableData();
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index cb107ba..e8b384c 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -354,12 +354,34 @@ ScDPObject::ScDPObject(const ScDPObject r) :
 
 ScDPObject::~ScDPObject()
 {
-delete pOutput;
-delete pSaveData;
-delete pSheetDesc;
-delete pImpDesc;
-delete pServDesc;
-ClearTableData();
+Clear();
+}
+
+ScDPObject ScDPObject::operator= (const ScDPObject r)
+{
+Clear();
+
+pDoc = r.pDoc;
+aTableName = r.aTableName;
+aTableTag = r.aTableTag;
+aOutRange = r.aOutRange;
+mnAutoFormatIndex = r.mnAutoFormatIndex;
+nHeaderRows = r.nHeaderRows;
+mbHeaderLayout = r.mbHeaderLayout;
+bAllowMove = false;
+bSettingsChanged = false;
+mbEnableGetPivotData = r.mbEnableGetPivotData;
+
+if (r.pSaveData)
+pSaveData = new ScDPSaveData(*r.pSaveData);
+if (r.pSheetDesc)
+pSheetDesc = new ScSheetSourceDesc(*r.pSheetDesc);
+if (r.pImpDesc)
+pImpDesc = new ScImportSourceDesc(*r.pImpDesc);
+if (r.pServDesc)
+pServDesc = new ScDPServiceDesc(*r.pServDesc);
+
+return *this;
 }
 
 void ScDPObject::EnableGetPivotData(bool b)
@@ -780,6 +802,21 @@ void ScDPObject::InvalidateData()
 bSettingsChanged = true;
 }
 
+void ScDPObject::Clear()
+{
+delete pOutput;
+delete pSaveData;
+delete pSheetDesc;
+delete pImpDesc;
+delete pServDesc;
+pOutput = NULL;
+pSaveData = NULL;
+pSheetDesc = NULL;
+pImpDesc = NULL;
+pServDesc = NULL;
+ClearTableData();
+}
+
 void ScDPObject::ClearTableData()
 {
 ClearSource();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-12-05 Thread Kohei Yoshida
 sc/inc/dputil.hxx|8 +++-
 sc/inc/pivot.hxx |7 +--
 sc/source/core/data/dpobject.cxx |6 ++
 sc/source/core/data/dputil.cxx   |   21 +
 sc/source/core/data/pivot2.cxx   |7 ---
 sc/source/ui/dbgui/pvfundlg.cxx  |   34 +++---
 sc/source/ui/dbgui/pvlaydlg.cxx  |7 +--
 sc/source/ui/inc/pvfundlg.hxx|4 ++--
 8 files changed, 73 insertions(+), 21 deletions(-)

New commits:
commit ba0204675724ada537db63999d73ac8174b24949
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Dec 5 15:37:10 2013 -0500

fdo#69984: Handle duplicate field names correctly.

Duplicate field names are represented in two ways: 1) 'Name' vs 'Name*' in
the UNO part of the pivot engine, and 2) Name,0 vs Name,1 which are a pair
of textural name and a numeric duplicate index in the non-UNO part of the
engine.  But some parts lost this duplicate index information and/or 
confused
the 2 ways of representation.  Hopefully this change will sort things out.

Change-Id: I03ae7b6c011c31ace454679837542d6d0909ecaa
(cherry picked from commit 7e491281d2ba71490fa22cce1e43ba91f60395e3)

diff --git a/sc/inc/dputil.hxx b/sc/inc/dputil.hxx
index 294ca97..e4ed831 100644
--- a/sc/inc/dputil.hxx
+++ b/sc/inc/dputil.hxx
@@ -26,7 +26,13 @@ public:
 
 SC_DLLPUBLIC static OUString getSourceDimensionName(const OUString rName);
 
-static OUString createDuplicateDimensionName(const OUString rOriginal, 
size_t nDupCount);
+/**
+ * Get a duplicate index in case the dimension is a duplicate.  It returns
+ * 0 in case it's an original dimension.
+ */
+sal_uInt8 static getDuplicateIndex(const OUString rName);
+
+SC_DLLPUBLIC static OUString createDuplicateDimensionName(const OUString 
rOriginal, size_t nDupCount);
 
 static OUString getDateGroupName(
 sal_Int32 nDatePart, sal_Int32 nValue, SvNumberFormatter* pFormatter,
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index 6c9b03e..cd74a99 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -51,12 +51,14 @@
 #include com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp
 #include com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp
 
-struct ScDPName
+struct SC_DLLPUBLIC ScDPName
 {
 OUString maName; /// Original name of the dimension.
 OUString maLayoutName;   /// Layout name (display name)
+sal_uInt8 mnDupCount;
 
-explicit ScDPName(const OUString rName, const OUString rLayoutName);
+ScDPName();
+explicit ScDPName(const OUString rName, const OUString rLayoutName, 
sal_uInt8 nDupCount);
 };
 
 struct ScDPLabelData
@@ -69,6 +71,7 @@ struct ScDPLabelData
 sal_uInt16  mnFuncMask; /// Page/Column/Row subtotal function.
 sal_Int32   mnUsedHier; /// Used hierarchy.
 sal_Int32   mnFlags;/// Flags from the DataPilotSource 
dimension
+sal_uInt8   mnDupCount;
 boolmbShowAll:1;/// true = Show all (also empty) 
results.
 boolmbIsValue:1;/// true = Sum or count in data field.
 boolmbDataLayout:1;
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index bab3988..4dca258 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1840,10 +1840,16 @@ bool ScDPObject::FillLabelDataForDimension(
 xDimProp, OUString(SC_UNO_DP_FIELD_SUBTOTALNAME), OUString());
 
 bool bIsValue = true;   //! check
+
+// Name from the UNO dimension object may have trailing '*'s in which
+// case it's a duplicate dimension. Convert that to a duplicate index.
+
+sal_uInt8 nDupCount = ScDPUtil::getDuplicateIndex(aFieldName);
 aFieldName = ScDPUtil::getSourceDimensionName(aFieldName);
 
 rLabelData.maName = aFieldName;
 rLabelData.mnCol = static_castSCCOL(nDim);
+rLabelData.mnDupCount = nDupCount;
 rLabelData.mbDataLayout = bData;
 rLabelData.mbIsValue = bIsValue;
 
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 40cfafb..e21b2a8 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -64,6 +64,27 @@ OUString ScDPUtil::getSourceDimensionName(const OUString 
rName)
 return comphelper::string::stripEnd(rName, '*');
 }
 
+sal_uInt8 ScDPUtil::getDuplicateIndex(const OUString rName)
+{
+// Count all trailing '*'s.
+
+sal_Int32 n = rName.getLength();
+if (!n)
+return 0;
+
+sal_uInt8 nDupCount = 0;
+const sal_Unicode* p = rName.getStr();
+const sal_Unicode* pStart = p;
+p += n-1; // Set it to the last char.
+for (; p != pStart; --p, ++nDupCount)
+{
+if (*p != '*')
+break;
+}
+
+return nDupCount;
+}
+
 OUString ScDPUtil::createDuplicateDimensionName(const OUString rOriginal, 
size_t nDupCount)
 {
 if (!nDupCount)
diff 

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

2013-12-04 Thread Eike Rathke
 sc/inc/scmod.hxx |1 +
 sc/source/ui/app/inputhdl.cxx|   14 ++
 sc/source/ui/app/scmod.cxx   |7 +++
 sc/source/ui/formdlg/formula.cxx |2 +-
 sc/source/ui/inc/inputhdl.hxx|1 +
 5 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 4bea81272d502c044febc419a16c86bbdadf5513
Author: Eike Rathke er...@redhat.com
Date:   Thu Dec 5 01:50:38 2013 +0100

resolved fdo#71667 and fdo#72278, fdo#69971 follow-up fix

a9d85d62a889288b17899c8defc020da487d8b36 used
ScInputHandler::EnterHandler() to reset all sort of things related to
input EditEngine, but that is a handler for Enter and does not enter a
handler and actually attempts to finalize input, which lead to various
unwanted side effects.

Introduced ScInputHandler::InputTurnOffWinEngine() as only the input bar
window EditEngine needs to be reset in the window switching case (which
EnterHandler also does hence it did prevent that bug). The approach
could be polished with further refinement but most importantly fixes the
actual problems now.

Change-Id: I9a0bc452b49ba11a3313cafbc1e5972f41dc65c7
(cherry picked from commit dfd1a47a38dac743f9ed0f1e9507714bac027d35)

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index a871663..5d7572e 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -217,6 +217,7 @@ SC_DLLPUBLICvoidSetAppOptions   ( 
const ScAppOptions rO
 voidInputGetSelection( xub_StrLen rStart, xub_StrLen 
rEnd );
 voidInputSetSelection( xub_StrLen nStart, xub_StrLen nEnd 
);
 voidInputReplaceSelection( const OUString rStr );
+voidInputTurnOffWinEngine();
 OUStringInputGetFormulaStr();
 voidActivateInputWindow( const OUString* pStr = NULL,
 sal_Bool bMatrix = false );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6f901ce..8001e67 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3906,6 +3906,20 @@ void ScInputHandler::InputReplaceSelection( const 
OUString rStr )
 bModified = true;
 }
 
+void ScInputHandler::InputTurnOffWinEngine()
+{
+bInOwnChange = true;// disable ModifyHdl (reset below)
+
+eMode = SC_INPUT_NONE;
+/* TODO: it would be better if there was some way to reset the input bar
+ * engine instead of deleting and having it recreate through
+ * GetFuncEditView(), but first least invasively let this fix fdo#71667 and
+ * fdo#72278 without reintroducing fdo#69971. */
+StopInputWinEngine(true);
+
+bInOwnChange = false;
+}
+
 //
 //  ScInputHdlState
 //
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index b4398e5..7dcbc9f 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1543,6 +1543,13 @@ void ScModule::InputReplaceSelection( const OUString 
rStr )
 pHdl-InputReplaceSelection( rStr );
 }
 
+void ScModule::InputTurnOffWinEngine()
+{
+ScInputHandler* pHdl = GetInputHdl();
+if (pHdl)
+pHdl-InputTurnOffWinEngine();
+}
+
 OUString ScModule::InputGetFormulaStr()
 {
 ScInputHandler* pHdl = GetInputHdl();
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 70571d2..1503a8c 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -623,7 +623,7 @@ void ScFormulaDlg::setCurrentFormula(const OUString 
_sReplacement)
 //ScMultiTextWnd::Paint a new editengine will have been created via
 //GetEditView with its default Modification handler enabled. So ensure
 //its off when we will access it via InputReplaceSelection
-pScMod-InputEnterHandler();
+pScMod-InputTurnOffWinEngine();
 }
 pScMod-InputReplaceSelection(_sReplacement);
 }
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 73e97c4..1c2d9c3 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -233,6 +233,7 @@ public:
 voidInputGetSelection   ( xub_StrLen rStart, xub_StrLen 
rEnd );
 voidInputSetSelection   ( xub_StrLen nStart, xub_StrLen 
nEnd );
 voidInputReplaceSelection   ( const OUString rStr );
+voidInputTurnOffWinEngine();
 
 boolIsFormulaMode() const   { return 
bFormulaMode; }
 ScInputWindow*  GetInputWindow(){ return 
pInputWin; }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-12-03 Thread Eike Rathke
 sc/inc/scmatrix.hxx|2 +-
 sc/source/core/data/validat.cxx|2 +-
 sc/source/core/tool/interpr4.cxx   |2 +-
 sc/source/filter/excel/xeformula.cxx   |6 +++---
 sc/source/filter/excel/xehelper.cxx|2 +-
 sc/source/filter/excel/xilink.cxx  |4 ++--
 sc/source/filter/xml/XMLExportDDELinks.cxx |2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 507afd9531a89e5c8ec07514a8f741ce21a0b78d
Author: Eike Rathke er...@redhat.com
Date:   Wed Dec 4 00:29:29 2013 +0100

resolved fdo#72288 made case insensitive matrix string query work again

The SharedString stored at ScQueryEntry::Item was constructed from an
OUString passed from ScMatrixValue::GetString() so
rItem.maString.getDataIgnoreCase() in QueryEvaluator::compareByString()
was NULL and never evaluated equal. Made ScMatrixValue::GetString()
return a SharedString instead.

Change-Id: I473d5724dfb97707fea58e6b72b1396c049b79c8
(cherry picked from commit 882665d821a2fc705b7ae03372c2ae7593028210)

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index f2508a6..93105dd 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -54,7 +54,7 @@ struct ScMatrixValue
 ScMatValType nType;
 
 /// Only valid if ScMatrix methods indicate so!
-OUString GetString() const { return aStr.getString(); }
+svl::SharedString GetString() const { return aStr; }
 
 /// Only valid if ScMatrix methods indicate that this is no string!
 sal_uInt16 GetError() const { return GetDoubleErrorValue( fVal); }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 0adc60a..b7e51ba 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -731,7 +731,7 @@ bool ScValidationData::GetSelectionFromFormula(
 // strings and empties
 if( ScMatrix::IsNonValueType( nMatVal.nType ) )
 {
-aValStr = nMatVal.GetString();
+aValStr = nMatVal.GetString().getString();
 
 if( NULL != pStrings )
 pEntry = new ScTypedStrData( aValStr, 0.0, 
ScTypedStrData::Standard);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index c70fdf4..6983d3e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1855,7 +1855,7 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef xMat, 
short rRetTypeExpr, sal_
 }
 else
 {
-OUString aStr( nMatVal.GetString());
+svl::SharedString aStr( nMatVal.GetString());
 FormulaTokenRef xRes = new FormulaStringToken( aStr);
 PushTempToken( new ScMatrixCellResultToken( xMat, xRes.get()));
 rRetTypeExpr = NUMBERFORMAT_TEXT;
diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index ba02aef..19040ff 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1319,8 +1319,8 @@ void XclExpFmlaCompImpl::ProcessMatrix( const 
XclExpScToken rTokData )
 }
 else// string or empty
 {
-const OUString rStr = nMatVal.GetString();
-if( rStr.isEmpty() )
+const OUString aStr( nMatVal.GetString().getString());
+if( aStr.isEmpty() )
 {
 AppendExt( EXC_CACHEDVAL_EMPTY );
 AppendExt( 0, 8 );
@@ -1328,7 +1328,7 @@ void XclExpFmlaCompImpl::ProcessMatrix( const 
XclExpScToken rTokData )
 else
 {
 AppendExt( EXC_CACHEDVAL_STRING );
-AppendExt( rStr );
+AppendExt( aStr );
 }
 }
 }
diff --git a/sc/source/filter/excel/xehelper.cxx 
b/sc/source/filter/excel/xehelper.cxx
index c64006a..2e6b4cf 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -1034,7 +1034,7 @@ void XclExpCachedMatrix::Save( XclExpStream rStrm ) const
 }
 else if( ScMatrix::IsNonValueType( nMatVal.nType ) )
 {
-XclExpString aStr( nMatVal.GetString(), EXC_STR_DEFAULT );
+XclExpString aStr( nMatVal.GetString().getString(), 
EXC_STR_DEFAULT );
 rStrm.SetSliceSize( 6 );
 rStrm  EXC_CACHEDVAL_STRING  aStr;
 }
diff --git a/sc/source/filter/excel/xilink.cxx 
b/sc/source/filter/excel/xilink.cxx
index 3a687eb..a33da23 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -517,8 +517,8 @@ bool XclImpExtName::CreateOleData(ScDocument rDoc, const 
OUString rUrl,
 break;
 case SC_MATVAL_STRING:
 

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

2013-11-27 Thread Kohei Yoshida
 sc/inc/document.hxx  |5 +
 sc/source/core/data/column2.cxx  |   14 ++
 sc/source/core/data/document.cxx |5 +
 sc/source/ui/docshell/docsh.cxx  |1 +
 4 files changed, 25 insertions(+)

New commits:
commit 975a9e88d4ad9ebad23e377bb6fc4437186c92e8
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Wed Nov 27 19:43:08 2013 -0500

Clear column data array cache when the document content changes.

Change-Id: I09ffa455e79199e37ca6168753ec9ef4d5aa33dc

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0546ef0..e283b3d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2018,6 +2018,11 @@ public:
 
 formula::VectorRefArray FetchVectorRefArray( const ScAddress rPos, SCROW 
nLength );
 
+/**
+ * Called whenever the value of a cell inside the document is modified.
+ */
+void CellContentModified();
+
 SvtBroadcaster* GetBroadcaster( const ScAddress rPos );
 const SvtBroadcaster* GetBroadcaster( const ScAddress rPos ) const;
 void DeleteBroadcasters( sc::ColumnBlockPosition rBlockPos, const 
ScAddress rTopPos, SCROW nLength );
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 8759c51..a39016a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2862,6 +2862,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const 
double* pResults, size_t nLe
 rCell.ResetDirty();
 rCell.SetChanged(true);
 }
+
+std::vectorSCROW aRows;
+aRows.reserve(nLen);
+for (size_t i = 0; i  nLen; ++i)
+aRows.push_back(nRow+i);
+
+BroadcastCells(aRows, SC_HINT_DATACHANGED);
 }
 
 void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* 
pResults, size_t nLen )
@@ -2888,6 +2895,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const 
formula::FormulaTokenRef* pR
 rCell.ResetDirty();
 rCell.SetChanged(true);
 }
+
+std::vectorSCROW aRows;
+aRows.reserve(nLen);
+for (size_t i = 0; i  nLen; ++i)
+aRows.push_back(nRow+i);
+
+BroadcastCells(aRows, SC_HINT_DATACHANGED);
 }
 
 void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 931994a..2fa2b0e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2313,6 +2313,11 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
 mpDoc-pFormatExchangeList = NULL;
 }
 
+void ScDocument::CellContentModified()
+{
+mpFormulaGroupCxt.reset();
+}
+
 SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress rPos )
 {
 ScTable* pTab = FetchTable(rPos.Tab());
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 98b6be6..0760425 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -3047,6 +3047,7 @@ ScDocShellModificator::~ScDocShellModificator()
 void ScDocShellModificator::SetDocumentModified()
 {
 ScDocument* pDoc = rDocShell.GetDocument();
+pDoc-CellContentModified();
 if ( !pDoc-IsImportingXML() )
 {
 // AutoCalcShellDisabled temporaer restaurieren
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-11-26 Thread Eike Rathke
 sc/inc/tablink.hxx |8 +++-
 sc/source/ui/docshell/arealink.cxx |2 +-
 sc/source/ui/docshell/tablink.cxx  |   18 --
 3 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 1de7d0aba4142424fe0082071a4ac64ec377cea0
Author: Eike Rathke er...@redhat.com
Date:   Wed Nov 27 00:04:44 2013 +0100

resolved fdo#53103 actually use the external data filter options

ScDocShell::ConvertFrom() queries the filter options from the SfxItemSet
at SfxMedium, which is fine when loading the data into the table
selector first, but the final load via ScAreaLink created a bare
SfxMedium without options set. Do so.

Additionally it may now even work that ScDocShell sets options at
SfxMedium, which the ScAreaLink code prepared for but previously the
SfxMedium did not have an SfxItemSet.

Change-Id: I45d6a24906dc3ba41654b8c0951dd84939d8af5e
(cherry picked from commit 513eadd422ff6a41cfe9a16f82cf32872d729652)

diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index aabb2e2..d8d173e 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -72,6 +72,7 @@ public:
 
 class ScDocument;
 class SfxMedium;
+class SfxFilter;
 
 class SC_DLLPUBLIC ScDocumentLoader
 {
@@ -92,7 +93,12 @@ public:
 
 voidReleaseDocRef();// without calling DoClose
 
-static OUString GetOptions( SfxMedium rMedium );
+/** Create SfxMedium for stream read with SfxFilter and filter options set
+at the medium's SfxItemSet.
+ */
+static SfxMedium*   CreateMedium( const OUString rFileName, const 
SfxFilter* pFilter, const OUString rOptions );
+
+static OUString GetOptions( SfxMedium rMedium );
 
 /** Returns the filter name and options from a file name.
 @param bWithContent
diff --git a/sc/source/ui/docshell/arealink.cxx 
b/sc/source/ui/docshell/arealink.cxx
index 2069141..f917e88 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -253,7 +253,7 @@ sal_Bool ScAreaLink::Refresh( const OUString rNewFile, 
const OUString rNewFilt
 if ( rNewFilter != aFilterName )
 aOptions = ;
 
-SfxMedium* pMed = new SfxMedium(aNewUrl, STREAM_STD_READ, pFilter);
+SfxMedium* pMed = ScDocumentLoader::CreateMedium( aNewUrl, pFilter, 
aOptions);
 
 // aRef-DoClose() will be closed explicitly, but it is still more safe to 
use SfxObjectShellLock here
 ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
diff --git a/sc/source/ui/docshell/tablink.cxx 
b/sc/source/ui/docshell/tablink.cxx
index 9085f08..0e89441 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -506,6 +506,17 @@ void ScDocumentLoader::RemoveAppPrefix( OUString 
rFilterName )
 rFilterName = rFilterName.copy( aAppPrefix.getLength());
 }
 
+SfxMedium* ScDocumentLoader::CreateMedium( const OUString rFileName, const 
SfxFilter* pFilter,
+const OUString rOptions )
+{
+// Always create SfxItemSet so ScDocShell can set options.
+SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()-GetPool() );
+if ( !rOptions.isEmpty() )
+pSet-Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
+
+return new SfxMedium( rFileName, STREAM_STD_READ, pFilter, pSet );
+}
+
 ScDocumentLoader::ScDocumentLoader( const OUString rFileName,
 OUString rFilterName, OUString rOptions,
 sal_uInt32 nRekCnt, bool bWithInteraction 
) :
@@ -517,12 +528,7 @@ ScDocumentLoader::ScDocumentLoader( const OUString 
rFileName,
 
 const SfxFilter* pFilter = 
ScDocShell::Factory().GetFilterContainer()-GetFilter4FilterName( rFilterName );
 
-//  ItemSet immer anlegen, damit die DocShell die Optionen setzen kann
-SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()-GetPool() );
-if ( !rOptions.isEmpty() )
-pSet-Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
-
-pMedium = new SfxMedium( rFileName, STREAM_STD_READ, pFilter, pSet );
+pMedium = CreateMedium( rFileName, pFilter, rOptions);
 if ( pMedium-GetError() != ERRCODE_NONE )
 return ;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits