[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/column.hxx|2 ++ sc/inc/document.hxx | 12 sc/inc/table.hxx |2 ++ sc/source/core/data/column.cxx | 34 ++ sc/source/core/data/document.cxx | 16 sc/source/core/data/table2.cxx | 12 sc/source/ui/app/scmod.cxx | 30 -- 7 files changed, 102 insertions(+), 6 deletions(-) New commits: commit cad24bc49681e0a765bee01b00825ab02d537705 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jan 30 15:55:58 2013 -0500 bnc#615357: Recompile cells with #NAME! for English function name option. When the option for using English function name changes, we should re-compile all cells with #NAME! as the error may have been caused by unresolved function name which may be fixed after the option change. Change-Id: Id340ce9b5db3ed368b98e814861be5c3f96df071 Reviewed-on: https://gerrit.libreoffice.org/1931 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 3e927c8..930caba 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -250,6 +250,8 @@ public: voidCompileAll(); voidCompileXML( ScProgress rProgress ); +bool CompileErrorCells(sal_uInt16 nErrCode); + voidResetChanged( SCROW nStartRow, SCROW nEndRow ); boolUpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c7c09d8..31c5ac2 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -863,6 +863,18 @@ public: voidCompileAll(); voidCompileXML(); +/** + * Re-compile formula cells with error. + * + * @param nErrCode specified error code to match. Only those cells with + * this error code will be re-compiled. If this value is + * 0, cells with any error values will be re-compiled. + * + * @return true if at least one cell is re-compiled, false if no cells are + * re-compiled. + */ +bool CompileErrorCells(sal_uInt16 nErrCode); + ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; } SC_DLLPUBLIC void SetAutoNameCache( ScAutoNameCache* pCache ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 26d5a69..061c830 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -446,6 +446,8 @@ public: voidCompileAll(); voidCompileXML( ScProgress rProgress ); +bool CompileErrorCells(sal_uInt16 nErrCode); + voidUpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 462abe7..5fb98a2 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2149,6 +2149,40 @@ void ScColumn::CompileXML( ScProgress rProgress ) } } +bool ScColumn::CompileErrorCells(sal_uInt16 nErrCode) +{ +if (maItems.empty()) +return false; + +bool bCompiled = false; +std::vectorColEntry::iterator it = maItems.begin(), itEnd = maItems.end(); +for (; it != itEnd; ++it) +{ +ScBaseCell* pCell = it-pCell; +if (pCell-GetCellType() != CELLTYPE_FORMULA) +// Not a formula cell. Skip it. +continue; + +ScFormulaCell* pFCell = static_castScFormulaCell*(pCell); +sal_uInt16 nCurError = pFCell-GetRawError(); +if (!nCurError) +// It's not an error cell. Skip it. +continue; + +if (nErrCode nCurError != nErrCode) +// Error code is specified, and it doesn't match. Skip it. +continue; + +pFCell-GetCode()-SetCodeError(0); +OUStringBuffer aBuf; +pFCell-GetFormula(aBuf, pDocument-GetGrammar()); +pFCell-Compile(aBuf.makeStringAndClear(), false, pDocument-GetGrammar()); + +bCompiled = true; +} + +return bCompiled; +} void ScColumn::CalcAfterLoad() { diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 95018d7..8cc1713 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3377,6 +3377,22 @@ void ScDocument::CompileXML() SetAutoCalc( bOldAutoCalc ); } +bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode) +{ +bool bCompiled = false; +TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end(); +for (; it != itEnd; ++it) +{ +ScTable* pTab = *it; +if (!pTab) +continue; + +if (pTab-CompileErrorCells(nErrCode)) +
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/drwlayer.hxx |1 + sc/source/core/data/drwlayer.cxx |7 +++ sc/source/ui/view/viewfun7.cxx |8 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) New commits: commit c4820200312e3d50a12d3605147772759938bcf6 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Jan 25 12:57:14 2013 -0500 fdo#59056: Re-calculate cell anchor position of a pasted drawing object. Else it would re-use the anchor position of the original one (minus the sheet index which is correctly adjusted). Change-Id: I52d11eb9953ee7539c9d5da41edd7dd28604587c Reviewed-on: https://gerrit.libreoffice.org/1869 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 298d619..72b980d 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -166,6 +166,7 @@ public: String GetNewGraphicName( long* pnCounter = NULL ) const; voidEnsureGraphicNames(); +static bool IsCellAnchored( const SdrObject rObj ); static void SetPageAnchored( SdrObject ); static void SetCellAnchored( SdrObject, const ScDrawObjData rAnchor ); // Updates rAnchor based on position of rObj diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 76d6794..8ea4fca 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1787,6 +1787,13 @@ void ScDrawLayer::UpdateCellAnchorFromPositionEnd( SdrObject rObj, const ScDocu pAnchor-maEndOffset.X() = aCellRect.Right()-aObjRect.Left(); } +bool ScDrawLayer::IsCellAnchored( const SdrObject rObj ) +{ +// Cell anchored object always has a user data, to store the anchor cell +// info. If it doesn't then it's page-anchored. +return GetFirstUserDataOfType(rObj, SC_UD_OBJDATA) != NULL; +} + void ScDrawLayer::SetPageAnchored( SdrObject rObj ) { DeleteFirstUserDataOfType(rObj, SC_UD_OBJDATA); diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index c69dc65..63e2f1a 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -172,8 +172,8 @@ void ScViewFunc::PasteDraw( const Point rLogicPos, SdrModel* pModel, pDestPage-InsertObject( pNeuObj ); pScDrawView-AddUndo(new SdrUndoInsertObj( *pNeuObj )); -// Chart braucht nicht mehr getrennt behandelt zu werden, -// weil es seine Daten jetzt selber hat +if (ScDrawLayer::IsCellAnchored(*pNeuObj)) +ScDrawLayer::SetCellAnchoredFromPosition(*pNeuObj, *GetViewData()-GetDocument(), nTab); } } @@ -238,6 +238,10 @@ void ScViewFunc::PasteDraw( const Point rLogicPos, SdrModel* pModel, { if ( pObject-ISA(SdrUnoObj) pObject-GetLayer() != SC_LAYER_CONTROLS ) pObject-NbcSetLayer(SC_LAYER_CONTROLS); + +if (ScDrawLayer::IsCellAnchored(*pObject)) +ScDrawLayer::SetCellAnchoredFromPosition(*pObject, *GetViewData()-GetDocument(), nTab); + pObject = aIter.Next(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source xmloff/source
sc/inc/unonames.hxx |1 + sc/source/ui/unoobj/chart2uno.cxx |8 +++- xmloff/source/chart/SchXMLTools.cxx | 30 +- 3 files changed, 33 insertions(+), 6 deletions(-) New commits: commit 8a4272347298d8e4eab2fd685a4993709d888762 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jan 23 22:18:05 2013 -0500 fdo#58562: Ensure internal data is always used when pasting to another doc. Without this, pasting a chart object from one Calc doc to another may occasionally incorrectly switch to range references *if* the destination document contains the right set of sheet names. With this fix, pasted chart objects always switch to internal cached data source when pasting to another document, while retaining range references when pasting within the same document. Change-Id: If1dbc854c5faae62f06ece155fad470b229ca0c7 Reviewed-on: https://gerrit.libreoffice.org/1835 Tested-by: Noel Power noel.po...@suse.com Reviewed-by: Noel Power noel.po...@suse.com diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index ca89837..9ab1856 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -652,6 +652,7 @@ #define SC_UNONAME_HIDDENVALUES HiddenValues #define SC_UNONAME_INCLUDEHIDDENCELLS IncludeHiddenCells #define SC_UNONAME_HIDDENVALUES HiddenValues +#define SC_UNONAME_USE_INTERNAL_DATA_PROVIDER UseInternalDataProvider // Solver #define SC_UNONAME_TIMEOUT Timeout diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 53656cb..5ea6f54 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -76,7 +76,8 @@ const SfxItemPropertyMapEntry* lcl_GetDataProviderPropertyMap() { static SfxItemPropertyMapEntry aDataProviderPropertyMap_Impl[] = { -{MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, getBooleanCppuType(), 0, 0 }, +{ MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, getBooleanCppuType(), 0, 0 }, +{ MAP_CHAR_LEN(SC_UNONAME_USE_INTERNAL_DATA_PROVIDER), 0, getBooleanCppuType(), 0, 0 }, {0,0,0,0,0,0} }; return aDataProviderPropertyMap_Impl; @@ -2327,6 +2328,11 @@ uno::Any SAL_CALL ScChart2DataProvider::getPropertyValue( uno::Any aRet; if ( rPropertyName == SC_UNONAME_INCLUDEHIDDENCELLS ) aRet = m_bIncludeHiddenCells; +else if (rPropertyName == SC_UNONAME_USE_INTERNAL_DATA_PROVIDER) +{ +// This is a read-only property. +aRet = static_castsal_Bool(m_pDocument-PastingDrawFromOtherDoc()); +} else throw beans::UnknownPropertyException(); return aRet; diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 2c83c3e..e12de82 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -380,14 +380,34 @@ Reference chart2::data::XDataSequence CreateDataSequence( return xRet; } -try +bool bUseInternal = false; +uno::Referencebeans::XPropertySet xPropSet(xDataProvider, uno::UNO_QUERY); +if (xPropSet.is()) { -xRet.set( xDataProvider-createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider ))); -SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange ); +try +{ +sal_Bool bVal; +uno::Any any = xPropSet-getPropertyValue(UseInternalDataProvider); +if (any = bVal) +bUseInternal = static_castbool(bVal); +} +catch (const beans::UnknownPropertyException) +{ +// Do nothing +} } -catch( const lang::IllegalArgumentException ) + +if (!bUseInternal) { -OSL_FAIL( could not create data sequence ); +try +{ +xRet.set( xDataProvider-createDataSequenceByRangeRepresentation( lcl_ConvertRange( rRange, xDataProvider ))); +SchXMLTools::setXMLRangePropertyAtDataSequence( xRet, rRange ); +} +catch( const lang::IllegalArgumentException ) +{ +OSL_FAIL( could not create data sequence ); +} } if( !xRet.is() !xChartDoc-hasInternalDataProvider() !rRange.isEmpty() ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/compiler.hxx |1 + sc/inc/externalrefmgr.hxx|4 ++-- sc/source/core/tool/compiler.cxx | 31 +++ 3 files changed, 34 insertions(+), 2 deletions(-) New commits: commit 260f1b19ce7340b02fce5aea948caa61ee128f44 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jan 10 12:02:07 2013 -0500 fdo#58531: Register cells with external references at compile time. In the old code, we would do this during interpretation. But we need to move that to the compilation to make this work properly without full recalculation during ods import. For 4.0, we'll just add calls to insertRefCells in ScCompiler. On master we should remove these calls from the old places to avoid duplicate calls. Duplicate calls for the same external file ID - cell address pair will not hurt; it just adds more overhead. Change-Id: I25cf2e08195da17c6c8f7d19c74d744df6e1638e Reviewed-on: https://gerrit.libreoffice.org/1631 Reviewed-by: Noel Power noel.po...@suse.com Tested-by: Noel Power noel.po...@suse.com diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index d40d261..10af901 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -331,6 +331,7 @@ private: ExtendedErrorDetection meExtendedErrorDetection; boolmbCloseBrackets;// whether to close open brackets automatically, default TRUE boolmbRewind; // whether symbol is to be rewound to some step during lexical analysis +std::vectorsal_uInt16 maExternalFiles; bool NextNewToken(bool bInArray = false); diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 3fd3ab5..87693a3 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -679,14 +679,14 @@ public: */ bool containsUnsavedReferences() { return !maUnsavedDocShells.empty(); } +void insertRefCell(sal_uInt16 nFileId, const ScAddress rCell); + private: ScExternalRefManager(); ScExternalRefManager(const ScExternalRefManager); void refreshAllRefCells(sal_uInt16 nFileId); -void insertRefCell(sal_uInt16 nFileId, const ScAddress rCell); - void fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCache::CellFormat* pFmt) const; ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc( diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index b827019..b6183ba 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2717,6 +2717,7 @@ bool ScCompiler::IsDoubleReference( const String rName ) const OUString* pRealTab = pRefMgr-getRealTableName(aExtInfo.mnFileId, aExtInfo.maTabName); aToken.SetExternalDoubleRef( aExtInfo.mnFileId, pRealTab ? *pRealTab : aExtInfo.maTabName, aRef); +maExternalFiles.push_back(aExtInfo.mnFileId); } else { @@ -2765,6 +2766,7 @@ bool ScCompiler::IsSingleReference( const String rName ) const OUString* pRealTab = pRefMgr-getRealTableName(aExtInfo.mnFileId, aExtInfo.maTabName); aToken.SetExternalSingleRef( aExtInfo.mnFileId, pRealTab ? *pRealTab : aExtInfo.maTabName, aRef); +maExternalFiles.push_back(aExtInfo.mnFileId); } else aToken.SetSingleReference(aRef); @@ -2973,6 +2975,7 @@ bool ScCompiler::IsExternalNamedRange( const String rSymbol ) const OUString* pRealName = pRefMgr-getRealRangeName(nFileId, aName); aToken.SetExternalName(nFileId, pRealName ? *pRealName : OUString(aTmp)); pRawToken = aToken.Clone(); +maExternalFiles.push_back(nFileId); return true; } @@ -3737,6 +3740,24 @@ void ScCompiler::CreateStringFromXMLTokenArray( rtl::OUString rFormula, rtl::OU rFormulaNmsp = aFormulaNmsp; } +namespace { + +class ExternalFileInserter : std::unary_functionsal_uInt16, void +{ +ScAddress maPos; +ScExternalRefManager mrRefMgr; +public: +ExternalFileInserter(const ScAddress rPos, ScExternalRefManager rRefMgr) : +maPos(rPos), mrRefMgr(rRefMgr) {} + +void operator() (sal_uInt16 nFileId) const +{ +mrRefMgr.insertRefCell(nFileId, maPos); +} +}; + +} + ScTokenArray* ScCompiler::CompileString( const String rFormula ) { OSL_ENSURE( meGrammar != FormulaGrammar::GRAM_EXTERNAL, ScCompiler::CompileString - unexpected grammar GRAM_EXTERNAL ); @@ -3943,6 +3964,16 @@ ScTokenArray* ScCompiler::CompileString( const String rFormula ) // remember pArr, in case a subsequent CompileTokenArray() is executed. ScTokenArray* pNew = new ScTokenArray( aArr ); pArr = pNew; + +if (!maExternalFiles.empty()) +{ +// Remove duplicates, and register all external files found in this cell. +std::sort(maExternalFiles.begin(), maExternalFiles.end()); +std::vectorsal_uInt16::iterator itEnd =
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/document.hxx |1 + sc/source/core/data/document.cxx | 11 +++ sc/source/ui/docshell/docsh.cxx | 38 +- 3 files changed, 49 insertions(+), 1 deletion(-) New commits: commit 31664fbc882652f6b308fa5aab1eac48e9d0ad0a Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jan 10 16:21:05 2013 -0500 fdo#58069: Invalidate sheet stream cache when directory path changes. To properly regenerate hyperlinks (among other things) which depend on the full path of the host document. Change-Id: I44fdd5b0ef0a57bf4fae13f29f1ebacfe1ab19a8 Reviewed-on: https://gerrit.libreoffice.org/1634 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 5b5a472..76df284 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -571,6 +571,7 @@ public: void AppendTabOnLoad(const rtl::OUString rName); void SetTabNameOnLoad(SCTAB nTab, const rtl::OUString rName); +void InvalidateStreamOnSave(); SC_DLLPUBLIC bool InsertTab( SCTAB nPos, const rtl::OUString rName, bool bExternalDocument = false ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 9d8a8c3..65e904f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -402,6 +402,17 @@ void ScDocument::SetTabNameOnLoad(SCTAB nTab, const rtl::OUString rName) maTabs[nTab]-SetName(rName); } +void ScDocument::InvalidateStreamOnSave() +{ +TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end(); +for (; it != itEnd; ++it) +{ +ScTable* pTab = *it; +if (pTab) +pTab-SetStreamValid(false); +} +} + bool ScDocument::InsertTab( SCTAB nPos, const rtl::OUString rName, bool bExternalDocument ) { diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 291f5e0..948f622 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -34,6 +34,7 @@ #include sfx2/objface.hxx #include svl/documentlockfile.hxx #include svl/sharecontrolfile.hxx +#include svl/urihelper.hxx #include chgtrack.hxx #include chgviset.hxx #include com/sun/star/awt/Key.hpp @@ -1526,10 +1527,45 @@ sal_Bool ScDocShell::Save() return bRet; } +namespace { + +/** + * Remove the file name from the full path, to keep only the directory path. + */ +void popFileName(OUString rPath) +{ +if (!rPath.isEmpty()) +{ +INetURLObject aURLObj(rPath); +aURLObj.removeSegment(); +rPath = aURLObj.GetMainURL(INetURLObject::NO_DECODE); +} +} + +} sal_Bool ScDocShell::SaveAs( SfxMedium rMedium ) { -RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, sc, nn93723, ScDocShell::SaveAs ); +OUString aCurPath; // empty for new document that hasn't been saved. +const SfxMedium* pCurMedium = GetMedium(); +if (pCurMedium) +{ +aCurPath = pCurMedium-GetName(); +popFileName(aCurPath); +} + +if (!aCurPath.isEmpty()) +{ +// current document has a path - not a brand-new document. +OUString aNewPath = rMedium.GetName(); +popFileName(aNewPath); +OUString aRel = URIHelper::simpleNormalizedMakeRelative(aCurPath, aNewPath); +if (!aRel.isEmpty()) +{ +// Directory path will change before and after the save. +aDocument.InvalidateStreamOnSave(); +} +} ScTabViewShell* pViewShell = GetBestViewShell(); bool bNeedsRehash = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_SHA1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/globstr.hrc|5 +-- sc/source/filter/oox/workbookfragment.cxx | 46 +++--- sc/source/ui/src/globstr.src |8 + sc/source/ui/src/optdlg.src |2 - 4 files changed, 16 insertions(+), 45 deletions(-) New commits: commit 828fcbc8c7f0ff7c6288190b62dbadca5a4cd190 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Mon Dec 17 10:31:14 2012 -0500 Use check box Always perform this in future rather than 4 buttons. Change-Id: Ib04debaf3c2d06e694e965c1ece01d6cc7a43fa8 diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index e860a6b..4b8031d 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -619,9 +619,8 @@ #define STR_QUERY_FORMULA_RECALC_ONLOAD_ODS 493 #define STR_QUERY_FORMULA_RECALC_ONLOAD_XLS 494 -#define STR_ALWAYS 495 -#define STR_NEVER 496 +#define STR_ALWAYS_PERFORM_SELECTED 495 -#define STR_COUNT 497 +#define STR_COUNT 496 #endif diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 0e92e2a..4f71e57 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -327,55 +327,31 @@ void WorkbookFragment::finalizeImport() { if (rDoc.IsUserInteractionEnabled()) { - -#define RET_ALWAYS 10 -#define RET_NEVER 11 // Ask the user if full re-calculation is desired. QueryBox aBox( pDocSh-GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); -aBox.AddButton(ScGlobal::GetRscString(STR_ALWAYS), RET_ALWAYS, 0); -aBox.AddButton(ScGlobal::GetRscString(STR_NEVER), RET_NEVER, 0); + aBox.SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); boost::shared_ptr comphelper::ConfigurationChanges batch( comphelper::ConfigurationChanges::create() ); sal_Int32 nRet = aBox.Execute(); -switch (nRet) +bHardRecalc = nRet == RET_YES; + +if (aBox.GetCheckBoxState()) { -case RET_YES: -bHardRecalc = true; -break; -case RET_NO: -bHardRecalc = false; -break; -case RET_ALWAYS: -{ -bHardRecalc = true; - officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), batch); -ScFormulaOptions aOpt = SC_MOD()-GetFormulaOptions(); -aOpt.SetOOXMLRecalcOptions(RECALC_ALWAYS); -SC_MOD()-SetFormulaOptions(aOpt); -} -break; -case RET_NEVER: -{ -bHardRecalc = false; - officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(2), batch); -ScFormulaOptions aOpt = SC_MOD()-GetFormulaOptions(); -aOpt.SetOOXMLRecalcOptions(RECALC_NEVER); -SC_MOD()-SetFormulaOptions(aOpt); -} -break; -default: -SAL_WARN(sc, unknown return value!); -bHardRecalc = true; +// Always perform selected action in the future. + officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), batch); +ScFormulaOptions aOpt = SC_MOD()-GetFormulaOptions(); +aOpt.SetOOXMLRecalcOptions(bHardRecalc ? RECALC_ALWAYS : RECALC_NEVER); +SC_MOD()-SetFormulaOptions(aOpt); + } batch-commit(); } } -else if(nRecalcMode == 0) +else if (nRecalcMode == 0) bHardRecalc = true; - if (bHardRecalc) pDocSh-DoHardRecalc(false); else diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 955dcb5..79ad06e 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1961,13 +1961,9 @@ Resource RID_GLOBSTR Text [ en-US ] = This document was last saved by Excel. Some formula cells may produce different results when recalculated.\n\nDo you want to recalculate all formula cells now?; }; -String STR_ALWAYS +String STR_ALWAYS_PERFORM_SELECTED { -Text [ en-US ] = Always; -}; -String STR_NEVER -{ -Text [ en-US ] = Never; +Text [ en-US ] = Always perform this without prompt in the future.; }; }; diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src index e3a1175..821f200 100644 --- a/sc/source/ui/src/optdlg.src +++ b/sc/source/ui/src/optdlg.src @@ -288,7 +288,7 @@ TabPage
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/viewopti.hxx |4 ++-- sc/source/core/tool/viewopti.cxx | 36 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) New commits: commit 0dc856a870a300d6743f58b558ca9a0fc23fd1c8 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Fri Dec 14 22:05:11 2012 -0500 Fixed accidentally modified default view options. It was unintentionally caused by 6ea8ea456cf5df267284278ecda42aa9b089a682. Also made the default values easier to see. Let's not do foo1 = foo2 = foo3 = true; type of assignment which may give the reader the wrong impression. Let's do foo1 = true; foo2 = true; foo3 = true; instead. Change-Id: I181b80d2aae96d65b662b187bc884913fec836db diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx index 4bea442..07e8c04 100644 --- a/sc/inc/viewopti.hxx +++ b/sc/inc/viewopti.hxx @@ -86,7 +86,7 @@ public: voidSetDefaults(); voidSetOption( ScViewOption eOpt, sal_Bool bNew = sal_True ){ aOptArr[eOpt] = bNew; } -sal_BoolGetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; } +boolGetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; } voidSetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; } ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; } @@ -103,7 +103,7 @@ public: int operator!= ( const ScViewOptions rOpt ) const { return !(operator==(rOpt)); } private: -sal_BoolaOptArr [MAX_OPT]; +boolaOptArr [MAX_OPT]; ScVObjMode aModeArr[MAX_TYPE]; Color aGridCol; String aGridColName; diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index d1078a5..64a4fec 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -134,24 +134,24 @@ ScViewOptions::~ScViewOptions() void ScViewOptions::SetDefaults() { -aOptArr[ VOPT_FORMULAS] = -aOptArr[ VOPT_SYNTAX ] = -aOptArr[ VOPT_HELPLINES ] = -aOptArr[ VOPT_GRID_ONTOP ] = -aOptArr[ VOPT_NOTES ] = -aOptArr[ VOPT_NULLVALS] = -aOptArr[ VOPT_VSCROLL ] = -aOptArr[ VOPT_HSCROLL ] = -aOptArr[ VOPT_TABCONTROLS ] = -aOptArr[ VOPT_OUTLINER] = -aOptArr[ VOPT_HEADER ] = -aOptArr[ VOPT_GRID] = -aOptArr[ VOPT_ANCHOR ] = -aOptArr[ VOPT_PAGEBREAKS ] = -aOptArr[ VOPT_CLIPMARKS ] = sal_True; - -aModeArr[VOBJ_TYPE_OLE ] = -aModeArr[VOBJ_TYPE_CHART] = +aOptArr[ VOPT_FORMULAS] = false; +aOptArr[ VOPT_SYNTAX ] = false; +aOptArr[ VOPT_HELPLINES ] = false; +aOptArr[ VOPT_GRID_ONTOP ] = false; +aOptArr[ VOPT_NOTES ] = true; +aOptArr[ VOPT_NULLVALS] = true; +aOptArr[ VOPT_VSCROLL ] = true; +aOptArr[ VOPT_HSCROLL ] = true; +aOptArr[ VOPT_TABCONTROLS ] = true; +aOptArr[ VOPT_OUTLINER] = true; +aOptArr[ VOPT_HEADER ] = true; +aOptArr[ VOPT_GRID] = true; +aOptArr[ VOPT_ANCHOR ] = true; +aOptArr[ VOPT_PAGEBREAKS ] = true; +aOptArr[ VOPT_CLIPMARKS ] = true; + +aModeArr[VOBJ_TYPE_OLE ] = VOBJ_MODE_SHOW; +aModeArr[VOBJ_TYPE_CHART] = VOBJ_MODE_SHOW; aModeArr[VOBJ_TYPE_DRAW ] = VOBJ_MODE_SHOW; aGridCol = Color( SC_STD_GRIDCOLOR ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/dpcache.hxx |1 sc/source/core/data/dpcache.cxx| 45 - sc/source/core/data/dpitemdata.cxx |3 +- 3 files changed, 43 insertions(+), 6 deletions(-) New commits: commit a81040bed300b1110fdef051ffaa21588d62c94f Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Sat Dec 15 00:46:12 2012 -0500 fdo#35943: Better performance with pivot table refresh. When the source data range contains trailing rows, simply skip them, and don't even bother iterating them. Apparently sometimes users specify a data range with a huge amount of trailing empty rows, which would slow down the pivot table refresh for no good reason. But we do still need to keep the original end row position, in case the pivot table needs to include empty cells in the output. Change-Id: I2c73c368837b8e322e12b25ddf31429488961f06 diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx index 0185f9d..69d11ec 100644 --- a/sc/inc/dpcache.hxx +++ b/sc/inc/dpcache.hxx @@ -121,6 +121,7 @@ private: LabelsType maLabelNames;// Stores dimension names. mdds::flat_segment_treeSCROW, bool maEmptyRows; SCROW mnDataSize; +SCROW mnRowCount; bool mbDisposing; diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index cf03b0d..724c842 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -56,6 +56,7 @@ ScDPCache::ScDPCache(ScDocument* pDoc) : mnColumnCount ( 0 ), maEmptyRows(0, MAXROW, true), mnDataSize(-1), +mnRowCount(0), mbDisposing(false) { } @@ -311,6 +312,16 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange rRange) mnColumnCount = nEndCol - nStartCol + 1; +// this row count must include the trailing empty rows. +mnRowCount = nEndRow - nStartRow; // skip the topmost label row. + +// Skip trailing empty rows if exists. +SCCOL nCol1 = nStartCol, nCol2 = nEndCol; +SCROW nRow1 = nStartRow, nRow2 = nEndRow; +pDoc-ShrinkToDataArea(nDocTab, nCol1, nRow1, nCol2, nRow2); +bool bTailEmptyRows = nEndRow nRow2; // Trailing empty rows exist. +nEndRow = nRow2; + maFields.reserve(mnColumnCount); for (size_t i = 0; i static_castsize_t(mnColumnCount); ++i) maFields.push_back(new Field); @@ -342,6 +353,17 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange rRange) } processBuckets(aBuckets, rField); + +if (bTailEmptyRows) +{ +// If the last item is not empty, append one. Note that the items +// are sorted, and empty item should come last when sorted. +if (rField.maItems.empty() || !rField.maItems.back().IsEmpty()) +{ +aData.SetEmpty(); +rField.maItems.push_back(aData); +} +} } PostInit(); @@ -404,6 +426,9 @@ bool ScDPCache::InitFromDataBase(DBConnector rDB) rDB.finish(); +if (!maFields.empty()) +mnRowCount = maFields[0].maData.size(); + PostInit(); return true; } @@ -684,6 +709,8 @@ void ScDPCache::PostInit() void ScDPCache::Clear() { +mnColumnCount = 0; +mnRowCount = 0; maFields.clear(); maLabelNames.clear(); maGroupFields.clear(); @@ -723,7 +750,18 @@ SCROW ScDPCache::GetItemDataId(sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty) OSL_ENSURE(nDim mnColumnCount, ScDPTableDataCache::GetItemDataId ); const Field rField = maFields[nDim]; -if (bRepeatIfEmpty) +if (static_castsize_t(nRow) = rField.maData.size()) +{ +// nRow is in the trailing empty rows area. +if (bRepeatIfEmpty) +nRow = rField.maData.size()-1; // Move to the last non-empty row. +else +// Return the last item, which should always be empty if the +// initialization has skipped trailing empty rows. +return rField.maItems.size()-1; + +} +else if (bRepeatIfEmpty) { while (nRow 0 rField.maItems[rField.maData[nRow]].IsEmpty()) --nRow; @@ -772,10 +810,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const SCROW ScDPCache::GetRowCount() const { -if (maFields.empty() || maFields[0].maData.empty()) -return 0; - -return maFields[0].maData.size(); +return mnRowCount; } SCROW ScDPCache::GetDataSize() const diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx index 5408714..85a6917 100644 --- a/sc/source/core/data/dpitemdata.cxx +++ b/sc/source/core/data/dpitemdata.cxx @@ -33,7 +33,8 @@ sal_Int32 ScDPItemData::Compare(const ScDPItemData rA, const ScDPItemData rB) { if (rA.meType != rB.meType) { -// group value, value and string in this order. +// group value, value and string in this order. Ensure that the empty +// type comes last.
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - sc/inc sc/source
sc/inc/document.hxx |6 ++--- sc/source/filter/oox/workbookfragment.cxx | 34 -- 2 files changed, 17 insertions(+), 23 deletions(-) New commits: commit 16f60be1d926369abac5d6bcb86d9dd1ba55e991 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Tue Dec 4 20:34:51 2012 -0500 Actually let's use the internal API directly here. Change-Id: I1690723b11db2d6f1f5101913ab68596a44c467e diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 7986930..d38142c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1646,9 +1646,9 @@ public: SvtListener* pListener ); voidPutInFormulaTree( ScFormulaCell* pCell ); voidRemoveFromFormulaTree( ScFormulaCell* pCell ); -voidCalcFormulaTree( bool bOnlyForced = false, - bool bNoProgressBar = false, - bool bDirtyFlag=true ); +SC_DLLPUBLIC void CalcFormulaTree( bool bOnlyForced = false, + bool bNoProgressBar = false, + bool bDirtyFlag=true ); voidClearFormulaTree(); voidAppendToFormulaTrack( ScFormulaCell* pCell ); voidRemoveFromFormulaTrack( ScFormulaCell* pCell ); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 896f648..3c696b6 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -20,7 +20,6 @@ #include workbookfragment.hxx #include com/sun/star/table/CellAddress.hpp -#include com/sun/star/sheet/XCalculatable.hpp #include oox/core/filterbase.hxx #include oox/drawingml/themefragmenthandler.hxx #include oox/helper/attributelist.hxx @@ -316,28 +315,23 @@ void WorkbookFragment::finalizeImport() finalizeWorkbookImport(); // Recalculate formula cells. -Reference XCalculatable xCalculatable( getDocument(), UNO_QUERY ); -if( xCalculatable.is() ) +bool bHardRecalc = false; +ScDocument rDoc = getScDocument(); +ScDocShell* pDocSh = static_castScDocShell*(rDoc.GetDocumentShell()); +if (rDoc.IsUserInteractionEnabled()) { -bool bHardRecalc = false; -ScDocument rDoc = getScDocument(); -if (rDoc.IsUserInteractionEnabled()) -{ -// Ask the user if full re-calculation is desired. -ScDocShell* pDocSh = static_castScDocShell*(rDoc.GetDocumentShell()); - -QueryBox aBox( -pDocSh-GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), -ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); +// Ask the user if full re-calculation is desired. +QueryBox aBox( +pDocSh-GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), +ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); -bHardRecalc = aBox.Execute() == RET_YES; -} - -if (bHardRecalc) -xCalculatable-calculateAll(); -else -xCalculatable-calculate(); +bHardRecalc = aBox.Execute() == RET_YES; } + +if (bHardRecalc) +pDocSh-DoHardRecalc(false); +else +rDoc.CalcFormulaTree(false, false, false); } // private ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits