update to 4.4.1 rc1

f41
David Tardon 10 years ago
parent dbe428adc5
commit 1556d1a49c

3
.gitignore vendored

@ -54,3 +54,6 @@
/libreoffice-4.4.0.3.tar.xz
/libreoffice-help-4.4.0.3.tar.xz
/libreoffice-translations-4.4.0.3.tar.xz
/libreoffice-4.4.1.1.tar.xz
/libreoffice-help-4.4.1.1.tar.xz
/libreoffice-translations-4.4.1.1.tar.xz

@ -1,27 +0,0 @@
From b471dca2a924a3f03fe2a0a7fe2612f9c6c6bd54 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 23 Jan 2015 15:55:24 +0100
Subject: [PATCH] Related rhbz#1185307: One more location to look for Hamcrest
jar
Change-Id: I307a009c14dd5cd946b39fbfb80ffc3962a7739b
---
configure.ac | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 5c67205..607e97e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12022,6 +12022,8 @@ if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
if test "$with_hamcrest" = "yes"; then
if test -e /usr/share/lib/java/hamcrest.jar; then
HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
+ elif test -e /usr/share/java/hamcrest/core.jar; then
+ HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
else
HAMCREST_JAR=/usr/share/java/hamcrest.jar
fi
--
1.9.3

@ -1,31 +0,0 @@
From dae7d2089516d9cf014b9fad0adb484f19282a29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Sat, 24 Jan 2015 20:59:27 +0000
Subject: [PATCH] Resolves: rhbz#1179642 crash in GetFocus with empty
mpPreviouslyFocusedListBox
Change-Id: I7559067c00617482d34e7cbdd177202868cbfc76
---
sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 84b61d4..ff0c95e 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -123,9 +123,10 @@ void ScPivotLayoutTreeListBase::GetFocus()
if( GetGetFocusFlags() & GETFOCUS_MNEMONIC )
{
SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
- InsertEntryForSourceTarget(pEntry, NULL);
+ if (pEntry)
+ InsertEntryForSourceTarget(pEntry, NULL);
- if(mpParent->mpPreviouslyFocusedListBox != NULL)
+ if (mpParent->mpPreviouslyFocusedListBox != NULL)
mpParent->mpPreviouslyFocusedListBox->GrabFocus();
}
--
1.9.3

@ -1,72 +0,0 @@
From 15e1c881684c0127c0ca989924bbf2508b4fd780 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 26 Jan 2015 15:00:29 +0000
Subject: [PATCH] don't strip font names of apparent script suffixes anymore
e.g. "CM Roman CE" should be left alone.
bump font cache id to invalidate old cached lists
I think this practice stems from Window 3.1/Word 95 where the encoding was
included in the font name
http://www.webcenter.ru/~kazarn/eng/fonts_ttf.htm#charsettbl Microsoft Office
still generates RTF files with weird-ass Win 3.1 style fontnames but any actual
existing fonts that happen to have names that fall into that pattern should be
left alone now.
Change-Id: Ibb704048d63b33ce510d6b1076700c6e94a0af2a
---
unotools/qa/unit/testGetEnglishSearchName.cxx | 7 +++----
unotools/source/misc/fontdefs.cxx | 2 --
vcl/generic/fontmanager/fontcache.cxx | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/unotools/qa/unit/testGetEnglishSearchName.cxx b/unotools/qa/unit/testGetEnglishSearchName.cxx
index dbc8b17..c9d8e1f 100644
--- a/unotools/qa/unit/testGetEnglishSearchName.cxx
+++ b/unotools/qa/unit/testGetEnglishSearchName.cxx
@@ -39,12 +39,11 @@ void Test::testSingleElement()
//trailingWhitespaces
test1 = GetEnglishSearchFontName( "Symbol " );
CPPUNIT_ASSERT_EQUAL(OUString("symbol"),test1);
- //removing Skripts
+ //no longer remove script suffixes
test1 = GetEnglishSearchFontName( "Symbol(SIP)" );
CPPUNIT_ASSERT_EQUAL(OUString("symbol(sip)"),test1);
- //remove Whitespaces between
- test1 = GetEnglishSearchFontName( "Symbol (thai)" );
- CPPUNIT_ASSERT_EQUAL( OUString("symbol"),test1);
+ test1 = GetEnglishSearchFontName( "CM Roman CE" );
+ CPPUNIT_ASSERT_EQUAL( OUString("cmromance"),test1);
//remove special characters; leave semicolon, numbers
test1 = GetEnglishSearchFontName( "sy;mb?=ol129" );
CPPUNIT_ASSERT_EQUAL( OUString("sy;mbol129"),test1);
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index f368cc6..04c6fc4 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -367,8 +367,6 @@ OUString GetEnglishSearchFontName(const OUString& rInName)
if ( i != nLen )
rName.truncate(i);
- // Remove Script at the end
- rName = StripScriptFromName(rName.toString());
nLen = rName.getLength();
// remove all whitespaces and converts to lower case ASCII
diff --git a/vcl/generic/fontmanager/fontcache.cxx b/vcl/generic/fontmanager/fontcache.cxx
index 56a15bf..e978eb7 100644
--- a/vcl/generic/fontmanager/fontcache.cxx
+++ b/vcl/generic/fontmanager/fontcache.cxx
@@ -38,7 +38,7 @@
#endif
#define FONTCACHEFILE "/user/psprint/pspfontcache"
-#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 5"
+#define CACHE_MAGIC "LibreOffice PspFontCacheFile format 6"
using namespace std;
using namespace psp;
--
1.9.3

@ -1,40 +0,0 @@
From df756ee1f2c37c8ed02bf8b357102e577c41901f Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 29 Jan 2015 10:26:01 +0100
Subject: [PATCH] fix assert call
Change-Id: I3b06c79b733cf4e97049a8a437680e1f8f339dac
---
bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx | 2 +-
bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
index 4922278..a21e43e 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx
@@ -360,7 +360,7 @@ static typelib_TypeClass cpp_mediate(
// determine called method
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
- assert(nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!");
+ assert(nMemberPos < pTypeDescr->nAllMembers); // illegal member index!
TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
index c1815b4..1d95dee 100644
--- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
@@ -289,7 +289,7 @@ static void cpp_call(
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- assert(pReturnTypeDescr, "### expected return type description!");
+ assert(pReturnTypeDescr); // ### expected return type description!
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
--
2.1.0

@ -0,0 +1,35 @@
From 63a5f3804578dc185a88b7f88cdbdfc53dde02b4 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 11 Feb 2015 22:56:53 +0100
Subject: [PATCH] fix linker error
/builddir/build/BUILD/libreoffice-4.4.1.1/workdir/CxxObject/svtools/source/misc/imageresourceaccess.o: In function `com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>::Reference(com::sun::star::io::XOutputStream*)':
/builddir/build/BUILD/libreoffice-4.4.1.1/include/com/sun/star/uno/Reference.hxx:137: undefined reference to `non-virtual thunk to utl::OSeekableOutputStreamWrapper::acquire()'
Change-Id: Ic644a8299cf2f79f02c1e3ca0de9687520f402a9
---
include/unotools/streamwrap.hxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/unotools/streamwrap.hxx b/include/unotools/streamwrap.hxx
index e8027ce..8efc227 100644
--- a/include/unotools/streamwrap.hxx
+++ b/include/unotools/streamwrap.hxx
@@ -123,12 +123,12 @@ typedef ::cppu::ImplHelper1 < css::io::XSeekable
/** helper class for wrapping an SvStream into an com.sun.star.io::XOutputStream
which is seekable (i.e. supports the com.sun.star.io::XSeekable interface).
*/
-class OSeekableOutputStreamWrapper
+class UNOTOOLS_DLLPUBLIC OSeekableOutputStreamWrapper
:public OOutputStreamWrapper
,public OSeekableOutputStreamWrapper_Base
{
public:
- UNOTOOLS_DLLPUBLIC OSeekableOutputStreamWrapper(SvStream& _rStream);
+ OSeekableOutputStreamWrapper(SvStream& _rStream);
private:
virtual ~OSeekableOutputStreamWrapper();
--
2.1.0

@ -1,87 +0,0 @@
From 36e158ce7a0effb130936ba4598a193102faa6a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 19 Jan 2015 12:09:17 +0000
Subject: [PATCH 1/2] if we change the keys we have to resort based on the new
keys
Change-Id: Ied95c2d1490554d9ba5402c936a9720c8a325771
---
sw/source/core/doc/docredln.cxx | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 960a15d..b2f1eea 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1336,6 +1336,8 @@ void SwRangeRedline::MoveFromSection()
SwDoc* pDoc = GetDoc();
const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
std::vector<SwPosition*> aBeforeArr, aBehindArr;
+ typedef std::map<sal_uInt16, SwRangeRedline*> IndexAndRange;
+ IndexAndRange aIndexAndRangeMap;
sal_uInt16 nMyPos = rTbl.GetPos( this );
OSL_ENSURE( this, "this is not in the array?" );
bool bBreak = false;
@@ -1346,12 +1348,16 @@ void SwRangeRedline::MoveFromSection()
bBreak = true;
if( rTbl[ n ]->GetBound(true) == *GetPoint() )
{
- aBehindArr.push_back( &rTbl[ n ]->GetBound(true) );
+ SwRangeRedline* pRedl = rTbl[n];
+ aBehindArr.push_back(&pRedl->GetBound(true));
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl));
bBreak = false;
}
if( rTbl[ n ]->GetBound(false) == *GetPoint() )
{
- aBehindArr.push_back( &rTbl[ n ]->GetBound(false) );
+ SwRangeRedline* pRedl = rTbl[n];
+ aBehindArr.push_back(&pRedl->GetBound(false));
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl));
bBreak = false;
}
}
@@ -1361,12 +1367,16 @@ void SwRangeRedline::MoveFromSection()
bBreak = true;
if( rTbl[ n ]->GetBound(true) == *GetPoint() )
{
- aBeforeArr.push_back( &rTbl[ n ]->GetBound(true) );
+ SwRangeRedline* pRedl = rTbl[n];
+ aBeforeArr.push_back(&pRedl->GetBound(true));
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl));
bBreak = false;
}
if( rTbl[ n ]->GetBound(false) == *GetPoint() )
{
- aBeforeArr.push_back( &rTbl[ n ]->GetBound(false) );
+ SwRangeRedline* pRedl = rTbl[n];
+ aBeforeArr.push_back(&pRedl->GetBound(false));
+ aIndexAndRangeMap.insert(std::make_pair(n, pRedl));
bBreak = false;
}
}
@@ -1420,6 +1430,7 @@ void SwRangeRedline::MoveFromSection()
if( pColl && pCNd )
pCNd->ChgFmtColl( pColl );
}
+
// #i95771#
// Under certain conditions the previous <SwDoc::Move(..)> has already
// removed the change tracking section of this <SwRangeRedline> instance from
@@ -1440,6 +1451,13 @@ void SwRangeRedline::MoveFromSection()
*aBeforeArr[ n ] = *Start();
for( n = 0; n < aBehindArr.size(); ++n )
*aBehindArr[ n ] = *End();
+ SwRedlineTbl& rResortTbl = const_cast<SwRedlineTbl&>(rTbl);
+ for (auto& a : aIndexAndRangeMap)
+ {
+ // re-insert
+ rResortTbl.Remove(a.first);
+ rResortTbl.Insert(a.second);
+ }
}
else
InvalidateRange();
--
1.9.3

@ -1,137 +0,0 @@
From 4f747afae591f244164df25d96a83f417e6c0698 Mon Sep 17 00:00:00 2001
From: Michael Stahl <mstahl@redhat.com>
Date: Thu, 15 Jan 2015 17:00:13 +0100
Subject: [PATCH] rhbz#1175027: sw: fix life cycle of
SwConnectionDisposedListener_Impl
The SwDBManager is owned by SwDoc, so if the database thing is still
alive when SwDoc dies (which may or may not indicate a leak), the
listener will crash when the database stuff is eventually disposed
during shutdown.
Change-Id: I2bb5eb35f0a403374bc8f123b85ba2d7244016b0
---
sw/source/uibase/dbui/dbmgr.cxx | 41 +++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index ddcaf6e..fc79e80 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -198,26 +198,35 @@ bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultS
class SwConnectionDisposedListener_Impl : public cppu::WeakImplHelper1
< lang::XEventListener >
{
- SwDBManager& rDBManager;
+private:
+ SwDBManager * m_pDBManager;
virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
+
public:
SwConnectionDisposedListener_Impl(SwDBManager& rMgr);
virtual ~SwConnectionDisposedListener_Impl();
+ void Dispose() { m_pDBManager = 0; }
+
};
struct SwDBManager_Impl
{
SwDSParam* pMergeData;
AbstractMailMergeDlg* pMergeDialog;
- uno::Reference<lang::XEventListener> xDisposeListener;
+ ::rtl::Reference<SwConnectionDisposedListener_Impl> m_xDisposeListener;
SwDBManager_Impl(SwDBManager& rDBManager)
:pMergeData(0)
,pMergeDialog(0)
- ,xDisposeListener(new SwConnectionDisposedListener_Impl(rDBManager))
+ , m_xDisposeListener(new SwConnectionDisposedListener_Impl(rDBManager))
{}
+
+ ~SwDBManager_Impl()
+ {
+ m_xDisposeListener->Dispose();
+ }
};
static void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<XDataSource> xSource)
@@ -350,7 +359,7 @@ bool SwDBManager::MergeNew( const SwMergeDescriptor& rMergeDesc )
{
uno::Reference<XComponent> xComponent(pInsert->xConnection, UNO_QUERY);
if(xComponent.is())
- xComponent->addEventListener(pImpl->xDisposeListener);
+ xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
catch(const Exception&)
{
@@ -2124,7 +2133,7 @@ uno::Reference< XConnection> SwDBManager::RegisterConnection(OUString& rDataSour
{
uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
if(xComponent.is())
- xComponent->addEventListener(pImpl->xDisposeListener);
+ xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
catch(const Exception&)
{
@@ -2236,7 +2245,7 @@ SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate)
{
uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
if(xComponent.is())
- xComponent->addEventListener(pImpl->xDisposeListener);
+ xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
catch(const Exception&)
{
@@ -2273,7 +2282,7 @@ SwDSParam* SwDBManager::FindDSConnection(const OUString& rDataSource, bool bCre
{
uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
if(xComponent.is())
- xComponent->addEventListener(pImpl->xDisposeListener);
+ xComponent->addEventListener(pImpl->m_xDisposeListener.get());
}
catch(const Exception&)
{
@@ -2822,27 +2831,31 @@ uno::Reference<XResultSet> SwDBManager::createCursor(const OUString& _sDataSourc
return xResultSet;
}
-SwConnectionDisposedListener_Impl::SwConnectionDisposedListener_Impl(SwDBManager& rMgr) :
- rDBManager(rMgr)
+SwConnectionDisposedListener_Impl::SwConnectionDisposedListener_Impl(SwDBManager& rManager)
+ : m_pDBManager(&rManager)
{
-};
+}
SwConnectionDisposedListener_Impl::~SwConnectionDisposedListener_Impl()
{
-};
+}
void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource )
throw (RuntimeException, std::exception)
{
::SolarMutexGuard aGuard;
+
+ if (!m_pDBManager) return; // we're disposed too!
+
uno::Reference<XConnection> xSource(rSource.Source, UNO_QUERY);
- for(sal_uInt16 nPos = rDBManager.aDataSourceParams.size(); nPos; nPos--)
+ for (size_t nPos = m_pDBManager->aDataSourceParams.size(); nPos; nPos--)
{
- SwDSParam* pParam = &rDBManager.aDataSourceParams[nPos - 1];
+ SwDSParam* pParam = &m_pDBManager->aDataSourceParams[nPos - 1];
if(pParam->xConnection.is() &&
(xSource == pParam->xConnection))
{
- rDBManager.aDataSourceParams.erase(rDBManager.aDataSourceParams.begin() + nPos - 1);
+ m_pDBManager->aDataSourceParams.erase(
+ m_pDBManager->aDataSourceParams.begin() + nPos - 1);
}
}
}
--
2.1.0

@ -1,476 +0,0 @@
From 509c57e91c324decada94ac1f70a58fdf52a6372 Mon Sep 17 00:00:00 2001
From: Michael Stahl <mstahl@redhat.com>
Date: Tue, 27 Jan 2015 00:20:58 +0100
Subject: [PATCH] rhbz#1177022: vcl: fix PDF embedding of Type 1 fonts
Problem is that for the "CM Typewriter" font the Width for "space" (32)
is exported as 0 instead of 525, which is the correct value in the AFM.
The reason is that PDFWriterImpl::emitEmbeddedFont() has various arrays
to map from font code points to Unicode code points, and there are
duplicate mappings, so the 160->32 mapping overrides 32->32.
The PrintFontManager::PrintFont::readAfmMetrics() actually creates a
Unicode to font code mapping (which may legitimately be n:1) that is
then inverted; add an additional hack to store a set of "preferred"
Unicodes so that PDFWriterImpl can pick the right Unicode.
Presumably the code that is stored explicitly via "C" or "CH" in the
AFM should take priority over more generic mappings.
Conflicts:
vcl/inc/cairotextrender.hxx
vcl/inc/textrender.hxx
vcl/inc/unx/salgdi.h
vcl/source/gdi/pdfwriter_impl.cxx
Change-Id: Id4205a1cd45ba6a0a5facee1e39f70c3535e7dd4
---
vcl/generic/fontmanager/fontmanager.cxx | 25 +++++++++++++++++++++-
vcl/generic/print/genpspgraphics.cxx | 8 +++----
vcl/headless/svptext.cxx | 4 ++--
vcl/inc/cairotextrender.hxx | 2 +-
vcl/inc/fontmanager.hxx | 7 ++++++-
vcl/inc/generic/genpspgraphics.h | 6 ++++--
vcl/inc/headless/svpgdi.hxx | 2 +-
vcl/inc/quartz/salgdi.h | 2 +-
vcl/inc/salgdi.hxx | 4 +++-
vcl/inc/textrender.hxx | 2 +-
vcl/inc/unx/salgdi.h | 2 +-
vcl/inc/win/salgdi.h | 2 +-
vcl/quartz/salgdi.cxx | 2 +-
vcl/source/gdi/pdfwriter_impl.cxx | 37 +++++++++++++++++++++++++++++++--
vcl/unx/generic/gdi/cairotextrender.cxx | 4 ++--
vcl/unx/generic/gdi/salgdi3.cxx | 4 ++--
vcl/win/source/gdi/salgdi3.cxx | 2 +-
17 files changed, 90 insertions(+), 25 deletions(-)
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 33fb4ed..d5b481f 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -291,6 +291,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
}
m_aEncodingVector.clear();
+ m_aEncodingVectorPriority.clear();
// fill in global info
// PSName
@@ -504,7 +505,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
{
pUnicodes[i] = pChar->code + 0xf000;
if( bFillEncodingvector )
+ {
m_aEncodingVector[ pUnicodes[i] ] = pChar->code;
+ m_aEncodingVectorPriority.insert(pUnicodes[i]);
+ }
continue;
}
@@ -565,7 +569,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
{
m_pMetrics->m_aMetrics[ pUnicodes[i] ] = aMetric;
if( bFillEncodingvector )
+ {
m_aEncodingVector[ pUnicodes[i] ] = pChar->code;
+ m_aEncodingVectorPriority.insert(pUnicodes[i]);
+ }
}
else if( pChar->name )
{
@@ -593,13 +600,21 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
::std::pair< ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator,
::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator >
aCodes = rManager.getUnicodeFromAdobeCode( pChar->code );
+ bool bFirst = true;
while( aCodes.first != aCodes.second )
{
if( (*aCodes.first).second != 0 )
{
m_pMetrics->m_aMetrics[ (*aCodes.first).second ] = aMetric;
if( bFillEncodingvector )
+ {
m_aEncodingVector[ (*aCodes.first).second ] = pChar->code;
+ if (bFirst) // arbitrarily prefer the first one
+ {
+ m_aEncodingVectorPriority.insert((*aCodes.first).second);
+ bFirst = false;
+ }
+ }
}
++aCodes.first;
}
@@ -613,7 +628,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
m_pMetrics->m_aMetrics[ code ] = aMetric;
// maybe should try to find the name in the convtabs ?
if( bFillEncodingvector )
+ {
m_aEncodingVector[ code ] = pChar->code;
+ m_aEncodingVectorPriority.insert(code);
+ }
}
}
}
@@ -2140,7 +2158,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
}
}
-const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded ) const
+const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded, std::set<sal_Unicode> const** ppPriority ) const
{
PrintFont* pFont = getFont( nFont );
if( !pFont || pFont->m_eType != fonttype::Type1 )
@@ -2152,6 +2170,11 @@ const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( font
if( pNonEncoded )
*pNonEncoded = pFont->m_aNonEncoded.size() ? &pFont->m_aNonEncoded : NULL;
+ if (ppPriority)
+ {
+ *ppPriority = &pFont->m_aEncodingVectorPriority;
+ }
+
return pFont->m_aEncodingVector.size() ? &pFont->m_aEncodingVector : NULL;
}
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 1e63ab0..58991c3 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1009,7 +1009,7 @@ bool GenPspGraphics::CreateFontSubset(
return bSuccess;
}
-const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
{
// in this context the pFont->GetFontId() is a valid PSP
// font since they are the only ones left after the PDF
@@ -1017,7 +1017,7 @@ const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
+ return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded, ppPriority );
}
void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
@@ -1034,7 +1034,7 @@ void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
GenPspGraphics::DoGetGlyphWidths( aFont, bVertical, rWidths, rUnicodeEnc );
}
-const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
{
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
@@ -1046,7 +1046,7 @@ const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const
return NULL;
}
- return rMgr.getEncodingMap( aFont, pNonEncoded );
+ return rMgr.getEncodingMap( aFont, pNonEncoded, ppPriority );
}
void GenPspGraphics::DoGetGlyphWidths( psp::fontID aFont,
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 8fc51ce..5fb0af8 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -321,7 +321,7 @@ bool SvpSalGraphics::CreateFontSubset(
return bSuccess;
}
-const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
{
// in this context the pFont->GetFontId() is a valid PSP
// font since they are the only ones left after the PDF
@@ -329,7 +329,7 @@ const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
+ return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority);
}
const void* SvpSalGraphics::GetEmbedFontData(
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index 2b8a21e..fdbc001 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -104,7 +104,7 @@ public:
int nGlyphs,
FontSubsetInfo& rInfo
) SAL_OVERRIDE;
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
diff --git a/vcl/inc/fontmanager.hxx b/vcl/inc/fontmanager.hxx
index e1203bd..0091849 100644
--- a/vcl/inc/fontmanager.hxx
+++ b/vcl/inc/fontmanager.hxx
@@ -202,7 +202,12 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
bool m_bHaveVerticalSubstitutedGlyphs;
bool m_bUserOverride;
+ /// mapping from unicode (well, UCS-2) to font code
std::map< sal_Unicode, sal_Int32 > m_aEncodingVector;
+ /// HACK for Type 1 fonts: if multiple UCS-2 codes map to the same
+ /// font code, this set contains the preferred one, i.e., the one that
+ /// is specified explicitly via "C" or "CH" in the AFM file
+ std::set<sal_Unicode> m_aEncodingVectorPriority;
std::map< sal_Unicode, OString > m_aNonEncoded;
explicit PrintFont( fonttype::type eType );
@@ -438,7 +443,7 @@ public:
// if ppNonEncoded is set and non encoded type1 glyphs exist
// then *ppNonEncoded is set to the mapping for nonencoded glyphs.
// the encoding vector contains -1 for non encoded glyphs
- const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded ) const;
+ const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded, std::set<sal_Unicode> const ** ppPriority ) const;
// evaluates copyright flags for TrueType fonts for printing/viewing
// type1 fonts do not have such a feature, so return for them is true
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index 18a434f..b2cf527 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -60,7 +60,8 @@ public:
// helper methods for sharing with X11SalGraphics
static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont,
- const Ucs2OStrMap** pNonEncoded );
+ const Ucs2OStrMap** pNonEncoded,
+ std::set<sal_Unicode> const** ppPriority);
static void DoGetGlyphWidths( psp::fontID aFont,
bool bVertical,
Int32Vector& rWidths,
@@ -107,7 +108,8 @@ public:
int nGlyphs,
FontSubsetInfo& rInfo ) SAL_OVERRIDE;
virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*,
- const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
+ const Ucs2OStrMap** ppNonEncoded,
+ std::set<sal_Unicode> const** ppPriority) SAL_OVERRIDE;
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 9ae3d05..87bf5e0e 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -176,7 +176,7 @@ public:
int nGlyphs,
FontSubsetInfo& rInfo
) SAL_OVERRIDE;
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 9a5d4da..e9c51cbd 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -368,7 +368,7 @@ public:
// glyphs with only a name) exist it is set to the corresponding
// map for non encoded glyphs; the encoding vector contains -1
// as encoding for these cases
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
// GetEmbedFontData: gets the font data for a font marked
// embeddable by GetDevFontList or NULL in case of error
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index ff6271c..2849cc1 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -34,6 +34,7 @@
#include "sallayout.hxx"
#include <map>
+#include <set>
class PhysicalFontCollection;
class SalBitmap;
@@ -188,7 +189,8 @@ public:
// as encoding for these cases
virtual const Ucs2SIntMap* GetFontEncodingVector(
const PhysicalFontFace*,
- const Ucs2OStrMap** ppNonEncoded ) = 0;
+ const Ucs2OStrMap** ppNonEncoded,
+ std::set<sal_Unicode> const** ppPriority) = 0;
// GetEmbedFontData: gets the font data for a font marked
// embeddable by GetDevFontList or NULL in case of error
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index f4dcc83..48f1a74 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -58,7 +58,7 @@ public:
int nGlyphs,
FontSubsetInfo& rInfo
) = 0;
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) = 0;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ppPriority ) = 0;
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 29697a9..a550c96 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -179,7 +179,7 @@ public:
int nGlyphs,
FontSubsetInfo& rInfo
) SAL_OVERRIDE;
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ppPriority ) SAL_OVERRIDE;
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 5a46cb1f..358eae5 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -411,7 +411,7 @@ public:
// glyphs with only a name) exist it is set to the corresponding
// map for non encoded glyphs; the encoding vector contains -1
// as encoding for these cases
- virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded );
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** );
// GetEmbedFontData: gets the font data for a font marked
// embeddable by GetDevFontList or NULL in case of error
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 0b1ffef..79d30bf 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -751,7 +751,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
}
const Ucs2SIntMap* AquaSalGraphics::GetFontEncodingVector(
- const PhysicalFontFace*, const Ucs2OStrMap** /*ppNonEncoded*/ )
+ const PhysicalFontFace*, const Ucs2OStrMap** /*ppNonEncoded*/, std::set<sal_Unicode> const** )
{
return NULL;
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 93efd94..2ad37ce 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3087,7 +3087,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
sal_Int32 nFontDescriptor = 0;
// prepare font encoding
- const Ucs2SIntMap* pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pFont, NULL );
+ std::set<sal_Unicode> const * pPriority(0);
+ const Ucs2SIntMap *const pEncoding =
+ m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pFont, NULL, &pPriority );
sal_Int32 nToUnicodeStream = 0;
sal_uInt8 nEncoding[256];
sal_Ucs nEncodedCodes[256];
@@ -3106,6 +3108,37 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
if( it->second != -1 )
{
sal_Int32 nCode = (sal_Int32)(it->second & 0x000000ff);
+ SAL_WARN_IF(nCode != it->second, "vcl.gdi", "emitEmbeddedFont: FIXME: cannot handle Type 1 font with code points > 256");
+ if (nEncoding[nCode] != 0)
+ {
+ // should not have 2 identical mappings
+ assert(nEncodedCodes[nCode] != it->first);
+ if (pPriority)
+ {
+ bool bExist = pPriority->find(nEncodedCodes[nCode]) != pPriority->end();
+ bool bIter = pPriority->find(it->first) != pPriority->end();
+ SAL_WARN_IF(bExist && bIter, "vcl.gdi", "both are preferred? odd...");
+ if (bExist)
+ {
+ continue;
+ }
+ // note: aUnicodes will contain the old one but that
+ // does not matter because there's nothing iterating it
+ }
+ else
+ {
+ // is this fallback important? let's prefer lower one
+ if (nEncodedCodes[nCode] < it->first)
+ {
+ SAL_WARN("vcl.gdi", "emitEmbeddedFont: ignoring code " << nCode << " mapping to " << it->first << " in favor of " << nEncodedCodes[nCode]);
+ continue;
+ }
+ else
+ {
+ SAL_WARN("vcl.gdi", "emitEmbeddedFont: ignoring code " << nCode << " mapping to " << nEncodedCodes[nCode] << " in favor of " << it->first);
+ }
+ }
+ }
nEncoding[ nCode ] = static_cast<sal_uInt8>( nCode );
nEncodedCodes[ nCode ] = it->first;
pEncToUnicodeIndex[ nCode ] = static_cast<sal_Int32>(aUnicodes.size());
@@ -7230,7 +7263,7 @@ bool PDFWriterImpl::registerGlyphs( int nGlyphs,
const Ucs2OStrMap* pNonEncoded = NULL;
if (!getReferenceDevice()->AcquireGraphics())
return false;
- pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded );
+ pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded, 0);
Ucs2SIntMap::const_iterator enc_it;
Ucs2OStrMap::const_iterator nonenc_it;
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 589b53a..229e408 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -637,7 +637,7 @@ void CairoTextRender::FreeEmbedFontData( const void* pData, long nLen )
GenPspGraphics::DoFreeEmbedFontData( pData, nLen );
}
-const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
{
// in this context the pFont->GetFontId() is a valid PSP
// font since they are the only ones left after the PDF
@@ -645,7 +645,7 @@ const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFac
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
+ return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority);
}
void CairoTextRender::GetGlyphWidths( const PhysicalFontFace* pFont,
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index 1809923..16918a4 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -188,9 +188,9 @@ void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen )
mpTextRenderImpl->FreeEmbedFontData(pData, nLen);
}
-const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
{
- return mpTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded);
+ return mpTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded, ppPriority);
}
void X11SalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index ba3f5d7e..830538e 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -2655,7 +2655,7 @@ void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ )
delete[] reinterpret_cast<char*>(const_cast<void*>(pData));
}
-const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
+const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const**)
{
// TODO: even for builtin fonts we get here... why?
if( !pFont->IsEmbeddable() )
--
1.9.3

@ -1,153 +0,0 @@
From dae6572c54a952d9da94261852496dc72fe51d92 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Thu, 22 Jan 2015 12:47:29 +0100
Subject: [PATCH] rhbz#1184582: At least catch and log UNO exceptions in
grammar checking thread
(cherry picked from commit b1dbc511eeaf88e3b4b5a8a2dce129d251d2dcb6)
Conflicts:
linguistic/source/gciterator.cxx
Change-Id: I87744f86d1413973709a46a58ebc03a39bce842c
---
linguistic/source/gciterator.cxx | 110 +++++++++++++++++++++------------------
1 file changed, 60 insertions(+), 50 deletions(-)
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 41018e3..d3759eb 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -545,70 +545,80 @@ void GrammarCheckingIterator::DequeueAndCheck()
if (xFlatPara.is() && xFPIterator.is())
{
- OUString aCurTxt( xFlatPara->getText() );
- lang::Locale aCurLocale = lcl_GetPrimaryLanguageOfSentence( xFlatPara, aFPEntryItem.m_nStartIndex );
-
- bModified = xFlatPara->isModified();
- if (!bModified)
+ try
{
- // ---- THREAD SAFE START ----
- ::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
+ OUString aCurTxt( xFlatPara->getText() );
+ lang::Locale aCurLocale = lcl_GetPrimaryLanguageOfSentence( xFlatPara, aFPEntryItem.m_nStartIndex );
- sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
- sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
- DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.isEmpty()) || nSuggestedEnd > nStartPos,
- "nSuggestedEndOfSentencePos calculation failed?" );
+ bModified = xFlatPara->isModified();
+ if (!bModified)
+ {
+ // ---- THREAD SAFE START ----
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
- linguistic2::ProofreadingResult aRes;
+ sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
+ sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
+ DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.isEmpty()) || nSuggestedEnd > nStartPos,
+ "nSuggestedEndOfSentencePos calculation failed?" );
- uno::Reference< linguistic2::XProofreader > xGC( GetGrammarChecker( aCurLocale ), uno::UNO_QUERY );
- if (xGC.is())
- {
- aGuard.clear();
- uno::Sequence<beans::PropertyValue> const aProps(
+ linguistic2::ProofreadingResult aRes;
+
+ uno::Reference< linguistic2::XProofreader > xGC( GetGrammarChecker( aCurLocale ), uno::UNO_QUERY );
+ if (xGC.is())
+ {
+ aGuard.clear();
+ uno::Sequence<beans::PropertyValue> const aProps(
lcl_makeProperties(xFlatPara));
- aRes = xGC->doProofreading( aCurDocId, aCurTxt,
- aCurLocale, nStartPos, nSuggestedEnd, aProps );
-
- //!! work-around to prevent looping if the grammar checker
- //!! failed to properly identify the sentence end
- if (
- aRes.nBehindEndOfSentencePosition <= nStartPos &&
- aRes.nBehindEndOfSentencePosition != nSuggestedEnd
- )
+ aRes = xGC->doProofreading( aCurDocId, aCurTxt,
+ aCurLocale, nStartPos, nSuggestedEnd, aProps );
+
+ //!! work-around to prevent looping if the grammar checker
+ //!! failed to properly identify the sentence end
+ if (
+ aRes.nBehindEndOfSentencePosition <= nStartPos &&
+ aRes.nBehindEndOfSentencePosition != nSuggestedEnd
+ )
+ {
+ DBG_ASSERT( false, "!! Grammarchecker failed to provide end of sentence !!" );
+ aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
+ }
+
+ aRes.xFlatParagraph = xFlatPara;
+ aRes.nStartOfSentencePosition = nStartPos;
+ }
+ else
{
- DBG_ASSERT( false, "!! Grammarchecker failed to provide end of sentence !!" );
- aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
+ // no grammar checker -> no error
+ // but we need to provide the data below in order to continue with the next sentence
+ aRes.aDocumentIdentifier = aCurDocId;
+ aRes.xFlatParagraph = xFlatPara;
+ aRes.aText = aCurTxt;
+ aRes.aLocale = aCurLocale;
+ aRes.nStartOfSentencePosition = nStartPos;
+ aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
}
+ aRes.nStartOfNextSentencePosition = lcl_SkipWhiteSpaces( aCurTxt, aRes.nBehindEndOfSentencePosition );
+ aRes.nBehindEndOfSentencePosition = lcl_BacktraceWhiteSpaces( aCurTxt, aRes.nStartOfNextSentencePosition );
- aRes.xFlatParagraph = xFlatPara;
- aRes.nStartOfSentencePosition = nStartPos;
+ //guard has to be cleared as ProcessResult calls out of this class
+ aGuard.clear();
+ ProcessResult( aRes, xFPIterator, aFPEntryItem.m_bAutomatic );
+ // ---- THREAD SAFE END ----
}
else
{
- // no grammar checker -> no error
- // but we need to provide the data below in order to continue with the next sentence
- aRes.aDocumentIdentifier = aCurDocId;
- aRes.xFlatParagraph = xFlatPara;
- aRes.aText = aCurTxt;
- aRes.aLocale = aCurLocale;
- aRes.nStartOfSentencePosition = nStartPos;
- aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
+ // the paragraph changed meanwhile... (and maybe is still edited)
+ // thus we simply continue to ask for the next to be checked.
+ uno::Reference< text::XFlatParagraph > xFlatParaNext( xFPIterator->getNextPara() );
+ AddEntry( xFPIterator, xFlatParaNext, aCurDocId, 0, aFPEntryItem.m_bAutomatic );
}
- aRes.nStartOfNextSentencePosition = lcl_SkipWhiteSpaces( aCurTxt, aRes.nBehindEndOfSentencePosition );
- aRes.nBehindEndOfSentencePosition = lcl_BacktraceWhiteSpaces( aCurTxt, aRes.nStartOfNextSentencePosition );
-
- //guard has to be cleared as ProcessResult calls out of this class
- aGuard.clear();
- ProcessResult( aRes, xFPIterator, aFPEntryItem.m_bAutomatic );
- // ---- THREAD SAFE END ----
}
- else
+ catch (css::uno::Exception & e)
{
- // the paragraph changed meanwhile... (and maybe is still edited)
- // thus we simply continue to ask for the next to be checked.
- uno::Reference< text::XFlatParagraph > xFlatParaNext( xFPIterator->getNextPara() );
- AddEntry( xFPIterator, xFlatParaNext, aCurDocId, 0, aFPEntryItem.m_bAutomatic );
+ SAL_WARN(
+ "linguistic",
+ "GrammarCheckingIterator::DequeueAndCheck ignoring UNO"
+ " exception " << e.Message);
}
}
--
1.9.3

