summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-31 16:25:32 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-11-04 13:59:17 -0500
commit835fee82efb70b40b94f6babc2706ee1eb66dcf7 (patch)
treed83a10775a68412d4b6bddde3cf60d725062cc4f /sc/source
parent8228f6736b91da06f439080665bdc389297bb5b7 (diff)
Populate raw cell values using ScDocumentImport.
Also fix incorrect const methods. Methods that populate the document model should not be marked const even if the compiler allows it. Change-Id: Ic5d1670ce93c166d0f44ace04494fccab6eac275
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/inc/workbookhelper.hxx6
-rw-r--r--sc/source/filter/inc/worksheethelper.hxx20
-rw-r--r--sc/source/filter/oox/defnamesbuffer.cxx2
-rw-r--r--sc/source/filter/oox/numberformatsbuffer.cxx2
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx14
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx27
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx2
7 files changed, 40 insertions, 33 deletions
diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx
index 4db98ce9fe1f..a9056128dd8d 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -149,7 +149,11 @@ public:
void useInternalChartDataTable( bool bInternal );
// document model ---------------------------------------------------------
- ScDocument& getScDocument() const;
+ ScDocument& getScDocument();
+ const ScDocument& getScDocument() const;
+
+ ScDocumentImport& getDocImport();
+
ScEditEngineDefaulter& getEditEngine() const;
/** Returns a reference to the source/target spreadsheet document model. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 270cafea9301..8cda8768c291 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -281,23 +281,17 @@ public:
void setManualRowHeight( sal_Int32 nRow );
/** Inserts a value cell directly into the Calc sheet. */
- void putValue(
- const ::com::sun::star::table::CellAddress& rAddress,
- double fValue ) const;
+ void putValue( const com::sun::star::table::CellAddress& rAddress, double fValue );
/** Inserts a string cell directly into the Calc sheet. */
- void putString(
- const ::com::sun::star::table::CellAddress& rAddress,
- const OUString& rText ) const;
+ void putString( const com::sun::star::table::CellAddress& rAddress, const OUString& rText );
/** Inserts a rich-string cell directly into the Calc sheet. */
- void putRichString(
- const ::com::sun::star::table::CellAddress& rAddress,
- const RichString& rString,
- const Font* pFirstPortionFont ) const;
+ void putRichString(
+ const com::sun::star::table::CellAddress& rAddress,
+ const RichString& rString, const Font* pFirstPortionFont );
/** Inserts a formula cell directly into the Calc sheet. */
- void putFormulaTokens(
- const ::com::sun::star::table::CellAddress& rAddress,
- const ApiTokenSequence& rTokens ) const;
+ void putFormulaTokens(
+ const com::sun::star::table::CellAddress& rAddress, const ApiTokenSequence& rTokens );
/** Initial conversion before importing the worksheet. */
void initializeWorksheetImport();
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index 3c3dd09773a0..94203a852c7f 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -458,7 +458,7 @@ bool DefinedName::getAbsoluteRange( CellRangeAddress& orRange ) const
{
ScTokenArray* pTokenArray = mpScRangeData->GetCode();
Sequence< FormulaToken > aFTokenSeq;
- ScTokenConversion::ConvertToTokenSequence( this->getScDocument(), aFTokenSeq, *pTokenArray );
+ ScTokenConversion::ConvertToTokenSequence(getScDocument(), aFTokenSeq, *pTokenArray);
return getFormulaParser().extractCellRange( orRange, aFTokenSeq, false );
}
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx
index d6992f5c2330..2b6f271c5dc3 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -1936,7 +1936,7 @@ sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNum
void NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
{
- ScDocument& rDoc = getScDocument();
+ const ScDocument& rDoc = getScDocument();
static sal_uLong nDflt = rDoc.GetFormatTable()->GetStandardFormat( ScGlobal::eLnge );
sal_uLong nScNumFmt = nDflt;
if ( maApiData.mnIndex )
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index f7fc22559009..496be44ea974 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -662,7 +662,7 @@ void WorkbookGlobals::finalize()
//stop preventing establishment of listeners as is done in
//ScDocShell::AfterXMLLoading() for ods
getScDocument().SetInsertingFromOtherDoc(false);
- getScDocument().RebuildFormulaGroups();
+ getDocImport().finalize();
if (mxCLKernelThread.is())
mxCLKernelThread->join();
@@ -755,11 +755,21 @@ void WorkbookHelper::finalizeWorkbookImport()
// document model -------------------------------------------------------------
-ScDocument& WorkbookHelper::getScDocument() const
+ScDocument& WorkbookHelper::getScDocument()
{
return mrBookGlob.getScDocument();
}
+const ScDocument& WorkbookHelper::getScDocument() const
+{
+ return mrBookGlob.getScDocument();
+}
+
+ScDocumentImport& WorkbookHelper::getDocImport()
+{
+ return mrBookGlob.getDocImport();
+}
+
ScEditEngineDefaulter& WorkbookHelper::getEditEngine() const
{
return mrBookGlob.getEditEngine();
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index ee8201f56e65..fe02efacb729 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -69,6 +69,7 @@
#include "editutil.hxx"
#include "tokenarray.hxx"
#include "tablebuffer.hxx"
+#include "documentimport.hxx"
#include <svl/stritem.hxx>
#include <editeng/editobj.hxx>
@@ -355,11 +356,11 @@ private:
typedef ::std::list< ValidationModel > ValidationModelList;
/** Inserts all imported hyperlinks into their cell ranges. */
- void finalizeHyperlinkRanges() const;
+ void finalizeHyperlinkRanges();
/** Generates the final URL for the passed hyperlink. */
OUString getHyperlinkUrl( const HyperlinkModel& rHyperlink ) const;
/** Inserts a hyperlinks into the specified cell. */
- void insertHyperlink( const CellAddress& rAddress, const OUString& rUrl ) const;
+ void insertHyperlink( const CellAddress& rAddress, const OUString& rUrl );
/** Inserts all imported data validations into their cell ranges. */
void finalizeValidationRanges() const;
@@ -977,7 +978,7 @@ void WorksheetGlobals::finalizeDrawingImport()
// private --------------------------------------------------------------------
-void WorksheetGlobals::finalizeHyperlinkRanges() const
+void WorksheetGlobals::finalizeHyperlinkRanges()
{
for( HyperlinkModelList::const_iterator aIt = maHyperlinks.begin(), aEnd = maHyperlinks.end(); aIt != aEnd; ++aIt )
{
@@ -1018,7 +1019,7 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c
return aUrl;
}
-void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUString& rUrl ) const
+void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUString& rUrl )
{
Reference< XCell > xCell = getCell( rAddress );
if( xCell.is() ) switch( xCell->getType() )
@@ -1544,11 +1545,11 @@ void WorksheetHelper::setRowModel( const RowModel& rModel )
mrSheetGlob.setRowModel( rModel );
}
-void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue ) const
+void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue )
{
ScAddress aAddress;
ScUnoConversion::FillScAddress( aAddress, rAddress );
- getScDocument().SetValue( aAddress.Col(), aAddress.Row(), aAddress.Tab(), fValue );
+ getDocImport().setNumericCell(aAddress, fValue);
}
void WorksheetHelper::setCellFormulaValue( const ::com::sun::star::table::CellAddress& rAddress,
@@ -1557,34 +1558,32 @@ void WorksheetHelper::setCellFormulaValue( const ::com::sun::star::table::CellAd
getFormulaBuffer().setCellFormulaValue( rAddress, fValue );
}
-void WorksheetHelper::putString( const CellAddress& rAddress, const OUString& rText ) const
+void WorksheetHelper::putString( const CellAddress& rAddress, const OUString& rText )
{
ScAddress aAddress;
ScUnoConversion::FillScAddress( aAddress, rAddress );
- ScDocument& rDoc = getScDocument();
if ( !rText.isEmpty() )
- rDoc.SetTextCell(aAddress, rText);
+ getDocImport().setStringCell(aAddress, rText);
}
-void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichString& rString, const Font* pFirstPortionFont ) const
+void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichString& rString, const Font* pFirstPortionFont )
{
- ScDocument& rDoc = getScDocument();
ScEditEngineDefaulter& rEE = getEditEngine();
// The cell will own the text object instance returned from convert().
ScAddress aAddress;
ScUnoConversion::FillScAddress( aAddress, rAddress );
- rDoc.SetEditText(aAddress, rString.convert(rEE, pFirstPortionFont));
+ getDocImport().setEditCell(aAddress, rString.convert(rEE, pFirstPortionFont));
}
-void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens ) const
+void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens )
{
ScDocument& rDoc = getScDocument();
ScTokenArray aTokenArray;
ScAddress aCellPos;
ScUnoConversion::FillScAddress( aCellPos, rAddress );
ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
- rDoc.SetFormula(aCellPos, aTokenArray);
+ getDocImport().setFormulaCell(aCellPos, aTokenArray);
}
void WorksheetHelper::initializeWorksheetImport()
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 16949817d0f9..ff1b41731b12 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -372,7 +372,7 @@ bool ScTokenConversion::ConvertToTokenArray( ScDocument& rDoc,
return !rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
}
-bool ScTokenConversion::ConvertToTokenSequence( ScDocument& rDoc,
+bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc,
uno::Sequence<sheet::FormulaToken>& rSequence, const ScTokenArray& rTokenArray )
{
bool bError = false;