[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-06-26 Thread Petr Mladek
 sc/inc/attarray.hxx|2 +-
 sc/inc/column.hxx  |2 +-
 sc/inc/document.hxx|1 -
 sc/inc/table.hxx   |2 +-
 sc/source/core/data/attarray.cxx   |4 ++--
 sc/source/core/data/column2.cxx|4 ++--
 sc/source/core/data/document.cxx   |   13 -
 sc/source/core/data/table1.cxx |4 ++--
 sc/source/filter/excel/xetable.cxx |2 +-
 9 files changed, 10 insertions(+), 24 deletions(-)

New commits:
commit e5f690b3711b61c05671d46d19439dd1100f4bff
Author: Petr Mladek pmla...@suse.cz
Date:   Tue Jun 26 11:16:59 2012 +0200

Revert export all style information to xls/xlsx, fdo#46738

It caused huge slow down and even errors when exporting XLS (fdo#49582).
The original problem was less serious because it was old regression
from LO-3.3. There is not easy fix.

= reverting is the best solution according to Markus.

This reverts commit 6c6a4ed070acc0b106e951864fa5d20927f5c1e0.

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 27a086e..b58472e 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -175,7 +175,7 @@ public:
 boolIsEmpty() const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea = false ) const;
+boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleEqual( const ScAttrArray rOther,
 SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 313dcd6..f86bf9b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -183,7 +183,7 @@ public:
 boolHasSelectionMatrixFragment(const ScMarkData rMark) const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow, bool bFullFormattedArea = 
false ) const;
+boolGetLastVisibleAttr( SCROW rLastRow ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleAttrEqual( const ScColumn rCol, SCROW nStartRow = 0,
 SCROW nEndRow = MAXROW ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6167634..50bcd27 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -940,7 +940,6 @@ public:
 SCCOL rEndCol, SCROW rEndRow, bool 
bIncludeOld, bool bOnlyDown ) const;
 SC_DLLPUBLIC bool   GetCellArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow ) const;
 SC_DLLPUBLIC bool   GetTableArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow ) const;
-SC_DLLPUBLIC void   GetFormattedAndUsedArea( SCTAB nTab, SCCOL 
rEndCol, SCROW rEndRow ) const;
 SC_DLLPUBLIC bool   GetPrintArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow,
 bool bNotes = true ) const;
 SC_DLLPUBLIC bool   GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, 
SCROW nEndRow,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 10775e2..4f1fe38 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -405,7 +405,7 @@ public:
 
 boolGetCellArea( SCCOL rEndCol, SCROW rEndRow ) const;   
 // FALSE = empty
 boolGetTableArea( SCCOL rEndCol, SCROW rEndRow ) const;
-boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes, 
bool bFullFormattedArea = false ) const;
+boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes ) 
const;
 boolGetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
 SCCOL rEndCol, bool bNotes ) const;
 boolGetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 5714e7c..2aa660a 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1831,7 +1831,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW rFirstRow ) 
const
 
 const SCROW SC_VISATTR_STOP = 84;
 
-bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea ) const
+bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const
 {
 //  #i30830# changed behavior:
 //  ignore all attributes starting with the first run of SC_VISATTR_STOP 
equal rows
@@ -1862,7 +1862,7 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, 
SCROW nLastData, bool bFu
 if ( nAttrStartRow = nLastData )
 nAttrStartRow = nLastData + 1;
 SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow;
-if ( nAttrSize = SC_VISATTR_STOP  !bFullFormattedArea )
+if ( nAttrSize = SC_VISATTR_STOP )
 {
 bFound = false;// ignore this range and below
 }
diff --git 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-04-19 Thread Eike Rathke
 sc/inc/compiler.hxx  |9 ++-
 sc/inc/rangenam.hxx  |6 ++--
 sc/source/core/data/table1.cxx   |   10 ---
 sc/source/core/tool/compiler.cxx |   50 +++
 sc/source/core/tool/rangenam.cxx |   10 +++
 5 files changed, 42 insertions(+), 43 deletions(-)

New commits:
commit 9a9121929408e8ffc86b91606355ff5fe9514f7d
Author: Eike Rathke er...@redhat.com
Date:   Fri Apr 20 00:20:29 2012 +0200

resolved fdo#48856 update sheet-local named expressions correctly

This combines from master:

44481da569df85aa91455fdc2892a4e0c5818e6c
Author: Markus Mohrhard markus.mohrh...@googlemail.com

update relative local range names, fdo#48856

Signed-off-by: Eike Rathke er...@redhat.com


409f11ae387c859dcf9275c08093649a676e1f9e
Author: Eike Rathke er...@redhat.com

fdo#48856 update sheet-local named expressions correctly

* Named expression must be updated before any formulas that would access 
them.
* Handle all ocName tokens differentiating between global and sheet-local
  names.

Signed-off-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 371192c..765187e 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -364,6 +364,13 @@ private:
 
 void SetRelNameReference();
 
+/** Obtain range data for ocName token, global or sheet local.
+
+Prerequisite: rToken is a FormulaIndexToken so IsGlobal() and
+GetIndex() can be called on it. We don't check with RTTI.
+ */
+ScRangeData* GetRangeData( const formula::FormulaToken pToken ) const;
+
 static void InitCharClassEnglish();
 
 public:
@@ -442,7 +449,7 @@ public:
 bool UpdateNameReference( UpdateRefMode eUpdateRefMode,
   const ScRange,
   SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
-  bool rChanged, bool bSharedFormula = false);
+  bool rChanged, bool bSharedFormula = false, 
bool bLocal = false);
 
 ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode,
   const ScAddress rOldPos, const ScRange,
diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 53e9ec8..e2bf10b 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -140,7 +140,7 @@ public:
 const formula::FormulaGrammar::Grammar 
eGrammar = formula::FormulaGrammar::GRAM_DEFAULT );
 voidUpdateReference( UpdateRefMode eUpdateRefMode,
  const ScRange r,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal = 
false );
 boolIsModified() const  { return bModified; }
 
 SC_DLLPUBLIC void   GuessPosition();
@@ -203,9 +203,9 @@ public:
 SC_DLLPUBLIC const ScRangeData* findByRange(const ScRange rRange) const;
 SC_DLLPUBLIC ScRangeData* findByUpperName(const rtl::OUString rName);
 SC_DLLPUBLIC const ScRangeData* findByUpperName(const rtl::OUString 
rName) const;
-SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i);
+SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i) const;
 void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange rRange,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz);
+ SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bLocal = 
false);
 void UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable = 0, 
SCTAB nNewSheets = 1);
 void UpdateTranspose(const ScRange rSource, const ScAddress rDest);
 void UpdateGrow(const ScRange rArea, SCCOL nGrowX, SCROW nGrowY);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 31c3f46..76f371b 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1317,16 +1317,18 @@ void ScTable::UpdateReference( UpdateRefMode 
eUpdateRefMode, SCCOL nCol1, SCROW
 i = 0;
 iMax = MAXCOL;
 }
-for ( ; i=iMax; i++)
-bUpdated |= aCol[i].UpdateReference(
-eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, 
nDy, nDz, pUndoDoc );
 
+// Named expressions need to be updated before formulas acessing them.
 if (mpRangeName)
 {
 ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );;
-mpRangeName-UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
+mpRangeName-UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz, 
true );
 }
 
+for ( ; i=iMax; i++)
+bUpdated |= aCol[i].UpdateReference(
+eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, 
nDy, nDz, pUndoDoc );
+
 if ( bIncludeDraw )
 UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2, nDx, nDy, nDz, bUpdateNoteCaptionPos 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-03-27 Thread Noel Power
 sc/inc/attarray.hxx|2 +-
 sc/inc/column.hxx  |2 +-
 sc/inc/document.hxx|1 +
 sc/inc/table.hxx   |2 +-
 sc/source/core/data/attarray.cxx   |4 ++--
 sc/source/core/data/column2.cxx|4 ++--
 sc/source/core/data/document.cxx   |   13 +
 sc/source/core/data/table1.cxx |4 ++--
 sc/source/filter/excel/xetable.cxx |2 +-
 9 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 6c6a4ed070acc0b106e951864fa5d20927f5c1e0
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Mar 27 05:14:06 2012 +0200

export all style information to xls/xlsx, fdo#46738

Fixes that if more than 84 empty but formatted rows at the end of a file
have been found the export skipped those rows.

Signed-off-by: Noel Power noel.po...@novell.com

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index b58472e..27a086e 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -175,7 +175,7 @@ public:
 boolIsEmpty() const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const;
+boolGetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea = false ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleEqual( const ScAttrArray rOther,
 SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index f86bf9b..313dcd6 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -183,7 +183,7 @@ public:
 boolHasSelectionMatrixFragment(const ScMarkData rMark) const;
 
 boolGetFirstVisibleAttr( SCROW rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW rLastRow ) const;
+boolGetLastVisibleAttr( SCROW rLastRow, bool bFullFormattedArea = 
false ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleAttrEqual( const ScColumn rCol, SCROW nStartRow = 0,
 SCROW nEndRow = MAXROW ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 50bcd27..6167634 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -940,6 +940,7 @@ public:
 SCCOL rEndCol, SCROW rEndRow, bool 
bIncludeOld, bool bOnlyDown ) const;
 SC_DLLPUBLIC bool   GetCellArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow ) const;
 SC_DLLPUBLIC bool   GetTableArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow ) const;
+SC_DLLPUBLIC void   GetFormattedAndUsedArea( SCTAB nTab, SCCOL 
rEndCol, SCROW rEndRow ) const;
 SC_DLLPUBLIC bool   GetPrintArea( SCTAB nTab, SCCOL rEndCol, 
SCROW rEndRow,
 bool bNotes = true ) const;
 SC_DLLPUBLIC bool   GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, 
SCROW nEndRow,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 4f1fe38..10775e2 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -405,7 +405,7 @@ public:
 
 boolGetCellArea( SCCOL rEndCol, SCROW rEndRow ) const;   
 // FALSE = empty
 boolGetTableArea( SCCOL rEndCol, SCROW rEndRow ) const;
-boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes ) 
const;
+boolGetPrintArea( SCCOL rEndCol, SCROW rEndRow, bool bNotes, 
bool bFullFormattedArea = false ) const;
 boolGetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
 SCCOL rEndCol, bool bNotes ) const;
 boolGetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 2aa660a..5714e7c 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1831,7 +1831,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW rFirstRow ) 
const
 
 const SCROW SC_VISATTR_STOP = 84;
 
-bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData ) const
+bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, SCROW nLastData, bool 
bFullFormattedArea ) const
 {
 //  #i30830# changed behavior:
 //  ignore all attributes starting with the first run of SC_VISATTR_STOP 
equal rows
@@ -1862,7 +1862,7 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW rLastRow, 
SCROW nLastData ) const
 if ( nAttrStartRow = nLastData )
 nAttrStartRow = nLastData + 1;
 SCROW nAttrSize = pData[nEndPos].nRow + 1 - nAttrStartRow;
-if ( nAttrSize = SC_VISATTR_STOP )
+if ( nAttrSize = SC_VISATTR_STOP  !bFullFormattedArea )
 {
 bFound = false;// ignore this range and below
 }
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 22d3da4..95b6cf8 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1443,14 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-24 Thread Petr Mladek
 sc/inc/dpobject.hxx  |7 ++
 sc/source/core/data/dpobject.cxx |  121 +--
 2 files changed, 124 insertions(+), 4 deletions(-)

New commits:
commit a0dc477bfa4460a3091e533eed57fae93f481d5a
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Jan 23 16:34:15 2012 -0500

Fix refresh problem on pivot tables whose data cache have not been created.

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 47c1999..2d8991a 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -330,6 +330,7 @@ public:
 ScDocument* mpDoc;
 public:
 DBCaches(ScDocument* pDoc);
+bool hasCache(sal_Int32 nSdbType, const rtl::OUString rDBName, const 
rtl::OUString rCommand) const;
 const ScDPCache* getCache(sal_Int32 nSdbType, const ::rtl::OUString 
rDBName, const ::rtl::OUString rCommand);
 size_t size() const;
 
@@ -386,6 +387,12 @@ private:
 /** Only to be called from ScDPCache::RemoveReference(). */
 void RemoveCache(const ScDPCache* pCache);
 
+void GetAllTables(const ScRange rSrcRange, std::setScDPObject* rRefs) 
const;
+void GetAllTables(const rtl::OUString rSrcName, std::setScDPObject* 
rRefs) const;
+void GetAllTables(
+sal_Int32 nSdbType, const ::rtl::OUString rDBName, const 
::rtl::OUString rCommand,
+std::setScDPObject* rRefs) const;
+
 private:
 typedef ::boost::ptr_vectorScDPObject TablesType;
 
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 3113f1b..ba7af2e 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2706,6 +2706,13 @@ bool ScDPCollection::DBType::less::operator() (const 
DBType left, const DBType
 
 ScDPCollection::DBCaches::DBCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
 
+bool ScDPCollection::DBCaches::hasCache(sal_Int32 nSdbType, const OUString 
rDBName, const OUString rCommand) const
+{
+DBType aType(nSdbType, rDBName, rCommand);
+CachesType::const_iterator itr = maCaches.find(aType);
+return itr != maCaches.end();
+}
+
 const ScDPCache* ScDPCollection::DBCaches::getCache(sal_Int32 nSdbType, const 
OUString rDBName, const OUString rCommand)
 {
 DBType aType(nSdbType, rDBName, rCommand);
@@ -2911,13 +2918,27 @@ sal_uLong ScDPCollection::ReloadCache(ScDPObject* 
pDPObj, std::setScDPObject*
 {
 // cache by named range
 ScDPCollection::NameCaches rCaches = GetNameCaches();
-rCaches.updateCache(pDesc-GetRangeName(), 
pDesc-GetSourceRange(), rRefs);
+if (rCaches.hasCache(pDesc-GetRangeName()))
+rCaches.updateCache(pDesc-GetRangeName(), 
pDesc-GetSourceRange(), rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this named
+// range as data source.
+GetAllTables(pDesc-GetRangeName(), rRefs);
+}
 }
 else
 {
 // cache by cell range
 ScDPCollection::SheetCaches rCaches = GetSheetCaches();
-rCaches.updateCache(pDesc-GetSourceRange(), rRefs);
+if (rCaches.hasCache(pDesc-GetSourceRange()))
+rCaches.updateCache(pDesc-GetSourceRange(), rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this range as
+// data source.
+GetAllTables(pDesc-GetSourceRange(), rRefs);
+}
 }
 }
 else if (pDPObj-IsImportData())
@@ -2928,8 +2949,15 @@ sal_uLong ScDPCollection::ReloadCache(ScDPObject* 
pDPObj, std::setScDPObject*
 return STR_ERR_DATAPILOTSOURCE;
 
 ScDPCollection::DBCaches rCaches = GetDBCaches();
-rCaches.updateCache(
-pDesc-GetCommandType(), pDesc-aDBName, pDesc-aObject, rRefs);
+if (rCaches.hasCache(pDesc-GetCommandType(), pDesc-aDBName, 
pDesc-aObject))
+rCaches.updateCache(
+pDesc-GetCommandType(), pDesc-aDBName, pDesc-aObject, 
rRefs);
+else
+{
+// Not cached yet.  Collect all tables that use this range as
+// data source.
+GetAllTables(pDesc-GetCommandType(), pDesc-aDBName, 
pDesc-aObject, rRefs);
+}
 }
 return 0;
 }
@@ -3155,6 +3183,91 @@ void ScDPCollection::RemoveCache(const ScDPCache* pCache)
 return;
 }
 