@ -1,5 +1,5 @@
# download path contains version without the last (fourth) digit
%define libo_version 4.4.0
%define libo_version 4.4.1
# Should contain .alphaX / .betaX, if this is pre-release (actually
# pre-RC) version. The pre-release string is part of tarball file names,
# so we need a way to define it easily at one place.
@ -45,8 +45,8 @@
Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.3
Release: 5%{?libo_prerelease}%{?dist}
Version: %{libo_version}.1
Release: 1%{?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 and CC0
Group: Applications/Productivity
URL: http://www.libreoffice.org/
@ -325,14 +325,7 @@ Patch17: 0001-Resolves-fdo-37559-revert-adding-extra-dummy-polygon.patch
Patch18: 0001-radio-check-top-center-bottom-alignment-for-table-ce.patch
Patch19: 0001-allow-comparing-documents-which-only-differ-by-frame.patch
Patch20: 0001-Use-the-same-advanced-Ellipse-and-Rectangle-shapes-i.patch
Patch21: 0001-if-we-change-the-keys-we-have-to-resort-based-on-the.patch
Patch22: 0001-rhbz-1175027-sw-fix-life-cycle-of-SwConnectionDispos.patch
Patch23: 0001-rhbz-1184582-At-least-catch-and-log-UNO-exceptions-i.patch
Patch24: 0001-Related-rhbz-1185307-One-more-location-to-look-for-H.patch
Patch25: 0001-Resolves-rhbz-1179642-crash-in-GetFocus-with-empty-m.patch
Patch26: 0001-rhbz-1177022-vcl-fix-PDF-embedding-of-Type-1-fonts.patch
Patch27: 0001-don-t-strip-font-names-of-apparent-script-suffixes-a.patch
Patch28: 0001-fix-assert-call.patch
Patch21: 0001-fix-linker-error.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@ -2357,6 +2350,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
* Tue Feb 10 2015 David Tardon <dtardon@redhat.com> - 1:4.4.1.1-1
- update to 4.4.1 rc1
* Thu Jan 29 2015 David Tardon <dtardon@redhat.com> - 1:4.4.0.3-5
- fix build on s390

@ -7,6 +7,6 @@ a7983f859eafb2677d7ff386a023bc40 a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.
0168229624cfac409e766913506961a8 0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz
12fb8b5b0d5132726e57b9b9fc7e22c4 libreoffice-multiliblauncher.sh
4b87018f7fff1d054939d19920b751a0 4b87018f7fff1d054939d19920b751a0-collada2gltf-master-cb1d97788a.tar.bz2
34cf1a7fbac5b496c141c32c8464a73a libreoffice-4.4.0.3.tar.xz
46e893fdbc435917b5cf70565e38d6f0 libreoffice-help-4.4.0.3.tar.xz
064605fe0695dcf0b461036c07e75c7a libreoffice-translations-4.4.0.3.tar.xz
fd1ed454901042e734f30293c7e63d77 libreoffice-4.4.1.1.tar.xz
f98da4acfc4469126336559673a0814e libreoffice-help-4.4.1.1.tar.xz
ba7ef491c940452191c3bf4b0fde28db libreoffice-translations-4.4.1.1.tar.xz

Loading…
Cancel
Save