cui/uiconfig/ui/transparencytabpage.ui | 2 desktop/inc/app.hxx | 4 desktop/source/app/app.cxx | 2 desktop/source/app/cmdlineargs.cxx | 8 desktop/source/app/sofficemain.cxx | 2 desktop/unx/source/splashx.c | 3 distro-configs/LibreOfficeiOS.conf | 11 distro-configs/LibreOfficeiOS_Sim.conf | 32 ++ framework/source/fwe/helper/titlehelper.cxx | 4 include/vcl/opengl/OpenGLWrapper.hxx | 13 sc/source/core/data/table2.cxx | 2 sc/source/ui/unoobj/fmtuno.cxx | 2 scp2/source/ooo/module_hidden_ooo.scp | 2 sfx2/source/doc/guisaveas.cxx | 5 solenv/gbuild/gbuild.mk | 5 sw/inc/doc.hxx | 8 sw/qa/extras/odfimport/odfimport.cxx | 4 sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx |binary sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 27 ++ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 2 sw/source/core/doc/doc.cxx | 9 sw/source/core/doc/docnew.cxx | 1 sw/source/core/txtnode/txtedt.cxx | 18 + sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 30 +- vcl/headless/svpinst.cxx | 22 - vcl/inc/svsys.h | 4 vcl/source/control/listctrl.cxx | 10 vcl/source/edit/vclmedit.cxx | 8 vcl/source/salmain/salmain.cxx | 5 vcl/source/treelist/svimpbox.cxx | 11 writerfilter/source/dmapper/DomainMapper.cxx | 23 + xmlsecurity/Library_xsec_xmlsec.mk | 1 xmlsecurity/source/helper/documentsignaturemanager.cxx | 7 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 131 +++++++++- xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 56 ++-- xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 23 - xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx | 2 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx | 24 - 41 files changed, 383 insertions(+), 140 deletions(-)
New commits: commit 9fc3d2261ef9d2daccde96c1f18c30144985ea3e Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Jan 24 11:22:22 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:08:57 2019 +0200 tdf#86731 Don't show 'start from beginning' when dictionary is missing Change-Id: I160e4b15e3c636be0e23dd5bbb2da62dfa6a42ef diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 9f6863ae6e96..4761ee310f05 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -175,6 +175,8 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) SwWrtShell* pWrtShell = GetWrtShell_Impl(); if(pWrtShell) { + bool bNoDictionaryAvailable = pWrtShell->GetDoc()->IsDictionaryMissing(); + if (!bRecheck) { // first set continuation point for spell/grammar check to the @@ -379,7 +381,7 @@ The code below would only be part of the solution. OSL_ENSURE(m_pSpellState->m_bDrawingsSpelled && m_pSpellState->m_bOtherSpelled && m_pSpellState->m_bBodySpelled, "not all parts of the document are already spelled"); - if(m_pSpellState->m_xStartRange.is()) + if( m_pSpellState->m_xStartRange.is() && !bNoDictionaryAvailable ) { LockFocusNotification( true ); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), @@ -405,7 +407,6 @@ The code below would only be part of the solution. bCloseMessage = false; // no closing message if a wrap around has been denied } } - bool bNoDictionaryAvailable = pWrtShell->GetDoc()->IsDictionaryMissing(); if( aRet.empty() && bCloseMessage && !bNoDictionaryAvailable ) { LockFocusNotification( true ); commit 4bc934827d63d99ab34564aeb3c031cab9227ae1 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Jan 22 17:43:45 2019 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:05:09 2019 +0200 tdf#86731 Don't show 'spelling complete' when dictionary is missing To check if dictionary is missing we have to run spelling which checks used language for each text portion. When AutoSpelling or manually invoked Spelling is performed SwDoc receives notification about missing dictionaries. Then it is possible to not show 'Completed' dialog. Change-Id: I040ce6565632294796c0206d20c4cd0066ca9643 Reviewed-on: https://gerrit.libreoffice.org/66813 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> (cherry picked from commit 33f6848dc5abe71471b08dc6a8946feaa2d75ffc) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index ce2311c59c09..5afcea308e31 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -313,6 +313,9 @@ private: bool mbColumnSelection : 1; //< TRUE: this content has been created by a column selection (clipboard docs only) bool mbIsPrepareSelAll : 1; + enum MissingDictionary { False = -1, Undefined = 0, True = 1 }; + MissingDictionary meDictionaryMissing; + // true: Document contains at least one anchored object, which is anchored AT_PAGE with a content position. // Thus, certain adjustment needed during formatting for these kind of anchored objects. bool mbContainsAtPageObjWithContentAnchor : 1; @@ -1635,6 +1638,11 @@ public: */ bool StartGrammarChecking( bool bSkipStart = false ); + /// Use to notify if the dictionary can be found for a single content portion (has to be called for all portions) + void SetMissingDictionaries( bool bIsMissing ); + /// Returns true if no dictionary can be found for any content + bool IsDictionaryMissing() { return meDictionaryMissing == MissingDictionary::True; } + private: // Copies master header to left / first one, if necessary - used by ChgPageDesc(). void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d5c49b0515b6..2624f10880bb 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1825,4 +1825,13 @@ SwDoc::GetVbaEventProcessor() return mxVbaEvents; } +void SwDoc::SetMissingDictionaries( bool bIsMissing ) +{ + if( bIsMissing && meDictionaryMissing == MissingDictionary::Undefined ) + meDictionaryMissing = MissingDictionary::True; + else if( !bIsMissing ) + meDictionaryMissing = MissingDictionary::False; +}; + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index e48fd619d8e5..421d49bac9a3 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -274,6 +274,7 @@ SwDoc::SwDoc() mbClipBoard( false ), mbColumnSelection( false ), mbIsPrepareSelAll(false), + meDictionaryMissing( MissingDictionary::Undefined ), mbContainsAtPageObjWithContentAnchor(false), //#i119292#, fdo#37024 meDocType(DOCTYPE_NATIVE) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 41e288a74ec8..211ec9cd8a77 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -88,6 +88,22 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::linguistic2; using namespace ::com::sun::star::smarttags; +namespace +{ + void DetectAndMarkMissingDictionaries( SwDoc* pDoc, + const uno::Reference< XSpellChecker1 >& xSpell, + const LanguageType eActLang ) + { + if( !pDoc ) + return; + + if( xSpell.is() && !xSpell->hasLanguage( eActLang.get() ) ) + pDoc->SetMissingDictionaries( true ); + else + pDoc->SetMissingDictionaries( false ); + } +} + struct SwParaIdleData_Impl { SwWrongList* pWrong; // for spell checking @@ -1054,6 +1070,7 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs) // get next language for next word, consider language attributes // within the word LanguageType eActLang = aScanner.GetCurrentLanguage(); + DetectAndMarkMissingDictionaries( GetTextNode()->GetDoc(), pArgs->xSpeller, eActLang ); if( rWord.getLength() > 0 && LANGUAGE_NONE != eActLang ) { @@ -1360,6 +1377,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos) // get next language for next word, consider language attributes // within the word LanguageType eActLang = aScanner.GetCurrentLanguage(); + DetectAndMarkMissingDictionaries( pDoc, xSpell, eActLang ); bool bSpell = xSpell.is() && xSpell->hasLanguage( static_cast<sal_uInt16>(eActLang) ); if( bSpell && !rWord.isEmpty() ) diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 20a658499103..9f6863ae6e96 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -405,20 +405,21 @@ The code below would only be part of the solution. bCloseMessage = false; // no closing message if a wrap around has been denied } } - if(aRet.empty()) + bool bNoDictionaryAvailable = pWrtShell->GetDoc()->IsDictionaryMissing(); + if( aRet.empty() && bCloseMessage && !bNoDictionaryAvailable ) { - if(bCloseMessage) - { - LockFocusNotification( true ); - OUString sInfo(SwResId(STR_SPELLING_COMPLETED)); - // #i84610# - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), - VclMessageType::Info, VclButtonsType::Ok, sInfo)); - xBox->run(); - LockFocusNotification( false ); - // take care that the now valid selection is stored - LoseFocus(); - } + LockFocusNotification( true ); + OUString sInfo( SwResId( STR_SPELLING_COMPLETED ) ); + // #i84610# + std::unique_ptr<weld::MessageDialog> xBox( + Application::CreateMessageDialog( GetWindow()->GetFrameWeld(), + VclMessageType::Info, + VclButtonsType::Ok, + sInfo ) ); + xBox->run(); + LockFocusNotification( false ); + // take care that the now valid selection is stored + LoseFocus(); } } return aRet; commit 0a5e7464cf94a9a2cd55439a66f97cc7333e959c Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Apr 16 14:14:03 2019 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:04:33 2019 +0200 tdf#123636 writerfilter: handle deferred breaks on frames and... related tdf#123636 writerfilter: split newline also if PAGE_BREAK ...but only with old MSWord compat flag SplitPgBreakAndParaMark. All of the other cases (COLUMN_BREAK and non-empty runs) split the paragraph, so why not here? This document shows it is needed, but only for SplitPgBreakAndParaMark documents. Note: Word 2003 doesn't display "modern" docx well in this regard. It adds extra paragraphs where it shouldn't. There are already example unit tests that ensure that extra paragraphs aren't written for SplitPgBreakAndParaMark == false. The actual bug's document is not related to the compatibility flag. That will be handled in separate commit. Reviewed-on: https://gerrit.libreoffice.org/70835 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> (cherry picked from commit 89e44da1ab450f6e2f4106103efd169227683f20) tdf#123636 writerfilter: handle deferred breaks on frames ...similar to handling breaks before shapes in lcl_startShape. Three different examples found to create/split a paragraph. Which one to use? (addDummy, m_bIsSplitPara, and lcl_startCharacterGroup). SplitPara is not good because the paragraph properties probably should not be copied to the dummy paragraph (like numbering for example). Slightly modified the lcl_startChar example to ensure that the dummy paragraph doesn't steal a part of the properties, but is only default properties plus page-break. This doesn't export very well, so roundtripping is very poor. Research Note: There exists a compat flag showBreaksInFrames (Display Page/Column Breaks Present in Frames) "This element specifies whether applications should honor the presence of page and/or column breaks which are present within the contents of paragraphs which have been defined as frames using the framePr element." --Currently, LO does nothing with this flag. Probably too exotic and irrelevant (word 2003 era?). No existing unit tests found that have isSet(pg_brk) frames. Reviewed-on: https://gerrit.libreoffice.org/71255 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit f6f53f76e15f5eecc5b6ce56e471c53cebfea8ad) Change-Id: I29f815355401c7af8b347a3ed9d0298bc9b27b93 diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx new file mode 100644 index 000000000000..6f7b4b144547 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx new file mode 100644 index 000000000000..a876bea84e02 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak2.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx new file mode 100644 index 000000000000..1bcc335fdc59 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak3.docx differ diff --git a/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx new file mode 100644 index 000000000000..3a9d86ee21e2 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123636_newlinePageBreak4.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 8a82f0f04d38..87019efcec3d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -962,6 +962,33 @@ DECLARE_OOXMLEXPORT_TEST(testInputListExport, "tdf122186_input_list.odt") assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 0); } +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak, "tdf123636_newlinePageBreak.docx") +{ + //MS Compatibility flag: SplitPgBreakAndParaMark + //special case: split first empty paragraph in a section. + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak2, "tdf123636_newlinePageBreak2.docx") +{ + //WITHOUT SplitPgBreakAndParaMark: a following anchored shape should force a page break + //CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 2, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(2, ""), "NumberingStyleName")); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf123636_newlinePageBreak4, "tdf123636_newlinePageBreak4.docx") +{ + //MS Compatibility flag: SplitPgBreakAndParaMark + //special case: an empty paragraph doesn't split (except if first paragraph). + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Paragraphs", 3, getParagraphs() ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); + + xmlDocPtr pDump = parseLayoutDump(); + assertXPath(pDump, "/root/page[2]/body/txt[1]/Text", 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 097048febe40..5b4e7c99e67b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -938,6 +938,8 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx") sal_Int32 nX = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent", "cx").toInt32(); // This was negative. CPPUNIT_ASSERT(nX >= 0); + + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 2, getPages() ); } // part of tdf#93676, word gives the frame in the exported .docx a huge height, diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e408b74df7e0..9381a5fb8682 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1965,6 +1965,22 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); if( pContext.get() ) { + // If there is a deferred page break applied to this framed paragraph, + // create a dummy paragraph without extra properties, + // so that the anchored frame will be on the correct page (similar to shapes). + if (pContext->isSet(PROP_BREAK_TYPE)) + { + pContext->Erase(PROP_BREAK_TYPE); + + lcl_startParagraphGroup(); + m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); + lcl_startCharacterGroup(); + sal_uInt8 const sBreak[] = { 0xd }; + lcl_text(sBreak, 1); + lcl_endCharacterGroup(); + lcl_endParagraphGroup(); + } + ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() ); if (pParaContext) pParaContext->SetFrameMode(); @@ -3273,6 +3289,13 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { if (m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark()) { + if ( m_pImpl->GetIsFirstParagraphInSection() || !m_pImpl->IsFirstRun() ) + { + m_pImpl->m_bIsSplitPara = true; + m_pImpl->finishParagraph( m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) ); + lcl_startParagraphGroup(); + } + pContext->Insert(PROP_BREAK_TYPE, uno::makeAny(style::BreakType_PAGE_BEFORE)); m_pImpl->clearDeferredBreaks(); } commit 7167630618c559e8bed9215a1e75c55b429de1ea Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Jun 15 15:44:33 2019 +0900 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:03:59 2019 +0200 tdf#124907 vcl: react to pan gesture for listbox and other widgets Change-Id: I4579f8edd2bf24506b1d55a7291cd86e276f30a4 Reviewed-on: https://gerrit.libreoffice.org/74087 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/control/listctrl.cxx b/vcl/source/control/listctrl.cxx index d861dca20b31..2e44e2ae396d 100644 --- a/vcl/source/control/listctrl.cxx +++ b/vcl/source/control/listctrl.cxx @@ -159,9 +159,15 @@ bool ListControl::EventNotify( NotifyEvent& rNEvt ) if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) { const CommandEvent* pEvent = rNEvt.GetCommandEvent(); - if (pEvent && pEvent->GetCommand() == CommandEventId::Wheel) + if (pEvent) { - HandleScrollCommand(*pEvent, nullptr, mpScrollBar.get()); + CommandEventId nCommand = pEvent->GetCommand(); + + if (nCommand == CommandEventId::Wheel || + nCommand == CommandEventId::Gesture) + { + HandleScrollCommand(*pEvent, nullptr, mpScrollBar.get()); + } } } return true; diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 10c6f20c0bb9..7ba7ee3c056f 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -649,9 +649,11 @@ void ImpVclMEdit::Enable( bool bEnable ) bool ImpVclMEdit::HandleCommand( const CommandEvent& rCEvt ) { bool bDone = false; - if ( ( rCEvt.GetCommand() == CommandEventId::Wheel ) || - ( rCEvt.GetCommand() == CommandEventId::StartAutoScroll ) || - ( rCEvt.GetCommand() == CommandEventId::AutoScroll ) ) + CommandEventId nCommand = rCEvt.GetCommand(); + if (nCommand == CommandEventId::Wheel || + nCommand == CommandEventId::StartAutoScroll || + nCommand == CommandEventId::AutoScroll || + nCommand == CommandEventId::Gesture) { (void)mpTextWindow->HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar ); bDone = true; diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 6ba41bbf0823..8ea15fec4b12 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -2890,15 +2890,20 @@ void SvImpLBox::PaintDDCursor(SvTreeListEntry* pEntry, bool bShow) void SvImpLBox::Command( const CommandEvent& rCEvt ) { - CommandEventId nCommand = rCEvt.GetCommand(); + CommandEventId nCommand = rCEvt.GetCommand(); if( nCommand == CommandEventId::ContextMenu ) aEditIdle.Stop(); // scroll mouse event? - if( ( ( nCommand == CommandEventId::Wheel ) || ( nCommand == CommandEventId::StartAutoScroll ) || ( nCommand == CommandEventId::AutoScroll ) ) - && pView->HandleScrollCommand( rCEvt, aHorSBar.get(), aVerSBar.get() ) ) + if (nCommand == CommandEventId::Wheel || + nCommand == CommandEventId::StartAutoScroll || + nCommand == CommandEventId::AutoScroll || + nCommand == CommandEventId::Gesture) + { + if (pView->HandleScrollCommand(rCEvt, aHorSBar.get(), aVerSBar.get())) return; + } if( bContextMenuHandling && nCommand == CommandEventId::ContextMenu ) { commit 0976d3b966186422c1051c8513d4caaec8968826 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Wed Sep 18 11:48:13 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:03:25 2019 +0200 Replace remaining occurrences of LIBO_HEADLESS with HAVE_FEATURE_UI Change-Id: Ie2b04ee443dece851d3d96afbc932aa64369c75c Reviewed-on: https://gerrit.libreoffice.org/79084 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 01224c68ffeb..8a1ca8a36bb2 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_DESKTOP_INC_APP_HXX #define INCLUDED_DESKTOP_INC_APP_HXX +#include <config_features.h> + #include <boost/optional.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <sal/log.hxx> @@ -181,7 +183,7 @@ OUString ReplaceStringHookProc(const OUString& rStr); } -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI bool fire_glxtest_process(); void reap_glxtest_process(); #endif diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0fd6ebe187ec..59d6a0db378f 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1596,7 +1596,7 @@ int Desktop::Main() // In headless mode, reap the process started by fire_glxtest_process() early in soffice_main // (desktop/source/app/sofficemain.cxx), in a code block that needs to be covered by the same // #if condition as this code block: -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) && HAVE_FEATURE_OPENGL +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && HAVE_FEATURE_OPENGL if (rCmdLineArgs.IsHeadless()) { reap_glxtest_process(); } diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 30d0c3f4cced..381147cd534e 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -695,12 +695,12 @@ void CommandLineArgs::InitParamValues() { m_minimized = false; m_norestore = false; -#ifdef LIBO_HEADLESS - m_invisible = true; - m_headless = true; -#else +#if HAVE_FEATURE_UI m_invisible = false; m_headless = false; +#else + m_invisible = true; + m_headless = true; #endif m_eventtesting = false; m_quickstart = false; diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 372598abdb9d..d4a212ee0876 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -121,7 +121,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() #endif #endif -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) && HAVE_FEATURE_OPENGL +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && HAVE_FEATURE_OPENGL /* Run test for OpenGL support in own process to avoid crash with broken * OpenGL drivers. Start process as early as possible. * In non-headless mode, the process will be reaped in X11OpenGLDeviceInfo::GetData diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c index e03fc094abcb..ed88f8b16fd4 100644 --- a/desktop/unx/source/splashx.c +++ b/desktop/unx/source/splashx.c @@ -7,9 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <config_features.h> #include "splashx.h" -#if defined(ENABLE_QUICKSTART_LIBPNG) && !defined(LIBO_HEADLESS) +#if defined(ENABLE_QUICKSTART_LIBPNG) && HAVE_FEATURE_UI #include <X11/Xlib.h> #include <X11/Xatom.h> diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 36141cfba0f1..cab7be43d50d 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_features.h> + #include <framework/titlehelper.hxx> #include <classes/fwkresid.hxx> #include <strings.hrc> @@ -577,7 +579,7 @@ void TitleHelper::impl_appendDebugVersion (OUStringBuffer& sTitle) OUString sVersion = ::utl::Bootstrap::getBuildIdData("development"); sTitle.append(" ["); sTitle.append(sVersion); -#ifndef LIBO_HEADLESS +#if HAVE_FEATURE_UI if (OpenGLWrapper::isVCLOpenGLEnabled()) sTitle.append("-GL"); #endif diff --git a/include/vcl/opengl/OpenGLWrapper.hxx b/include/vcl/opengl/OpenGLWrapper.hxx index 9c61a11c2a48..c84286ea5244 100644 --- a/include/vcl/opengl/OpenGLWrapper.hxx +++ b/include/vcl/opengl/OpenGLWrapper.hxx @@ -12,6 +12,7 @@ #ifndef INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX #define INCLUDED_VCL_OPENGL_OPENGLWRAPPER_HXX +#include <config_features.h> #include <vcl/dllapi.h> // All member functions static and VCL_DLLPUBLIC. Basically a glorified namespace. @@ -22,18 +23,18 @@ struct VCL_DLLPUBLIC OpenGLWrapper /** * Returns true if VCL has OpenGL rendering enabled */ -#ifdef LIBO_HEADLESS - static bool isVCLOpenGLEnabled() - { - return false; - } -#else +#if HAVE_FEATURE_UI static bool isVCLOpenGLEnabled(); /** * Returns the number of times OpenGL buffers have been swapped. */ static sal_Int64 getBufferSwapCounter(); +#else + static bool isVCLOpenGLEnabled() + { + return false; + } #endif }; diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index cff32e16930d..904cea2420bd 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -75,7 +75,6 @@ End #endif #endif -#ifndef LIBO_HEADLESS Module gid_Module_Root_Files_Images PackageInfo = "packinfo_office.txt"; ParentID = gid_Module_Root; @@ -87,7 +86,6 @@ Module gid_Module_Root_Files_Images Styles = (HIDDEN_ROOT); Files = (auto_ooo_images_ALL); End -#endif #ifndef WITHOUT_FONTS Module gid_Module_Root_Fonts_OOo_Hidden diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 0aee4f84776d..1a20050b651e 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -228,11 +228,6 @@ gb_GLOBALDEFS += -DDEBUG \ endif endif -ifeq ($(DISABLE_GUI),TRUE) -gb_GLOBALDEFS += -DLIBO_HEADLESS \ - -endif - gb_GLOBALDEFS += \ $(call gb_Helper_define_if_set,\ DISABLE_DYNLOADING \ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 4df20d9e42a8..38185017ecda 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <config_features.h> + #include <swmodeltestbase.hxx> #include <com/sun/star/awt/FontWeight.hpp> @@ -611,7 +613,7 @@ DECLARE_ODFIMPORT_TEST(testFdo37606Copy, "fdo37606.odt") // Previously copy&paste failed to copy the table in case it was the document-starting one. uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); -#if !defined(MACOSX) && !defined(LIBO_HEADLESS) // FIXME +#if !defined(MACOSX) && HAVE_FEATURE_UI CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); #endif } diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 22ec77ec8c7f..80223ac58904 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_features.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> @@ -29,7 +30,7 @@ #include <vcl/inputtypes.hxx> #include <vcl/lok.hxx> -#ifndef LIBO_HEADLESS +#if HAVE_FEATURE_UI # include <vcl/opengl/OpenGLContext.hxx> #endif @@ -548,32 +549,33 @@ void SvpSalInstance::AddToRecentDocumentList(const OUString&, const OUString&, c //obviously doesn't actually do anything, it's just a nonfunctional stub -#ifdef LIBO_HEADLESS +#if HAVE_FEATURE_UI -class SvpOpenGLContext +class SvpOpenGLContext : public OpenGLContext { + GLWindow m_aGLWin; +private: + virtual const GLWindow& getOpenGLWindow() const override { return m_aGLWin; } + virtual GLWindow& getModifiableOpenGLWindow() override { return m_aGLWin; } }; OpenGLContext* SvpSalInstance::CreateOpenGLContext() { - return nullptr; + return new SvpOpenGLContext; } #else -class SvpOpenGLContext : public OpenGLContext +class SvpOpenGLContext { - GLWindow m_aGLWin; -private: - virtual const GLWindow& getOpenGLWindow() const override { return m_aGLWin; } - virtual GLWindow& getModifiableOpenGLWindow() override { return m_aGLWin; } }; OpenGLContext* SvpSalInstance::CreateOpenGLContext() { - return new SvpOpenGLContext; + return nullptr; } + #endif SvpSalTimer::~SvpSalTimer() diff --git a/vcl/inc/svsys.h b/vcl/inc/svsys.h index 8c283f221e11..d86985669e80 100644 --- a/vcl/inc/svsys.h +++ b/vcl/inc/svsys.h @@ -20,6 +20,8 @@ #ifndef INCLUDED_VCL_INC_SVSYS_H #define INCLUDED_VCL_INC_SVSYS_H +#include <config_features.h> + #ifdef _WIN32 #include "win/svsys.h" #elif defined MACOSX @@ -29,7 +31,7 @@ #elif defined ANDROID #include "android/svsys.h" #elif defined HAIKU -#elif defined LIBO_HEADLESS +#elif !HAVE_FEATURE_UI #else #include "unx/svsys.h" #endif diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx index b2b45a89e934..95f23eebde5f 100644 --- a/vcl/source/salmain/salmain.cxx +++ b/vcl/source/salmain/salmain.cxx @@ -18,6 +18,7 @@ */ #include <sal/config.h> +#include <config_features.h> #include <cstdlib> @@ -28,12 +29,12 @@ #include <salinst.hxx> -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS && !defined HAIKU +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && !defined HAIKU #include <opengl/x11/glxtest.hxx> #endif SAL_IMPLEMENT_MAIN() { -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS && !defined HAIKU +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && HAVE_FEATURE_UI && !defined HAIKU fire_glxtest_process(); #endif tools::extendApplicationEnvironment(); commit 102f3e37a9439c6eba4f990576019eb7110fecdc Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Sun Jul 28 05:51:40 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:02:42 2019 +0200 tdf#125800: accessing cond format props in UNO throws error These conditions were always evaluated to true: OR should become AND when negated. Regression from 8c637b47d9de4b3a64c33a9c2ffe7ed220be2467 Change-Id: I87038319ed27eff2bed2412da49e01f73ec0a79c Reviewed-on: https://gerrit.libreoffice.org/76493 Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> (cherry picked from commit 9ad8f83912e6cf14d7b3b3e1cb2a79d819247c82) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index f7ff62260b05..524dfe220190 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2185,7 +2185,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC for (size_t nEntry=0; nEntry<nEntryCount; nEntry++) { const ScFormatEntry* pEntry = pFormat->GetEntry(nEntry); - if(pEntry->GetType() != ScFormatEntry::Type::Condition || + if(pEntry->GetType() != ScFormatEntry::Type::Condition && pEntry->GetType() != ScFormatEntry::Type::ExtCondition) continue; diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 40af3ba2d59b..f311c65dd59a 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -162,7 +162,7 @@ ScTableConditionalFormat::ScTableConditionalFormat( { ScCondFormatEntryItem aItem; const ScFormatEntry* pFrmtEntry = pFormat->GetEntry(i); - if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition || + if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition && pFrmtEntry->GetType() != ScFormatEntry::Type::ExtCondition) continue; commit 1444e5b1e97584d66d8a565b3f443ff98f27c6b5 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Mar 20 20:54:31 2019 +0900 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:02:08 2019 +0200 tdf#124153 fix cut-off radio button Change-Id: I8e07a8c49a9dc47cb8b75b61450125d449a45d1e Reviewed-on: https://gerrit.libreoffice.org/69467 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> (cherry picked from commit 7aaa82b21af0bc212e572f1e1d931fb80b1e3e75) diff --git a/cui/uiconfig/ui/transparencytabpage.ui b/cui/uiconfig/ui/transparencytabpage.ui index c039f27e2987..63a1d5b40cc4 100644 --- a/cui/uiconfig/ui/transparencytabpage.ui +++ b/cui/uiconfig/ui/transparencytabpage.ui @@ -80,7 +80,6 @@ <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> - <property name="image_position">bottom</property> <property name="active">True</property> <property name="draw_indicator">True</property> </object> @@ -97,7 +96,6 @@ <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="xalign">0</property> - <property name="image_position">right</property> <property name="draw_indicator">True</property> <property name="group">RBT_TRANS_OFF</property> <accessibility> commit 79eed26585da88acb076fe9b270a890ac0fb957e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jun 3 14:42:44 2019 +0900 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:01:32 2019 +0200 Add distro config for iOS simulator to make building easier Change-Id: Iff70622732792224b3c0a080f95d69f86c167ae6 Reviewed-on: https://gerrit.libreoffice.org/73370 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit b4653db6504a7e12203d5defeea536a0decf76d8) diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf index 92bc968a9f76..fef1a33eac4b 100644 --- a/distro-configs/LibreOfficeiOS.conf +++ b/distro-configs/LibreOfficeiOS.conf @@ -27,15 +27,6 @@ --without-tls -# iOS simulator (debug) -#--enable-ios-simulator -#--enable-debug - -# iOS Device (debug) -#--enable-ios-simulator -#--enable-debug -#--host=arm64-apple-darwin - -# iOS Device (release) +# iOS device --host=arm64-apple-darwin diff --git a/distro-configs/LibreOfficeiOS_Sim.conf b/distro-configs/LibreOfficeiOS_Sim.conf new file mode 100644 index 000000000000..146be2bd3bcc --- /dev/null +++ b/distro-configs/LibreOfficeiOS_Sim.conf @@ -0,0 +1,32 @@ +--disable-breakpad +--disable-firebird-sdbc +--disable-online-update + +--without-export-validation +--without-helppack-integration +--without-java +--without-junit + +--with-theme=colibre tango + +--with-build-platform-configure-options=--with-system-jpeg=no +--with-macosx-version-min-required=10.11 + +--disable-avahi +--disable-avmedia +--disable-compiler-plugins +--disable-cups +--disable-database-connectivity +--disable-dconf +--disable-extensions +--disable-kde5 +--disable-odk +--disable-openssl +--disable-pdfium +--disable-python + +--without-tls + +# iOS simulator (debug) +--enable-ios-simulator +--enable-debug commit 3787e1b78299ee88a17c242d0b30181286a753c4 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Dec 31 12:14:19 2018 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:00:58 2019 +0200 NSS: create a temporary database instead of in-memory When initializing for the in-memory database (NSS_NoDB_Init) the internal slot is read-only so a lot of actions (PK11_ImportCert) fails. Instead of that we create a new cert/key database inside the tmp directory and delete it on exit. This way there are no limitations and all the actions perform as expected. Change-Id: Iadec5dd8f3459be56ba57d077057eacf3e0797fc Reviewed-on: https://gerrit.libreoffice.org/65765 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 87eec1b90b6ecd83455f09168430c23f73c25c86) diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk index 8efb4911fbbb..1ddbb712b957 100644 --- a/xmlsecurity/Library_xsec_xmlsec.mk +++ b/xmlsecurity/Library_xsec_xmlsec.mk @@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_libraries,xsec_xmlsec,\ svl \ tl \ xo \ + utl \ )) ifeq ($(SYSTEM_XMLSEC),) diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 5d33268f741d..534c5bd7fc5c 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -32,6 +32,8 @@ #include <osl/file.hxx> #include <osl/thread.h> #include <sal/log.hxx> +#include <unotools/tempfile.hxx> +#include <salhelper/singletonref.hxx> #include "seinitializer_nssimpl.hxx" @@ -40,6 +42,7 @@ #include "ciphercontext.hxx" #include <memory> +#include <vector> #include <nspr.h> #include <cert.h> @@ -64,6 +67,97 @@ static void nsscrypto_finalize(); namespace { +class InitNSSPrivate +{ +private: + std::unique_ptr<utl::TempFile> m_pTempFileDatabaseDirectory; + + static void scanDirsAndFiles(OUString const & rDirURL, std::vector<OUString> & rDirs, std::vector<OUString> & rFiles) + { + if (rDirURL.isEmpty()) + return; + osl::Directory aDirectory(rDirURL); + + if (osl::FileBase::E_None != aDirectory.open()) + return; + + osl::DirectoryItem aDirectoryItem; + + while (osl::FileBase::E_None == aDirectory.getNextItem(aDirectoryItem)) + { + osl::FileStatus aFileStatus(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName); + + if (osl::FileBase::E_None == aDirectoryItem.getFileStatus(aFileStatus)) + { + if (aFileStatus.isDirectory()) + { + const OUString aFileName(aFileStatus.getFileName()); + if (!aFileName.isEmpty()) + rDirs.push_back(aFileName); + } + else if (aFileStatus.isRegular()) + { + const OUString aFileName(aFileStatus.getFileName()); + if (!aFileName.isEmpty()) + rFiles.push_back(aFileName); + + } + } + } + } + + static bool deleteDirRecursively(OUString const & rDirURL) + { + std::vector<OUString> aDirs; + std::vector<OUString> aFiles; + bool bError(false); + + scanDirsAndFiles(rDirURL, aDirs, aFiles); + + for (const auto& sDir : aDirs) + { + const OUString aNewDirURL(rDirURL + "/" + sDir); + bError |= deleteDirRecursively(aNewDirURL); + } + + for (const auto& sFile : aFiles) + { + OUString aNewFileURL(rDirURL + "/" + sFile); + bError |= (osl::FileBase::E_None != osl::File::remove(aNewFileURL)); + } + + bError |= (osl::FileBase::E_None != osl::Directory::remove(rDirURL)); + + return bError; + } + +public: + OUString getTempDatabasePath() + { + if (!m_pTempFileDatabaseDirectory) + { + m_pTempFileDatabaseDirectory.reset(new utl::TempFile(nullptr, true)); + m_pTempFileDatabaseDirectory->EnableKillingFile(); + } + return m_pTempFileDatabaseDirectory->GetFileName(); + } + + void reset() + { + if (m_pTempFileDatabaseDirectory) + { + deleteDirRecursively(m_pTempFileDatabaseDirectory->GetURL()); + m_pTempFileDatabaseDirectory.reset(); + } + } +}; + +salhelper::SingletonRef<InitNSSPrivate>* getInitNSSPrivate() +{ + static salhelper::SingletonRef<InitNSSPrivate> aInitNSSPrivate; + return &aInitNSSPrivate; +} + bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init ); struct InitNSSInitialize @@ -230,7 +324,7 @@ OString getMozillaCurrentProfile( const css::uno::Reference< css::uno::XComponen //return true - whole initialization was successful //param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite //was successful and therefore NSS_Shutdown should be called when terminating. -bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init ) +bool nsscrypto_initialize(css::uno::Reference<css::uno::XComponentContext> const & rxContext, bool & out_nss_init) { // this method must be called only once, no need for additional lock OString sCertDir; @@ -244,9 +338,9 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ; - bool bSuccess = true; + bool bSuccess = false; // there might be no profile - if ( !sCertDir.isEmpty() ) + if (!sCertDir.isEmpty()) { if (sCertDir.indexOf(':') == -1) //might be env var with explicit prefix { @@ -262,26 +356,31 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex sCertDir = "dbm:" + sCertDir; } } - if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess ) + if (NSS_InitReadWrite(sCertDir.getStr()) != SECSuccess) { SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with profile failed."); int errlen = PR_GetErrorTextLength(); - if(errlen > 0) + if (errlen > 0) { std::unique_ptr<char[]> const error(new char[errlen + 1]); PR_GetErrorText(error.get()); SAL_INFO("xmlsecurity.xmlsec", error.get()); } - bSuccess = false; + } + else + { + bSuccess = true; } } - if( sCertDir.isEmpty() || !bSuccess ) + if (!bSuccess) // Try to create a database in temp dir { - SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS without profile."); - if ( NSS_NoDB_Init(nullptr) != SECSuccess ) + SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with a temporary profile."); + OUString rString = (*getInitNSSPrivate())->getTempDatabasePath(); + + if (NSS_InitReadWrite(rString.toUtf8().getStr()) != SECSuccess) { - SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS without profile failed."); + SAL_INFO("xmlsecurity.xmlsec", "Initializing NSS with a temporary profile."); int errlen = PR_GetErrorTextLength(); if(errlen > 0) { @@ -289,7 +388,15 @@ bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContex PR_GetErrorText(error.get()); SAL_INFO("xmlsecurity.xmlsec", error.get()); } - return false ; + return false; + } + // Initialize and set empty password if needed + PK11SlotInfo* pSlot = PK11_GetInternalKeySlot(); + if (pSlot) + { + if (PK11_NeedUserInit(pSlot)) + PK11_InitPin(pSlot, nullptr, nullptr); + PK11_FreeSlot(pSlot); } } out_nss_init = true; @@ -383,6 +490,8 @@ extern "C" void nsscrypto_finalize() } PK11_LogoutAll(); (void)NSS_Shutdown(); + + (*getInitNSSPrivate())->reset(); } ONSSInitializer::ONSSInitializer( diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 0da6276551af..b19ec766b5db 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -42,6 +42,7 @@ #include <comphelper/sequence.hxx> #include "secerror.hxx" +#include <prerror.h> // added for password exception #include <com/sun/star/security/NoPasswordException.hpp> @@ -442,15 +443,34 @@ X509Certificate_NssImpl* SecurityEnvironment_NssImpl::createAndAddCertificateFro if (!pCERTCertificate) return nullptr; - OString aTrustString = OUStringToOString(raString, RTL_TEXTENCODING_ASCII_US); + SECStatus aStatus; + OString aTrustString = OUStringToOString(raString, RTL_TEXTENCODING_ASCII_US); CERTCertTrust aTrust; - if (CERT_DecodeTrustString(&aTrust, aTrustString.getStr()) != SECSuccess) + + aStatus = CERT_DecodeTrustString(&aTrust, aTrustString.getStr()); + + if (aStatus != SECSuccess) + return nullptr; + + PK11SlotInfo* pSlot = PK11_GetInternalKeySlot(); + + if (!pSlot) return nullptr; - if (CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), pCERTCertificate, &aTrust) != SECSuccess) + aStatus = PK11_ImportCert(pSlot, pCERTCertificate, CK_INVALID_HANDLE, nullptr, PR_FALSE); + + if (aStatus != SECSuccess) return nullptr; + aStatus = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), pCERTCertificate, &aTrust); + + if (aStatus != SECSuccess) + return nullptr; + + + PK11_FreeSlot(pSlot); + X509Certificate_NssImpl* pX509Certificate = new X509Certificate_NssImpl(); pX509Certificate->setCert(pCERTCertificate); return pX509Certificate; @@ -840,12 +860,10 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() { // Adopt the private key of the signing certificate, if it has any. if (auto pCertificate = dynamic_cast<X509Certificate_NssImpl*>(m_xSigningCertificate.get())) { - SECKEYPrivateKey* pPrivateKey = pCertificate->getPrivateKey(); - SECKEYPrivateKey* copy - = pPrivateKey == nullptr ? nullptr : SECKEY_CopyPrivateKey(pPrivateKey); - if (copy) + SECKEYPrivateKey* pPrivateKey = SECKEY_CopyPrivateKey(pCertificate->getPrivateKey()); + if (pPrivateKey) { - xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(copy, nullptr); + xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(pPrivateKey, nullptr); xmlSecKeyPtr pKey = xmlSecKeyCreate(); xmlSecKeySetValue(pKey, pKeyData); xmlSecNssAppDefaultKeysMngrAdoptKey(pKeysMngr, pKey); @@ -872,42 +890,40 @@ SECKEYPrivateKey* SecurityEnvironment_NssImpl::insertPrivateKey(css::uno::Sequen if (!pSlot) return nullptr; - SECItem pDerPrivateKeyInfo; - pDerPrivateKeyInfo.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(raPrivateKey.getConstArray())); - pDerPrivateKeyInfo.len = raPrivateKey.getLength(); + SECItem aDerPrivateKeyInfo; + aDerPrivateKeyInfo.data = reinterpret_cast<unsigned char *>(const_cast<sal_Int8 *>(raPrivateKey.getConstArray())); + aDerPrivateKeyInfo.len = raPrivateKey.getLength(); - const unsigned int aKeyUsage = KU_KEY_ENCIPHERMENT | KU_DATA_ENCIPHERMENT | KU_DIGITAL_SIGNATURE; + const unsigned int aKeyUsage = KU_ALL; SECKEYPrivateKey* pPrivateKey = nullptr; - bool bPermanent = false; - bool bSensitive = false; + bool bPermanent = PR_FALSE; + bool bPrivate = PR_TRUE; SECStatus nStatus = PK11_ImportDERPrivateKeyInfoAndReturnKey( - pSlot, &pDerPrivateKeyInfo, nullptr, nullptr, bPermanent, bSensitive, + pSlot, &aDerPrivateKeyInfo, nullptr, nullptr, bPermanent, bPrivate, aKeyUsage, &pPrivateKey, nullptr); if (nStatus != SECSuccess) return nullptr; + PK11_FreeSlot(pSlot); + return pPrivateKey; } uno::Reference<security::XCertificate> SecurityEnvironment_NssImpl::createDERCertificateWithPrivateKey( Sequence<sal_Int8> const & raDERCertificate, Sequence<sal_Int8> const & raPrivateKey) { - SECKEYPrivateKey* pPrivateKey = insertPrivateKey(raPrivateKey); if (!pPrivateKey) return uno::Reference<security::XCertificate>(); - X509Certificate_NssImpl* pX509Certificate = createAndAddCertificateFromPackage(raDERCertificate, "TCu,Cu,Tu"); - + X509Certificate_NssImpl* pX509Certificate = createAndAddCertificateFromPackage(raDERCertificate, "TCu,TCu,TCu"); if (!pX509Certificate) return uno::Reference<security::XCertificate>(); - pX509Certificate->setCustomPrivateKey(pPrivateKey); - return pX509Certificate; } diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 35a3e841e6f4..180ef6558d38 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -46,8 +46,7 @@ using ::com::sun::star::security::XCertificate ; using ::com::sun::star::util::DateTime ; X509Certificate_NssImpl::X509Certificate_NssImpl() : - m_pCert(nullptr), - m_pPrivateKey(nullptr) + m_pCert(nullptr) { } @@ -332,25 +331,13 @@ void X509Certificate_NssImpl::setRawCert( const Sequence< sal_Int8 >& rawCert ) m_pCert = cert ; } -void X509Certificate_NssImpl::setCustomPrivateKey(SECKEYPrivateKey* pPrivateKey) -{ - m_pPrivateKey = pPrivateKey; -} - SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey() { - if (m_pPrivateKey) - { - return m_pPrivateKey; - } - else + if (m_pCert && m_pCert->slot) { - if (m_pCert && m_pCert->slot) - { - SECKEYPrivateKey* pPrivateKey = PK11_FindPrivateKeyFromCert(m_pCert->slot, m_pCert, nullptr); - if (pPrivateKey) - return pPrivateKey; - } + SECKEYPrivateKey* pPrivateKey = PK11_FindPrivateKeyFromCert(m_pCert->slot, m_pCert, nullptr); + if (pPrivateKey) + return pPrivateKey; } return nullptr; } diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx index 64c76972bf83..cae1f7238739 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx @@ -41,7 +41,6 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper< { private: CERTCertificate* m_pCert; - SECKEYPrivateKey* m_pPrivateKey; public: X509Certificate_NssImpl() ; @@ -97,7 +96,6 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper< /// @throws css::uno::RuntimeException void setRawCert( const css::uno::Sequence< sal_Int8 >& rawCert ) ; - void setCustomPrivateKey(SECKEYPrivateKey* pPrivateKey); SECKEYPrivateKey* getPrivateKey(); // XServiceInfo commit 6fca83fab5a14745c3dc41eb8179d7ee0efd4e71 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Nov 30 11:48:50 2018 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 19:00:17 2019 +0200 convert to range for Change-Id: I3558010129eaafdab94ca3f8a63abeda32318fbb Reviewed-on: https://gerrit.libreoffice.org/64336 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit bb8c2b1cbf7a9eb56b1515f60a2aadbef24199a2) diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index c3641829b4f3..5da6459779f7 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -414,11 +414,10 @@ bool DocumentSignatureManager::add( mxStore, meSignatureMode, DocumentSignatureAlgorithm::OOo3_2); DocumentSignatureHelper::AppendContentTypes(mxStore, aElements); - sal_Int32 nElements = aElements.size(); - for (sal_Int32 n = 0; n < nElements; n++) + for (OUString const& rUri : aElements) { - bool bBinaryMode = !isXML(aElements[n]); - maSignatureHelper.AddForSigning(nSecurityId, aElements[n], bBinaryMode, bAdESCompliant); + bool bBinaryMode = !isXML(rUri); + maSignatureHelper.AddForSigning(nSecurityId, rUri, bBinaryMode, bAdESCompliant); } maSignatureHelper.SetDateTime(nSecurityId, DateTime(DateTime::SYSTEM)); commit 9835ac90d002e28249bcac9c951b54cca1901599 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Nov 29 22:06:02 2018 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 18:57:40 2019 +0200 xmlsecurity: clean-up code a bit Change-Id: I4a43f1f33f73919f56150310e7d05244d81b7510 Reviewed-on: https://gerrit.libreoffice.org/64294 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 40d52cfe3b64e6bac035caed825486546bba5280) diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 1dc7b735c94e..311ce6aeb69f 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -135,7 +135,7 @@ SAL_CALL XMLSignature_NssImpl::generate( if( pSecEnv == nullptr ) throw RuntimeException() ; - setErrorRecorder(); + setErrorRecorder(); std::unique_ptr<xmlSecKeysMngr> pMngr(pSecEnv->createKeysManager()); if( !pMngr ) { @@ -283,25 +283,27 @@ SAL_CALL XMLSignature_NssImpl::validate( } /* XServiceInfo */ -OUString SAL_CALL XMLSignature_NssImpl::getImplementationName() { +OUString SAL_CALL XMLSignature_NssImpl::getImplementationName() +{ return OUString("com.sun.star.xml.crypto.XMLSignature"); } /* XServiceInfo */ -sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService( const OUString& serviceName) { - Sequence< OUString > seqServiceNames = getSupportedServiceNames() ; - const OUString* pArray = seqServiceNames.getConstArray() ; - for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { - if( *( pArray + i ) == serviceName ) - return true ; +sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService(const OUString& rServiceName) +{ + for (OUString const & rCurrentServiceName : getSupportedServiceNames()) + { + if (rCurrentServiceName == rServiceName) + return true; } - return false ; + return false; } /* XServiceInfo */ -Sequence< OUString > SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames() { +Sequence<OUString> SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames() +{ Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignature" }; - return seqServiceNames ; + return seqServiceNames; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* commit 6d4e1c3a3f9903ae3f74fe4caa52e14f46ebd206 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Nov 29 21:58:57 2018 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sun Sep 22 18:56:59 2019 +0200 lokit: disable triggering of GUI when changing a signed doc When a signed document is changed and saved, the dialog pops up on the GUI to warn that the signature will be removed. When saving over the lokit this dialog isn't shown and assumes that we don't want to save (throws an exception) which means we can't save the document ever. This changes the behavior so that we allow removal of the signature and saving can proceed. Change-Id: I52e4a53f0cd3a326c767daee6301a78122af09d4 Reviewed-on: https://gerrit.libreoffice.org/64293 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit c2ee336288dcee103f297a55287fbca596a6c7a1) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 15928451f2b1..ca61c84152ec 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -67,6 +67,7 @@ #include <comphelper/propertysequence.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/mimeconfighelper.hxx> +#include <comphelper/lok.hxx> #include <vcl/weld.hxx> #include <vcl/window.hxx> #include <toolkit/awt/vclxwindow.hxx> @@ -1384,7 +1385,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo } } - if ( !( nStoreMode & EXPORT_REQUESTED ) ) + if (!comphelper::LibreOfficeKit::isActive() && !( nStoreMode & EXPORT_REQUESTED ) ) { // if it is no export, warn user that the signature will be removed if ( SignatureState::OK == nDocumentSignatureState @@ -1399,7 +1400,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo { // the user has decided not to store the document throw task::ErrorCodeIOException( - "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT", + "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT (Preserve Signature)", uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits