[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 83a5eedb7010c236267fcca5cfac4978b9900801 Author: Stephan Bergmann AuthorDate: Wed Nov 29 19:13:35 2023 +0100 Commit: Stephan Bergmann CommitDate: Wed Nov 29 22:58:26 2023 +0100 Extended loplugin:ostr: desktop Change-Id: I4d61b086c2152fec137fd979677729647bb6fd16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160123 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d33ffb95e13f..b3410bd8eb49 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2993,8 +2993,8 @@ void DesktopLOKTest::testTextSelectionHandles() CPPUNIT_ASSERT_EQUAL("1898, 1418, 0, 275"_ostr, m_aTextSelectionEnd); // deselect & check -m_aTextSelectionStart = ""; -m_aTextSelectionEnd = ""; +m_aTextSelectionStart = ""_ostr; +m_aTextSelectionEnd = ""_ostr; pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE); Scheduler::ProcessEventsToIdle(); pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |6 +++--- desktop/source/app/app.cxx |2 +- desktop/source/app/check_ext_deps.cxx |2 +- desktop/source/app/cmdlinehelp.cxx |4 ++-- desktop/source/app/crashreport.cxx |4 ++-- desktop/source/deployment/gui/dp_gui_dialog2.cxx|2 +- desktop/source/deployment/gui/dp_gui_theextmgr.cxx |2 +- desktop/source/deployment/manager/dp_properties.cxx |2 +- desktop/source/deployment/misc/dp_dependencies.cxx |8 desktop/source/deployment/registry/help/dp_help.cxx |2 +- desktop/source/lib/init.cxx |8 desktop/source/migration/migration.cxx |8 desktop/source/migration/services/jvmfwk.cxx|2 +- 13 files changed, 26 insertions(+), 26 deletions(-) New commits: commit 326a8d5dd2d01a2037f17a6fd921494937c134d4 Author: Stephan Bergmann AuthorDate: Thu Oct 19 10:30:11 2023 +0200 Commit: Stephan Bergmann CommitDate: Thu Oct 19 18:49:36 2023 +0200 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: desktop Change-Id: I896fb07e753bfd7be5df892b1608954ad6a9cece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158188 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index dcb5c7192782..dd89ebf1eed0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3044,7 +3044,7 @@ void DesktopLOKTest::testComplexSelection() { // Start with a blank text file and add contents. LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); -static constexpr OStringLiteral aText("hello world"); +static constexpr OString aText("hello world"_ostr); // Certainly not complex. CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument)); @@ -3072,7 +3072,7 @@ void DesktopLOKTest::testComplexSelection() // Export as plain text, we should get only the text part "hello". char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); CPPUNIT_ASSERT(pText != nullptr); -CPPUNIT_ASSERT_EQUAL(OString(aText), OString(pText)); +CPPUNIT_ASSERT_EQUAL(aText, OString(pText)); free(pText); // Export as rtf, we should also get the image. @@ -3128,7 +3128,7 @@ void DesktopLOKTest::testCalcSaveAs() void DesktopLOKTest::testSpellcheckerMultiView() { -static constexpr OUStringLiteral aLangISO(u"en-US"); +static constexpr OUString aLangISO(u"en-US"_ustr); SvtSysLocaleOptions aSysLocaleOptions; aSysLocaleOptions.SetLocaleConfigString(aLangISO); aSysLocaleOptions.SetUILocaleConfigString(aLangISO); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index cb3beaf0ae26..cd1d1de0d6ea 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -581,7 +581,7 @@ bool Desktop::QueryExit() { } -static constexpr OUStringLiteral SUSPEND_QUICKSTARTVETO = u"SuspendQuickstartVeto"; +static constexpr OUString SUSPEND_QUICKSTARTVETO = u"SuspendQuickstartVeto"_ustr; Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XPropertySet > xPropertySet(xDesktop, UNO_QUERY_THROW); diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 8b53d564feb1..4a69a8cf79cc 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -208,7 +208,7 @@ void SilentCommandEnv::pop() } // end namespace -constexpr OUStringLiteral aAccessSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess"; +constexpr OUString aAccessSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr; static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > const ) { diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 58b8b3abb566..9c9fd940f233 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -35,9 +35,9 @@ namespace desktop { -constexpr OUStringLiteral aCmdLineHelp_version = +constexpr OUString aCmdLineHelp_version = u"%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION %BUILDID\n" -"\n"; +"\n"_ustr; constexpr OUStringLiteral aCmdLineHelp = u"Usage: %CMDNAME [argument...]\n" " argument - switches, switch parameters and document URIs (filenames). \n\n" diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 680492b3b80a..186a59b02101 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -135,8 +135,8 @@ void
[Libreoffice-commits] core.git: desktop/qa vcl/jsdialog
desktop/qa/desktop_lib/test_desktop_lib.cxx | 68 vcl/jsdialog/enabled.cxx|3 + 2 files changed, 3 insertions(+), 68 deletions(-) New commits: commit 245c76630f86695234840601e76067388b740de2 Author: Szymon Kłos AuthorDate: Thu Sep 7 16:25:45 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Oct 16 17:38:04 2023 +0200 jsdialog: enable Hyperlink Dialog - removed old "tunneled window" test for hyperlink dialog which cannot work when using jsdialogs Change-Id: I62b6c568149d4ea4656b23c47f4c79efe61abfb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156668 Tested-by: Jenkins CollaboraOffice Reviewed-by: Attila Szűcs Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157022 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 186a18b0a03b..dcb5c7192782 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -211,8 +211,6 @@ public: void testComplexSelection(); void testSpellcheckerMultiView(); void testDialogPaste(); -void testShowHideDialog(); -void testDialogInput(); void testCalcSaveAs(); void testControlState(); void testMetricField(); @@ -285,8 +283,6 @@ public: CPPUNIT_TEST(testComplexSelection); CPPUNIT_TEST(testSpellcheckerMultiView); CPPUNIT_TEST(testDialogPaste); -CPPUNIT_TEST(testShowHideDialog); -CPPUNIT_TEST(testDialogInput); CPPUNIT_TEST(testCalcSaveAs); CPPUNIT_TEST(testControlState); CPPUNIT_TEST(testMetricField); @@ -2040,34 +2036,6 @@ void DesktopLOKTest::testBinaryCallback() } } -void DesktopLOKTest::testDialogInput() -{ -LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); -pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); -Scheduler::ProcessEventsToIdle(); - -SfxViewShell* pViewShell = SfxViewShell::Current(); -pViewShell->GetViewFrame().GetBindings().Update(); - -VclPtr pWindow(Application::GetActiveTopWindow()); -CPPUNIT_ASSERT(pWindow); - -Control* pCtrlFocused = GetFocusControl(pWindow.get()); -CPPUNIT_ASSERT(pCtrlFocused); -CPPUNIT_ASSERT_EQUAL(WindowType::COMBOBOX, pCtrlFocused->GetType()); -CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlFocused->GetText()); - -vcl::LOKWindowId nDialogId = pWindow->GetLOKWindowId(); -pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT, "wiki."); -pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT_END, "wiki."); -pDocument->pClass->removeTextContext(pDocument, nDialogId, 1, 0); -Scheduler::ProcessEventsToIdle(); -CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlFocused->GetText()); - -static_cast(pWindow.get())->Close(); -Scheduler::ProcessEventsToIdle(); -} - void DesktopLOKTest::testInput() { // Load a Writer document, enable change recording and press a key. @@ -2174,7 +2142,6 @@ public: boost::property_tree::ptree m_aCommentCallbackResult; boost::property_tree::ptree m_aCallbackWindowResult; boost::property_tree::ptree m_aColorPaletteCallbackResult; -bool m_bWindowHidden; ViewCallback(LibLODocument_Impl* pDocument) : mpDocument(pDocument), @@ -2231,16 +2198,6 @@ public: m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); } break; -case LOK_CALLBACK_WINDOW: -{ -m_aCallbackWindowResult.clear(); -std::stringstream aStream(pPayload); -boost::property_tree::read_json(aStream, m_aCallbackWindowResult); - -std::string sAction = m_aCallbackWindowResult.get("action"); -if (sAction == "hide") -m_bWindowHidden = true; -} break; case LOK_CALLBACK_CELL_FORMULA: { @@ -3083,31 +3040,6 @@ void DesktopLOKTest::testDialogPaste() Scheduler::ProcessEventsToIdle(); } -void DesktopLOKTest::testShowHideDialog() -{ - -LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - -pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -ViewCallback aView(pDocument); - -pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); -Scheduler::ProcessEventsToIdle(); - -VclPtr pWindow(Application::GetActiveTopWindow()); -CPPUNIT_ASSERT(pWindow); - -aView.m_bWindowHidden = false; - -pWindow->Hide(); -Scheduler::ProcessEventsToIdle(); - -CPPUNIT_ASSERT_EQUAL(true, aView.m_bWindowHidden); - -static_cast(pWindow.get())->Close(); -Scheduler::ProcessEventsToIdle(); -} - void DesktopLOKTest::testComplexSelection() { // Start with a blank text file and add contents. diff --git a/vcl/jsdialog/enabled.cxx
[Libreoffice-commits] core.git: desktop/qa include/xmloff schema/libreoffice sw/inc sw/source xmloff/inc xmloff/qa xmloff/source
desktop/qa/data/comments.odt|binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 14 +++--- include/xmloff/xmltoken.hxx |1 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |5 ++ sw/inc/AnnotationWin.hxx|3 + sw/inc/docufld.hxx | 10 sw/inc/unoprnms.hxx |1 sw/source/core/fields/docufld.cxx | 23 +- sw/source/core/inc/bookmark.hxx |2 sw/source/core/inc/unofldmid.h |1 sw/source/core/unocore/unofield.cxx | 11 sw/source/core/unocore/unomap.cxx |1 sw/source/uibase/docvw/AnnotationWin.cxx| 14 ++ sw/source/uibase/docvw/PostItMgr.cxx| 27 +++- sw/source/uibase/shells/textfld.cxx |8 +++ sw/source/uibase/uno/unotxdoc.cxx |3 - xmloff/inc/txtfldi.hxx |1 xmloff/qa/unit/text.cxx |8 +++ xmloff/source/core/xmltoken.cxx |1 xmloff/source/text/txtflde.cxx |9 xmloff/source/text/txtfldi.cxx |6 ++ xmloff/source/token/tokens.txt |1 22 files changed, 133 insertions(+), 17 deletions(-) New commits: commit 62cc2217217650d23c72e4646ccd793f76722d94 Author: Gökay Şatır AuthorDate: Fri Sep 1 09:49:53 2023 +0300 Commit: Miklos Vajna CommitDate: Tue Sep 12 17:09:18 2023 +0200 Added parent / child relationship to comments. Adding parent name of a comment into odf file when there is a parent. Also includes: Added test case to comment property test. Change-Id: I033f6574b4875fcb76b16c8b5b9d9f7d55b52cbe Also includes: Add parent / child relations to replied comments. Change-Id: Ia7d95c4e6020b501798a89cbdcae64dc5691437c Change-Id: I08b5ab6eb11adcafcbf3559896d79d41b449b26a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156824 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/data/comments.odt b/desktop/qa/data/comments.odt index ee7f15f8b755..1bcdcc0385ea 100644 Binary files a/desktop/qa/data/comments.odt and b/desktop/qa/data/comments.odt differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a55ae18172d..8f90f3198b27 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2452,7 +2452,7 @@ void DesktopLOKTest::testCommentsWriter() // This is a reply comment else if (rComment.second.get("text") == "Reply to Comment 2") { -CPPUNIT_ASSERT_EQUAL(nComment2Id, rComment.second.get("parent")); +CPPUNIT_ASSERT_EQUAL(nComment2Id, rComment.second.get("parentId")); } } @@ -2594,8 +2594,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action and linked to its parent comment CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView1.m_aCommentCallbackResult.get("action")); CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView2.m_aCommentCallbackResult.get("action")); -CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parent")); -CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parent")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parentId")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parentId")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView1.m_aCommentCallbackResult.get("text")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView2.m_aCommentCallbackResult.get("text")); int nCommentId2 = aView1.m_aCommentCallbackResult.get("id"); @@ -2609,8 +2609,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView1.m_aCommentCallbackResult.get("action")); CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView2.m_aCommentCallbackResult.get("action")); // parent is unchanged still -CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parent")); -CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parent")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("parentId")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get("parentId")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"),
[Libreoffice-commits] core.git: desktop/qa sc/inc sc/qa sc/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 +- sc/inc/postit.hxx|2 + sc/qa/unit/tiledrendering/tiledrendering.cxx |8 ++-- sc/source/ui/docshell/docsh4.cxx | 25 -- sc/source/ui/unoobj/docuno.cxx | 47 --- 5 files changed, 30 insertions(+), 56 deletions(-) New commits: commit f363777f1c518ed9633596e482d4a11eee17295d Author: Caolán McNamara AuthorDate: Mon Jul 31 11:29:05 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Aug 1 14:55:54 2023 +0200 cool#6911 report the position of comments as cell addresses and leave it to the client to determine the bounds of the cell Change-Id: I20a1bece5d0717c0e099b38610842d4800d6a074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155088 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e93cf695068f..8b21f905f71d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2407,14 +2407,14 @@ void DesktopLOKTest::testCommentsCalc() { CPPUNIT_ASSERT_EQUAL(std::string("4"), rComment.second.get("tab")); CPPUNIT_ASSERT_EQUAL(std::string("Comment1"), rComment.second.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("7650, 3570, 1274, 254"), rComment.second.get("cellPos")); +CPPUNIT_ASSERT_EQUAL(std::string("6 14 6 14"), rComment.second.get("cellRange")); } break; case 1: { CPPUNIT_ASSERT_EQUAL(std::string("4"), rComment.second.get("tab")); CPPUNIT_ASSERT_EQUAL(std::string("Comment2"), rComment.second.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("8925, 4335, 1274, 254"), rComment.second.get("cellPos")); +CPPUNIT_ASSERT_EQUAL(std::string("7 17 7 17"), rComment.second.get("cellRange")); } break; } diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 52872b8d650e..828d094e49d1 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -155,6 +155,8 @@ public: /** Updates caption position according to position of the passed cell. */ voidUpdateCaptionPos( const ScAddress& rPos ); +static OString NoteRangeToJsonString(const ScDocument& rDoc, const ScAddress& rPos); + private: ScPostIt( const ScPostIt& ) = delete; ScPostIt& operator=( const ScPostIt& ) = delete; diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 254fb5e8a042..c0fc36968c58 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1110,8 +1110,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCommentCallback) CPPUNIT_ASSERT_EQUAL(std::string("LOK User1"), aView2.m_aCommentCallbackResult.get("author")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView1.m_aCommentCallbackResult.get("text")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView2.m_aCommentCallbackResult.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("0, 255, 1274, 254"), aView1.m_aCommentCallbackResult.get("cellPos")); -CPPUNIT_ASSERT_EQUAL(std::string("0, 255, 1274, 254"), aView2.m_aCommentCallbackResult.get("cellPos")); +CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get("cellRange")); std::string aCommentId = aView1.m_aCommentCallbackResult.get("id"); @@ -1138,8 +1138,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCommentCallback) CPPUNIT_ASSERT_EQUAL(std::string("LOK User2"), aView2.m_aCommentCallbackResult.get("author")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get("text")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("0, 255, 1274, 254"), aView1.m_aCommentCallbackResult.get("cellPos")); -CPPUNIT_ASSERT_EQUAL(std::string("0, 255, 1274, 254"), aView2.m_aCommentCallbackResult.get("cellPos")); +CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get("cellRange")); // Delete the comment if (pTabViewShell) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 8c9d227a84ca..7e4370b7e6db 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2561,30 +2561,7 @@ void
[Libreoffice-commits] core.git: desktop/qa desktop/source docmodel/source include/docmodel include/LibreOfficeKit include/svx libreofficekit/source sd/source svx/source sw/inc sw/source
desktop/qa/data/ThemeDocument.docx |binary desktop/qa/desktop_lib/test_desktop_lib.cxx| 40 +++ desktop/source/lib/init.cxx|2 + docmodel/source/color/ComplexColorJSON.cxx | 15 +--- include/LibreOfficeKit/LibreOfficeKitEnums.h |9 - include/docmodel/color/ComplexColorJSON.hxx|3 + include/svx/svdpage.hxx|1 include/svx/theme/ThemeColorPaletteManager.hxx |1 libreofficekit/source/gtk/lokdocview.cxx |1 sd/source/ui/inc/ViewShellBase.hxx |2 + sd/source/ui/view/ViewShellBase.cxx|5 ++ svx/source/svdraw/svdpage.cxx | 19 +++ svx/source/theme/ThemeColorPaletteManager.cxx | 43 + sw/inc/view.hxx|2 + sw/source/uibase/uiview/view.cxx | 15 15 files changed, 150 insertions(+), 8 deletions(-) New commits: commit e86a0236e69d76769b91f96d71fe852b91c5db6e Author: Tomaž Vajngerl AuthorDate: Sun Jun 4 20:57:19 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Jun 5 13:06:57 2023 +0200 lok: callback to send the updated theme palette when theme changes The callback sends the updated theme color palette when the theme changes or initially when the view is registered, so the client should always have the up-to-date theme color palette stored, so it can just show the color picker with the theme at any time without the need to call the server. Change-Id: I7cceccc46c2fad23ba89e6d3f3643e37f8dab292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152589 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/data/ThemeDocument.docx b/desktop/qa/data/ThemeDocument.docx new file mode 100644 index ..4dbba883d9b6 Binary files /dev/null and b/desktop/qa/data/ThemeDocument.docx differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 74db478c09a3..b698cc5976b7 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -219,6 +219,7 @@ public: void testRenderSearchResult_CommonNode(); void testNoDuplicateTableSelection(); void testMultiViewTableSelection(); +void testColorPaletteCallback(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -291,6 +292,7 @@ public: CPPUNIT_TEST(testRenderSearchResult_CommonNode); CPPUNIT_TEST(testNoDuplicateTableSelection); CPPUNIT_TEST(testMultiViewTableSelection); +CPPUNIT_TEST(testColorPaletteCallback); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2160,12 +2162,14 @@ class ViewCallback public: OString m_aCellFormula; int m_nTableSelectionCount; +int m_nColorPaletteCallbackCount = 0; bool m_bEmptyTableSelection; bool m_bTilesInvalidated; bool m_bZeroCursor; tools::Rectangle m_aOwnCursor; boost::property_tree::ptree m_aCommentCallbackResult; boost::property_tree::ptree m_aCallbackWindowResult; +boost::property_tree::ptree m_aColorPaletteCallbackResult; bool m_bWindowHidden; ViewCallback(LibLODocument_Impl* pDocument) @@ -2245,6 +2249,14 @@ public: ++m_nTableSelectionCount; } break; +case LOK_CALLBACK_COLOR_PALETTES: +{ +m_aColorPaletteCallbackResult.clear(); +std::stringstream aStream(pPayload); +boost::property_tree::read_json(aStream, m_aColorPaletteCallbackResult); +++m_nColorPaletteCallbackCount; +} +break; } } }; @@ -3525,6 +3537,34 @@ void DesktopLOKTest::testMultiViewTableSelection() CPPUNIT_ASSERT(!aView1.m_bEmptyTableSelection); } +void DesktopLOKTest::testColorPaletteCallback() +{ +LibLODocument_Impl* pDocument = loadDoc("ThemeDocument.docx"); + +// Create view 1. +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +ViewCallback aView1(pDocument); +Scheduler::ProcessEventsToIdle(); +{ +CPPUNIT_ASSERT_EQUAL(1, aView1.m_nColorPaletteCallbackCount); +boost::property_tree::ptree aValues = aView1.m_aColorPaletteCallbackResult.get_child("ThemeColors"); +CPPUNIT_ASSERT(!aValues.empty()); +CPPUNIT_ASSERT_EQUAL(size_t(6), aValues.size()); +} + +// Create view 2. +pDocument->m_pDocumentClass->createView(pDocument); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +ViewCallback aView2(pDocument); +Scheduler::ProcessEventsToIdle(); +{ +CPPUNIT_ASSERT_EQUAL(1, aView2.m_nColorPaletteCallbackCount); +boost::property_tree::ptree aValues = aView1.m_aColorPaletteCallbackResult.get_child("ThemeColors"); +CPPUNIT_ASSERT(!aValues.empty()); +CPPUNIT_ASSERT_EQUAL(size_t(6), aValues.size()); +} +} +
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/sal include/sfx2 libreofficekit/source sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |8 desktop/source/lib/init.cxx | 144 +++-- include/LibreOfficeKit/LibreOfficeKit.h |9 include/LibreOfficeKit/LibreOfficeKit.hxx| 30 + include/LibreOfficeKit/LibreOfficeKitEnums.h | 41 + include/sal/log-areas.dox|1 include/sfx2/lokhelper.hxx |2 include/sfx2/viewsh.hxx | 11 libreofficekit/source/gtk/lokdocview.cxx |3 sfx2/source/view/lokhelper.cxx | 17 sfx2/source/view/viewsh.cxx | 741 +++ 11 files changed, 968 insertions(+), 39 deletions(-) New commits: commit 14b3ad0b4e5a540f436db3467f8a4051392f8479 Author: Marco Cecchetti AuthorDate: Thu Mar 23 08:33:16 2023 +0100 Commit: Miklos Vajna CommitDate: Fri Jun 2 08:04:38 2023 +0200 lok: accessibility event listener for focused paragraph LOKDocumentFocusListener keeps track of the currently focused paragraph. Also includes: Author: Andras Timar Date: Mon May 15 22:06:10 2023 +0200 fix unused exception parameter 'e' Change-Id: Ibfee099e4e9b724648d7500b9ebb4e8ab84989b8 and: Author: Marco Cecchetti Date: Thu May 4 12:11:53 2023 +0200 lok: a11y: focused paragraph info sent to client For the currently focused paragraph the following data is notified to client: paragraph content, caret position, text selection start/end These data is kept as an instance state so the client can request such info at any time. Change-Id: Ic1a3be0d93472300b1b6a91fb0de5bad87c031aa and: Author: Marco Cecchetti Date: Sun May 7 11:52:14 2023 +0200 fixup! lok: accessibility event listener for focused paragraph It seems it was not a good idea using a unique_ptr as smart pointer for an instance of LOKDocumentFocusListener Change-Id: I8e6b0f48fee3c5db3c9b074a663f7f3fb96a601e Change-Id: I0fa400694f3129608228ade0b96e0b4e0aee87e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152488 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 675ebfe82e8d..74db478c09a3 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3641,9 +3641,15 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), offsetof(struct _LibreOfficeKitDocumentClass, getEditMode)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(68), offsetof(struct _LibreOfficeKitDocumentClass, setViewTimezone)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), + offsetof(struct _LibreOfficeKitDocumentClass, setAccessibilityState)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(70), + offsetof(struct _LibreOfficeKitDocumentClass, getA11yFocusedParagraph)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(71), + offsetof(struct _LibreOfficeKitDocumentClass, getA11yCaretPosition)); // As above -CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(72), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8561760febce..13922571d9ce 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1309,6 +1309,11 @@ static void doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const cha static void doc_setViewTimezone(LibreOfficeKitDocument* pThis, int nId, const char* timezone); +static void doc_setAccessibilityState(LibreOfficeKitDocument* pThis, int nId, bool bEnabled); + +static char* doc_getA11yFocusedParagraph(LibreOfficeKitDocument* pThis); + +static int doc_getA11yCaretPosition(LibreOfficeKitDocument* pThis); } // extern "C" namespace { @@ -1361,6 +1366,45 @@ vcl::Font FindFont_FallbackToDefault(std::u16string_view rFontName) return OutputDevice::GetDefaultFont(DefaultFontType::SANS_UNICODE, LANGUAGE_NONE, GetDefaultFontFlags::NONE); } + +int getDocumentType (LibreOfficeKitDocument* pThis) +{ +SetLastExceptionMsg(); + +LibLODocument_Impl* pDocument = static_cast(pThis); + +try +{ +uno::Reference xDocument(pDocument->mxComponent, uno::UNO_QUERY_THROW); + +if (xDocument->supportsService("com.sun.star.sheet.SpreadsheetDocument")) +{ +return
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit ac519af951541b7313a4c98e1bee463bf47356be Author: Miklos Vajna AuthorDate: Thu Apr 20 15:15:38 2023 +0200 Commit: Miklos Vajna CommitDate: Fri Apr 21 08:08:15 2023 +0200 CppunitTest_desktop_lib: disable 3 useless doc sign tests These would test how LOK APIs for signing editable documents would work. In practice, this is already broken, because the tests are disabled in the MPL subset builds but binaries tuned for LOK API users at distro-configs/CPLinux-LOKit.conf already use --enable-mpl-subset. Additionally these tests pass with an upcoming libxmlsec-1.3 for me locally, but not in a RHEL7 environment. So just disable the 3 tests till we have the time to fix them up in MPL subset builds, where they would be useful. PDF signing is a different story, that still works to some extent. Change-Id: Idcfda4c8c72353e710a65c5b0ee68d28e30a351b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150700 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8490b4d0e116..59c883cb733d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -198,9 +198,11 @@ public: void testExtractParameter(); void testGetSignatureState_NonSigned(); void testGetSignatureState_Signed(); +#if 0 // broken with system nss on RHEL 7 void testInsertCertificate_DER_ODT(); void testInsertCertificate_PEM_ODT(); void testInsertCertificate_PEM_DOCX(); +#endif void testSignDocument_PEM_PDF(); void testTextSelectionHandles(); void testComplexSelection(); @@ -267,9 +269,11 @@ public: CPPUNIT_TEST(testGetSignatureState_Signed); CPPUNIT_TEST(testGetSignatureState_NonSigned); #if !MPL_HAVE_SUBSET +#if 0 // broken with system nss on RHEL 7 CPPUNIT_TEST(testInsertCertificate_DER_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_DOCX); +#endif CPPUNIT_TEST(testSignDocument_PEM_PDF); #endif CPPUNIT_TEST(testTextSelectionHandles); @@ -2708,6 +2712,7 @@ void DesktopLOKTest::testGetSignatureState_NonSigned() CPPUNIT_ASSERT_EQUAL(int(0), nState); } +#if 0 // broken with system nss on RHEL 7 void DesktopLOKTest::testInsertCertificate_DER_ODT() { // Load the document, save it into a temp file and load that file again @@ -2865,6 +2870,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); CPPUNIT_ASSERT_EQUAL(int(5), nState); } +#endif void DesktopLOKTest::testSignDocument_PEM_PDF() {
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit e5aeca2cf9ff9746f9af521c52b40360cd7f7bfc Author: Stephan Bergmann AuthorDate: Thu Apr 13 19:08:25 2023 +0200 Commit: Stephan Bergmann CommitDate: Fri Apr 14 10:26:27 2023 +0200 -Werror,-Wunused-variable Unused ever since it got introduced in 62b337a3d6650b8b3045dd98f59a8c0188f0a6fa "Unit test for removeTextContext." (Found with an experimental Clang build supporting __attribute__((warn_unused)) on individual ctors rather than just whole class types, and the corresponding css::uno::Reference ctor marked accordingly.) Change-Id: Id80b031625134ea6b4d679bfb774fc253206ae18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150374 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 3ad89b37416c..8490b4d0e116 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2062,7 +2062,6 @@ void DesktopLOKTest::testInput() { // Load a Writer document, enable change recording and press a key. LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); -uno::Reference xPropertySet(mxComponent, uno::UNO_QUERY); Scheduler::ProcessEventsToIdle(); // Get focus & other bits setup.
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl vcl/inc vcl/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +- desktop/source/lib/init.cxx |8 ++ include/LibreOfficeKit/LibreOfficeKit.h |4 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 17 + include/vcl/lok.hxx |4 +++ vcl/inc/graphic/Manager.hxx |8 -- vcl/inc/impgraph.hxx|2 + vcl/inc/svdata.hxx |7 + vcl/source/app/svapp.cxx| 21 vcl/source/app/svdata.cxx | 23 + vcl/source/gdi/impgraph.cxx | 25 +++ vcl/source/graphic/Manager.cxx | 36 +++- 12 files changed, 149 insertions(+), 9 deletions(-) New commits: commit 4a4602ad7513262a6c0423f17b42791a852b7e23 Author: Michael Meeks AuthorDate: Fri Mar 10 10:36:22 2023 + Commit: Michael Meeks CommitDate: Sat Mar 11 21:03:05 2023 + lok: add trimMemory capability, and expand dumpState to caches. Being able to trigger some more aggressive memory saving is useful in for both online and mobile. Change-Id: I9b91c9fe9eecec06c75112595deac0bfeb94c144 Signed-off-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148624 Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 217b537fa214..a919dbcf4267 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3554,10 +3554,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(classOffset(14), offsetof(struct _LibreOfficeKitClass, setOption)); CPPUNIT_ASSERT_EQUAL(classOffset(15), offsetof(struct _LibreOfficeKitClass, dumpState)); CPPUNIT_ASSERT_EQUAL(classOffset(16), offsetof(struct _LibreOfficeKitClass, extractRequest)); +CPPUNIT_ASSERT_EQUAL(classOffset(17), offsetof(struct _LibreOfficeKitClass, trimMemory)); // When extending LibreOfficeKit with a new function pointer, add new assert for the offsetof the // new function pointer and bump this assert for the size of the class. -CPPUNIT_ASSERT_EQUAL(classOffset(17), sizeof(struct _LibreOfficeKitClass)); +CPPUNIT_ASSERT_EQUAL(classOffset(18), sizeof(struct _LibreOfficeKitClass)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index cf23f09f1413..9722be530db2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2523,6 +2523,8 @@ static bool lo_signDocument(LibreOfficeKit* pThis, static char* lo_extractRequest(LibreOfficeKit* pThis, const char* pFilePath); +static void lo_trimMemory(LibreOfficeKit* pThis, int nTarget); + static void lo_runLoop(LibreOfficeKit* pThis, LibreOfficeKitPollCallback pPollCallback, LibreOfficeKitWakeCallback pWakeCallback, @@ -2564,6 +2566,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl() m_pOfficeClass->setOption = lo_setOption; m_pOfficeClass->dumpState = lo_dumpState; m_pOfficeClass->extractRequest = lo_extractRequest; +m_pOfficeClass->trimMemory = lo_trimMemory; gOfficeClass = m_pOfficeClass; } @@ -3142,6 +3145,11 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, const char* pFilePath) return convertOUString(result); } +static void lo_trimMemory(LibreOfficeKit* /* pThis */, int nTarget) +{ +vcl::lok::trimMemory(nTarget); +} + static void lo_registerCallback (LibreOfficeKit* pThis, LibreOfficeKitCallback pCallback, void* pData) diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 3887d3d3c412..e98ea6f47f42 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -127,6 +127,10 @@ struct _LibreOfficeKitClass */ char* (*extractRequest) (LibreOfficeKit* pThis, const char* pFilePath); + +/// @see lok::Office::trimMemory +/// @since LibreOffice 7.6 +void (*trimMemory) (LibreOfficeKit* pThis, int nTarget); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index d3c2e5de78aa..bc3bbb98cc10 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -1146,6 +1146,23 @@ public: { return mpThis->pClass->extractRequest(mpThis,
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 --- desktop/source/lib/init.cxx | 34 include/LibreOfficeKit/LibreOfficeKit.h |8 -- include/LibreOfficeKit/LibreOfficeKit.hxx | 25 4 files changed, 1 insertion(+), 70 deletions(-) New commits: commit 1f4e9eacc36413bba92f119ebed931cfdb975e80 Author: Tor Lillqvist AuthorDate: Tue Mar 7 11:43:00 2023 +0200 Commit: Tor Lillqvist CommitDate: Tue Mar 7 14:40:02 2023 + Drop the LibreOfficeKit paintThumbnail() API It turns out that Mert's original idea is actually the simplest and it is known to work. And in that, the separate paintThumbnail() is rather pointless, as all paintThumbnail() did was to call paintTile(). The caller (in Collabora Online) knows when a file is opened specifically for thumbnailing, and can call paintTile() itself with the appropriate parameters. My misguided idea would have had paintThumbnail() somehow figure out the physical Twip coordinates of the current location (for text documents, the insertion caret location) in the document. (Or, as LibreOfficeKit for some reason calls them, "logical" coordinates, even if a Twip is a very physical length unit.) Then it would have called paintTile() with those coordinates. But it turned out to be rather hard to figure out the Twip coordinates of the current location in the document. Mert's idea was that when a document is opened for thumbnailing, only Online actually needs to know that. From LibreOfficeKit's and core's point of view it is a normal document load operation. Then Online performs the .uno:OpenHyperlink magic, which makes core move the current position to the requested "target" or "mark" (the terminology varies) location. And then a "cursor" callback is used by Online to get the Twip coordinates of the target. It is a bit unclear to me whether .uno:HyperLink causes the document to be opened an extra time, but whatever, this way is said to work. So let's do it like that. This reverts the paintThumbnail part of 1aa37ca99112c0760552600d7774ba7224581c5b. Change-Id: I8f3d9917ee362c1518834fc10a57c57ebc4a6edb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148390 Tested-by: Tor Lillqvist Reviewed-by: Tor Lillqvist diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c143662d7dd4..217b537fa214 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3635,11 +3635,9 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), offsetof(struct _LibreOfficeKitDocumentClass, getEditMode)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(68), offsetof(struct _LibreOfficeKitDocumentClass, setViewTimezone)); -CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), offsetof(struct _LibreOfficeKitDocumentClass, paintThumbnail)); - // As above -CPPUNIT_ASSERT_EQUAL(documentClassOffset(70), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 903dc2b06687..ee1f47a8ea96 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1114,12 +1114,6 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight); -static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, - unsigned char* pBuffer, - int bufferWidth, - int bufferHeight, - int width, - const char* pURL); #ifdef IOS static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, void* rCGContext, @@ -1393,7 +1387,6 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference xC m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->getEditMode = doc_getEditMode; m_pDocumentClass->paintTile = doc_paintTile; -m_pDocumentClass->paintThumbnail = doc_paintThumbnail; #ifdef IOS m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext; #endif @@ -4015,33 +4008,6 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, #endif -static void doc_paintThumbnail(LibreOfficeKitDocument* pThis, - unsigned char* pBuffer, - int bufferWidth, -
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx | 16 ++ desktop/source/lib/init.cxx | 175 include/LibreOfficeKit/LibreOfficeKit.h | 10 + include/LibreOfficeKit/LibreOfficeKit.hxx | 10 + 4 files changed, 208 insertions(+), 3 deletions(-) New commits: commit 1aa37ca99112c0760552600d7774ba7224581c5b Author: Tor Lillqvist AuthorDate: Tue Feb 21 13:19:42 2023 +0200 Commit: Tor Lillqvist CommitDate: Wed Feb 22 08:14:30 2023 + Extend LOKit API with functionality to extract a request and paint thumbnails Original author was Mert Tümer. Change-Id: I181a9955bcce1d5ee4c81e2a52445ef318dc4823 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147396 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 3d2fc3c0d2fb..c143662d7dd4 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3549,6 +3549,15 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo)); CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro)); CPPUNIT_ASSERT_EQUAL(classOffset(11), offsetof(struct _LibreOfficeKitClass, signDocument)); +CPPUNIT_ASSERT_EQUAL(classOffset(12), offsetof(struct _LibreOfficeKitClass, runLoop)); +CPPUNIT_ASSERT_EQUAL(classOffset(13), offsetof(struct _LibreOfficeKitClass, sendDialogEvent)); +CPPUNIT_ASSERT_EQUAL(classOffset(14), offsetof(struct _LibreOfficeKitClass, setOption)); +CPPUNIT_ASSERT_EQUAL(classOffset(15), offsetof(struct _LibreOfficeKitClass, dumpState)); +CPPUNIT_ASSERT_EQUAL(classOffset(16), offsetof(struct _LibreOfficeKitClass, extractRequest)); + +// When extending LibreOfficeKit with a new function pointer, add new assert for the offsetof the +// new function pointer and bump this assert for the size of the class. +CPPUNIT_ASSERT_EQUAL(classOffset(17), sizeof(struct _LibreOfficeKitClass)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); @@ -3626,10 +3635,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), offsetof(struct _LibreOfficeKitDocumentClass, getEditMode)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(68), offsetof(struct _LibreOfficeKitDocumentClass, setViewTimezone)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), offsetof(struct _LibreOfficeKitDocumentClass, paintThumbnail)); + -// Extending is fine, update this, and add new assert for the offsetof the -// new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(69), sizeof(struct _LibreOfficeKitDocumentClass)); +// As above +CPPUNIT_ASSERT_EQUAL(documentClassOffset(70), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ed601003d042..1a077ce19500 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -179,6 +180,7 @@ // Needed for getUndoManager() #include #include +#include #include #include #include @@ -399,6 +401,97 @@ std::vector desktop::jsonToPropertyValuesVector(const char return aArguments; } +static bool extractLinks(const uno::Reference< container::XNameAccess >& xLinks, bool subcontent, OUStringBuffer& jsonText) +{ +const uno::Sequence< OUString > aNames( xLinks->getElementNames() ); + +const sal_uLong nLinks = aNames.getLength(); +const OUString* pNames = aNames.getConstArray(); +const OUString aProp_LinkDisplayName( "LinkDisplayName" ); +const OUString aProp_LinkTarget( "com.sun.star.document.LinkTarget" ); +bool bIsTarget = false; +for( sal_uLong i = 0; i < nLinks; i++ ) +{ +uno::Any aAny; +OUString aLink( *pNames++ ); + +bool bError = false; +try +{ +aAny = xLinks->getByName( aLink ); +} +catch(const uno::Exception&) +{ +// if the name of the target was invalid (like empty headings) +// no object can be provided +bError = true; +} +if(bError) +continue; + +uno::Reference< beans::XPropertySet > xTarget; +if( aAny >>= xTarget ) +{ +try +{ +// get name to display +aAny = xTarget->getPropertyValue( aProp_LinkDisplayName ); +OUString aDisplayName; +aAny >>= aDisplayName; +OUString aStrDisplayname (
[Libreoffice-commits] core.git: desktop/qa sc/qa sd/qa sw/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |7 - sc/qa/unit/tiledrendering/tiledrendering.cxx | 97 -- sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 15 ++-- sd/qa/unit/tiledrendering/tiledrendering.cxx | 79 ++--- sd/qa/unit/uiimpress.cxx |6 - sw/qa/extras/uiwriter/uiwriter6.cxx |1 6 files changed, 101 insertions(+), 104 deletions(-) New commits: commit b767398f33f91f53f65ab2822ee667b59589e162 Author: Xisco Fauli AuthorDate: Tue Feb 21 12:38:38 2023 +0100 Commit: Xisco Fauli CommitDate: Tue Feb 21 13:14:40 2023 + qa: use dispatchCommand from macroTest Change-Id: I135bdcf6b93a38d7ee746234462736b0868c9017 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147395 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 6be2de622b1d..9cd9e74a61ff 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -606,7 +605,7 @@ void DesktopLOKTest::testSearchCalc() {"SearchItem.Backward", uno::Any(false)}, {"SearchItem.Command", uno::Any(static_cast(SvxSearchCmd::FIND_ALL))}, })); -comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); +dispatchCommand(mxComponent, ".uno:ExecuteSearch", aPropertyValues); Scheduler::ProcessEventsToIdle(); std::vector aSelections; @@ -637,7 +636,7 @@ void DesktopLOKTest::testSearchAllNotificationsCalc() {"SearchItem.Backward", uno::Any(false)}, {"SearchItem.Command", uno::Any(static_cast(SvxSearchCmd::FIND_ALL))}, })); -comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); +dispatchCommand(mxComponent, ".uno:ExecuteSearch", aPropertyValues); Scheduler::ProcessEventsToIdle(); // This was 1, make sure that we get no notifications about selection changes during search. @@ -769,7 +768,7 @@ void DesktopLOKTest::testPasteWriterJPEG() { {"AnchorType", uno::Any(static_cast(text::TextContentAnchorType_AT_CHARACTER))}, })); -comphelper::dispatchCommand(".uno:Paste", aPropertyValues); +dispatchCommand(mxComponent, ".uno:Paste", aPropertyValues); xShape.set(xDrawPage->getByIndex(0), uno::UNO_QUERY); // This was text::TextContentAnchorType_AS_CHARACTER, AnchorType argument was ignored. CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, xShape->getPropertyValue("AnchorType").get()); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 1434cfe80e95..0eef509ff7c3 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -309,7 +308,7 @@ void ScTiledRenderingTest::testRowColumnSelections() { "Row", uno::Any(sal_Int32(5 - 1)) }, { "Modifier", uno::Any(sal_uInt16(0)) } })); -comphelper::dispatchCommand(".uno:SelectRow", aArgs); +dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // Check if it is selected OString aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); @@ -319,7 +318,7 @@ void ScTiledRenderingTest::testRowColumnSelections() // Select the 10th row with shift modifier aArgs = comphelper::InitPropertySequence({ { "Row", uno::Any(static_cast(10 - 1)) }, { "Modifier", uno::Any(KEY_SHIFT) } }); -comphelper::dispatchCommand(".uno:SelectRow", aArgs); +dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // Check if all the rows from 5th to 10th get selected aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"); @@ -329,7 +328,7 @@ void ScTiledRenderingTest::testRowColumnSelections() // Select the 10th row with ctrl modifier aArgs = comphelper::InitPropertySequence({ { "Row", uno::Any(static_cast(13 - 1)) }, { "Modifier", uno::Any(KEY_MOD1) } }); -comphelper::dispatchCommand(".uno:SelectRow", aArgs); +dispatchCommand(mxComponent, ".uno:SelectRow", aArgs); // When we copy this, we don't get anything useful, but we must not crash // (used to happen) @@ -341,7 +340,7 @@ void ScTiledRenderingTest::testRowColumnSelections() // Select Column 5 with ctrl modifier aArgs = comphelper::InitPropertySequence({ { "Col", uno::Any(static_cast(5 - 1)) }, { "Modifier", uno::Any(KEY_MOD1) } }); -comphelper::dispatchCommand(".uno:SelectColumn", aArgs); +
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 1 file changed, 4 insertions(+) New commits: commit 25c16d260999487284b54cf2794b29b868d05f58 Author: Caolán McNamara AuthorDate: Wed Jan 18 15:07:29 2023 + Commit: Caolán McNamara CommitDate: Wed Jan 18 20:36:01 2023 + don't crash with --disable-pdfium Change-Id: Ibc88d9f32ae86f7137c24e2fe1d581ff1cd64497 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145746 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 181366e6a19e..98c734c8190a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -687,6 +687,10 @@ void DesktopLOKTest::testSaveAsJsonOptions() OString aOptions("{\"PageRange\":{\"type\":\"string\",\"value\":\"2-\"}}"); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, maTempFile.GetURL().toUtf8().getStr(), "pdf", aOptions.getStr())); +std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; + // Then make sure the resulting PDF has 2 pages: std::unique_ptr pPdfDocument = parsePDFExport();
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |5 - desktop/source/lib/init.cxx | 113 +--- include/LibreOfficeKit/LibreOfficeKit.h |4 include/LibreOfficeKit/LibreOfficeKit.hxx |8 + sfx2/source/view/lokhelper.cxx |6 - 5 files changed, 103 insertions(+), 33 deletions(-) New commits: commit 931e3d204e59ccb2e9c479477e6e66b2c098924f Author: Szymon Kłos AuthorDate: Mon Aug 29 09:34:53 2022 +0200 Commit: Szymon Kłos CommitDate: Sat Nov 19 18:16:16 2022 +0100 lok: masterpage: Introduce mode property to tile rendering This is needed for Impress which can have slides in two Edit Modes: Master Page and Page. Change-Id: I3eca0f51ba7970e793026d1ac6aa09b19b7a904b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137869 Reviewed-by: Ashod Nakashian Tested-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142969 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index dd84323f6c9b..e7762753775f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2275,7 +2275,7 @@ void DesktopLOKTest::testPaintPartTile() // Call paintPartTile() to paint the second part (in whichever view it finds suitable for this). unsigned char pPixels[256 * 256 * 4]; -pDocument->m_pDocumentClass->paintPartTile(pDocument, pPixels, 1, 256, 256, 0, 0, 256, 256); +pDocument->m_pDocumentClass->paintPartTile(pDocument, pPixels, 1, 0, 256, 256, 0, 0, 256, 256); // Type again. Scheduler::ProcessEventsToIdle(); @@ -3624,10 +3624,11 @@ void DesktopLOKTest::testABI() offsetof(struct _LibreOfficeKitDocumentClass, sendContentControlEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionTypeAndText)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), offsetof(struct _LibreOfficeKitDocumentClass, getDataArea)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), offsetof(struct _LibreOfficeKitDocumentClass, getEditMode)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(68), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 1163ef2a638f..766248ef00ef 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -998,6 +998,7 @@ static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); +static int doc_getEditMode(LibreOfficeKitDocument* pThis); static void doc_paintTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nCanvasWidth, const int nCanvasHeight, @@ -1013,6 +1014,7 @@ static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, static void doc_paintPartTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, const int nPart, + const int nMode, const int nCanvasWidth, const int nCanvasHeight, const int nTilePosX, const int nTilePosY, const int nTileWidth, const int nTileHeight); @@ -1269,6 +1271,7 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference xC m_pDocumentClass->moveSelectedParts = doc_moveSelectedParts; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; +m_pDocumentClass->getEditMode = doc_getEditMode; m_pDocumentClass->paintTile = doc_paintTile; #ifdef IOS m_pDocumentClass->paintTileToCGContext = doc_paintTileToCGContext; @@ -3641,6 +3644,23 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis, } } +static int doc_getEditMode(LibreOfficeKitDocument* pThis) +{ +comphelper::ProfileZone aZone("doc_getEditMode"); + +SolarMutexGuard aGuard; +SetLastExceptionMsg(); + +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +SetLastExceptionMsg("Document doesn't support tiled rendering"); +return 0; +} + +return pDoc->getEditMode(); +} + static void doc_paintTile(LibreOfficeKitDocument* pThis, unsigned char* pBuffer,
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- desktop/source/lib/init.cxx | 28 include/LibreOfficeKit/LibreOfficeKit.h |6 ++ include/LibreOfficeKit/LibreOfficeKit.hxx |6 ++ include/vcl/ITiledRenderable.hxx|8 sc/inc/docuno.hxx |3 +++ sc/source/ui/unoobj/docuno.cxx | 22 ++ 7 files changed, 75 insertions(+), 1 deletion(-) New commits: commit ff9b9944401a594ec4a67bca953b312f3a54e3f8 Author: Szymon Kłos AuthorDate: Fri Sep 2 11:35:42 2022 +0200 Commit: Szymon Kłos CommitDate: Thu Nov 10 10:16:52 2022 +0100 lok: Introudce getDataArea for Calc It will share information about real size of a data inside spreadsheet so we can easily check where data ends in online side. Change-Id: I376187a33c5c82d409f559d5cc826a4f36d4252e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139472 Reviewed-by: Gökay ŞATIR Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142503 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d7089d9243f0..dd84323f6c9b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3623,10 +3623,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), offsetof(struct _LibreOfficeKitDocumentClass, sendContentControlEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionTypeAndText)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), offsetof(struct _LibreOfficeKitDocumentClass, getDataArea)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(67), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d4332d5c2926..f4aeaf2760cf 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1020,6 +1020,10 @@ static int doc_getTileMode(LibreOfficeKitDocument* pThis); static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, long* pWidth, long* pHeight); +static void doc_getDataArea(LibreOfficeKitDocument* pThis, +long nTab, +long* pCol, +long* pRow); static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, const char* pArguments); @@ -1272,6 +1276,7 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference xC m_pDocumentClass->paintPartTile = doc_paintPartTile; m_pDocumentClass->getTileMode = doc_getTileMode; m_pDocumentClass->getDocumentSize = doc_getDocumentSize; +m_pDocumentClass->getDataArea = doc_getDataArea; m_pDocumentClass->initializeForRendering = doc_initializeForRendering; m_pDocumentClass->registerCallback = doc_registerCallback; m_pDocumentClass->postKeyEvent = doc_postKeyEvent; @@ -3919,6 +3924,29 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, } } +static void doc_getDataArea(LibreOfficeKitDocument* pThis, +long nTab, +long* pCol, +long* pRow) +{ +comphelper::ProfileZone aZone("doc_getDataArea"); + +SolarMutexGuard aGuard; +SetLastExceptionMsg(); + +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (pDoc) +{ +Size aDocumentSize = pDoc->getDataArea(nTab); +*pCol = aDocumentSize.Width(); +*pRow = aDocumentSize.Height(); +} +else +{ +SetLastExceptionMsg("Document doesn't support tiled rendering"); +} +} + static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, const char* pArguments) { diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 3a706ba47091..2f57f744e1d4 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -483,6 +483,12 @@ struct _LibreOfficeKitDocumentClass char** pText, char** pUsedMimeType); +/// @see lok::Document::getDataArea(). +void (*getDataArea) (LibreOfficeKitDocument* pThis, + long nPart, + long* pCol, + long* pRow); + #endif //
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 920ca8c8eea0ccd40f42d3d72a3c43f59e6373e8 Author: Andrea Gelmini AuthorDate: Mon Sep 26 16:02:03 2022 +0200 Commit: Julien Nabet CommitDate: Mon Sep 26 20:10:11 2022 +0200 Fix typo Change-Id: Ib35b1ce171e655e2dfbca2ed996b7e212813b8f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140622 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 54c8a8189ab5..437acd28df42 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3276,7 +3276,7 @@ namespace { SfxChildWindow* lcl_initializeSidebar() { -// in init.cxx we do setupSidebar which creaes the controller, do it here +// in init.cxx we do setupSidebar which creates the controller, do it here SfxViewShell* pViewShell = SfxViewShell::Current(); CPPUNIT_ASSERT(pViewShell);
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/deployment_misc/test_dp_version.cxx|2 +- desktop/source/app/officeipcthread.cxx| 12 ++-- desktop/source/deployment/manager/dp_extensionmanager.cxx |2 +- desktop/source/deployment/misc/dp_misc.cxx|2 +- 4 files changed, 9 insertions(+), 9 deletions(-) New commits: commit 8dc57426c3bd3385c30b9007991af8496b315f9a Author: jsala AuthorDate: Fri Jun 24 18:46:25 2022 +0200 Commit: Hossein CommitDate: Mon Sep 5 18:57:53 2022 +0200 tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro Also change some integer by std::size_t Change-Id: Ia51b27bb99b8adda576394f9331345cb11149d6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137274 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/desktop/qa/deployment_misc/test_dp_version.cxx b/desktop/qa/deployment_misc/test_dp_version.cxx index e896686865be..1b8fb9086769 100644 --- a/desktop/qa/deployment_misc/test_dp_version.cxx +++ b/desktop/qa/deployment_misc/test_dp_version.cxx @@ -60,7 +60,7 @@ void Test::test() { OUString("9223372036854775807"), ::dp_misc::GREATER } }; -for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) { +for (std::size_t i = 0; i < std::size(data); ++i) { CPPUNIT_ASSERT_EQUAL( data[i].order, ::dp_misc::compareVersions(data[i].version1, data[i].version2)); diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index e559f7253e53..6e3e97b06d19 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -72,7 +72,7 @@ char const PROCESSING_DONE[] = "InternalIPC::ProcessingDone"; OString readStringFromPipe(osl::StreamPipe const & pipe) { for (OStringBuffer str;;) { char buf[1024]; -sal_Int32 n = pipe.recv(buf, SAL_N_ELEMENTS(buf)); +sal_Int32 n = pipe.recv(buf, std::size(buf)); if (n <= 0) { SAL_INFO("desktop.app", "read empty string"); return ""; @@ -1154,10 +1154,10 @@ void PipeIpcThread::execute() // notify client we're ready to process its args: SAL_INFO("desktop.app", "writing <" << SEND_ARGUMENTS << ">"); -sal_Int32 n = aStreamPipe.write( -SEND_ARGUMENTS, SAL_N_ELEMENTS(SEND_ARGUMENTS)); +std::size_t n = aStreamPipe.write( +SEND_ARGUMENTS, std::size(SEND_ARGUMENTS)); // incl. terminating NUL -if (n != SAL_N_ELEMENTS(SEND_ARGUMENTS)) { +if (n != std::size(SEND_ARGUMENTS)) { SAL_WARN("desktop.app", "short write: " << n); continue; } @@ -1186,9 +1186,9 @@ void PipeIpcThread::execute() { // processing finished, inform the requesting end: SAL_INFO("desktop.app", "writing <" << PROCESSING_DONE << ">"); -n = aStreamPipe.write(PROCESSING_DONE, SAL_N_ELEMENTS(PROCESSING_DONE)); +n = aStreamPipe.write(PROCESSING_DONE, std::size(PROCESSING_DONE)); // incl. terminating NUL -if (n != SAL_N_ELEMENTS(PROCESSING_DONE)) +if (n != std::size(PROCESSING_DONE)) { SAL_WARN("desktop.app", "short write: " << n); continue; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index fc7816f6a4c6..44bd4648eff0 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -296,7 +296,7 @@ std::vector > std::vector > extensionList; Reference lRepos[] = { getUserRepository(), getSharedRepository(), getBundledRepository() }; -for (int i(0); i != SAL_N_ELEMENTS(lRepos); ++i) +for (std::size_t i(0); i != std::size(lRepos); ++i) { Reference xPackage; try diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index f4437711dab5..df94e958292b 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -416,7 +416,7 @@ OUString generateRandomPipeId() throw RuntimeException( "cannot create random pool!?", nullptr ); sal_uInt8 bytes[ 32 ]; if (rtl_random_getBytes( -s_hPool, bytes, SAL_N_ELEMENTS(bytes) ) != rtl_Random_E_None) { +s_hPool, bytes, std::size(bytes) ) != rtl_Random_E_None) { throw RuntimeException( "random pool error!?", nullptr ); } OUStringBuffer buf;
[Libreoffice-commits] core.git: desktop/qa filter/qa svx/qa svx/source vcl/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 ++ filter/qa/pdf.cxx |9 - svx/qa/unit/core.cxx|2 ++ svx/source/svdraw/svdpdf.cxx|2 +- vcl/qa/cppunit/filter/ipdf/ipdf.cxx |2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) New commits: commit 10e81b3dd5e0712eb8298ee7b6ebf80fc2d8 Author: Caolán McNamara AuthorDate: Wed Aug 10 09:00:34 2022 +0100 Commit: Caolán McNamara CommitDate: Thu Aug 11 17:13:05 2022 +0200 some --disable-pdfium fixes Change-Id: I33867397cd5783adb90e9dc2c62b037ced131e26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138081 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 12e34a58ee5a..aa52f3edc16b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -697,6 +697,8 @@ void DesktopLOKTest::testSaveAsJsonOptions() SvMemoryStream aMemory; aMemory.WriteStream(aFile); std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; std::unique_ptr pPdfDocument = pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), OString()); CPPUNIT_ASSERT(pPdfDocument); diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx index 3500bb5dae28..29129f2b08f2 100644 --- a/filter/qa/pdf.cxx +++ b/filter/qa/pdf.cxx @@ -59,6 +59,10 @@ constexpr OUStringLiteral DATA_DIRECTORY = u"/filter/qa/data/"; CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName) { +std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; + uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); uno::Reference xSecurityContext @@ -99,7 +103,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName) xFilter->filter(aDescriptor); // Then make sure the resulting PDF has a signature: -std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); std::unique_ptr pPdfDocument = pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString()); // Without the accompanying fix in place, this test would have failed, as signing was enabled @@ -110,6 +113,10 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName) CPPUNIT_TEST_FIXTURE(Test, testPdfDecompositionSize) { +std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; + // Given an empty Writer document: getComponent().set( loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument")); diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx index 27e5783e20db..3966010012e6 100644 --- a/svx/qa/unit/core.cxx +++ b/svx/qa/unit/core.cxx @@ -70,6 +70,8 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf) // Then make sure we get a valid, non-empty PDF: auto pPdfium = vcl::pdf::PDFiumLibrary::get(); +if (!pPdfium) +return; SvMemoryStream aMemory; aMemory.WriteStream(*aTempFile.GetStream(StreamMode::READ)); std::unique_ptr pPdfDocument diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index 13a75fddbb3a..fb608bd2c5cf 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -115,7 +115,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools: auto const& rVectorGraphicData = rGraphic.getVectorGraphicData(); auto* pData = rVectorGraphicData->getBinaryDataContainer().getData(); sal_Int32 nSize = rVectorGraphicData->getBinaryDataContainer().getSize(); -mpPdfDocument = mpPDFium->openDocument(pData, nSize, OString()); +mpPdfDocument = mpPDFium ? mpPDFium->openDocument(pData, nSize, OString()) : nullptr; if (!mpPdfDocument) return; diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 3beedaad0dc0..fa8b7374c5d6 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -128,6 +128,8 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testPDFAddVisibleSignatureLastPage) // Then: count the # of shapes on the signature widget/annotation. std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +if (!pPDFium) +return; SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ); SvMemoryStream aMemory; aMemory.WriteStream(aFile);
[Libreoffice-commits] core.git: desktop/qa filter/qa include/vcl sc/qa sd/qa svx/qa svx/source sw/qa vcl/inc vcl/qa vcl/source xmlsecurity/qa xmlsecurity/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 filter/qa/pdf.cxx|2 include/vcl/filter/PDFiumLibrary.hxx |4 + include/vcl/filter/pdfdocument.hxx |2 include/vcl/filter/pdfobjectcontainer.hxx|4 + sc/qa/extras/scpdfexport.cxx |6 +- sd/qa/unit/SdrPdfImportTest.cxx |5 +- svx/qa/unit/core.cxx |2 svx/source/svdraw/svdpdf.cxx |2 sw/qa/core/text/text.cxx |2 sw/qa/extras/uiwriter/uiwriter2.cxx |2 sw/qa/extras/uiwriter/uiwriter3.cxx |2 vcl/inc/pdf/pdfwriter_impl.hxx |4 - vcl/qa/cppunit/PDFiumLibraryTest.cxx | 18 +-- vcl/qa/cppunit/filter/ipdf/ipdf.cxx |2 vcl/qa/cppunit/pdfexport/data/rectangles.pdf | 54 +++ vcl/qa/cppunit/pdfexport/pdfexport.cxx | 50 - vcl/source/filter/ipdf/pdfread.cxx |8 ++- vcl/source/gdi/pdfobjectcopier.cxx | 29 +--- vcl/source/gdi/pdfwriter_impl.cxx| 32 - vcl/source/graphic/VectorGraphicSearch.cxx |3 - vcl/source/pdf/PDFiumLibrary.cxx | 13 - xmlsecurity/qa/unit/signing/signing.cxx |2 xmlsecurity/source/helper/pdfsignaturehelper.cxx |4 - 24 files changed, 211 insertions(+), 43 deletions(-) New commits: commit 7d56dae3375dc0180aa6d20983b3f5f962302588 Author: Miklos Vajna AuthorDate: Wed Jul 20 08:16:57 2022 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 20 12:54:45 2022 +0200 tdf#127236 vcl: fix missing encryption of PDF images during export Regression from commit 78e25558e86188314b9b72048b8ddca18697cb86 (tdf#106059 PDF export: create a reference XObject for JPG images with PDF data, 2017-02-23), once a PDF image was inserted to a document, an encrypted PDF export lost those images. The reason for this is that we started to preserve PDF images as vector data with the above commit, but this means we copied over PDF objects from PDF images to the export result as-is, so encryption was not performed for them. Fix this by separating the write of the PDF object headers, stream content and object footer and then calling checkAndEnableStreamEncryption() / disableStreamEncryption() for each object, even if it's not something our PDF export created but comes from a PDF image. Note that when existing PDF files are signed, PDF objects are also copied into a vcl::filter::PDFDocument, but such PDF images are never encrypted, so it's fine to have stub implementations in vcl::filter::PDFDocument. Change-Id: I2f74b9f51cd35b4319221532ca890e197bab9cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137242 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 0c5df69dba8b..12e34a58ee5a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -698,7 +698,7 @@ void DesktopLOKTest::testSaveAsJsonOptions() aMemory.WriteStream(aFile); std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); std::unique_ptr pPdfDocument -= pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize()); += pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize(), OString()); CPPUNIT_ASSERT(pPdfDocument); // Without the accompanying fix in place, this test would have failed with: // - Expected: 2 diff --git a/filter/qa/pdf.cxx b/filter/qa/pdf.cxx index bc8329d0116e..04bd4170c17e 100644 --- a/filter/qa/pdf.cxx +++ b/filter/qa/pdf.cxx @@ -100,7 +100,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSignCertificateSubjectName) // Then make sure the resulting PDF has a signature: std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); std::unique_ptr pPdfDocument -= pPDFium->openDocument(aStream.GetData(), aStream.GetSize()); += pPDFium->openDocument(aStream.GetData(), aStream.GetSize(), OString()); // Without the accompanying fix in place, this test would have failed, as signing was enabled // without configuring a certificate, so the whole export failed. CPPUNIT_ASSERT(pPdfDocument); diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index c5f1766f60c0..3a4d0d83faf6 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -55,7 +55,9 @@ public: virtual const OUString& getLastError() const = 0; -virtual std::unique_ptr openDocument(const void* pData, int nSize) = 0; +virtual std::unique_ptr openDocument(const void* pData, int nSize, +
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 605e391874e08484111ac760d5b353b7d4db6517 Author: offtkp AuthorDate: Sat Jul 9 20:40:52 2022 +0300 Commit: Tomaž Vajngerl CommitDate: Tue Jul 19 13:06:19 2022 +0200 Replace old png writer in test_desktop_lib.cxx Change-Id: I9f73b316521bcacb9042375adef3a3339ab2166f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137115 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 54440df9266b..0c5df69dba8b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -62,7 +62,7 @@ #include #include -#include +#include #include #if USE_TLS_NSS @@ -3377,8 +3377,8 @@ void DesktopLOKTest::testRenderSearchResult_WriterNode() if (bDumpBitmap) { SvFileStream aStream("~/SearchResultBitmap.png", StreamMode::WRITE | StreamMode::TRUNC); -vcl::PNGWriter aPNGWriter(aBitmap); -aPNGWriter.Write(aStream); +vcl::PngImageWriter aPNGWriter(aStream); +aPNGWriter.write(aBitmap); } CPPUNIT_ASSERT_EQUAL(tools::Long(642), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(561), aBitmap.GetSizePixel().Height()); @@ -3422,8 +3422,8 @@ void DesktopLOKTest::testRenderSearchResult_CommonNode() if (bDumpBitmap) { SvFileStream aStream("~/SearchResultBitmap.png", StreamMode::WRITE | StreamMode::TRUNC); -vcl::PNGWriter aPNGWriter(aBitmap); -aPNGWriter.Write(aStream); +vcl::PngImageWriter aPNGWriter(aStream); +aPNGWriter.write(aBitmap); } CPPUNIT_ASSERT_EQUAL(tools::Long(192), aBitmap.GetSizePixel().Width()); CPPUNIT_ASSERT_EQUAL(tools::Long(96), aBitmap.GetSizePixel().Height());
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |9 +++ desktop/source/lib/init.cxx | 62 ++- include/LibreOfficeKit/LibreOfficeKit.h |7 +++ include/LibreOfficeKit/LibreOfficeKit.hxx| 27 +++ include/LibreOfficeKit/LibreOfficeKitEnums.h |2 5 files changed, 104 insertions(+), 3 deletions(-) New commits: commit e4842a4c520c68813f0567d34ad321de11c4f1c3 Author: Luboš Luňák AuthorDate: Thu May 19 09:15:46 2022 +0200 Commit: Luboš Luňák CommitDate: Tue May 31 17:03:02 2022 +0200 lok: add more efficient getSelectionType() replacement The getSelectionType() function usually needs to be followed by a call to getTextSelection(), which means having them as two functions leads to duplicating to a number of calls, some of which may be somewhat expensive (pDoc->getSelection() e.g. for Calc builds another ScDocument for the selection, and then getFromTransferrable() converts that to the given format). Change-Id: Ib0a8844701d80eaaff4834dcd3633c09d6b921b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134603 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index f2fd0ab16173..54440df9266b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3040,12 +3040,16 @@ void DesktopLOKTest::testComplexSelection() // Certainly not complex. CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument)); +CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionTypeAndText(pDocument, + "", nullptr, nullptr)); // Paste text. CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength())); // No selection. CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument)); +CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionTypeAndText(pDocument, + "", nullptr, nullptr)); // Paste an image. OUString aFileURL; @@ -3080,6 +3084,8 @@ void DesktopLOKTest::testComplexSelection() // We expect this to be complex. CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_COMPLEX), pDocument->pClass->getSelectionType(pDocument)); +CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_COMPLEX), pDocument->pClass->getSelectionTypeAndText(pDocument, + "", nullptr, nullptr)); } void DesktopLOKTest::testCalcSaveAs() @@ -3633,10 +3639,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), offsetof(struct _LibreOfficeKitDocumentClass, renderSearchResult)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), offsetof(struct _LibreOfficeKitDocumentClass, sendContentControlEvent)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionTypeAndText)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(66), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e8bb8b44f6bf..ec97510b40e4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1048,6 +1048,10 @@ static char* doc_getTextSelection(LibreOfficeKitDocument* pThis, const char* pMimeType, char** pUsedMimeType); static int doc_getSelectionType(LibreOfficeKitDocument* pThis); +static int doc_getSelectionTypeAndText(LibreOfficeKitDocument* pThis, + const char* pMimeType, + char** pText, + char** pUsedMimeType); static int doc_getClipboard (LibreOfficeKitDocument* pThis, const char **pMimeTypes, size_t *pOutCount, @@ -1242,6 +1246,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference setWindowTextSelection = doc_setWindowTextSelection; m_pDocumentClass->getTextSelection = doc_getTextSelection; m_pDocumentClass->getSelectionType = doc_getSelectionType; +m_pDocumentClass->getSelectionTypeAndText = doc_getSelectionTypeAndText; m_pDocumentClass->getClipboard = doc_getClipboard; m_pDocumentClass->setClipboard = doc_setClipboard;
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl libreofficekit/qa libreofficekit/source sw/inc sw/qa sw/source tools/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 desktop/source/lib/init.cxx | 32 include/LibreOfficeKit/LibreOfficeKit.h |3 include/LibreOfficeKit/LibreOfficeKit.hxx | 19 ++ include/LibreOfficeKit/LibreOfficeKitGtk.h |7 include/vcl/ITiledRenderable.hxx|6 libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |2 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx | 30 +++ libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.hxx |1 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx |4 libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.hxx |1 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx| 16 ++ libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx|2 libreofficekit/qa/gtktiledviewer/gtv.ui | 18 ++ libreofficekit/source/gtk/lokdocview.cxx| 27 ++- sw/inc/unotxdoc.hxx |3 sw/qa/extras/tiledrendering/tiledrendering.cxx | 77 ++ sw/source/core/crsr/viscrs.cxx | 10 + sw/source/uibase/uno/unotxdoc.cxx | 46 + tools/qa/cppunit/test_json_writer.cxx | 17 ++ 20 files changed, 319 insertions(+), 6 deletions(-) New commits: commit c7d80d229a5660a0ee702477bfbd2ca137992a7d Author: Miklos Vajna AuthorDate: Fri May 13 08:26:32 2022 +0200 Commit: Miklos Vajna CommitDate: Fri May 13 09:10:25 2022 +0200 sw content controls, dropdown: add LOK API - expose the available list items in a new "items" key of the LOK_CALLBACK_CONTENT_CONTROL callback - add a new lok::Document::sendContentControlEvent() function to be able to select a list item from the current drop-down - add a new listbox to the gtktiledviewer toolbar to select a content control list item when the cursor is inside a dropdown - add tests for the array API of tools::JsonWriter Change-Id: I47f1333a7815d67952f7c20a9cba1b248886f6dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134256 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 038ea2db6aca..f2fd0ab16173 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3631,10 +3631,12 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), offsetof(struct _LibreOfficeKitDocumentClass, sendFormFieldEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), offsetof(struct _LibreOfficeKitDocumentClass, setBlockedCommandList)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), offsetof(struct _LibreOfficeKitDocumentClass, renderSearchResult)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), + offsetof(struct _LibreOfficeKitDocumentClass, sendContentControlEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(64), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(65), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 50ae3a5da400..45f059a73d7d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1143,6 +1143,8 @@ static bool doc_renderSearchResult(LibreOfficeKitDocument* pThis, const char* pSearchResult, unsigned char** pBitmapBuffer, int* pWidth, int* pHeight, size_t* pByteSize); +static void doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const char* pArguments); + } // extern "C" namespace { @@ -1286,6 +1288,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference setBlockedCommandList = doc_setBlockedCommandList; +m_pDocumentClass->sendContentControlEvent = doc_sendContentControlEvent; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -6070,6 +6074,34 @@ static bool doc_renderSearchResult(LibreOfficeKitDocument* pThis, return true; } +static void doc_sendContentControlEvent(LibreOfficeKitDocument* pThis, const char* pArguments) +{ +SolarMutexGuard aGuard; + +// Supported in Writer only +if (doc_getDocumentType(pThis) != LOK_DOCTYPE_TEXT) +{ +return; +} + +StringMap aMap(jsdialog::jsonToStringMap(pArguments)); +
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 128 1 file changed, 128 insertions(+) New commits: commit 12746af8c3c07cc38c682073d55bfa9eadde0b67 Author: Henry Castro AuthorDate: Fri Sep 10 07:16:04 2021 -0400 Commit: Henry Castro CommitDate: Fri Feb 18 19:42:38 2022 +0100 lok: sc: unit test drag & drop .. Change-Id: I774ece93e5c439c65df50e6a67d1447a062708b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121898 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129470 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 523101527a06..1d36f54f3ffc 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -172,6 +172,7 @@ public: void testWriterComments(); void testSheetOperations(); void testSheetSelections(); +void testSheetDragDrop(); void testContextMenuCalc(); void testContextMenuWriter(); void testContextMenuImpress(); @@ -239,6 +240,7 @@ public: CPPUNIT_TEST(testWriterComments); CPPUNIT_TEST(testSheetOperations); CPPUNIT_TEST(testSheetSelections); +CPPUNIT_TEST(testSheetDragDrop); CPPUNIT_TEST(testContextMenuCalc); CPPUNIT_TEST(testContextMenuWriter); CPPUNIT_TEST(testContextMenuImpress); @@ -1188,6 +1190,132 @@ void DesktopLOKTest::testSheetSelections() } } +void DesktopLOKTest::testSheetDragDrop() +{ +LibLODocument_Impl* pDocument = loadDoc("sheets.ods", LOK_DOCTYPE_SPREADSHEET); +pDocument->pClass->initializeForRendering(pDocument, nullptr); +pDocument->pClass->registerCallback(pDocument, ::callback, this); + +int row01 = 100; +int col01 = 1100; +int col02 = 2200; +int col03 = 3300; +int col05 = 5500; +int col07 = 5700; + +// Select row 01 from column 01 through column 05 +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEBUTTONDOWN, + col01, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEMOVE, + col02, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEMOVE, + col05, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEBUTTONUP, + col05, row01, + 1, 1, 0); + +Scheduler::ProcessEventsToIdle(); +{ +SfxViewShell* pViewShell = SfxViewShell::Current(); +SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); + +OUString sValue; +css::uno::Any aValue; +css::util::URL aURL; +std::unique_ptr pState; + +aURL.Protocol = ".uno:"; +aURL.Complete = ".uno:Address"; +aURL.Path = "Address"; +aURL.Main = ".uno:Address"; + + pViewFrame->GetBindings().QueryState(pViewFrame->GetBindings().QuerySlotId(aURL), pState); +pState->QueryValue(aValue); +aValue >>= sValue; +CPPUNIT_ASSERT_EQUAL(OUString("Sheet5.A1:E1"), sValue); +} + +// Check selection content +{ +char* pMimeType = nullptr; +char* pContent = pDocument->pClass->getTextSelection(pDocument, nullptr, ); +std::vector aExpected = {1, 2, 3, 4, 5}; +std::istringstream aContent(pContent); +std::string token; +for (size_t i = 0; i < aExpected.size(); i++) +{ +aContent >> token; +CPPUNIT_ASSERT_EQUAL(aExpected[i], strtol(token.c_str(), nullptr, 10)); +} + +free(pMimeType); +free(pContent); +} + +// drag and drop +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEBUTTONDOWN, + col01, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEMOVE, + col02, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEMOVE, + col03, row01, + 1, 1, 0); +pDocument->pClass->postMouseEvent(pDocument, + LOK_MOUSEEVENT_MOUSEBUTTONUP, + col07, row01, +
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 14 -- 1 file changed, 14 deletions(-) New commits: commit 6a5dfb88d75bccd6e7c8fd54365093cece2b1de7 Author: Henry Castro AuthorDate: Mon Oct 4 08:45:18 2021 -0400 Commit: Henry Castro CommitDate: Fri Feb 18 17:58:01 2022 +0100 lok: test: fix testSheetSelections The unit test is selecting again range, it will conflict with the drag & drop because it will drop to new cell address. The unit test will fail, the removed code will be used to a new unit test for drag & drop. Change-Id: I896f5cd7e6b671f3fac95c8ae76e7558fa8dd1d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123062 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129468 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 76eccc8f4a6d..523101527a06 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1157,20 +1157,6 @@ void DesktopLOKTest::testSheetSelections() /* * Check if clicking inside the selection deselects the whole selection */ -int const row10 = 2400; -// Select starting from row5, col1 to row10, col5 -pDocument->pClass->postMouseEvent(pDocument, - LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - col1, row5, - 1, 1, 0); -pDocument->pClass->postMouseEvent(pDocument, - LOK_MOUSEEVENT_MOUSEMOVE, - col5, row5, - 1, 1, 0); -pDocument->pClass->postMouseEvent(pDocument, - LOK_MOUSEEVENT_MOUSEBUTTONUP, - col5, row10, - 1, 1, 0); // Click at row5, col4 pDocument->pClass->postMouseEvent(pDocument,
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/data/3page.odg |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 29 desktop/source/lib/init.cxx |7 +- 3 files changed, 35 insertions(+), 1 deletion(-) New commits: commit d0451dcf96508bf4d75c8147168f974ad3ebf03f Author: Miklos Vajna AuthorDate: Wed Jan 26 08:38:59 2022 +0100 Commit: Miklos Vajna CommitDate: Wed Jan 26 09:31:21 2022 +0100 desktop lok, export options: allow passing through a JSON string as-is setFormatSpecificFilterData() sets useful defaults, but the PDF export code has the (sane) behavior of preferring FilterData over FilterOptions, so in case we explicitly got a JSON string in FilterOptions to in fact set FilterData, then leave FilterData empty. Change-Id: I20e8094bf431782fe0f5d68e3ec630e1274e30c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128970 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/data/3page.odg b/desktop/qa/data/3page.odg new file mode 100644 index ..1fad913e0493 Binary files /dev/null and b/desktop/qa/data/3page.odg differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 689a406e4a07..76eccc8f4a6d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #if USE_TLS_NSS #include @@ -159,6 +160,7 @@ public: void testSearchAllNotificationsCalc(); void testPaintTile(); void testSaveAs(); +void testSaveAsJsonOptions(); void testSaveAsCalc(); void testPasteWriter(); void testPasteWriterJPEG(); @@ -225,6 +227,7 @@ public: CPPUNIT_TEST(testSearchAllNotificationsCalc); CPPUNIT_TEST(testPaintTile); CPPUNIT_TEST(testSaveAs); +CPPUNIT_TEST(testSaveAsJsonOptions); CPPUNIT_TEST(testSaveAsCalc); CPPUNIT_TEST(testPasteWriter); CPPUNIT_TEST(testPasteWriterJPEG); @@ -675,6 +678,32 @@ void DesktopLOKTest::testSaveAs() CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", nullptr)); } +void DesktopLOKTest::testSaveAsJsonOptions() +{ +// Given a document with 3 pages: +LibLODocument_Impl* pDocument = loadDoc("3page.odg"); + +// When exporting that document to PDF, skipping the first page: +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); +OString aOptions("{\"PageRange\":{\"type\":\"string\",\"value\":\"2-\"}}"); +CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "pdf", aOptions.getStr())); + +// Then make sure the resulting PDF has 2 pages: +SvFileStream aFile(aTempFile.GetURL(), StreamMode::READ); +SvMemoryStream aMemory; +aMemory.WriteStream(aFile); +std::shared_ptr pPDFium = vcl::pdf::PDFiumLibrary::get(); +std::unique_ptr pPdfDocument += pPDFium->openDocument(aMemory.GetData(), aMemory.GetSize()); +CPPUNIT_ASSERT(pPdfDocument); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 2 +// - Actual : 3 +// i.e. FilterOptions was ignored. +CPPUNIT_ASSERT_EQUAL(2, pPdfDocument->getPageCount()); +} + void DesktopLOKTest::testSaveAsCalc() { LibLODocument_Impl* pDocument = loadDoc("search.ods"); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index dfbf503b269f..f9b1d3e0ea96 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2897,7 +2897,12 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha comphelper::SequenceAsHashMap aFilterDataMap; -setFormatSpecificFilterData(sFormat, aFilterDataMap); +// If filter options is JSON string, then make sure aFilterDataMap stays empty, otherwise we +// would ignore the filter options. +if (!aFilterOptions.startsWith("{")) +{ +setFormatSpecificFilterData(sFormat, aFilterDataMap); +} if (!watermarkText.isEmpty()) aFilterDataMap["TiledWatermark"] <<= watermarkText;
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 092e99d5335ffd471dfa6dc75dd42e526e43098e Author: Mike Kaganski AuthorDate: Thu Nov 11 11:24:20 2021 +0300 Commit: Mike Kaganski CommitDate: Thu Nov 11 11:56:05 2021 +0100 Use o3tl::convert Change-Id: Ia64ae3445a4aea3be3044e2345e432e839d9a0f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125027 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 1144a5e48369..5c17f880e2de 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -829,7 +830,7 @@ void DesktopLOKTest::testRowColumnHeaders() for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) { sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); -nSize *= 15; /* TWIPS_PER_PIXEL */ +nSize = o3tl::convert(nSize, o3tl::Length::px, o3tl::Length::twip); OString aText(rValue.second.get("text").c_str()); if (bFirstHeader) @@ -858,7 +859,7 @@ void DesktopLOKTest::testRowColumnHeaders() for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) { sal_Int32 nSize = OString(rValue.second.get("size").c_str()).toInt32(); -nSize *= 15; /* TWIPS_PER_PIXEL */ +nSize = o3tl::convert(nSize, o3tl::Length::px, o3tl::Length::twip); OString aText(rValue.second.get("text").c_str()); if (bFirstHeader) {
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/unit/desktop-lok-init.cxx | 44 +++ desktop/source/app/app.cxx|4 desktop/source/app/appinit.cxx| 10 - desktop/source/app/check_ext_deps.cxx |6 desktop/source/app/dispatchwatcher.cxx| 62 -- desktop/source/app/opencl.cxx |6 desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 27 +--- desktop/source/deployment/manager/dp_extensionmanager.cxx |3 desktop/source/deployment/manager/dp_informationprovider.cxx |8 - desktop/source/deployment/misc/dp_dependencies.cxx|3 desktop/source/deployment/misc/dp_descriptioninfoset.cxx |3 desktop/source/deployment/registry/component/dp_component.cxx | 10 - desktop/source/deployment/registry/configuration/dp_configuration.cxx |5 desktop/source/deployment/registry/dp_registry.cxx|7 - desktop/source/deployment/registry/help/dp_help.cxx |3 desktop/source/deployment/registry/package/dp_package.cxx | 19 +-- desktop/source/deployment/registry/script/dp_script.cxx |5 desktop/source/lib/init.cxx | 23 +-- desktop/source/lib/lokclipboard.cxx |7 - desktop/source/migration/migration.cxx| 22 ++- 20 files changed, 120 insertions(+), 157 deletions(-) New commits: commit 471f5ab323c5676ca22358ca67f4e6820b7e071c Author: Mike Kaganski AuthorDate: Fri Oct 29 09:27:05 2021 +0300 Commit: Mike Kaganski CommitDate: Sat Oct 30 17:39:47 2021 +0200 Prepare for removal of non-const operator[] from Sequence in desktop Change-Id: I76959f62d46e12d984fe4c7be74e5857399e9126 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124358 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx index 7e6e266cf899..49971afc2e5c 100644 --- a/desktop/qa/unit/desktop-lok-init.cxx +++ b/desktop/qa/unit/desktop-lok-init.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -61,9 +62,7 @@ void LOKInitTest::testJsonToPropertyValues() "\"value\":\"something.odt\"" "}}"; -uno::Sequence aArgs(1); -aArgs[0].Name = "FileName"; -aArgs[0].Value <<= OUString("something.odt"); +uno::Sequence aArgs{ comphelper::makePropertyValue("FileName", OUString("something.odt")) }; assertSequencesEqual( aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments))); @@ -129,31 +128,26 @@ void LOKInitTest::testJsonToPropertyValuesBorder() "}}"; // see SvxBoxItem::QueryValue for details -uno::Sequence aOuterSeq(9); table::BorderLine2 aLine(sal_Int32(COL_BLACK), 0, 1, 0, table::BorderLineStyle::SOLID, 1); -aOuterSeq[0] <<= aLine; // left -aOuterSeq[1] <<= aLine; // right -aOuterSeq[2] <<= aLine; // bottom -aOuterSeq[3] <<= aLine; // top -aOuterSeq[4] <<= static_cast(0); -aOuterSeq[5] <<= static_cast(0); -aOuterSeq[6] <<= static_cast(0); -aOuterSeq[7] <<= static_cast(0); -aOuterSeq[8] <<= static_cast(0); +uno::Sequence aOuterSeq{ uno::Any(aLine), // left + uno::Any(aLine), // right + uno::Any(aLine), // bottom + uno::Any(aLine), // top + uno::Any(static_cast(0)), + uno::Any(static_cast(0)), + uno::Any(static_cast(0)), + uno::Any(static_cast(0)), + uno::Any(static_cast(0)) }; // see SvxBoxInfoItem::QueryValue() for details -uno::Sequence aInnerSeq(5); -aInnerSeq[0] <<= aLine; // horizontal -aInnerSeq[1] <<= aLine; // vertical -aInnerSeq[2] <<= static_cast(0); -aInnerSeq[3] <<= static_cast(0x7F); -aInnerSeq[4] <<= static_cast(0); - -uno::Sequence aArgs(2); -aArgs[0].Name = "OuterBorder"; -aArgs[0].Value <<= aOuterSeq; -aArgs[1].Name = "InnerBorder"; -aArgs[1].Value <<= aInnerSeq; +uno::Sequence aInnerSeq{ uno::Any(aLine), // horizontal + uno::Any(aLine), // vertical + uno::Any(static_cast(0)), + uno::Any(static_cast(0x7F)), + uno::Any(static_cast(0)) }; + +uno::Sequence aArgs{ comphelper::makePropertyValue("OuterBorder",
[Libreoffice-commits] core.git: desktop/qa desktop/source sw/inc sw/source test/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 12 desktop/source/lib/init.cxx | 56 +- sw/inc/viscrs.hxx |2 sw/source/core/crsr/viscrs.cxx | 70 ++-- sw/source/uibase/uiview/viewsrch.cxx|4 - sw/source/uibase/wrtsh/wrtsh4.cxx |5 ++ test/source/lokcallback.cxx |2 7 files changed, 121 insertions(+), 30 deletions(-) New commits: commit 4bb6533d398cc76d7ff292a9e47dae87fac74f83 Author: Luboš Luňák AuthorDate: Thu Oct 7 18:02:12 2021 +0200 Commit: Luboš Luňák CommitDate: Mon Oct 25 19:30:34 2021 +0200 use pull model also for LOK text selection Make LOK_CALLBACK_TEXT_SELECTION, LOK_CALLBACK_TEXT_SELECTION_START, LOK_CALLBACK_TEXT_SELECTION_END and LOK_CALLBACK_TEXT_VIEW_SELECTION also use pull model, i.e. LO core will only set a flag and when CallbackFlushHandler needs the actual data it'll use getLOKPayload(). This again avoids a large number of messages passed to CallbackFlushHandler only for them to be sooner or later discarded. Change-Id: Ia7528039be996a6e9e8491b4eba3f4133582fa56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124146 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index cfa8e039a5d0..1144a5e48369 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1545,6 +1545,7 @@ void DesktopLOKTest::testNotificationCompression() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, ""); // 0 handler->queue(LOK_CALLBACK_TEXT_SELECTION, "15, 25, 15, 10"); // Superseded. @@ -1640,6 +1641,7 @@ void DesktopLOKTest::testTileInvalidationCompression() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); @@ -1660,6 +1662,7 @@ void DesktopLOKTest::testTileInvalidationCompression() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1"); // Different part @@ -1683,6 +1686,7 @@ void DesktopLOKTest::testTileInvalidationCompression() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); // 0 handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1"); // 1: Different part @@ -1709,6 +1713,7 @@ void DesktopLOKTest::testTileInvalidationCompression() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 0"); // 0 handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 100, 100, 1"); // 1: Different part @@ -1744,6 +1749,7 @@ void DesktopLOKTest::testTileInvalidationCompression() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "EMPTY, 0"); @@ -1768,6 +1774,7 @@ void DesktopLOKTest::testPartInInvalidation() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10"); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "20, 10, 20, 10"); @@ -1783,6 +1790,7 @@ void DesktopLOKTest::testPartInInvalidation() { std::vector> notifs; std::unique_ptr handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, )); +handler->setViewId(SfxLokHelper::getView()); handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10");
[Libreoffice-commits] core.git: desktop/qa include/tools sc/source tools/qa tools/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 include/tools/json_writer.hxx | 20 sc/source/ui/view/tabview.cxx |4 - tools/qa/cppunit/test_json_writer.cxx |3 - tools/source/misc/json_writer.cxx | 63 +++- 5 files changed, 22 insertions(+), 70 deletions(-) New commits: commit 03c474c640d63f54d520712693e2f47976d8d531 Author: Mike Kaganski AuthorDate: Wed Oct 13 11:59:29 2021 +0300 Commit: Mike Kaganski CommitDate: Wed Oct 13 17:39:32 2021 +0200 Unify JsonWriter::put and putRaw a bit In the process, it turned out that there was unnecessary conversion of OStringBuffer to OString and back to OStringBuffer when using putRaw, which is avoided now. Change-Id: I1e3ee685679df0b025bee8f4430624ee5bc9ccb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123547 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d827124a4e52..389ae7af74af 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2356,7 +2356,7 @@ void DesktopLOKTest::testCommentsCallbacksWriter() namespace { -void addParameter(tools::JsonWriter& rJson, const char* sName, OString const & type, OString const & value) +void addParameter(tools::JsonWriter& rJson, const char* sName, std::string_view type, std::string_view value) { auto testNode = rJson.startNode(sName); rJson.put("type", type); diff --git a/include/tools/json_writer.hxx b/include/tools/json_writer.hxx index fb40e1920314..45df53c61c5f 100644 --- a/include/tools/json_writer.hxx +++ b/include/tools/json_writer.hxx @@ -8,13 +8,15 @@ */ #pragma once +#include + #include +#include #include +#include -namespace rtl -{ -class OStringBuffer; -} +#include +#include /** Simple JSON encoder designed specifically for LibreOfficeKit purposes. * @@ -49,11 +51,11 @@ public: [[nodiscard]] ScopedJsonWriterStruct startStruct(); void put(const char* pPropName, const OUString& rPropValue); -void put(const char* pPropName, const OString& rPropValue); -void put(const char* pPropName, const char* pPropVal); -void put(const char* pPropName, const std::string& rPropValue) +// Assumes utf-8 property value encoding +void put(const char* pPropName, std::string_view rPropValue); +void put(const char* pPropName, const char* pPropVal) { -put(pPropName, rPropValue.data()); +put(pPropName, std::string_view(pPropVal)); } void put(const char* pPropName, sal_uInt16 nPropVal) { put(pPropName, sal_Int64(nPropVal)); } @@ -67,7 +69,7 @@ public: void putSimpleValue(const OUString& rPropValue); /// This assumes that this data belongs at this point in the stream, and is valid, and properly encoded -void putRaw(const rtl::OStringBuffer&); +void putRaw(std::string_view); /** Hands ownership of the underlying storage buffer to the caller, * after this no more document modifications may be written. */ diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 1315b2d88214..8d8412d3673e 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2720,7 +2720,7 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J if (nRowGroupDepth > 0) { aRowGroupsBuffer.append(",\n"); -rJsonWriter.putRaw(aRowGroupsBuffer.getStr()); +rJsonWriter.putRaw(aRowGroupsBuffer); } /// end collecting ROWS @@ -2815,7 +2815,7 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J if (nColGroupDepth > 0) { aColGroupsBuffer.append(",\n"); -rJsonWriter.putRaw(aColGroupsBuffer.getStr()); +rJsonWriter.putRaw(aColGroupsBuffer); } /// end collecting COLs diff --git a/tools/qa/cppunit/test_json_writer.cxx b/tools/qa/cppunit/test_json_writer.cxx index d5c037801067..fe3019e91b0a 100644 --- a/tools/qa/cppunit/test_json_writer.cxx +++ b/tools/qa/cppunit/test_json_writer.cxx @@ -46,14 +46,13 @@ void JsonWriterTest::test1() { auto testNode = aJson.startNode("node"); aJson.put("oustring", OUString("val1")); -aJson.put("ostring", OString("val2")); aJson.put("charptr", "val3"); aJson.put("int", static_cast(12)); } std::unique_ptr result(aJson.extractData()); -CPPUNIT_ASSERT_EQUAL(std::string("{ \"node\": { \"oustring\": \"val1\", \"ostring\": \"val2\", " +CPPUNIT_ASSERT_EQUAL(std::string("{ \"node\": { \"oustring\": \"val1\", " "\"charptr\": \"val3\", \"int\": 12}}"), std::string(result.get())); } diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index
[Libreoffice-commits] core.git: desktop/qa sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- sw/source/uibase/utlui/content.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 84e61754bfe2f07de412c24513774900702a48a2 Author: Andrea Gelmini AuthorDate: Wed Sep 22 22:10:23 2021 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Thu Sep 23 05:29:21 2021 +0200 Fix typos Change-Id: I01c46b864e296d4094f0a1579fdc64066eacc386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122496 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 680e48228d10..d827124a4e52 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3299,7 +3299,7 @@ void DesktopLOKTest::testMultiViewTableSelection() Scheduler::ProcessEventsToIdle(); // View1 should not get any table selection messages. CPPUNIT_ASSERT_EQUAL(0, aView1.m_nTableSelectionCount); -// View2 will first get table selection of Table1, then emty selection, and finally on 7th down arrow keypress, +// View2 will first get table selection of Table1, then empty selection, and finally on 7th down arrow keypress, // it will get table-selection of Table2. So in total it should get 3 table selections. CPPUNIT_ASSERT_EQUAL(3, aView2.m_nTableSelectionCount); CPPUNIT_ASSERT(!aView2.m_bEmptyTableSelection); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index fb8667ead94a..ff17d753e13e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3406,7 +3406,7 @@ void SwContentTree::UpdateTracking() m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), aContentAtPos) && !(m_bIsRoot && m_nRootType != ContentTypeId::URLFIELD)) { -// Because hyperlink item names do not need to be unique, finding the corrosponding item +// Because hyperlink item names do not need to be unique, finding the corresponding item // in the tree by name may result in incorrect selection. Find the item in the tree by // comparing the SwTextINetFormat pointer at the document cursor position to that stored // in the item SwURLFieldContent.
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/data/table-selection.odt |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 121 2 files changed, 121 insertions(+) New commits: commit ba0851926a9def7577dcf7b29919de0632ac31a9 Author: Dennis Francis AuthorDate: Mon Jun 28 13:32:48 2021 +0530 Commit: Dennis Francis CommitDate: Wed Sep 22 09:12:53 2021 +0200 lok-desktop: unit tests for LOK_CALLBACK_TABLE_SELECTED Conflicts: desktop/qa/desktop_lib/test_desktop_lib.cxx Change-Id: I4e07ffc6f8eebbbee284d19cd9c77df13dddff3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118945 Tested-by: Jenkins CollaboraOffice Reviewed-by: Dennis Francis (cherry picked from commit 56795f50abad3de960f23e85b2ccfa1ba0181370) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122415 Tested-by: Jenkins diff --git a/desktop/qa/data/table-selection.odt b/desktop/qa/data/table-selection.odt new file mode 100644 index ..c19f8c79fc3a Binary files /dev/null and b/desktop/qa/data/table-selection.odt differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c593eca12562..680e48228d10 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -209,6 +209,8 @@ public: void testJumpCursor(); void testRenderSearchResult_WriterNode(); void testRenderSearchResult_CommonNode(); +void testNoDuplicateTableSelection(); +void testMultiViewTableSelection(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -274,6 +276,8 @@ public: CPPUNIT_TEST(testJumpCursor); CPPUNIT_TEST(testRenderSearchResult_WriterNode); CPPUNIT_TEST(testRenderSearchResult_CommonNode); +CPPUNIT_TEST(testNoDuplicateTableSelection); +CPPUNIT_TEST(testMultiViewTableSelection); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -1953,6 +1957,8 @@ class ViewCallback int mnView; public: OString m_aCellFormula; +int m_nTableSelectionCount; +bool m_bEmptyTableSelection; bool m_bTilesInvalidated; bool m_bZeroCursor; tools::Rectangle m_aOwnCursor; @@ -1962,6 +1968,8 @@ public: ViewCallback(LibLODocument_Impl* pDocument) : mpDocument(pDocument), + m_nTableSelectionCount(0), + m_bEmptyTableSelection(false), m_bTilesInvalidated(false), m_bZeroCursor(false) { @@ -2029,6 +2037,12 @@ public: m_aCellFormula = aPayload; } break; +case LOK_CALLBACK_TABLE_SELECTED: +{ +m_bEmptyTableSelection = (std::string(pPayload).compare("{ }") == 0); +++m_nTableSelectionCount; +} +break; } } }; @@ -3199,6 +3213,113 @@ void DesktopLOKTest::testRenderSearchResult_CommonNode() std::free(pBuffer); } +static void lcl_repeatKeyStroke(LibLODocument_Impl *pDocument, int nCharCode, int nKeyCode, size_t nCount) +{ +for (size_t nCtr = 0; nCtr < nCount; ++nCtr) +{ +pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, nCharCode, nKeyCode); +pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, nCharCode, nKeyCode); +} +} + +void DesktopLOKTest::testNoDuplicateTableSelection() +{ +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("table-selection.odt"); + +// Create view 1. +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +ViewCallback aView1(pDocument); + +lcl_repeatKeyStroke(pDocument, 0, KEY_DOWN, 1); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(1, aView1.m_nTableSelectionCount); +CPPUNIT_ASSERT(aView1.m_bEmptyTableSelection); + +aView1.m_nTableSelectionCount = 0; +// Go to Table1. +lcl_repeatKeyStroke(pDocument, 0, KEY_DOWN, 1); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(1, aView1.m_nTableSelectionCount); +CPPUNIT_ASSERT(!aView1.m_bEmptyTableSelection); + +aView1.m_nTableSelectionCount = 0; +// Move to the last row in Table1. +lcl_repeatKeyStroke(pDocument, 0, KEY_DOWN, 2); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(0, aView1.m_nTableSelectionCount); + +// Go outside Table1. +lcl_repeatKeyStroke(pDocument, 0, KEY_DOWN, 1); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(1, aView1.m_nTableSelectionCount); +CPPUNIT_ASSERT(aView1.m_bEmptyTableSelection); +} + +void DesktopLOKTest::testMultiViewTableSelection() +{ +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("table-selection.odt"); + +// Create view 1. +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +ViewCallback aView1(pDocument); +int nView1 = pDocument->m_pDocumentClass->getView(pDocument); + +// Create view 2. +
[Libreoffice-commits] core.git: desktop/qa sw/qa sw/source
desktop/qa/data/SearchIndexResultShapeTest.odt|binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 53 -- sw/qa/extras/indexing/SearchResultLocatorTest.cxx | 16 +++--- sw/source/core/model/SearchResultLocator.cxx |3 - 4 files changed, 59 insertions(+), 13 deletions(-) New commits: commit 160b6db92cc94f2ec2447ae0e9c60c8c9dcf3bad Author: Tomaž Vajngerl AuthorDate: Wed Sep 8 16:34:42 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Sep 8 15:18:52 2021 +0200 indexing: fix correct size and pos. for shapes + more tests Determining the position and size of the shapes (SdrObjects) was wrong as the assumption was the values are in Hmm but were in twips. Added some more tests that check rendering of SdrObjects. Change-Id: I6ef9287892d1774a1243118a5c97f58384bcfd68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121801 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/data/SearchIndexResultShapeTest.odt b/desktop/qa/data/SearchIndexResultShapeTest.odt new file mode 100644 index ..4298eb8ad06e Binary files /dev/null and b/desktop/qa/data/SearchIndexResultShapeTest.odt differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 28a5e76a6e1e..c593eca12562 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -207,7 +207,8 @@ public: void testMetricField(); void testMultiDocuments(); void testJumpCursor(); -void testRenderSearchResult(); +void testRenderSearchResult_WriterNode(); +void testRenderSearchResult_CommonNode(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -271,7 +272,8 @@ public: CPPUNIT_TEST(testMetricField); CPPUNIT_TEST(testMultiDocuments); CPPUNIT_TEST(testJumpCursor); -CPPUNIT_TEST(testRenderSearchResult); +CPPUNIT_TEST(testRenderSearchResult_WriterNode); +CPPUNIT_TEST(testRenderSearchResult_CommonNode); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -3107,7 +3109,7 @@ void DesktopLOKTest::testJumpCursor() comphelper::LibreOfficeKit::setTiledAnnotations(true); } -void DesktopLOKTest::testRenderSearchResult() +void DesktopLOKTest::testRenderSearchResult_WriterNode() { constexpr const bool bDumpBitmap = false; @@ -3152,6 +3154,51 @@ void DesktopLOKTest::testRenderSearchResult() std::free(pBuffer); } +void DesktopLOKTest::testRenderSearchResult_CommonNode() +{ +constexpr const bool bDumpBitmap = false; + +LibLODocument_Impl* pDocument = loadDoc("SearchIndexResultShapeTest.odt"); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + +Scheduler::ProcessEventsToIdle(); + +unsigned char* pBuffer = nullptr; +OString aPayload = +"" +"" +""; + +int nWidth = 0; +int nHeight = 0; +size_t nByteSize = 0; + +bool bResult = pDocument->m_pDocumentClass->renderSearchResult(pDocument, aPayload.getStr(), , , , ); + +CPPUNIT_ASSERT(bResult); +CPPUNIT_ASSERT(pBuffer); + +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(192, nWidth); +CPPUNIT_ASSERT_EQUAL(96, nHeight); +CPPUNIT_ASSERT_EQUAL(size_t(73728), nByteSize); + +const sal_uInt8* pD = reinterpret_cast(pBuffer); +BitmapEx aBitmap = vcl::bitmap::CreateFromData(pD, nWidth, nHeight, nWidth * 4, vcl::PixelFormat::N32_BPP, true, true); + +if (bDumpBitmap) +{ +SvFileStream aStream("~/SearchResultBitmap.png", StreamMode::WRITE | StreamMode::TRUNC); +vcl::PNGWriter aPNGWriter(aBitmap); +aPNGWriter.Write(aStream); +} +CPPUNIT_ASSERT_EQUAL(tools::Long(192), aBitmap.GetSizePixel().Width()); +CPPUNIT_ASSERT_EQUAL(tools::Long(96), aBitmap.GetSizePixel().Height()); + +std::free(pBuffer); +} + namespace { constexpr size_t classOffset(int i) diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 08d074bb86f8..586c07b1e534 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -155,11 +155,11 @@ void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() // inconsistent results #if !defined(_WIN32) && !defined(MACOSX) auto aRectangle = aResult.maRectangles[0]; -CPPUNIT_ASSERT_DOUBLES_EQUAL(1478.0, aRectangle.getMinX(), 1e-4); -CPPUNIT_ASSERT_DOUBLES_EQUAL(3223.0, aRectangle.getMinY(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(2607.0, aRectangle.getMinX(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(5685.0, aRectangle.getMinY(), 1e-4); -CPPUNIT_ASSERT_DOUBLES_EQUAL(2059.0, aRectangle.getWidth(), 1e-4); -CPPUNIT_ASSERT_DOUBLES_EQUAL(2059.0, aRectangle.getHeight(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(3631.0, aRectangle.getWidth(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(3631.0,
[Libreoffice-commits] core.git: desktop/qa sw/qa sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 - sw/qa/extras/indexing/IndexingExportTest.cxx | 34 +- sw/qa/extras/indexing/SearchResultLocatorTest.cxx |6 +-- sw/source/core/inc/SearchResultLocator.hxx|2 - sw/source/core/model/SearchResultLocator.cxx | 24 +++ sw/source/filter/indexing/IndexingExport.cxx | 14 - 6 files changed, 51 insertions(+), 31 deletions(-) New commits: commit 83da70de985e1f9f7193676bef8dc71226803bb0 Author: Tomaž Vajngerl AuthorDate: Tue Sep 7 15:40:42 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Wed Sep 8 06:58:07 2021 +0200 indexing: rename "type" for prargraph an object nodes They are conflicting, so rename the one for paragraphs to "node_type and the one for objects to "object_type". This needs adusting all the tests. Also change the node_type from numerical value (correcponding to a enum) to string based - "writer" or "commom" values. Change-Id: I0465cd4c2c6989e436d5a675db20c87066d19208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121743 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 85e09ab13a51..28a5e76a6e1e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3119,7 +3119,7 @@ void DesktopLOKTest::testRenderSearchResult() unsigned char* pBuffer = nullptr; OString aPayload = "" -"ABC" +"ABC" ""; int nWidth = 0; diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx index 9d40d887f30d..c08cdcd282c9 100644 --- a/sw/qa/extras/indexing/IndexingExportTest.cxx +++ b/sw/qa/extras/indexing/IndexingExportTest.cxx @@ -74,7 +74,7 @@ void IndexingExportTest::testIndexingExport_Paragraphs() assertXPath(pXmlDoc, "/indexing"); assertXPathContent(pXmlDoc, "/indexing/paragraph[1]", "Title"); -assertXPath(pXmlDoc, "/indexing/paragraph[1]", "type", "1"); +assertXPath(pXmlDoc, "/indexing/paragraph[1]", "node_type", "writer"); assertXPathContent(pXmlDoc, "/indexing/paragraph[2]", "Heading 1"); assertXPathContent(pXmlDoc, "/indexing/paragraph[3]", "Heading 2"); assertXPathContent(pXmlDoc, "/indexing/paragraph[4]", "Paragraph 1"); @@ -91,6 +91,7 @@ void IndexingExportTest::testIndexingExport_Paragraphs() assertXPathContent(pXmlDoc, "/indexing/paragraph[15]", "Center"); assertXPathContent(pXmlDoc, "/indexing/paragraph[16]", "Right"); assertXPathContent(pXmlDoc, "/indexing/paragraph[17]", "Bold Italic Underline Strikeout"); +assertXPath(pXmlDoc, "/indexing/paragraph[17]", "node_type", "writer"); } void IndexingExportTest::testIndexingExport_Images() @@ -109,10 +110,10 @@ void IndexingExportTest::testIndexingExport_Images() assertXPath(pXmlDoc, "/indexing"); assertXPath(pXmlDoc, "/indexing/object[1]", "alt", "Image_NonCaption - Alternative text"); assertXPath(pXmlDoc, "/indexing/object[1]", "name", "Image_NonCaption"); -assertXPath(pXmlDoc, "/indexing/object[1]", "type", "graphic"); +assertXPath(pXmlDoc, "/indexing/object[1]", "object_type", "graphic"); assertXPath(pXmlDoc, "/indexing/object[2]", "alt", "Image_InCaption - Alternative text"); assertXPath(pXmlDoc, "/indexing/object[2]", "name", "Image_InCaption"); -assertXPath(pXmlDoc, "/indexing/object[2]", "type", "graphic"); +assertXPath(pXmlDoc, "/indexing/object[2]", "object_type", "graphic"); } void IndexingExportTest::testIndexingExport_OLE() @@ -131,7 +132,7 @@ void IndexingExportTest::testIndexingExport_OLE() assertXPath(pXmlDoc, "/indexing"); assertXPath(pXmlDoc, "/indexing/object[1]", "name", "Object - Chart"); assertXPath(pXmlDoc, "/indexing/object[1]", "alt", "Alt Text"); -assertXPath(pXmlDoc, "/indexing/object[1]", "type", "ole"); +assertXPath(pXmlDoc, "/indexing/object[1]", "object_type", "ole"); } void IndexingExportTest::testIndexingExport_Shapes() @@ -149,21 +150,28 @@ void IndexingExportTest::testIndexingExport_Shapes() assertXPath(pXmlDoc, "/indexing"); assertXPathContent(pXmlDoc, "/indexing/paragraph[1]", "Drawing : Just a Diamond"); +assertXPath(pXmlDoc, "/indexing/paragraph[1]", "node_type", "writer"); assertXPath(pXmlDoc, "/indexing/object[1]", "name", "Circle"); -assertXPath(pXmlDoc, "/indexing/object[1]", "type", "shape"); +assertXPath(pXmlDoc, "/indexing/object[1]", "object_type", "shape"); assertXPathContent(pXmlDoc, "/indexing/paragraph[2]", "This is a circle"); +assertXPath(pXmlDoc, "/indexing/paragraph[2]", "node_type", "common"); assertXPathContent(pXmlDoc, "/indexing/paragraph[3]", "This is a second paragraph"); +assertXPath(pXmlDoc, "/indexing/paragraph[3]", "node_type", "common"); assertXPath(pXmlDoc,
[Libreoffice-commits] core.git: desktop/qa sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |7 ++-- sw/source/uibase/uno/unotxdoc.cxx | 49 2 files changed, 40 insertions(+), 16 deletions(-) New commits: commit 7da5537f6a43c1b82afc5e0c8d18b8d847293fda Author: Tomaž Vajngerl AuthorDate: Mon Aug 2 22:27:28 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Aug 10 08:32:57 2021 +0200 indexing: use XML as input that is identical to indexing XML Change-Id: I2242b4bd77220b55e67c2e0f0fe54f008759d282 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120194 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index f23f9709416e..dc8b4caf1de4 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3117,13 +3117,16 @@ void DesktopLOKTest::testRenderSearchResult() Scheduler::ProcessEventsToIdle(); unsigned char* pBuffer = nullptr; -OString aJSON = "{ \"type\" : 1, \"node_index\" : 19 }"; +OString aPayload = +"" +"ABC" +""; int nWidth = 0; int nHeight = 0; size_t nByteSize = 0; -bool bResult = pDocument->m_pDocumentClass->renderSearchResult(pDocument, aJSON.getStr(), , , , ); +bool bResult = pDocument->m_pDocumentClass->renderSearchResult(pDocument, aPayload.getStr(), , , , ); CPPUNIT_ASSERT(bResult); CPPUNIT_ASSERT(pBuffer); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2940c52b8256..51dfac84254c 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -122,7 +122,6 @@ #include #include - #include #include @@ -164,7 +163,7 @@ #include #include -#include +#include #define TWIPS_PER_PIXEL 15 @@ -3397,23 +3396,45 @@ SwXTextDocument::getSearchResultRectangles(const char* pPayload) { std::vector aRectangles; -boost::property_tree::ptree aTree; -std::stringstream aStream(pPayload); -boost::property_tree::read_json(aStream, aTree); +const OString aPayloadString(pPayload); -sw::search::SearchIndexData aData; +SvMemoryStream aStream(const_cast(aPayloadString.getStr()), aPayloadString.getLength(), StreamMode::READ); +tools::XmlWalker aWalker; +if (!aWalker.open()) +return aRectangles; -int nType = aTree.get("type"); +if (aWalker.name() == "indexing") +{ +SwDoc* pDoc = m_pDocShell->GetDoc(); -aData.nNodeIndex = sal_uInt32(aTree.get("node_index")); -aData.eType = sw::search::NodeType(nType); +sw::search::SearchIndexData aData; -SwDoc* pDoc = m_pDocShell->GetDoc(); +aWalker.children(); +while (aWalker.isValid()) +{ +if (aWalker.name() == "paragraph") +{ +OString sType = aWalker.attribute("type"); +OString sIndex = aWalker.attribute("index"); + +if (!sType.isEmpty() && !sIndex.isEmpty()) +{ +aData.nNodeIndex = sIndex.toInt32(); +aData.eType = sw::search::NodeType(sType.toInt32()); -sw::search::SearchResultLocator aLocator(pDoc); -sw::search::LocationResult aResult = aLocator.find(aData); -if (aResult.mbFound) -aRectangles = aResult.maRectangles; +sw::search::SearchResultLocator aLocator(pDoc); +sw::search::LocationResult aResult = aLocator.find(aData); +if (aResult.mbFound) +{ +for (auto const & rRect : aResult.maRectangles) +aRectangles.push_back(rRect); +} +} +} +aWalker.next(); +} +aWalker.parent(); +} return aRectangles; }
[Libreoffice-commits] core.git: desktop/qa sw/qa sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 sw/qa/extras/indexing/SearchResultLocatorTest.cxx | 50 + sw/source/core/inc/SearchResultLocator.hxx| 13 +++- sw/source/core/model/SearchResultLocator.cxx | 62 +- sw/source/uibase/uno/unotxdoc.cxx |9 ++- 5 files changed, 105 insertions(+), 31 deletions(-) New commits: commit ea1818b8ba34378b777b8706069d28fade2cc924 Author: Tomaž Vajngerl AuthorDate: Fri Jul 9 19:36:58 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Aug 10 07:54:06 2021 +0200 indexing: add support for SdrObjects in SearchResultLocator Also add (node) "type" parameter because we need to differentiate between Writer nodes and SdrObject nodes. Change-Id: I590695ae71781f64c22bdd7e1df01d69e3376e67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118671 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 927f24fa26ca..f23f9709416e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -3117,7 +3117,7 @@ void DesktopLOKTest::testRenderSearchResult() Scheduler::ProcessEventsToIdle(); unsigned char* pBuffer = nullptr; -OString aJSON = "{ \"node_index\" : 19 }"; +OString aJSON = "{ \"type\" : 1, \"node_index\" : 19 }"; int nWidth = 0; int nHeight = 0; diff --git a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx index 9b8474911fbd..99f33422a065 100644 --- a/sw/qa/extras/indexing/SearchResultLocatorTest.cxx +++ b/sw/qa/extras/indexing/SearchResultLocatorTest.cxx @@ -17,27 +17,24 @@ namespace { -#if !defined MACOSX constexpr OUStringLiteral DATA_DIRECTORY = u"sw/qa/extras/indexing/data/"; -#endif } class SearchResultLocatorTest : public SwModelTestBase { private: -#if !defined MACOSX SwDoc* createDoc(const char* pName = nullptr); -#endif public: void testSearchResultLocator(); +void testSearchResultLocatorForSdrObjects(); CPPUNIT_TEST_SUITE(SearchResultLocatorTest); CPPUNIT_TEST(testSearchResultLocator); +CPPUNIT_TEST(testSearchResultLocatorForSdrObjects); CPPUNIT_TEST_SUITE_END(); }; -#if !defined MACOSX SwDoc* SearchResultLocatorTest::createDoc(const char* pName) { if (!pName) @@ -49,25 +46,27 @@ SwDoc* SearchResultLocatorTest::createDoc(const char* pName) CPPUNIT_ASSERT(pTextDoc); return pTextDoc->GetDocShell()->GetDoc(); } -#endif void SearchResultLocatorTest::testSearchResultLocator() { -#if !defined(_WIN32) && !defined(MACOSX) if (!IsDefaultDPI()) return; SwDoc* pDoc = createDoc("IndexingExport_VariousParagraphs.odt"); CPPUNIT_ASSERT(pDoc); -sw::SearchResultLocator aLocator(pDoc); -sw::SearchIndexData aData; +sw::search::SearchResultLocator aLocator(pDoc); +sw::search::SearchIndexData aData; +aData.eType = sw::search::NodeType::WriterNode; aData.nNodeIndex = 14; -sw::LocationResult aResult = aLocator.find(aData); +sw::search::LocationResult aResult = aLocator.find(aData); CPPUNIT_ASSERT_EQUAL(size_t(1), aResult.maRectangles.size()); -auto aRectangle = aResult.maRectangles[0]; +// skip asserting exact values for macOS and Windows because of +// inconsistent results +#if !defined(_WIN32) && !defined(MACOSX) +auto aRectangle = aResult.maRectangles[0]; CPPUNIT_ASSERT_DOUBLES_EQUAL(1418.0, aRectangle.getMinX(), 1e-4); CPPUNIT_ASSERT_DOUBLES_EQUAL(.0, aRectangle.getMinY(), 1e-4); @@ -76,6 +75,35 @@ void SearchResultLocatorTest::testSearchResultLocator() #endif } +void SearchResultLocatorTest::testSearchResultLocatorForSdrObjects() +{ +if (!IsDefaultDPI()) +return; + +SwDoc* pDoc = createDoc("IndexingExport_Shapes.odt"); +CPPUNIT_ASSERT(pDoc); + +sw::search::SearchResultLocator aLocator(pDoc); +sw::search::SearchIndexData aData; +aData.eType = sw::search::NodeType::SdrObject; +aData.aObjectName = u"Circle"; +aData.nNodeIndex = 1; + +sw::search::LocationResult aResult = aLocator.find(aData); +CPPUNIT_ASSERT_EQUAL(size_t(1), aResult.maRectangles.size()); + +// skip asserting exact values for macOS and Windows because of +// inconsistent results +#if !defined(_WIN32) && !defined(MACOSX) +auto aRectangle = aResult.maRectangles[0]; +CPPUNIT_ASSERT_DOUBLES_EQUAL(1478.0, aRectangle.getMinX(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(3223.0, aRectangle.getMinY(), 1e-4); + +CPPUNIT_ASSERT_DOUBLES_EQUAL(2059.0, aRectangle.getWidth(), 1e-4); +CPPUNIT_ASSERT_DOUBLES_EQUAL(2059.0, aRectangle.getHeight(), 1e-4); +#endif +} + CPPUNIT_TEST_SUITE_REGISTRATION(SearchResultLocatorTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git
[Libreoffice-commits] core.git: desktop/qa icon-themes/breeze icon-themes/breeze_dark icon-themes/colibre icon-themes/elementary icon-themes/karasa_jaga icon-themes/sifr icon-themes/sifr_dark icon-the
desktop/qa/desktop_lib/test_desktop_lib.cxx | 2 icon-themes/breeze/links.txt| 6 - icon-themes/breeze_dark/links.txt | 6 - icon-themes/colibre/links.txt | 6 - icon-themes/elementary/links.txt| 11 -- icon-themes/karasa_jaga/links.txt | 6 - icon-themes/sifr/links.txt | 6 - icon-themes/sifr_dark/links.txt | 6 - icon-themes/sukapura/links.txt | 6 - officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 16 sc/inc/sc.hrc | 4 - sc/sdi/drawsh.sdi | 5 - sc/sdi/scalc.sdi| 37 -- sc/source/ui/drawfunc/drawsh.cxx| 23 +- sc/source/ui/drawfunc/drawsh2.cxx | 11 +- sc/uiconfig/scalc/popupmenu/draw.xml| 6 + sc/uiconfig/scalc/popupmenu/graphic.xml | 5 - sc/uiconfig/scalc/popupmenu/media.xml | 5 - sc/uiconfig/scalc/ui/notebookbar.ui | 16 ++-- sc/uiconfig/scalc/ui/notebookbar_compact.ui | 16 ++-- sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui | 8 +- sc/uiconfig/scalc/ui/notebookbar_groupedbar_full.ui | 8 +- sd/uiconfig/sdraw/ui/notebookbar_compact.ui | 8 +- sd/uiconfig/simpress/ui/notebookbar_compact.ui | 8 +- sw/uiconfig/swriter/ui/notebookbar_compact.ui | 8 +- test/user-template/user/config/soffice.cfg/modules/scalc/popupmenu/draw.xml | 4 - 26 files changed, 78 insertions(+), 165 deletions(-) New commits: commit fe0c93b7526ba6bab98d3f12f16c0b863a82fa9c Author: Samuel Mehrbrodt AuthorDate: Thu Aug 5 09:53:56 2021 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Aug 5 10:52:03 2021 +0200 No need for extra uno commands for shape hyperlinks Change-Id: Ibf5987f543d4e1a767a7a5ae6a855f7eb883bfae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120056 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index dfbee77167b8..927f24fa26ca 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1296,7 +1296,7 @@ void DesktopLOKTest::testContextMenuCalc() // Remove hyperlink is disabled { -boost::optional aMenuItem = getContextMenuItem(aMenu.get(), ".uno:DeleteShapeHyperlink"); +boost::optional aMenuItem = getContextMenuItem(aMenu.get(), ".uno:RemoveHyperlink"); CPPUNIT_ASSERT(aMenuItem); boost::optional aEnabled = aMenuItem.get().get_child_optional("enabled"); diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt index f737e3e55cc4..be27fcf7f1ca 100644 --- a/icon-themes/breeze/links.txt +++ b/icon-themes/breeze/links.txt @@ -2846,22 +2846,16 @@ cmd/sc_namegroup.png cmd/sc_label.png # === cmd/32/convertmenu.png cmd/32/bezierconvert.png -cmd/32/deleteshapehyperlink.png cmd/32/removehyperlink.png -cmd/32/editshapehyperlink.png cmd/32/inserthyperlink.png cmd/32/mirrormenu.png cmd/32/rotateleft.png cmd/32/openhyperlinkoncursor.png cmd/32/inserthyperlink.png cmd/32/rotateflipmenu.png cmd/32/rotateleft.png cmd/lc_convertmenu.png cmd/lc_bezierconvert.png -cmd/lc_deleteshapehyperlink.png cmd/lc_removehyperlink.png -cmd/lc_editshapehyperlink.png cmd/lc_inserthyperlink.png cmd/lc_mirrormenu.png cmd/lc_rotateleft.png cmd/lc_openhyperlinkoncursor.png cmd/lc_inserthyperlink.png cmd/lc_rotateflipmenu.png cmd/lc_rotateleft.png cmd/sc_convertmenu.png cmd/sc_bezierconvert.png -cmd/sc_deleteshapehyperlink.png cmd/sc_removehyperlink.png -cmd/sc_editshapehyperlink.png cmd/sc_inserthyperlink.png cmd/sc_mirrormenu.png cmd/sc_rotateleft.png cmd/sc_openhyperlinkoncursor.png cmd/sc_inserthyperlink.png cmd/sc_rotateflipmenu.png cmd/sc_rotateleft.png diff --git a/icon-themes/breeze_dark/links.txt b/icon-themes/breeze_dark/links.txt index f737e3e55cc4..be27fcf7f1ca 100644 --- a/icon-themes/breeze_dark/links.txt +++ b/icon-themes/breeze_dark/links.txt @@ -2846,22 +2846,16 @@ cmd/sc_namegroup.png cmd/sc_label.png
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sw/inc sw/source
desktop/qa/data/SearchIndexResultTest.odt |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 49 +++- desktop/source/lib/init.cxx | 57 include/LibreOfficeKit/LibreOfficeKit.h |6 ++ include/LibreOfficeKit/LibreOfficeKit.hxx | 16 +++ include/vcl/ITiledRenderable.hxx|9 sw/inc/unotxdoc.hxx |3 + sw/source/uibase/uno/unotxdoc.cxx | 25 8 files changed, 164 insertions(+), 1 deletion(-) New commits: commit e1511ce551f27a5560600029193f076fd65ece17 Author: Tomaž Vajngerl AuthorDate: Fri Jul 9 14:41:21 2021 +0900 Commit: Tomaž Vajngerl CommitDate: Fri Jul 30 08:22:19 2021 +0200 indexing: add LOKit API to render the search result into a bitmap This adds a new LOKit API to render the search result into a bitmap buffer. It combines the SearchResultLocator to get the location inside the document of the search result (a series of rectangles) and the existing LOKit paintTile API to render the result into a bitmap (byte) buffer. It also adds a LOKit test to show how the API is used and to render a search result of a example document. Change-Id: I4284d90188777fd28158d029daa04151e71022bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118670 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/data/SearchIndexResultTest.odt b/desktop/qa/data/SearchIndexResultTest.odt new file mode 100644 index ..58ed3a0f5447 Binary files /dev/null and b/desktop/qa/data/SearchIndexResultTest.odt differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 2a26b04dcfa0..dfbee77167b8 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -59,6 +59,8 @@ #include #include +#include +#include #if USE_TLS_NSS #include @@ -205,6 +207,7 @@ public: void testMetricField(); void testMultiDocuments(); void testJumpCursor(); +void testRenderSearchResult(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -268,6 +271,7 @@ public: CPPUNIT_TEST(testMetricField); CPPUNIT_TEST(testMultiDocuments); CPPUNIT_TEST(testJumpCursor); +CPPUNIT_TEST(testRenderSearchResult); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -3103,6 +3107,48 @@ void DesktopLOKTest::testJumpCursor() comphelper::LibreOfficeKit::setTiledAnnotations(true); } +void DesktopLOKTest::testRenderSearchResult() +{ +constexpr const bool bDumpBitmap = false; + +LibLODocument_Impl* pDocument = loadDoc("SearchIndexResultTest.odt"); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + +Scheduler::ProcessEventsToIdle(); + +unsigned char* pBuffer = nullptr; +OString aJSON = "{ \"node_index\" : 19 }"; + +int nWidth = 0; +int nHeight = 0; +size_t nByteSize = 0; + +bool bResult = pDocument->m_pDocumentClass->renderSearchResult(pDocument, aJSON.getStr(), , , , ); + +CPPUNIT_ASSERT(bResult); +CPPUNIT_ASSERT(pBuffer); + +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(642, nWidth); +CPPUNIT_ASSERT_EQUAL(561, nHeight); +CPPUNIT_ASSERT_EQUAL(size_t(1440648), nByteSize); + +const sal_uInt8* pD = reinterpret_cast(pBuffer); +BitmapEx aBitmap = vcl::bitmap::CreateFromData(pD, nWidth, nHeight, nWidth * 4, vcl::PixelFormat::N32_BPP, true, true); + +if (bDumpBitmap) +{ +SvFileStream aStream("~/SearchResultBitmap.png", StreamMode::WRITE | StreamMode::TRUNC); +vcl::PNGWriter aPNGWriter(aBitmap); +aPNGWriter.Write(aStream); +} +CPPUNIT_ASSERT_EQUAL(tools::Long(642), aBitmap.GetSizePixel().Width()); +CPPUNIT_ASSERT_EQUAL(tools::Long(561), aBitmap.GetSizePixel().Height()); + +std::free(pBuffer); +} + namespace { constexpr size_t classOffset(int i) @@ -3200,10 +3246,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), offsetof(struct _LibreOfficeKitDocumentClass, completeFunction)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), offsetof(struct _LibreOfficeKitDocumentClass, setWindowTextSelection)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), offsetof(struct _LibreOfficeKitDocumentClass, sendFormFieldEvent)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), offsetof(struct _LibreOfficeKitDocumentClass, renderSearchResult)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(63), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit d4661d66f5735a80613d5e7dcffdd01d7e18d896 Author: Noel Grandin AuthorDate: Sat May 22 13:24:41 2021 +0200 Commit: Noel Grandin CommitDate: Sat May 22 14:35:39 2021 +0200 fix leak in desktop test Change-Id: I6d6ae4a59777b17fda39b81ce867c2ee4a753a43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115986 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a165cf6e8652..13370261a0fc 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -478,6 +478,7 @@ void DesktopLOKTest::testGetStyles() CPPUNIT_FAIL("Unknown style family: " + rPair.first); } } +free(pJSON); } void DesktopLOKTest::testGetFonts() @@ -1031,7 +1032,9 @@ void DesktopLOKTest::testSheetOperations() std::vector aExpected = { "FirstSheet", "Renamed", "Sheet3", "Sheet4", "Sheet5", "LastSheet" }; for (int i = 0; i < 6; ++i) { -CPPUNIT_ASSERT_EQUAL(aExpected[i], OString(pDocument->pClass->getPartName(pDocument, i))); +char* pPartName = pDocument->pClass->getPartName(pDocument, i); +CPPUNIT_ASSERT_EQUAL(aExpected[i], OString(pPartName)); +free(pPartName); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa sc/qa sfx2/qa sw/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |1 - sc/qa/extras/anchor.cxx |8 sc/qa/extras/regression-test.cxx|2 -- sc/qa/unit/scshapetest.cxx | 19 --- sfx2/qa/cppunit/test_misc.cxx |3 --- sw/qa/core/macros-test.cxx |1 - 6 files changed, 34 deletions(-) New commits: commit 993298cfff01e09142c98faf03c3dbb608369114 Author: dipanshu124 AuthorDate: Tue Mar 2 14:53:31 2021 +0530 Commit: Mike Kaganski CommitDate: Sun Mar 14 20:24:09 2021 +0100 tdf#139734 Drop redundant asserts after MacrosTest::loadFromDesktop MacrosTest::loadFromDesktop itself asserts on its return value. Thus, there additional checks in unit tests are redundant. Change-Id: Iec9be2293c6337fa747c78a0963e31aa99b60772 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111810 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 71ce50b5d301..b774c80a230b 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -330,7 +330,6 @@ DesktopLOKTest::loadDocUrlImpl(const OUString& rFileURL, LibreOfficeKitDocumentT static int nDocumentIdCounter = 0; SfxViewShell::SetCurrentDocId(ViewShellDocId(nDocumentIdCounter)); uno::Reference xComponent = loadFromDesktop(rFileURL, aService); -CPPUNIT_ASSERT(xComponent.is()); std::unique_ptr pDocument(new LibLODocument_Impl(xComponent, nDocumentIdCounter)); ++nDocumentIdCounter; diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx index 6fb801a6c6f5..347da5ec950f 100644 --- a/sc/qa/extras/anchor.cxx +++ b/sc/qa/extras/anchor.cxx @@ -68,7 +68,6 @@ void ScAnchorTest::testUndoAnchor() createFileURL(u"document_with_linked_graphic.ods", aFileURL); // open the document with graphic included uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Get the document model SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); @@ -200,7 +199,6 @@ void ScAnchorTest::testODFAnchorTypes() createFileURL(u"3AnchorTypes.ods", aFileURL); // open the document with graphic included uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Get the document model SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); @@ -245,7 +243,6 @@ void ScAnchorTest::testCopyColumnWithImages() createFileURL(u"3AnchorTypes.ods", aFileURL); // open the document with graphic included uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Get the document model SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); @@ -317,7 +314,6 @@ void ScAnchorTest::testCutWithImages() createFileURL(u"3AnchorTypes.ods", aFileURL); // open the document with graphic included uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Get the document model SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); @@ -375,7 +371,6 @@ void ScAnchorTest::testTdf121963() OUString aFileURL; createFileURL(u"tdf121963.ods", aFileURL); uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself. @@ -389,7 +384,6 @@ void ScAnchorTest::testTdf129552() OUString aFileURL; createFileURL(u"tdf129552.fods", aFileURL); uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself. @@ -403,7 +397,6 @@ void ScAnchorTest::testTdf130556() OUString aFileURL; createFileURL(u"tdf130556.ods", aFileURL); uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself. @@ -417,7 +410,6 @@ void ScAnchorTest::testTdf134161() OUString aFileURL; createFileURL(u"tdf134161.ods", aFileURL); uno::Reference xComponent = loadFromDesktop(aFileURL); -CPPUNIT_ASSERT(xComponent.is()); // Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop diff --git a/sc/qa/extras/regression-test.cxx
[Libreoffice-commits] core.git: desktop/qa solenv/clang-format solenv/sanitizers sw/inc sw/Library_sw.mk sw/qa sw/source sw/uiconfig sw/UIConfig_swriter.mk
desktop/qa/desktop_lib/test_desktop_lib.cxx | 36 solenv/clang-format/excludelist |3 solenv/sanitizers/ui/modules/swriter.suppr |1 sw/Library_sw.mk|2 sw/UIConfig_swriter.mk |2 sw/inc/AnnotationWin.hxx| 45 - sw/qa/uitest/writer_tests/comments.py | 12 sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py |5 sw/source/uibase/docvw/AnnotationMenuButton.cxx | 213 +--- sw/source/uibase/docvw/AnnotationMenuButton.hxx | 51 - sw/source/uibase/docvw/AnnotationWin.cxx| 83 - sw/source/uibase/docvw/AnnotationWin2.cxx | 696 sw/source/uibase/docvw/PostItMgr.cxx|5 sw/source/uibase/docvw/SidebarScrollBar.cxx | 73 - sw/source/uibase/docvw/SidebarScrollBar.hxx | 40 sw/source/uibase/docvw/SidebarTxtControl.cxx| 328 +++ sw/source/uibase/docvw/SidebarTxtControl.hxx| 49 - sw/source/uibase/docvw/SidebarTxtControlAcc.cxx | 271 -- sw/source/uibase/docvw/SidebarTxtControlAcc.hxx | 43 sw/uiconfig/swriter/ui/annotation.ui| 240 + sw/uiconfig/swriter/ui/annotationmenu.ui| 95 -- 21 files changed, 736 insertions(+), 1557 deletions(-) New commits: commit 69c546e1e7a697217f273baa7c1729ff823efd76 Author: Caolán McNamara AuthorDate: Fri Dec 4 16:30:31 2020 + Commit: Caolán McNamara CommitDate: Sat Feb 6 12:16:04 2021 +0100 weld annotation window note the labels in sw/uiconfig/swriter/ui/annotation.ui are deliberately yaligned to 0 to retain the preexisting SwAnnotationWin::PaintTile hack which depends on this for bin/run gtktiledviewer --enable-tiled-annotations to not show clipped author/date/etc labels Change-Id: I53827aa98ed4d71d532a5993d21c6e22190b8063 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107264 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8660906e5659..7a52bee8c6fa 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -172,7 +172,6 @@ public: void testTrackChanges(); void testRedlineCalc(); void testPaintPartTile(); -void testWriterCommentInsertCursor(); #if HAVE_MORE_FONTS void testGetFontSubset(); #endif @@ -234,7 +233,6 @@ public: CPPUNIT_TEST(testTrackChanges); CPPUNIT_TEST(testRedlineCalc); CPPUNIT_TEST(testPaintPartTile); -CPPUNIT_TEST(testWriterCommentInsertCursor); #if HAVE_MORE_FONTS CPPUNIT_TEST(testGetFontSubset); #endif @@ -2050,40 +2048,6 @@ void DesktopLOKTest::testPaintPartTile() //CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); } -void DesktopLOKTest::testWriterCommentInsertCursor() -{ -// Load a document and type a character into the body text of the second view. -LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); -pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -ViewCallback aView1(pDocument); -pDocument->m_pDocumentClass->createView(pDocument); -pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -ViewCallback aView2(pDocument); -pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0); -pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0); -Scheduler::ProcessEventsToIdle(); -tools::Rectangle aBodyCursor = aView2.m_aOwnCursor; - -// Now insert a comment and make sure that the comment's cursor is shown, -// not the body text's one. -aView1.m_aOwnCursor.SetEmpty(); -const int nCtrlAltC = KEY_MOD1 + KEY_MOD2 + 512 + 'c' - 'a'; -pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'c', nCtrlAltC); -pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'c', nCtrlAltC); -Scheduler::ProcessEventsToIdle(); -// Wait for SfxBindings to actually update the state, which updated the -// cursor as well. -osl::Thread::wait(std::chrono::seconds(1)); -Scheduler::ProcessEventsToIdle(); -// This failed: the body cursor was shown right after inserting a comment. -CPPUNIT_ASSERT(aView2.m_aOwnCursor.getX() > aBodyCursor.getX()); -// This failed, the first view's cursor also jumped when the second view -// inserted the comment. -CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty()); - -Scheduler::ProcessEventsToIdle(); -} - #if HAVE_MORE_FONTS void DesktopLOKTest::testGetFontSubset() { diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 25d5fe43d99f..4bda736c6736 100644 --- a/solenv/clang-format/excludelist +++
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 39 +++- 1 file changed, 38 insertions(+), 1 deletion(-) New commits: commit 033d732cf636aa4e81570864d40c541d7a1c6492 Author: Henry Castro AuthorDate: Fri Jan 15 16:13:29 2021 -0400 Commit: Henry Castro CommitDate: Thu Jan 21 12:50:13 2021 +0100 lok: unit test incorrect cursor position Test to not send client side cursor position (0,0) due to: mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) ); Change-Id: Ib5cd7f1c0c45073c5d2039e8b889d3a6fd7ef70c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109417 Tested-by: Jenkins CollaboraOffice Reviewed-by: Jan Holesovsky (cherry picked from commit 08d45119cfb875fa8a5c03d6e946a47f0f680932) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109733 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 99fba50f14bb..8660906e5659 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -199,6 +199,7 @@ public: void testControlState(); void testMetricField(); void testMultiDocuments(); +void testJumpCursor(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -262,6 +263,7 @@ public: CPPUNIT_TEST(testControlState); CPPUNIT_TEST(testMetricField); CPPUNIT_TEST(testMultiDocuments); +CPPUNIT_TEST(testJumpCursor); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -1926,6 +1928,7 @@ class ViewCallback public: OString m_aCellFormula; bool m_bTilesInvalidated; +bool m_bZeroCursor; tools::Rectangle m_aOwnCursor; boost::property_tree::ptree m_aCommentCallbackResult; boost::property_tree::ptree m_aCallbackWindowResult; @@ -1933,7 +1936,8 @@ public: ViewCallback(LibLODocument_Impl* pDocument) : mpDocument(pDocument), - m_bTilesInvalidated(false) + m_bTilesInvalidated(false), + m_bZeroCursor(false) { mnView = SfxLokHelper::getView(); mpDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, this); @@ -1970,6 +1974,9 @@ public: m_aOwnCursor.setY(aSeq[1].toInt32()); m_aOwnCursor.setWidth(aSeq[2].toInt32()); m_aOwnCursor.setHeight(aSeq[3].toInt32()); + +if (m_aOwnCursor.getX() == 0 && m_aOwnCursor.getY() == 0) +m_bZeroCursor = true; } break; case LOK_CALLBACK_COMMENT: @@ -3080,6 +3087,36 @@ void DesktopLOKTest::testMetricField() CPPUNIT_ASSERT_EQUAL(aMap["VALUE"], aRet["Value"]); } +void DesktopLOKTest::testJumpCursor() +{ +comphelper::LibreOfficeKit::setTiledAnnotations(false); + +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'B', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'o', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'l', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'i', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'v', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'i', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'a', 0); +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE); +Scheduler::ProcessEventsToIdle(); + +// There is a cursor jump to (0, 0) due to +// mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) ); +// when creating a comment +ViewCallback aView1(pDocument); + +pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT(!aView1.m_bZeroCursor); + +comphelper::LibreOfficeKit::setTiledAnnotations(true); +} + namespace { constexpr size_t classOffset(int i) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 30d2b76e0ed081bed545820e459af56e45fecbdd Author: Stephan Bergmann AuthorDate: Sun Dec 6 10:27:24 2020 +0100 Commit: Stephan Bergmann CommitDate: Sun Dec 6 13:20:35 2020 +0100 Directly check for nullptr ...instead of relying on the OString(pText) ctor's undocumented behavior of treating a null pText as an empty string Change-Id: I884c789b9b4c63bc1f013ed6bbf6c3ab9880f0e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107277 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 701f624038c5..8a5b3f54d81a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2738,7 +2738,7 @@ void DesktopLOKTest::testTextSelectionHandles() pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE); Scheduler::ProcessEventsToIdle(); pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); -CPPUNIT_ASSERT_EQUAL(OString(), OString(pText)); +CPPUNIT_ASSERT_EQUAL(static_cast(nullptr), pText); free(pText); CPPUNIT_ASSERT_EQUAL(OString(), m_aTextSelectionStart); CPPUNIT_ASSERT_EQUAL(OString(), m_aTextSelectionEnd); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 181 ++-- 1 file changed, 92 insertions(+), 89 deletions(-) New commits: commit cf09258fc3287b6299d07799dce22d9b9fd1ebb7 Author: Tor Lillqvist AuthorDate: Thu Sep 3 21:51:16 2020 +0300 Commit: Tor Lillqvist CommitDate: Sat Nov 21 23:20:23 2020 +0100 Test also that loading more documents after closing all open ones works Just run the code in DesktopLOKTest::testMultiDocuments() in a short loop. Sadly this did not find the actual problem that is present in the code, though. (A follow-up commit will fix that problem, and then I might also change this unit test so that it would have found that problem.) Change-Id: Ie847d04e77ea3d712820413fa0f00521207eb7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102018 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tor Lillqvist Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106253 Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 0a19d5582e80..701f624038c5 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2940,95 +2940,98 @@ void DesktopLOKTest::testSpellcheckerMultiView() void DesktopLOKTest::testMultiDocuments() { -// Load a document. -uno::Reference xComponent1; -std::unique_ptr document1; -std::tie(document1, xComponent1) = loadDocImpl("blank_text.odt"); -LibLODocument_Impl* pDocument1 = document1.get(); -CPPUNIT_ASSERT_EQUAL(1, pDocument1->m_pDocumentClass->getViewsCount(pDocument1)); -const int nDocId1 = pDocument1->mnDocumentId; - -const int nDoc1View0 = pDocument1->m_pDocumentClass->getView(pDocument1); -CPPUNIT_ASSERT_EQUAL(nDocId1, SfxLokHelper::getDocumentIdOfView(nDoc1View0)); -const int nDoc1View1 = pDocument1->m_pDocumentClass->createView(pDocument1); -CPPUNIT_ASSERT_EQUAL(nDoc1View1, pDocument1->m_pDocumentClass->getView(pDocument1)); -CPPUNIT_ASSERT_EQUAL(nDocId1, SfxLokHelper::getDocumentIdOfView(nDoc1View1)); -CPPUNIT_ASSERT_EQUAL(2, pDocument1->m_pDocumentClass->getViewsCount(pDocument1)); - -// Validate the views of document 1. -std::vector aViewIdsDoc1(2); -CPPUNIT_ASSERT(pDocument1->m_pDocumentClass->getViewIds(pDocument1, aViewIdsDoc1.data(), aViewIdsDoc1.size())); -CPPUNIT_ASSERT_EQUAL(nDoc1View0, aViewIdsDoc1[0]); -CPPUNIT_ASSERT_EQUAL(nDoc1View1, aViewIdsDoc1[1]); - -CPPUNIT_ASSERT_EQUAL(nDoc1View1, pDocument1->m_pDocumentClass->getView(pDocument1)); -CPPUNIT_ASSERT_EQUAL(nDocId1, SfxLokHelper::getDocumentIdOfView(nDoc1View1)); -pDocument1->m_pDocumentClass->setView(pDocument1, nDoc1View0); -CPPUNIT_ASSERT_EQUAL(nDoc1View0, pDocument1->m_pDocumentClass->getView(pDocument1)); -CPPUNIT_ASSERT_EQUAL(nDocId1, SfxLokHelper::getDocumentIdOfView(nDoc1View0)); -pDocument1->m_pDocumentClass->setView(pDocument1, nDoc1View1); -CPPUNIT_ASSERT_EQUAL(nDoc1View1, pDocument1->m_pDocumentClass->getView(pDocument1)); -CPPUNIT_ASSERT_EQUAL(nDocId1, SfxLokHelper::getDocumentIdOfView(nDoc1View1)); -CPPUNIT_ASSERT_EQUAL(2, pDocument1->m_pDocumentClass->getViewsCount(pDocument1)); - -// Load another document. -uno::Reference xComponent2; -std::unique_ptr document2; -std::tie(document2, xComponent2) = loadDocImpl("blank_presentation.odp"); -LibLODocument_Impl* pDocument2 = document2.get(); -CPPUNIT_ASSERT_EQUAL(1, pDocument2->m_pDocumentClass->getViewsCount(pDocument2)); -const int nDocId2 = pDocument2->mnDocumentId; - -const int nDoc2View0 = pDocument2->m_pDocumentClass->getView(pDocument2); -CPPUNIT_ASSERT_EQUAL(nDocId2, SfxLokHelper::getDocumentIdOfView(nDoc2View0)); -const int nDoc2View1 = pDocument2->m_pDocumentClass->createView(pDocument2); -CPPUNIT_ASSERT_EQUAL(nDoc2View1, pDocument2->m_pDocumentClass->getView(pDocument2)); -CPPUNIT_ASSERT_EQUAL(nDocId2, SfxLokHelper::getDocumentIdOfView(nDoc2View1)); -CPPUNIT_ASSERT_EQUAL(2, pDocument2->m_pDocumentClass->getViewsCount(pDocument2)); - -// Validate the views of document 2. -std::vector aViewIdsDoc2(2); -CPPUNIT_ASSERT(pDocument2->m_pDocumentClass->getViewIds(pDocument2, aViewIdsDoc2.data(), aViewIdsDoc2.size())); -CPPUNIT_ASSERT_EQUAL(nDoc2View0, aViewIdsDoc2[0]); -CPPUNIT_ASSERT_EQUAL(nDoc2View1, aViewIdsDoc2[1]); - -CPPUNIT_ASSERT_EQUAL(nDoc2View1, pDocument2->m_pDocumentClass->getView(pDocument2)); -CPPUNIT_ASSERT_EQUAL(nDocId2, SfxLokHelper::getDocumentIdOfView(nDoc2View1)); -pDocument2->m_pDocumentClass->setView(pDocument2, nDoc2View0); -CPPUNIT_ASSERT_EQUAL(nDoc2View0, pDocument2->m_pDocumentClass->getView(pDocument2)); -CPPUNIT_ASSERT_EQUAL(nDocId2, SfxLokHelper::getDocumentIdOfView(nDoc2View0)); -pDocument2->m_pDocumentClass->setView(pDocument2, nDoc2View1); -
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 117 +--- 1 file changed, 91 insertions(+), 26 deletions(-) New commits: commit 23951bdc3836b252aab0e7628d8839e89b5a9f6d Author: Ashod Nakashian AuthorDate: Sun Aug 2 12:41:19 2020 -0400 Commit: Tor Lillqvist CommitDate: Sat Nov 21 22:25:05 2020 +0100 DesktopLOKTest: cleanup Refactor the handling of document loading and unloading and cleanup to allow more flexibility when loading multiple documents and for manual destruction. Also, correctly set the document type when loading, which was defaulted to TEXT even when loading spreadsheet and presentation documents. Minor misc cleanup such as dangling semicolons and unregistering the callback twice. Change-Id: Ia244aafd526d60f73c46e99fb8c7e63f63b0a8f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99974 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106225 Tested-by: Tor Lillqvist Reviewed-by: Tor Lillqvist diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 74d9bcede0cf..a02347450a38 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -55,9 +55,34 @@ #include #include +#include + using namespace com::sun::star; using namespace desktop; +static LibreOfficeKitDocumentType getDocumentTypeFromName(const char* pName) +{ +CPPUNIT_ASSERT_MESSAGE("Document name must be valid.", pName != nullptr); + +const std::string name(pName); +CPPUNIT_ASSERT_MESSAGE("Document name must include extension.", name.size() > 4); + +const auto it = name.rfind('.'); +if (it != std::string::npos) +{ +const std::string ext = name.substr(it); + +if (ext == ".ods") +return LOK_DOCTYPE_SPREADSHEET; + +if (ext == ".odp") +return LOK_DOCTYPE_PRESENTATION; +} + +CPPUNIT_ASSERT_MESSAGE("Document name must include extension.", it != std::string::npos); +return LOK_DOCTYPE_TEXT; +} + class DesktopLOKTest : public UnoApiTest { public: @@ -78,22 +103,38 @@ public: UnoApiTest::setUp(); mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory(; SfxApplication::GetOrCreate(); -}; +} virtual void tearDown() override { -if (m_pDocument) -m_pDocument->pClass->registerCallback(m_pDocument.get(), nullptr, nullptr); closeDoc(); UnoApiTest::tearDown(); comphelper::LibreOfficeKit::setActive(false); -}; +} + +std::pair, uno::Reference> +loadDocImpl(const char* pName, LibreOfficeKitDocumentType eType); + +private: +std::pair, uno::Reference> +loadDocImpl(const char* pName); + +public: +std::pair, uno::Reference> +loadDocUrlImpl(const OUString& rFileURL, LibreOfficeKitDocumentType eType); LibLODocument_Impl* loadDocUrl(const OUString& rFileURL, LibreOfficeKitDocumentType eType); -LibLODocument_Impl* loadDoc(const char* pName, LibreOfficeKitDocumentType eType = LOK_DOCTYPE_TEXT); -void closeDoc(); +LibLODocument_Impl* loadDoc(const char* pName, LibreOfficeKitDocumentType eType); +LibLODocument_Impl* loadDoc(const char* pName) +{ +return loadDoc(pName, getDocumentTypeFromName(pName)); +} + +void closeDoc(std::unique_ptr& loDocument, + uno::Reference& xComponent); +void closeDoc() { closeDoc(m_pDocument, mxComponent); } static void callback(int nType, const char* pPayload, void* pData); void callbackImpl(int nType, const char* pPayload); @@ -261,7 +302,8 @@ static Control* GetFocusControl(vcl::Window const * pParent) return nullptr; } -LibLODocument_Impl* DesktopLOKTest::loadDocUrl(const OUString& rFileURL, LibreOfficeKitDocumentType eType) +std::pair, uno::Reference> +DesktopLOKTest::loadDocUrlImpl(const OUString& rFileURL, LibreOfficeKitDocumentType eType) { OUString aService; switch (eType) @@ -279,28 +321,54 @@ LibLODocument_Impl* DesktopLOKTest::loadDocUrl(const OUString& rFileURL, LibreOf CPPUNIT_ASSERT(false); break; } -mxComponent = loadFromDesktop(rFileURL, aService); -if (!mxComponent.is()) -{ -CPPUNIT_ASSERT(false); -} -m_pDocument.reset(new LibLODocument_Impl(mxComponent)); -return m_pDocument.get(); + +uno::Reference xComponent = loadFromDesktop(rFileURL, aService); +CPPUNIT_ASSERT(xComponent.is()); + +std::unique_ptr pDocument(new LibLODocument_Impl(xComponent)); + +return std::make_pair(std::move(pDocument), xComponent); } -LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +std::pair, uno::Reference> +DesktopLOKTest::loadDocImpl(const char* pName,
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit 2897383dc831bca0db1ff040dc9f96a3611d262e Author: Andras Timar AuthorDate: Wed Nov 4 23:11:26 2020 +0100 Commit: Andras Timar CommitDate: Thu Nov 5 06:56:28 2020 +0100 use a utl::TempFile and clean it up after test Change-Id: I1cbe7fd8002f6ba54532135de935805dd6a4e0e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105319 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5d44a289af0f..74d9bcede0cf 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2797,12 +2797,13 @@ void DesktopLOKTest::testCalcSaveAs() Scheduler::ProcessEventsToIdle(); // Save as a new file. -OUString aNewFileUrl = "file:///tmp/saveas.ods"; -pDocument->pClass->saveAs(pDocument, aNewFileUrl.toUtf8().getStr(), nullptr, nullptr); +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); +pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "ods", nullptr); closeDoc(); // Load the new document and verify that the in-flight changes are saved. -pDocument = loadDocUrl(aNewFileUrl, LOK_DOCTYPE_SPREADSHEET); +pDocument = loadDocUrl(aTempFile.GetURL(), LOK_DOCTYPE_SPREADSHEET); CPPUNIT_ASSERT(pDocument); ViewCallback aView(pDocument); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 42efdb71bce9b6ec3469236e0de8e08c00b3c90e Author: Stephan Bergmann AuthorDate: Wed Oct 28 08:32:57 2020 +0100 Commit: Stephan Bergmann CommitDate: Wed Oct 28 10:45:02 2020 +0100 strtol returns long, so that needs to be used here Reverting part of 6436302f40252bc6619e304e2051115fee902e20 "convert some more long -> tools::Long" Change-Id: I72a0029e580885a1714a85d105b6f666343ebdd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104916 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index b2015dbafcf2..5d44a289af0f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1008,7 +1008,7 @@ void DesktopLOKTest::testSheetSelections() { char* pUsedMimeType = nullptr; char* pCopiedContent = pDocument->pClass->getTextSelection(pDocument, nullptr, ); -std::vector aExpected = {5, 6, 7, 8, 9}; +std::vector aExpected = {5, 6, 7, 8, 9}; std::istringstream iss(pCopiedContent); for (size_t i = 0; i < aExpected.size(); i++) { @@ -1055,7 +1055,7 @@ void DesktopLOKTest::testSheetSelections() { char* pUsedMimeType = nullptr; char* pCopiedContent = pDocument->pClass->getTextSelection(pDocument, nullptr, ); -std::vector aExpected = { 8 }; +std::vector aExpected = { 8 }; std::istringstream iss(pCopiedContent); for (size_t i = 0; i < aExpected.size(); i++) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa include/unotest sw/qa xmlsecurity/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 24 include/unotest/macros_test.hxx | 25 + sw/qa/inc/swmodeltestbase.hxx | 24 xmlsecurity/qa/unit/signing/signing.cxx | 27 --- 4 files changed, 25 insertions(+), 75 deletions(-) New commits: commit f016f9016f5139791d544b5e5aa2ac438227b735 Author: Miklos Vajna AuthorDate: Wed Aug 5 21:12:44 2020 +0200 Commit: Miklos Vajna CommitDate: Thu Aug 6 09:29:23 2020 +0200 unotest: one Resetter is enough It seems all 3 places derive from unotest::MacrosTest, so extract the common code there. Change-Id: I71a2474a7d6b1623f50575f9e9c43580ba076330 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100185 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5b6947f93eaf..68ce00bdfe84 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -60,30 +60,6 @@ using namespace desktop; class DesktopLOKTest : public UnoApiTest { -class Resetter -{ -private: -std::function m_Func; - -public: -Resetter(std::function const& rFunc) -: m_Func(rFunc) -{ -} -~Resetter() -{ -try -{ -m_Func(); -} -catch (...) // has to be reliable -{ -fprintf(stderr, "resetter failed with exception\n"); -abort(); -} -} -}; - public: DesktopLOKTest() : UnoApiTest("/desktop/qa/data/"), m_nSelectionBeforeSearchResult(0), diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 2960dc0fbb23..6f55e34e7c87 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -38,6 +39,30 @@ namespace unotest { class OOO_DLLPUBLIC_UNOTEST MacrosTest { public: +class Resetter +{ +private: +std::function m_Func; + +public: +Resetter(std::function const& rFunc) +: m_Func(rFunc) +{ +} +~Resetter() +{ +try +{ +m_Func(); +} +catch (...) // has to be reliable +{ +fprintf(stderr, "resetter failed with exception\n"); +abort(); +} +} +}; + MacrosTest(); ~MacrosTest(); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 6193be33afc3..c3d5033a8370 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -141,30 +141,6 @@ protected: protected: -class Resetter -{ -private: -std::function m_Func; - -public: -Resetter(std::function const& rFunc) -: m_Func(rFunc) -{ -} -~Resetter() -{ -try -{ -m_Func(); -} -catch (...) // has to be reliable -{ -fprintf(stderr, "resetter failed with exception\n"); -abort(); -} -} -}; - virtual OUString getTestName() { return OUString(); } /// Copy helper. diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index ec17d7a82d78..a62dbd096aa0 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -1221,33 +1221,6 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) SignatureState::NOSIGNATURES, ODFVER_013_TEXT); } -namespace -{ -class Resetter -{ -private: -std::function m_Func; - -public: -Resetter(std::function const& rFunc) -: m_Func(rFunc) -{ -} -~Resetter() -{ -try -{ -m_Func(); -} -catch (...) // has to be reliable -{ -fprintf(stderr, "resetter failed with exception\n"); -abort(); -} -} -}; -} - /// Test if a macro signature from a OTT 1.0 template is preserved for ODT 1.0 CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit f7eff4319be741143f6d8d5e0f2995e3ce46b126 Author: Miklos Vajna AuthorDate: Mon Jul 13 17:51:49 2020 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 14 01:58:11 2020 +0200 CppunitTest_desktop_lib: handle SignatureState::OK after loading The purpose of DesktopLOKTest::testGetSignatureState_Signed() is to make sure that in case we don't trust a cert and we add the necessary CAs, then we trust the cert. So just return early when we trust the cert already, it's not an interesting failure. Change-Id: I32f24b5464a0e14156292de2acda562025ded73f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98673 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 4eeb728599b7..5b6947f93eaf 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2411,6 +2411,12 @@ void DesktopLOKTest::testGetSignatureState_Signed() Scheduler::ProcessEventsToIdle(); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); +if (nState == 1) +{ +// Already SignatureState::OK, then can't test the effect of trusting new CAs. +return; +} + CPPUNIT_ASSERT_EQUAL(int(4), nState); std::vector aCertificate; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa sd/qa
desktop/qa/data/BlankDrawDocument.odg|binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 68 +++ sd/qa/unit/tiledrendering/data/dummy.odg |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 56 +- 4 files changed, 121 insertions(+), 3 deletions(-) New commits: commit fbecbb6872db7c40c8d632955589223a6c456475 Author: Tomaž Vajngerl AuthorDate: Sat Jul 11 21:18:34 2020 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Jul 12 10:36:12 2020 +0200 add test for editing of annotations (using .uno:EditAnnotation) Change-Id: Ic798ab94bb63a3ae80882e77cf1582d875e27d4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98583 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/data/BlankDrawDocument.odg b/desktop/qa/data/BlankDrawDocument.odg new file mode 100644 index ..19ae49d63b36 Binary files /dev/null and b/desktop/qa/data/BlankDrawDocument.odg differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a75e5ea805cf..4eeb728599b7 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -159,6 +160,7 @@ public: void testCommentsCalc(); void testCommentsImpress(); void testCommentsCallbacksWriter(); +void testCommentsAddEditDeleteDraw(); void testRunMacro(); void testExtractParameter(); void testGetSignatureState_NonSigned(); @@ -218,6 +220,7 @@ public: CPPUNIT_TEST(testCommentsCalc); CPPUNIT_TEST(testCommentsImpress); CPPUNIT_TEST(testCommentsCallbacksWriter); +CPPUNIT_TEST(testCommentsAddEditDeleteDraw); CPPUNIT_TEST(testRunMacro); CPPUNIT_TEST(testExtractParameter); CPPUNIT_TEST(testGetSignatureState_Signed); @@ -2286,6 +2289,71 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(static_cast(5), aTree.get_child("comments").size()); } +namespace +{ + +void addParameter(tools::JsonWriter& rJson, const char* sName, OString const & type, OString const & value) +{ +auto testNode = rJson.startNode(sName); +rJson.put("type", type); +rJson.put("value", value); +} + +} + +void DesktopLOKTest::testCommentsAddEditDeleteDraw() +{ +// Comments callback are emitted only if tiled annotations are off +comphelper::LibreOfficeKit::setTiledAnnotations(false); +LibLODocument_Impl* pDocument = loadDoc("BlankDrawDocument.odg"); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +ViewCallback aView1(pDocument); + +// Add a new comment +OString aCommandArgs; +{ +tools::JsonWriter aJson; +addParameter(aJson, "Text", "string", "Comment"); +addParameter(aJson, "Author", "string", "LOK User1"); +aCommandArgs = aJson.extractAsOString(); +} + +pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", aCommandArgs.getStr(), false); +Scheduler::ProcessEventsToIdle(); + +// We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action +CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView1.m_aCommentCallbackResult.get("action")); +int nCommentId1 = aView1.m_aCommentCallbackResult.get("id"); + +// Edit the previously added comment +{ +tools::JsonWriter aJson; +addParameter(aJson, "Id", "string", OString::number(nCommentId1)); +addParameter(aJson, "Text", "string", "Edited comment"); +aCommandArgs = aJson.extractAsOString(); +} + +pDocument->pClass->postUnoCommand(pDocument, ".uno:EditAnnotation", aCommandArgs.getStr(), false); +Scheduler::ProcessEventsToIdle(); + +// We received a LOK_CALLBACK_COMMENT callback with comment 'Modify' action +CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView1.m_aCommentCallbackResult.get("action")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("id")); + +// Delete Comment +{ +tools::JsonWriter aJson; +addParameter(aJson, "Id", "string", OString::number(nCommentId1)); +aCommandArgs = aJson.extractAsOString(); +} +pDocument->pClass->postUnoCommand(pDocument, ".uno:DeleteAnnotation", aCommandArgs.getStr(), false); +Scheduler::ProcessEventsToIdle(); + +// We received a LOK_CALLBACK_COMMENT callback with comment 'Remove' action +CPPUNIT_ASSERT_EQUAL(std::string("Remove"), aView1.m_aCommentCallbackResult.get("action")); +CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get("id")); +} + void DesktopLOKTest::testRunMacro() { LibLibreOffice_Impl aOffice; diff --git a/sd/qa/unit/tiledrendering/data/dummy.odg b/sd/qa/unit/tiledrendering/data/dummy.odg new file mode 100644 index ..19ae49d63b36 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/dummy.odg differ diff --git
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 -- 1 file changed, 2 deletions(-) New commits: commit f5263e433d0a61a7c589b079ae28fa79efc90add Author: Noel Grandin AuthorDate: Mon Jun 22 10:37:43 2020 +0200 Commit: Noel Grandin CommitDate: Mon Jun 22 12:10:50 2020 +0200 remove debugging leftovers Change-Id: Ib0317628cbb59cd1e22d1ebca0e0925cc8e8eea1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96834 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8e02686f7f57..a75e5ea805cf 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -818,9 +818,7 @@ void DesktopLOKTest::testHiddenRowHeaders() boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aPayload.str().c_str()); -SAL_WARN("desktop", "xxx " << pJSON); std::stringstream aStream(pJSON); -SAL_WARN("desktop", aStream.str()); CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/tools include/vcl sc/inc sc/qa sc/source sd/source sw/inc sw/qa sw/source tools/qa tools/source
desktop/qa/desktop_lib/test_desktop_lib.cxx|4 desktop/source/lib/init.cxx| 32 ++-- include/tools/json_writer.hxx | 65 +++- include/vcl/ITiledRenderable.hxx | 18 -- sc/inc/docuno.hxx |8 - sc/qa/unit/tiledrendering/tiledrendering.cxx | 29 +++ sc/source/ui/inc/tabview.hxx |3 sc/source/ui/unoobj/docuno.cxx | 70 +++-- sc/source/ui/view/tabview.cxx | 183 - sd/source/ui/inc/unomodel.hxx |2 sd/source/ui/unoidl/unomodel.cxx | 26 +-- sw/inc/swmodule.hxx|3 sw/inc/unotxdoc.hxx|6 sw/qa/extras/tiledrendering/tiledrendering.cxx |6 sw/qa/extras/uiwriter/uiwriter2.cxx|8 - sw/qa/extras/uiwriter/uiwriter3.cxx|8 - sw/source/uibase/app/swmodul1.cxx | 26 --- sw/source/uibase/inc/swruler.hxx |3 sw/source/uibase/misc/swruler.cxx | 47 ++ sw/source/uibase/uno/unotxdoc.cxx | 39 ++--- tools/qa/cppunit/test_json_writer.cxx | 38 - tools/source/misc/json_writer.cxx | 117 ++- 22 files changed, 444 insertions(+), 297 deletions(-) New commits: commit cb95276e6e6bf12a1c06d5c252551e55c788fcb2 Author: Noel Grandin AuthorDate: Thu Jun 18 21:39:30 2020 +0200 Commit: Noel Grandin CommitDate: Sat Jun 20 21:25:11 2020 +0200 use JsonWriter for the rest of ITiledRenderable and fix bug in buffer reallacotion where mPos pointing at the beginning of the new buffer instead of at the correct index inside it. Change-Id: Ie1ffaa176f6165e2cec85c93adc945312eff38e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96650 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a651ab764da..8e02686f7f57 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -818,11 +818,13 @@ void DesktopLOKTest::testHiddenRowHeaders() boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aPayload.str().c_str()); +SAL_WARN("desktop", "xxx " << pJSON); std::stringstream aStream(pJSON); -free(pJSON); +SAL_WARN("desktop", aStream.str()); CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); +free(pJSON); sal_Int32 nPrevious = 0; sal_Int32 nIndex = 0; for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 357111d220af..a9202a0c90b5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3303,8 +3303,9 @@ static char* getPostIts(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } -OUString aComments = pDoc->getPostIts(); -return strdup(aComments.toUtf8().getStr()); +tools::JsonWriter aJsonWriter; +pDoc->getPostIts(aJsonWriter); +return aJsonWriter.extractData(); } /// Returns the JSON representation of the positions of all the comments in the document @@ -3317,8 +3318,9 @@ static char* getPostItsPos(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } -OUString aComments = pDoc->getPostItsPos(); -return strdup(aComments.toUtf8().getStr()); +tools::JsonWriter aJsonWriter; +pDoc->getPostItsPos(aJsonWriter); +return aJsonWriter.extractData(); } static char* getRulerState(LibreOfficeKitDocument* pThis) @@ -3330,8 +3332,9 @@ static char* getRulerState(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } -OUString state = pDoc->getRulerState(); -return strdup(state.toUtf8().getStr()); +tools::JsonWriter aJsonWriter; +pDoc->getRulerState(aJsonWriter); +return aJsonWriter.extractData(); } static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) @@ -4781,8 +4784,9 @@ static char* getTrackedChangeAuthors(LibreOfficeKitDocument* pThis) SetLastExceptionMsg("Document doesn't support tiled rendering"); return nullptr; } -OUString aAuthors = pDoc->getTrackedChangeAuthors(); -return strdup(aAuthors.toUtf8().getStr()); +tools::JsonWriter aJsonWriter; +pDoc->getTrackedChangeAuthors(aJsonWriter); +return aJsonWriter.extractData(); } static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand) @@ -4885,11 +4889,9 @@
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 34 1 file changed, 34 insertions(+) New commits: commit 2f4ea95149702a46852b320f828d8462eb3666ba Author: Henry Castro AuthorDate: Thu May 7 16:47:36 2020 -0400 Commit: Henry Castro CommitDate: Mon May 11 05:34:04 2020 +0200 lok: unit test for metric field or formatted field control Change-Id: I0a3efef85ff889c4214ab326d1de96a4acd207a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93689 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 30dd2c60dc3c..9ee4a596ec70 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -24,10 +24,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -173,6 +175,7 @@ public: void testDialogInput(); void testCalcSaveAs(); void testControlState(); +void testMetricField(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -233,6 +236,7 @@ public: CPPUNIT_TEST(testDialogInput); CPPUNIT_TEST(testCalcSaveAs); CPPUNIT_TEST(testControlState); +CPPUNIT_TEST(testMetricField); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2827,6 +2831,36 @@ void DesktopLOKTest::testControlState() CPPUNIT_ASSERT(!aState.empty()); } +void DesktopLOKTest::testMetricField() +{ +LibLODocument_Impl* pDocument = loadDoc("search.ods"); +pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, false); +Scheduler::ProcessEventsToIdle(); + +SfxViewShell* pViewShell = SfxViewShell::Current(); +CPPUNIT_ASSERT(pViewShell); + +SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); +CPPUNIT_ASSERT(pViewFrame); + +SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR); +CPPUNIT_ASSERT(pSideBar); + +vcl::Window* pWin = pSideBar->GetWindow(); +CPPUNIT_ASSERT(pWin); + +WindowUIObject aWinUI(pWin); +std::unique_ptr pUIWin(aWinUI.get_child("selectwidth")); +CPPUNIT_ASSERT(pUIWin.get()); + +StringMap aMap; +aMap["VALUE"] = "75.06"; +pUIWin->execute("VALUE", aMap); + +StringMap aRet = pUIWin->get_state(); +CPPUNIT_ASSERT_EQUAL(aMap["VALUE"], aRet["Value"]); +} + namespace { constexpr size_t classOffset(int i) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sw/inc sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +- desktop/source/lib/init.cxx | 33 + include/LibreOfficeKit/LibreOfficeKit.h |4 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 10 +++ include/vcl/ITiledRenderable.hxx| 11 sw/inc/unotxdoc.hxx |3 ++ sw/source/uibase/uno/unotxdoc.cxx | 36 7 files changed, 99 insertions(+), 1 deletion(-) New commits: commit 36508d0110248f6683757602cd1668547dbfb253 Author: Tamás Zolnai AuthorDate: Wed May 6 14:33:10 2020 +0200 Commit: Tamás Zolnai CommitDate: Fri May 8 22:42:35 2020 +0200 lok: MSForms: Handle event about item selection of a drop-down field. Change-Id: I095013097348c98361b6614e4ddf1e9029923c7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93659 Tested-by: Tamás Zolnai Reviewed-by: Tamás Zolnai diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 3344279f1a78..30dd2c60dc3c 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2923,10 +2923,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), offsetof(struct _LibreOfficeKitDocumentClass, paintWindowForView)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), offsetof(struct _LibreOfficeKitDocumentClass, completeFunction)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), offsetof(struct _LibreOfficeKitDocumentClass, setWindowTextSelection)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), offsetof(struct _LibreOfficeKitDocumentClass, sendFormFieldEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(62), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ccd32a035ff5..c7763b608a28 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1137,6 +1137,10 @@ static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowI const int nWidth, const int nHeight); static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex); + + +static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis, + const char* pArguments); } // extern "C" namespace { @@ -1252,6 +1256,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference createViewWithOptions = doc_createViewWithOptions; m_pDocumentClass->completeFunction = doc_completeFunction; +m_pDocumentClass->sendFormFieldEvent = doc_sendFormFieldEvent; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -5412,6 +5418,33 @@ static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex) pDoc->completeFunction(nIndex); } + +static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis, const char* pArguments) +{ +SolarMutexGuard aGuard; + +// Supported in Writer only +if (doc_getDocumentType(pThis) != LOK_DOCTYPE_TEXT) +return; + +StringMap aMap(jsonToStringMap(pArguments)); +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +SetLastExceptionMsg("Document doesn't support tiled rendering!"); +return; +} + +// Sanity check +if (aMap.find("type") == aMap.end() || aMap.find("cmd") == aMap.end()) +{ +SetLastExceptionMsg("Wrong arguments for sendFormFieldEvent!"); +return; +} + +pDoc->executeFromFieldEvent(aMap); +} + static char* lo_getError (LibreOfficeKit *pThis) { comphelper::ProfileZone aZone("lo_getError"); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 6203c11fb044..309744522004 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -446,6 +446,10 @@ struct _LibreOfficeKitDocumentClass int nX, int nY); +/// @see lok::Document::sendFormFieldEvent +void (*sendFormFieldEvent) (LibreOfficeKitDocument* pThis, +const char* pArguments); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 4076637863fd..37eacdfb3649 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -779,6 +779,16 @@ public: mpDoc->pClass->setWindowTextSelection(mpDoc, nWindowId, bSwap, nX, nY); }
[Libreoffice-commits] core.git: desktop/qa svx/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 14 ++ svx/source/tbxctrls/tbcontrl.cxx|1 - 2 files changed, 6 insertions(+), 9 deletions(-) New commits: commit d263afb35f3532844a10c23c30e28b5360d96fe4 Author: Caolán McNamara AuthorDate: Fri Apr 24 12:53:56 2020 +0100 Commit: Caolán McNamara CommitDate: Fri Apr 24 20:22:40 2020 +0200 don't need to include combobox.hxx Change-Id: I3cc0fe1be7e7bc28a398c04a6702a6cd4d7d6b53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92855 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index ce0a55d2acf8..3344279f1a78 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -19,11 +19,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -1754,16 +1754,15 @@ void DesktopLOKTest::testDialogInput() Control* pCtrlFocused = GetFocusControl(pWindow.get()); CPPUNIT_ASSERT(pCtrlFocused); -ComboBox* pCtrlURL = dynamic_cast(pCtrlFocused); -CPPUNIT_ASSERT(pCtrlURL); -CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlURL->GetText()); +CPPUNIT_ASSERT_EQUAL(WindowType::COMBOBOX, pCtrlFocused->GetType()); +CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlFocused->GetText()); vcl::LOKWindowId nDialogId = pWindow->GetLOKWindowId(); pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT, "wiki."); pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT_END, "wiki."); pDocument->pClass->removeTextContext(pDocument, nDialogId, 1, 0); Scheduler::ProcessEventsToIdle(); -CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlURL->GetText()); +CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlFocused->GetText()); static_cast(pWindow.get())->Close(); Scheduler::ProcessEventsToIdle(); @@ -2650,9 +2649,8 @@ void DesktopLOKTest::testDialogPaste() Control* pCtrlFocused = GetFocusControl(pWindow.get()); CPPUNIT_ASSERT(pCtrlFocused); -ComboBox* pCtrlURL = dynamic_cast(pCtrlFocused); -CPPUNIT_ASSERT(pCtrlURL); -CPPUNIT_ASSERT_EQUAL(OUString("www.softwarelibre.org.bo"), pCtrlURL->GetText()); +CPPUNIT_ASSERT_EQUAL(WindowType::COMBOBOX, pCtrlFocused->GetType()); +CPPUNIT_ASSERT_EQUAL(OUString("www.softwarelibre.org.bo"), pCtrlFocused->GetText()); static_cast(pWindow.get())->Close(); Scheduler::ProcessEventsToIdle(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index cf5541622150..a56ab368f12a 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) New commits: commit ffb4ce52ea32fbaf4944a5b5072d6385eccf3cb3 Author: Szymon Kłos AuthorDate: Tue Apr 21 11:57:47 2020 +0200 Commit: Miklos Vajna CommitDate: Wed Apr 22 09:26:46 2020 +0200 Make hide lok dialog test reliable On slower machines actions were reported in different order Change-Id: I8effea3a9d114ffb0e9ebed2c18fde046490fe07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92615 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e699f797c290..c243b75a25f8 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1871,6 +1871,7 @@ public: tools::Rectangle m_aOwnCursor; boost::property_tree::ptree m_aCommentCallbackResult; boost::property_tree::ptree m_aCallbackWindowResult; +bool m_bWindowHidden; ViewCallback(LibLODocument_Impl* pDocument) : mpDocument(pDocument), @@ -1926,6 +1927,10 @@ public: m_aCallbackWindowResult.clear(); std::stringstream aStream(pPayload); boost::property_tree::read_json(aStream, m_aCallbackWindowResult); + +std::string sAction = m_aCallbackWindowResult.get("action"); +if (sAction == "hide") +m_bWindowHidden = true; } break; case LOK_CALLBACK_CELL_FORMULA: @@ -2666,15 +2671,15 @@ void DesktopLOKTest::testShowHideDialog() VclPtr pWindow(Application::GetActiveTopWindow()); CPPUNIT_ASSERT(pWindow); +aView.m_bWindowHidden = false; + pWindow->Hide(); Scheduler::ProcessEventsToIdle(); -CPPUNIT_ASSERT_EQUAL(std::string("hide"), aView.m_aCallbackWindowResult.get("action")); +CPPUNIT_ASSERT_EQUAL(true, aView.m_bWindowHidden); -pWindow->Show(); +static_cast(pWindow.get())->Close(); Scheduler::ProcessEventsToIdle(); - -CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get("action")); } void DesktopLOKTest::testComplexSelection() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 16 1 file changed, 16 insertions(+) New commits: commit d652baae2f2ab23916f394ddf53b7a25459ef780 Author: Henry Castro AuthorDate: Mon Mar 30 19:38:31 2020 -0400 Commit: Henry Castro CommitDate: Mon Apr 6 04:35:24 2020 +0200 lok: unit test GetControlState Change-Id: I7187fe787aaed33d85ad76b612725741e9f586d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91383 Tested-by: Jenkins CollaboraOffice Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91579 Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 4e2aac986fcb..e699f797c290 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -49,6 +49,7 @@ #include #include +#include using namespace com::sun::star; using namespace desktop; @@ -170,6 +171,7 @@ public: void testShowHideDialog(); void testDialogInput(); void testCalcSaveAs(); +void testControlState(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -229,6 +231,7 @@ public: CPPUNIT_TEST(testShowHideDialog); CPPUNIT_TEST(testDialogInput); CPPUNIT_TEST(testCalcSaveAs); +CPPUNIT_TEST(testControlState); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2807,6 +2810,19 @@ void DesktopLOKTest::testSpellcheckerMultiView() CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViewsCount(pDocument)); } +void DesktopLOKTest::testControlState() +{ +LibLODocument_Impl* pDocument = loadDoc("search.ods"); +pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, false); +Scheduler::ProcessEventsToIdle(); + +boost::property_tree::ptree aState; +SfxViewShell* pViewShell = SfxViewShell::Current(); +pViewShell->GetViewFrame()->GetBindings().Update(); + pViewShell->GetViewFrame()->GetBindings().QueryControlState(SID_ATTR_TRANSFORM_WIDTH, aState); +CPPUNIT_ASSERT(!aState.empty()); +} + namespace { constexpr size_t classOffset(int i) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit vcl/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +- desktop/source/lib/init.cxx | 31 include/LibreOfficeKit/LibreOfficeKit.h |7 ++ include/LibreOfficeKit/LibreOfficeKit.hxx | 13 +++ vcl/source/window/seleng.cxx| 11 + 5 files changed, 63 insertions(+), 2 deletions(-) New commits: commit 814c69878b03cd053b53bcc81bbaeee02d416ce7 Author: Marco Cecchetti AuthorDate: Thu Feb 6 11:19:32 2020 +0100 Commit: Miklos Vajna CommitDate: Thu Feb 6 20:23:40 2020 +0100 lok: calc: formula input bar: set text selection as requested by client Change-Id: If04ed3c1637249329530a73d20df9b9296d1004e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88089 Reviewed-by: Marco Cecchetti Tested-by: Marco Cecchetti (cherry picked from commit 01f0d42f5ca9fb0e6e45b7bfcf51cb33c1a27bec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88117 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 14ecd2bcb196..a582ba764a01 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2902,10 +2902,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), offsetof(struct _LibreOfficeKitDocumentClass, renderFontOrientation)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), offsetof(struct _LibreOfficeKitDocumentClass, paintWindowForView)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), offsetof(struct _LibreOfficeKitDocumentClass, completeFunction)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), offsetof(struct _LibreOfficeKitDocumentClass, setWindowTextSelection)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(61), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 253ab51d2b29..65698eebbc37 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1037,6 +1037,11 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished); +static void doc_setWindowTextSelection(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + bool swap, + int nX, + int nY); static void doc_setTextSelection (LibreOfficeKitDocument* pThis, int nType, int nX, @@ -1201,6 +1206,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference sendDialogEvent = doc_sendDialogEvent; m_pDocumentClass->postUnoCommand = doc_postUnoCommand; m_pDocumentClass->setTextSelection = doc_setTextSelection; +m_pDocumentClass->setWindowTextSelection = doc_setWindowTextSelection; m_pDocumentClass->getTextSelection = doc_getTextSelection; m_pDocumentClass->getSelectionType = doc_getSelectionType; m_pDocumentClass->getClipboard = doc_getClipboard; @@ -3881,6 +3887,31 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n pDoc->setTextSelection(nType, nX, nY); } +static void doc_setWindowTextSelection(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, bool swap, int nX, int nY) +{ +comphelper::ProfileZone aZone("doc_setWindowTextSelection"); + +SolarMutexGuard aGuard; +SetLastExceptionMsg(); + +VclPtr pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); +if (!pWindow) +{ +SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found."); +return; +} + + +Size aOffset(pWindow->GetOutOffXPixel(), pWindow->GetOutOffYPixel()); +Point aCursorPos(nX, nY); +aCursorPos.Move(aOffset); +sal_uInt16 nModifier = swap ? KEY_MOD1 + KEY_MOD2 : KEY_SHIFT; + +MouseEvent aCursorEvent(aCursorPos, 1, MouseEventModifiers::SIMPLECLICK, 0, nModifier); +Application::PostMouseEvent(VclEventId::WindowMouseButtonDown, pWindow, ); +Application::PostMouseEvent(VclEventId::WindowMouseButtonUp, pWindow, ); +} + static bool getFromTransferrable( const css::uno::Reference , const OString , OString ); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index b4278625ccb0..6203c11fb044 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -439,6
[Libreoffice-commits] core.git: desktop/qa include/sfx2 sc/source sd/source sfx2/source sw/source
desktop/qa/data/2slides.odp |binary include/sfx2/childwin.hxx |6 +++--- sc/source/ui/app/scdll.cxx|5 - sd/source/ui/app/sddll.cxx|5 - sfx2/source/appl/workwin.cxx |3 +++ sw/source/uibase/app/swmodule.cxx |5 - 6 files changed, 18 insertions(+), 6 deletions(-) New commits: commit c9829f585103f3daa9749c5b0f479297edd42042 Author: Ashod Nakashian AuthorDate: Sat Jul 27 23:35:13 2019 -0400 Commit: Ashod Nakashian CommitDate: Mon Dec 23 00:52:34 2019 +0100 LOK: spelldialog: don't create the dialog when loading new views By default dialogs/decks are re-created when a new view is created/attached, if they are visible. For the spell checker this is unexpected, as the user doesn't expect to be doing spell checking upon loading a document, just because another user was at the time spell checking. Currently the suppression is for LOK only. This also adds support to suppress the recreation of any dialog by flagging it with the SfxChildWindowFlags::NEVERCLONE flag upon invoking RegisterChildWindow. (cherry picked from commit e3fb48fe4f84b5609730c64fdb49b1bd7ddd1f96) Reviewed-on: https://gerrit.libreoffice.org/85004 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks (cherry picked from commit e573919cd8561a81d967c1a4566c5733dd44b7b1) Change-Id: I7d71c664f1b2804910c96eeb0431164d48b5679b Reviewed-on: https://gerrit.libreoffice.org/85680 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/desktop/qa/data/2slides.odp b/desktop/qa/data/2slides.odp index 8be376f5b548..0e3f8758ffc9 100644 Binary files a/desktop/qa/data/2slides.odp and b/desktop/qa/data/2slides.odp differ diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index 68279262d11d..054f1ff0a0f5 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -47,13 +47,13 @@ enum class SfxChildWindowFlags TASK= 0x10, // ChildWindow inside the Task CANTGETFOCUS= 0x20, // ChildWindow can not get focus ALWAYSAVAILABLE = 0x40, // ChildWindow is never disabled -NEVERHIDE = 0x80 // ChildWindow is can always made -// visible/is visible +NEVERHIDE = 0x80, // ChildWindow is always visible +NEVERCLONE = 0x100, // ChildWindow is not recreated in new view }; namespace o3tl { -template<> struct typed_flags : is_typed_flags {}; +template<> struct typed_flags : is_typed_flags {}; } diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 59faba24ece2..45129b81b089 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -238,7 +239,9 @@ void ScDLL::Init() SvxHlinkDlgWrapper ::RegisterChildWindow(false, pMod); SvxFontWorkChildWindow ::RegisterChildWindow(false, pMod); SvxIMapDlgChildWindow ::RegisterChildWindow(false, pMod); -ScSpellDialogChildWindow::RegisterChildWindow(false, pMod); +ScSpellDialogChildWindow::RegisterChildWindow( +false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE +: SfxChildWindowFlags::NONE); ScValidityRefChildWin::RegisterChildWindow(false, pMod); sc::SearchResultsDlgWrapper::RegisterChildWindow(false, pMod); diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 8098c5d6c31c..55d306e53925 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -84,6 +84,7 @@ #include #include #include +#include #include #include #include @@ -165,7 +166,9 @@ void SdDLL::RegisterControllers(SdModule* pMod) SvxBmpMaskChildWindow::RegisterChildWindow(false, pMod); SvxIMapDlgChildWindow::RegisterChildWindow(false, pMod); SvxHlinkDlgWrapper::RegisterChildWindow(false, pMod); -::sd::SpellDialogChildWindow::RegisterChildWindow(false, pMod); +::sd::SpellDialogChildWindow::RegisterChildWindow( +false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE +: SfxChildWindowFlags::NONE); #if HAVE_FEATURE_AVMEDIA ::avmedia::MediaPlayer::RegisterChildWindow(false, pMod); #endif diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index cb9680b94ae0..3c505a364c07 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1283,6 +1283,9 @@ void SfxWorkWindow::UpdateChildWindows_Impl() else bCreate = true; +if (pCW->aInfo.nFlags & SfxChildWindowFlags::NEVERCLONE) +pCW->bCreate = bCreate = false; // Don't create and remember that we haven't created. + // Currently, no
[Libreoffice-commits] core.git: desktop/qa include/sfx2 sc/source sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 61 include/sfx2/objsh.hxx |2 sc/source/ui/docshell/docsh.cxx |6 ++ sc/source/ui/inc/docsh.hxx |2 sfx2/source/doc/objserv.cxx |1 sfx2/source/doc/objstor.cxx |7 +++ 6 files changed, 71 insertions(+), 8 deletions(-) New commits: commit 9b3c7c81299590d6d845f7437f6ab16db0219929 Author: Ashod Nakashian AuthorDate: Thu Aug 22 09:15:15 2019 -0400 Commit: Ashod Nakashian CommitDate: Sun Dec 22 22:14:41 2019 +0100 sc: LOK: commit cell edits before saveas Users typically don't recognize that changes done to a cell need to be committed (typically by hitting RETURN) before they are saved to file. This is especially true on the web. This patch commits any in-flight changes before SaveAs. This is currently done only for LOK and unconditionally at that. This can be controlled via a flag, if there is such a use-case. Reviewed-on: https://gerrit.libreoffice.org/78012 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian (cherry picked from commit cc7eb4d345e3fede698a3f255c1938d275305c14) Reviewed-on: https://gerrit.libreoffice.org/78455 Reviewed-by: Andras Timar Tested-by: Andras Timar (cherry picked from commit e867404fbe7e0ff0d6f2573292c19b3a178a412d) Change-Id: I2a88b2f1df47be764058f4505561b22830d9d67a Reviewed-on: https://gerrit.libreoffice.org/82102 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 178d42f335c0..2649c0cb0d40 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -75,7 +75,6 @@ public: comphelper::LibreOfficeKit::setActive(true); UnoApiTest::setUp(); - mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory(; SfxApplication::GetOrCreate(); }; @@ -85,11 +84,13 @@ public: if (m_pDocument) m_pDocument->pClass->registerCallback(m_pDocument.get(), nullptr, nullptr); closeDoc(); + UnoApiTest::tearDown(); comphelper::LibreOfficeKit::setActive(false); }; +LibLODocument_Impl* loadDocUrl(const OUString& rFileURL, LibreOfficeKitDocumentType eType); LibLODocument_Impl* loadDoc(const char* pName, LibreOfficeKitDocumentType eType = LOK_DOCTYPE_TEXT); void closeDoc(); static void callback(int nType, const char* pPayload, void* pData); @@ -147,6 +148,7 @@ public: void testDialogPaste(); void testShowHideDialog(); void testDialogInput(); +void testCalcSaveAs(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -204,6 +206,7 @@ public: CPPUNIT_TEST(testDialogPaste); CPPUNIT_TEST(testShowHideDialog); CPPUNIT_TEST(testDialogInput); +CPPUNIT_TEST(testCalcSaveAs); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -249,10 +252,8 @@ static Control* GetFocusControl(vcl::Window const * pParent) return nullptr; } -LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +LibLODocument_Impl* DesktopLOKTest::loadDocUrl(const OUString& rFileURL, LibreOfficeKitDocumentType eType) { -OUString aFileURL; -createFileURL(OUString::createFromAscii(pName), aFileURL); OUString aService; switch (eType) { @@ -269,7 +270,7 @@ LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDoc CPPUNIT_ASSERT(false); break; } -mxComponent = loadFromDesktop(aFileURL, aService); +mxComponent = loadFromDesktop(rFileURL, aService); if (!mxComponent.is()) { CPPUNIT_ASSERT(false); @@ -278,6 +279,13 @@ LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDoc return m_pDocument.get(); } +LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) +{ +OUString aFileURL; +createFileURL(OUString::createFromAscii(pName), aFileURL); +return loadDocUrl(aFileURL, eType); +} + void DesktopLOKTest::closeDoc() { if (mxComponent.is()) @@ -905,7 +913,7 @@ void DesktopLOKTest::testTrackChanges() pDocument->pClass->registerCallback(pDocument, ::callback, this); Scheduler::ProcessEventsToIdle(); -// Enable track changes and assert that both views get notified. +// Enable trak changes and assert that both views get notified. m_nTrackChanges = 0; pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); Scheduler::ProcessEventsToIdle(); @@ -1833,6 +1841,7 @@ class ViewCallback LibLODocument_Impl* mpDocument; int mnView; public: +OString m_aCellFormula; bool
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 32 1 file changed, 32 insertions(+) New commits: commit af3bb63fc048b4a2e8ccdee89ddd39fcf5a7a6b2 Author: Marco Cecchetti AuthorDate: Sun Oct 20 12:57:48 2019 +0200 Commit: Michael Meeks CommitDate: Mon Dec 16 15:04:22 2019 +0100 lok: unit test dialog text input field Change-Id: I989086e12ada7c8606f5bfe1534d33360d14031e Reviewed-on: https://gerrit.libreoffice.org/82017 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 232d8cb3073a..178d42f335c0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -146,6 +146,7 @@ public: void testComplexSelection(); void testDialogPaste(); void testShowHideDialog(); +void testDialogInput(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -202,6 +203,7 @@ public: CPPUNIT_TEST(testComplexSelection); CPPUNIT_TEST(testDialogPaste); CPPUNIT_TEST(testShowHideDialog); +CPPUNIT_TEST(testDialogInput); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -1703,6 +1705,36 @@ void DesktopLOKTest::testPartInInvalidation() } } +void DesktopLOKTest::testDialogInput() +{ +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); +Scheduler::ProcessEventsToIdle(); + +SfxViewShell* pViewShell = SfxViewShell::Current(); +pViewShell->GetViewFrame()->GetBindings().Update(); + +VclPtr pWindow(Application::GetActiveTopWindow()); +CPPUNIT_ASSERT(pWindow); + +Control* pCtrlFocused = GetFocusControl(pWindow.get()); +CPPUNIT_ASSERT(pCtrlFocused); +ComboBox* pCtrlURL = dynamic_cast(pCtrlFocused); +CPPUNIT_ASSERT(pCtrlURL); +CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlURL->GetText()); + +vcl::LOKWindowId nDialogId = pWindow->GetLOKWindowId(); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT, "wiki."); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT_END, "wiki."); +pDocument->pClass->removeTextContext(pDocument, nDialogId, 1, 0); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlURL->GetText()); + +static_cast(pWindow.get())->Close(); +Scheduler::ProcessEventsToIdle(); +} + void DesktopLOKTest::testInput() { // Load a Writer document, enable change recording and press a key. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- desktop/source/lib/init.cxx | 17 + include/LibreOfficeKit/LibreOfficeKit.h |3 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++ include/vcl/ITiledRenderable.hxx|5 + sc/inc/docuno.hxx |3 +++ sc/source/ui/app/inputhdl.cxx | 16 sc/source/ui/inc/inputhdl.hxx |2 ++ sc/source/ui/unoobj/docuno.cxx | 10 ++ 9 files changed, 68 insertions(+), 1 deletion(-) New commits: commit e5367efbd15e1d97f8d4de232df1c325d8fff2b8 Author: Marco Cecchetti AuthorDate: Wed Nov 27 22:53:38 2019 +0100 Commit: Miklos Vajna CommitDate: Tue Dec 3 07:28:36 2019 +0100 lok: formula bar: function completion lok clients can request to complete a function name partially typed in the formula input box. Change-Id: I8771fd4d2a7f79c20138d9183162da23a92f2ba4 Reviewed-on: https://gerrit.libreoffice.org/83984 Reviewed-by: Marco Cecchetti Tested-by: Marco Cecchetti Reviewed-on: https://gerrit.libreoffice.org/84258 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 08fa6a54ab62..1effbc2669b8 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2751,10 +2751,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), offsetof(struct _LibreOfficeKitDocumentClass, sendDialogEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), offsetof(struct _LibreOfficeKitDocumentClass, renderFontOrientation)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), offsetof(struct _LibreOfficeKitDocumentClass, paintWindowForView)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), offsetof(struct _LibreOfficeKitDocumentClass, completeFunction)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(60), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7fb08f0bec15..7ecc9fcdf78b 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -933,6 +933,7 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, const int nWidth, const int nHeight); +static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex); } // extern "C" namespace { @@ -1044,6 +1045,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference postWindowGestureEvent = doc_postWindowGestureEvent; m_pDocumentClass->createViewWithOptions = doc_createViewWithOptions; +m_pDocumentClass->completeFunction = doc_completeFunction; gDocumentClass = m_pDocumentClass; } @@ -5144,6 +5146,21 @@ static void doc_resizeWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWin pWindow->SetSizePixel(Size(nWidth, nHeight)); } +static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex) +{ +SolarMutexGuard aGuard; +SetLastExceptionMsg(); + +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +SetLastExceptionMsg("Document doesn't support tiled rendering"); +return; +} + +pDoc->completeFunction(nIndex); +} + static char* lo_getError (LibreOfficeKit *pThis) { comphelper::ProfileZone aZone("lo_getError"); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index a486886c15de..b4278625ccb0 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -436,6 +436,9 @@ struct _LibreOfficeKitDocumentClass const double dpiscale, int viewId); +/// @see lok::Document::completeFunction(). +void (*completeFunction) (LibreOfficeKitDocument* pThis, int nIndex); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 318bf943cca9..19f0b2663552 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -757,6 +757,16 @@ public: mpDoc->pClass->removeTextContext(mpDoc, nWindowId, nBefore, nAfter); } +/** + * Select the Calc function to be pasted into the formula input box + * + * @param nIndex is the index of the selected function + */ +void
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +- desktop/source/lib/init.cxx | 29 ++-- include/LibreOfficeKit/LibreOfficeKit.h |9 include/LibreOfficeKit/LibreOfficeKit.hxx |7 +++--- sfx2/source/control/shell.cxx |7 ++ 5 files changed, 45 insertions(+), 10 deletions(-) New commits: commit 71c5b374deb35993d0af3e953ff0cdfc64d76aab Author: Michael Meeks AuthorDate: Sat Nov 30 14:59:02 2019 + Commit: Michael Meeks CommitDate: Sat Nov 30 22:58:58 2019 +0100 lok: add viewId to window painting, to allow special-casing on render. View switching should not cause the sidebar UX to re-build at all. Particularly it should not do this when we switch view just to render a sidebar. Change-Id: Iec0427cdc8308fc273d73ea56dd208bfa7036471 Reviewed-on: https://gerrit.libreoffice.org/84120 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks (cherry picked from commit 92814f3389de346f3ae32cddb38f079763e68ddf) Reviewed-on: https://gerrit.libreoffice.org/84129 Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 242a539cf08e..08fa6a54ab62 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2750,10 +2750,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), offsetof(struct _LibreOfficeKitDocumentClass, sendDialogEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), offsetof(struct _LibreOfficeKitDocumentClass, renderFontOrientation)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), offsetof(struct _LibreOfficeKitDocumentClass, paintWindowForView)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(59), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2d8f7290a05d..8f05cc487672 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -905,6 +905,11 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* pThis, unsigned nLOKWindo const int nWidth, const int nHeight, const double fDPIScale); +static void doc_paintWindowForView(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, + const int nX, const int nY, + const int nWidth, const int nHeight, + const double fDPIScale, int viewId); + static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction, const char* pData); @@ -1022,6 +1027,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference paintWindow = doc_paintWindow; m_pDocumentClass->paintWindowDPI = doc_paintWindowDPI; +m_pDocumentClass->paintWindowForView = doc_paintWindowForView; m_pDocumentClass->postWindow = doc_postWindow; m_pDocumentClass->resizeWindow = doc_resizeWindow; @@ -4850,12 +4856,20 @@ static void doc_paintWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId doc_paintWindowDPI(pThis, nLOKWindowId, pBuffer, nX, nY, nWidth, nHeight, 1.0); } -static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, +static void doc_paintWindowDPI(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, const int nX, const int nY, const int nWidth, const int nHeight, const double fDPIScale) { +doc_paintWindowForView(pThis, nLOKWindowId, pBuffer, nX, nY, nWidth, nHeight, fDPIScale, -1); +} + +static void doc_paintWindowForView(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, + unsigned char* pBuffer, const int nX, const int nY, + const int nWidth, const int nHeight, + const double fDPIScale, int viewId) +{ comphelper::ProfileZone aZone("doc_paintWindowDPI"); SolarMutexGuard aGuard; @@ -4868,6 +4882,12 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKW return; } +// Used to avoid work in setView if set. +comphelper::LibreOfficeKit::setDialogPainting(true); + +if (viewId >= 0) +doc_setView(pThis, viewId); + // Setup cairo (or CoreGraphics, in the iOS case)
[Libreoffice-commits] core.git: desktop/qa desktop/source filter/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 +-- desktop/source/lib/init.cxx | 33 +++- filter/source/pdf/pdfexport.cxx | 23 +-- include/LibreOfficeKit/LibreOfficeKit.h |8 ++ include/LibreOfficeKit/LibreOfficeKit.hxx |8 +- 5 files changed, 50 insertions(+), 26 deletions(-) New commits: commit 7c8450abac77a2e41f1068fb11d19c1c0c93783f Author: Mert Tumer AuthorDate: Thu Oct 24 12:11:21 2019 +0300 Commit: Ashod Nakashian CommitDate: Sun Nov 10 22:39:55 2019 +0100 Added Orientation argument to LOKIT renderFont method for rendering watermarks with angle Change-Id: Id422ed62e4f78390661e4e1efa45101af9ecfc23 Reviewed-on: https://gerrit.libreoffice.org/81435 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8200c7e1c859..e6207b2cf98a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2743,11 +2743,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), offsetof(struct _LibreOfficeKitDocumentClass, sendDialogEvent)); - +CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), offsetof(struct _LibreOfficeKitDocumentClass, renderFontOrientation)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(58), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5b5b301cdee9..bc0fd62eb78a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -879,6 +879,12 @@ static int doc_getView(LibreOfficeKitDocument* pThis); static int doc_getViewsCount(LibreOfficeKitDocument* pThis); static bool doc_getViewIds(LibreOfficeKitDocument* pThis, int* pArray, size_t nSize); static void doc_setViewLanguage(LibreOfficeKitDocument* pThis, int nId, const char* language); +static unsigned char* doc_renderFontOrientation(LibreOfficeKitDocument* pThis, + const char *pFontName, + const char *pChar, + int* pFontWidth, + int* pFontHeight, + int pOrientation); static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, const char *pFontName, const char *pChar, @@ -895,7 +901,8 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* pThis, unsigned nLOKWindo const int nWidth, const int nHeight, const double fDPIScale); -static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction, const char* pData); +static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned + nLOKWindowId, int nAction, const char* pData); static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart); @@ -1001,6 +1008,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getViewIds = doc_getViewIds; m_pDocumentClass->renderFont = doc_renderFont; +m_pDocumentClass->renderFontOrientation = doc_renderFontOrientation; m_pDocumentClass->getPartHash = doc_getPartHash; m_pDocumentClass->paintWindow = doc_paintWindow; @@ -4671,12 +4679,24 @@ static void doc_setViewLanguage(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*p SfxLokHelper::setViewLanguage(nId, OStringToOUString(language, RTL_TEXTENCODING_UTF8)); } -unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, + + +unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, const char* pFontName, const char* pChar, int* pFontWidth, int* pFontHeight) { +return doc_renderFontOrientation(pThis, pFontName, pChar, pFontWidth, pFontHeight, 0); +} + +unsigned char* doc_renderFontOrientation(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, + const char* pFontName, + const char* pChar, + int* pFontWidth, + int* pFontHeight, + int pOrientation) +{ comphelper::ProfileZone aZone("doc_renderFont"); SolarMutexGuard aGuard; @@ -4708,6 +4728,7 @@
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 +- desktop/source/lib/init.cxx | 45 +++- include/LibreOfficeKit/LibreOfficeKit.h |5 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 11 ++ 4 files changed, 63 insertions(+), 2 deletions(-) New commits: commit ef433656498ce52b69849915671d4aa34ec59136 Author: Szymon Kłos AuthorDate: Fri Oct 11 08:53:14 2019 +0200 Commit: Szymon Kłos CommitDate: Tue Oct 15 15:59:07 2019 +0200 jsdialogs: handle dialog events Change-Id: Icc092cd5b06168d9de8ebed891fc03491865dbad Reviewed-on: https://gerrit.libreoffice.org/80788 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5945a3bd378a..49a26253b388 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2742,10 +2742,12 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(53), offsetof(struct _LibreOfficeKitDocumentClass, setClipboard)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), offsetof(struct _LibreOfficeKitDocumentClass, sendDialogEvent)); + // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(57), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index cd604f939d8b..1790bdbfa478 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -147,6 +147,7 @@ #include #include #include +#include #include @@ -768,7 +769,9 @@ static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter); - +static void doc_sendDialogEvent(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + const char* pArguments); static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, @@ -942,6 +945,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference postWindowKeyEvent = doc_postWindowKeyEvent; m_pDocumentClass->postMouseEvent = doc_postMouseEvent; m_pDocumentClass->postWindowMouseEvent = doc_postWindowMouseEvent; +m_pDocumentClass->sendDialogEvent = doc_sendDialogEvent; m_pDocumentClass->postUnoCommand = doc_postUnoCommand; m_pDocumentClass->setTextSelection = doc_setTextSelection; m_pDocumentClass->getTextSelection = doc_getTextSelection; @@ -3256,6 +3260,45 @@ public: virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} }; +static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWindowId, const char* pArguments) +{ +SolarMutexGuard aGuard; + +char* pCopy = strdup(pArguments); +if (!pCopy) { +SetLastExceptionMsg("String copying error."); +return; +} + +char* pIdChar = strtok(pCopy, " "); + +if (!pIdChar) { +SetLastExceptionMsg("Error parsing the command."); +return; +} + +OUString sId = OUString::createFromAscii(pIdChar); +free(pCopy); + +VclPtr pWindow = vcl::Window::FindLOKWindow(nWindowId); +if (!pWindow) +{ +SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found."); +return; +} +else +{ +OUString sAction("CLICK"); +WindowUIObject aUIObject(pWindow); +std::unique_ptr pUIWindow(aUIObject.get_child(sId)); +if (pUIWindow) +pUIWindow->execute(sAction, StringMap()); + +// force resend +pWindow->Resize(); +} +} + static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished) { comphelper::ProfileZone aZone("doc_postUnoCommand"); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 6060b015be01..29d834969ad6 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -414,6 +414,11 @@ struct _LibreOfficeKitDocumentClass int nBefore, int nAfter); +/// @see lok::Document::sendDialogEvent +void
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 39 1 file changed, 39 insertions(+) New commits: commit 62b337a3d6650b8b3045dd98f59a8c0188f0a6fa Author: Michael Meeks AuthorDate: Tue Jul 16 15:23:54 2019 +0100 Commit: Michael Meeks CommitDate: Wed Oct 2 17:02:39 2019 +0200 Unit test for removeTextContext. Change-Id: Ib75259f1680fac41a84caeef57718203ec9c4b86 Reviewed-on: https://gerrit.libreoffice.org/79880 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e16bc91aecb7..5945a3bd378a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -121,6 +121,7 @@ public: void testNotificationCompression(); void testTileInvalidationCompression(); void testPartInInvalidation(); +void testInput(); void testRedlineWriter(); void testTrackChanges(); void testRedlineCalc(); @@ -174,6 +175,7 @@ public: CPPUNIT_TEST(testNotificationCompression); CPPUNIT_TEST(testTileInvalidationCompression); CPPUNIT_TEST(testPartInInvalidation); +CPPUNIT_TEST(testInput); CPPUNIT_TEST(testRedlineWriter); CPPUNIT_TEST(testTrackChanges); CPPUNIT_TEST(testRedlineCalc); @@ -1699,6 +1701,43 @@ void DesktopLOKTest::testPartInInvalidation() } } +void DesktopLOKTest::testInput() +{ +// Load a Writer document, enable change recording and press a key. +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +uno::Reference xPropertySet(mxComponent, uno::UNO_QUERY); + +Scheduler::ProcessEventsToIdle(); // Get focus & other bits setup. + +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "far"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "far"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " "); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " "); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "beyond"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "beyond"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " "); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " "); +// Mis-spelled ... +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "kovely"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "kovely"); +// Remove it again +pDocument->pClass->removeTextContext(pDocument, 0, 6, 0); +// Replace it with lovely +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "lovely"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "lovely"); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " "); +pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " "); + +// get the text ... +pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); +Scheduler::ProcessEventsToIdle(); +char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); +CPPUNIT_ASSERT(pText != nullptr); +OString aLovely("far beyond lovely "); +CPPUNIT_ASSERT_EQUAL(aLovely, OString(pText)); +free(pText); +} + void DesktopLOKTest::testRedlineWriter() { // Load a Writer document, enable change recording and press a key. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/sfx2 sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 + desktop/source/lib/init.cxx | 44 include/LibreOfficeKit/LibreOfficeKit.h |6 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 13 include/sfx2/lokhelper.hxx |2 - sfx2/source/view/lokhelper.cxx |4 +- 6 files changed, 68 insertions(+), 4 deletions(-) New commits: commit 9590e8d0a2194b36d5a025a21dc2e71f37f4f54b Author: Marco Cecchetti AuthorDate: Wed Jul 10 10:32:07 2019 +0200 Commit: Michael Meeks CommitDate: Tue Oct 1 10:01:57 2019 +0200 lok: handling a single msg for deleting multiple characters also includes: lok: fixing testABI failure Change-Id: I4df662a0df49a864c4b307efdd963b857bb77792 lok: missing removeTextContext implementation for Document class Change-Id: I884ad07f330afc19dfe759c08c8a17bdb4f9dcf3 Change-Id: I045d89f9fa478f37fc2917e159e044eee7e1ab31 Reviewed-on: https://gerrit.libreoffice.org/79879 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 93e81b595f65..eb3c713560ee 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2782,10 +2782,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), offsetof(struct _LibreOfficeKitDocumentClass, getClipboard)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(53), offsetof(struct _LibreOfficeKitDocumentClass, setClipboard)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2af356e0bb7b..3b8e7eb128c7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -764,6 +764,11 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText); +static void doc_removeTextContext(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + int nCharBefore, + int nCharAfter); + static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, @@ -933,6 +938,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference registerCallback = doc_registerCallback; m_pDocumentClass->postKeyEvent = doc_postKeyEvent; m_pDocumentClass->postWindowExtTextInputEvent = doc_postWindowExtTextInputEvent; +m_pDocumentClass->removeTextContext = doc_removeTextContext; m_pDocumentClass->postWindowKeyEvent = doc_postWindowKeyEvent; m_pDocumentClass->postMouseEvent = doc_postMouseEvent; m_pDocumentClass->postWindowMouseEvent = doc_postWindowMouseEvent; @@ -3053,6 +3059,44 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig } } +static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) +{ +SolarMutexGuard aGuard; +VclPtr pWindow; +if (nLOKWindowId == 0) +{ +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +return; +} +pWindow = pDoc->getDocWindow(); +} +else +{ +pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); +} + +if (!pWindow) +{ +gImpl->maLastExceptionMsg = "No window found for window id: " + OUString::number(nLOKWindowId); +return; +} + +if (nCharBefore > 0) +{ +// backspace +SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 8, 1283, nCharBefore - 1); +} + +if (nCharAfter > 0) +{ +// delete (forward) +SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 46, 1286, nCharAfter - 1); +} +} + static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode) { comphelper::ProfileZone
[Libreoffice-commits] core.git: desktop/qa sc/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 44 +--- sc/qa/unit/tiledrendering/tiledrendering.cxx | 255 ++- 2 files changed, 121 insertions(+), 178 deletions(-) New commits: commit e137449a420a02bdeffd26447bc029df5c823916 Author: Noel Grandin AuthorDate: Thu Aug 1 10:33:52 2019 +0200 Commit: Noel Grandin CommitDate: Thu Aug 1 11:59:29 2019 +0200 clean up ViewCallback nicely Change-Id: Idb882460092642bc77804560cd8fd6432a590323 Reviewed-on: https://gerrit.libreoffice.org/76776 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 6ad9c78edd13..36e7d727efb0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1803,15 +1803,26 @@ void DesktopLOKTest::testRedlineCalc() class ViewCallback { +LibLODocument_Impl* mpDocument; +int mnView; public: bool m_bTilesInvalidated; tools::Rectangle m_aOwnCursor; boost::property_tree::ptree m_aCommentCallbackResult; boost::property_tree::ptree m_aCallbackWindowResult; -ViewCallback() -: m_bTilesInvalidated(false) +ViewCallback(LibLODocument_Impl* pDocument) +: mpDocument(pDocument), + m_bTilesInvalidated(false) { +mnView = SfxLokHelper::getView(); +mpDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, this); +} + +~ViewCallback() +{ +mpDocument->m_pDocumentClass->setView(mpDocument, mnView); +mpDocument->m_pDocumentClass->registerCallback(mpDocument, nullptr, nullptr); } static void callback(int nType, const char* pPayload, void* pData) @@ -1908,16 +1919,12 @@ void DesktopLOKTest::testWriterCommentInsertCursor() // Load a document and type a character into the body text of the second view. comphelper::LibreOfficeKit::setActive(); -ViewCallback aView1; -ViewCallback aView2; LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -int nView1 = SfxLokHelper::getView(); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +ViewCallback aView1(pDocument); pDocument->m_pDocumentClass->createView(pDocument); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -int nView2 = SfxLokHelper::getView(); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +ViewCallback aView2(pDocument); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0); Scheduler::ProcessEventsToIdle(); @@ -1941,10 +1948,6 @@ void DesktopLOKTest::testWriterCommentInsertCursor() CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty()); Scheduler::ProcessEventsToIdle(); -pDocument->m_pDocumentClass->setView(pDocument, nView1); -pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, nullptr); -pDocument->m_pDocumentClass->setView(pDocument, nView2); -pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, nullptr); } #if HAVE_MORE_FONTS @@ -2137,16 +2140,12 @@ void DesktopLOKTest::testCommentsCallbacksWriter() comphelper::LibreOfficeKit::setActive(); // Comments callback are emitted only if tiled annotations are off comphelper::LibreOfficeKit::setTiledAnnotations(false); -ViewCallback aView1; -ViewCallback aView2; LibLODocument_Impl* pDocument = loadDoc("comments.odt"); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -int nView1 = pDocument->m_pDocumentClass->getView(pDocument); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +ViewCallback aView1(pDocument); pDocument->m_pDocumentClass->createView(pDocument); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -int nView2 = pDocument->m_pDocumentClass->getView(pDocument); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +ViewCallback aView2(pDocument); // Add a new comment OString aCommandArgs("{ \"Text\": { \"type\": \"string\", \"value\": \"Additional comment\" }, \"Author\": { \"type\": \"string\", \"value\": \"LOK User1\" } }"); @@ -2218,11 +2217,6 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); CPPUNIT_ASSERT_EQUAL(static_cast(5), aTree.get_child("comments").size()); - -pDocument->m_pDocumentClass->setView(pDocument, nView1); -pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, nullptr); -pDocument->m_pDocumentClass->setView(pDocument, nView2); -pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, nullptr); }
[Libreoffice-commits] core.git: desktop/qa desktop/source sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 desktop/source/lib/init.cxx | 16 sfx2/source/sidebar/SidebarChildWindow.cxx | 10 +++--- 3 files changed, 27 insertions(+), 3 deletions(-) New commits: commit 70d3bbe11e56f12a339a5b8759b53a96b4fe84ab Author: Ashod Nakashian AuthorDate: Thu May 2 23:16:30 2019 -0400 Commit: Noel Grandin CommitDate: Tue Jul 30 18:52:48 2019 +0200 sfx2: Enable sidebar on calc and writer, but not in impress Added by Noel to this commit: And add a special deregister mode to doc_registerCallback so we can unregister stack-based callback objects in the presence of multiple views. Reviewed-on: https://gerrit.libreoffice.org/71715 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky (cherry picked from commit fba6d4267b3f827269d6550dcb003cc56b31e493) Change-Id: I8d846bc1f794cf16fd45486fd83ef87f43fd52c7 Reviewed-on: https://gerrit.libreoffice.org/76555 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e0647da2f6af..112f29f4c59e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1939,6 +1939,7 @@ void DesktopLOKTest::testWriterCommentInsertCursor() CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty()); Scheduler::ProcessEventsToIdle(); +pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast(1)); } #if HAVE_MORE_FONTS @@ -2210,6 +2211,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); CPPUNIT_ASSERT_EQUAL(static_cast(5), aTree.get_child("comments").size()); + +pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast(1)); } void DesktopLOKTest::testRunMacro() @@ -2629,6 +2632,7 @@ void DesktopLOKTest::testShowHideDialog() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get("action")); +pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast(1)); } namespace { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f8d93534f44a..89078209ef43 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2828,6 +2828,22 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, LibLODocument_Impl* pDocument = static_cast(pThis); +// This is used by unit-tests to unregister stack-local callback objects where we have multiple views +// so we cannot rely on SfxLokHelper::getView +if (pCallback == nullptr && pData != nullptr) +{ +for (auto& pair1 : pDocument->mpCallbackFlushHandlers) +{ +int nView = pair1.first; +for (auto& pair2 : pDocument->mpCallbackFlushHandlers) +{ +pair2.second->removeViewStates(nView); +} +pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pThis, nullptr, nullptr)); +} +return; +} + int nView = SfxLokHelper::getView(); if (nView < 0) return; diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx index 678c5538aa0b..b958d840dd3b 100644 --- a/sfx2/source/sidebar/SidebarChildWindow.cxx +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -33,7 +33,7 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR); SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow(pParentWindow, nId) -, mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress") +, mbSidebarVisibleInLOK(pInfo && (pInfo->aModule == "scalc" || pInfo->aModule == "swriter")) { auto pDockWin = VclPtr::Create( pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN @@ -53,8 +53,12 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nI // HACK: unfortunately I haven't found a clean solution to do // this, so do it this way: // -pDockWin->SetSizePixel(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), -pDockWin->GetSizePixel().Height())); +if (!comphelper::LibreOfficeKit::isActive()) +{ +pDockWin->SetSizePixel( +Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), + pDockWin->GetSizePixel().Height())); +} } pDockWin->Initialize(pInfo); ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: desktop/qa desktop/source sc/source sd/qa sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 10 ++-- desktop/source/lib/init.cxx | 16 +- desktop/source/lib/lokinteractionhandler.cxx |2 sc/source/ui/app/inputwin.cxx|7 ++ sd/qa/unit/tiledrendering/tiledrendering.cxx | 64 --- sfx2/source/control/dispatch.cxx |4 - 6 files changed, 27 insertions(+), 76 deletions(-) New commits: commit d2bb93e299f42e2ab4ea8940fb4dc5da01a386b6 Author: Ashod Nakashian AuthorDate: Thu Aug 9 23:14:34 2018 -0400 Commit: Noel Grandin CommitDate: Mon Jul 29 21:21:44 2019 +0200 sfx2: Re-enable the sidebars for LOK This re-enables the sidebars for LOK, which were disabled to avoid overheads. Also, fixes a regression where editing stopped when loading a new view because the sidebar window creation killed the edit view. Revert "Avoid various desktop GUI elements when used from LibreOfficeKit" This reverts commit c0b70ec34d5e056bb92a66cbf83838923cb41fee. Also (added by Noel to the above commit) (1) Comment out parts DesktopLOKTest::testPaintPartTile test that trigger a crash. We are installing a callback that points to something on the stack, and then not removing that callback, resulting in calls to random stack memory. There is a further problem in the LOK code in that we cannot uninstall a callback when we have multiple views because the uninstall code in doc_registerCallback can only remove a callback for the __current__ view, which I do not fix here. (2) prevent code from accidentally creating empty entries in the mpCallbackFlushHandlers map, which is what happens when you use the index operator on map, which results in a crash in doc_registerCallback because the std::shared_ptr is empty. (3) In SdTiledRenderingTest, only turn off LOK via LibreOfficeKit::setActive(false) once the document has been torn down. Otherwise, we don't remove entries from the statically allocated s_pLOKWindowsMap map in vcl/source/window/window.cxx, which means that at process exit, we have dangling Window objects. Reviewed-on: https://gerrit.libreoffice.org/71165 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky (cherry picked from commit 88565c3662c6fde240c98a9b4f2ce6dfbcf4094e) Change-Id: I06b06a990f05c06b1889fa89b698dff6f494e09c Reviewed-on: https://gerrit.libreoffice.org/76466 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index f10e1fb0f035..e0647da2f6af 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1865,17 +1865,17 @@ void DesktopLOKTest::testPaintPartTile() // Load an impress doc of 2 slides. comphelper::LibreOfficeKit::setActive(); -ViewCallback aView1; -ViewCallback aView2; +//ViewCallback aView1; +//ViewCallback aView2; LibLODocument_Impl* pDocument = loadDoc("2slides.odp"); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +//pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); int nView1 = pDocument->m_pDocumentClass->getView(pDocument); // Create a second view. pDocument->m_pDocumentClass->createView(pDocument); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); +//pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); // Go to the second slide in the second view. pDocument->m_pDocumentClass->setPart(pDocument, 1); @@ -1894,7 +1894,7 @@ void DesktopLOKTest::testPaintPartTile() // Type again. Scheduler::ProcessEventsToIdle(); -aView1.m_bTilesInvalidated = false; +//aView1.m_bTilesInvalidated = false; pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0); pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0); Scheduler::ProcessEventsToIdle(); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6bed02b869e6..f8d93534f44a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2711,8 +2711,12 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, } // Disable callbacks while we are painting. -if (nOrigViewId >= 0 && pDocument->mpCallbackFlushHandlers[nOrigViewId]) - pDocument->mpCallbackFlushHandlers[nOrigViewId]->setPartTilePainting(true); +if (nOrigViewId >= 0) +{ +auto findIt = pDocument->mpCallbackFlushHandlers.find(nOrigViewId); +if (findIt != pDocument->mpCallbackFlushHandlers.end()) +
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 - desktop/source/app/app.cxx |2 - desktop/source/app/dispatchwatcher.cxx |4 +- desktop/source/deployment/gui/dp_gui_updatedialog.cxx |5 +-- desktop/source/lib/init.cxx | 17 desktop/source/migration/migration.cxx | 14 +++-- desktop/source/migration/services/oo3extensionmigration.cxx |3 -- 7 files changed, 19 insertions(+), 28 deletions(-) New commits: commit 2ec1c7a69917ce39850addc49ea3eb8618869aac Author: Noel Grandin AuthorDate: Fri Jul 19 14:03:53 2019 +0200 Commit: Noel Grandin CommitDate: Fri Jul 19 14:52:24 2019 +0200 loplugin:referencecasting in desktop Change-Id: I9ba4243bc3d6b14e66694728deb270ed74a70d01 Reviewed-on: https://gerrit.libreoffice.org/75949 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a3db0fd57b1f..e590b0a7f974 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -878,7 +878,7 @@ void DesktopLOKTest::testWriterComments() LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); pDocument->pClass->registerCallback(pDocument, ::callback, this); -uno::Reference xToolkit(com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY); +uno::Reference xToolkit = com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()); // Insert a comment at the beginning of the document and wait till the main // loop grabs the focus, so characters end up in the annotation window. diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0867f6b5e82d..4feef4a7c27b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2291,7 +2291,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) if ( !xTask.is() ) { // get any task if there is no active one -Reference< css::container::XIndexAccess > xList( xDesktop->getFrames(), css::uno::UNO_QUERY ); +Reference< css::container::XIndexAccess > xList = xDesktop->getFrames(); if ( xList->getCount() > 0 ) xList->getByIndex(0) >>= xTask; } diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 96f0a7f69168..af0a6d9ffd93 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -771,7 +771,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector xList( xDesktop->getFrames(), UNO_QUERY ); +Reference< XElementAccess > xList = xDesktop->getFrames(); if ( !xList->hasElements() ) { @@ -799,7 +799,7 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& ) { // We have to check if we have an open task otherwise we have to shutdown the office. Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); -Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY ); +Reference< XElementAccess > xList = xDesktop->getFrames(); if ( !xList->hasElements() ) { diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 3cff34b814ce..e55a7ea717eb 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -228,9 +228,8 @@ UpdateDialog::Thread::Thread( { if( m_context.is() ) { -m_xInteractionHdl.set( -task::InteractionHandler::createWithParent(m_context, dialog.getDialog()->GetXWindow()), -uno::UNO_QUERY ); +m_xInteractionHdl = +task::InteractionHandler::createWithParent(m_context, dialog.getDialog()->GetXWindow()); m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f48f9846d063..1a18e296a092 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3484,11 +3484,9 @@ static char* getLanguages(const char* pCommand) css::uno::Reference xLangSrv = css::linguistic2::LinguServiceManager::create(xContext); if (xLangSrv.is()) { -css::uno::Reference xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY); -css::uno::Reference xLocales(xSpell, css::uno::UNO_QUERY); - -if (xLocales.is()) -aLocales = xLocales->getLocales(); +css::uno::Reference xSpell = xLangSrv->getSpellChecker(); +if (xSpell.is()) +
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sd/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- desktop/source/lib/init.cxx | 18 ++ include/LibreOfficeKit/LibreOfficeKit.h |3 +++ include/LibreOfficeKit/LibreOfficeKit.hxx |8 include/vcl/ITiledRenderable.hxx|6 ++ sd/source/ui/inc/unomodel.hxx |2 ++ sd/source/ui/unoidl/unomodel.cxx|7 +++ 7 files changed, 46 insertions(+), 1 deletion(-) New commits: commit 0e82806ed6841c0a6919f97660ed4622c89d2338 Author: Ashod Nakashian AuthorDate: Sun Sep 16 17:27:35 2018 -0400 Commit: Jan Holesovsky CommitDate: Wed Jul 17 09:46:17 2019 +0200 LOK: support for ordering/moving parts Currently reordering of slides is only supported for presentations, although it is provisioned for spreadsheets as well. Change-Id: I6c35066d6a5ef7586d34a8e8b89db69a20b86572 Reviewed-on: https://gerrit.libreoffice.org/69612 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/73495 Tested-by: Jenkins Reviewed-by: Jan Holesovsky diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 75b9143e4417..a3db0fd57b1f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2716,9 +2716,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c8ec63210664..f48f9846d063 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -711,6 +711,7 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect); +static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); static void doc_paintTile(LibreOfficeKitDocument* pThis, @@ -862,6 +863,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; m_pDocumentClass->selectPart = doc_selectPart; +m_pDocumentClass->moveSelectedParts = doc_moveSelectedParts; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->paintTile = doc_paintTile; @@ -2358,6 +2360,22 @@ static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect pDoc->selectPart( nPart, nSelect ); } +static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate) +{ +SolarMutexGuard aGuard; +if (gImpl) +gImpl->maLastExceptionMsg.clear(); + +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +return; +} + +pDoc->moveSelectedParts(nPosition, bDuplicate); +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { comphelper::ProfileZone aZone("doc_getPartPageRectangles"); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 81a4787d24df..896b441ff715 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -381,6 +381,9 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::selectPart(). void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect); +/// @see lok::Document::moveSelectedParts(). +void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 70c80d626493828cc40227de4cdcfb1842356069 Author: Andrea Gelmini AuthorDate: Wed Jul 10 16:58:52 2019 +0200 Commit: Julien Nabet CommitDate: Wed Jul 10 17:09:21 2019 +0200 Fix typo Change-Id: Ifca7c0626f9671c1539e7828eb993278574ea10c Reviewed-on: https://gerrit.libreoffice.org/75367 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e51346e22587..75b9143e4417 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -927,7 +927,7 @@ void DesktopLOKTest::testTrackChanges() pDocument->pClass->registerCallback(pDocument, ::callback, this); Scheduler::ProcessEventsToIdle(); -// Enable trak changes and assert that both views get notified. +// Enable track changes and assert that both views get notified. m_nTrackChanges = 0; pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); Scheduler::ProcessEventsToIdle(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sd/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |5 +-- desktop/source/lib/init.cxx | 20 include/LibreOfficeKit/LibreOfficeKit.h |3 + include/LibreOfficeKit/LibreOfficeKit.hxx | 12 ++- include/vcl/ITiledRenderable.hxx|8 sd/source/ui/inc/DrawViewShell.hxx |2 + sd/source/ui/inc/unomodel.hxx |3 + sd/source/ui/unoidl/unomodel.cxx|9 + sd/source/ui/view/drviews1.cxx | 46 9 files changed, 104 insertions(+), 4 deletions(-) New commits: commit 74d56d44804efa3424cff3434d2baf00c60b3cd5 Author: Ashod Nakashian AuthorDate: Tue Sep 11 08:11:47 2018 -0400 Commit: Jan Holesovsky CommitDate: Wed Jul 10 15:32:53 2019 +0200 slide-sorter: multiple selection Change-Id: I8624de25b0bb66020002890f33758e52059a24ab Reviewed-on: https://gerrit.libreoffice.org/69610 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/73493 Tested-by: Jenkins Reviewed-by: Jan Holesovsky diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index f3f09b71aa2a..e51346e22587 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -927,7 +927,7 @@ void DesktopLOKTest::testTrackChanges() pDocument->pClass->registerCallback(pDocument, ::callback, this); Scheduler::ProcessEventsToIdle(); -// Enable track changes and assert that both views get notified. +// Enable trak changes and assert that both views get notified. m_nTrackChanges = 0; pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); Scheduler::ProcessEventsToIdle(); @@ -2715,9 +2715,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b014080b4aff..c8ec63210664 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -710,6 +710,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis); static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis); static int doc_getPart(LibreOfficeKitDocument* pThis); static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart); +static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect); static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart); static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode); static void doc_paintTile(LibreOfficeKitDocument* pThis, @@ -860,6 +861,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getPartPageRectangles = doc_getPartPageRectangles; m_pDocumentClass->getPart = doc_getPart; m_pDocumentClass->setPart = doc_setPart; +m_pDocumentClass->selectPart = doc_selectPart; m_pDocumentClass->getPartName = doc_getPartName; m_pDocumentClass->setPartMode = doc_setPartMode; m_pDocumentClass->paintTile = doc_paintTile; @@ -2340,6 +2342,22 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart) return pMemory; } +static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect) +{ +SolarMutexGuard aGuard; +if (gImpl) +gImpl->maLastExceptionMsg.clear(); + +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +return; +} + +pDoc->selectPart( nPart, nSelect ); +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { comphelper::ProfileZone aZone("doc_getPartPageRectangles"); @@ -2696,6 +2714,8 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis, if (pDoc) { doc_iniUnoCommands(); +// Create the SlideSorter which is used for multiselection and reordering. +doc_postUnoCommand(pThis, ".uno:LeftPaneImpress", nullptr, false); pDoc->initializeForTiledRendering(
[Libreoffice-commits] core.git: desktop/qa postprocess/Module_postprocess.mk
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +++ postprocess/Module_postprocess.mk |4 2 files changed, 7 insertions(+) New commits: commit 09a322600b2343ff25218bba198da25d7bb7888c Author: Andras Timar AuthorDate: Thu Jan 24 10:28:07 2019 + Commit: Andras Timar CommitDate: Mon May 27 20:30:37 2019 +0200 disable a few failing unit tests in MPLv2 subset Change-Id: If7595983f7bf2d990687a64659a63a8a66b120bd Reviewed-on: https://gerrit.libreoffice.org/73049 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 280e0336f8bb..f3f09b71aa2a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include @@ -185,10 +186,12 @@ public: CPPUNIT_TEST(testExtractParameter); CPPUNIT_TEST(testGetSignatureState_Signed); CPPUNIT_TEST(testGetSignatureState_NonSigned); +#if !MPL_HAVE_SUBSET CPPUNIT_TEST(testInsertCertificate_DER_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_DOCX); CPPUNIT_TEST(testSignDocument_PEM_PDF); +#endif CPPUNIT_TEST(testTextSelectionHandles); CPPUNIT_TEST(testDialogPaste); CPPUNIT_TEST(testShowHideDialog); diff --git a/postprocess/Module_postprocess.mk b/postprocess/Module_postprocess.mk index b02faf7b9310..c1b0fad212d8 100644 --- a/postprocess/Module_postprocess.mk +++ b/postprocess/Module_postprocess.mk @@ -43,11 +43,15 @@ endif ifeq ($(OS),LINUX) ifneq ($(PKGFORMAT),) +# Implementation com.sun.star.xml.security.SEInitializer_Gpg +# does not provide a constructor or factory in case of MPLv2 subset +ifneq ($(MPL_SUBSET),TRUE) $(eval $(call gb_Module_add_check_targets,postprocess,\ CustomTarget_check_dynamic_objects \ )) endif endif +endif $(eval $(call gb_Module_add_check_targets,postprocess,\ CppunitTest_services \ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source sfx2/sdi sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 18 ++ desktop/source/lib/init.cxx |1 + sfx2/sdi/sfx.sdi|2 +- sw/source/uibase/dochdl/swdtflvr.cxx| 15 ++- sw/source/uibase/inc/swdtflvr.hxx |5 +++-- sw/source/uibase/shells/basesh.cxx | 10 +++--- 6 files changed, 40 insertions(+), 11 deletions(-) New commits: commit dd5c9897c4930cb30bd8e5d6a0018b9515970111 Author: Miklos Vajna AuthorDate: Thu May 23 13:06:54 2019 +0200 Commit: Miklos Vajna CommitDate: Thu May 23 13:41:39 2019 +0200 sw: add IgnoreComments parameter to .uno:Paste Which allows not hardcoding true for LOK. Change-Id: I644763ba052b148fc34283e361aa02f9bba2c5ee Reviewed-on: https://gerrit.libreoffice.org/72832 Reviewed-by: Miklos Vajna Tested-by: Michael Meeks diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d57ae546c7de..280e0336f8bb 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -586,6 +586,24 @@ void DesktopLOKTest::testPasteWriter() CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength())); // Writer is expected to support text/html. CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aText.getStr(), aText.getLength())); + +// Overwrite doc contents with a HTML paste. +pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); +Scheduler::ProcessEventsToIdle(); +OString aComment("foo baz"); +CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aComment.getStr(), aComment.getLength())); + +// Check if we have a comment. +uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); +uno::Reference xParagraphEnumerationAccess(xTextDocument->getText(), uno::UNO_QUERY); +uno::Reference xParagraphEnumeration = xParagraphEnumerationAccess->createEnumeration(); +uno::Reference xParagraph(xParagraphEnumeration->nextElement(), uno::UNO_QUERY); +uno::Reference xTextPortionEnumeration = xParagraph->createEnumeration(); +uno::Reference xTextPortion(xTextPortionEnumeration->nextElement(), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(OUString("Text"), xTextPortion->getPropertyValue("TextPortionType").get()); +// Without the accompanying fix in place, this test would have failed, as we had a comment +// between "foo" and "baz". +CPPUNIT_ASSERT(!xTextPortionEnumeration->hasMoreElements()); } void DesktopLOKTest::testPasteWriterJPEG() diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 646505603311..755d980139a2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3295,6 +3295,7 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons uno::Sequence aPropertyValues(comphelper::InitPropertySequence( { {"AnchorType", uno::makeAny(static_cast(text::TextContentAnchorType_AS_CHARACTER))}, +{"IgnoreComments", uno::makeAny(true)}, })); if (!comphelper::dispatchCommand(".uno:Paste", aPropertyValues)) { diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index d3e1157d96e2..3d8cade70309 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3022,7 +3022,7 @@ SfxTemplateItem ParaStyle SID_STYLE_FAMILY2 SfxVoidItem Paste SID_PASTE -(SfxUInt16Item AnchorType FN_PARAM_1) +(SfxUInt16Item AnchorType FN_PARAM_1, SfxBoolItem IgnoreComments FN_PARAM_2) [ AutoUpdate = FALSE, FastCall = TRUE, diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 6912152d8f56..e5e71a251629 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1249,7 +1249,7 @@ bool SwTransferable::IsPaste( const SwWrtShell& rSh, return bIsPaste; } -bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndStdIds nAnchorType) +bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndStdIds nAnchorType, bool bIgnoreComments) { SwPasteContext aPasteContext(rSh); @@ -1321,7 +1321,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt nLevel++; } while (rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) != nullptr); if ( SwTransferable::PasteData( rData, rSh, EXCHG_OUT_ACTION_INSERT_STRING, nActionFlags, SotClipboardFormatId::HTML, -nDestination, false, false, nullptr, 0, false, nAnchorType, )) +nDestination, false, false, nullptr, 0, false, nAnchorType, bIgnoreComments, )) { pDispatch->Execute(FN_CHAR_LEFT, SfxCallMode::SYNCHRON);
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 37 1 file changed, 37 insertions(+) New commits: commit 135eb77464a7a4682547e28ac5e291abff145f3c Author: Szymon Kłos AuthorDate: Mon May 13 14:48:47 2019 +0200 Commit: Szymon Kłos CommitDate: Tue May 14 17:54:24 2019 +0200 lok: test show/hide status of a window Change-Id: I610fa6c5b7f19a7c995e02c4aa50e55090271642 Reviewed-on: https://gerrit.libreoffice.org/72230 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 1d7ae45a3b2e..d57ae546c7de 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -139,6 +139,7 @@ public: void testSignDocument_PEM_PDF(); void testTextSelectionHandles(); void testDialogPaste(); +void testShowHideDialog(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -190,6 +191,7 @@ public: CPPUNIT_TEST(testSignDocument_PEM_PDF); CPPUNIT_TEST(testTextSelectionHandles); CPPUNIT_TEST(testDialogPaste); +CPPUNIT_TEST(testShowHideDialog); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -1784,6 +1786,7 @@ public: bool m_bTilesInvalidated; tools::Rectangle m_aOwnCursor; boost::property_tree::ptree m_aCommentCallbackResult; +boost::property_tree::ptree m_aCallbackWindowResult; ViewCallback() : m_bTilesInvalidated(false) @@ -1825,6 +1828,13 @@ public: m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment"); } break; +case LOK_CALLBACK_WINDOW: +{ +m_aCallbackWindowResult.clear(); +std::stringstream aStream(pPayload); +boost::property_tree::read_json(aStream, m_aCallbackWindowResult); +} +break; } } }; @@ -2573,6 +2583,33 @@ void DesktopLOKTest::testDialogPaste() Scheduler::ProcessEventsToIdle(); } +void DesktopLOKTest::testShowHideDialog() +{ +ViewCallback aView; + +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +pDocument->m_pDocumentClass->registerCallback(pDocument, ::callback, ); + +pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); +Scheduler::ProcessEventsToIdle(); + +VclPtr pWindow(Application::GetActiveTopWindow()); +CPPUNIT_ASSERT(pWindow); + +pWindow->Hide(); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(std::string("hide"), aView.m_aCallbackWindowResult.get("action")); + +pWindow->Show(); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get("action")); +} + namespace { constexpr size_t classOffset(int i) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ba74ae76b56d845132c149ac0aa5ca5d6a5693c6 Author: Andrea Gelmini AuthorDate: Wed May 8 10:13:18 2019 + Commit: Julien Nabet CommitDate: Sun May 12 09:00:15 2019 +0200 Fix typo Change-Id: Icb3714d9bc62b70dc57c07b0fad64ca6fea7c3e7 Reviewed-on: https://gerrit.libreoffice.org/72183 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 9240785d10c1..1d7ae45a3b2e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -904,7 +904,7 @@ void DesktopLOKTest::testTrackChanges() pDocument->pClass->registerCallback(pDocument, ::callback, this); Scheduler::ProcessEventsToIdle(); -// Enable trak changes and assert that both views get notified. +// Enable track changes and assert that both views get notified. m_nTrackChanges = 0; pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); Scheduler::ProcessEventsToIdle(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 112 ++-- desktop/source/lib/init.cxx | 10 ++ 2 files changed, 18 insertions(+), 104 deletions(-) New commits: commit da17ccaec39f50de68c3fdd431bc66a2bec04127 Author: Miklos Vajna AuthorDate: Thu May 9 18:13:20 2019 +0200 Commit: Miklos Vajna CommitDate: Thu May 9 22:22:29 2019 +0200 CppunitTest_desktop_lib: close the document while LOK is still active Otherwise the LOK notifiers won't be released (since LOK is not active), and we leak vcl::Windows in GetLOKWindowsMap()::s_pLOKWindowsMap. In dbgutil builds, this leads to an assertion failure if the sidebar is active. Change-Id: Idedb9578478ff4a9f2e17c0cfd203da6f007bdbd Reviewed-on: https://gerrit.libreoffice.org/72065 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e18cda94bb7d..9240785d10c1 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -78,7 +78,11 @@ public: virtual void tearDown() override { +if (m_pDocument) +m_pDocument->pClass->registerCallback(m_pDocument.get(), nullptr, nullptr); closeDoc(); +comphelper::LibreOfficeKit::setActive(false); + UnoApiTest::tearDown(); }; @@ -211,6 +215,7 @@ public: osl::Condition m_aContextMenuCondition; boost::property_tree::ptree m_aContextMenuResult; +std::unique_ptr m_pDocument; }; static Control* GetFocusControl(vcl::Window const * pParent) @@ -255,7 +260,8 @@ LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDoc { CPPUNIT_ASSERT(false); } -return new LibLODocument_Impl(mxComponent); +m_pDocument.reset(new LibLODocument_Impl(mxComponent)); +return m_pDocument.get(); } void DesktopLOKTest::closeDoc() @@ -367,7 +373,6 @@ void DesktopLOKTest::testGetStyles() CPPUNIT_FAIL("Unknown style family: " + rPair.first); } } -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testGetFonts() @@ -389,7 +394,6 @@ void DesktopLOKTest::testGetFonts() CPPUNIT_ASSERT( !rPair.second.empty()); } free(pJSON); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testCreateView() @@ -416,7 +420,6 @@ void DesktopLOKTest::testCreateView() pDocument->m_pDocumentClass->destroyView(pDocument, nId1); CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViewsCount(pDocument)); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testGetPartPageRectangles() @@ -440,7 +443,6 @@ void DesktopLOKTest::testGetPartPageRectangles() CPPUNIT_ASSERT_EQUAL(static_cast(1), aRectangles.size()); free(pRectangles); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testGetFilterTypes() @@ -456,7 +458,6 @@ void DesktopLOKTest::testGetFilterTypes() CPPUNIT_ASSERT(!aTree.empty()); CPPUNIT_ASSERT_EQUAL(std::string("application/vnd.oasis.opendocument.text"), aTree.get_child("writer8").get_child("MediaType").get_value()); free(pJSON); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testSearchCalc() @@ -490,9 +491,6 @@ void DesktopLOKTest::testSearchCalc() CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); // Result is on the first sheet. CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); - -pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testSearchAllNotificationsCalc() @@ -517,9 +515,6 @@ void DesktopLOKTest::testSearchAllNotificationsCalc() CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); // But we do get the selection afterwards. CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); - -pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testPaintTile() @@ -548,8 +543,6 @@ void DesktopLOKTest::testPaintTile() nTileHeight = 4000; aBuffer.resize(nCanvasWidth * nCanvasHeight * 4); pDocument->pClass->paintTile(pDocument, aBuffer.data(), nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); - -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testSaveAs() @@ -560,8 +553,6 @@ void DesktopLOKTest::testSaveAs() utl::TempFile aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", nullptr)); - -comphelper::LibreOfficeKit::setActive(false); } void DesktopLOKTest::testSaveAsCalc() @@ -572,8 +563,6 @@ void DesktopLOKTest::testSaveAsCalc() utl::TempFile aTempFile;
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit ios/LibreOfficeLight libreofficekit/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 51 desktop/source/lib/init.cxx | 37 desktop/source/lib/lokclipboard.cxx | 10 +- desktop/source/lib/lokclipboard.hxx |3 include/LibreOfficeKit/LibreOfficeKit.h |2 include/LibreOfficeKit/LibreOfficeKit.hxx |4 include/LibreOfficeKit/LibreOfficeKitEnums.h|3 ios/LibreOfficeLight/LibreOfficeLight/LOKit/Document.swift |8 - libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx |2 libreofficekit/qa/tilebench/tilebench.cxx |2 10 files changed, 107 insertions(+), 15 deletions(-) New commits: commit 2ead533d2383083925537832b473e3264811d454 Author: Henry Castro AuthorDate: Thu Apr 18 18:10:13 2019 -0400 Commit: Henry Castro CommitDate: Fri Apr 26 15:28:11 2019 +0200 lok: allow paste content to popup dialog Change-Id: I1893d52df505bc43428c37a624ca05c569ba1bc0 Reviewed-on: https://gerrit.libreoffice.org/70958 Tested-by: Jenkins Reviewed-by: Henry Castro diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a08d476a8bac..e18cda94bb7d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -22,7 +22,11 @@ #include +#include #include +#include +#include +#include #include #include #include @@ -130,6 +134,7 @@ public: void testInsertCertificate_PEM_DOCX(); void testSignDocument_PEM_PDF(); void testTextSelectionHandles(); +void testDialogPaste(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -180,6 +185,7 @@ public: CPPUNIT_TEST(testInsertCertificate_PEM_DOCX); CPPUNIT_TEST(testSignDocument_PEM_PDF); CPPUNIT_TEST(testTextSelectionHandles); +CPPUNIT_TEST(testDialogPaste); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -207,6 +213,23 @@ public: }; +static Control* GetFocusControl(vcl::Window const * pParent) +{ +sal_uInt16 nChildren = pParent->GetChildCount(); +for (sal_uInt16 nChild = 0; nChild < nChildren; ++nChild) +{ +vcl::Window* pChild = pParent->GetChild( nChild ); +Control* pCtrl = dynamic_cast(pChild); +if (pCtrl && pCtrl->HasControlFocus()) +return pCtrl; + +Control* pSubCtrl = GetFocusControl( pChild ); +if (pSubCtrl) +return pSubCtrl; +} +return nullptr; +} + LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType) { OUString aFileURL; @@ -2616,6 +2639,34 @@ void DesktopLOKTest::testTextSelectionHandles() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testDialogPaste() +{ +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false); +Scheduler::ProcessEventsToIdle(); + +SfxViewShell* pViewShell = SfxViewShell::Current(); +pViewShell->GetViewFrame()->GetBindings().Update(); + +VclPtr pWindow(Application::GetActiveTopWindow()); +CPPUNIT_ASSERT(pWindow); + +pDocument->pClass->postWindow(pDocument, pWindow->GetLOKWindowId(), LOK_WINDOW_PASTE, +"{ \"MimeType\" : { \"type\" : \"string\", \"value\" : \"text/plain;charset=utf-8\" }, \"Data\" : { \"type\" : \"[]byte\", \"value\" : \"www.softwarelibre.org.bo\" } }"); +Scheduler::ProcessEventsToIdle(); + +Control* pCtrlFocused = GetFocusControl(pWindow.get()); +CPPUNIT_ASSERT(pCtrlFocused); +ComboBox* pCtrlURL = dynamic_cast(pCtrlFocused); +CPPUNIT_ASSERT(pCtrlURL); +CPPUNIT_ASSERT_EQUAL(OUString("www.softwarelibre.org.bo"), pCtrlURL->GetText()); + +static_cast(pWindow.get())->Close(); +Scheduler::ProcessEventsToIdle(); +comphelper::LibreOfficeKit::setActive(false); +} + namespace { constexpr size_t classOffset(int i) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c4a36e9e182e..937331376024 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -358,6 +358,15 @@ std::vector desktop::jsonToPropertyValuesVector(const char aValue.Value <<= static_cast(OString(rValue.c_str()).toInt32()); else if (rType == "unsigned short") aValue.Value <<= static_cast(OString(rValue.c_str()).toUInt32()); +else if (rType == "[]byte") +{ +aNodeValue = rPair.second.get_child("value", aNodeNull); +if (aNodeValue != aNodeNull && aNodeValue.size() == 0) +{ +uno::Sequence< sal_Int8 > aSeqByte(reinterpret_cast(rValue.c_str()), rValue.size()); +aValue.Value <<= aSeqByte; +
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- desktop/source/lib/init.cxx | 22 -- include/LibreOfficeKit/LibreOfficeKit.h |3 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 10 +++--- 4 files changed, 32 insertions(+), 6 deletions(-) New commits: commit 6a2382c64f65d433d44ce74f936e42f744f04e21 Author: Ashod Nakashian AuthorDate: Thu Jan 24 06:51:46 2019 -0500 Commit: Michael Meeks CommitDate: Tue Apr 23 11:58:54 2019 +0200 LOK: support creating view with options This adds a new API createViewWithOptions that make createView similar to documentLoad, which also has documentViewWithOptions version. This is primarily to support setting per-view language and similar settings. Change-Id: I0ae5a5b2410cf9e053aee8f7c8a6204af9038a31 Reviewed-on: https://gerrit.libreoffice.org/68261 Reviewed-by: Andras Timar Tested-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/7 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a688350cb386..a08d476a8bac 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2699,9 +2699,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 0853678a0008..7fcf018813d4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -783,6 +783,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis, static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight); static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden); static int doc_createView(LibreOfficeKitDocument* pThis); +static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis, const char* pOptions); static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId); static void doc_setView(LibreOfficeKitDocument* pThis, int nId); static int doc_getView(LibreOfficeKitDocument* pThis); @@ -891,6 +892,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference renderShapeSelection = doc_renderShapeSelection; m_pDocumentClass->postWindowGestureEvent = doc_postWindowGestureEvent; +m_pDocumentClass->createViewWithOptions = doc_createViewWithOptions; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -1615,7 +1618,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, // 'Language=...' is an option that LOK consumes by itself, and does // not pass it as a parameter to the filter OUString aOptions = getUString(pOptions); -OUString aLanguage = extractParameter(aOptions, "Language"); +const OUString aLanguage = extractParameter(aOptions, "Language"); if (!aLanguage.isEmpty()) { @@ -3866,7 +3869,8 @@ static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int pDoc->setOutlineState(bColumn, nLevel, nIndex, bHidden); } -static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) +static int doc_createViewWithOptions(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, + const char* pOptions) { comphelper::ProfileZone aZone("doc_createView"); @@ -3874,9 +3878,23 @@ static int doc_createView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/ if (gImpl) gImpl->maLastExceptionMsg.clear(); +OUString aOptions = getUString(pOptions); +const OUString aLanguage = extractParameter(aOptions, "Language"); + +if (!aLanguage.isEmpty()) +{ +// Set the LOK language tag, used for dialog tunneling. +comphelper::LibreOfficeKit::setLanguageTag(LanguageTag(aLanguage)); +} + return SfxLokHelper::createView(); } +static int doc_createView(LibreOfficeKitDocument* pThis) +{ +return
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_app/test_desktop_app.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2e7aa6f7a5669e7c2b4029ef8b0785a7dbdee0eb Author: Andrea Gelmini AuthorDate: Thu Apr 18 13:40:50 2019 + Commit: Julien Nabet CommitDate: Fri Apr 19 22:58:39 2019 +0200 Fix typo Change-Id: I1849d00fbccabd4ba39c1c98f0ec3353b2135d41 Reviewed-on: https://gerrit.libreoffice.org/70966 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/desktop/qa/desktop_app/test_desktop_app.cxx b/desktop/qa/desktop_app/test_desktop_app.cxx index 1a027dfade78..ef88ae408c81 100644 --- a/desktop/qa/desktop_app/test_desktop_app.cxx +++ b/desktop/qa/desktop_app/test_desktop_app.cxx @@ -112,7 +112,7 @@ void Test::testTdf100837() { } { -// 3. Test enocded URLs +// 3. Test encoded URLs TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7cbar1", "ms-word:ofv%7cu%7Cbar2", "ms-word:nft%7Cu%7cbar3", "baz" }; desktop::CommandLineArgs args(supplier); auto vOpenList = args.GetOpenList(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_app/test_desktop_app.cxx |2 +- desktop/source/app/cmdlineargs.cxx |8 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit f6dc5636c1eda8aebeac3f7b85dd61499523d6a3 Author: Tamás Zolnai AuthorDate: Wed Apr 17 12:33:13 2019 +0200 Commit: Tamás Zolnai CommitDate: Wed Apr 17 23:36:58 2019 +0200 SharePoint connection: Better handling of encoded URLs Handle %7c with small letters. Make sure that the output parameter's content is not affected by decoding. Change-Id: Ie3faad2461815497c0edfb04a589fc57aeb7d66b Reviewed-on: https://gerrit.libreoffice.org/70873 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/desktop/qa/desktop_app/test_desktop_app.cxx b/desktop/qa/desktop_app/test_desktop_app.cxx index 055c8cf5434e..1a027dfade78 100644 --- a/desktop/qa/desktop_app/test_desktop_app.cxx +++ b/desktop/qa/desktop_app/test_desktop_app.cxx @@ -113,7 +113,7 @@ void Test::testTdf100837() { { // 3. Test enocded URLs -TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7Cbar1", "ms-word:ofv%7Cu%7Cbar2", "ms-word:nft%7Cu%7Cbar3", "baz" }; +TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7cbar1", "ms-word:ofv%7cu%7Cbar2", "ms-word:nft%7Cu%7cbar3", "baz" }; desktop::CommandLineArgs args(supplier); auto vOpenList = args.GetOpenList(); auto vForceOpenList = args.GetForceOpenList(); diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx old mode 100755 new mode 100644 index acb266eb335e..30d0c3f4cced --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -131,25 +131,25 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur long nURIlen = -1; // URL might be encoded -rest1 = rest1.replaceAll("%7C", "|"); +OUString decoded_rest = rest1.replaceAll("%7C", "|").replaceAll("%7c", "|"); // 2. Discriminate by command name (incl. 1st command argument descriptor) //Extract URI: everything up to possible next argument -if (rest1.startsWith("ofv|u|", )) +if (decoded_rest.startsWith("ofv|u|", )) { // Open for view - override only in default mode if (curEvt == CommandLineEvent::Open) curEvt = CommandLineEvent::View; nURIlen = rest2.indexOf("|"); } -else if (rest1.startsWith("ofe|u|", )) +else if (decoded_rest.startsWith("ofe|u|", )) { // Open for editing - override only in default mode if (curEvt == CommandLineEvent::Open) curEvt = CommandLineEvent::ForceOpen; nURIlen = rest2.indexOf("|"); } -else if (rest1.startsWith("nft|u|", )) +else if (decoded_rest.startsWith("nft|u|", )) { // New from template - override only in default mode if (curEvt == CommandLineEvent::Open) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_app/test_desktop_app.cxx | 23 +++ desktop/source/app/cmdlineargs.cxx |4 2 files changed, 27 insertions(+) New commits: commit 2317ad572cc330c4c2de95065ef275f58a9c83a1 Author: Tamás Zolnai AuthorDate: Tue Apr 16 10:45:12 2019 +0200 Commit: Tamás Zolnai CommitDate: Tue Apr 16 22:00:48 2019 +0200 SharePoint connection: Handle encoded URL passed as command line argument Change-Id: I3352bf9ade88bd86f7ca3d53238364216547d52b Reviewed-on: https://gerrit.libreoffice.org/70830 Tested-by: Jenkins Reviewed-by: Tamás Zolnai diff --git a/desktop/qa/desktop_app/test_desktop_app.cxx b/desktop/qa/desktop_app/test_desktop_app.cxx index ef588a580266..055c8cf5434e 100644 --- a/desktop/qa/desktop_app/test_desktop_app.cxx +++ b/desktop/qa/desktop_app/test_desktop_app.cxx @@ -110,6 +110,29 @@ void Test::testTdf100837() { CPPUNIT_ASSERT_EQUAL(OUString("bar"), vForceOpenList[0]); CPPUNIT_ASSERT_EQUAL(OUString("baz"), vForceOpenList[1]); } + +{ +// 3. Test enocded URLs +TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7Cbar1", "ms-word:ofv%7Cu%7Cbar2", "ms-word:nft%7Cu%7Cbar3", "baz" }; +desktop::CommandLineArgs args(supplier); +auto vOpenList = args.GetOpenList(); +auto vForceOpenList = args.GetForceOpenList(); +auto vViewList = args.GetViewList(); +auto vForceNewList = args.GetForceNewList(); +// 2 documents go to Open list: foo; baz +CPPUNIT_ASSERT_EQUAL(decltype(vOpenList.size())(2), vOpenList.size()); +CPPUNIT_ASSERT_EQUAL(OUString("foo"), vOpenList[0]); +CPPUNIT_ASSERT_EQUAL(OUString("baz"), vOpenList[1]); +// 1 document goes to ForceOpen list: bar1 +CPPUNIT_ASSERT_EQUAL(decltype(vForceOpenList.size())(1), vForceOpenList.size()); +CPPUNIT_ASSERT_EQUAL(OUString("bar1"), vForceOpenList[0]); +// 1 document goes to View list: bar2 +CPPUNIT_ASSERT_EQUAL(decltype(vViewList.size())(1), vViewList.size()); +CPPUNIT_ASSERT_EQUAL(OUString("bar2"), vViewList[0]); +// 1 document goes to ForceNew list: bar3 +CPPUNIT_ASSERT_EQUAL(decltype(vForceNewList.size())(1), vForceNewList.size()); +CPPUNIT_ASSERT_EQUAL(OUString("bar3"), vForceNewList[0]); +} } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx old mode 100644 new mode 100755 index 52f96dd84d88..acb266eb335e --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -129,6 +129,10 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur OUString rest2; long nURIlen = -1; + +// URL might be encoded +rest1 = rest1.replaceAll("%7C", "|"); + // 2. Discriminate by command name (incl. 1st command argument descriptor) //Extract URI: everything up to possible next argument if (rest1.startsWith("ofv|u|", )) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 + desktop/source/lib/init.cxx | 45 include/LibreOfficeKit/LibreOfficeKit.h |9 + include/LibreOfficeKit/LibreOfficeKit.hxx | 16 + 4 files changed, 72 insertions(+), 1 deletion(-) New commits: commit 4a68361d578fe3bf313f80d8e186079bd34b2300 Author: Tomaž Vajngerl AuthorDate: Mon Mar 25 18:23:36 2019 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Mar 26 01:31:46 2019 +0100 tdf#124146 support posting of gesture event for LOKit Change-Id: I51845f2e41dbcbe1ae6cb0a18cf9f42d5549968b Reviewed-on: https://gerrit.libreoffice.org/69657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 445901108ed4..413b697be70a 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2696,9 +2696,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), offsetof(struct _LibreOfficeKitDocumentClass, addCertificate)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a83af85d4441..dfbbdd8386dc 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -107,6 +107,7 @@ #include #include #include +#include #include #include #include @@ -744,6 +745,12 @@ static void doc_postWindowMouseEvent (LibreOfficeKitDocument* pThis, int nCount, int nButtons, int nModifier); +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + const char* pType, + int nX, + int nY, + int nOffset); static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, @@ -879,6 +886,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getSignatureState = doc_getSignatureState; m_pDocumentClass->renderShapeSelection = doc_renderShapeSelection; +m_pDocumentClass->postWindowGestureEvent = doc_postWindowGestureEvent; gDocumentClass = m_pDocumentClass; } @@ -3020,6 +3028,43 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned } } +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, const char* pType, int nX, int nY, int nOffset) +{ +SolarMutexGuard aGuard; +if (gImpl) +gImpl->maLastExceptionMsg.clear(); + +VclPtr pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); +if (!pWindow) +{ +gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found."; +return; +} + +OString aType(pType); +GestureEventType eEventType = GestureEventType::PanningUpdate; + +if (aType == "panBegin") +eEventType = GestureEventType::PanningBegin; +else if (aType == "panEnd") +eEventType = GestureEventType::PanningEnd; + +GestureEvent aEvent { +sal_Int32(nX), +sal_Int32(nY), +eEventType, +sal_Int32(nOffset), +PanningOrientation::Vertical, +}; + +if (Dialog* pDialog = dynamic_cast(pWindow.get())) +{ +pDialog->EnableInput(); +} + +Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, ); +} + static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 2df1cea6dd31..0e596f5067ba 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -356,10 +356,19 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::getSignatureState(). int (*getSignatureState) (LibreOfficeKitDocument* pThis); +// END CERTIFICATE
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 14 ++ 1 file changed, 14 insertions(+) New commits: commit b9d5c32b687d2747e7c4fe91b8890942f4548a5c Author: Miklos Vajna AuthorDate: Fri Jan 25 14:47:02 2019 +0100 Commit: Miklos Vajna CommitDate: Fri Jan 25 16:57:34 2019 +0100 CppunitTest_desktop_lib: avoid use-after-free The LOK callback registers a DesktopLOKTest instance, but depending on timing, VCL may invoke that callback after that instance is already deleted. The symptom is that all tests run fine, but the testsuite still crashes at the end. This can happen because DeInitVCL() indirectly calls Scheduler::ProcessEventsToIdle(), which desktop::CallbackFlushHandler::Invoke(), which may or may not invoke the (now gone) callback, depending on timing. This typically doesn't happen in debug builds, but it happens in release builds. Change-Id: I00fc07046c46ad602a8b26c022ffcc916d211346 Reviewed-on: https://gerrit.libreoffice.org/66909 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index c6678704f3e4..331877503775 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -466,6 +466,7 @@ void DesktopLOKTest::testSearchCalc() // Result is on the first sheet. CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -492,6 +493,7 @@ void DesktopLOKTest::testSearchAllNotificationsCalc() // But we do get the selection afterwards. CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -843,6 +845,7 @@ void DesktopLOKTest::testCommandResult() CPPUNIT_ASSERT_EQUAL(std::string(".uno:Bold"), aTree.get_child("commandName").get_value()); CPPUNIT_ASSERT_EQUAL(true, aTree.get_child("success").get_value()); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -886,6 +889,7 @@ void DesktopLOKTest::testWriterComments() // This was empty, typed characters ended up in the body text. CPPUNIT_ASSERT_EQUAL(OUString("test"), xTextField->getPropertyValue("Content").get()); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -910,6 +914,7 @@ void DesktopLOKTest::testTrackChanges() // This was 1, only the active view was notified. CPPUNIT_ASSERT_EQUAL(2, m_nTrackChanges); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -944,6 +949,7 @@ void DesktopLOKTest::testSheetOperations() CPPUNIT_ASSERT_EQUAL(aExpected[i], OString(pDocument->pClass->getPartName(pDocument, i))); } +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1057,6 +1063,7 @@ void DesktopLOKTest::testSheetSelections() free(pCopiedContent); } +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1239,6 +1246,7 @@ void DesktopLOKTest::testContextMenuCalc() CPPUNIT_ASSERT_EQUAL(aCheckedToCell.get().data(), std::string("false")); } +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1296,6 +1304,7 @@ void DesktopLOKTest::testContextMenuWriter() CPPUNIT_ASSERT_EQUAL(aEnabled.get().data(), std::string("true")); } +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1424,6 +1433,7 @@ void DesktopLOKTest::testContextMenuImpress() CPPUNIT_ASSERT_EQUAL(aCheckedHelpFront.get().data(), std::string("true")); } +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1895,6 +1905,7 @@ void DesktopLOKTest::testPaintPartTile() mxComponent.clear(); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -1937,6 +1948,7 @@ void DesktopLOKTest::testWriterCommentInsertCursor() Scheduler::ProcessEventsToIdle(); mxComponent.clear(); +pDocument->pClass->registerCallback(pDocument, nullptr, nullptr); comphelper::LibreOfficeKit::setActive(false); } @@ -2215,6 +2227,7 @@ void DesktopLOKTest::testCommentsCallbacksWriter() boost::property_tree::read_json(aStream, aTree); CPPUNIT_ASSERT_EQUAL(static_cast(5),
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 53 desktop/source/lib/init.cxx |2 - 2 files changed, 53 insertions(+), 2 deletions(-) New commits: commit fe9b4067e00015975e0a99f3f127b93338aa4269 Author: Jan Holesovsky AuthorDate: Fri Jan 11 11:39:29 2019 +0100 Commit: Jan Holesovsky CommitDate: Thu Jan 17 10:17:47 2019 +0100 lok: We cannot skip duplicates of SELECTION_START / _END. The scenario is like this (see the unit test): * double-click a word to select it (the handles appear) * click somewhere else (the selection and handles disappear) * double-click the same word again (the handles did not appear in this case) The reason was that the old state was remembered and the now thought duplicate state was discarded. Change-Id: Ia49200f12907c520067258b7570d4e21b365a8dd Reviewed-on: https://gerrit.libreoffice.org/66171 Tested-by: Jenkins Reviewed-by: Jan Holesovsky diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 55d8c6761420..c6678704f3e4 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -127,6 +127,7 @@ public: void testInsertCertificate_PEM_ODT(); void testInsertCertificate_PEM_DOCX(); void testSignDocument_PEM_PDF(); +void testTextSelectionHandles(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -176,11 +177,14 @@ public: CPPUNIT_TEST(testInsertCertificate_PEM_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_DOCX); CPPUNIT_TEST(testSignDocument_PEM_PDF); +CPPUNIT_TEST(testTextSelectionHandles); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); uno::Reference mxComponent; OString m_aTextSelection; +OString m_aTextSelectionStart; +OString m_aTextSelectionEnd; std::vector m_aSearchResultSelection; std::vector m_aSearchResultPart; int m_nSelectionBeforeSearchResult; @@ -256,6 +260,12 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) ++m_nSelectionAfterSearchResult; } break; +case LOK_CALLBACK_TEXT_SELECTION_START: +m_aTextSelectionStart = pPayload; +break; +case LOK_CALLBACK_TEXT_SELECTION_END: +m_aTextSelectionEnd = pPayload; +break; case LOK_CALLBACK_SEARCH_RESULT_SELECTION: { m_aSearchResultSelection.clear(); @@ -2547,6 +2557,49 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testTextSelectionHandles() +{ +comphelper::LibreOfficeKit::setActive(); + +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +pDocument->pClass->registerCallback(pDocument, ::callback, this); + +OString aText("hello"); +CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/plain;charset=utf-8", aText.getStr(), aText.getLength())); + +// select the inserted text +pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); +Scheduler::ProcessEventsToIdle(); +char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); +CPPUNIT_ASSERT_EQUAL(aText, OString(pText)); +free(pText); +CPPUNIT_ASSERT_EQUAL(OString("1418, 1418, 0, 275"), m_aTextSelectionStart); +CPPUNIT_ASSERT_EQUAL(OString("1898, 1418, 0, 275"), m_aTextSelectionEnd); + +// deselect & check +m_aTextSelectionStart = ""; +m_aTextSelectionEnd = ""; +pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE); +Scheduler::ProcessEventsToIdle(); +pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); +CPPUNIT_ASSERT_EQUAL(OString(), OString(pText)); +free(pText); +CPPUNIT_ASSERT_EQUAL(OString(), m_aTextSelectionStart); +CPPUNIT_ASSERT_EQUAL(OString(), m_aTextSelectionEnd); + +// select again; the positions of the selection handles have to be sent +// again +pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); +Scheduler::ProcessEventsToIdle(); +pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); +CPPUNIT_ASSERT_EQUAL(aText, OString(pText)); +free(pText); +CPPUNIT_ASSERT_EQUAL(OString("1418, 1418, 0, 275"), m_aTextSelectionStart); +CPPUNIT_ASSERT_EQUAL(OString("1898, 1418, 0, 275"), m_aTextSelectionEnd); + +comphelper::LibreOfficeKit::setActive(false); +} + namespace { constexpr size_t classOffset(int i) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7b3a8a81c945..c10283321221 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -843,8 +843,6 @@ CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li // Add the states
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/sfx2 sfx2/Library_sfx.mk sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx | 63 ++ desktop/source/lib/init.cxx | 78 + include/LibreOfficeKit/LibreOfficeKit.h | 10 ++ include/LibreOfficeKit/LibreOfficeKit.hxx | 12 ++ include/sfx2/DocumentSigner.hxx | 41 + sfx2/Library_sfx.mk |1 sfx2/source/doc/DocumentSigner.cxx | 125 7 files changed, 330 insertions(+) New commits: commit a8cb7cf68ff661b502e7c006fe4330098b5b0944 Author: Tomaž Vajngerl AuthorDate: Mon Dec 31 12:27:39 2018 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Jan 1 09:53:20 2019 +0100 lok: add signDocument to "Office" iface - to sign not opened docs. LOKit function "signDocument" can sign document without the need to open them. This is useful to sign PDF documents after they are created from a currently opened (ODF, DOCX) document. This adds DocumentDigner to sfx2, which could also be used in desktop LibreOffice without opening them and in further tests. Change-Id: Id6f242e817f594aa672f94f9c6f9b34e4035d46a Reviewed-on: https://gerrit.libreoffice.org/65767 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 740e2d4fdecf..55d8c6761420 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -126,6 +126,7 @@ public: void testInsertCertificate_DER_ODT(); void testInsertCertificate_PEM_ODT(); void testInsertCertificate_PEM_DOCX(); +void testSignDocument_PEM_PDF(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -174,6 +175,7 @@ public: CPPUNIT_TEST(testInsertCertificate_DER_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_ODT); CPPUNIT_TEST(testInsertCertificate_PEM_DOCX); +CPPUNIT_TEST(testSignDocument_PEM_PDF); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2485,6 +2487,66 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testSignDocument_PEM_PDF() +{ +comphelper::LibreOfficeKit::setActive(); + +// Load the document, save it into a temp file and load that file again +LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); + +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT(mxComponent.is()); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +Scheduler::ProcessEventsToIdle(); + +std::vector aCertificate; +std::vector aPrivateKey; + +{ +readFileIntoByteVector("test-cert-chain-1.pem", aCertificate); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +{ +readFileIntoByteVector("test-cert-chain-2.pem", aCertificate); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +{ +readFileIntoByteVector("test-cert-chain-3.pem", aCertificate); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "pdf", nullptr)); + +closeDoc(); + +Scheduler::ProcessEventsToIdle(); + +readFileIntoByteVector("test-cert-signing.pem", aCertificate); +readFileIntoByteVector("test-PK-signing.pem", aPrivateKey); + +LibLibreOffice_Impl aOffice; +bool bResult = aOffice.m_pOfficeClass->signDocument(, aTempFile.GetURL().toUtf8().getStr(), + aCertificate.data(), int(aCertificate.size()), + aPrivateKey.data(), int(aPrivateKey.size())); + +CPPUNIT_ASSERT(bResult); + +comphelper::LibreOfficeKit::setActive(false); +} + namespace { constexpr size_t classOffset(int i) @@ -2513,6 +2575,7 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(classOffset(8), offsetof(struct _LibreOfficeKitClass, setDocumentPassword)); CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo)); CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro)); +CPPUNIT_ASSERT_EQUAL(classOffset(11), offsetof(struct _LibreOfficeKitClass, signDocument)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct
[Libreoffice-commits] core.git: desktop/qa xmlsecurity/inc xmlsecurity/source
desktop/qa/desktop_lib/test_desktop_lib.cxx|6 + xmlsecurity/inc/documentsignaturemanager.hxx |2 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 21 xmlsecurity/source/helper/documentsignaturemanager.cxx | 76 - 4 files changed, 65 insertions(+), 40 deletions(-) New commits: commit 49fcd3bbb30f93763fc5cb80fa6ac5cec5d00834 Author: Tomaž Vajngerl AuthorDate: Mon Dec 24 15:11:30 2018 +0100 Commit: Tomaž Vajngerl CommitDate: Mon Dec 24 23:03:02 2018 +0100 Fix signing empty Configurations2/accelerator/current.xml When determining if a file is an XML file for siging, we need to read the manifest file to get an accurate detection. In case when we were signing in the GUI the manifest file was read when the storage was set. When we didn't sign over the GUI, the manifest was never read: the code was only present in the GUI code - "documentsignaturesdialog.cxx" so the detection was wrong and isXML returned "true" for current.xml. With this we move the manifest reading to DigitalSignatureManager, where the manifest is read when needed. Change-Id: If45a32af6410bc5f7c5afdb976b182bd69ab7d6b Reviewed-on: https://gerrit.libreoffice.org/65600 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e7694905747e..a934ac5cc982 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2372,6 +2372,9 @@ void DesktopLOKTest::testInsertCertificate() CPPUNIT_ASSERT(bResult); } +int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); +CPPUNIT_ASSERT_EQUAL(int(1), nState); + comphelper::LibreOfficeKit::setActive(false); } @@ -2458,6 +2461,9 @@ void DesktopLOKTest::testInsertCertificatePEM() CPPUNIT_ASSERT(bResult); } +int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); +CPPUNIT_ASSERT_EQUAL(int(1), nState); + comphelper::LibreOfficeKit::setActive(false); } diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx index d67e08318123..85ad7cb07b1e 100644 --- a/xmlsecurity/inc/documentsignaturemanager.hxx +++ b/xmlsecurity/inc/documentsignaturemanager.hxx @@ -83,6 +83,8 @@ public: * differently when they are signed (c14n transformation) */ bool isXML(const OUString& rURI); +bool readManifest(); + SignatureStreamHelper ImplOpenSignatureStream(sal_Int32 nStreamOpenMode, bool bTempStream); /// Add a new signature, using xCert as a signing certificate, and rDescription as description. bool add(const css::uno::Reference& xCert, diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index a09dfad43edd..63c0c839ccc1 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -243,26 +242,6 @@ void DigitalSignaturesDialog::SetStorage( const css::uno::Reference < css::embed maSignatureManager.mxStore = rxStore; maSignatureManager.maSignatureHelper.SetStorage( maSignatureManager.mxStore, m_sODFVersion); - -Reference < css::packages::manifest::XManifestReader > xReader = -css::packages::manifest::ManifestReader::create(mxCtx); - -uno::Reference xNameAccess(rxStore, uno::UNO_QUERY); -if (!xNameAccess.is()) -return; - -if (xNameAccess->hasByName("META-INF")) -{ -//Get the manifest.xml -Reference < css::embed::XStorage > xSubStore(rxStore->openStorageElement( -"META-INF", css::embed::ElementModes::READ), UNO_QUERY_THROW); - -Reference< css::io::XInputStream > xStream( -xSubStore->openStreamElement("manifest.xml", css::embed::ElementModes::READ), -UNO_QUERY_THROW); - -maSignatureManager.m_manifest = xReader->readManifestSequence(xStream); -} } void DigitalSignaturesDialog::SetSignatureStream( const css::uno::Reference < css::io::XStream >& rxStream ) diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index 2b3c0a8c9fc1..5da6459779f7 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -125,6 +126,40 @@ bool DocumentSignatureManager::IsXAdESRelevant() } #endif +bool DocumentSignatureManager::readManifest() +{ +// Check if manifest was already read +if (m_manifest.getLength() > 0) +return true; + +if (!mxContext.is()) +return false; + +
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/desktop_lib/test_desktop_lib.cxx | 17 + 1 file changed, 17 insertions(+) New commits: commit 868a683138308727496f53b43aa145a0a4e03c83 Author: Tor Lillqvist AuthorDate: Thu Dec 13 13:30:24 2018 +0200 Commit: Tor Lillqvist CommitDate: Thu Dec 13 13:58:21 2018 +0200 Un-revert the addition of more ABI checks for LibreOfficeKitClass Change-Id: Idf2ebb552065fa600a4010e83a24a0f13651c029 diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 74e2c09bb5af..e7694905747e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2463,6 +2463,11 @@ void DesktopLOKTest::testInsertCertificatePEM() namespace { +constexpr size_t classOffset(int i) +{ +return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); +} + constexpr size_t documentClassOffset(int i) { return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); @@ -2473,6 +2478,18 @@ constexpr size_t documentClassOffset(int i) void DesktopLOKTest::testABI() { // STABLE ABI, NEVER CHANGE (unless there's a very good reason, agreed by ESC, etc.) +CPPUNIT_ASSERT_EQUAL(classOffset(0), offsetof(struct _LibreOfficeKitClass, destroy)); +CPPUNIT_ASSERT_EQUAL(classOffset(1), offsetof(struct _LibreOfficeKitClass, documentLoad)); +CPPUNIT_ASSERT_EQUAL(classOffset(2), offsetof(struct _LibreOfficeKitClass, getError)); +CPPUNIT_ASSERT_EQUAL(classOffset(3), offsetof(struct _LibreOfficeKitClass, documentLoadWithOptions)); +CPPUNIT_ASSERT_EQUAL(classOffset(4), offsetof(struct _LibreOfficeKitClass, freeError)); +CPPUNIT_ASSERT_EQUAL(classOffset(5), offsetof(struct _LibreOfficeKitClass, registerCallback)); +CPPUNIT_ASSERT_EQUAL(classOffset(6), offsetof(struct _LibreOfficeKitClass, getFilterTypes)); +CPPUNIT_ASSERT_EQUAL(classOffset(7), offsetof(struct _LibreOfficeKitClass, setOptionalFeatures)); +CPPUNIT_ASSERT_EQUAL(classOffset(8), offsetof(struct _LibreOfficeKitClass, setDocumentPassword)); +CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo)); +CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx | 37 desktop/source/lib/init.cxx | 22 include/LibreOfficeKit/LibreOfficeKit.h | 10 --- include/LibreOfficeKit/LibreOfficeKit.hxx | 29 - 4 files changed, 98 deletions(-) New commits: commit ef9e7c83267d9bfa7f225a25fceafa1027a21a6a Author: Tor Lillqvist AuthorDate: Thu Dec 13 13:18:46 2018 +0200 Commit: Tor Lillqvist CommitDate: Thu Dec 13 13:20:30 2018 +0200 Revert adding the tanslateGet() and translateNGet() API to LibreOfficeKit Will handle it another way instead that isn't so visible and annoying. This reverts commit 5f0dda8e9f2e35e1fdb5750089a70543478fa8a1. This reverts commit 4f1a341bc312673b8d92e4474cc39bc3ab69aa5b. Change-Id: If456d2792a5f2793ee6337898aaa4a55637f8522 diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 067541dd345d..74e2c09bb5af 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -119,7 +118,6 @@ public: void testCommentsImpress(); void testCommentsCallbacksWriter(); void testRunMacro(); -void testTranslate(); void testExtractParameter(); void testGetSignatureState_NonSigned(); void testGetSignatureState_Signed(); @@ -167,7 +165,6 @@ public: CPPUNIT_TEST(testCommentsImpress); CPPUNIT_TEST(testCommentsCallbacksWriter); CPPUNIT_TEST(testRunMacro); -CPPUNIT_TEST(testTranslate); CPPUNIT_TEST(testExtractParameter); CPPUNIT_TEST(testGetSignatureState_Signed); CPPUNIT_TEST(testGetSignatureState_NonSigned); @@ -,20 +2219,6 @@ void DesktopLOKTest::testRunMacro() comphelper::LibreOfficeKit::setActive(false); } -void DesktopLOKTest::testTranslate() -{ -comphelper::LibreOfficeKit::setActive(); - -LibLibreOffice_Impl aOffice; - -// Try translating to a non-existent locale, should return the English string -char *translated = aOffice.m_pOfficeClass->translateGet(, STR_DESCRIPTION_FACTORY_WRITER, "svt", "foo"); -CPPUNIT_ASSERT_EQUAL(0, strcmp(translated, "Text Document")); -free(translated); - -comphelper::LibreOfficeKit::setActive(false); -} - void DesktopLOKTest::testExtractParameter() { comphelper::LibreOfficeKit::setActive(); @@ -2480,11 +2463,6 @@ void DesktopLOKTest::testInsertCertificatePEM() namespace { -constexpr size_t classOffset(int i) -{ -return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); -} - constexpr size_t documentClassOffset(int i) { return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); @@ -2495,21 +2473,6 @@ constexpr size_t documentClassOffset(int i) void DesktopLOKTest::testABI() { // STABLE ABI, NEVER CHANGE (unless there's a very good reason, agreed by ESC, etc.) - -CPPUNIT_ASSERT_EQUAL(classOffset(0), offsetof(struct _LibreOfficeKitClass, destroy)); -CPPUNIT_ASSERT_EQUAL(classOffset(1), offsetof(struct _LibreOfficeKitClass, documentLoad)); -CPPUNIT_ASSERT_EQUAL(classOffset(2), offsetof(struct _LibreOfficeKitClass, getError)); -CPPUNIT_ASSERT_EQUAL(classOffset(3), offsetof(struct _LibreOfficeKitClass, documentLoadWithOptions)); -CPPUNIT_ASSERT_EQUAL(classOffset(4), offsetof(struct _LibreOfficeKitClass, freeError)); -CPPUNIT_ASSERT_EQUAL(classOffset(5), offsetof(struct _LibreOfficeKitClass, registerCallback)); -CPPUNIT_ASSERT_EQUAL(classOffset(6), offsetof(struct _LibreOfficeKitClass, getFilterTypes)); -CPPUNIT_ASSERT_EQUAL(classOffset(7), offsetof(struct _LibreOfficeKitClass, setOptionalFeatures)); -CPPUNIT_ASSERT_EQUAL(classOffset(8), offsetof(struct _LibreOfficeKitClass, setDocumentPassword)); -CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo)); -CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro)); -CPPUNIT_ASSERT_EQUAL(classOffset(11), offsetof(struct _LibreOfficeKitClass, translateGet)); -CPPUNIT_ASSERT_EQUAL(classOffset(12), offsetof(struct _LibreOfficeKitClass, translateNGet)); - CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index cf9352f3b2cc..90994a92c257 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1422,8 +1422,6 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis, const char* pPassword); static char* lo_getVersionInfo(LibreOfficeKit* pThis); static int lo_runMacro
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx | 37 desktop/source/lib/init.cxx | 22 include/LibreOfficeKit/LibreOfficeKit.h | 10 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 23 + 4 files changed, 92 insertions(+) New commits: commit 4f1a341bc312673b8d92e4474cc39bc3ab69aa5b Author: Tor Lillqvist AuthorDate: Mon Dec 10 16:12:08 2018 +0200 Commit: Tor Lillqvist CommitDate: Mon Dec 10 18:31:18 2018 +0100 Add a localisation API to LibreOfficeKitClass Combines the LanguageTag::Create() and Translate::get() (or nget()) functionality. Also add an ABI test for the Kit class in the LibreOfficeKit unit test, and a test for the translation function. Change-Id: I78c48a8bbb434d6f204869290822830288022a53 Reviewed-on: https://gerrit.libreoffice.org/64882 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 74e2c09bb5af..067541dd345d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -118,6 +119,7 @@ public: void testCommentsImpress(); void testCommentsCallbacksWriter(); void testRunMacro(); +void testTranslate(); void testExtractParameter(); void testGetSignatureState_NonSigned(); void testGetSignatureState_Signed(); @@ -165,6 +167,7 @@ public: CPPUNIT_TEST(testCommentsImpress); CPPUNIT_TEST(testCommentsCallbacksWriter); CPPUNIT_TEST(testRunMacro); +CPPUNIT_TEST(testTranslate); CPPUNIT_TEST(testExtractParameter); CPPUNIT_TEST(testGetSignatureState_Signed); CPPUNIT_TEST(testGetSignatureState_NonSigned); @@ -2219,6 +,20 @@ void DesktopLOKTest::testRunMacro() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testTranslate() +{ +comphelper::LibreOfficeKit::setActive(); + +LibLibreOffice_Impl aOffice; + +// Try translating to a non-existent locale, should return the English string +char *translated = aOffice.m_pOfficeClass->translateGet(, STR_DESCRIPTION_FACTORY_WRITER, "svt", "foo"); +CPPUNIT_ASSERT_EQUAL(0, strcmp(translated, "Text Document")); +free(translated); + +comphelper::LibreOfficeKit::setActive(false); +} + void DesktopLOKTest::testExtractParameter() { comphelper::LibreOfficeKit::setActive(); @@ -2463,6 +2480,11 @@ void DesktopLOKTest::testInsertCertificatePEM() namespace { +constexpr size_t classOffset(int i) +{ +return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); +} + constexpr size_t documentClassOffset(int i) { return sizeof(static_cast(nullptr)->nSize) + i * sizeof(void*); @@ -2473,6 +2495,21 @@ constexpr size_t documentClassOffset(int i) void DesktopLOKTest::testABI() { // STABLE ABI, NEVER CHANGE (unless there's a very good reason, agreed by ESC, etc.) + +CPPUNIT_ASSERT_EQUAL(classOffset(0), offsetof(struct _LibreOfficeKitClass, destroy)); +CPPUNIT_ASSERT_EQUAL(classOffset(1), offsetof(struct _LibreOfficeKitClass, documentLoad)); +CPPUNIT_ASSERT_EQUAL(classOffset(2), offsetof(struct _LibreOfficeKitClass, getError)); +CPPUNIT_ASSERT_EQUAL(classOffset(3), offsetof(struct _LibreOfficeKitClass, documentLoadWithOptions)); +CPPUNIT_ASSERT_EQUAL(classOffset(4), offsetof(struct _LibreOfficeKitClass, freeError)); +CPPUNIT_ASSERT_EQUAL(classOffset(5), offsetof(struct _LibreOfficeKitClass, registerCallback)); +CPPUNIT_ASSERT_EQUAL(classOffset(6), offsetof(struct _LibreOfficeKitClass, getFilterTypes)); +CPPUNIT_ASSERT_EQUAL(classOffset(7), offsetof(struct _LibreOfficeKitClass, setOptionalFeatures)); +CPPUNIT_ASSERT_EQUAL(classOffset(8), offsetof(struct _LibreOfficeKitClass, setDocumentPassword)); +CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo)); +CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro)); +CPPUNIT_ASSERT_EQUAL(classOffset(11), offsetof(struct _LibreOfficeKitClass, translateGet)); +CPPUNIT_ASSERT_EQUAL(classOffset(12), offsetof(struct _LibreOfficeKitClass, translateNGet)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 90994a92c257..cf9352f3b2cc 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1422,6 +1422,8 @@ static void lo_setDocumentPassword(LibreOfficeKit* pThis, const char* pPassword); static char*
[Libreoffice-commits] core.git: desktop/qa sc/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |2 +- sc/source/ui/view/gridwin.cxx |7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit e3ff84aed5be8e0d2780d80b178fa8fc0e388859 Author: Marco Cecchetti AuthorDate: Sat Oct 27 17:25:06 2018 + Commit: Jan Holesovsky CommitDate: Fri Nov 9 07:01:41 2018 +0100 lok: sc: make hi-dpi/zoom compatible with retrieving cell cursor A bit different approach than trying to handle different zoom levels at the samet time: instead, always handle the spreadsheet at 100%, but use cairo to scale to the actual zoom level. Change-Id: I318aec8fa4baaab2ee1f271223b2e10e26d41fcf Reviewed-on: https://gerrit.libreoffice.org/63040 Tested-by: Jenkins Reviewed-by: Jan Holesovsky diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 728af9163222..855bb398a570 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -784,7 +784,7 @@ void DesktopLOKTest::testCellCursor() OString aRectangle(aTree.get("commandValues").c_str()); // cell cursor geometry + col + row -CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1279, 255, 0, 0"), aRectangle); +CPPUNIT_ASSERT_EQUAL(OString("0, 0, 1274, 254, 0, 0"), aRectangle); comphelper::LibreOfficeKit::setActive(false); } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index ba4d08dc874a..914640ce392e 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5658,7 +5658,7 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight, return getCellCursor(zoomX, zoomY); } -OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) const +OString ScGridWindow::getCellCursor(const Fraction& /*rZoomX*/, const Fraction& /*rZoomY*/) const { // GridWindow stores a shown cell cursor in mpOOCursors, hence // we can use that to determine whether we would want to be showing @@ -5674,7 +5674,10 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo Fraction defaultZoomX = pViewData->GetZoomX(); Fraction defaultZoomY = pViewData->GetZoomY(); -pViewData->SetZoom(rZoomX, rZoomY, true); +// hardcode to what we mean as 100% (256px tiles meaning 3840 twips) +Fraction aFracX(long(256 * TWIPS_PER_PIXEL), 3840); +Fraction aFracY(long(256 * TWIPS_PER_PIXEL), 3840); +pViewData->SetZoom(aFracX, aFracY, true); Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); long nSizeXPix; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/qa desktop/source
desktop/qa/data/signed.odt |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 50 ++-- desktop/source/lib/init.cxx |2 + 3 files changed, 49 insertions(+), 3 deletions(-) New commits: commit 28a698db6f604137443053144dde94c9e553c0ef Author: Tomaž Vajngerl AuthorDate: Wed Oct 24 11:29:32 2018 +0200 Commit: Miklos Vajna CommitDate: Tue Nov 6 17:20:41 2018 +0100 lok: trigger sign. verification in getSignatureState + update test As the certificate chain can be added after the document was opened, we need to trigger signature verification every time the LOK API method getSignatureState is called. In addition update the tests so that they check the status of a document that's not signed, a document that was signed but the certificate chain is not available so the verification fails and later adding the certificate chain and the verification returns an OK status. Change-Id: I44578d0cece5bfc4a2e43fbbcd68b5ea1ccbc38b Reviewed-on: https://gerrit.libreoffice.org/62276 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/desktop/qa/data/signed.odt b/desktop/qa/data/signed.odt new file mode 100644 index ..49bd9dd240fe Binary files /dev/null and b/desktop/qa/data/signed.odt differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index ab0e98033b55..389d84a0cc31 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -118,7 +118,8 @@ public: void testCommentsCallbacksWriter(); void testRunMacro(); void testExtractParameter(); -void testGetSignatureState(); +void testGetSignatureState_NonSigned(); +void testGetSignatureState_Signed(); void testInsertCertificate(); void testABI(); @@ -163,7 +164,8 @@ public: CPPUNIT_TEST(testCommentsCallbacksWriter); CPPUNIT_TEST(testRunMacro); CPPUNIT_TEST(testExtractParameter); -CPPUNIT_TEST(testGetSignatureState); +CPPUNIT_TEST(testGetSignatureState_Signed); +CPPUNIT_TEST(testGetSignatureState_NonSigned); CPPUNIT_TEST(testInsertCertificate); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2246,7 +2248,49 @@ void DesktopLOKTest::testExtractParameter() comphelper::LibreOfficeKit::setActive(false); } -void DesktopLOKTest::testGetSignatureState() +void DesktopLOKTest::testGetSignatureState_Signed() +{ +comphelper::LibreOfficeKit::setActive(); +LibLODocument_Impl* pDocument = loadDoc("signed.odt"); +Scheduler::ProcessEventsToIdle(); +pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +int nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); +CPPUNIT_ASSERT_EQUAL(int(4), nState); + +{ +OUString aCertificateURL; +createFileURL("rootCA.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); +std::vector aCertificate; +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +{ +OUString aCertificateURL; +createFileURL("intermediateRootCA.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); +std::vector aCertificate; +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); + + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +nState = pDocument->m_pDocumentClass->getSignatureState(pDocument); +CPPUNIT_ASSERT_EQUAL(int(1), nState); + +comphelper::LibreOfficeKit::setActive(false); +} + +void DesktopLOKTest::testGetSignatureState_NonSigned() { comphelper::LibreOfficeKit::setActive(); LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index cc49f86e6d85..faf1dfa40936 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3752,6 +3752,8 @@ static int doc_getSignatureState(LibreOfficeKitDocument* pThis) if (!pObjectShell) return int(SignatureState::UNKNOWN); +pObjectShell->RecheckSignature(false); + return int(pObjectShell->GetDocumentSignatureState()); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org
[Libreoffice-commits] core.git: desktop/qa
desktop/qa/data/certificate.der |binary desktop/qa/data/certificatePrivateKey.der |binary desktop/qa/data/intermediateRootCA.der |binary desktop/qa/data/rootCA.der |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 66 5 files changed, 49 insertions(+), 17 deletions(-) New commits: commit ab7fabd8b116d16def53772720f19fad4dbd6366 Author: Tomaž Vajngerl AuthorDate: Wed Oct 24 11:19:32 2018 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Nov 5 08:58:54 2018 +0100 lok: update the test for singing the document from LOK Change-Id: Ie34d8c26bfbf4192cd2067c8315030903edb3fb3 Reviewed-on: https://gerrit.libreoffice.org/62274 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/data/certificate.der b/desktop/qa/data/certificate.der index 2a750ab281af..10e3ade13e3e 100644 Binary files a/desktop/qa/data/certificate.der and b/desktop/qa/data/certificate.der differ diff --git a/desktop/qa/data/certificatePrivateKey.der b/desktop/qa/data/certificatePrivateKey.der new file mode 100644 index ..7a5599c82521 Binary files /dev/null and b/desktop/qa/data/certificatePrivateKey.der differ diff --git a/desktop/qa/data/intermediateRootCA.der b/desktop/qa/data/intermediateRootCA.der new file mode 100644 index ..9adf7f82e5f6 Binary files /dev/null and b/desktop/qa/data/intermediateRootCA.der differ diff --git a/desktop/qa/data/rootCA.der b/desktop/qa/data/rootCA.der new file mode 100644 index ..30fc66e26f79 Binary files /dev/null and b/desktop/qa/data/rootCA.der differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a225fb6ad85d..ab0e98033b55 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2274,24 +2274,56 @@ void DesktopLOKTest::testInsertCertificate() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(mxComponent.is()); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +Scheduler::ProcessEventsToIdle(); + +{ +OUString aCertificateURL; +createFileURL("rootCA.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); +std::vector aCertificate; +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +{ +OUString aCertificateURL; +createFileURL("intermediateRootCA.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); +std::vector aCertificate; +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); -OUString aCertificateURL; -createFileURL("certificate.der", aCertificateURL); -SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); -std::vector aCertificate; -aCertificate.resize(aCertificateStream.remainingSize()); -aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); - -OUString aPrivateKeyURL; -createFileURL("pkey.der", aPrivateKeyURL); -SvFileStream aPrivateKeyStream(aPrivateKeyURL, StreamMode::READ); -std::vector aPrivateKey; -aPrivateKey.resize(aPrivateKeyStream.remainingSize()); -aPrivateKeyStream.ReadBytes(aPrivateKey.data(), aPrivateKeyStream.remainingSize()); - -pDocument->m_pDocumentClass->insertCertificate(pDocument, -aCertificate.data(), int(aCertificate.size()), -aPrivateKey.data(), int(aPrivateKey.size())); + +bool bResult = pDocument->m_pDocumentClass->addCertificate( +pDocument, aCertificate.data(), int(aCertificate.size())); +CPPUNIT_ASSERT(bResult); +} + +{ +OUString aCertificateURL; +createFileURL("certificate.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); +std::vector aCertificate; +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); + + +OUString aPrivateKeyURL; +createFileURL("certificatePrivateKey.der", aPrivateKeyURL); +SvFileStream aPrivateKeyStream(aPrivateKeyURL, StreamMode::READ); +std::vector aPrivateKey; +aPrivateKey.resize(aPrivateKeyStream.remainingSize()); +aPrivateKeyStream.ReadBytes(aPrivateKey.data(), aPrivateKeyStream.remainingSize()); + +bool bResult =
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit offapi/com xmlsecurity/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |6 - desktop/source/lib/init.cxx | 52 ++ include/LibreOfficeKit/LibreOfficeKit.h |5 include/LibreOfficeKit/LibreOfficeKit.hxx | 15 ++ offapi/com/sun/star/xml/crypto/XCertificateCreator.idl|9 + xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |7 + xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |4 7 files changed, 92 insertions(+), 6 deletions(-) New commits: commit 08c3c504644ee978c2ec75ba083765b6ffddf08c Author: Tomaž Vajngerl AuthorDate: Wed Oct 24 10:56:15 2018 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Oct 31 09:08:20 2018 +0100 lok: new function to add certificate to certificate DB Also needed to extend XCertificateCreator with a new method "addDERCertificateToTheDatabase". Change-Id: I7b4df65365893bd5a0628aeec30b3156584849fe Reviewed-on: https://gerrit.libreoffice.org/62273 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index aeb4f0692c42..a225fb6ad85d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2356,11 +2356,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), offsetof(struct _LibreOfficeKitDocumentClass, postWindowExtTextInputEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), offsetof(struct _LibreOfficeKitDocumentClass, getPartInfo)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(42), offsetof(struct _LibreOfficeKitDocumentClass, insertCertificate)); -CPPUNIT_ASSERT_EQUAL(documentClassOffset(43), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); - +CPPUNIT_ASSERT_EQUAL(documentClassOffset(43), offsetof(struct _LibreOfficeKitDocumentClass, addCertificate)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 1119886763ce..040218c1e314 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -696,6 +696,10 @@ static bool doc_insertCertificate(LibreOfficeKitDocument* pThis, const unsigned char* pPrivateKeyBinary, const int nPrivateKeyBinarySize); +static bool doc_addCertificate(LibreOfficeKitDocument* pThis, + const unsigned char* pCertificateBinary, + const int nCertificateBinarySize); + static int doc_getSignatureState(LibreOfficeKitDocument* pThis); LibLODocument_Impl::LibLODocument_Impl(const uno::Reference ) @@ -759,6 +763,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getPartInfo = doc_getPartInfo; m_pDocumentClass->insertCertificate = doc_insertCertificate; +m_pDocumentClass->addCertificate = doc_addCertificate; m_pDocumentClass->getSignatureState = doc_getSignatureState; gDocumentClass = m_pDocumentClass; @@ -3653,6 +3658,53 @@ static bool doc_insertCertificate(LibreOfficeKitDocument* pThis, return pObjectShell->SignDocumentContentUsingCertificate(xCertificate); } +static bool doc_addCertificate(LibreOfficeKitDocument* pThis, + const unsigned char* pCertificateBinary, const int nCertificateBinarySize) +{ +if (!xContext.is()) +return false; + +LibLODocument_Impl* pDocument = static_cast(pThis); + +if (!pDocument->mxComponent.is()) +return false; + +SfxBaseModel* pBaseModel = dynamic_cast(pDocument->mxComponent.get()); +if (!pBaseModel) +return false; + +SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); + +if (!pObjectShell) +return false; + +uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(xContext); +uno::Reference xSecurityContext; +xSecurityContext = xSEInitializer->createSecurityContext(OUString()); +if (!xSecurityContext.is()) +return false; + +uno::Reference xSecurityEnvironment; +xSecurityEnvironment = xSecurityContext->getSecurityEnvironment(); +uno::Reference xCertificateCreator(xSecurityEnvironment, uno::UNO_QUERY); + +if (!xCertificateCreator.is()) +return false; + +uno::Sequence aCertificateSequence(nCertificateBinarySize); +std::copy(pCertificateBinary, pCertificateBinary +
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit
desktop/qa/desktop_lib/test_desktop_lib.cxx | 35 +++- desktop/source/lib/init.cxx | 19 --- include/LibreOfficeKit/LibreOfficeKit.h |4 ++- include/LibreOfficeKit/LibreOfficeKit.hxx |8 -- 4 files changed, 49 insertions(+), 17 deletions(-) New commits: commit c2ceb1f54e85ebc8b38df3f2e4d1113a2fe1cc64 Author: Tomaž Vajngerl AuthorDate: Thu Oct 18 10:35:25 2018 +0200 Commit: Tomaž Vajngerl CommitDate: Mon Oct 29 19:35:04 2018 +0100 lok: create certificate and private key with insertCertificate Change-Id: Ie114068d9aec5259f9f7ed395c5dfeecf8bb787d Reviewed-on: https://gerrit.libreoffice.org/61915 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index bd8b08f9fac8..aeb4f0692c42 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2261,24 +2261,37 @@ void DesktopLOKTest::testInsertCertificate() { comphelper::LibreOfficeKit::setActive(); +// Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); +utl::TempFile aTempFile; +aTempFile.EnableKillingFile(); +CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "odt", nullptr)); +closeDoc(); + +mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); +pDocument = new LibLODocument_Impl(mxComponent); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(mxComponent.is()); pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); -OUString aFileURL; -createFileURL("certificate.der", aFileURL); - -SvFileStream aStream(aFileURL, StreamMode::READ); -sal_uInt64 nSize = aStream.remainingSize(); - +OUString aCertificateURL; +createFileURL("certificate.der", aCertificateURL); +SvFileStream aCertificateStream(aCertificateURL, StreamMode::READ); std::vector aCertificate; -aCertificate.resize(nSize); -aStream.ReadBytes(aCertificate.data(), nSize); - -bool bResult = pDocument->m_pDocumentClass->insertCertificate(pDocument, aCertificate.data(), int(aCertificate.size())); -CPPUNIT_ASSERT(bResult); +aCertificate.resize(aCertificateStream.remainingSize()); +aCertificateStream.ReadBytes(aCertificate.data(), aCertificateStream.remainingSize()); + +OUString aPrivateKeyURL; +createFileURL("pkey.der", aPrivateKeyURL); +SvFileStream aPrivateKeyStream(aPrivateKeyURL, StreamMode::READ); +std::vector aPrivateKey; +aPrivateKey.resize(aPrivateKeyStream.remainingSize()); +aPrivateKeyStream.ReadBytes(aPrivateKey.data(), aPrivateKeyStream.remainingSize()); + +pDocument->m_pDocumentClass->insertCertificate(pDocument, +aCertificate.data(), int(aCertificate.size()), +aPrivateKey.data(), int(aPrivateKey.size())); comphelper::LibreOfficeKit::setActive(false); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2a13775dcc64..b08c6d694f4a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -76,6 +76,7 @@ #include #include #include +#include #include #include #include @@ -691,7 +692,9 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart); static bool doc_insertCertificate(LibreOfficeKitDocument* pThis, const unsigned char* pCertificateBinary, - const int pCertificateBinarySize); + const int nCertificateBinarySize, + const unsigned char* pPrivateKeyBinary, + const int nPrivateKeyBinarySize); static int doc_getSignatureState(LibreOfficeKitDocument* pThis); @@ -3601,7 +3604,9 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo } // CERTIFICATE AND DOCUMENT SIGNING -static bool doc_insertCertificate(LibreOfficeKitDocument* /*pThis*/, const unsigned char* pCertificateBinary, const int nCertificateBinarySize) +static bool doc_insertCertificate(LibreOfficeKitDocument* /*pThis*/, + const unsigned char* pCertificateBinary, const int nCertificateBinarySize, + const unsigned char* pPrivateKeyBinary, const int nPrivateKeySize) { if (!xContext.is()) return false; @@ -3614,11 +3619,19 @@ static bool doc_insertCertificate(LibreOfficeKitDocument* /*pThis*/, const unsig uno::Reference xSecurityEnvironment; xSecurityEnvironment = xSecurityContext->getSecurityEnvironment(); +uno::Reference xCertificateCreator(xSecurityEnvironment, uno::UNO_QUERY); + +if (!xCertificateCreator.is()) +return false;
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/sfx2 sfx2/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |4 desktop/source/lib/init.cxx | 69 include/LibreOfficeKit/LibreOfficeKit.h | 10 ++ include/LibreOfficeKit/LibreOfficeKit.hxx | 19 include/sfx2/docfile.hxx|4 include/sfx2/objsh.hxx |3 sfx2/source/doc/docfile.cxx | 117 sfx2/source/doc/objserv.cxx | 79 ++ 8 files changed, 304 insertions(+), 1 deletion(-) New commits: commit 23a2312344ac961ead9ee14140c0b3e879bb7a41 Author: Tomaž Vajngerl AuthorDate: Mon Oct 15 10:09:15 2018 +0200 Commit: Tomaž Vajngerl CommitDate: Sun Oct 28 21:29:19 2018 +0100 lokit: add funct. to insert, sign and verify signature A lot of signing code paths trigger a GUI dialog (to select the certificate for example) which aren't acceptable when triggering through the LOKit. This code paths needed to be duplicated and reworked to not trigger any GUI action. Change-Id: I2f0d6038fb1bcd00adcdf86e432f9df8858cc21c Reviewed-on: https://gerrit.libreoffice.org/61780 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 69f2b3ac2bfb..9a8d7b88b0b7 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2299,10 +2299,12 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(39), offsetof(struct _LibreOfficeKitDocumentClass, setViewLanguage)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), offsetof(struct _LibreOfficeKitDocumentClass, postWindowExtTextInputEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), offsetof(struct _LibreOfficeKitDocumentClass, getPartInfo)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(42), offsetof(struct _LibreOfficeKitDocumentClass, insertCertificate)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(43), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(42), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a2182e9ea2a8..2a13775dcc64 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -73,6 +73,13 @@ #include #include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -682,6 +689,12 @@ static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart); +static bool doc_insertCertificate(LibreOfficeKitDocument* pThis, + const unsigned char* pCertificateBinary, + const int pCertificateBinarySize); + +static int doc_getSignatureState(LibreOfficeKitDocument* pThis); + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference ) : mxComponent(xComponent) { @@ -742,6 +755,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference getPartInfo = doc_getPartInfo; +m_pDocumentClass->insertCertificate = doc_insertCertificate; +m_pDocumentClass->getSignatureState = doc_getSignatureState; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -3584,6 +3600,59 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo } } +// CERTIFICATE AND DOCUMENT SIGNING +static bool doc_insertCertificate(LibreOfficeKitDocument* /*pThis*/, const unsigned char* pCertificateBinary, const int nCertificateBinarySize) +{ +if (!xContext.is()) +return false; + +uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(xContext); +uno::Reference xSecurityContext; +xSecurityContext = xSEInitializer->createSecurityContext(OUString()); +if (!xSecurityContext.is()) +return false; + +uno::Reference xSecurityEnvironment; +xSecurityEnvironment = xSecurityContext->getSecurityEnvironment(); + +uno::Sequence aCertificateSequence(nCertificateBinarySize); +std::copy(pCertificateBinary, pCertificateBinary + nCertificateBinarySize, aCertificateSequence.begin()); + +uno::Reference xCertificate = xSecurityEnvironment->createCertificateFromRaw(aCertificateSequence); + +if (!xCertificate.is()) +return false; + +printf("CERTIFICATE\n\tIssuerName: %s \n\tSubjectName: %s\n\tPK %s\n\n", +xCertificate->getIssuerName().toUtf8().getStr(), +xCertificate->getSubjectName().toUtf8().getStr(), +
[Libreoffice-commits] core.git: desktop/qa desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- desktop/source/lib/init.cxx | 22 ++ include/LibreOfficeKit/LibreOfficeKit.h |3 +++ include/vcl/ITiledRenderable.hxx|9 + sc/inc/docuno.hxx |3 +++ sc/source/ui/unoobj/docuno.cxx | 12 6 files changed, 51 insertions(+), 1 deletion(-) New commits: commit 8ffbb86b30e2c1674ba32e9e29447cbea3585d03 Author: Marco CecchettiDate: Thu Feb 1 12:17:45 2018 +0100 lok - calc: add support for show/hide tabs in online Change-Id: Ibd061414a0c3a5fad83d03f7047831cef62076d2 Reviewed-on: https://gerrit.libreoffice.org/49083 Tested-by: Jenkins Reviewed-by: Marco Cecchetti diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 0714b6804ca0..51e048d04af4 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2298,10 +2298,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(38), offsetof(struct _LibreOfficeKitDocumentClass, postWindowMouseEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(39), offsetof(struct _LibreOfficeKitDocumentClass, setViewLanguage)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), offsetof(struct _LibreOfficeKitDocumentClass, postWindowExtTextInputEvent)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), offsetof(struct _LibreOfficeKitDocumentClass, getPartInfo)); // Extending is fine, update this, and add new assert for the offsetof the // new method -CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), sizeof(struct _LibreOfficeKitDocumentClass)); +CPPUNIT_ASSERT_EQUAL(documentClassOffset(42), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 5959f4237738..67beb36d3a56 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -579,6 +579,8 @@ static void doc_paintWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction); +static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart); + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference ) : mxComponent(xComponent) { @@ -634,6 +636,8 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference setViewLanguage = doc_setViewLanguage; +m_pDocumentClass->getPartInfo = doc_getPartInfo; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -1856,6 +1860,24 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart) pDoc->setPart( nPart ); } +static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart) +{ +SolarMutexGuard aGuard; +ITiledRenderable* pDoc = getTiledRenderable(pThis); +if (!pDoc) +{ +gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; +return nullptr; +} + +OUString aPartInfo = pDoc->getPartInfo( nPart ); +OString aString = OUStringToOString(aPartInfo, RTL_TEXTENCODING_UTF8); + +char* pMemory = static_cast (malloc(aString.getLength() + 1)); +strcpy(pMemory, aString.getStr()); +return pMemory; +} + static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index d465d541b0e0..0799584d3097 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -306,6 +306,9 @@ struct _LibreOfficeKitDocumentClass int nType, const char* pText); +/// @see lok::Document::getPartInfo(). +char* (*getPartInfo) (LibreOfficeKitDocument* pThis, int nPart); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index e25cdd67506a..0b6b52373316 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -360,6 +360,15 @@ public: { return OUString(); } + +/* + * Used for sheets in spreadsheet documents. + */ +virtual OUString getPartInfo(int /*nPart*/) +{ +return OUString(); +} + }; } // namespace vcl diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 5e1ce12bd37a..f86c9048fe03 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -313,6 +313,9 @@ public: /// @see vcl::ITiledRenderable::getParts(). virtual int getParts() override; +/// @see vcl::ITiledRenderable::getPartInfo(). +virtual OUString
[Libreoffice-commits] core.git: desktop/qa officecfg/registry
desktop/qa/desktop_lib/test_desktop_lib.cxx |3 ++- officecfg/registry/schema/org/openoffice/Office/Draw.xcs|2 +- officecfg/registry/schema/org/openoffice/Office/Impress.xcs |2 +- 3 files changed, 4 insertions(+), 3 deletions(-) New commits: commit d799436414ab7e28b6bf9a918fd3779b3fc85008 Author: Samuel MehrbrodtDate: Wed Mar 14 14:25:44 2018 +0100 tdf#116342 Allow selecting text boxes anywhere by default Not only by hitting the (invisble) frame or the text content. Change-Id: I125f76a102611b628411d8c5acf70e3ed9e5e8fe Reviewed-on: https://gerrit.libreoffice.org/51276 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 4e4c4ee3f6ba..0714b6804ca0 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1280,7 +1280,8 @@ void DesktopLOKTest::testContextMenuImpress() pDocument->pClass->initializeForRendering(pDocument, nullptr); pDocument->pClass->registerCallback(pDocument, ::callback, this); -Point aRandomPoint(1150, 1100); +// random point where we don't hit an underlying comment or text box +Point aRandomPoint(10, 1150); pDocument->pClass->postMouseEvent(pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aRandomPoint.X(), aRandomPoint.Y(), diff --git a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs index ac2725eef58f..dab24b019bdc 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Draw.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Draw.xcs @@ -368,7 +368,7 @@ Indicates whether a text frame can only be selected by clicking on the text or by clicking somewhere in the frame. Only text area selectable - true + false diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs index e421a579a91e..e27df89f8129 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs @@ -591,7 +591,7 @@ Indicates whether a text frame can only be selected by clicking on the text or by clicking somewhere in the frame. Only text area selectable - true + false ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits