sc/source/core/tool/compiler.cxx | 16 ++++++++++++++++ sc/source/core/tool/dbdata.cxx | 21 ++++++++++++++++++++- sc/source/filter/oox/workbookfragment.cxx | 1 + sc/source/filter/oox/worksheethelper.cxx | 1 - 4 files changed, 37 insertions(+), 2 deletions(-)
New commits: commit 53d8b34465e28909491def39bfd11dfb83876939 Author: Eike Rathke <er...@redhat.com> Date: Thu Jun 25 14:46:55 2015 +0200 TableRef: ScCompiler::IsTableRefColumn() lookup column name in ScDBData ... as a fallback for named expressions during document import when cell content isn't available yet. Change-Id: I134ac2aaeb5f336703edbadfd6664d916d2c5885 (cherry picked from commit 4fc13975ad83fd2e95d2383ab0e9af688c47710d) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 1a63740..04f7c01 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3496,6 +3496,22 @@ bool ScCompiler::IsTableRefColumn( const OUString& rName ) const } } } + + // And now a fallback for named expressions during document load time when + // cell content isn't available yet. This could be the preferred method IF + // the ScDBData column names were maintained and refreshed on ALL sheet + // operations, including cell content changes. + sal_Int32 nOffset = pDBData->GetColumnNameOffset( aName); + if (nOffset >= 0) + { + ScSingleRefData aRef; + ScAddress aAdr( aRange.aStart); + aAdr.IncCol( nOffset); + aRef.InitAddress( aAdr); + maRawToken.SetSingleReference( aRef ); + return true; + } + return false; } commit e8e333aa176d613d074b7730d7de4efacfad9bc9 Author: Eike Rathke <er...@redhat.com> Date: Thu Jun 25 14:45:37 2015 +0200 TableRef: search table column names case insensitive Change-Id: I753a4511aa2c1e37b83094189902ce7031d68c04 (cherry picked from commit cd3486798496545271baa2cb5d7beb6f0a99dcca) diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index ef39e8b..113fa5f 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -603,10 +603,29 @@ void ScDBData::AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL nDx, aNewNames.swap( maTableColumnNames); } +namespace { +class TableColumnNameSearch : public unary_function<ScDBData, bool> +{ +public: + explicit TableColumnNameSearch( const OUString& rSearchName ) : + maSearchName( rSearchName ) + { + } + + bool operator()( const OUString& rName ) const + { + return ScGlobal::GetpTransliteration()->isEqual( maSearchName, rName); + } + +private: + OUString maSearchName; +}; +} + sal_Int32 ScDBData::GetColumnNameOffset( const OUString& rName ) const { ::std::vector<OUString>::const_iterator it( - ::std::find( maTableColumnNames.begin(), maTableColumnNames.end(), rName)); + ::std::find_if( maTableColumnNames.begin(), maTableColumnNames.end(), TableColumnNameSearch( rName))); if (it != maTableColumnNames.end()) return it - maTableColumnNames.begin(); commit 3fc8cf504fab9a45c1f9a0dd4ff09949dfbec981 Author: Eike Rathke <er...@redhat.com> Date: Thu Jun 25 14:43:18 2015 +0200 TableRef: move getTables().applyTableColumns() to the correct position ... in import sequence. Change-Id: Ib5601af281f0378d283ecd61fa71c41e6c1be254 (cherry picked from commit 58b0c0cf0c1429ec2f7f5ef8fc9ebc4840ace92d) diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 342be2b..4b37d0f 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -461,6 +461,7 @@ void WorkbookFragment::finalizeImport() // create all database ranges and defined names, in that order getTables().finalizeImport(); + getTables().applyTableColumns(); getDefinedNames().finalizeImport(); // open the VBA project storage OUString aVbaFragmentPath = getFragmentPathFromFirstType( CREATE_MSOFFICE_RELATION_TYPE( "vbaProject" ) ); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 9875f0e..d74f344 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -943,7 +943,6 @@ void WorksheetGlobals::finalizeWorksheetImport() // assumes getTables().finalizeImport ( which creates the DatabaseRanges ) // has been called already getTables().applyAutoFilters(); - getTables().applyTableColumns(); getCondFormats().finalizeImport(); lclUpdateProgressBar( mxFinalProgress, 0.25 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits