diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:48:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 11:48:25 +0000 |
commit | 9c0049cfae49c8e4ddef9125a69db2ad134c10c6 (patch) | |
tree | 812a86c0eee63dfc5ace12f2622ed3ce9cd3d680 /sw/source/core/fields | |
parent | Releasing progress-linux version 4:24.2.3-2~progress7.99u1. (diff) | |
download | libreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.tar.xz libreoffice-9c0049cfae49c8e4ddef9125a69db2ad134c10c6.zip |
Merging upstream version 4:24.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/source/core/fields')
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/fields/reffld.cxx | 66 |
2 files changed, 46 insertions, 30 deletions
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index b3fab811f1..69f08a4eab 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -48,13 +48,12 @@ using namespace ::com::sun::star; using namespace nsSwDocInfoSubType; -static LanguageType lcl_GetLanguageOfFormat( LanguageType nLng, sal_uLong nFormat, - const SvNumberFormatter& rFormatter ) +static LanguageType lcl_GetLanguageOfFormat(LanguageType nLng, sal_uLong nFormat) { if( nLng == LANGUAGE_NONE ) // Bug #60010 nLng = LANGUAGE_SYSTEM; else if( nLng == ::GetAppLanguage() ) - switch( rFormatter.GetIndexTableOffset( nFormat )) + switch( SvNumberFormatter::GetIndexTableOffset( nFormat )) { case NF_NUMBER_SYSTEM: case NF_DATE_SYSTEM_SHORT: @@ -583,7 +582,7 @@ OUString SwValueFieldType::ExpandValue( const double& rVal, const Color* pCol = nullptr; // Bug #60010 - LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, nFormat, *pFormatter ); + LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, nFormat ); if( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && LANGUAGE_SYSTEM != nFormatLng ) { @@ -752,8 +751,7 @@ void SwValueField::SetLanguage( LanguageType nLng ) { // Bug #60010 SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter(); - LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat(), - *pFormatter ); + LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat() ); if( (GetFormat() >= SV_COUNTRY_LANGUAGE_OFFSET || LANGUAGE_SYSTEM != nFormatLng ) && diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 0ee26771bb..85a18c7892 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1220,7 +1220,9 @@ namespace /// Picks the first text node with a matching style from a double ended queue, starting at the front /// This allows us to use the deque either as a stack or as a queue depending on whether we want to search up or down SwTextNode* SearchForStyleAnchor(SwTextNode* pSelf, const std::deque<SwNode*>& pToSearch, - std::u16string_view rStyleName, bool bCaseSensitive = true) + std::u16string_view rStyleName, + sal_Int32 *const pStart, sal_Int32 *const pEnd, + bool bCaseSensitive = true) { std::deque<SwNode*> pSearching(pToSearch); while (!pSearching.empty()) @@ -1235,15 +1237,38 @@ namespace if (!pTextNode) continue; - if (bCaseSensitive) + if (bCaseSensitive + ? pTextNode->GetFormatColl()->GetName() == rStyleName + : pTextNode->GetFormatColl()->GetName().equalsIgnoreAsciiCase(rStyleName)) { - if (pTextNode->GetFormatColl()->GetName() == rStyleName) - return pTextNode; + *pStart = 0; + if (pEnd) + { + *pEnd = pTextNode->GetText().getLength(); + } + return pTextNode; } - else + + if (auto const pHints = pTextNode->GetpSwpHints()) { - if (pTextNode->GetFormatColl()->GetName().equalsIgnoreAsciiCase(rStyleName)) - return pTextNode; + for (size_t i = 0; i < pHints->Count(); ++i) + { + auto const*const pHint(pHints->Get(i)); + if (pHint->Which() == RES_TXTATR_CHARFMT) + { + if (bCaseSensitive + ? pHint->GetCharFormat().GetCharFormat()->HasName(rStyleName) + : pHint->GetCharFormat().GetCharFormat()->GetName().equalsIgnoreAsciiCase(rStyleName)) + { + *pStart = pHint->GetStart(); + if (pEnd) + { + *pEnd = *pHint->End(); + } + return pTextNode; + } + } + } } } @@ -1505,21 +1530,21 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, pSearchThird.push_back(nodes[n]); } - pTextNd = SearchForStyleAnchor(pSelf, pInPage, rRefMark); + pTextNd = SearchForStyleAnchor(pSelf, pInPage, rRefMark, pStt, pEnd); if (pTextNd) { break; } // 2. Search up from the top of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark); + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, pStt, pEnd); if (pTextNd) { break; } // 3. Search down from the bottom of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark); + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark, pStt, pEnd); if (pTextNd) { break; @@ -1528,21 +1553,21 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, // Word has case insensitive styles. LO has case sensitive styles. If we didn't find // it yet, maybe we could with a case insensitive search. Let's do that - pTextNd = SearchForStyleAnchor(pSelf, pInPage, rRefMark, + pTextNd = SearchForStyleAnchor(pSelf, pInPage, rRefMark, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) { break; } - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) { break; } - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark, + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, rRefMark, pStt, pEnd, false /* bCaseSensitive */); break; } @@ -1574,7 +1599,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, // 1. Search up until we hit the top of the document - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark); + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark, pStt, pEnd); if (pTextNd) { break; @@ -1582,7 +1607,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, // 2. Search down until we hit the bottom of the document - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark); + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, pStt, pEnd); if (pTextNd) { break; @@ -1590,14 +1615,14 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, // Again, we need to remember that Word styles are not case sensitive - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark, + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, rRefMark, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) { break; } - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, rRefMark, pStt, pEnd, false /* bCaseSensitive */); break; } @@ -1605,13 +1630,6 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, OSL_FAIL("<SwGetRefFieldType::FindAnchor(..)> - unknown getref element type"); } - if (pTextNd) - { - *pStt = 0; - if (pEnd) - *pEnd = pTextNd->GetText().getLength(); - } - break; } |