[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/source

2013-04-13 Thread Kohei Yoshida
 sc/Library_sc.mk|1 
 sc/inc/column.hxx   |4 +
 sc/inc/document.hxx |2 
 sc/inc/documentimport.hxx   |   67 
 sc/inc/table.hxx|2 
 sc/source/core/data/column2.cxx |   46 ++
 sc/source/core/data/column3.cxx |   41 
 sc/source/core/data/documentimport.cxx  |  104 
 sc/source/filter/inc/orcusinterface.hxx |   13 ++--
 sc/source/filter/orcus/interface.cxx|   57 -
 10 files changed, 260 insertions(+), 77 deletions(-)

New commits:
commit c03d5def337a112939b9864391f7b246c4e13fb5
Author: Kohei Yoshida 
Date:   Sat Apr 13 11:17:06 2013 -0400

ScDocumentImport accessor to provide efficient means to fill document.

Import filters should be using this class to populate ScDocument, instead
of filling it directly to ScDocument, and do all the broadcasting etc only
once at the end of each import session.

Change-Id: Ifc663e3dcf6b2ec96aaa185006af7ae9b9940af3

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 527d0d7..5b82620 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -124,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/documentimport \
sc/source/core/data/dpdimsave \
sc/source/core/data/dpfilteredcache \
sc/source/core/data/dpglobal \
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e872d87e..8e076ee 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -74,6 +74,7 @@ struct ScColWidthParam;
 class ScColumnTextWidthIterator;
 struct ScFormulaCellGroup;
 struct ScRefCellValue;
+class ScDocumentImport;
 
 typedef ::boost::intrusive_ptr ScFormulaCellGroupRef;
 
@@ -140,6 +141,7 @@ friend class ScCellIterator;
 friend class ScHorizontalCellIterator;
 friend class ScHorizontalAttrIterator;
 friend class ScColumnTextWidthIterator;
+friend class ScDocumentImport;
 
 ScColumn(const ScColumn&); // disabled
 ScColumn& operator= (const ScColumn&); // disabled
@@ -463,6 +465,8 @@ private:
 void CellStorageModified();
 
 void CopyScriptTypesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& 
rDestCol) const;
+
+void SetCell(SCROW nRow, ScBaseCell* pNewCell);
 };
 
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a6438ad..030dd21 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -145,6 +145,7 @@ class ScNotes;
 class ScEditDataArray;
 class EditTextObject;
 struct ScRefCellValue;
+class ScDocumentImport;
 
 namespace com { namespace sun { namespace star {
 namespace lang {
@@ -219,6 +220,7 @@ friend class ScColumnTextWidthIterator;
 friend class ScFormulaCell;
 friend class ScTable;
 friend struct ScRefCellValue;
+friend class ScDocumentImport;
 
 typedef ::std::vector TableContainer;
 private:
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
new file mode 100644
index 000..eca8021
--- /dev/null
+++ b/sc/inc/documentimport.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_DOCUMENTIMPORT_HXX
+#define SC_DOCUMENTIMPORT_HXX
+
+#include "scdllapi.h"
+#include "address.hxx"
+
+#include "rtl/ustring.hxx"
+
+class ScDocument;
+class ScAddress;
+class ScTokenArray;
+class ScBaseCell;
+
+/**
+ * Accessor class to ScDocument.  Its purpose is to allow import filter to
+ * fill the document model and nothing but that.  Filling the document via
+ * this class does not trigger any kind of broadcasting, drawing object
+ * position calculation, or anything else that requires expensive
+ * computation which are unnecessary and undesirable during import.
+ */
+class SC_DLLPUBLIC ScDocumentImport
+{
+ScDocument& mrDoc;
+
+ScDocumentImport(); // disabled
+
+public:
+ScDocumentImport(ScDocument& rDoc);
+ScDocumentImport(const ScDocumentImport& r);
+
+ScDocument& getDoc();
+const ScDocument& getDoc() const;
+
+/**
+ * @param rName sheet name.
+ *
+ * @return 0-based sheet index, or -1 in case no sheet is found by
+ * specified name.
+ */
+SCTAB getSheetIndex(const OUString& rName) const;
+SCTAB getSheetCount() const;
+bool appendSheet(const OUString& rName);
+
+void setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay);
+
+void setAutoInput(const ScAddress& rPos, const OUString& rStr);
+void setNumericCell(const ScAddress& rPos, double fVal);
+void setStringCell(const ScAddress& rPos, const OUString&

[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/source

2014-01-30 Thread Kohei Yoshida
 sc/Library_sc.mk   |2 
 sc/inc/cellvalues.hxx  |   44 +++
 sc/inc/column.hxx  |6 
 sc/inc/document.hxx|   13 +
 sc/inc/table.hxx   |5 
 sc/source/core/data/cellvalues.cxx |  116 
++
 sc/source/core/data/column4.cxx|   84 +++
 sc/source/core/data/document10.cxx |   27 ++
 sc/source/core/data/table7.cxx |   24 ++
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |   18 +
 sc/source/ui/collab/sendfunc.cxx   |7 
 sc/source/ui/collab/sendfunc.hxx   |1 
 sc/source/ui/docshell/docfunc.cxx  |   35 +++
 sc/source/ui/inc/docfunc.hxx   |1 
 sc/source/ui/inc/undocell.hxx  |   31 ++
 sc/source/ui/undo/undocell2.cxx|   69 +
 16 files changed, 477 insertions(+), 6 deletions(-)

New commits:
commit a0bd814fb5c2ed1d8a1583eb59c783290c7c3dc9
Author: Kohei Yoshida 
Date:   Wed Jan 29 23:35:34 2014 -0500

Speed up filling of random number generation over entire column.

Because nobody wants to wait forever...

Change-Id: Ie52bff944893b7e3fe9e7908be19d27c692fc1ea

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 1ed89c6..dcced7f 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -100,6 +100,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/bcaslot \
 sc/source/core/data/bigrange \
 sc/source/core/data/cellvalue \
+sc/source/core/data/cellvalues \
 sc/source/core/data/clipcontext \
 sc/source/core/data/clipparam \
 sc/source/core/data/column \
@@ -512,6 +513,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/undo/undoblk2 \
 sc/source/ui/undo/undoblk3 \
 sc/source/ui/undo/undocell \
+sc/source/ui/undo/undocell2 \
 sc/source/ui/undo/undodat \
 sc/source/ui/undo/undodraw \
 sc/source/ui/undo/undoolk \
diff --git a/sc/inc/cellvalues.hxx b/sc/inc/cellvalues.hxx
new file mode 100644
index 000..8b249b4
--- /dev/null
+++ b/sc/inc/cellvalues.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_CELLVALUES_HXX
+#define SC_CELLVALUES_HXX
+
+#include 
+
+class ScColumn;
+
+namespace sc {
+
+struct CellValuesImpl;
+
+class CellValues
+{
+CellValuesImpl* mpImpl;
+
+CellValues( const CellValues& ); // disabled
+CellValues& operator= ( const CellValues& ); // disabled
+
+public:
+CellValues();
+~CellValues();
+
+void transferFrom( ScColumn& rCol, SCROW nRow, size_t nLen );
+void copyTo( ScColumn& rCol, SCROW nRow ) const;
+
+void assign( const std::vector& rVals );
+
+size_t size() const;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 1ac1e3f..69ba1af 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -56,6 +56,7 @@ struct RefUpdateMoveTabContext;
 class EditTextIterator;
 struct NoteEntry;
 class DocumentStreamAccess;
+class CellValues;
 
 }
 
@@ -143,6 +144,7 @@ friend class sc::DocumentStreamAccess;
 friend class sc::SingleColumnSpanSet;
 friend class sc::ColumnSpanSet;
 friend class sc::EditTextIterator;
+friend class sc::CellValues;
 
 ScColumn(const ScColumn&); // disabled
 ScColumn& operator= (const ScColumn&); // disabled
@@ -294,6 +296,7 @@ public:
 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const 
OUString& rStr, bool bBroadcast = true );
 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const 
svl::SharedString& rStr, bool bBroadcast = true );
 void SetValue( SCROW nRow, double fVal );
+void SetValues( SCROW nRow, const std::vector& rVals );
 void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double 
fVal, bool bBroadcast = true );
 voidSetError( SCROW nRow, const sal_uInt16 nError);
 
@@ -539,6 +542,9 @@ public:
  */
 void RegroupFormulaCells();
 
+void TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rDest 
);
+void CopyCellValuesFrom( SCROW nRow, const sc::CellValues& rSrc );
+
 #if DEBUG_COLUMN_STORAGE
 void DumpFormulaGroups() const;
 #endif
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d39cb09..b241859 100644
--- a/sc/inc/document.hxx
+++ b/s

[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/source

2014-02-01 Thread Kohei Yoshida
 sc/Library_sc.mk |1 
 sc/inc/column.hxx|6 +-
 sc/inc/document.hxx  |   16 +++---
 sc/inc/rowheightcontext.hxx  |   57 
 sc/inc/table.hxx |   21 +++--
 sc/source/core/data/column2.cxx  |   12 ++---
 sc/source/core/data/dociter.cxx  |9 ++-
 sc/source/core/data/document.cxx |   23 +++--
 sc/source/core/data/rowheightcontext.cxx |   72 +++
 sc/source/core/data/table1.cxx   |   43 ++
 sc/source/core/data/table2.cxx   |4 +
 sc/source/filter/rtf/eeimpars.cxx|8 ++-
 sc/source/ui/docshell/docfunc.cxx|   10 ++--
 sc/source/ui/docshell/docsh5.cxx |9 ++-
 sc/source/ui/undo/undobase.cxx   |   12 ++---
 sc/source/ui/undo/undoblk.cxx|   10 ++--
 sc/source/ui/undo/undoblk3.cxx   |8 ++-
 sc/source/ui/view/viewfun2.cxx   |   11 ++--
 sc/source/ui/view/viewfunc.cxx   |8 ++-
 19 files changed, 230 insertions(+), 110 deletions(-)

New commits:
commit f74c0a42b0e176771e15458b1bdb85c0a2dc99db
Author: Kohei Yoshida 
Date:   Sat Feb 1 20:51:29 2014 -0500

Add RowHeightContext to stuff all parameters for SetOptimalHeights().

To help reduce the number of function arguments.

Change-Id: Ic29fff38f6cd844bdaac8ac4b440dfcaba55df61

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index dcced7f..397ca22 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -169,6 +169,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/poolhelp \
 sc/source/core/data/postit \
 sc/source/core/data/refupdatecontext \
+sc/source/core/data/rowheightcontext \
 sc/source/core/data/segmenttree \
 sc/source/core/data/sheetevents \
 sc/source/core/data/simpleformulacalc \
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 7fefa04..835daa8 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -58,6 +58,7 @@ struct NoteEntry;
 class DocumentStreamAccess;
 class CellValues;
 struct RowSpan;
+class RowHeightContext;
 
 }
 
@@ -437,9 +438,8 @@ public:
 bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, 
const ScColWidthParam* pParam) const;
 
 void GetOptimalHeight(
-SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* 
pDev,
-double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& 
rZoomY,
-bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart);
+sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, 
sal_uInt16* pHeight,
+sal_uInt16 nMinHeight, SCROW nMinStart );
 
 /// Including current, may return -1
 SCsROW  GetNextUnprotected( SCROW nRow, bool bUp ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index b241859..2d84ecd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -72,6 +72,7 @@ struct FormulaGroupContext;
 class DocumentStreamAccess;
 class DocumentLinkManager;
 class CellValues;
+class RowHeightContext;
 
 }
 
@@ -1480,15 +1481,12 @@ public:
 bool bFormula,
 const ScMarkData* pMarkData = NULL,
 const ScColWidthParam* pParam = NULL );
-SC_DLLPUBLIC bool   SetOptimalHeight( SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab, sal_uInt16 nExtra,
-OutputDevice* pDev,
-double nPPTX, double nPPTY,
-const Fraction& rZoomX, const 
Fraction& rZoomY,
-bool bShrink );
-voidUpdateAllRowHeights( OutputDevice* pDev,
-double nPPTX, double nPPTY,
-const Fraction& rZoomX, const 
Fraction& rZoomY,
-const ScMarkData* pTabMark = NULL );
+
+SC_DLLPUBLIC bool SetOptimalHeight(
+sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab 
);
+
+void UpdateAllRowHeights( sc::RowHeightContext& rCxt, const ScMarkData* 
pTabMark = NULL );
+
 longGetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
 OutputDevice* pDev,
 double nPPTX, double nPPTY,
diff --git a/sc/inc/rowheightcontext.hxx b/sc/inc/rowheightcontext.hxx
new file mode 100644
index 000..7985df3
--- /dev/null
+++ b/sc/inc/rowheightcontext.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You c