[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 28 commits - connectivity/source cui/source editeng/source extensions/source external/poppler filter/source forms/source formula/source icon-themes/sifr include/formula include/vcl sc/inc sc/qa sc/source sdext/source svx/source sw/inc sw/qa sw/source vcl/inc vcl/source vcl/unx vcl/win writerfilter/source xmlsecurity/qa xmlsecurity/source
Julien Nabet
serval2412 at yahoo.fr
Tue May 30 08:32:32 UTC 2017
connectivity/source/drivers/firebird/Table.cxx | 22 -
cui/source/tabpages/tpbitmap.cxx | 32 +-
editeng/source/editeng/impedit.cxx | 1
editeng/source/editeng/impedit.hxx | 4
editeng/source/editeng/impedit4.cxx | 4
extensions/source/propctrlr/standardcontrol.cxx | 36 --
external/poppler/0001-really-disable-JPEG2000-import.patch.1 | 35 ++
external/poppler/UnpackedTarball_poppler.mk | 1
filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 14
forms/source/component/FormComponent.cxx | 12
formula/source/core/api/FormulaCompiler.cxx | 23 +
icon-themes/sifr/cmd/lc_insertindexentry.png |binary
icon-themes/sifr/cmd/lc_insertreferencefield.png |binary
icon-themes/sifr/cmd/sc_insertindexentry.png |binary
icon-themes/sifr/cmd/sc_insertreferencefield.png |binary
include/formula/FormulaCompiler.hxx | 2
include/vcl/commandevent.hxx | 10
include/vcl/window.hxx | 2
sc/inc/document.hxx | 1
sc/qa/unit/data/xlsb/tdf108017_calcProtection.xlsb |binary
sc/qa/unit/subsequent_export-test.cxx | 37 +-
sc/source/core/data/document.cxx | 9
sc/source/core/tool/interpr1.cxx | 10
sc/source/filter/oox/worksheetsettings.cxx | 30 -
sc/source/filter/orcus/orcusfiltersimpl.cxx | 17 -
sc/source/ui/vba/vbarange.cxx | 3
sdext/source/presenter/PresenterScrollBar.cxx | 1
sdext/source/presenter/PresenterScrollBar.hxx | 3
sdext/source/presenter/PresenterTextView.cxx | 6
sdext/source/presenter/PresenterTextView.hxx | 2
sdext/source/presenter/PresenterTimer.cxx | 99 +++++-
sdext/source/presenter/PresenterTimer.hxx | 2
svx/source/tbxctrls/tbcontrl.cxx | 9
sw/inc/fchrfmt.hxx | 6
sw/qa/extras/rtfimport/data/tdf106953.rtf | 23 +
sw/qa/extras/rtfimport/rtfimport.cxx | 9
sw/source/core/doc/docnew.cxx | 12
sw/source/core/para/paratr.cxx | 1
sw/source/core/unocore/SwXTextDefaults.cxx | 3
sw/source/core/unocore/unoobj.cxx | 4
sw/source/core/unocore/unostyle.cxx | 5
sw/source/filter/ww8/ww8par.cxx | 10
sw/source/uibase/app/apphdl.cxx | 2
sw/source/uibase/docvw/edtwin.cxx | 2
vcl/inc/salwtype.hxx | 3
vcl/inc/unx/gtk/gtkframe.hxx | 10
vcl/source/gdi/pdfwriter_impl.cxx | 5
vcl/source/opengl/OpenGLContext.cxx | 3
vcl/source/window/commandevent.cxx | 7
vcl/source/window/menu.cxx | 2
vcl/source/window/syswin.cxx | 2
vcl/source/window/window2.cxx | 14
vcl/source/window/winproc.cxx | 2
vcl/unx/generic/window/salframe.cxx | 1
vcl/unx/gtk/gtksalframe.cxx | 47 +--
vcl/unx/gtk3/gtk3gtkframe.cxx | 169 ++++++-----
vcl/win/window/salframe.cxx | 1
writerfilter/source/rtftok/rtfsprm.cxx | 5
xmlsecurity/qa/unit/pdfsigning/data/tdf107782.pdf |binary
xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 20 +
xmlsecurity/source/helper/pdfsignaturehelper.cxx | 3
61 files changed, 554 insertions(+), 244 deletions(-)
New commits:
commit 2f3e56a26121927dfb941c74cafae82227cbcf8b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Thu May 25 10:14:30 2017 +0200
Related tdf#108068: Use new name of column when it's been changed
First fix simple case, the rename of a column which is not a primary key
Change-Id: Ia0de8e531021cbec0409408008c541c25a4bcd85
Reviewed-on: https://gerrit.libreoffice.org/38014
Tested-by: Jenkins <ci at libreoffice.org>
(cherry picked from commit c751318868f3f0082b2c86df493216d452b8ecc5)
Reviewed-on: https://gerrit.libreoffice.org/38023
Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
(cherry picked from commit 7b7c43f3c86eeeb7c092621464a747604a1cd48a)
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index fea904630ffb..21a59e4ee0c2 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -133,17 +133,6 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
bool bDefaultChanged = xColumn->getPropertyValue("DefaultValue")
!= rDescriptor->getPropertyValue("DefaultValue");
- // TODO: quote identifiers as needed.
- if (bNameChanged)
- {
- OUString sNewTableName;
- rDescriptor->getPropertyValue("Name") >>= sNewTableName;
- OUString sSql(getAlterTableColumn(rColName)
- + " TO \"" + sNewTableName + "\"");
-
- getConnection()->createStatement()->execute(sSql);
- }
-
if (bTypeChanged || bTypeNameChanged || bPrecisionChanged || bScaleChanged)
{
// If bPrecisionChanged this will only succeed if we have increased the
@@ -217,6 +206,17 @@ void SAL_CALL Table::alterColumnByName(const OUString& rColName,
getConnection()->createStatement()->execute(sSql);
}
+ // TODO: quote identifiers as needed.
+ if (bNameChanged)
+ {
+ OUString sNewTableName;
+ rDescriptor->getPropertyValue("Name") >>= sNewTableName;
+ OUString sSql(getAlterTableColumn(rColName)
+ + " TO \"" + sNewTableName + "\"");
+
+ getConnection()->createStatement()->execute(sSql);
+ }
+
m_pColumns->refresh();
}
commit 9622c0c6a2be508cd5f9655bf383c24ac0e450e4
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sun Apr 16 17:40:07 2017 +0200
tdf#107176: just return initial selection when there's no range
See https://bugs.documentfoundation.org/show_bug.cgi?id=107176#c2
Change-Id: I606b7f248821bb24b3a9026ecd26a9bc93971748
Reviewed-on: https://gerrit.libreoffice.org/36582
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 6bde2e93a2e0f94bc2263928cb27c4b85827822d)
Reviewed-on: https://gerrit.libreoffice.org/37788
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit 83e87f7579ecf63e810c7556661e4f95a8309aff)
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 7cf098b3c279..36dfeea6b0da 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2722,6 +2722,10 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
if ( !aSel.HasRange() )
aSel = SelectWord( aSel );
+ // tdf#107176: if there's still no range, just return aSel
+ if ( !aSel.HasRange() )
+ return aSel;
+
EditSelection aNewSel( aSel );
const sal_Int32 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
commit 81272683d31000dfa450dfbdc45198486412840a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 13 19:10:45 2017 +0200
import stream on the LibreOffice side, tdf#107827
This adds support for all LibreOffice content providers and non-ascii file names.
Change-Id: I0a0fd0ab0c78ef039679516e7a3e880929e8f725
Reviewed-on: https://gerrit.libreoffice.org/37578
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 5e9178f765b327a8aba17476d135ba3b1f881bf7)
Reviewed-on: https://gerrit.libreoffice.org/37582
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit b1d039c2ce986424a8a7c6e9460924291318ceb7)
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index b38926aa7a0d..b77ec878296c 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -88,14 +88,24 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) co
{
ScOrcusFactory aFactory(rDoc);
aFactory.setStatusIndicator(getStatusIndicator(rMedium));
- OString aSysPath = toSystemPath(rMedium.GetName());
- const char* path = aSysPath.getStr();
+ SvStream* pStream = rMedium.GetInStream();
+ pStream->Seek(0);
+ static const size_t nReadBuffer = 1024*32;
+ OStringBuffer aBuffer((int(nReadBuffer)));
+ size_t nRead = 0;
+ do
+ {
+ char pData[nReadBuffer];
+ nRead = pStream->ReadBytes(pData, nReadBuffer);
+ aBuffer.append(static_cast<sal_Char*>(pData), nRead);
+ }
+ while (nRead == nReadBuffer);
try
{
rDoc.ClearTabs();
orcus::orcus_gnumeric filter(&aFactory);
- filter.read_file(path);
+ filter.read_stream(aBuffer.getStr(), aBuffer.getLength());
}
catch (const std::exception& e)
{
commit 035f9cbb0b7b38c21e3f353cbbe4a7c975384f18
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sat May 13 21:34:28 2017 +0200
use empty document in orcus gnumeric import, tdf#107828
Change-Id: Ia7ee2de6f9b14a132a29c01f8d863889477c0a8d
Reviewed-on: https://gerrit.libreoffice.org/37579
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Reviewed-on: https://gerrit.libreoffice.org/37659
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit a45fedeb9e7ae451b3b719e7830108ee7aff03b9)
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6db9ab6d616e..911e441a0d14 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -812,6 +812,7 @@ public:
bool bNamesValid = false );
SC_DLLPUBLIC bool DeleteTabs( SCTAB nTab, SCTAB nSheets );
SC_DLLPUBLIC bool DeleteTab( SCTAB nTab );
+ SC_DLLPUBLIC void ClearTabs();
SC_DLLPUBLIC bool RenameTab( SCTAB nTab, const OUString& rName,
bool bUpdateRef = true,
bool bExternalDocument = false );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ee69a89cc3f8..931d44a550d1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -774,6 +774,15 @@ bool ScDocument::DeleteTab( SCTAB nTab )
return bValid;
}
+void ScDocument::ClearTabs()
+{
+ for (auto& it: maTabs)
+ {
+ delete it;
+ }
+ maTabs.clear();
+}
+
bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
{
bool bValid = false;
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 66a9ca29efab..b38926aa7a0d 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -93,6 +93,7 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) co
try
{
+ rDoc.ClearTabs();
orcus::orcus_gnumeric filter(&aFactory);
filter.read_file(path);
}
commit db243920bf17263a88005bdfcd4fd35578f7f6c4
Author: Matthias Freund <matti_lx at secure.mailbox.org>
Date: Fri May 26 00:01:24 2017 +0200
tdf#106532 Sifr icon for "Cross-reference" needed
16px png and 24px png
Change-Id: Id90f656880f05681d9d95132851be0566918a792
Reviewed-on: https://gerrit.libreoffice.org/38047
Reviewed-by: Yousuf Philips <philipz85 at hotmail.com>
Tested-by: Yousuf Philips <philipz85 at hotmail.com>
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit 75cb0e8e5654b1a82b687c117b940ad49127ad8e)
diff --git a/icon-themes/sifr/cmd/lc_insertreferencefield.png b/icon-themes/sifr/cmd/lc_insertreferencefield.png
new file mode 100644
index 000000000000..0ea9d2009806
Binary files /dev/null and b/icon-themes/sifr/cmd/lc_insertreferencefield.png differ
diff --git a/icon-themes/sifr/cmd/sc_insertreferencefield.png b/icon-themes/sifr/cmd/sc_insertreferencefield.png
new file mode 100644
index 000000000000..c879491562b9
Binary files /dev/null and b/icon-themes/sifr/cmd/sc_insertreferencefield.png differ
commit 1b58eca5e7db961a66f868d0fd204c335e700e2a
Author: Matthias Freund <matti_lx at secure.mailbox.org>
Date: Sun May 28 00:37:44 2017 +0200
tdf#106533 Sifr icon for "Index Entry" needed
Change-Id: I267496d6b67aed56dee12b2a44036b71f8b0fbb2
Reviewed-on: https://gerrit.libreoffice.org/38097
Reviewed-by: Yousuf Philips <philipz85 at hotmail.com>
Tested-by: Yousuf Philips <philipz85 at hotmail.com>
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
(cherry picked from commit 5b2b838fe7f36fe80894d23676585d46f899c807)
diff --git a/icon-themes/sifr/cmd/lc_insertindexentry.png b/icon-themes/sifr/cmd/lc_insertindexentry.png
new file mode 100644
index 000000000000..d905627f4f53
Binary files /dev/null and b/icon-themes/sifr/cmd/lc_insertindexentry.png differ
diff --git a/icon-themes/sifr/cmd/sc_insertindexentry.png b/icon-themes/sifr/cmd/sc_insertindexentry.png
new file mode 100644
index 000000000000..610439a725b0
Binary files /dev/null and b/icon-themes/sifr/cmd/sc_insertindexentry.png differ
commit ee79ec68f94b4da7214df942a082237292452e25
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 26 12:41:10 2017 +0100
Resolves: tdf#108069 2nd OpenGLContext::init should dispose earlier results
Change-Id: If6bb9517a4081576347d71ddf26d020119d34247
(cherry picked from commit 0b9b36cafe29916a9fdeac420a49c174adb10c59)
Reviewed-on: https://gerrit.libreoffice.org/38065
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit c76aa66c60bde1fd009f097a0b974b65b295d1ab)
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 33d80095b15c..fc12d88617ff 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -240,7 +240,8 @@ bool OpenGLContext::init( vcl::Window* pParent )
mpWindow = pParent ? pParent : m_xWindow.get();
if(m_xWindow)
m_xWindow->setPosSizePixel(0,0,0,0);
- m_pChildWindow = nullptr;
+ //tdf#108069 we may be initted twice, so dispose earlier effort
+ m_pChildWindow.disposeAndClear();
initWindow();
return ImplInit();
}
commit 28bfce94d10d861519f36972913bdd7b02b50605
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri May 26 11:25:06 2017 +0200
sw: coverity#1409899 Null pointer dereferences
Change-Id: I152def3c629980aedb705ac511f154cc6e9d1b0f
(cherry picked from commit 40587c191ecf6ec667f40e9148c197246e3c45a5)
Reviewed-on: https://gerrit.libreoffice.org/38060
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 2990a2c2b29ca5c3316f28e5d3be74220c4948a4)
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index 8fc36009722b..bdc07540105f 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -77,7 +77,7 @@ SwFormatDrop::~SwFormatDrop()
void SwFormatDrop::SetCharFormat( SwCharFormat *pNew )
{
- assert(!pNew->IsDefault()); // expose cases that lead to use-after-free
+ assert(!pNew || !pNew->IsDefault()); // expose cases that lead to use-after-free
// Rewire
if ( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove( this );
commit 63defd57dc3ddeae300c1225367ac38a8ffde959
Author: Eike Rathke <erack at redhat.com>
Date: Wed May 17 15:21:25 2017 +0200
Resolves: tdf#96426 more whitespace intersection operator in Excel syntax
Handle also stacked token arrays resulting from named expressions like
=range1 range2
Change-Id: I1838af155f17b5e4f941e46895303caed75b6075
(cherry picked from commit 70cb7757f971c4c16d1b0a5585d95816cd4382e6)
Reviewed-on: https://gerrit.libreoffice.org/37712
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 9c89d41ed44c1a4126b82f0c05768f5d640f741b)
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index a271410d5a65..07c39037585a 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1263,7 +1263,7 @@ bool FormulaCompiler::GetToken()
if ( nRecursion > nRecursionMax )
{
SetError( FormulaError::StackOverflow );
- mpToken = new FormulaByteToken( ocStop );
+ mpLastToken = mpToken = new FormulaByteToken( ocStop );
return false;
}
if ( bAutoCorrect && !pStack )
@@ -1276,7 +1276,6 @@ bool FormulaCompiler::GetToken()
bStop = true;
else
{
- FormulaTokenRef pCurrToken = mpToken;
FormulaTokenRef pSpacesToken;
short nWasColRowName;
if ( pArr->nIndex > 0 && pArr->pCode[ pArr->nIndex-1 ]->GetOpCode() == ocColRowName )
@@ -1302,6 +1301,9 @@ bool FormulaCompiler::GetToken()
if( pStack )
{
PopTokenArray();
+ // mpLastToken was popped as well and corresponds to the
+ // then current last token during PushTokenArray(), e.g. for
+ // HandleRange().
return GetToken();
}
else
@@ -1311,17 +1313,17 @@ bool FormulaCompiler::GetToken()
{
if ( nWasColRowName >= 2 && mpToken->GetOpCode() == ocColRowName )
{ // convert an ocSpaces to ocIntersect in RPN
- mpToken = new FormulaByteToken( ocIntersect );
+ mpLastToken = mpToken = new FormulaByteToken( ocIntersect );
pArr->nIndex--; // we advanced to the second ocColRowName, step back
}
else if (pSpacesToken && FormulaGrammar::isExcelSyntax( meGrammar) &&
- pCurrToken && mpToken &&
- isPotentialRangeType( pCurrToken.get(), false, false) &&
+ mpLastToken && mpToken &&
+ isPotentialRangeType( mpLastToken.get(), false, false) &&
isPotentialRangeType( mpToken.get(), false, true))
{
// Let IntersectionLine() <- Factor() decide how to treat this,
// once the actual arguments are determined in RPN.
- mpToken = pSpacesToken;
+ mpLastToken = mpToken = pSpacesToken;
pArr->nIndex--; // step back from next non-spaces token
return true;
}
@@ -1329,9 +1331,14 @@ bool FormulaCompiler::GetToken()
}
if( bStop )
{
- mpToken = new FormulaByteToken( ocStop );
+ mpLastToken = mpToken = new FormulaByteToken( ocStop );
return false;
}
+
+ // Remember token for next round and any PushTokenArray() calls that may
+ // occur in handlers.
+ mpLastToken = mpToken;
+
if ( mpToken->IsExternalRef() )
{
return HandleExternalReference(*mpToken);
@@ -2060,6 +2067,7 @@ void FormulaCompiler::PopTokenArray()
if( p->bTemp )
delete pArr;
pArr = p->pArr;
+ mpLastToken = p->mpLastToken;
delete p;
}
}
@@ -2601,6 +2609,7 @@ void FormulaCompiler::PushTokenArray( FormulaTokenArray* pa, bool bTemp )
FormulaArrayStack* p = new FormulaArrayStack;
p->pNext = pStack;
p->pArr = pArr;
+ p->mpLastToken = mpLastToken;
p->bTemp = bTemp;
pStack = p;
pArr = pa;
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 96d945f220b7..37da2ef8becc 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -58,6 +58,7 @@ struct FormulaArrayStack
{
FormulaArrayStack* pNext;
FormulaTokenArray* pArr;
+ FormulaTokenRef mpLastToken;
bool bTemp;
};
@@ -331,6 +332,7 @@ protected:
FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method)
sal_uInt16 nCurrentFactorParam; // current factor token's parameter, 1-based
FormulaTokenArray* pArr;
+ FormulaTokenRef mpLastToken; // last token
FormulaToken** pCode;
FormulaArrayStack* pStack;
commit 5af72a2fc78f77441d255ef8b9297ef5cda01388
Author: Eike Rathke <erack at redhat.com>
Date: Tue May 23 14:01:41 2017 +0200
PushError() instead of SetError() so there's a result token
Change-Id: I8c2a7e01b04c26e008c8cbea9332f71d47293c75
(cherry picked from commit cd87661b4761ee9f512fc01f95d84f786c97bb66)
Reviewed-on: https://gerrit.libreoffice.org/37950
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit bcd3e9f29c458847df839724def86f4ebd388cdd)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f005b26e4635..22ae9153e5c9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5713,7 +5713,7 @@ void ScInterpreter::ScSumIfs()
if (nParamCount < 3 || (nParamCount % 2 != 1))
{
- SetError( FormulaError::ParameterExpected);
+ PushError( FormulaError::ParameterExpected);
return;
}
@@ -5728,7 +5728,7 @@ void ScInterpreter::ScAverageIfs()
if (nParamCount < 3 || (nParamCount % 2 != 1))
{
- SetError( FormulaError::ParameterExpected);
+ PushError( FormulaError::ParameterExpected);
return;
}
@@ -5743,7 +5743,7 @@ void ScInterpreter::ScCountIfs()
if (nParamCount < 2 || (nParamCount % 2 != 0))
{
- SetError( FormulaError::ParameterExpected);
+ PushError( FormulaError::ParameterExpected);
return;
}
@@ -5758,7 +5758,7 @@ void ScInterpreter::ScMinIfs_MS()
if (nParamCount < 3 || (nParamCount % 2 != 1))
{
- SetError( FormulaError::ParameterExpected);
+ PushError( FormulaError::ParameterExpected);
return;
}
@@ -5774,7 +5774,7 @@ void ScInterpreter::ScMaxIfs_MS()
if (nParamCount < 3 || (nParamCount % 2 != 1))
{
- SetError( FormulaError::ParameterExpected);
+ PushError( FormulaError::ParameterExpected);
return;
}
commit e74d699e3d442ee15564f0e9f41b8e7dd0d8e4b8
Author: Justin Luth <justin_luth at sil.org>
Date: Wed May 24 12:48:12 2017 +0300
tdf#108049 VBA exception avoided in ScVbaRange::setStyle
Change-Id: I5fc928373d70829b6e68d9000140a30f04179536
Reviewed-on: https://gerrit.libreoffice.org/37981
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 4dc3e7d5e9044be66177e467d739bd8be7556783)
Reviewed-on: https://gerrit.libreoffice.org/38063
(cherry picked from commit bb9c240046955c432d963610d5dd99edcc6b43e6)
Reviewed-on: https://gerrit.libreoffice.org/38083
Tested-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit f82a36749a9df51d2344e4acb88f0e53b39f8e72)
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index af3a4e6c48e1..955d35a2c4e8 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -5270,7 +5270,8 @@ ScVbaRange::setStyle( const uno::Any& _style ) throw (uno::RuntimeException, std
uno::Reference< beans::XPropertySet > xProps( mxRange, uno::UNO_QUERY_THROW );
uno::Reference< excel::XStyle > xStyle;
_style >>= xStyle;
- xProps->setPropertyValue( CELLSTYLE, uno::makeAny( xStyle->getName() ) );
+ if ( xProps.is() && xStyle.is() )
+ xProps->setPropertyValue( CELLSTYLE, uno::makeAny( xStyle->getName() ) );
}
uno::Reference< excel::XRange >
commit ad612ab62a2bc1cfd07aadc56b576daf3445bf24
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Tue May 9 12:53:25 2017 +0200
tdf#107720 Bound Control initFromField: consider the case of the insert row
loplugin: simplifybool
(cherry picked from commit 95b25532d24bfb08c4846b991451a36475dd439f)
Change-Id: If18e161c994c926fd86453ab5736df1e89bb61de
Reviewed-on: https://gerrit.libreoffice.org/37427
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit bb50f9d66540a87065f30da8fd8cadde8e730704)
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 80e85758801c..743f4d47986b 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -1981,7 +1981,17 @@ void OBoundControlModel::initFromField( const Reference< XRowSet >& _rxRowSet )
// but only if the rowset is positioned on a valid record
if ( hasField() && _rxRowSet.is() )
{
- if ( !_rxRowSet->isBeforeFirst() && !_rxRowSet->isAfterLast() )
+ bool shouldTransfer(!_rxRowSet->isBeforeFirst() && !_rxRowSet->isAfterLast());
+ if (!shouldTransfer)
+ {
+ const Reference< XPropertySet > xPS(_rxRowSet, UNO_QUERY);
+ if (xPS.is())
+ {
+ assert(!shouldTransfer);
+ xPS->getPropertyValue("IsNew") >>= shouldTransfer;
+ }
+ }
+ if ( shouldTransfer )
transferDbValueToControl();
else
// reset the field if the row set is empty
commit ba54eb5f01a84ffb4dc72d11d7a8dd6572dd5a5f
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Wed May 17 00:13:18 2017 +0200
Related tdf#107696: deal with non empty header without number
See first case of https://bugs.documentfoundation.org/show_bug.cgi?id=107696#c11
Change-Id: Ic76301cb10ae891901be7dd5a385356c1cc0523b
Reviewed-on: https://gerrit.libreoffice.org/37694
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit 296c2296f5565556eea9fab51563050f28bbcafc)
Reviewed-on: https://gerrit.libreoffice.org/37792
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit 6ee4771aff5d756f45014b88aebbcfb25b5cadfe)
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index a8edf4b14167..34bb181db569 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1222,7 +1222,7 @@
<!-- writing out a heading number if desired.-->
<!-- if a corresponding 'text:outline-style' exist or is not empty -->
<xsl:choose>
- <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != ''">
+ <xsl:when test="$globalData/office:styles/text:outline-style/text:outline-level-style[@text:level = current()/@text:outline-level]/@style:num-format != '' and not(@text:is-list-header='true')">
<!-- Every heading element will get an unique anchor for its file, from its hiearchy level and name:
For example: The heading title 'My favorite heading' might get <a name="1_2_2_My_favorite_heading" /> -->
commit d3c63ec1b1eb2d02902fe7086e061f2ef6c6fc7b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Mon May 15 22:03:02 2017 +0200
tdf#107696: fix exports Heading style numbers
by taking into account text:is-list-header="true"
(thank you for having pointing at this attribute of header Regina!)
Change-Id: Ia0d9e0042e7ca3f31284c85f6b5336e1434bc0e6
Reviewed-on: https://gerrit.libreoffice.org/37655
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
(cherry picked from commit d67747c59c22e0346e13560810b9f3bf6c698428)
Reviewed-on: https://gerrit.libreoffice.org/37661
Reviewed-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit 9b4c1e9d85445f4ddfb45359ad661d4826fe6a3c)
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 7e9eb59734db..a8edf4b14167 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1416,14 +1416,24 @@
<xsl:param name="i" select="1"/>
<xsl:variable name="precedingoutlineLevel" select="preceding-sibling::text:h[$i]/@text:outline-level"/>
+ <!-- tdf#107696: if text:h has attribute "is-list-header" with "true" value, it mustn't be counted for numbering -->
+ <xsl:variable name="precedingoutlineLevel-is-list-header" select="preceding-sibling::text:h[$i][@text:is-list-header='true']/@text:outline-level"/>
<xsl:choose>
- <xsl:when test="$currentoutlineLevel = $precedingoutlineLevel">
+ <xsl:when test="($currentoutlineLevel = $precedingoutlineLevel) and (not($precedingoutlineLevel-is-list-header)) ">
<xsl:call-template name="calc-heading-digit">
<xsl:with-param name="value" select="$value + 1"/>
<xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
<xsl:with-param name="i" select="$i + 1"/>
</xsl:call-template>
</xsl:when>
+ <!-- tdf#107696: case text:h has attribute "is-list-header" with "true" value, we don't increment value -->
+ <xsl:when test="($currentoutlineLevel = $precedingoutlineLevel) and ($precedingoutlineLevel-is-list-header) ">
+ <xsl:call-template name="calc-heading-digit">
+ <xsl:with-param name="value" select="$value"/>
+ <xsl:with-param name="currentoutlineLevel" select="$currentoutlineLevel"/>
+ <xsl:with-param name="i" select="$i + 1"/>
+ </xsl:call-template>
+ </xsl:when>
<xsl:when test="$currentoutlineLevel < $precedingoutlineLevel">
<xsl:call-template name="calc-heading-digit">
<xsl:with-param name="value" select="$value"/>
commit 4784733ad3ae5637deaac35af607927344cc4b3d
Author: Justin Luth <justin_luth at sil.org>
Date: Tue May 23 15:35:13 2017 +0300
tdf#108017 xlsb import: protection settings were reversed
Back in LO4.3, commit 5728a56b20e01d6c9e86a23f20af64a1b68ad604
fdo#70499 selectn of lock/unlocked cells with worksheet protection reversed
...reversed finalizeImport's understanding of maSheetProt.* to match
xml import, but then it no longer matched the binary stream import.
So, .xlsb imported the opposite of what .xlsx/.xlsm imported.
Reviewed-on: https://gerrit.libreoffice.org/37952
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 0d3fcbf809852aab0d0f88272bbfd2e8507d1c5e)
Reviewed-on: https://gerrit.libreoffice.org/38041
Change-Id: I2da3967ef52187e4ef36ce7d01b17a4672f61e1c
Reviewed-on: https://gerrit.libreoffice.org/38052
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 4fbb8ad023c95266ce0882cd28bdf6703f5b67bf)
diff --git a/sc/qa/unit/data/xlsb/tdf108017_calcProtection.xlsb b/sc/qa/unit/data/xlsb/tdf108017_calcProtection.xlsb
new file mode 100644
index 000000000000..31661ba009a8
Binary files /dev/null and b/sc/qa/unit/data/xlsb/tdf108017_calcProtection.xlsb differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b5c2cd2f83dd..e6e1e87f710b 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -125,6 +125,7 @@ public:
void testFormulaReferenceXLS();
void testSheetProtectionXLSX();
+ void testSheetProtectionXLSB();
void testCellBordersXLS();
void testCellBordersXLSX();
@@ -226,6 +227,7 @@ public:
CPPUNIT_TEST(testFormulaReferenceXLS);
CPPUNIT_TEST(testSheetProtectionXLSX);
+ CPPUNIT_TEST(testSheetProtectionXLSB);
CPPUNIT_TEST(testCellBordersXLS);
CPPUNIT_TEST(testCellBordersXLSX);
CPPUNIT_TEST(testBordersExchangeXLSX);
@@ -1933,19 +1935,32 @@ void ScExportTest::testSheetProtectionXLSX()
ScDocument& rDoc = xDocSh->GetDocument();
const ScTableProtection* pTabProtect = rDoc.GetTabProtection(0);
CPPUNIT_ASSERT(pTabProtect);
- if ( pTabProtect )
+ Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
+ // check has
+ if (aHash.getLength() >= 2)
{
- Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
- // check has
- if (aHash.getLength() >= 2)
- {
- CPPUNIT_ASSERT_EQUAL(sal_uInt8(204), (sal_uInt8)aHash[0]);
- CPPUNIT_ASSERT_EQUAL(sal_uInt8(61), (sal_uInt8)aHash[1]);
- }
- // we could flesh out this check I guess
- CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) );
- CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) );
+ CPPUNIT_ASSERT_EQUAL(sal_uInt8(204), (sal_uInt8)aHash[0]);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt8(61), (sal_uInt8)aHash[1]);
}
+ // we could flesh out this check I guess
+ CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) );
+ CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) );
+ xDocSh->DoClose();
+}
+
+void ScExportTest::testSheetProtectionXLSB()
+{
+ ScDocShellRef xShell = loadDoc("tdf108017_calcProtection.", FORMAT_XLSB);
+ CPPUNIT_ASSERT(xShell.Is());
+
+ ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ const ScTableProtection* pTabProtect = rDoc.GetTabProtection(0);
+ CPPUNIT_ASSERT(pTabProtect);
+ CPPUNIT_ASSERT(pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ));
+ CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled( ScTableProtection::SELECT_LOCKED_CELLS ));
xDocSh->DoClose();
}
diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx
index 1bbc7a82cbd3..ca956382dc7b 100644
--- a/sc/source/filter/oox/worksheetsettings.cxx
+++ b/sc/source/filter/oox/worksheetsettings.cxx
@@ -215,21 +215,21 @@ void WorksheetSettings::importSheetProtection( SequenceInputStream& rStrm )
maSheetProt.mnPasswordHash = rStrm.readuInt16();
// no flags field for all these boolean flags?!?
maSheetProt.mbSheet = rStrm.readInt32() != 0;
- maSheetProt.mbObjects = rStrm.readInt32() != 0;
- maSheetProt.mbScenarios = rStrm.readInt32() != 0;
- maSheetProt.mbFormatCells = rStrm.readInt32() != 0;
- maSheetProt.mbFormatColumns = rStrm.readInt32() != 0;
- maSheetProt.mbFormatRows = rStrm.readInt32() != 0;
- maSheetProt.mbInsertColumns = rStrm.readInt32() != 0;
- maSheetProt.mbInsertRows = rStrm.readInt32() != 0;
- maSheetProt.mbInsertHyperlinks = rStrm.readInt32() != 0;
- maSheetProt.mbDeleteColumns = rStrm.readInt32() != 0;
- maSheetProt.mbDeleteRows = rStrm.readInt32() != 0;
- maSheetProt.mbSelectLocked = rStrm.readInt32() != 0;
- maSheetProt.mbSort = rStrm.readInt32() != 0;
- maSheetProt.mbAutoFilter = rStrm.readInt32() != 0;
- maSheetProt.mbPivotTables = rStrm.readInt32() != 0;
- maSheetProt.mbSelectUnlocked = rStrm.readInt32() != 0;
+ maSheetProt.mbObjects = rStrm.readInt32() == 0;
+ maSheetProt.mbScenarios = rStrm.readInt32() == 0;
+ maSheetProt.mbFormatCells = rStrm.readInt32() == 0;
+ maSheetProt.mbFormatColumns = rStrm.readInt32() == 0;
+ maSheetProt.mbFormatRows = rStrm.readInt32() == 0;
+ maSheetProt.mbInsertColumns = rStrm.readInt32() == 0;
+ maSheetProt.mbInsertRows = rStrm.readInt32() == 0;
+ maSheetProt.mbInsertHyperlinks = rStrm.readInt32() == 0;
+ maSheetProt.mbDeleteColumns = rStrm.readInt32() == 0;
+ maSheetProt.mbDeleteRows = rStrm.readInt32() == 0;
+ maSheetProt.mbSelectLocked = rStrm.readInt32() == 0;
+ maSheetProt.mbSort = rStrm.readInt32() == 0;
+ maSheetProt.mbAutoFilter = rStrm.readInt32() == 0;
+ maSheetProt.mbPivotTables = rStrm.readInt32() == 0;
+ maSheetProt.mbSelectUnlocked = rStrm.readInt32() == 0;
}
void WorksheetSettings::importChartProtection( SequenceInputStream& rStrm )
commit d9865d2dd322c505d242927937ad5fd9dcd4d6b7
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu May 25 02:17:06 2017 +0300
tdf#105002 Don't crash on mail wizard recreation
Change-Id: I8af4753cc654ec475d40223a64afa50a9de332ab
Reviewed-on: https://gerrit.libreoffice.org/38007
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
(cherry picked from commit ce40f2798f0fa2f8f6e3084e4bbbd50e749c55d6)
Reviewed-on: https://gerrit.libreoffice.org/38037
(cherry picked from commit 6b921e1c8a4779dfd6f5531842ab89d85aa99a85)
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 5e2b80979791..61a9e31b9f08 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -575,6 +575,7 @@ IMPL_LINK_NOARG( SwMailMergeWizardExecutor, EndDialogHdl, Dialog&, void )
xMMConfig->SetTargetView(nullptr);
// destroy wizard asynchronously
+ m_pWizardToDestroyInCallback = m_pWizard;
Application::PostUserEvent(
LINK( this, SwMailMergeWizardExecutor, CloseFrameHdl ), m_pWizard );
@@ -668,6 +669,7 @@ IMPL_LINK_NOARG(SwMailMergeWizardExecutor, CloseFrameHdl, void*, void)
m_pView2Close->GetViewFrame()->DoClose();
m_pView2Close = nullptr;
}
+ m_pWizardToDestroyInCallback.disposeAndClear();
}
} // namespace
commit 67338c3c91b8a47543d1a79c4d245d2d70f2df62
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon May 22 21:41:31 2017 +0200
tdf#107868 PDF export of editeng fill color: restrict to logic map modes
The original use case was Writer/Impress shape text, but when the map
mode is pixels, the reference device gives bogus values for the
PixelToLogic() calls, affecting e.g. form controls.
Just go back to the old way of not painting the background for those.
(cherry picked from commit 919a4ef592b6026a7533a93682f39118fef29ce8)
Conflicts:
vcl/qa/cppunit/pdfexport/pdfexport.cxx
Change-Id: I52f1901af15732274915fa3c77c06909b5164afb
Reviewed-on: https://gerrit.libreoffice.org/37977
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit f6a66846f50132fab7be6baf516ab6af04acf7e5)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a6ced4d62952..8c3575cdca14 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9548,7 +9548,10 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
}
}
- if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT))
+ // Avoid fill color when map mode is in pixels, the below code assumes
+ // logic map mode.
+ bool bPixel = m_aCurrentPDFState.m_aMapMode.GetMapUnit() == MapUnit::MapPixel;
+ if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT) && !bPixel)
{
// PDF doesn't have a text fill color, so draw a rectangle before
// drawing the actual text.
commit 6ef1aea8bd6040fd2b57c8330a5691d340a78ca2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu May 18 15:27:05 2017 +0200
tdf#107782 xmlsecurity PDF verify: handle empty X509 certificate
Leaving Signer as an empty reference will do exactly what we want: the
signature will be considered invalid.
(cherry picked from commit 18aa83acfa243741eb4c79a2e11aec6eaf1a9f02)
Change-Id: I25d7cbd260384110173fe953fc24f3dcf6b9acd5
Reviewed-on: https://gerrit.libreoffice.org/37813
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 398ab416bd552162131e74751e48d266a1f31ee9)
diff --git a/xmlsecurity/qa/unit/pdfsigning/data/tdf107782.pdf b/xmlsecurity/qa/unit/pdfsigning/data/tdf107782.pdf
new file mode 100644
index 000000000000..086e18eedc03
Binary files /dev/null and b/xmlsecurity/qa/unit/pdfsigning/data/tdf107782.pdf differ
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 015e5a02924e..b7bca31a6caa 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -74,6 +74,7 @@ public:
void testTokenize();
/// Test handling of unknown SubFilter values.
void testUnknownSubFilter();
+ void testTdf107782();
CPPUNIT_TEST_SUITE(PDFSigningTest);
CPPUNIT_TEST(testPDFAdd);
@@ -90,6 +91,7 @@ public:
CPPUNIT_TEST(testGood);
CPPUNIT_TEST(testTokenize);
CPPUNIT_TEST(testUnknownSubFilter);
+ CPPUNIT_TEST(testTdf107782);
CPPUNIT_TEST_SUITE_END();
};
@@ -284,6 +286,24 @@ void PDFSigningTest::testPDFRemoveAll()
CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), rInformations.size());
}
+void PDFSigningTest::testTdf107782()
+{
+ uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext);
+ uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext = xSEInitializer->createSecurityContext(OUString());
+
+ // Load the test document as a storage and read its signatures.
+ DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content);
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf107782.pdf";
+ SvStream* pStream = utl::UcbStreamHelper::CreateStream(aURL, StreamMode::READ | StreamMode::WRITE);
+ uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream));
+ aManager.mxSignatureStream = xStream;
+ aManager.read(/*bUseTempStream=*/false);
+ CPPUNIT_ASSERT(aManager.mpPDFSignatureHelper);
+
+ // This failed with an std::bad_alloc exception on Windows.
+ aManager.mpPDFSignatureHelper->GetDocumentSignatureInformations(aManager.getSecurityEnvironment());
+}
+
void PDFSigningTest::testPDF14Adobe()
{
// Two signatures, first is SHA1, the second is SHA256.
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 6c9d07125011..c8389ee8a915 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -78,7 +78,8 @@ uno::Sequence<security::DocumentSignatureInformation> PDFSignatureHelper::GetDoc
const SignatureInformation& rInternal = m_aSignatureInfos[i];
security::DocumentSignatureInformation& rExternal = aRet[i];
rExternal.SignatureIsValid = rInternal.nStatus == xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED;
- rExternal.Signer = xSecEnv->createCertificateFromAscii(rInternal.ouX509Certificate);
+ if (!rInternal.ouX509Certificate.isEmpty())
+ rExternal.Signer = xSecEnv->createCertificateFromAscii(rInternal.ouX509Certificate);
rExternal.PartialDocumentSignature = rInternal.bPartialDocumentSignature;
// Verify certificate.
commit 0d0525e8fee1d663f14ad3a9a11f019817a41b60
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue May 16 08:34:40 2017 +0200
tdf#106953 RTF import: fix missing paragraph left margin
See commit 3915bf2dc877d5f1140798e24933db0f21386a4a (tdf#95376 DOCX
import: fix incorrectly indented tab stops, 2016-01-26) for the various
sources that can determine the paragraph indentation.
In this case the problem was that too aggressive RTF style deduplication
removed a direct indent, which then meant a fallback to the ind-from-num
value, not to the ind-from-parastyle one.
(cherry picked from commit f528f9499bd91b700c549575e88fa102cfffede9)
Change-Id: I3b47b2bbeaaedf405baef24505d23dc49bd01865
Reviewed-on: https://gerrit.libreoffice.org/37670
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 0022ae02cfea1c5d69d9f4fedeeeb7a30cc4184b)
diff --git a/sw/qa/extras/rtfimport/data/tdf106953.rtf b/sw/qa/extras/rtfimport/data/tdf106953.rtf
new file mode 100644
index 000000000000..398f9df78dcf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf106953.rtf
@@ -0,0 +1,23 @@
+{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033
+{\stylesheet
+{\s19 \li720
+style;
+}
+}
+{\*\listtable
+{\list
+{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0
+{\leveltext\'02\'00.;
+}
+{\levelnumbers \'01
+{\uc1 \u59 ?}
+}
+\li720 \fi-360 }
+\listid697112958 }
+}
+{\*\listoverridetable
+{\listoverride \listid697112958 \listoverridecount0 \ls1 }
+}
+\pard \plain \s19 \fi-360 \li720 \ls1
+{hello\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ca696d9c84f8..9d863e7c76a9 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1330,6 +1330,15 @@ DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf")
CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
}
+DECLARE_RTFIMPORT_TEST(testTdf106953, "tdf106953.rtf")
+{
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
+ uno::Reference<beans::XPropertyState> xPropertyState(getParagraph(1), uno::UNO_QUERY);
+ beans::PropertyState ePropertyState = xPropertyState->getPropertyState("ParaLeftMargin");
+ // Was beans::PropertyState_DEFAULT_VALUE.
+ CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
+}
+
DECLARE_RTFIMPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Standard"), uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx
index 3f4f6659d2e8..b8f32ea48b69 100644
--- a/writerfilter/source/rtftok/rtfsprm.cxx
+++ b/writerfilter/source/rtftok/rtfsprm.cxx
@@ -163,6 +163,11 @@ static bool isSPRMDeduplicateBlacklist(Id nId)
case NS_ooxml::LN_CT_TabStop_pos:
// See the NS_ooxml::LN_CT_PPrBase_tabs handler in DomainMapper,
// deduplication is explicitly not wanted for these tokens.
+ // Erasing these just because they equal to the style one is
+ // problematic, as then the used value won't be from the style, but
+ // possibly from the numbering.
+ case NS_ooxml::LN_CT_Ind_left:
+ case NS_ooxml::LN_CT_Ind_right:
return true;
default:
commit eb08f3bfa9bac6afce0a2a59a07b5b71fb2605bc
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Thu May 18 23:25:32 2017 +0200
fix gdi resource leak (editeng/impedit)
Change-Id: Ia2d9ad88b5bcc2adf7f28ac7833132c04045d55b
Reviewed-on: https://gerrit.libreoffice.org/37802
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 4b6bc4e012bde5737f279377c8186faf38a888ad)
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index a8af19d86982..e3a5291a5e0e 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1770,6 +1770,7 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
SolarMutexGuard aVclGuard;
+ delete pDragAndDropInfo;
pDragAndDropInfo = nullptr;
Point aMousePosPixel( rDGE.DragOriginX, rDGE.DragOriginY );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 0958617c3bba..1547ed769669 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -132,6 +132,10 @@ struct DragAndDropInfo
bHasValidData = false; bUndoAction = false; bOutlinerMode = false;
nSensibleRange = 0; nCursorWidth = 0; pField = nullptr; nOutlinerDropDest = 0; bDragAccepted = false;
}
+ ~DragAndDropInfo()
+ {
+ pBackground.disposeAndClear();
+ }
};
struct ImplIMEInfos
commit a9e7600bd3fc56d4f103754784706773ca20e0f3
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri May 5 01:30:30 2017 +0300
tdf#103158 ctrl+shift should work on key up
Under gtk/gtk3 we send CommandEventId::ModKeyChange on
key down, to support the auto-accelerator feature. But
at least the handler in SwEditWin::Command must get it
on key up, in order to not interfere with other
ctrl+shift+X shortcuts, which work on key down.
To achieve that, we need:
- On key up pass the key that was just released, instead
of the current state of nothing being pressed.
- Have a flag of whether it's a key down or up event, so
it can be checked by the application code.
Reviewed-on: https://gerrit.libreoffice.org/37275
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
(cherry picked from commit fe0451259d2fb93c809c1bfa3baf5abd90019c58)
Conflicts:
include/vcl/commandevent.hxx
vcl/source/window/commandevent.cxx
vcl/unx/generic/window/salframe.cxx
vcl/unx/gtk/gtksalframe.cxx
vcl/unx/gtk3/gtk3gtkframe.cxx
Change-Id: If188d6ccdc3b214a2c3ed20aad291d74d46b358f
Reviewed-on: https://gerrit.libreoffice.org/37516
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 30c17a288b03656633b626f6e7f679ca7c1aa6ff)
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 371fd54716d9..adaa8ad953bb 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -187,11 +187,13 @@ public:
class VCL_DLLPUBLIC CommandModKeyData
{
private:
+ bool mbDown;
sal_uInt16 mnCode;
public:
- CommandModKeyData( sal_uInt16 nCode );
+ CommandModKeyData( sal_uInt16 nCode, bool bDown );
+ bool IsDown() const { return mbDown; }
bool IsMod1() const { return (mnCode & MODKEY_MOD1) != 0; }
bool IsMod2() const { return (mnCode & MODKEY_MOD2) != 0; }
bool IsLeftShift() const { return (mnCode & MODKEY_LSHIFT) != 0; }
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index c552cdfe8df5..024c3aabfc88 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5527,7 +5527,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
case CommandEventId::ModKeyChange :
{
const CommandModKeyData* pCommandData = rCEvt.GetModKeyData();
- if (pCommandData->IsMod1() && !pCommandData->IsMod2())
+ if (!pCommandData->IsDown() && pCommandData->IsMod1() && !pCommandData->IsMod2())
{
sal_uInt16 nSlot = 0;
if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift())
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index c25ca80909dc..a52d887e6cdc 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -121,6 +121,7 @@ struct SalMenuEvent
// KEYMODCHANGE
struct SalKeyModEvent
{
+ bool mbDown; // Whether the change occurred on a key down event
sal_uInt64 mnTime; // Time in ms, when event is created
sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2)
sal_uInt16 mnModKeyCode; // extended Modifier (MODKEY_LEFT,MODKEY_RIGHT,MODKEY_PRESS,MODKEY_RELEASE)
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index fcb4498512d9..f2631604606f 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -197,7 +197,6 @@ class GtkSalFrame : public SalFrame
bool m_bSpanMonitorsWhenFullscreen;
bool m_bDefaultPos;
bool m_bDefaultSize;
- bool m_bSendModChangeOnRelease;
bool m_bWindowIsGtkPlug;
OUString m_aTitle;
OUString m_sWMClass;
diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx
index 8ef928f3a571..a07086a3e8cb 100644
--- a/vcl/source/window/commandevent.cxx
+++ b/vcl/source/window/commandevent.cxx
@@ -100,8 +100,9 @@ CommandScrollData::CommandScrollData( long nDeltaX, long nDeltaY )
mnDeltaY = nDeltaY;
}
-CommandModKeyData::CommandModKeyData( sal_uInt16 nCode )
+CommandModKeyData::CommandModKeyData( sal_uInt16 nCode, bool bDown )
{
+ mbDown = bDown;
mnCode = nCode;
}
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 0852b953442a..5979104f230c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2568,7 +2568,7 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent )
const CommandModKeyData* pCData = rCEvent.GetModKeyData ();
if (pWin->nHighlightedItem == ITEMPOS_INVALID)
{
- if (pCData && pCData->IsMod2())
+ if (pCData && pCData->IsMod2() && pCData->IsDown())
pWin->SetMBWHideAccel(false);
else
pWin->SetMBWHideAccel(true);
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 95c1652be2af..dfa23f06a09c 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -167,7 +167,7 @@ bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::W
if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && ImplGetSVData()->maNWFData.mbAutoAccel)
{
const CommandModKeyData *pCData = rCEvent.GetModKeyData();
- const bool bShowAccel = pCData && pCData->IsMod2();
+ const bool bShowAccel = pCData && pCData->IsMod2() && pCData->IsDown();
processChildren(pWindow, bShowAccel);
return true;
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 8defcd3614ea..3133990e158f 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2102,7 +2102,7 @@ static void ImplHandleSalKeyMod( vcl::Window* pWindow, SalKeyModEvent* pEvent )
if ( !pChild )
return;
- CommandModKeyData data( pEvent->mnModKeyCode );
+ CommandModKeyData data( pEvent->mnModKeyCode, pEvent->mbDown );
ImplCallCommand( pChild, CommandEventId::ModKeyChange, &data );
}
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index f71eecf239ea..6b2a3e543600 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -3044,6 +3044,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
|| nKeySym == XK_Super_L || nKeySym == XK_Super_R )
{
SalKeyModEvent aModEvt;
+ aModEvt.mbDown = false; // auto-accelerator feature not supported here
aModEvt.mnModKeyCode = 0;
if( pEvent->type == KeyPress && mnExtKeyMod == 0 )
mbSendExtKeyModChange = true;
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 2bb6718725dc..1e28c041ea47 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -968,7 +968,6 @@ void GtkSalFrame::InitCommon()
m_bSpanMonitorsWhenFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
m_nVisibility = GDK_VISIBILITY_FULLY_OBSCURED;
- m_bSendModChangeOnRelease = false;
m_pIMHandler = nullptr;
m_nExtStyle = 0;
m_pRegion = nullptr;
@@ -2985,10 +2984,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
pSalInstance->updatePrinterUpdate();
if( !pEvent->in )
- {
pThis->m_nKeyModifiers = 0;
- pThis->m_bSendModChangeOnRelease = false;
- }
if( pThis->m_pIMHandler )
pThis->m_pIMHandler->focusChanged( pEvent->in );
@@ -3101,20 +3097,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
pEvent->keyval == GDK_KEY_Meta_L || pEvent->keyval == GDK_KEY_Meta_R ||
pEvent->keyval == GDK_KEY_Super_L || pEvent->keyval == GDK_KEY_Super_R )
{
- SalKeyModEvent aModEvt;
-
sal_uInt16 nModCode = GetKeyModCode( pEvent->state );
-
- aModEvt.mnModKeyCode = 0; // emit no MODKEYCHANGE events
- if( pEvent->type == GDK_KEY_PRESS && !pThis->m_nKeyModifiers )
- pThis->m_bSendModChangeOnRelease = true;
-
- else if( pEvent->type == GDK_KEY_RELEASE &&
- pThis->m_bSendModChangeOnRelease )
- {
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
- }
-
sal_uInt16 nExtModMask = 0;
sal_uInt16 nModMask = 0;
// pressing just the ctrl key leads to a keysym of XK_Control but
@@ -3160,8 +3143,15 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
nModMask = KEY_MOD3;
break;
}
+
+ SalKeyModEvent aModEvt;
+ aModEvt.mbDown = pEvent->type == GDK_KEY_PRESS;
+ aModEvt.mnTime = pEvent->time;
+ aModEvt.mnCode = nModCode;
+
if( pEvent->type == GDK_KEY_RELEASE )
{
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
nModCode &= ~nModMask;
pThis->m_nKeyModifiers &= ~nExtModMask;
}
@@ -3169,14 +3159,10 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
{
nModCode |= nModMask;
pThis->m_nKeyModifiers |= nExtModMask;
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
}
- aModEvt.mnCode = nModCode;
- aModEvt.mnTime = pEvent->time;
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
-
pThis->CallCallback( SalEvent::KeyModChange, &aModEvt );
-
}
else
{
@@ -3189,7 +3175,7 @@ gboolean GtkSalFrame::signalKey( GtkWidget*, GdkEventKey* pEvent, gpointer frame
(pEvent->type == GDK_KEY_PRESS),
false );
if( ! aDel.isDeleted() )
- pThis->m_bSendModChangeOnRelease = false;
+ pThis->m_nKeyModifiers = 0;
}
if( !aDel.isDeleted() && pThis->m_pIMHandler )
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index f22e8ebcbaa7..67caeb516770 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1075,7 +1075,6 @@ void GtkSalFrame::InitCommon()
m_bSpanMonitorsWhenFullscreen = false;
m_nState = GDK_WINDOW_STATE_WITHDRAWN;
m_nVisibility = GDK_VISIBILITY_FULLY_OBSCURED;
- m_bSendModChangeOnRelease = false;
m_pIMHandler = nullptr;
m_nExtStyle = 0;
m_pRegion = nullptr;
@@ -3021,10 +3020,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
pSalInstance->updatePrinterUpdate();
if( !pEvent->in )
- {
pThis->m_nKeyModifiers = 0;
- pThis->m_bSendModChangeOnRelease = false;
- }
if( pThis->m_pIMHandler )
pThis->m_pIMHandler->focusChanged( pEvent->in );
@@ -3088,20 +3084,7 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
pEvent->keyval == GDK_KEY_Meta_L || pEvent->keyval == GDK_KEY_Meta_R ||
pEvent->keyval == GDK_KEY_Super_L || pEvent->keyval == GDK_KEY_Super_R )
{
- SalKeyModEvent aModEvt;
-
sal_uInt16 nModCode = GetKeyModCode( pEvent->state );
-
- aModEvt.mnModKeyCode = 0; // emit no MODKEYCHANGE events
- if( pEvent->type == GDK_KEY_PRESS && !pThis->m_nKeyModifiers )
- pThis->m_bSendModChangeOnRelease = true;
-
- else if( pEvent->type == GDK_KEY_RELEASE &&
- pThis->m_bSendModChangeOnRelease )
- {
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
- }
-
sal_uInt16 nExtModMask = 0;
sal_uInt16 nModMask = 0;
// pressing just the ctrl key leads to a keysym of XK_Control but
@@ -3147,8 +3130,15 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
nModMask = KEY_MOD3;
break;
}
+
+ SalKeyModEvent aModEvt;
+ aModEvt.mbDown = pEvent->type == GDK_KEY_PRESS;
+ aModEvt.mnTime = pEvent->time;
+ aModEvt.mnCode = nModCode;
+
if( pEvent->type == GDK_KEY_RELEASE )
{
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
nModCode &= ~nModMask;
pThis->m_nKeyModifiers &= ~nExtModMask;
}
@@ -3156,14 +3146,10 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
{
nModCode |= nModMask;
pThis->m_nKeyModifiers |= nExtModMask;
+ aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
}
- aModEvt.mnCode = nModCode;
- aModEvt.mnTime = pEvent->time;
- aModEvt.mnModKeyCode = pThis->m_nKeyModifiers;
-
pThis->CallCallbackExc( SalEvent::KeyModChange, &aModEvt );
-
}
else
{
@@ -3176,7 +3162,7 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
(pEvent->type == GDK_KEY_PRESS),
false );
if( ! aDel.isDeleted() )
- pThis->m_bSendModChangeOnRelease = false;
+ pThis->m_nKeyModifiers = 0;
}
if( !aDel.isDeleted() && pThis->m_pIMHandler )
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 7c234c5dd3e9..c0c88596c186 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3475,6 +3475,7 @@ static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
if ( (wParam == VK_SHIFT) || (wParam == VK_CONTROL) || (wParam == VK_MENU) )
{
SalKeyModEvent aModEvt;
+ aModEvt.mbDown = false; // auto-accelerator feature not supported here.
aModEvt.mnTime = GetMessageTime();
aModEvt.mnCode = nModCode;
aModEvt.mnModKeyCode = 0; // no command events will be sent if this member is 0
commit b80657a35863763404dcae79abb417bb47dab530
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Wed May 10 22:56:35 2017 +0200
tdf#106424 fix crash in SfxItemPool::Put
This fix reverts commit 304d3856c138fb54ff536f41be3eff26ab4d6315
Date: Wed Oct 16 07:55:09 2002 +0000
#103124# possible unremoved SwFmt object fixed
and commit fab98924e01f211c1d1fc5823c0867019b590c60
Date: Wed Oct 16 10:18:26 2002 +0000
#103152# possible unremoved SwFmt object fixed
as they are causing crashes:
http://crashreport.libreoffice.org/stats/signature
/SfxItemPool::Put(SfxPoolItem%20const%20&,unsigned%20short)
The comments suggest there was/is a use-after-free when
SwFormatCharFormat is changed with API. This happens in unoobj.cxx
and unostyle.cxx by SwFormatDrop::SetCharFormat().
With following changes:
commit bf2ae97a223df987d6b9bc649afe311b5421f61e
INTEGRATION: CWS os7 (1.64.4.3.34); FILE MERGED
2003/03/25 14:23:43 os 1.64.4.3.34.1: #104245# table mode added
to the SwXTextCursor::SetPropertyValue attribute list; 'Standard'
character format not allowed as drop cap char style
and commit 9625366d0b2fd36a57c6283a4a80c47b80d57707
INTEGRATION: CWS os8 (1.64.4.3.48); FILE MERGED
2003/04/09 09:11:53 os 1.64.4.3.48.3: #104245# Default not
allowed as DropCapCharStyleName, too
in unoobj.cxx, setting the documents' default SwFormatCharFormat is
rejected by throwing an exception. Likely to fix the same issue as
the first 2 commits.
So we do the same in unostyle.cxx now too.
Add an assert in SwFormatCharFormat::SetCharFormat and
SwFormatDrop::SetCharFormat, to uncover other changes to the default
SwFormatCharFormat or SwFormatDrop.
Such an case could happen in SwXTextDefaults::setPropertyValue
where we bail out now.
Change-Id: Iac59dffbd6285dd28d1000a8eacda8ffd3bdc962
Reviewed-on: https://gerrit.libreoffice.org/37499
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit 6d51bb3d54ac52e4870bd00a21fce3a3b1c5010b)
Reviewed-on: https://gerrit.libreoffice.org/38005
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 69330c31f5e8c35fb5ede92dcd130fde0bdc7e4f)
Reviewed-on: https://gerrit.libreoffice.org/38032
(cherry picked from commit f750372ac81cb51177cd6cbda39ecacd5f821590)
diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx
index 2d6c77f20d7d..90314b18d437 100644
--- a/sw/inc/fchrfmt.hxx
+++ b/sw/inc/fchrfmt.hxx
@@ -62,7 +62,11 @@ public:
virtual bool GetInfo( SfxPoolItem& rInfo ) const override;
- void SetCharFormat( SwFormat* pFormat ) { pFormat->Add(this); }
+ void SetCharFormat( SwFormat* pFormat )
+ {
+ assert(!pFormat->IsDefault()); // expose cases that lead to use-after-free
+ pFormat->Add(this);
+ }
SwCharFormat* GetCharFormat() const { return const_cast<SwCharFormat*>(static_cast<const SwCharFormat*>(GetRegisteredIn())); }
};
#endif
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5396f9697afa..f665c032ccf1 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -44,8 +44,6 @@
#include <svl/zforlist.hxx>
#include <unotools/lingucfg.hxx>
#include <svx/svdpage.hxx>
-#include <paratr.hxx>
-#include <fchrfmt.hxx>
#include <fmtcntnt.hxx>
#include <fmtanchr.hxx>
#include <fmtfsize.hxx>
@@ -387,16 +385,6 @@ SwDoc::~SwDoc()
delete mpGrammarContact;
mpGrammarContact = nullptr;
- //!! needs to be done to destroy a possible SwFormatDrop format that may
- //!! be connected to a char format which may not otherwise be removed
- //!! and thus would leave a unremoved SwFormat object. (TL)
- //!! (this is case is not possible via UI but via API...)
- SwFormatDrop aDrop;
- SetDefault(aDrop);
- //!! same for SwFormatCharFormat
- SwFormatCharFormat aCharFormat(nullptr);
- SetDefault(aCharFormat);
-
getIDocumentTimerAccess().StopIdling(); // stop idle timer
delete mpURLStateChgd;
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index ad86bc250192..8fc36009722b 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -77,6 +77,7 @@ SwFormatDrop::~SwFormatDrop()
void SwFormatDrop::SetCharFormat( SwCharFormat *pNew )
{
+ assert(!pNew->IsDefault()); // expose cases that lead to use-after-free
// Rewire
if ( GetRegisteredIn() )
GetRegisteredInNonConst()->Remove( this );
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx
index 4aa4c012ad41..fcdc14049234 100644
--- a/sw/source/core/unocore/SwXTextDefaults.cxx
+++ b/sw/source/core/unocore/SwXTextDefaults.cxx
@@ -94,6 +94,9 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName,
if(pStyle)
{
rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) );
+ if (xStyle->GetCharFormat() == m_pDoc->GetDfltCharFormat())
+ return; // don't SetCharFormat with formats from mpDfltCharFormat
+
if (RES_PARATR_DROP == pMap->nWID)
{
pDrop = static_cast<SwFormatDrop*>(rItem.Clone()); // because rItem is const...
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 9c9bb65e4a3f..27a97260bd05 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -414,9 +414,7 @@ lcl_setDropcapCharStyle(SwPaM & rPam, SfxItemSet & rItemSet,
SwDocStyleSheet *const pStyle = static_cast<SwDocStyleSheet*>(
pDoc->GetDocShell()
->GetStyleSheetPool()->Find(sStyle, SfxStyleFamily::Char));
- if (!pStyle ||
- (static_cast<SwDocStyleSheet*>(pStyle)->GetCharFormat() ==
- pDoc->GetDfltCharFormat()))
+ if (!pStyle || pStyle->GetCharFormat() == pDoc->GetDfltCharFormat())
{
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 2bbf13720a6a..63ce5d95beb6 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1936,8 +1936,11 @@ void SwXStyle::SetPropertyValue<RES_PARATR_DROP>(const SfxItemPropertySimpleEntr
OUString sStyle;
SwStyleNameMapper::FillUIName(sValue, sStyle, SwGetPoolIdFromName::ChrFmt, true);
auto pStyle(static_cast<SwDocStyleSheet*>(m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SfxStyleFamily::Char)));
- if(!pStyle)
+ //default character style must not be set as default format
+ if(!pStyle || pStyle->GetCharFormat() == m_pDoc->GetDfltCharFormat() )
+ {
throw lang::IllegalArgumentException();
+ }
pDrop->SetCharFormat(pStyle->GetCharFormat());
rStyleSet.Put(*pDrop);
}
commit 150daf84b802e1ad9f53f98272111fd22197ccc2
Author: David Tardon <dtardon at redhat.com>
Date: Thu May 25 16:14:36 2017 +0200
disable use of poppler's internal JPEG2000 codec
Change-Id: I7789d91f26577b08d88fc53460466798fc267e24
Reviewed-on: https://gerrit.libreoffice.org/38029
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 37f8fd94ee19119c8f1896a7b651874caac19964)
diff --git a/external/poppler/0001-really-disable-JPEG2000-import.patch.1 b/external/poppler/0001-really-disable-JPEG2000-import.patch.1
new file mode 100644
index 000000000000..b23e29de0348
--- /dev/null
+++ b/external/poppler/0001-really-disable-JPEG2000-import.patch.1
@@ -0,0 +1,35 @@
+From 728c4d962ec0d2b1a6b2684aff8319ff9f91dbbc Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Thu, 25 May 2017 16:12:20 +0200
+Subject: [PATCH] really disable JPEG2000 import
+
+---
+ poppler/Stream.cc | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/poppler/Stream.cc b/poppler/Stream.cc
+index 4a9babe4..ea119cb4 100644
+--- a/poppler/Stream.cc
++++ b/poppler/Stream.cc
+@@ -76,8 +76,6 @@
+
+ #ifdef ENABLE_LIBOPENJPEG
+ #include "JPEG2000Stream.h"
+-#else
+-#include "JPXStream.h"
+ #endif
+
+ #ifdef __DJGPP__
+@@ -348,7 +346,8 @@ Stream *Stream::makeFilter(char *name, Stream *str, Object *params, int recursio
+ globals.free();
+ obj.free();
+ } else if (!strcmp(name, "JPXDecode")) {
+- str = new JPXStream(str);
++ error(errSyntaxError, getPos(), "Unknown filter '{0:s}'", name);
++ str = new EOFStream(str);
+ } else if (!strcmp(name, "Crypt")) {
+ if (str->getKind() == strCrypt) {
+ str = str->getBaseStream();
+--
+2.13.0
+
diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk
index f72c040c513b..86080d4e802a 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
external/poppler/poppler-mac-fake.patch.1 \
external/poppler/ubsan.patch.0 \
external/poppler/poppler-libjpeg.patch.1 \
+ external/poppler/0001-really-disable-JPEG2000-import.patch.1 \
))
# vim: set noet sw=4 ts=4:
commit 356e3ab9945e36fae7a07bb1c4948df5686236cf
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed May 24 16:14:56 2017 +0200
rhbz#1425304 sdext: join TimerScheduler thread before shutdown
Use a osl::Condition to interrupt the waiting thread, and join it.
Change-Id: I638a2495afd082446c39faf9362578bd0f758d04
(cherry picked from commit 15b033d1dd09cd1898a994a0f12e38ed5cf847cb)
Reviewed-on: https://gerrit.libreoffice.org/37992
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit 1a14a0404ef02a76cfc3b6bfd50b1c78bb150d45)
diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx
index 8cba1bcafa01..831c0ec274bb 100644
--- a/sdext/source/presenter/PresenterScrollBar.cxx
+++ b/sdext/source/presenter/PresenterScrollBar.cxx
@@ -802,6 +802,7 @@ void PresenterScrollBar::MousePressRepeater::Start (const PresenterScrollBar::Ar
// Schedule repeated executions.
auto pThis(shared_from_this());
mnMousePressRepeaterTaskId = PresenterTimer::ScheduleRepeatedTask (
+ mpScrollBar->GetComponentContext(),
[pThis] (TimeValue const& rTime) { return pThis->Callback(rTime); },
500000000,
250000000);
diff --git a/sdext/source/presenter/PresenterScrollBar.hxx b/sdext/source/presenter/PresenterScrollBar.hxx
index 7706ce4ea5aa..1c51194e897b 100644
--- a/sdext/source/presenter/PresenterScrollBar.hxx
+++ b/sdext/source/presenter/PresenterScrollBar.hxx
@@ -60,6 +60,9 @@ public:
virtual void SAL_CALL disposing() override;
+ css::uno::Reference<css::uno::XComponentContext> const&
+ GetComponentContext() { return mxComponentContext; }
+
void SetVisible (const bool bIsVisible);
/** Set the bounding box of the scroll bar.
diff --git a/sdext/source/presenter/PresenterTextView.cxx b/sdext/source/presenter/PresenterTextView.cxx
index 8e3800b46479..1946696b4b89 100644
--- a/sdext/source/presenter/PresenterTextView.cxx
+++ b/sdext/source/presenter/PresenterTextView.cxx
@@ -73,6 +73,7 @@ PresenterTextView::PresenterTextView (
mpFont(),
maParagraphs(),
mpCaret(new PresenterTextCaret(
+ rxContext,
[this] (sal_Int32 const nParagraphIndex, sal_Int32 const nCharacterIndex)
{ return this->GetCaretBounds(nParagraphIndex, nCharacterIndex); },
rInvalidator)),
@@ -1077,9 +1078,11 @@ void PresenterTextParagraph::SetupCellArray (
//===== PresenterTextCaret ================================================----
PresenterTextCaret::PresenterTextCaret (
+ uno::Reference<uno::XComponentContext> const& xContext,
const ::std::function<css::awt::Rectangle (const sal_Int32,const sal_Int32)>& rCharacterBoundsAccess,
const ::std::function<void (const css::awt::Rectangle&)>& rInvalidator)
- : mnParagraphIndex(-1),
+ : m_xContext(xContext)
+ , mnParagraphIndex(-1),
mnCharacterIndex(-1),
mnCaretBlinkTaskId(0),
mbIsCaretVisible(false),
@@ -1100,6 +1103,7 @@ void PresenterTextCaret::ShowCaret()
if (mnCaretBlinkTaskId == 0)
{
mnCaretBlinkTaskId = PresenterTimer::ScheduleRepeatedTask (
+ m_xContext,
[this] (TimeValue const&) { return this->InvertCaret(); },
CaretBlinkIntervall,
CaretBlinkIntervall);
diff --git a/sdext/source/presenter/PresenterTextView.hxx b/sdext/source/presenter/PresenterTextView.hxx
index b56bd5a85f31..9fc7fd663e1f 100644
--- a/sdext/source/presenter/PresenterTextView.hxx
+++ b/sdext/source/presenter/PresenterTextView.hxx
@@ -41,6 +41,7 @@ class PresenterTextCaret
{
public:
PresenterTextCaret (
+ css::uno::Reference<css::uno::XComponentContext> const& xContext,
const ::std::function<css::awt::Rectangle (const sal_Int32,const sal_Int32)>&
rCharacterBoundsAccess,
const ::std::function<void (const css::awt::Rectangle&)>&
@@ -69,6 +70,7 @@ public:
const css::awt::Rectangle& GetBounds() const;
private:
+ css::uno::Reference<css::uno::XComponentContext> const& m_xContext;
sal_Int32 mnParagraphIndex;
sal_Int32 mnCharacterIndex;
sal_Int32 mnCaretBlinkTaskId;
diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx
index e9d3117ba323..6d4897642c42 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -18,10 +18,15 @@
*/
#include "PresenterTimer.hxx"
+
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+
#include <osl/doublecheckedlocking.h>
#include <osl/thread.hxx>
+#include <osl/conditn.hxx>
#include <algorithm>
#include <iterator>
@@ -71,7 +76,8 @@ class TimerScheduler
public ::osl::Thread
{
public:
- static std::shared_ptr<TimerScheduler> Instance();
+ static std::shared_ptr<TimerScheduler> Instance(
+ uno::Reference<uno::XComponentContext> const& xContext);
static SharedTimerTask CreateTimerTask (
const PresenterTimer::Task& rTask,
const TimeValue& rDueTime,
@@ -90,6 +96,9 @@ public:
static sal_Int64 ConvertFromTimeValue (
const TimeValue& rTimeValue);
+ static void NotifyTermination();
+ static bool HasInstance() { return mpInstance != nullptr; }
+
private:
static std::shared_ptr<TimerScheduler> mpInstance;
static ::osl::Mutex maInstanceMutex;
@@ -101,8 +110,10 @@ private:
TaskContainer maScheduledTasks;
::osl::Mutex maCurrentTaskMutex;
SharedTimerTask mpCurrentTask;
+ ::osl::Condition m_Shutdown;
- TimerScheduler();
+ TimerScheduler(
+ uno::Reference<uno::XComponentContext> const& xContext);
virtual ~TimerScheduler() override;
class Deleter {public: void operator () (TimerScheduler* pScheduler) { delete pScheduler; } };
friend class Deleter;
@@ -111,15 +122,42 @@ private:
virtual void SAL_CALL onTerminated() override { mpLateDestroy.reset(); }
};
+class TerminateListener
+ : public ::cppu::WeakImplHelper<frame::XTerminateListener>
+{
+ virtual ~TerminateListener() override
+ {
+ assert(!TimerScheduler::HasInstance());
+ }
+
+ virtual void SAL_CALL disposing(lang::EventObject const&)
+ throw (uno::RuntimeException, std::exception) override
+ {
+ }
+
+ virtual void SAL_CALL queryTermination(lang::EventObject const&)
+ throw (uno::RuntimeException, std::exception) override
+ {
+ }
+
+ virtual void SAL_CALL notifyTermination(lang::EventObject const&)
+ throw (uno::RuntimeException, std::exception) override
+ {
+ TimerScheduler::NotifyTermination();
+ }
+};
+
} // end of anonymous namespace
//===== PresenterTimer ========================================================
sal_Int32 PresenterTimer::ScheduleRepeatedTask (
+ const uno::Reference<uno::XComponentContext>& xContext,
const Task& rTask,
const sal_Int64 nDelay,
const sal_Int64 nIntervall)
{
+ assert(xContext.is());
TimeValue aCurrentTime;
if (TimerScheduler::GetCurrentTime(aCurrentTime))
{
@@ -128,7 +166,7 @@ sal_Int32 PresenterTimer::ScheduleRepeatedTask (
aDueTime,
TimerScheduler::ConvertFromTimeValue (aCurrentTime) + nDelay);
SharedTimerTask pTask (TimerScheduler::CreateTimerTask(rTask, aDueTime, nIntervall));
- TimerScheduler::Instance()->ScheduleTask(pTask);
+ TimerScheduler::Instance(xContext)->ScheduleTask(pTask);
return pTask->mnTaskId;
}
@@ -137,7 +175,11 @@ sal_Int32 PresenterTimer::ScheduleRepeatedTask (
void PresenterTimer::CancelTask (const sal_Int32 nTaskId)
{
- return TimerScheduler::Instance()->CancelTask(nTaskId);
+ auto const pInstance(TimerScheduler::Instance(nullptr));
+ if (pInstance)
+ {
+ pInstance->CancelTask(nTaskId);
+ }
}
//===== TimerScheduler ========================================================
@@ -146,23 +188,33 @@ std::shared_ptr<TimerScheduler> TimerScheduler::mpInstance;
::osl::Mutex TimerScheduler::maInstanceMutex;
sal_Int32 TimerScheduler::mnTaskId = PresenterTimer::NotAValidTaskId;
-std::shared_ptr<TimerScheduler> TimerScheduler::Instance()
+std::shared_ptr<TimerScheduler> TimerScheduler::Instance(
+ uno::Reference<uno::XComponentContext> const& xContext)
{
::osl::MutexGuard aGuard (maInstanceMutex);
if (mpInstance.get() == nullptr)
{
- mpInstance.reset(new TimerScheduler(), TimerScheduler::Deleter());
+ if (!xContext.is())
+ return nullptr;
+ mpInstance.reset(new TimerScheduler(xContext), TimerScheduler::Deleter());
mpInstance->create();
}
return mpInstance;
}
-TimerScheduler::TimerScheduler()
+TimerScheduler::TimerScheduler(
+ uno::Reference<uno::XComponentContext> const& xContext)
: maTaskContainerMutex(),
maScheduledTasks(),
maCurrentTaskMutex(),
mpCurrentTask()
{
+ uno::Reference<frame::XDesktop> const xDesktop(
+ frame::Desktop::create(xContext));
+ uno::Reference<frame::XTerminateListener> const xListener(
+ new TerminateListener);
+ // assuming the desktop can take ownership
+ xDesktop->addTerminateListener(xListener);
}
TimerScheduler::~TimerScheduler()
@@ -222,6 +274,33 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
// Let the main-loop cleanup in its own time
}
+void TimerScheduler::NotifyTermination()
+{
+ std::shared_ptr<TimerScheduler> const pInstance(TimerScheduler::mpInstance);
+ if (!pInstance)
+ {
+ return;
+ }
+
+ {
+ ::osl::MutexGuard aGuard(pInstance->maTaskContainerMutex);
+ pInstance->maScheduledTasks.clear();
+ }
+
+ {
+ ::osl::MutexGuard aGuard(pInstance->maCurrentTaskMutex);
+ if (pInstance->mpCurrentTask)
+ {
+ pInstance->mpCurrentTask->mbIsCanceled = true;
+ }
+ }
+
+ pInstance->m_Shutdown.set();
+
+ // rhbz#1425304 join thread before shutdown
+ pInstance->join();
+}
+
void SAL_CALL TimerScheduler::run()
{
osl_setThreadName("sdext::presenter::TimerScheduler");
@@ -269,7 +348,8 @@ void SAL_CALL TimerScheduler::run()
// Wait until the first task becomes due.
TimeValue aTimeValue;
ConvertToTimeValue(aTimeValue, nDifference);
- wait(aTimeValue);
+ // wait on condition variable, so the thread can be stopped
+ m_Shutdown.wait(&aTimeValue);
}
else
{
@@ -381,7 +461,9 @@ PresenterClockTimer::PresenterClockTimer (const Reference<XComponentContext>& rx
mnTimerTaskId(PresenterTimer::NotAValidTaskId),
mbIsCallbackPending(false),
mxRequestCallback()
+ , m_xContext(rxContext)
{
+ assert(m_xContext.is());
Reference<lang::XMultiComponentFactory> xFactory (
rxContext->getServiceManager(), UNO_QUERY);
if (xFactory.is())
@@ -416,6 +498,7 @@ void PresenterClockTimer::AddListener (const SharedListener& rListener)
if (mnTimerTaskId==PresenterTimer::NotAValidTaskId)
{
mnTimerTaskId = PresenterTimer::ScheduleRepeatedTask(
+ m_xContext,
[this] (TimeValue const& rTime) { return this->CheckCurrentTime(rTime); },
0,
250000000 /*ns*/);
diff --git a/sdext/source/presenter/PresenterTimer.hxx b/sdext/source/presenter/PresenterTimer.hxx
index 6b6ce0eef029..48784970b2a8 100644
--- a/sdext/source/presenter/PresenterTimer.hxx
+++ b/sdext/source/presenter/PresenterTimer.hxx
@@ -57,6 +57,7 @@ public:
nIntervall ns long until CancelTask is called.
*/
static sal_Int32 ScheduleRepeatedTask (
+ const css::uno::Reference<css::uno::XComponentContext>& xContext,
const Task& rTask,
const sal_Int64 nFirst,
const sal_Int64 nIntervall);
@@ -108,6 +109,7 @@ private:
sal_Int32 mnTimerTaskId;
bool mbIsCallbackPending;
css::uno::Reference<css::awt::XRequestCallback> mxRequestCallback;
+ const css::uno::Reference<css::uno::XComponentContext> m_xContext;
PresenterClockTimer (
const css::uno::Reference<css::uno::XComponentContext>& rxContext);
commit b6218e94f0bf546ac065be3f874ccd47c9381c78
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 16 10:12:09 2017 +0100
Resolves: tdf#103174 & rhbz#1367846 improve gtk3 trackpad scrolling
convert number of "lines" scrolled to double and allow
fractional parts of lines/columns
Change-Id: Ib99c815cfc8823e22fc1d76e201903c34ed0f61b
Related: rhbz#1367846 queue and merge scroll events
Reviewed-on: https://gerrit.libreoffice.org/37779
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 7f60978b2ccd0e17816b78bde60c6e0e60a9d52e)
Change-Id: Ib45f61bbb35bd240829491ac8a79803222974778
Reviewed-on: https://gerrit.libreoffice.org/37913
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit f7d2bf216afa10268e6a7c1d4613a2fd8f7c7f3c)
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 5b9cc09a7eaa..371fd54716d9 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -140,7 +140,7 @@ class VCL_DLLPUBLIC CommandWheelData
private:
long mnDelta;
long mnNotchDelta;
- sal_uLong mnLines;
+ double mnLines;
CommandWheelMode mnWheelMode;
sal_uInt16 mnCode;
bool mbHorz;
@@ -149,13 +149,13 @@ private:
public:
CommandWheelData();
CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
- sal_uLong nScrollLines,
+ double nScrollLines,
CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
bool bHorz, bool bDeltaIsPixel = false );
long GetDelta() const { return mnDelta; }
long GetNotchDelta() const { return mnNotchDelta; }
- sal_uLong GetScrollLines() const { return mnLines; }
+ double GetScrollLines() const { return mnLines; }
bool IsHorz() const { return mbHorz; }
bool IsDeltaPixel() const { return mbDeltaIsPixel; }
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 4fdb80560d68..7d6f69ce9b28 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -719,7 +719,7 @@ private:
SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
- SAL_DLLPRIVATE static void ImplHandleScroll( ScrollBar* pHScrl, long nX, ScrollBar* pVScrl, long nY );
+ SAL_DLLPRIVATE static void ImplHandleScroll(ScrollBar* pHScrl, double nX, ScrollBar* pVScrl, double nY);
SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const;
SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX();
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index b7f803eee86e..c25ca80909dc 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -149,7 +149,7 @@ struct SalWheelMouseEvent
long mnY; // Y-Position (Pixel, TopLeft-Output)
long mnDelta; // Number of rotations
long mnNotchDelta; // Number of fixed rotations
- sal_uLong mnScrollLines; // Actual number of lines to scroll
+ double mnScrollLines; // Actual number of lines to scroll
sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT)
bool mbHorz; // Horizontal
bool mbDeltaIsPixel; // delta value is a pixel value (on touch devices)
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 3deb4c4a8c28..fcb4498512d9 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -30,6 +30,7 @@
#include <gdk/gdkkeysyms.h>
#include <salframe.hxx>
+#include <vcl/idle.hxx>
#include <vcl/sysdata.hxx>
#include <unx/nativewindowhandleprovider.hxx>
#include <unx/saltype.h>
@@ -281,7 +282,7 @@ class GtkSalFrame : public SalFrame
static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer );
static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer );
- static gboolean signalScroll( GtkWidget*, GdkEventScroll*, gpointer );
+ static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer );
static gboolean signalVisibility( GtkWidget*, GdkEventVisibility*, gpointer );
static void signalDestroy( GtkWidget*, gpointer );
@@ -347,6 +348,8 @@ public:
#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t* m_pSurface;
DamageHandler m_aDamageHandler;
+ std::vector<GdkEvent*> m_aPendingScrollEvents;
+ Idle m_aSmoothScrollIdle;
int m_nGrabLevel;
bool m_bSalObjectSetPosSize;
#endif
@@ -427,6 +430,10 @@ public:
void removeGrabLevel();
void nopaint_container_resize_children(GtkContainer*);
+
+ void LaunchAsyncScroll(GdkEvent* pEvent);
+ DECL_LINK(AsyncScroll, Idle *, void);
+
#endif
virtual ~GtkSalFrame() override;
diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx
index e7f7dcd8569d..8ef928f3a571 100644
--- a/vcl/source/window/commandevent.cxx
+++ b/vcl/source/window/commandevent.cxx
@@ -73,7 +73,7 @@ CommandWheelData::CommandWheelData()
{
mnDelta = 0;
mnNotchDelta = 0;
- mnLines = 0;
+ mnLines = 0.0;
mnWheelMode = CommandWheelMode::NONE;
mnCode = 0;
mbHorz = false;
@@ -81,7 +81,7 @@ CommandWheelData::CommandWheelData()
}
CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
- sal_uLong nScrollLines,
+ double nScrollLines,
CommandWheelMode nWheelMode, sal_uInt16 nKeyModifier,
bool bHorz, bool bDeltaIsPixel )
{
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 095452df7b17..68a1dd554efd 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -664,7 +664,7 @@ long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
return nP;
}
-static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN, bool isMultiplyByLineSize )
+static void lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool isMultiplyByLineSize )
{
if ( pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode() )
{
@@ -681,7 +681,7 @@ static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN, bool isMultiplyBy
nN*=pScrl->GetLineSize();
}
- const double fVal = (double)(nNewPos - nN);
+ const double fVal = nNewPos - nN;
if ( fVal < LONG_MIN )
nNewPos = LONG_MIN;
@@ -737,8 +737,8 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd,
{
if (!pData->IsDeltaPixel())
{
- sal_uLong nScrollLines = pData->GetScrollLines();
- long nLines;
+ double nScrollLines = pData->GetScrollLines();
+ double nLines;
if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
{
if ( pData->GetDelta() < 0 )
@@ -747,7 +747,7 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd,
nLines = LONG_MAX;
}
else
- nLines = pData->GetNotchDelta() * (long)nScrollLines;
+ nLines = pData->GetNotchDelta() * nScrollLines;
if ( nLines )
{
ImplHandleScroll( nullptr,
@@ -860,8 +860,8 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd,
// horizontal or vertical scroll bar. nY is correspondingly either
// the horizontal or vertical scroll amount.
-void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
- ScrollBar* pVScrl, long nY )
+void Window::ImplHandleScroll( ScrollBar* pHScrl, double nX,
+ ScrollBar* pVScrl, double nY )
{
lcl_HandleScrollHelper( pHScrl, nX, true );
lcl_HandleScrollHelper( pVScrl, nY, true );
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index cfc6f4548f8c..2bb6718725dc 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2788,8 +2788,9 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
return true;
}
-gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEventScroll* pEvent, gpointer frame )
+gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEvent* pInEvent, gpointer frame)
{
+ GdkEventScroll& rEvent = pInEvent->scroll;
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
static sal_uLong nLines = 0;
@@ -2801,16 +2802,16 @@ gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEventScroll* pEvent, gpointer
nLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
}
- bool bNeg = (pEvent->direction == GDK_SCROLL_DOWN || pEvent->direction == GDK_SCROLL_RIGHT );
+ bool bNeg = (rEvent.direction == GDK_SCROLL_DOWN || rEvent.direction == GDK_SCROLL_RIGHT );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = pEvent->time;
- aEvent.mnX = (sal_uLong)pEvent->x;
- aEvent.mnY = (sal_uLong)pEvent->y;
+ aEvent.mnTime = rEvent.time;
+ aEvent.mnX = (sal_uLong)rEvent.x;
+ aEvent.mnY = (sal_uLong)rEvent.y;
aEvent.mnDelta = bNeg ? -120 : 120;
aEvent.mnNotchDelta = bNeg ? -1 : 1;
aEvent.mnScrollLines = nLines;
- aEvent.mnCode = GetMouseModCode( pEvent->state );
- aEvent.mbHorz = (pEvent->direction == GDK_SCROLL_LEFT || pEvent->direction == GDK_SCROLL_RIGHT);
+ aEvent.mnCode = GetMouseModCode( rEvent.state );
+ aEvent.mbHorz = (rEvent.direction == GDK_SCROLL_LEFT || rEvent.direction == GDK_SCROLL_RIGHT);
// --- RTL --- (mirror mouse pos)
if( AllSettings::GetLayoutRTL() )
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 93a3d0138c8d..f22e8ebcbaa7 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -801,6 +801,9 @@ void GtkSalFrame::InvalidateGraphics()
GtkSalFrame::~GtkSalFrame()
{
+ m_aSmoothScrollIdle.Stop();
+ m_aSmoothScrollIdle.SetIdleHdl(Link<Idle *, void>());
+
if (m_pDropTarget)
{
m_pDropTarget->deinitialize();
@@ -986,6 +989,8 @@ void GtkSalFrame::InitCommon()
m_aDamageHandler.handle = this;
m_aDamageHandler.damaged = ::damaged;
+ m_aSmoothScrollIdle.SetIdleHdl(LINK(this, GtkSalFrame, AsyncScroll));
+
m_pTopLevelGrid = GTK_GRID(gtk_grid_new());
gtk_container_add(GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pTopLevelGrid));
@@ -2649,59 +2654,107 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
return true;
}
-gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEventScroll* pEvent, gpointer frame)
+void GtkSalFrame::LaunchAsyncScroll(GdkEvent* pEvent)
{
- UpdateLastInputEventTime(pEvent->time);
+ //if we don't match previous pending states, flush that queue now
+ if (!m_aPendingScrollEvents.empty() && pEvent->scroll.state != m_aPendingScrollEvents.back()->scroll.state)
+ {
+ m_aSmoothScrollIdle.Stop();
+ m_aSmoothScrollIdle.Invoke();
+ assert(m_aPendingScrollEvents.empty());
+ }
+ //add scroll event to queue
+ m_aPendingScrollEvents.push_back(gdk_event_copy(pEvent));
+ if (!m_aSmoothScrollIdle.IsActive())
+ m_aSmoothScrollIdle.Start();
+}
- GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+IMPL_LINK_NOARG(GtkSalFrame, AsyncScroll, Idle *, void)
+{
+ assert(!m_aPendingScrollEvents.empty());
SalWheelMouseEvent aEvent;
- aEvent.mnTime = pEvent->time;
- aEvent.mnX = (sal_uLong)pEvent->x;
+ GdkEvent* pEvent = m_aPendingScrollEvents.back();
+
+ aEvent.mnTime = pEvent->scroll.time;
+ aEvent.mnX = (sal_uLong)pEvent->scroll.x;
// --- RTL --- (mirror mouse pos)
if (AllSettings::GetLayoutRTL())
- aEvent.mnX = pThis->maGeometry.nWidth - 1 - aEvent.mnX;
- aEvent.mnY = (sal_uLong)pEvent->y;
- aEvent.mnCode = GetMouseModCode( pEvent->state );
+ aEvent.mnX = maGeometry.nWidth - 1 - aEvent.mnX;
+ aEvent.mnY = (sal_uLong)pEvent->scroll.y;
+ aEvent.mnCode = GetMouseModCode( pEvent->scroll.state );
- switch (pEvent->direction)
+ double delta_x(0.0), delta_y(0.0);
+ for (auto pSubEvent : m_aPendingScrollEvents)
{
- case GDK_SCROLL_SMOOTH:
- // rhbz#1344042 "Traditionally" in gtk3 we tool a single up/down event as
- // equating to 3 scroll lines and a delta of 120. So scale the delta here
- // by 120 where a single mouse wheel click is an incoming delta_x of 1
- // and divide that by 40 to get the number of scrollines
- if (pEvent->delta_x != 0.0)
- {
- aEvent.mnDelta = -pEvent->delta_x * 120;
- aEvent.mnNotchDelta = aEvent.mnDelta < 0 ? -1 : +1;
- if (aEvent.mnDelta == 0)
- aEvent.mnDelta = aEvent.mnNotchDelta;
- aEvent.mbHorz = true;
- aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40;
- if (aEvent.mnScrollLines == 0)
- aEvent.mnScrollLines = 1;
-
- pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent);
- }
+ delta_x += pSubEvent->scroll.delta_x;
+ delta_y += pSubEvent->scroll.delta_y;
+ gdk_event_free(pSubEvent);
+ }
+ m_aPendingScrollEvents.clear();
- if (pEvent->delta_y != 0.0)
- {
- aEvent.mnDelta = -pEvent->delta_y * 120;
- aEvent.mnNotchDelta = aEvent.mnDelta < 0 ? -1 : +1;
- if (aEvent.mnDelta == 0)
- aEvent.mnDelta = aEvent.mnNotchDelta;
- aEvent.mbHorz = false;
- aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40;
- if (aEvent.mnScrollLines == 0)
- aEvent.mnScrollLines = 1;
-
- pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent);
- }
+ // rhbz#1344042 "Traditionally" in gtk3 we tool a single up/down event as
+ // equating to 3 scroll lines and a delta of 120. So scale the delta here
+ // by 120 where a single mouse wheel click is an incoming delta_x of 1
+ // and divide that by 40 to get the number of scroll lines
+ if (delta_x != 0.0)
+ {
+ aEvent.mnDelta = -delta_x * 120;
+ aEvent.mnNotchDelta = aEvent.mnDelta < 0 ? -1 : +1;
+ if (aEvent.mnDelta == 0)
+ aEvent.mnDelta = aEvent.mnNotchDelta;
+ aEvent.mbHorz = true;
+ aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40.0;
+ CallCallbackExc(SalEvent::WheelMouse, &aEvent);
+ }
- break;
+ if (delta_y != 0.0)
+ {
+ aEvent.mnDelta = -delta_y * 120;
+ aEvent.mnNotchDelta = aEvent.mnDelta < 0 ? -1 : +1;
+ if (aEvent.mnDelta == 0)
+ aEvent.mnDelta = aEvent.mnNotchDelta;
+ aEvent.mbHorz = false;
+ aEvent.mnScrollLines = std::abs(aEvent.mnDelta) / 40.0;
+ CallCallbackExc(SalEvent::WheelMouse, &aEvent);
+ }
+}
+gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEvent* pInEvent, gpointer frame)
+{
+ GdkEventScroll& rEvent = pInEvent->scroll;
+
+ UpdateLastInputEventTime(rEvent.time);
+
+ GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+
+ if (rEvent.direction == GDK_SCROLL_SMOOTH)
+ {
+ pThis->LaunchAsyncScroll(pInEvent);
+ return true;
+ }
+
+ //if we have smooth scrolling previous pending states, flush that queue now
+ if (!pThis->m_aPendingScrollEvents.empty())
+ {
+ pThis->m_aSmoothScrollIdle.Stop();
+ pThis->m_aSmoothScrollIdle.Invoke();
+ assert(pThis->m_aPendingScrollEvents.empty());
+ }
+
+ SalWheelMouseEvent aEvent;
+
+ aEvent.mnTime = rEvent.time;
+ aEvent.mnX = (sal_uLong)rEvent.x;
+ // --- RTL --- (mirror mouse pos)
+ if (AllSettings::GetLayoutRTL())
+ aEvent.mnX = pThis->maGeometry.nWidth - 1 - aEvent.mnX;
+ aEvent.mnY = (sal_uLong)rEvent.y;
+ aEvent.mnCode = GetMouseModCode(rEvent.state);
+
+ switch (rEvent.direction)
+ {
case GDK_SCROLL_UP:
aEvent.mnDelta = 120;
aEvent.mnNotchDelta = 1;
@@ -2733,6 +2786,8 @@ gboolean GtkSalFrame::signalScroll(GtkWidget*, GdkEventScroll* pEvent, gpointer
aEvent.mbHorz = true;
pThis->CallCallbackExc(SalEvent::WheelMouse, &aEvent);
break;
+ default:
+ break;
}
return true;
commit 00b4da9c833c7763f03b9b1de6e55760b0a2c234
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list