Resolves: rhbz#1020712 wrong default CTL font shown in editengine

f41
Caolán McNamara 11 years ago
parent 640ea35c4b
commit 703328727b

@ -0,0 +1,134 @@
From e3bde35198d8a5420b7106c983766b88ccfba51a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 18 Oct 2013 15:36:28 +0100
Subject: [PATCH] Related: rhbz#1020712 wrong default font shown in editengine
Only in editengine could we have this fiasco.
There are two ImpEditEngine::GetScriptType's
a) sal_uInt16 ImpEditEngine::GetScriptType(const EditPaM& rPaM, sal_uInt16* pEndPos) const
this one returns i18n::ScriptType
b) sal_uInt16 ImpEditEngine::GetScriptType(const EditSelection& rSel) const
this one returns SCRIPTTYPE
Could there be a better way to ensure that mistakes will be made.
Anyway, within variant b, with an empty edit engine
ImpEditEngine::GetScriptType calls GetI18NScriptTypeOfLanguage but *that*
returns i18n::ScriptType's not SCRIPTTYPEs but when there is content then a
SCRIPTTYPE is truly returned.
Change-Id: I3a4a7c8746728e0fdfb25d961004c8339a24c93d
(cherry picked from commit e63a0d5657c7b9c7431525ba669b3edab0e56af3)
Related: rhbz#1020712 more i18n::ScriptType being compared against SCRIPTTYPE
Change-Id: I5da9114a3fd8330df2b63dc9187323765d305791
(cherry picked from commit b57ffef61afd61b57087150b1a9245e21079e15b)
Resolves: rhbz#1020712 return all the selected scripts
What we want here is *all* the scripts in the range, that's the whole point of
using SCRIPTTYPE. We use this to determine the font to show in the fontbox. If
it's an exclusive script then we can show the font that that script, and if
there are multiple scripts we know to set it empty.
With the other intermediate bugs out of the way, this now appears to work
correctly.
(cherry picked from commit f1a8aefec91f51a15c951f53f283a38a2edcd141)
Conflicts:
editeng/source/editeng/impedit2.cxx
Change-Id: I58426123602d70c151bd878e96fa5cbab7d3fd3e
---
editeng/source/editeng/impedit2.cxx | 39 ++++++++++++++++++++-----------------
editeng/source/editeng/impedit4.cxx | 4 ++--
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 4bc6d70..21d0d32 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1788,32 +1788,35 @@ sal_uInt16 ImpEditEngine::GetScriptType( const EditSelection& rSel ) const
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
- // find the first(!) script type position that holds the
- // complete selection. Thus it will work for selections as
- // well as with just moving the cursor from char to char.
+ // find all the scripts of this range
sal_uInt16 nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0;
sal_uInt16 nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len();
- for ( size_t n = 0; n < rTypes.size(); n++ )
+
+ //no selection, just bare cursor
+ if (nStartPara == nEndPara && nS == nE)
{
- if (rTypes[n].nStartPos <= nS && nE <= rTypes[n].nEndPos)
- {
+ //If we are not at the start of the paragraph we want the properties of the
+ //preceding character. Otherwise get the properties of the next (or what the
+ //next would have if it existed)
+ if (nS != 0)
+ --nS;
+ else
+ ++nE;
+ }
+
+ for (size_t n = 0; n < rTypes.size(); ++n)
+ {
+ bool bStartInRange = rTypes[n].nStartPos <= nS && nS < rTypes[n].nEndPos;
+ bool bEndInRange = rTypes[n].nStartPos < nE && nE <= rTypes[n].nEndPos;
+
+ if (bStartInRange || bEndInRange)
+ {
if ( rTypes[n].nScriptType != i18n::ScriptType::WEAK )
- {
nScriptType |= GetItemScriptType ( rTypes[n].nScriptType );
- }
- else
- {
- if ( !nScriptType && n )
- {
- // #93548# When starting with WEAK, use prev ScriptType...
- nScriptType = rTypes[n-1].nScriptType;
- }
- }
- break;
}
}
}
- return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
+ return nScriptType ? nScriptType : SvtLanguageOptions::GetScriptTypeOfLanguage( GetDefaultLanguage() );
}
sal_Bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 39e8156..5e0fa09 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2124,7 +2124,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() );
}
- sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
@@ -2171,7 +2171,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
if(eCurLanguage != aCurrentNewPortion->eLanguage)
{
- sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
--
1.8.3.1

@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice Name: libreoffice
Epoch: 1 Epoch: 1
Version: %{libo_version}.1 Version: %{libo_version}.1
Release: 1%{?libo_prerelease}%{?dist} Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
Group: Applications/Productivity Group: Applications/Productivity
URL: http://www.libreoffice.org/default/ URL: http://www.libreoffice.org/default/
@ -261,6 +261,7 @@ Patch20: 0001-Resolves-rhbz-1015281-crash-on-clicking-custom-anima.patch
Patch21: 0001-Resolves-rhbz-996162-apparent-NULL-bullet-font.patch Patch21: 0001-Resolves-rhbz-996162-apparent-NULL-bullet-font.patch
Patch22: 0001-fdo-70201-sw-eliminate-no-extent-RSID-only-AUTOFMT-h.patch Patch22: 0001-fdo-70201-sw-eliminate-no-extent-RSID-only-AUTOFMT-h.patch
Patch23: 0001-WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch Patch23: 0001-WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch
Patch24: 0001-Related-rhbz-1020712-wrong-default-font-shown-in-edi.patch
%define instdir %{_libdir} %define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice %define baseinstdir %{instdir}/libreoffice
@ -1016,6 +1017,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch21 -p1 -b .rhbz-996162-apparent-NULL-bullet-font.patch %patch21 -p1 -b .rhbz-996162-apparent-NULL-bullet-font.patch
%patch22 -p1 -b .fdo-70201-sw-eliminate-no-extent-RSID-only-AUTOFMT-h.patch %patch22 -p1 -b .fdo-70201-sw-eliminate-no-extent-RSID-only-AUTOFMT-h.patch
%patch23 -p1 -b .WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch %patch23 -p1 -b .WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch
%patch24 -p1 -b .rhbz-1020712-wrong-default-font-shown-in-edi.patch
# TODO: check this # TODO: check this
# these are horribly incomplete--empty translations and copied english # these are horribly incomplete--empty translations and copied english
@ -2106,6 +2108,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif %endif
%changelog %changelog
* Mon Oct 21 2013 Caolán McNamara <caolanm@redhat.com> - 1:4.1.3.1-2
- Resolves: rhbz#1020712 wrong default CTL font shown in editengine
* Wed Oct 16 2013 David Tardon <dtardon@redhat.com> - 1:4.1.3.1-1 * Wed Oct 16 2013 David Tardon <dtardon@redhat.com> - 1:4.1.3.1-1
- 4.1.3 rc1 - 4.1.3 rc1

Loading…
Cancel
Save