sc/inc/document.hxx | 2 ++ sc/source/core/tool/compiler.cxx | 16 ++++++++++++---- sw/inc/iodetect.hxx | 2 +- sw/source/ui/index/cnttab.cxx | 16 +++++++++++----- 4 files changed, 26 insertions(+), 10 deletions(-)
New commits: commit 721cd0658ab9721c01be0097f71a66ff3bdad7ac Author: Eike Rathke <[email protected]> AuthorDate: Sun Jan 30 23:36:53 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Jan 31 19:34:03 2022 +0100 Resolves: tdf#146722 Force row label for single text with numeric to the right Note this *might* break other uses of the non-deterministic automatic labels where exactly this constellation previously lead to a column label. For which expecting a column label though makes less sense.. Change-Id: Id85df7485f9b71620d8cbc404a981852d1567a54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129187 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins (cherry picked from commit 61cb699e88b3680becf78dc7b8bd514b2b7318a4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129079 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 50edcb77493e..3df5ddc926ff 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2598,7 +2598,9 @@ private: bool HasPartOfMerged( const ScRange& rRange ); +public: ScRefCellValue GetRefCellValue( const ScAddress& rPos ); +private: ScRefCellValue GetRefCellValue( const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos ); std::map< SCTAB, ScSortParam > mSheetSortParams; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 7a60d5fcabfc..074f78791c36 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3889,10 +3889,18 @@ bool ScCompiler::IsColRowName( const OUString& rName ) else aAdr = aOne; aRef.InitAddress( aAdr ); - if ( (aAdr.Row() != rDoc.MaxRow() && rDoc.HasStringData( - aAdr.Col(), aAdr.Row() + 1, aAdr.Tab())) - || (aAdr.Row() != 0 && rDoc.HasStringData( - aAdr.Col(), aAdr.Row() - 1, aAdr.Tab()))) + // Prioritize on column label; row label only if the next cell + // above/below the found label cell is text, or if both are not and + // the cell below is empty and the next cell to the right is + // numeric. + if ((aAdr.Row() < rDoc.MaxRow() && rDoc.HasStringData( + aAdr.Col(), aAdr.Row() + 1, aAdr.Tab())) + || (aAdr.Row() > 0 && rDoc.HasStringData( + aAdr.Col(), aAdr.Row() - 1, aAdr.Tab())) + || (aAdr.Row() < rDoc.MaxRow() && rDoc.GetRefCellValue( + ScAddress( aAdr.Col(), aAdr.Row() + 1, aAdr.Tab())).isEmpty() + && aAdr.Col() < rDoc.MaxCol() && rDoc.GetRefCellValue( + ScAddress( aAdr.Col() + 1, aAdr.Row(), aAdr.Tab())).hasNumeric())) aRef.SetRowRel( true ); // RowName else aRef.SetColRel( true ); // ColName commit 4dc4dfe0f249f454291a2d57e28f11342421bb00 Author: Andreas Heinisch <[email protected]> AuthorDate: Fri Jan 21 21:01:41 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Jan 31 19:32:22 2022 +0100 tdf#108910, tdf#125496 - read/write index entries using utf8 Always write an index concordance file using the utf8 encoding and read the index entries using the appropriate character set which is either utf8 or the os thread encoding. Change-Id: I5b30f4749f635bd51d8f0933ce5029d5303aef3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128745 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129207 diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx index ce24e0800134..3ad450a4e1e4 100644 --- a/sw/inc/iodetect.hxx +++ b/sw/inc/iodetect.hxx @@ -108,7 +108,7 @@ public: static bool IsValidStgFilter( const css::uno::Reference < css::embed::XStorage >& rStg, const SfxFilter& rFilter); // tdf#106899 - wrapper around IsDetectableText to retrieve the text encoding for a given stream - static rtl_TextEncoding GetTextEncoding(SvStream&); + SW_DLLPUBLIC static rtl_TextEncoding GetTextEncoding(SvStream&); static bool IsDetectableText( const char* pBuf, sal_uLong &rLen, rtl_TextEncoding *pCharSet, bool *pSwap, LineEnd *pLineEnd, bool *pBom); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 17a360bf522c..80d3bb3d27ca 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -53,6 +53,7 @@ #include <docsh.hxx> #include <swmodule.hxx> #include <modcfg.hxx> +#include <iodetect.hxx> #include <cmdid.h> #include <cnttab.hrc> @@ -3772,7 +3773,10 @@ void SwEntryBrowseBox::InitController( void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) { AutoMarkEntry* pToInsert = nullptr; - rtl_TextEncoding eTEnc = osl_getThreadTextEncoding(); + // tdf#108910, tdf#125496 - read index entries using the appropriate character set + rtl_TextEncoding eTEnc = SwIoSystem::GetTextEncoding(rInStr); + if (eTEnc == RTL_TEXTENCODING_DONTKNOW) + eTEnc = osl_getThreadTextEncoding(); while (rInStr.good()) { OUString sLine; @@ -3832,13 +3836,13 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr) if (pController->IsValueChangedFromSaved()) GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 )); - rtl_TextEncoding eTEnc = osl_getThreadTextEncoding(); for(const std::unique_ptr<AutoMarkEntry> & rpEntry : m_Entries) { AutoMarkEntry* pEntry = rpEntry.get(); if(!pEntry->sComment.isEmpty()) { - rOutStr.WriteByteStringLine( OUStringConcatenation("#" + pEntry->sComment), eTEnc ); + // tdf#108910, tdf#125496 - write index entries using the utf8 text encoding + rOutStr.WriteByteStringLine( OUStringConcatenation("#" + pEntry->sComment), RTL_TEXTENCODING_UTF8 ); } OUString sWrite( pEntry->sSearch + ";" + @@ -3850,7 +3854,8 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr) (pEntry->bWord ? std::u16string_view(u"1") : std::u16string_view(u"0")) ); if( sWrite.getLength() > 5 ) - rOutStr.WriteByteStringLine( sWrite, eTEnc ); + // tdf#108910, tdf#125496 - write index entries using the utf8 text encoding + rOutStr.WriteByteStringLine( sWrite, RTL_TEXTENCODING_UTF8 ); } } @@ -3918,7 +3923,8 @@ IMPL_LINK_NOARG(SwAutoMarkDlg_Impl, OkHdl, weld::Button&, void) bCreateMode ? StreamMode::WRITE : StreamMode::WRITE| StreamMode::TRUNC ); SvStream* pStrm = aMed.GetOutStream(); - pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 ); + // tdf#108910, tdf#125496 - write index entries using the utf8 text encoding + pStrm->SetStreamCharSet( RTL_TEXTENCODING_UTF8 ); if( !pStrm->GetError() ) { m_xEntriesBB->WriteEntries( *pStrm );