+void ScDPCollection::GetAllTables(const ScRange rSrcRange, 
std::setScDPObject* rRefs) const
+{
+std::setScDPObject* aRefs;
+TablesType::const_iterator it = maTables.begin(), itEnd = maTables.end();
+for (; it != itEnd; ++it)
+{
+const ScDPObject rObj = *it;
+if (!rObj.IsSheetData())
+// Source is not a sheet range.
+continue;
+
+const ScSheetSourceDesc* pDesc = rObj.GetSheetDesc();
+if (!pDesc)
+continue;
+
+if 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-20 Thread Kohei Yoshida
 sc/inc/rangenam.hxx  |2 +-
 sc/source/core/tool/rangenam.cxx |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4a00c3d74cd2d0d9905224b8f781dcb8d2ff3f1e
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Sat Jan 21 00:08:29 2012 -0500

fdo#44831: Named range should overwrite existing name.

When inserting a new named range, it should overwrite any existing
name if one exists.  That was the old behavior in 3.3 prior to my
range name rework, and because of ptr_map not overwriting existing
key, that behavior had changed unintentionally.

Let's revert to the old behavior.

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index 0e8de43..ce0e208 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -222,7 +222,7 @@ public:
 SC_DLLPUBLIC size_t size() const;
 bool empty() const;
 
-/** Insert object into set if not a duplicate.
+/** Insert object into set.
 @ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes
 ownership of p and if it can't insert it deletes the object! So, if
 this insert here returns false the object where p pointed to is gone!
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 8ebcc76..214c17b 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,6 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
 }
 
 rtl::OUString aName(p-GetUpperName());
+maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
 pairDataType::iterator, bool r = maData.insert(aName, p);
 if (r.second)
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-20 Thread Kohei Yoshida
 sc/inc/rangenam.hxx  |1 +
 sc/source/core/tool/rangenam.cxx |9 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 8a449369b50db65423d709000891fec25d9dba54
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Sat Jan 21 01:08:32 2012 -0500

Oops I shouldn't have erased names directly.

We always need to remove the index map when removing a name.

diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx
index ce0e208..53e9ec8 100644
--- a/sc/inc/rangenam.hxx
+++ b/sc/inc/rangenam.hxx
@@ -230,6 +230,7 @@ public:
 SC_DLLPUBLIC bool insert(ScRangeData* p);
 
 void erase(const ScRangeData r);
+void erase(const rtl::OUString rName);
 
 /**
  * Erase by iterator position.  Note that this method doesn't check for
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 214c17b..ed8b5d3 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -894,7 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
 }
 
 rtl::OUString aName(p-GetUpperName());
-maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
+erase(aName); // ptr_map won't insert it if a duplicate name exists.
 pairDataType::iterator, bool r = maData.insert(aName, p);
 if (r.second)
 {
@@ -909,7 +909,12 @@ bool ScRangeName::insert(ScRangeData* p)
 
 void ScRangeName::erase(const ScRangeData r)
 {
-DataType::iterator itr = maData.find(r.GetUpperName());
+erase(r.GetUpperName());
+}
+
+void ScRangeName::erase(const rtl::OUString rName)
+{
+DataType::iterator itr = maData.find(rName);
 if (itr != maData.end())
 erase(itr);
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-11 Thread Kohei Yoshida
 sc/inc/dpobject.hxx  |8 ++-
 sc/source/core/data/dpobject.cxx |  100 +++
 2 files changed, 99 insertions(+), 9 deletions(-)

New commits:
commit 1e88cd643a5959271f28eaaab3d14488374df11f
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Wed Jan 11 15:24:52 2012 -0500

fdo#44661: Properly update range keys for pivot cache.

When the internal data source range gets modified, we should also
update the affected range keys that are used to look up pivot caches.

Otherwise we'll end up creating a brand new cache, without removing
the old one that's no longer referenced.

diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index cc73fcb..db8ea92 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -259,12 +259,18 @@ public:
 class SheetCaches
 {
 friend class ScDPCollection;
-typedef ::boost::ptr_mapScRange, ScDPCache CachesType;
+typedef boost::ptr_mapsize_t, ScDPCache CachesType;
+typedef std::vectorScRange RangeIndexType;
 CachesType maCaches;
+RangeIndexType maRanges;
 ScDocument* mpDoc;
 public:
 SheetCaches(ScDocument* pDoc);
 const ScDPCache* getCache(const ScRange rRange);
+
+void updateReference(
+UpdateRefMode eMode, const ScRange r, SCsCOL nDx, SCsROW nDy, 
SCsTAB nDz);
+
 private:
 void removeCache(const ScRange rRange);
 };
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 51be02d..b0bbace 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2459,27 +2459,108 @@ uno::Referencesheet::XDimensionsSupplier 
ScDPObject::CreateSource( const ScDPS
 
 ScDPCollection::SheetCaches::SheetCaches(ScDocument* pDoc) : mpDoc(pDoc) {}
 
+namespace {
+
+struct FindInvalidRange : public std::unary_functionScRange, bool
+{
+bool operator() (const ScRange r) const
+{
+return !r.IsValid();
+}
+};
+
+}
+
 const ScDPCache* ScDPCollection::SheetCaches::getCache(const ScRange rRange)
 {
-CachesType::const_iterator itr = maCaches.find(rRange);
-if (itr != maCaches.end())
-// already cached.
-return itr-second;
+RangeIndexType::iterator it = std::find(maRanges.begin(), maRanges.end(), 
rRange);
+if (it != maRanges.end())
+{
+// Already cached.
+size_t nIndex = std::distance(maRanges.begin(), it);
+CachesType::iterator itCache = maCaches.find(nIndex);
+if (itCache == maCaches.end())
+// cache pool and index pool out-of-sync !!!
+return NULL;
 
+return itCache-second;
+}
+
+// Not cached.  Create a new cache.
 SAL_WNODEPRECATED_DECLARATIONS_PUSH
 ::std::auto_ptrScDPCache pCache(new ScDPCache(mpDoc));
 SAL_WNODEPRECATED_DECLARATIONS_POP
 pCache-InitFromDoc(mpDoc, rRange);
+
+// Get the smallest available range index.
+it = std::find_if(maRanges.begin(), maRanges.end(), FindInvalidRange());
+
+size_t nIndex = maRanges.size();
+if (it == maRanges.end())
+{
+// All range indices are valid.  Append a new index.
+maRanges.push_back(rRange);
+}
+else
+{
+// Slot with invalid range.  Re-use this slot.
+*it = rRange;
+nIndex = std::distance(maRanges.begin(), it);
+}
+
 const ScDPCache* p = pCache.get();
-maCaches.insert(rRange, pCache);
+maCaches.insert(nIndex, pCache);
 return p;
 }
 
+void ScDPCollection::SheetCaches::updateReference(
+UpdateRefMode eMode, const ScRange r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz)
+{
+if (maRanges.empty())
+// No caches.
+return;
+
+RangeIndexType::iterator it = maRanges.begin(), itEnd = maRanges.end();
+for (; it != itEnd; ++it)
+{
+const ScRange rKeyRange = *it;
+SCCOL nCol1 = rKeyRange.aStart.Col();
+SCROW nRow1 = rKeyRange.aStart.Row();
+SCTAB nTab1 = rKeyRange.aStart.Tab();
+SCCOL nCol2 = rKeyRange.aEnd.Col();
+SCROW nRow2 = rKeyRange.aEnd.Row();
+SCTAB nTab2 = rKeyRange.aEnd.Tab();
+
+ScRefUpdateRes eRes = ScRefUpdate::Update(
+mpDoc, eMode,
+r.aStart.Col(), r.aStart.Row(), r.aStart.Tab(),
+r.aEnd.Col(), r.aEnd.Row(), r.aEnd.Tab(), nDx, nDy, nDz,
+nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
+
+if (eRes != UR_NOTHING)
+{
+// range updated.
+ScRange aNew(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
+*it = aNew;
+}
+}
+}
+
 void ScDPCollection::SheetCaches::removeCache(const ScRange rRange)
 {
-CachesType::iterator itr = maCaches.find(rRange);
-if (itr != maCaches.end())
-maCaches.erase(itr);
+RangeIndexType::iterator it = std::find(maRanges.begin(), maRanges.end(), 
rRange);
+if (it == maRanges.end())
+// Not cached.  Nothing to do.
+return;
+
+  

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-09 Thread Kohei Yoshida
 sc/inc/dbdata.hxx|1 +
 sc/inc/document.hxx  |2 --
 sc/source/core/data/documen3.cxx |8 
 sc/source/core/data/table2.cxx   |3 ++-
 sc/source/core/tool/dbdata.cxx   |   17 -
 5 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit d710f11d76cd8728980824db1518d4d20e649727
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Mon Jan 9 12:03:48 2012 -0500

fdo#44545: Skip filtered cells during auto-fill.

Regression from 3.4.5.

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 1aab271..cef02e1 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -213,6 +213,7 @@ public:
 const_iterator end() const;
 const ScDBData* findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bStartOnly) const;
 const ScDBData* findByRange(const ScRange rRange) const;
+const ScDBData* findByTable(SCTAB nTab) const;
 ScDBData* getByRange(const ScRange rRange);
 void insert(ScDBData* p);
 void erase(iterator itr);
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 83ad4a1..50bcd27 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -493,8 +493,6 @@ public:
 ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bStartOnly = false);
 const ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2) const;
 ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2);
-const ScDBData* GetFilterDBAtTable(SCTAB nTab) const;
-
 
 SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange rBlock, 
rtl::OUString* pName=NULL ) const;
 
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 63d926a..66973de 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -311,14 +311,6 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, 
SCROW nRow1, SCCOL nC
 return NULL;
 }
 
-const ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const
-{
-if (pDBCollection)
-return pDBCollection-GetFilterDBAtTable(nTab);
-else
-return NULL;
-}
-
 ScDPCollection* ScDocument::GetDPCollection()
 {
 if (!pDPCollection)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index d070bf7..f13ed5b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2653,7 +2653,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool 
bShow)
 bool ScTable::IsDataFiltered() const
 {
 bool bAnyQuery = false;
-const ScDBData* pDBData = pDocument-GetFilterDBAtTable(nTab);
+const ScDBCollection* pDBs = pDocument-GetDBCollection();
+const ScDBData* pDBData = pDBs-GetFilterDBAtTable(nTab);
 if ( pDBData )
 {
 ScQueryParam aParam;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 3cc4146..9c5d03b 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -808,6 +808,13 @@ const ScDBData* ScDBCollection::AnonDBs::findByRange(const 
ScRange rRange) cons
 return itr == maDBs.end() ? NULL : (*itr);
 }
 
+const ScDBData* ScDBCollection::AnonDBs::findByTable(SCTAB nTab) const
+{
+DBsType::const_iterator itr = find_if(
+maDBs.begin(), maDBs.end(), FindFilterDBByTable(nTab));
+return itr == maDBs.end() ? NULL : (*itr);
+}
+
 ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange rRange)
 {
 const ScDBData* pData = findByRange(rRange);
@@ -972,7 +979,15 @@ const ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB 
nTab) const
 NamedDBs::DBsType::const_iterator itr = find_if(
 maNamedDBs.begin(), maNamedDBs.end(), FindFilterDBByTable(nTab));
 
-return itr == maNamedDBs.end() ? NULL : (*itr);
+const ScDBData* pData = itr == maNamedDBs.end() ? NULL : (*itr);
+if (pData)
+return pData;
+
+pData = pDoc-GetAnonymousDBData(nTab);
+if (pData)
+return pData;
+
+return getAnonDBs().findByTable(nTab);
 }
 
 void ScDBCollection::DeleteOnTab( SCTAB nTab )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2012-01-06 Thread Kohei Yoshida
 sc/inc/userdat.hxx   |4 +++-
 sc/source/core/data/drwlayer.cxx |   11 +--
 sc/source/core/data/postit.cxx   |2 +-
 sc/source/core/data/userdat.cxx  |2 +-
 sc/source/core/tool/detfunc.cxx  |1 +
 sc/source/ui/view/drawvie3.cxx   |2 +-
 6 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 753259a6b5a1b9ac4a270d4a38c7111714b9
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Fri Jan 6 16:24:07 2012 -0500

Fix re-calculation of the position of circular drawing objects.

Cell-anchored circular drawing objects would get distorted whenever
its bounding rectangle changes, either via insertion / removal of
columns / rows, or changing the row height / column width.

This commit fixes it by differentiating the validation circles, which
needs its own re-calc algorithm, from the normal circular drawing
objects.

diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index 259e99d..ed6adc2 100644
--- a/sc/inc/userdat.hxx
+++ b/sc/inc/userdat.hxx
@@ -59,11 +59,13 @@ public:
 class ScDrawObjData : public SdrObjUserData
 {
 public:
+enum Type { CellNote, ValidationCircle, DrawingObject };
+
 ScAddress   maStart;
 ScAddress   maEnd;
 Point   maStartOffset;
 Point   maEndOffset;
-boolmbNote;
+TypemeType;
 Rectangle   maLastRect;
 
 explicitScDrawObjData();
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 2e2d00a..91820f4 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -610,7 +610,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 if( !pDoc )
 return;
 
-if( rData.mbNote )
+if (rData.meType == ScDrawObjData::CellNote)
 {
 OSL_ENSURE( rData.maStart.IsValid(), ScDrawLayer::RecalcPos - invalid 
position for cell note );
 /*  #i109372# On insert/remove rows/columns/cells: Updating the caption
@@ -636,13 +636,12 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, 
ScDrawObjData rData, bool bNegati
 SCROW nRow2 = rData.maEnd.Row();
 SCTAB nTab2 = rData.maEnd.Tab();
 
-// validation circle
-bool bCircle = pObj-ISA( SdrCircObj );
 // detective arrow
 bool bArrow = pObj-IsPolyObj()  (pObj-GetPointCount() == 2);
 
-if( bCircle )
+if (rData.meType == ScDrawObjData::ValidationCircle)
 {
+// Validation circle for detective.
 rData.maLastRect = pObj-GetLogicRect();
 
 Point aPos( pDoc-GetColOffset( nCol1, nTab1 ), pDoc-GetRowOffset( 
nRow1, nTab1 ) );
@@ -1835,13 +1834,13 @@ ScDrawObjData* ScDrawLayer::GetObjDataTab( SdrObject* 
pObj, SCTAB nTab )
 bool ScDrawLayer::IsNoteCaption( SdrObject* pObj )
 {
 ScDrawObjData* pData = pObj ? GetObjData( pObj ) : 0;
-return pData  pData-mbNote;
+return pData  pData-meType == ScDrawObjData::CellNote;
 }
 
 ScDrawObjData* ScDrawLayer::GetNoteCaptionData( SdrObject* pObj, SCTAB nTab )
 {
 ScDrawObjData* pData = pObj ? GetObjDataTab( pObj, nTab ) : 0;
-return (pData  pData-mbNote) ? pData : 0;
+return (pData  pData-meType == ScDrawObjData::CellNote) ? pData : 0;
 }
 
 ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index a8881c0..04001c3 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -109,7 +109,7 @@ void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj 
rCaption, const ScAddress
 ScDrawObjData* pObjData = ScDrawLayer::GetObjData( rCaption, true );
 OSL_ENSURE( pObjData, ScCaptionUtil::SetCaptionUserData - missing drawing 
object user data );
 pObjData-maStart = rPos;
-pObjData-mbNote = true;
+pObjData-meType = ScDrawObjData::CellNote;
 }
 
 void ScCaptionUtil::SetDefaultItems( SdrCaptionObj rCaption, ScDocument rDoc 
)
diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx
index 2b2db80..6947634 100644
--- a/sc/source/core/data/userdat.cxx
+++ b/sc/source/core/data/userdat.cxx
@@ -70,7 +70,7 @@ ScDrawObjData::ScDrawObjData() :
 SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ),
 maStart( ScAddress::INITIALIZE_INVALID ),
 maEnd( ScAddress::INITIALIZE_INVALID ),
-mbNote( false )
+meType( DrawingObject )
 {
 }
 
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 567ba49..ebf9ef8 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -681,6 +681,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, 
ScDetectiveData rData
 ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, sal_True );
 pData-maStart.Set( nCol, nRow, nTab);
 pData-maEnd.SetInvalid();
+pData-meType = ScDrawObjData::ValidationCircle;
 
 Modified();
 }
diff --git a/sc/source/ui/view/drawvie3.cxx 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2011-12-13 Thread Kohei Yoshida
 sc/inc/column.hxx  |6 +++---
 sc/source/core/data/table6.cxx |9 -
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 9aee78bf2683d8acdaf0c35bc35a12e726d61706
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Tue Dec 13 10:51:41 2011 -0500

fdo#39917: Use correct address convention during search and replace.

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index c6346f6..f86bf9b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -246,9 +246,9 @@ public:
 bool   HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW 
rFirst) const;
 
 // TRUE = format for numbers is set
-bool   SetString( SCROW nRow, SCTAB nTab, const String 
rString,
-   formula::FormulaGrammar::AddressConvention conv = 
formula::FormulaGrammar::CONV_OOO,
-   ScSetStringParam* pParam = NULL );
+bool SetString(
+SCROW nRow, SCTAB nTab, const String rString, 
formula::FormulaGrammar::AddressConvention eConv,
+ScSetStringParam* pParam = NULL );
 voidSetValue( SCROW nRow, const double rVal);
 voidSetError( SCROW nRow, const sal_uInt16 nError);
 
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 9bc4a58..55ac066 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -82,8 +82,7 @@ bool ScTable::SearchCell(const SvxSearchItem rSearchItem, 
SCCOL nCol, SCROW nRo
 case SVX_SEARCHIN_FORMULA:
 {
 if ( eCellType == CELLTYPE_FORMULA )
-((ScFormulaCell*)pCell)-GetFormula( aString,
-   formula::FormulaGrammar::GRAM_NATIVE_UI);
+static_castScFormulaCell*(pCell)-GetFormula(aString, 
pDocument-GetGrammar());
 else if ( eCellType == CELLTYPE_EDIT )
 bMultiLine = lcl_GetTextWithBreaks(
 *(const ScEditCell*)pCell, pDocument, aString );
@@ -239,7 +238,7 @@ bool ScTable::SearchCell(const SvxSearchItem rSearchItem, 
SCCOL nCol, SCROW nRo
 }
 ScAddress aAdr( nCol, nRow, nTab );
 ScFormulaCell* pFCell = new ScFormulaCell( pDocument, aAdr,
-aString,formula::FormulaGrammar::GRAM_NATIVE_UI, 
cMatrixFlag );
+aString, pDocument-GetGrammar(), cMatrixFlag );
 SCCOL nMatCols;
 SCROW nMatRows;
 ((ScFormulaCell*)pCell)-GetMatColsRows( nMatCols, nMatRows );
@@ -249,7 +248,7 @@ bool ScTable::SearchCell(const SvxSearchItem rSearchItem, 
SCCOL nCol, SCROW nRo
 else if ( bMultiLine  aString.Search('\n') != STRING_NOTFOUND )
 PutCell( nCol, nRow, new ScEditCell( aString, pDocument ) );
 else
-aCol[nCol].SetString(nRow, nTab, aString);
+aCol[nCol].SetString(nRow, nTab, aString, 
pDocument-GetAddressConvention());
 // pCell is invalid now (deleted)
 }
 }
@@ -1043,7 +1042,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
 ScAddress aCellPos(nCol, nRow, nTab);
 pUndoDoc-PutCell(nCol, nRow, nTab, 
pCell-CloneWithNote(aCellPos, *pUndoDoc, aCellPos));
 }
-aCol[nCol].SetString(nRow, nTab, 
rSearchItem.GetReplaceString());
+aCol[nCol].SetString(nRow, nTab, 
rSearchItem.GetReplaceString(), pDocument-GetAddressConvention());
 }
 }
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

2011-12-07 Thread Kohei Yoshida
 sc/inc/externalrefmgr.hxx|   16 +-
 sc/source/core/tool/interpr1.cxx |  204 ---
 sc/source/ui/docshell/externalrefmgr.cxx |8 -
 3 files changed, 170 insertions(+), 58 deletions(-)

New commits:
commit c3f5bfb3c6ad03c3582c404c16c1707cddd8a7a7
Author: Kohei Yoshida kohei.yosh...@suse.com
Date:   Wed Dec 7 22:33:44 2011 -0500

fdo#43534: Fully support external references in CELL function.

Some parameters don't work with external references, however, such
as PROTECT, PREFIX and WIDTH.

diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index e0f3158..e39ac2e 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -107,9 +107,9 @@ public:
 
 struct CellFormat
 {
-boolmbIsSet;
-short   mnType;
-sal_uInt32  mnIndex;
+bool  mbIsSet;
+short mnType;
+sal_uLong mnIndex;
 
 explicit CellFormat();
 };
@@ -118,8 +118,8 @@ private:
 /** individual cell within cached external ref table. */
 struct Cell
 {
-TokenRefmxToken;
-sal_uInt32  mnFmtIndex;
+TokenRef   mxToken;
+sal_uLong  mnFmtIndex;
 };
 typedef ::boost::unordered_mapSCCOL, CellRowDataType;
 typedef ::boost::unordered_mapSCROW, RowDataType RowsDataType;
@@ -160,7 +160,7 @@ public:
  *   false _only when_ adding a range of cell
  *   values, for performance reasons.
  */
-SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, 
sal_uInt32 nFmtIndex = 0, bool bSetCacheRange = true);
+SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, 
sal_uLong nFmtIndex = 0, bool bSetCacheRange = true);
 SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* 
pnFmtIndex = NULL) const;
 bool hasRow( SCROW nRow ) const;
 /** Set/clear referenced status flag only if current status is not
@@ -242,7 +242,7 @@ public:
 void setRangeNameTokens(sal_uInt16 nFileId, const ::rtl::OUString rName, 
TokenArrayRef pArray);
 
 void setCellData(sal_uInt16 nFileId, const ::rtl::OUString rTabName,
- SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 
nFmtIndex);
+ SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uLong 
nFmtIndex);
 
 struct SingleRangeData
 {
@@ -681,7 +681,7 @@ private:
 
 void insertRefCell(sal_uInt16 nFileId, const ScAddress rCell);
 
-void fillCellFormat(sal_uInt32 nFmtIndex, ScExternalRefCache::CellFormat* 
pFmt) const;
+void fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* 
pFmt) const;
 
 ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc(
 sal_uInt16 nFileId, const ScDocument* pSrcDoc, const ScAddress rCell,
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 6f552b7..862e92b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2055,6 +2055,58 @@ inline bool lcl_FormatHasOpenPar( const SvNumberformat* 
pFormat )
 return pFormat  (pFormat-GetFormatstring().Search( '(' ) != 
STRING_NOTFOUND);
 }
 
+namespace {
+
+void getFormatString(SvNumberFormatter* pFormatter, sal_uLong nFormat, String 
rFmtStr)
+{
+boolbAppendPrec = true;
+sal_uInt16  nPrec, nLeading;
+boolbThousand, bIsRed;
+pFormatter-GetFormatSpecialInfo( nFormat, bThousand, bIsRed, nPrec, 
nLeading );
+
+switch( pFormatter-GetType( nFormat ) )
+{
+case NUMBERFORMAT_NUMBER:   rFmtStr = (bThousand ? ',' : 'F');  
break;
+case NUMBERFORMAT_CURRENCY: rFmtStr = 'C';  
break;
+case NUMBERFORMAT_SCIENTIFIC:   rFmtStr = 'S';  
break;
+case NUMBERFORMAT_PERCENT:  rFmtStr = 'P';  
break;
+default:
+{
+bAppendPrec = false;
+switch( pFormatter-GetIndexTableOffset( nFormat ) )
+{
+case NF_DATE_SYSTEM_SHORT:
+case NF_DATE_SYS_DMMMYY:
+case NF_DATE_SYS_DDMMYY:
+case NF_DATE_SYS_DDMM:
+case NF_DATE_SYS_DMMM:
+case NF_DATE_DIN_DMMM:
+case NF_DATE_SYS_D:
+case NF_DATE_DIN_D: rFmtStr.AssignAscii( 
RTL_CONSTASCII_STRINGPARAM( D1 ) );  break;
+case NF_DATE_SYS_DDMMM: rFmtStr.AssignAscii( 
RTL_CONSTASCII_STRINGPARAM( D2 ) );  break;
+case NF_DATE_SYS_MMYY:  rFmtStr.AssignAscii( 
RTL_CONSTASCII_STRINGPARAM( D3 ) );  break;
+case NF_DATETIME_SYSTEM_SHORT_HHMM:
+case NF_DATETIME_SYS_DDMM_HHMMSS:
+rFmtStr.AssignAscii( 
RTL_CONSTASCII_STRINGPARAM( D4 ) );  break;
+case