core.git: sw/qa sw/source
sw/qa/extras/ooxmlexport/data/comment_with_children.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 29 sw/source/filter/ww8/docxattributeoutput.cxx| 11 +++--- 3 files changed, 36 insertions(+), 4 deletions(-) New commits: commit 34d242f5099fdb9234ac047e5712aea6df113e4c Author: Jaume Pujantell AuthorDate: Thu Sep 19 19:22:21 2024 +0200 Commit: Jaume Pujantell CommitDate: Wed Sep 25 15:44:06 2024 +0200 tdf#163092 sw: fix broken anotations on save to docx Opening an odt file and saving it as docx would break the comment threads into unconnected comments. This also fixes a regression from commit 3bb2668f5e753e9fa6aa7eea74454bf11cdfc853 where creating a commet thread with multiple children and saving to docx would break it into separate threads. Change-Id: I76a0ec49bd69b953d816b3b5d3cc6d14065d5846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173681 Reviewed-by: Mike Kaganski Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173872 Tested-by: Jenkins Reviewed-by: Jaume Pujantell diff --git a/sw/qa/extras/ooxmlexport/data/comment_with_children.odt b/sw/qa/extras/ooxmlexport/data/comment_with_children.odt new file mode 100644 index ..83ff88c69595 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/comment_with_children.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index deea3789c446..924f8b970856 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -1187,6 +1187,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf61000) "pos"_ostr, u"0"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testCommentWithChildrenTdf163092) +{ +loadAndSave("comment_with_children.odt"); +// commentsExtended should exist +xmlDocUniquePtr pXmlCommExt = parseExport("word/commentsExtended.xml"); +CPPUNIT_ASSERT(pXmlCommExt); +// And it should contain the same parent-child relations +OUString sExChild1 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[1]"_ostr, "paraId"_ostr); +OUString sExParent1 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[1]"_ostr, "paraIdParent"_ostr); +OUString sExChild2 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[2]"_ostr, "paraId"_ostr); +OUString sExParent2 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[2]"_ostr, "paraIdParent"_ostr); +std::map parents; +parents[sExChild1] = sExParent1; +parents[sExChild2] = sExParent2; +xmlDocUniquePtr pXmlComments = parseExport("word/comments.xml"); +OUString sComment1Id += getXPath(pXmlComments, "/w:comments/w:comment[1]/w:p[1]"_ostr, "paraId"_ostr); +OUString sComment2Id += getXPath(pXmlComments, "/w:comments/w:comment[2]/w:p[1]"_ostr, "paraId"_ostr); +OUString sComment3Id += getXPath(pXmlComments, "/w:comments/w:comment[3]/w:p[1]"_ostr, "paraId"_ostr); +CPPUNIT_ASSERT_EQUAL(parents[sComment2Id], sComment1Id); +CPPUNIT_ASSERT_EQUAL(parents[sComment3Id], sComment2Id); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6b38d40f1ad5..295c043e3cb9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8355,14 +8355,17 @@ DocxAttributeOutput::hasProperties DocxAttributeOutput::WritePostitFields() hasProperties eResult = hasProperties::no; for (auto& [f1, data1] : m_postitFields) { -if (f1->GetParentId() != 0) +if (f1->GetParentId() != 0 || f1->GetParentPostItId() != 0) { for (size_t i = 0; i < m_postitFields.size(); i++) { auto& [f2, data2] = m_postitFields[i]; -if (f2->GetParaId() == f1->GetParentId()) +if ((f1->GetParentId() != 0 && f2->GetParaId() == f1->GetParentId()) +|| (f1->GetParentPostItId() != 0 +&& f2->GetPostItId() == f1->GetParentPostItId())) { -data2.parentStatus = ParentStatus::IsParent; +if (data2.parentStatus == ParentStatus::None) +data2.parentStatus = ParentStatus::IsParent; data1.parentStatus = ParentStatus::HasParent; data1.parentIndex = i; break; @@ -8431,7 +8434,7 @@ void DocxAttributeOutput::WritePostItFieldsResolved() continue; OUString idstr = NumberToHexBinary(data.lastParaId); std::optional sDone, sParentId; -if (f->GetParentId() != 0) +if (f->GetParentId() != 0 || f->GetParentPostItId() != 0) { if (data.parentStatus ==
core.git: desktop/source officecfg/registry sfx2/source sw/inc sw/sdi sw/source sw/uiconfig
desktop/source/lib/init.cxx |1 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |8 + sfx2/source/control/dispatch.cxx |1 sfx2/source/control/unoctitm.cxx |1 sw/inc/AnnotationWin.hxx |3 sw/inc/PostItMgr.hxx |2 sw/inc/cmdid.h |1 sw/sdi/_annotsh.sdi |6 + sw/sdi/_textsh.sdi |5 sw/sdi/swriter.sdi | 17 +++ sw/source/uibase/docvw/AnnotationMenuButton.cxx |4 sw/source/uibase/docvw/AnnotationWin.cxx | 18 +++ sw/source/uibase/docvw/AnnotationWin2.cxx| 12 +- sw/source/uibase/docvw/PostItMgr.cxx | 56 ++ sw/source/uibase/shells/annotsh.cxx | 10 + sw/source/uibase/shells/textfld.cxx | 21 +-- sw/uiconfig/sglobal/menubar/menubar.xml |1 sw/uiconfig/sglobal/popupmenu/annotation.xml |1 sw/uiconfig/swriter/menubar/menubar.xml |1 sw/uiconfig/swriter/popupmenu/annotation.xml |1 sw/uiconfig/swriter/ui/annotation.ui |8 + sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui|7 + 22 files changed, 170 insertions(+), 15 deletions(-) New commits: commit 98cd8bac764b5d2a0a6a1cd8ee619529f1ab88b7 Author: Jaume Pujantell AuthorDate: Sun Sep 8 20:52:28 2024 +0200 Commit: Jaume Pujantell CommitDate: Wed Sep 25 15:43:47 2024 +0200 sw: add new command to make a response comment root Adds the option to convert a reply comment into a new top comment while preserving the parent-child realtions of the other comments in the thread. Change-Id: I3cd5e5466fadc2226651d7c244b5139ec2d1f949 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173051 Tested-by: Jenkins CollaboraOffice Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173870 Reviewed-by: Jaume Pujantell Tested-by: Jenkins diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a7cbbb271b48..c5720c992ea5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3853,6 +3853,7 @@ static void doc_iniUnoCommands () u".uno:ReplyComment"_ustr, u".uno:ResolveComment"_ustr, u".uno:ResolveCommentThread"_ustr, +u".uno:PromoteComment"_ustr, u".uno:InsertRowsBefore"_ustr, u".uno:InsertRowsAfter"_ustr, u".uno:InsertColumnsBefore"_ustr, diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index af3cff149c96..cb05dab650c7 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -6563,6 +6563,14 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 1 + + + Promote Comment To Root + + + 1 + + Top diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index d0ebae89f73d..ec73bf047279 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1532,6 +1532,7 @@ bool SfxDispatcher::IsCommandAllowedInLokReadOnlyViewMode (OUString commandName) u".uno:DeleteComment"_ustr, u".uno:DeleteAnnotation"_ustr, u".uno:EditAnnotation"_ustr, +u".uno:PromoteComment"_ustr, }; if (std::find(std::begin(allowedList), std::end(allowedList), commandName) != std::end(allowedList)) diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 3c9643eed181..30cf78a710f5 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1219,6 +1219,7 @@ constexpr auto handlers = frozen::make_unordered_map(FN_PARAM+2) diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 919dd0513aa5..0c26a55dd6d0 100644 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -78,6 +78,12 @@ interface _Annotation StateMethod = GetNoteState ; ] +FN_PROMOTE_COMMENT +[ +ExecMethod = NoteExec ; +StateMethod = GetNoteState ; +] + FN_POSTIT [ ExecMethod = NoteExec ; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 9f5e60
core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source
sw/qa/extras/ooxmlexport/data/comment_with_children.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 29 sw/source/filter/ww8/docxattributeoutput.cxx| 11 +++--- 3 files changed, 36 insertions(+), 4 deletions(-) New commits: commit 93730aee7d6a19a34e41a867a7908a1e1ef8fed0 Author: Jaume Pujantell AuthorDate: Thu Sep 19 19:22:21 2024 +0200 Commit: Mike Kaganski CommitDate: Mon Sep 23 08:42:47 2024 +0200 tdf#163092 sw: fix broken anotations on save to docx Opening an odt file and saving it as docx would break the comment threads into unconnected comments. This also fixes a regression from commit 3bb2668f5e753e9fa6aa7eea74454bf11cdfc853 where creating a commet thread with multiple children and saving to docx would break it into separate threads. Change-Id: I76a0ec49bd69b953d816b3b5d3cc6d14065d5846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173681 Reviewed-by: Mike Kaganski Tested-by: Jenkins CollaboraOffice diff --git a/sw/qa/extras/ooxmlexport/data/comment_with_children.odt b/sw/qa/extras/ooxmlexport/data/comment_with_children.odt new file mode 100644 index ..83ff88c69595 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/comment_with_children.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index 3e30a030145e..0f76824e135b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -439,6 +439,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162746) assertXPath(pDump, "//page[1]/body/tab/infos/prtBounds"_ostr, "width"_ostr, u"9360"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testCommentWithChildrenTdf163092) +{ +loadAndSave("comment_with_children.odt"); +// commentsExtended should exist +xmlDocUniquePtr pXmlCommExt = parseExport("word/commentsExtended.xml"); +CPPUNIT_ASSERT(pXmlCommExt); +// And it should contain the same parent-child relations +OUString sExChild1 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[1]"_ostr, "paraId"_ostr); +OUString sExParent1 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[1]"_ostr, "paraIdParent"_ostr); +OUString sExChild2 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[2]"_ostr, "paraId"_ostr); +OUString sExParent2 += getXPath(pXmlCommExt, "/w15:commentsEx/w15:commentEx[2]"_ostr, "paraIdParent"_ostr); +std::map parents; +parents[sExChild1] = sExParent1; +parents[sExChild2] = sExParent2; +xmlDocUniquePtr pXmlComments = parseExport("word/comments.xml"); +OUString sComment1Id += getXPath(pXmlComments, "/w:comments/w:comment[1]/w:p[1]"_ostr, "paraId"_ostr); +OUString sComment2Id += getXPath(pXmlComments, "/w:comments/w:comment[2]/w:p[1]"_ostr, "paraId"_ostr); +OUString sComment3Id += getXPath(pXmlComments, "/w:comments/w:comment[3]/w:p[1]"_ostr, "paraId"_ostr); +CPPUNIT_ASSERT_EQUAL(parents[sComment2Id], sComment1Id); +CPPUNIT_ASSERT_EQUAL(parents[sComment3Id], sComment2Id); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 44c0aa1efddf..96ca17068552 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8372,14 +8372,17 @@ DocxAttributeOutput::hasProperties DocxAttributeOutput::WritePostitFields() hasProperties eResult = hasProperties::no; for (auto& [f1, data1] : m_postitFields) { -if (f1->GetParentId() != 0) +if (f1->GetParentId() != 0 || f1->GetParentPostItId() != 0) { for (size_t i = 0; i < m_postitFields.size(); i++) { auto& [f2, data2] = m_postitFields[i]; -if (f2->GetParaId() == f1->GetParentId()) +if ((f1->GetParentId() != 0 && f2->GetParaId() == f1->GetParentId()) +|| (f1->GetParentPostItId() != 0 +&& f2->GetPostItId() == f1->GetParentPostItId())) { -data2.parentStatus = ParentStatus::IsParent; +if (data2.parentStatus == ParentStatus::None) +data2.parentStatus = ParentStatus::IsParent; data1.parentStatus = ParentStatus::HasParent; data1.parentIndex = i; break; @@ -8448,7 +8451,7 @@ void DocxAttributeOutput::WritePostItFieldsResolved() continue; OUString idstr = NumberToHexBinary(data.lastParaId); std::optional sDone, sParentId; -if (f->GetParentId() != 0) +if (f->GetParentId() != 0 || f->GetParentPostItId() != 0) { if (data.parentStatus == ParentStatus::HasParent) {
core.git: sw/source
sw/source/uibase/shells/textfld.cxx | 45 1 file changed, 36 insertions(+), 9 deletions(-) New commits: commit 26754f3c8577ce65c73b896b56456b5121941a62 Author: Jaume Pujantell AuthorDate: Thu Aug 29 15:32:01 2024 +0200 Commit: Jaume Pujantell CommitDate: Wed Sep 11 19:18:44 2024 +0200 lok: sw: restrict deletions on comment only mode On Writer, when in readonly mode with comments activated restrict the hability to delete comments to only those made by the same user. Change-Id: Iaefb1166c680726c9c73a305ef67be812d3b97d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172596 Tested-by: Jenkins CollaboraOffice Reviewed-by: Mike Kaganski (cherry picked from commit f93d46429c68770dd432fa6e7edcfc876891f8e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172890 Reviewed-by: Andreas Mantke Tested-by: Jenkins Reviewed-by: Jaume Pujantell diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 1335958232eb..653b4a93df2a 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -114,6 +114,23 @@ static OUString lcl_BuildTitleWithRedline( const SwRangeRedline *pRedline ) return sTitle + SwResId(pResId); } +static bool lcl_canUserModifyAnnotation(const SwView& rView, std::u16string_view sAuthor) +{ +return !comphelper::LibreOfficeKit::isActive() || !rView.IsLokReadOnlyView() + || sAuthor == rView.GetRedlineAuthor(); +} + +static bool lcl_canUserModifyAnnotation(const SwView& rView, +const sw::annotation::SwAnnotationWin* pAnnotationWin) +{ +return lcl_canUserModifyAnnotation(rView, pAnnotationWin->GetAuthor()); +} + +static bool lcl_canUserModifyAnnotation(const SwView& rView, sal_uInt32 nPostItId) +{ +return lcl_canUserModifyAnnotation(rView, rView.GetPostItMgr()->GetAnnotationWin(nPostItId)); +} + void SwTextShell::ExecField(SfxRequest &rReq) { SwWrtShell& rSh = GetShell(); @@ -397,12 +414,17 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) { - GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32()); +sal_uInt32 nPostItId = pIdItem->GetValue().toUInt32(); +if (lcl_canUserModifyAnnotation(GetView(), nPostItId)) +GetView().GetPostItMgr()->Delete(nPostItId); } else if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->HasActiveSidebarWin() ) { -GetView().GetPostItMgr()->DeleteActiveSidebarWin(); +sw::annotation::SwAnnotationWin* pAnnotationWin += GetView().GetPostItMgr()->GetActiveSidebarWin(); +if (lcl_canUserModifyAnnotation(GetView(), pAnnotationWin)) +GetView().GetPostItMgr()->DeleteActiveSidebarWin(); } break; } @@ -411,12 +433,16 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) { - GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32()); +sal_uInt32 nPostItId = pIdItem->GetValue().toUInt32(); +if (lcl_canUserModifyAnnotation(GetView(), nPostItId)) +GetView().GetPostItMgr()->DeleteCommentThread(nPostItId); } -else if ( GetView().GetPostItMgr() && -GetView().GetPostItMgr()->HasActiveSidebarWin() ) +else if (GetView().GetPostItMgr() && GetView().GetPostItMgr()->HasActiveSidebarWin()) { -GetView().GetPostItMgr()->DeleteActiveSidebarWin(); +sw::annotation::SwAnnotationWin* pAnnotationWin += GetView().GetPostItMgr()->GetActiveSidebarWin(); +if (lcl_canUserModifyAnnotation(GetView(), pAnnotationWin)) +GetView().GetPostItMgr()->DeleteActiveSidebarWin(); } break; } @@ -452,8 +478,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) case FN_DELETE_NOTE_AUTHOR: { const SfxStringItem* pNoteItem = rReq.GetArg(nSlot); -if ( pNoteItem && GetView().GetPostItMgr() ) -GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() ); +if (pNoteItem && GetView().GetPostItMgr() +&& lcl_canUserModifyAnnotation(GetView(), pNoteItem->GetValue())) +GetView().GetPostItMgr()->Delete(pNoteItem->GetValue()); } break; case FN_HIDE_NOTE: @@ -524,7
core.git: Branch 'distro/collabora/co-24.04' - desktop/qa sw/source
desktop/qa/desktop_lib/test_desktop_lib.cxx |9 +++-- sw/source/uibase/shells/textfld.cxx | 45 ++-- 2 files changed, 41 insertions(+), 13 deletions(-) New commits: commit f93d46429c68770dd432fa6e7edcfc876891f8e1 Author: Jaume Pujantell AuthorDate: Thu Aug 29 15:32:01 2024 +0200 Commit: Mike Kaganski CommitDate: Tue Sep 3 06:40:41 2024 +0200 lok: sw: restrict deletions on comment only mode On Writer, when in readonly mode with comments activated restrict the hability to delete comments to only those made by the same user. Change-Id: Iaefb1166c680726c9c73a305ef67be812d3b97d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172596 Tested-by: Jenkins CollaboraOffice 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 cfacc5cc4086..d013de5cf20f 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2677,10 +2677,11 @@ void DesktopLOKTest::testCommentsInReadOnlyMode() // Comments callback are emitted only if tiled annotations are off comphelper::LibreOfficeKit::setTiledAnnotations(false); LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); -pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); +OString aUserName("LOK User1"_ostr); +OString aArguments = "{\".uno:Author\":{\"type\":\"string\",\"value\":\"" + aUserName + "\"}}"; +pDocument->m_pDocumentClass->initializeForRendering(pDocument, aArguments.getStr()); -int viewId = pDocument->m_pDocumentClass->createView(pDocument); -pDocument->m_pDocumentClass->setView(pDocument, viewId); +int viewId = pDocument->m_pDocumentClass->getView(pDocument); SfxLokHelper::setViewReadOnly(viewId, true); SfxLokHelper::setAllowChangeComments(viewId, true); @@ -2694,7 +2695,7 @@ void DesktopLOKTest::testCommentsInReadOnlyMode() { tools::JsonWriter aJson; addParameter(aJson, "Text", "string", "Comment"); -addParameter(aJson, "Author", "string", "LOK User1"); +addParameter(aJson, "Author", "string", aUserName); aCommandArgs = aJson.finishAndGetAsOString(); } diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 6e3ff742cf20..20f21bb92355 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -114,6 +114,23 @@ static OUString lcl_BuildTitleWithRedline( const SwRangeRedline *pRedline ) return sTitle + SwResId(pResId); } +static bool lcl_canUserModifyAnnotation(const SwView& rView, std::u16string_view sAuthor) +{ +return !comphelper::LibreOfficeKit::isActive() || !rView.IsLokReadOnlyView() + || sAuthor == rView.GetRedlineAuthor(); +} + +static bool lcl_canUserModifyAnnotation(const SwView& rView, +const sw::annotation::SwAnnotationWin* pAnnotationWin) +{ +return lcl_canUserModifyAnnotation(rView, pAnnotationWin->GetAuthor()); +} + +static bool lcl_canUserModifyAnnotation(const SwView& rView, sal_uInt32 nPostItId) +{ +return lcl_canUserModifyAnnotation(rView, rView.GetPostItMgr()->GetAnnotationWin(nPostItId)); +} + void SwTextShell::ExecField(SfxRequest &rReq) { SwWrtShell& rSh = GetShell(); @@ -385,12 +402,17 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) { - GetView().GetPostItMgr()->Delete(pIdItem->GetValue().toUInt32()); +sal_uInt32 nPostItId = pIdItem->GetValue().toUInt32(); +if (lcl_canUserModifyAnnotation(GetView(), nPostItId)) +GetView().GetPostItMgr()->Delete(nPostItId); } else if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->HasActiveSidebarWin() ) { -GetView().GetPostItMgr()->DeleteActiveSidebarWin(); +sw::annotation::SwAnnotationWin* pAnnotationWin += GetView().GetPostItMgr()->GetActiveSidebarWin(); +if (lcl_canUserModifyAnnotation(GetView(), pAnnotationWin)) +GetView().GetPostItMgr()->DeleteActiveSidebarWin(); } break; } @@ -399,12 +421,16 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) { - GetView().GetPostItMgr()->DeleteCommentThread(pIdItem->GetValue().toUInt32()); +sal_uInt32 nPostItId = pIdItem->GetValue().toUInt32(); +if (lcl_canUserModifyAnnotation(GetView(), nPostItId)) +
core.git: Branch 'libreoffice-24-8' - sc/inc sc/qa sc/source
sc/inc/dpobject.hxx |4 sc/inc/dpoutput.hxx |3 sc/qa/unit/PivotTableFormatsImportExport.cxx| 60 +++--- sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 105 ++-- sc/source/core/data/dpobject.cxx|7 sc/source/core/data/dpoutput.cxx| 20 +- sc/source/filter/excel/xepivotxml.cxx |4 sc/source/filter/oox/pivottablebuffer.cxx |2 9 files changed, 118 insertions(+), 87 deletions(-) New commits: commit d54f4a7f5917097e9ac46f95d8122cb2671af9fa Author: Jaume Pujantell AuthorDate: Tue Aug 13 20:30:56 2024 +0200 Commit: Xisco Fauli CommitDate: Tue Aug 20 10:33:03 2024 +0200 tdf#162466 calc: added handling of firstHeaderRow="0" on xlsx files Calc ignored the firstHeaderRow attibute on xlsx pivot tables causing it to add an extra row when firstHeaderRow="0". And then changed the value to "1" on export. Some xlsx pivot table filter tests have been changed because removing this extra row changed the position of the values. Change-Id: I95b722e4f4cc40083c752a045df4ffe37e7159c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171836 Reviewed-by: Mike Kaganski Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171869 Tested-by: Jenkins (cherry picked from commit cd4498d32867af26e95de84836b724b4f85ba1b0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171991 Reviewed-by: Xisco Fauli diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 06ffc0085cf2..ce05a46f7c6b 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -107,6 +107,7 @@ private: bool mbAllowMove : 1; bool mbSettingsChanged : 1; bool mbEnableGetPivotData : 1; +bool mbHideHeader : 1 = false; void CreateObjects(); void CreateOutput(); @@ -148,6 +149,9 @@ public: SC_DLLPUBLIC void SetHeaderLayout(bool bUseGrid); boolGetHeaderLayout() const { return mbHeaderLayout;} +SC_DLLPUBLIC void SetHideHeader(bool bHideHeader); +bool GetHideHeader() const { return mbHideHeader; } + SC_DLLPUBLIC void SetSheetDesc(const ScSheetSourceDesc& rDesc); voidSetImportDesc(const ScImportSourceDesc& rDesc); voidSetServiceData(const ScDPServiceDesc& rDesc); diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx index 11251afd4fdf..29423ab66c57 100644 --- a/sc/inc/dpoutput.hxx +++ b/sc/inc/dpoutput.hxx @@ -88,6 +88,7 @@ private: bool mbHeaderLayout:1; // true : grid, false : standard bool mbHasCompactRowField:1; // true: at least one of the row fields has compact layout. bool mbExpandCollapse:1; // true: show expand/collapse buttons +bool mbHideHeader : 1; voidDataCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult& rData ); @@ -120,7 +121,7 @@ public: ScDPOutput(ScDocument* pDocument, css::uno::Reference xSource, const ScAddress& rPosition, bool bFilter, bool bExpandCollapse, - ScDPObject& rObject); + ScDPObject& rObject, bool bHideHeader); ~ScDPOutput(); voidSetPosition( const ScAddress& rPos ); diff --git a/sc/qa/unit/PivotTableFormatsImportExport.cxx b/sc/qa/unit/PivotTableFormatsImportExport.cxx index 3c3b9414d29e..22d56c0f11d6 100644 --- a/sc/qa/unit/PivotTableFormatsImportExport.cxx +++ b/sc/qa/unit/PivotTableFormatsImportExport.cxx @@ -122,13 +122,13 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, static void assertDataFieldInColumn_ColumnLabelColor(ScDocument& rDoc) { -CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getFontColor(rDoc, u"H5"_ustr)); -CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getBackgroundColor(rDoc, u"I5"_ustr)); +CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getFontColor(rDoc, u"H4"_ustr)); +CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getBackgroundColor(rDoc, u"I4"_ustr)); // Make sure the other cells have the font color or background set to default std::vector aEmptyAddresses{ -u"G5"_ustr, u"G6"_ustr, u"H6"_ustr, u"I6"_ustr, u"G7"_ustr, u"H7"_ustr, u"I7"_ustr, -u"G8"_ustr, u"H8"_ustr, u"I8"_ustr, u"G9"_ustr, u"H9"_ustr, u"I9"_ustr, +u"G4"_ustr, u"G5"_ustr, u"H5"_ustr, u"I5"_ustr, u"G6"_ustr, u"H6"_ustr, u"I6"_ustr, +u"G7"_ustr, u"H7"_ustr, u"I7"_ustr, u"G8"_ustr, u"H8"_ustr, u"I8"_ustr, }; CPPUNIT_ASSERT_EQUAL(OUString(), checkNonEmptyAddresses(rDoc, aEmptyAddresses)); } @@ -145,12 +145,12 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, static void assertDataFieldInColumn_DataColor(ScDocument& rDoc) { -CPPUNIT_ASSERT_
core.git: sc/inc sc/qa sc/source
sc/inc/dpobject.hxx |4 sc/inc/dpoutput.hxx |3 sc/qa/unit/PivotTableFormatsImportExport.cxx| 60 +++--- sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 105 ++-- sc/source/core/data/dpobject.cxx|7 sc/source/core/data/dpoutput.cxx| 20 +- sc/source/filter/excel/xepivotxml.cxx |4 sc/source/filter/oox/pivottablebuffer.cxx |2 9 files changed, 118 insertions(+), 87 deletions(-) New commits: commit cd4498d32867af26e95de84836b724b4f85ba1b0 Author: Jaume Pujantell AuthorDate: Tue Aug 13 20:30:56 2024 +0200 Commit: Mike Kaganski CommitDate: Sun Aug 18 22:35:50 2024 +0200 tdf#162466 calc: added handling of firstHeaderRow="0" on xlsx files Calc ignored the firstHeaderRow attibute on xlsx pivot tables causing it to add an extra row when firstHeaderRow="0". And then changed the value to "1" on export. Some xlsx pivot table filter tests have been changed because removing this extra row changed the position of the values. Change-Id: I95b722e4f4cc40083c752a045df4ffe37e7159c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171836 Reviewed-by: Mike Kaganski Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171869 Tested-by: Jenkins diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 06ffc0085cf2..ce05a46f7c6b 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -107,6 +107,7 @@ private: bool mbAllowMove : 1; bool mbSettingsChanged : 1; bool mbEnableGetPivotData : 1; +bool mbHideHeader : 1 = false; void CreateObjects(); void CreateOutput(); @@ -148,6 +149,9 @@ public: SC_DLLPUBLIC void SetHeaderLayout(bool bUseGrid); boolGetHeaderLayout() const { return mbHeaderLayout;} +SC_DLLPUBLIC void SetHideHeader(bool bHideHeader); +bool GetHideHeader() const { return mbHideHeader; } + SC_DLLPUBLIC void SetSheetDesc(const ScSheetSourceDesc& rDesc); voidSetImportDesc(const ScImportSourceDesc& rDesc); voidSetServiceData(const ScDPServiceDesc& rDesc); diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx index 11251afd4fdf..29423ab66c57 100644 --- a/sc/inc/dpoutput.hxx +++ b/sc/inc/dpoutput.hxx @@ -88,6 +88,7 @@ private: bool mbHeaderLayout:1; // true : grid, false : standard bool mbHasCompactRowField:1; // true: at least one of the row fields has compact layout. bool mbExpandCollapse:1; // true: show expand/collapse buttons +bool mbHideHeader : 1; voidDataCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult& rData ); @@ -120,7 +121,7 @@ public: ScDPOutput(ScDocument* pDocument, css::uno::Reference xSource, const ScAddress& rPosition, bool bFilter, bool bExpandCollapse, - ScDPObject& rObject); + ScDPObject& rObject, bool bHideHeader); ~ScDPOutput(); voidSetPosition( const ScAddress& rPos ); diff --git a/sc/qa/unit/PivotTableFormatsImportExport.cxx b/sc/qa/unit/PivotTableFormatsImportExport.cxx index 3c3b9414d29e..22d56c0f11d6 100644 --- a/sc/qa/unit/PivotTableFormatsImportExport.cxx +++ b/sc/qa/unit/PivotTableFormatsImportExport.cxx @@ -122,13 +122,13 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, static void assertDataFieldInColumn_ColumnLabelColor(ScDocument& rDoc) { -CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getFontColor(rDoc, u"H5"_ustr)); -CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getBackgroundColor(rDoc, u"I5"_ustr)); +CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getFontColor(rDoc, u"H4"_ustr)); +CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getBackgroundColor(rDoc, u"I4"_ustr)); // Make sure the other cells have the font color or background set to default std::vector aEmptyAddresses{ -u"G5"_ustr, u"G6"_ustr, u"H6"_ustr, u"I6"_ustr, u"G7"_ustr, u"H7"_ustr, u"I7"_ustr, -u"G8"_ustr, u"H8"_ustr, u"I8"_ustr, u"G9"_ustr, u"H9"_ustr, u"I9"_ustr, +u"G4"_ustr, u"G5"_ustr, u"H5"_ustr, u"I5"_ustr, u"G6"_ustr, u"H6"_ustr, u"I6"_ustr, +u"G7"_ustr, u"H7"_ustr, u"I7"_ustr, u"G8"_ustr, u"H8"_ustr, u"I8"_ustr, }; CPPUNIT_ASSERT_EQUAL(OUString(), checkNonEmptyAddresses(rDoc, aEmptyAddresses)); } @@ -145,12 +145,12 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFormatsImportExport, static void assertDataFieldInColumn_DataColor(ScDocument& rDoc) { -CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getFontColor(rDoc, u"H7"_ustr)); -CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getBackgroundColor(rDoc, u"I9"_ustr)); +CPPUNIT_ASSERT_EQUAL(COL
core.git: Branch 'distro/collabora/co-24.04' - sc/inc sc/qa sc/source
sc/inc/dpobject.hxx |4 sc/inc/dpoutput.hxx |8 sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 105 ++-- sc/source/core/data/dpobject.cxx| 50 +++-- sc/source/core/data/dpoutput.cxx| 56 +++--- sc/source/filter/excel/xepivotxml.cxx |4 sc/source/filter/oox/pivottablebuffer.cxx |2 8 files changed, 130 insertions(+), 99 deletions(-) New commits: commit 8423a7a21a52c224d5299a952ff7db25c01cad94 Author: Jaume Pujantell AuthorDate: Tue Aug 13 20:30:56 2024 +0200 Commit: Jaume Pujantell CommitDate: Wed Aug 14 15:29:55 2024 +0200 tdf#162466 calc: added handling of firstHeaderRow="0" on xlsx files Calc ignored the firstHeaderRow attibute on xlsx pivot tables causing it to add an extra row when firstHeaderRow="0". And then changed the value to "1" on export. Some xlsx pivot table filter tests have been changed because removing this extra row changed the position of the values. Change-Id: I95b722e4f4cc40083c752a045df4ffe37e7159c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171836 Reviewed-by: Mike Kaganski Tested-by: Jenkins CollaboraOffice diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 0e4cf882b529..a750e48d7030 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -106,6 +106,7 @@ private: boolbAllowMove:1; boolbSettingsChanged:1; boolmbEnableGetPivotData:1; +bool mbHideHeader : 1; SAL_DLLPRIVATE ScDPTableData*GetTableData(); SAL_DLLPRIVATE void CreateObjects(); @@ -146,6 +147,9 @@ public: voidSetHeaderLayout(bool bUseGrid); boolGetHeaderLayout() const { return mbHeaderLayout;} +void SetHideHeader(bool bHideHeader); +bool GetHideHeader() const { return mbHideHeader; } + voidSetSheetDesc(const ScSheetSourceDesc& rDesc); voidSetImportDesc(const ScImportSourceDesc& rDesc); voidSetServiceData(const ScDPServiceDesc& rDesc); diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx index 94decfa44466..de2adf9e51bc 100644 --- a/sc/inc/dpoutput.hxx +++ b/sc/inc/dpoutput.hxx @@ -85,6 +85,7 @@ private: boolmbHeaderLayout:1; // true : grid, false : standard boolmbHasCompactRowField:1; // true: at least one of the row fields has compact layout. boolmbExpandCollapse:1; // true: show expand/collapse buttons +bool mbHideHeader : 1; voidDataCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult& rData ); @@ -109,10 +110,9 @@ private: sal_Int32 GetRowFieldCompact(SCCOL nColQuery, SCROW nRowQuery) const; public: -ScDPOutput( ScDocument* pD, -css::uno::Reference< css::sheet::XDimensionsSupplier> xSrc, -const ScAddress& rPos, bool bFilter, bool bExpandCollapse ); -~ScDPOutput(); +ScDPOutput(ScDocument* pD, css::uno::Reference xSrc, + const ScAddress& rPos, bool bFilter, bool bExpandCollapse, bool bHideHeader); +~ScDPOutput(); voidSetPosition( const ScAddress& rPos ); diff --git a/sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx b/sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx new file mode 100644 index ..9660f6354b88 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot-table/first_header_row_zero.xlsx differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 31fb49351c8c..8c9c5ab401c9 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -330,22 +330,22 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableSharedGroupXLSX) // Check whether right group names are imported for both tables // First table -CPPUNIT_ASSERT_EQUAL(OUString("a2"), pDoc->GetString(ScAddress(0, 1, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("Csoport1"), pDoc->GetString(ScAddress(0, 2, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("Csoport2"), pDoc->GetString(ScAddress(0, 3, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("Csoport3"), pDoc->GetString(ScAddress(0, 4, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("16"), pDoc->GetString(ScAddress(0, 5, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("17"), pDoc->GetString(ScAddress(0, 6, 0))); -CPPUNIT_ASSERT_EQUAL(OUString("18"), pDoc->GetString(ScAddress(0, 7, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("a2"), pDoc->GetString(ScAddress(0, 0, 0))); +CPPUNIT_ASSER
core.git: include/vcl vcl/inc vcl/jsdialog vcl/source
include/vcl/toolkit/treelistbox.hxx |1 + vcl/inc/jsdialog/jsdialogbuilder.hxx |5 + vcl/jsdialog/jsdialogbuilder.cxx | 20 vcl/source/treelist/svtabbx.cxx |1 + vcl/source/treelist/treelistbox.cxx | 12 5 files changed, 39 insertions(+) New commits: commit 88219419bd99349453471272e9c59424c014826d Author: Jaume Pujantell AuthorDate: Tue Jul 30 16:45:31 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Aug 7 08:28:31 2024 +0200 cool#9704 calc jsdialog autofilter send disabled entry information Added the code necessary to disable already filtered entries on jsdialog autofilter, like it is done on desktop UI. Change-Id: I095b7fe0054efcaff2717d05a2ab7bd1d8248b29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171246 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit 2815d11bb608a933e14b799cc802825423426d28) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171530 Tested-by: Jenkins diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index f116b82efcb2..7d3213bfa1bc 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -563,6 +563,7 @@ public: voidSetCheckButtonState( SvTreeListEntry*, SvButtonState ); SvButtonState GetCheckButtonState( SvTreeListEntry* ) const; +bool GetCheckButtonEnabled(SvTreeListEntry* pEntry) const; voidSetEntryText(SvTreeListEntry*, const OUString& ); voidSetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index ee4105e5d7b4..28435d6536f1 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -774,6 +774,11 @@ public: virtual void set_toggle(int pos, TriState eState, int col = -1) override; virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override; +using SalInstanceTreeView::set_sensitive; +/// pos is used differently here, it defines how many steps of iterator we need to perform to take entry +virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override; +virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override; + using SalInstanceTreeView::select; /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry virtual void select(int pos) override; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index aba9d5381855..8cc2d0f38c86 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -2056,6 +2056,26 @@ void JSTreeView::set_toggle(const weld::TreeIter& rIter, TriState bOn, int col) sendUpdate(); } +void JSTreeView::set_sensitive(int pos, bool bSensitive, int col) +{ +SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0); + +while (pEntry && pos--) +pEntry = m_xTreeView->Next(pEntry); + +if (pEntry) +{ +SalInstanceTreeView::set_sensitive(pEntry, bSensitive, col); +sendUpdate(); +} +} + +void JSTreeView::set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) +{ +SalInstanceTreeView::set_sensitive(rIter, bSensitive, col); +sendUpdate(); +} + void JSTreeView::select(int pos) { assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 9614c7493c90..7968635362ad 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -161,6 +161,7 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, rJsonWriter.put("state", false); else if (eCheckState == SvButtonState::Checked) rJsonWriter.put("state", true); +rJsonWriter.put("enabled", pTabListBox->GetCheckButtonEnabled(pEntry)); } if (pTabListBox->IsSelected(pEntry)) diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a16758e3eaba..2984d1aeb38c 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1707,6 +1707,18 @@ SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) cons return eState; } +bool SvTreeListBox::GetCheckButtonEnabled(SvTreeListEntry* pEntry) const +{ +if (pEntry && (nTreeFlags & SvTreeFlags::CHKBTN)) +{ +SvLBoxButton* pItem += static_cast(pEntry->GetFirstItem(SvLBoxItemType::Button)); +if (pItem) +return pItem->isEnable(); +} +return false; +} + void SvTreeListBox::CheckButtonHdl() { if ( pCheckButtonData )
core.git: Branch 'distro/collabora/co-24.04' - include/vcl vcl/inc vcl/jsdialog vcl/source
include/vcl/toolkit/treelistbox.hxx |1 + vcl/inc/jsdialog/jsdialogbuilder.hxx |5 + vcl/jsdialog/jsdialogbuilder.cxx | 20 vcl/source/treelist/svtabbx.cxx |1 + vcl/source/treelist/treelistbox.cxx | 12 5 files changed, 39 insertions(+) New commits: commit 2815d11bb608a933e14b799cc802825423426d28 Author: Jaume Pujantell AuthorDate: Tue Jul 30 16:45:31 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Aug 6 08:25:51 2024 +0200 cool#9704 calc jsdialog autofilter send disabled entry information Added the code necessary to disable already filtered entries on jsdialog autofilter, like it is done on desktop UI. Change-Id: I095b7fe0054efcaff2717d05a2ab7bd1d8248b29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171246 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice diff --git a/include/vcl/toolkit/treelistbox.hxx b/include/vcl/toolkit/treelistbox.hxx index ecbd489fd853..007c119c5257 100644 --- a/include/vcl/toolkit/treelistbox.hxx +++ b/include/vcl/toolkit/treelistbox.hxx @@ -561,6 +561,7 @@ public: voidSetCheckButtonState( SvTreeListEntry*, SvButtonState ); SvButtonState GetCheckButtonState( SvTreeListEntry* ) const; +bool GetCheckButtonEnabled(SvTreeListEntry* pEntry) const; voidSetEntryText(SvTreeListEntry*, const OUString& ); voidSetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 58f8d431d258..0008f9f5fda9 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -771,6 +771,11 @@ public: virtual void set_toggle(int pos, TriState eState, int col = -1) override; virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override; +using SalInstanceTreeView::set_sensitive; +/// pos is used differently here, it defines how many steps of iterator we need to perform to take entry +virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override; +virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override; + using SalInstanceTreeView::select; /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry virtual void select(int pos) override; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 7a38aff47873..d68a52b7e441 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -2060,6 +2060,26 @@ void JSTreeView::set_toggle(const weld::TreeIter& rIter, TriState bOn, int col) sendUpdate(); } +void JSTreeView::set_sensitive(int pos, bool bSensitive, int col) +{ +SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0); + +while (pEntry && pos--) +pEntry = m_xTreeView->Next(pEntry); + +if (pEntry) +{ +SalInstanceTreeView::set_sensitive(pEntry, bSensitive, col); +sendUpdate(); +} +} + +void JSTreeView::set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) +{ +SalInstanceTreeView::set_sensitive(rIter, bSensitive, col); +sendUpdate(); +} + void JSTreeView::select(int pos) { assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index feb4f0b2011f..658584650e15 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -161,6 +161,7 @@ static void lcl_DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, rJsonWriter.put("state", false); else if (eCheckState == SvButtonState::Checked) rJsonWriter.put("state", true); +rJsonWriter.put("enabled", pTabListBox->GetCheckButtonEnabled(pEntry)); } if (pTabListBox->IsSelected(pEntry)) diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 6dd915e23996..67292505671f 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -1707,6 +1707,18 @@ SvButtonState SvTreeListBox::GetCheckButtonState( SvTreeListEntry* pEntry ) cons return eState; } +bool SvTreeListBox::GetCheckButtonEnabled(SvTreeListEntry* pEntry) const +{ +if (pEntry && (nTreeFlags & SvTreeFlags::CHKBTN)) +{ +SvLBoxButton* pItem += static_cast(pEntry->GetFirstItem(SvLBoxItemType::Button)); +if (pItem) +return pItem->isEnable(); +} +return false; +} + void SvTreeListBox::CheckButtonHdl() { if ( pCheckButtonData )
core.git: Branch 'distro/collabora/co-23.05' - editeng/source include/editeng svx/source
editeng/source/editeng/editview.cxx |2 ++ editeng/source/outliner/outlvw.cxx |2 ++ include/editeng/editview.hxx|1 + include/editeng/outliner.hxx|1 + svx/source/svdraw/svdedxv.cxx | 16 +++- 5 files changed, 17 insertions(+), 5 deletions(-) New commits: commit d5efff4057f61c583246bce559fdd0a221ae7d53 Author: Jaume Pujantell AuthorDate: Mon Jul 29 12:35:50 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Aug 6 08:22:19 2024 +0200 cool#9352 unassign cursor on SdrObjEditView to avoid crash On stress test with shapes and typing a segfault ocurred due to using a freed vcl::Cursor. On SdrObjEditView::SdrEndTextEdit, delete pOLV can delete the cursor remembered in pTECursorBuffer. But if it is set to the window before the deletion, it will be safely removed from the window. And on SdrObjEditView::ModelHasChanged a re-anchoring sets a cursor on the window that sholdn't be there and other SdrObjEditView can see, remeber, and use it even after this one died and freed the cursor. Change-Id: I3cfef3b68b77e6e6b49c3b68297a6a20e1f9394a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171184 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit 3b5738ab1a646d089fa7cc59ffaeda7d011c1e07) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171287 diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f10bffc6b1fc..debc22469a3d 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -554,6 +554,8 @@ void EditView::HideCursor(bool bDeactivate) } } +bool EditView::IsCursorVisible() const { return pImpEditView->GetCursor()->IsVisible(); } + Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck ) { return pImpEditView->Scroll( ndX, ndY, nRangeCheck ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 356d8076481c..6115ea129a38 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1225,6 +1225,8 @@ void OutlinerView::HideCursor(bool bDeactivate) pEditView->HideCursor(bDeactivate); } +bool OutlinerView::IsCursorVisible() const { return pEditView->IsCursorVisible(); } + void OutlinerView::SetWindow( vcl::Window* pWin ) { pEditView->SetWindow( pWin ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 7b363b260fed..ffc917460383 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -207,6 +207,7 @@ public: tools::Rectangle GetEditCursor() const; voidShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; voidSetSelectionMode( EESelectionMode eMode ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index ad59f8e9751e..aad1b9456fa1 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -220,6 +220,7 @@ public: voidShowCursor( bool bGotoCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; Outliner* GetOutliner() const { return pOwner; } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 42be2aff97fb..43ed9b470bf1 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -363,8 +363,8 @@ void SdrObjEditView::ModelHasChanged() for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++) { OutlinerView* pOLV = mpTextEditOutliner->GetView(nOV); +vcl::Window* pWin = pOLV->GetWindow(); { // invalidate old OutlinerView area -vcl::Window* pWin = pOLV->GetWindow(); tools::Rectangle aTmpRect(aOldArea); sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1; Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz))); @@ -379,9 +379,15 @@ void SdrObjEditView::ModelHasChanged() if (bColorChg) pOLV->SetBackgroundColor(aNewColor); +bool bWasCoursorVisible = pOLV->IsCursorVisible(); +vcl::Cursor* pOldCursor = pWin->GetCursor(); pOLV->SetOutputArea( aTextEditArea); // because otherwise, we're not re-anchoring correctly ImpInvalidateOutlinerView(*pOLV); +// Undo SetOutputArea setting and showing the cursor +if (!bWasCoursorVisible) +pOLV->HideCursor(); +pWin->SetCursor(pOldCursor); } mpTextEditOutlinerView->ShowCursor(); } @@ -1768,6 +1774,10 @@ S
core.git: editeng/source include/editeng svx/source
editeng/source/editeng/editview.cxx |2 ++ editeng/source/outliner/outlvw.cxx |2 ++ include/editeng/editview.hxx|1 + include/editeng/outliner.hxx|1 + svx/source/svdraw/svdedxv.cxx | 16 +++- 5 files changed, 17 insertions(+), 5 deletions(-) New commits: commit 75aeaab5ef36f819cdc11e88244f59efc4fbc5a6 Author: Jaume Pujantell AuthorDate: Mon Jul 29 12:35:50 2024 +0200 Commit: Miklos Vajna CommitDate: Thu Aug 1 13:54:28 2024 +0200 cool#9352 unassign cursor on SdrObjEditView to avoid crash On stress test with shapes and typing a segfault ocurred due to using a freed vcl::Cursor. On SdrObjEditView::SdrEndTextEdit, delete pOLV can delete the cursor remembered in pTECursorBuffer. But if it is set to the window before the deletion, it will be safely removed from the window. And on SdrObjEditView::ModelHasChanged a re-anchoring sets a cursor on the window that sholdn't be there and other SdrObjEditView can see, remeber, and use it even after this one died and freed the cursor. Change-Id: I3cfef3b68b77e6e6b49c3b68297a6a20e1f9394a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171184 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit 3b5738ab1a646d089fa7cc59ffaeda7d011c1e07) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171288 Tested-by: Jenkins diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index a686ccb04111..d76f0a1c69c0 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -568,6 +568,8 @@ void EditView::HideCursor(bool bDeactivate) } } +bool EditView::IsCursorVisible() const { return getImpl().GetCursor()->IsVisible(); } + Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck ) { return getImpl().Scroll( ndX, ndY, nRangeCheck ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 4bcd01905283..e4f06d4548a0 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1255,6 +1255,8 @@ void OutlinerView::HideCursor(bool bDeactivate) pEditView->HideCursor(bDeactivate); } +bool OutlinerView::IsCursorVisible() const { return pEditView->IsCursorVisible(); } + void OutlinerView::SetWindow( vcl::Window* pWin ) { pEditView->SetWindow( pWin ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index f2c5f9c46d7d..a1cb4eb9603b 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -205,6 +205,7 @@ public: tools::Rectangle GetEditCursor() const; voidShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; voidSetSelectionMode( EESelectionMode eMode ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index cd3acaf9452d..4b28af42ab00 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -221,6 +221,7 @@ public: voidShowCursor( bool bGotoCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; Outliner* GetOutliner() const { return pOwner; } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index fe647da817a1..ec938c51c320 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -434,8 +434,8 @@ void SdrObjEditView::ModelHasChanged() for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++) { OutlinerView* pOLV = mpTextEditOutliner->GetView(nOV); +vcl::Window* pWin = pOLV->GetWindow(); { // invalidate old OutlinerView area -vcl::Window* pWin = pOLV->GetWindow(); tools::Rectangle aTmpRect(aOldArea); sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1; Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz))); @@ -450,9 +450,15 @@ void SdrObjEditView::ModelHasChanged() if (bColorChg) pOLV->SetBackgroundColor(aNewColor); +bool bWasCoursorVisible = pOLV->IsCursorVisible(); +vcl::Cursor* pOldCursor = pWin->GetCursor(); pOLV->SetOutputArea( aTextEditArea); // because otherwise, we're not re-anchoring correctly ImpInvalidateOutlinerView(*pOLV); +// Undo SetOutputArea setting and showing the cursor +if (!bWasCoursorVisible) +pOLV->HideCursor(); +pWin->SetCursor(pOldCursor); } mpTextEditOutlinerView->ShowCursor(); } @@ -1853,
core.git: Branch 'distro/collabora/co-24.04' - editeng/source include/editeng svx/source
editeng/source/editeng/editview.cxx |2 ++ editeng/source/outliner/outlvw.cxx |2 ++ include/editeng/editview.hxx|1 + include/editeng/outliner.hxx|1 + svx/source/svdraw/svdedxv.cxx | 16 +++- 5 files changed, 17 insertions(+), 5 deletions(-) New commits: commit 3b5738ab1a646d089fa7cc59ffaeda7d011c1e07 Author: Jaume Pujantell AuthorDate: Mon Jul 29 12:35:50 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 31 12:03:12 2024 +0200 cool#9352 unassign cursor on SdrObjEditView to avoid crash On stress test with shapes and typing a segfault ocurred due to using a freed vcl::Cursor. On SdrObjEditView::SdrEndTextEdit, delete pOLV can delete the cursor remembered in pTECursorBuffer. But if it is set to the window before the deletion, it will be safely removed from the window. And on SdrObjEditView::ModelHasChanged a re-anchoring sets a cursor on the window that sholdn't be there and other SdrObjEditView can see, remeber, and use it even after this one died and freed the cursor. Change-Id: I3cfef3b68b77e6e6b49c3b68297a6a20e1f9394a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171184 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index e2f429bc7789..d4b60fecf415 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -566,6 +566,8 @@ void EditView::HideCursor(bool bDeactivate) } } +bool EditView::IsCursorVisible() const { return pImpEditView->GetCursor()->IsVisible(); } + Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck ) { return pImpEditView->Scroll( ndX, ndY, nRangeCheck ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index f3fd835ec1c9..fba3b099826a 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1237,6 +1237,8 @@ void OutlinerView::HideCursor(bool bDeactivate) pEditView->HideCursor(bDeactivate); } +bool OutlinerView::IsCursorVisible() const { return pEditView->IsCursorVisible(); } + void OutlinerView::SetWindow( vcl::Window* pWin ) { pEditView->SetWindow( pWin ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 01a0e426c09a..0bafa99bb35f 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -207,6 +207,7 @@ public: tools::Rectangle GetEditCursor() const; voidShowCursor( bool bGotoCursor = true, bool bForceVisCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; voidSetSelectionMode( EESelectionMode eMode ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 8733e4c4d429..79987a6b802a 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -221,6 +221,7 @@ public: voidShowCursor( bool bGotoCursor = true, bool bActivate = false ); voidHideCursor( bool bDeactivate = false ); +bool IsCursorVisible() const; Outliner* GetOutliner() const { return pOwner; } diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 48e28bc402a2..bc410669546c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -359,8 +359,8 @@ void SdrObjEditView::ModelHasChanged() for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++) { OutlinerView* pOLV = mpTextEditOutliner->GetView(nOV); +vcl::Window* pWin = pOLV->GetWindow(); { // invalidate old OutlinerView area -vcl::Window* pWin = pOLV->GetWindow(); tools::Rectangle aTmpRect(aOldArea); sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1; Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz))); @@ -375,9 +375,15 @@ void SdrObjEditView::ModelHasChanged() if (bColorChg) pOLV->SetBackgroundColor(aNewColor); +bool bWasCoursorVisible = pOLV->IsCursorVisible(); +vcl::Cursor* pOldCursor = pWin->GetCursor(); pOLV->SetOutputArea( aTextEditArea); // because otherwise, we're not re-anchoring correctly ImpInvalidateOutlinerView(*pOLV); +// Undo SetOutputArea setting and showing the cursor +if (!bWasCoursorVisible) +pOLV->HideCursor(); +pWin->SetCursor(pOldCursor); } mpTextEditOutlinerView->ShowCursor(); } @@ -1766,6 +1772,10 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) // to call AdjustMarkHdl() always. A
core.git: sc/sdi sc/source svx/sdi
sc/sdi/cellsh.sdi |2 + sc/source/ui/inc/gridwin.hxx |3 +- sc/source/ui/view/cellsh1.cxx | 54 -- sc/source/ui/view/gridwin.cxx | 14 +++--- svx/sdi/svx.sdi |4 +-- 5 files changed, 67 insertions(+), 10 deletions(-) New commits: commit d54f049ee7ca9b4bb0452412196d2d709ef048d8 Author: Jaume Pujantell AuthorDate: Mon Jul 8 22:27:24 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Jul 16 08:21:23 2024 +0200 lok calc: allow remove and edit hypelink outside of edit mode Right now .uno:EditHyperlink and .uno:RemoveHyperlink only work on edit mode or inside a draw object, but LOK_CALLBACK_HYPERLINK_CLICKED is dispatched outside of edit mode. Change-Id: I26fb0c2e1ac438631ea71e33282e201f0a215d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170171 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit decb72c909b3f8296fb5c6b57b267c1079a865be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170478 Tested-by: Jenkins diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 233b12249917..44e87cd69119 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -184,6 +184,8 @@ interface CellSelection SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_COPY_HYPERLINK_LOCATION [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_EDIT_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_REMOVE_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON[ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_TOGGLE[ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 76cbe56f4c4e..f456712b616f 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -396,7 +396,8 @@ public: /// Get the cell selection, coordinates are in logic units. void GetCellSelection(std::vector& rLogicRects); -bool GetEditUrl( const Point& rPos, OUString* pName=nullptr, OUString* pUrl=nullptr, OUString* pTarget=nullptr ); +bool GetEditUrl(const Point& rPos, OUString* pName = nullptr, OUString* pUrl = nullptr, +OUString* pTarget = nullptr, SCCOL* pnCol= nullptr); virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 55b65bce1979..888ab37c9ed4 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -3223,8 +3224,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), pPosY->GetValue() * rData.GetPPTY()); -OUString aName, aUrl; -if (pWindow->GetEditUrl(aPoint, &aName, &aUrl)) +OUString aUrl; +if (pWindow->GetEditUrl(aPoint, nullptr, &aUrl)) { uno::Reference xClipboard = pWindow->GetClipboard(); @@ -3236,6 +3237,55 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; +case SID_EDIT_HYPERLINK: +case SID_REMOVE_HYPERLINK: +{ +ScViewData& rData = GetViewData(); +ScGridWindow* pWindow = rData.GetActiveWin(); +const SfxInt32Item* pPosX = rReq.GetArg(FN_PARAM_1); +const SfxInt32Item* pPosY = rReq.GetArg(FN_PARAM_2); +if (pWindow && pPosX && pPosY) +{ +const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), + pPosY->GetValue() * rData.GetPPTY()); +SCCOL nPosX; +SCROW nPosY; +ScSplitPos eWhich = rData.GetActivePart(); +rData.GetPosFromPixel(aPoint.X(), aPoint.Y(), eWhich, nPosX, nPosY); +if (pWindow->GetEditUrl(aPoint, nullptr, nullptr, nullptr, &nPosX)) +{ +pTabViewShell->SetCursor(nPosX, nPosY); +pTabViewShell->UpdateInputHandler(); +pScMod->SetInputMode(SC_INPUT_TABLE); +ScInputHandler* pHdl = pScMod->GetInputHdl(pTabViewShell); +if (rData.HasEditView(eWhich) && pHdl) +{ +// Set text cursor where clicked +
core.git: Branch 'distro/collabora/co-23.05' - sc/sdi sc/source svx/sdi
sc/sdi/cellsh.sdi |2 + sc/source/ui/inc/gridwin.hxx |3 +- sc/source/ui/view/cellsh1.cxx | 54 -- sc/source/ui/view/gridwin.cxx | 14 +++--- svx/sdi/svx.sdi |4 +-- 5 files changed, 67 insertions(+), 10 deletions(-) New commits: commit 2ef50e771768b383d9299cbb30e710679253c471 Author: Jaume Pujantell AuthorDate: Mon Jul 8 22:27:24 2024 +0200 Commit: Miklos Vajna CommitDate: Mon Jul 15 16:20:35 2024 +0200 lok calc: allow remove and edit hypelink outside of edit mode Right now .uno:EditHyperlink and .uno:RemoveHyperlink only work on edit mode or inside a draw object, but LOK_CALLBACK_HYPERLINK_CLICKED is dispatched outside of edit mode. Change-Id: I26fb0c2e1ac438631ea71e33282e201f0a215d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170171 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit decb72c909b3f8296fb5c6b57b267c1079a865be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170479 diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 9aed584061a3..687273d4eacf 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -183,6 +183,8 @@ interface CellSelection SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_COPY_HYPERLINK_LOCATION [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_EDIT_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_REMOVE_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON[ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_TOGGLE[ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 773cb3a1eac3..ec992b680f73 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -387,7 +387,8 @@ public: /// Get the cell selection, coordinates are in logic units. void GetCellSelection(std::vector& rLogicRects); -bool GetEditUrl( const Point& rPos, OUString* pName=nullptr, OUString* pUrl=nullptr, OUString* pTarget=nullptr ); +bool GetEditUrl(const Point& rPos, OUString* pName = nullptr, OUString* pUrl = nullptr, +OUString* pTarget = nullptr, SCCOL* pnCol= nullptr); virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index b3d3d491166b..1eb1b717b8a0 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -3213,8 +3214,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), pPosY->GetValue() * rData.GetPPTY()); -OUString aName, aUrl; -if (pWindow->GetEditUrl(aPoint, &aName, &aUrl)) +OUString aUrl; +if (pWindow->GetEditUrl(aPoint, nullptr, &aUrl)) { uno::Reference xClipboard = pWindow->GetClipboard(); @@ -3226,6 +3227,55 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; +case SID_EDIT_HYPERLINK: +case SID_REMOVE_HYPERLINK: +{ +ScViewData& rData = GetViewData(); +ScGridWindow* pWindow = rData.GetActiveWin(); +const SfxInt32Item* pPosX = rReq.GetArg(FN_PARAM_1); +const SfxInt32Item* pPosY = rReq.GetArg(FN_PARAM_2); +if (pWindow && pPosX && pPosY) +{ +const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), + pPosY->GetValue() * rData.GetPPTY()); +SCCOL nPosX; +SCROW nPosY; +ScSplitPos eWhich = rData.GetActivePart(); +rData.GetPosFromPixel(aPoint.X(), aPoint.Y(), eWhich, nPosX, nPosY); +if (pWindow->GetEditUrl(aPoint, nullptr, nullptr, nullptr, &nPosX)) +{ +pTabViewShell->SetCursor(nPosX, nPosY); +pTabViewShell->UpdateInputHandler(); +pScMod->SetInputMode(SC_INPUT_TABLE); +ScInputHandler* pHdl = pScMod->GetInputHdl(pTabViewShell); +if (rData.HasEditView(eWhich) && pHdl) +{ +// Set text cursor where clicked +
core.git: Branch 'distro/collabora/co-24.04' - sc/sdi sc/source svx/sdi
sc/sdi/cellsh.sdi |2 + sc/source/ui/inc/gridwin.hxx |2 - sc/source/ui/view/cellsh1.cxx | 54 -- sc/source/ui/view/gridwin.cxx | 14 +++--- svx/sdi/svx.sdi |4 +-- 5 files changed, 66 insertions(+), 10 deletions(-) New commits: commit decb72c909b3f8296fb5c6b57b267c1079a865be Author: Jaume Pujantell AuthorDate: Mon Jul 8 22:27:24 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Jul 10 15:45:30 2024 +0200 lok calc: allow remove and edit hypelink outside of edit mode Right now .uno:EditHyperlink and .uno:RemoveHyperlink only work on edit mode or inside a draw object, but LOK_CALLBACK_HYPERLINK_CLICKED is dispatched outside of edit mode. Change-Id: I26fb0c2e1ac438631ea71e33282e201f0a215d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170171 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index f01bf7e93a64..d3d7a4dfec3d 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -183,6 +183,8 @@ interface CellSelection SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_COPY_HYPERLINK_LOCATION [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_EDIT_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_REMOVE_HYPERLINK [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON[ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_TOGGLE[ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index a2b8783fbac7..b0c6128f3031 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -389,7 +389,7 @@ public: void GetCellSelection(std::vector& rLogicRects); bool GetEditUrl(const Point& rPos, OUString* pName = nullptr, OUString* pUrl = nullptr, -OUString* pTarget = nullptr); +OUString* pTarget = nullptr, SCCOL* pnRow = nullptr); virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 7ef0b67efc8a..38d1e4682111 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -3207,8 +3208,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) { const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), pPosY->GetValue() * rData.GetPPTY()); -OUString aName, aUrl; -if (pWindow->GetEditUrl(aPoint, &aName, &aUrl)) +OUString aUrl; +if (pWindow->GetEditUrl(aPoint, nullptr, &aUrl)) { uno::Reference xClipboard = pWindow->GetClipboard(); @@ -3220,6 +3221,55 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; +case SID_EDIT_HYPERLINK: +case SID_REMOVE_HYPERLINK: +{ +ScViewData& rData = GetViewData(); +ScGridWindow* pWindow = rData.GetActiveWin(); +const SfxInt32Item* pPosX = rReq.GetArg(FN_PARAM_1); +const SfxInt32Item* pPosY = rReq.GetArg(FN_PARAM_2); +if (pWindow && pPosX && pPosY) +{ +const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), + pPosY->GetValue() * rData.GetPPTY()); +SCCOL nPosX; +SCROW nPosY; +ScSplitPos eWhich = rData.GetActivePart(); +rData.GetPosFromPixel(aPoint.X(), aPoint.Y(), eWhich, nPosX, nPosY); +if (pWindow->GetEditUrl(aPoint, nullptr, nullptr, nullptr, &nPosX)) +{ +pTabViewShell->SetCursor(nPosX, nPosY); +pTabViewShell->UpdateInputHandler(); +pScMod->SetInputMode(SC_INPUT_TABLE); +ScInputHandler* pHdl = pScMod->GetInputHdl(pTabViewShell); +if (rData.HasEditView(eWhich) && pHdl) +{ +// Set text cursor where clicked +EditView* pEditView = rData.GetEditView(eWhich); +MouseEvent aEditEvt(aPoint, 1, MouseEventModifiers::SYNTHETIC, +MOUSE_LEFT, 0); +pEditView->MouseButtonDown(aEd
core.git: Branch 'distro/collabora/co-23.05' - sc/sdi sc/source svx/sdi
sc/sdi/cellsh.sdi |1 + sc/source/ui/view/cellsh.cxx |1 + sc/source/ui/view/cellsh1.cxx | 24 sc/source/ui/view/gridwin.cxx | 11 +++ svx/sdi/svx.sdi |1 + 5 files changed, 34 insertions(+), 4 deletions(-) New commits: commit 0533474cb0188aede59841bf4d547106949f2760 Author: Jaume Pujantell AuthorDate: Tue Jun 25 09:49:46 2024 +0200 Commit: Miklos Vajna CommitDate: Fri Jun 28 11:22:46 2024 +0200 lok calc: allow copy hyperlink outside of edit mode Right now .uno:CopyHyperlinkLocation only works on edit mode or inside a draw object, but LOK_CALLBACK_HYPERLINK_CLICKED is dispatched outside of edit mode and the copy command from the pop-up is ignored. Since there is no text cursor, the position of the hyperlink is needed to discriminate the correct field, since there could be multiple hyperlink fields inside the same cell. Change-Id: If545cf56e631adcdb914c4e799a309bc8bd0422f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169507 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 7370d142607e..9aed584061a3 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -182,6 +182,7 @@ interface CellSelection SID_PASTE_TEXTIMPORT_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] +SID_COPY_HYPERLINK_LOCATION [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON[ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_TOGGLE[ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 7694061e6093..5b9f0de8e68d 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -295,6 +295,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; case SID_COPY: // copy +case SID_COPY_HYPERLINK_LOCATION: // not editable because of matrix only? Do not damage matrix //! is not called, when protected AND matrix, we will have //! to live with this... is caught in Copy-Routine, otherwise diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 3a44db570119..b3d3d491166b 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -3202,6 +3203,29 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; +case SID_COPY_HYPERLINK_LOCATION: +{ +ScViewData& rData = GetViewData(); +ScGridWindow* pWindow = rData.GetActiveWin(); +const SfxInt32Item* pPosX = rReq.GetArg(FN_PARAM_1); +const SfxInt32Item* pPosY = rReq.GetArg(FN_PARAM_2); +if (pWindow && pPosX && pPosY) +{ +const Point aPoint(pPosX->GetValue() * rData.GetPPTX(), + pPosY->GetValue() * rData.GetPPTY()); +OUString aName, aUrl; +if (pWindow->GetEditUrl(aPoint, &aName, &aUrl)) +{ +uno::Reference xClipboard += pWindow->GetClipboard(); +vcl::unohelper::TextDataObject::CopyStringTo(aUrl, xClipboard, + rData.GetViewShell()); +rReq.Done(); +} +} +} +break; + default: OSL_FAIL("incorrect slot in ExecuteEdit"); break; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 3cf47209647c..fc368a7cd8c3 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2492,7 +2492,9 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) OString aCursor = pViewShell->GetViewData().describeCellCursorAt(nPosX, nPosY); double fPPTX = pViewShell->GetViewData().GetPPTX(); int mouseX = aPos.X() / fPPTX; -OString aMsg(aUrl.toUtf8() + " coordinates: " + aCursor + ", " + OString::number(mouseX)); +int mouseY = aPos.Y() / fPPTX; +OString aMsg(aUrl.toUtf8() + " coordinates: " + aCursor + ", " + + OString::number(mouseX) + ", " + OString::number(mouseY)); pViewShell->libreOfficeKitVi
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/ui/table/instable.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit a1fe7787662722279453125fe62f3d9ab689a4ee Author: Jaume Pujantell AuthorDate: Wed May 29 12:00:27 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 11 09:42:00 2024 +0200 lok: sw: do not add a table style on insert dialog This brings the default beahivour of the insert table dialog closer to the behaviour of the uno command, where a table is inserted without a table style and with visible borders. Change-Id: Ifcadbce78c0623aec91fd9320bf90a87efc16448 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168183 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit a17e087e26774c4e33d371322fbef426cd387639) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168611 diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index a5aa4cd83853..03cdadacc678 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -31,6 +31,8 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC std::unique_ptr& prTAFormat ) { SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE; +if (comphelper::LibreOfficeKit::isActive()) +nInsMode = SwInsertTableFlags::DefaultBorder; rName = m_xNameEdit->get_text(); rRow = m_xRowSpinButton->get_value(); rCol = m_xColSpinButton->get_value(); @@ -43,7 +45,7 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC rInsTableOpts.mnRowsToRepeat = 0; if (!m_xDontSplitCB->get_active()) nInsMode |= SwInsertTableFlags::SplitLayout; -if( m_xTAutoFormat ) +if (m_xTAutoFormat && !comphelper::LibreOfficeKit::isActive()) { prTAFormat.reset(new SwTableAutoFormat( *m_xTAutoFormat )); rAutoName = prTAFormat->GetName(); @@ -151,8 +153,8 @@ void SwInsTableDlg::InitAutoTableFormat() // 1 means default table style // unfortunately when the table has a style sw/qa/uitest/writer_tests4/tdf115573.py fails // because tables that have pre-applied style resets the style of the elements in their cells -// when a new row is inserted and the ui test above relies on that. For now this is LOK only -m_lbIndex = comphelper::LibreOfficeKit::isActive() ? 1 : 0; +// when a new row is inserted and the ui test above relies on that. +m_lbIndex = 0; m_xLbFormat->select(m_lbIndex); m_tbIndex = lbIndexToTableIndex(m_lbIndex);
core.git: sw/source
sw/source/ui/table/instable.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit a2b6ce5d21b7f5c84ced8485f5af279f1bf8135f Author: Jaume Pujantell AuthorDate: Wed May 29 12:00:27 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Jun 11 09:41:14 2024 +0200 lok: sw: do not add a table style on insert dialog This brings the default beahivour of the insert table dialog closer to the behaviour of the uno command, where a table is inserted without a table style and with visible borders. Change-Id: Ifcadbce78c0623aec91fd9320bf90a87efc16448 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168183 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice (cherry picked from commit a17e087e26774c4e33d371322fbef426cd387639) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168610 Tested-by: Jenkins diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index a5aa4cd83853..03cdadacc678 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -31,6 +31,8 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC std::unique_ptr& prTAFormat ) { SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE; +if (comphelper::LibreOfficeKit::isActive()) +nInsMode = SwInsertTableFlags::DefaultBorder; rName = m_xNameEdit->get_text(); rRow = m_xRowSpinButton->get_value(); rCol = m_xColSpinButton->get_value(); @@ -43,7 +45,7 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC rInsTableOpts.mnRowsToRepeat = 0; if (!m_xDontSplitCB->get_active()) nInsMode |= SwInsertTableFlags::SplitLayout; -if( m_xTAutoFormat ) +if (m_xTAutoFormat && !comphelper::LibreOfficeKit::isActive()) { prTAFormat.reset(new SwTableAutoFormat( *m_xTAutoFormat )); rAutoName = prTAFormat->GetName(); @@ -151,8 +153,8 @@ void SwInsTableDlg::InitAutoTableFormat() // 1 means default table style // unfortunately when the table has a style sw/qa/uitest/writer_tests4/tdf115573.py fails // because tables that have pre-applied style resets the style of the elements in their cells -// when a new row is inserted and the ui test above relies on that. For now this is LOK only -m_lbIndex = comphelper::LibreOfficeKit::isActive() ? 1 : 0; +// when a new row is inserted and the ui test above relies on that. +m_lbIndex = 0; m_xLbFormat->select(m_lbIndex); m_tbIndex = lbIndexToTableIndex(m_lbIndex);
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/ui/table/instable.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit a17e087e26774c4e33d371322fbef426cd387639 Author: Jaume Pujantell AuthorDate: Wed May 29 12:00:27 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Jun 5 09:21:07 2024 +0200 lok: sw: do not add a table style on insert dialog This brings the default beahivour of the insert table dialog closer to the behaviour of the uno command, where a table is inserted without a table style and with visible borders. Change-Id: Ifcadbce78c0623aec91fd9320bf90a87efc16448 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168183 Reviewed-by: Miklos Vajna Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index a5aa4cd83853..03cdadacc678 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -31,6 +31,8 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC std::unique_ptr& prTAFormat ) { SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE; +if (comphelper::LibreOfficeKit::isActive()) +nInsMode = SwInsertTableFlags::DefaultBorder; rName = m_xNameEdit->get_text(); rRow = m_xRowSpinButton->get_value(); rCol = m_xColSpinButton->get_value(); @@ -43,7 +45,7 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC rInsTableOpts.mnRowsToRepeat = 0; if (!m_xDontSplitCB->get_active()) nInsMode |= SwInsertTableFlags::SplitLayout; -if( m_xTAutoFormat ) +if (m_xTAutoFormat && !comphelper::LibreOfficeKit::isActive()) { prTAFormat.reset(new SwTableAutoFormat( *m_xTAutoFormat )); rAutoName = prTAFormat->GetName(); @@ -151,8 +153,8 @@ void SwInsTableDlg::InitAutoTableFormat() // 1 means default table style // unfortunately when the table has a style sw/qa/uitest/writer_tests4/tdf115573.py fails // because tables that have pre-applied style resets the style of the elements in their cells -// when a new row is inserted and the ui test above relies on that. For now this is LOK only -m_lbIndex = comphelper::LibreOfficeKit::isActive() ? 1 : 0; +// when a new row is inserted and the ui test above relies on that. +m_lbIndex = 0; m_xLbFormat->select(m_lbIndex); m_tbIndex = lbIndexToTableIndex(m_lbIndex);
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 28 ++ sc/source/ui/view/tabview3.cxx |5 + 3 files changed, 31 insertions(+), 2 deletions(-) New commits: commit c8838d6dded9bcf77da657af50b48a7bfa90b85b Author: Jaume Pujantell AuthorDate: Thu May 23 15:30:42 2024 +0200 Commit: Miklos Vajna CommitDate: Mon May 27 11:58:27 2024 +0200 sc: don't overwrite Special Positioning on MakeEditView On LOK, calling UpdateEditPos after SetEditEngine overwrote the outer area of mpLOKSpecialPositioning, making the text show on the wrong position on right alined cells with overflowing content. Changing the order of the calls fixes that. Change-Id: I8ddb31103bb6f0bab1a9a6532af55797ef011214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167991 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3009eebbad4b1d9883a68066d758a67eeaf3c379) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167946 Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods new file mode 100644 index ..6a32fdc579c2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index cea5554d2f5c..f184251132e3 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3964,6 +3964,34 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNumberFormatLocaleMultiUser) } } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLeftOverflowEdit) +{ + comphelper::LibreOfficeKit::setCompatFlag(comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); +ScModelObj* pModelObj = createDoc("right-aligned-with-overflow.ods"); +ViewCallback aView; + +// Go to Cell B5000 +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$B$5000")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + +// Enter edit mode and select all text. +aView.m_aTextSelectionResult.clear(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); +// CTRL + A +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::A); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::A); +Scheduler::ProcessEventsToIdle(); + +// Without the accompanying fix this would fail with +// - Expected: 20 +// - Actual : 1300 +CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 0b8dcb4b8f61..8b075bf45cbc 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2212,14 +2212,15 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // MapMode must be set after HideCursor pGridWin[i]->SetMapMode(aViewData.GetLogicMode()); -aViewData.SetEditEngine( static_cast(i), pEngine, pGridWin[i], nCol, nRow ); - if ( !bPosVisible ) { // move the edit view area to the real (possibly negative) position, // or hide if completely above or left of the window pGridWin[i]->UpdateEditViewPos(); } + +aViewData.SetEditEngine(static_cast(i), pEngine, pGridWin[i], nCol, +nRow); } } }
core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 30 ++ sc/source/ui/view/tabview3.cxx |5 + 3 files changed, 33 insertions(+), 2 deletions(-) New commits: commit 99966b82fbc9f88bca47eaeeb43109c1e38455e4 Author: Jaume Pujantell AuthorDate: Thu May 23 15:30:42 2024 +0200 Commit: Miklos Vajna CommitDate: Mon May 27 11:43:01 2024 +0200 sc: don't overwrite Special Positioning on MakeEditView On LOK, calling UpdateEditPos after SetEditEngine overwrote the outer area of mpLOKSpecialPositioning, making the text show on the wrong position on right alined cells with overflowing content. Changing the order of the calls fixes that. Change-Id: I8ddb31103bb6f0bab1a9a6532af55797ef011214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167991 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168030 diff --git a/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods new file mode 100644 index ..6a32fdc579c2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 53a558b6ea52..1c3f58d7530d 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -185,6 +185,7 @@ public: void testEditShapeText(); void testCopyMultiSelection(); void testNumberFormatLocaleMultiUser(); +void testLeftOverflowEdit(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -268,6 +269,7 @@ public: CPPUNIT_TEST(testEditShapeText); CPPUNIT_TEST(testCopyMultiSelection); CPPUNIT_TEST(testNumberFormatLocaleMultiUser); +CPPUNIT_TEST(testLeftOverflowEdit); CPPUNIT_TEST_SUITE_END(); private: @@ -4237,6 +4239,34 @@ void ScTiledRenderingTest::testNumberFormatLocaleMultiUser() } } +void ScTiledRenderingTest::testLeftOverflowEdit() +{ + comphelper::LibreOfficeKit::setCompatFlag(comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); +ScModelObj* pModelObj = createDoc("right-aligned-with-overflow.ods"); +ViewCallback aView; + +// Go to Cell B5000 +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$B$5000")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + +// Enter edit mode and select all text. +aView.m_aTextSelectionResult.clear(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); +// CTRL + A +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::A); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::A); +Scheduler::ProcessEventsToIdle(); + +// Without the accompanying fix this would fail with +// - Expected: 20 +// - Actual : 1300 +CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX()); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 8f5fe8ae13b8..94cff18abab5 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2176,14 +2176,15 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // MapMode must be set after HideCursor pGridWin[i]->SetMapMode(aViewData.GetLogicMode()); -aViewData.SetEditEngine( static_cast(i), pEngine, pGridWin[i], nCol, nRow ); - if ( !bPosVisible ) { // move the edit view area to the real (possibly negative) position, // or hide if completely above or left of the window pGridWin[i]->UpdateEditViewPos(); } + +aViewData.SetEditEngine(static_cast(i), pEngine, pGridWin[i], nCol, +nRow); } } }
core.git: Branch 'distro/collabora/co-24.04' - sc/qa sc/source
sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 28 ++ sc/source/ui/view/tabview3.cxx |5 + 3 files changed, 31 insertions(+), 2 deletions(-) New commits: commit 3009eebbad4b1d9883a68066d758a67eeaf3c379 Author: Jaume Pujantell AuthorDate: Thu May 23 15:30:42 2024 +0200 Commit: Miklos Vajna CommitDate: Fri May 24 14:24:33 2024 +0200 sc: don't overwrite Special Positioning on MakeEditView On LOK, calling UpdateEditPos after SetEditEngine overwrote the outer area of mpLOKSpecialPositioning, making the text show on the wrong position on right alined cells with overflowing content. Changing the order of the calls fixes that. Change-Id: I8ddb31103bb6f0bab1a9a6532af55797ef011214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167991 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods new file mode 100644 index ..6a32fdc579c2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 17048a4ca8df..a29abeb1ac00 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -4007,6 +4007,34 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNumberFormatLocaleMultiUser) } } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLeftOverflowEdit) +{ + comphelper::LibreOfficeKit::setCompatFlag(comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); +ScModelObj* pModelObj = createDoc("right-aligned-with-overflow.ods"); +ViewCallback aView; + +// Go to Cell B5000 +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$B$5000")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + +// Enter edit mode and select all text. +aView.m_aTextSelectionResult.clear(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); +// CTRL + A +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::A); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::A); +Scheduler::ProcessEventsToIdle(); + +// Without the accompanying fix this would fail with +// - Expected: 20 +// - Actual : 1300 +CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 8345ba9f42d0..602256a34900 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2211,14 +2211,15 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // MapMode must be set after HideCursor pGridWin[i]->SetMapMode(aViewData.GetLogicMode()); -aViewData.SetEditEngine( static_cast(i), pEngine, pGridWin[i], nCol, nRow ); - if ( !bPosVisible ) { // move the edit view area to the real (possibly negative) position, // or hide if completely above or left of the window pGridWin[i]->UpdateEditViewPos(); } + +aViewData.SetEditEngine(static_cast(i), pEngine, pGridWin[i], nCol, +nRow); } } }
core.git: Branch 'distro/collabora/co-23.05' - writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx |binary writerfilter/qa/cppunittests/ooxml/ooxml.cxx |7 +++ writerfilter/source/ooxml/OOXMLDocumentImpl.cxx|3 ++- writerfilter/source/ooxml/OOXMLDocumentImpl.hxx|2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 1562265ced2aad987d7e7734cd9c0f7263dd357c Author: Jaume Pujantell AuthorDate: Fri May 17 16:44:12 2024 +0200 Commit: Miklos Vajna CommitDate: Tue May 21 14:02:29 2024 +0200 writerfilter: avoid infinit loop when resolving embeddings on docx If a docx file contains a loop on the .rels files for headers and/or footers the code would enter an infinite recursion while looking for embeddings. Change-Id: I2122fd6b1677812f561e96a9511a61b0e938e94a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167784 Reviewed-by: Miklos Vajna Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167886 Tested-by: Jenkins CollaboraOffice diff --git a/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx new file mode 100644 index ..8000760017ed Binary files /dev/null and b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx differ diff --git a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx index 8602ecd8e77d..532ff4e9d2e1 100644 --- a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx +++ b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx @@ -62,6 +62,13 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak) CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph")); CPPUNIT_ASSERT(!xParaEnum->hasMoreElements()); } + +CPPUNIT_TEST_FIXTURE(Test, testRecursiveHeaderRels) +{ +// Given a document with self-referencing rels in a header/footer: +loadFromURL(u"recursive_header_rels.docx"); +// It should not crash/hang on load +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 8e0cd9aa8a86..368b8d07465a 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -764,8 +764,9 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS { importSubStreamRelations(pStream, OOXMLStream::CHARTS); } -if(bHeaderFooterFound) +if (bHeaderFooterFound && maSeenStreams.find(customTarget) == maSeenStreams.end()) { +maSeenStreams.insert(customTarget); try { OOXMLStream::Pointer_t Stream = OOXMLDocumentFactory::createStream(pStream, streamType); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index 3f57696b2d25..917ea002 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -30,6 +30,7 @@ #include #include +#include namespace writerfilter::ooxml { @@ -55,6 +56,7 @@ class OOXMLDocumentImpl : public OOXMLDocument css::uno::Reference mxEmbeddings; css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList; std::vector aEmbeddings; +std::set maSeenStreams; bool mbIsSubstream; bool mbSkipImages; /// How many paragraphs equal to 1 percent?
core.git: formula/source
formula/source/core/api/FormulaCompiler.cxx | 61 +--- 1 file changed, 46 insertions(+), 15 deletions(-) New commits: commit c94a870f22a59bfce6ea828a0ea12b3ac567548d Author: Jaume Pujantell AuthorDate: Mon May 20 16:50:34 2024 +0200 Commit: Caolán McNamara CommitDate: Tue May 21 11:24:07 2024 +0200 lok: translate formula bar functions to each locale On calc the native formula symbols were loaded once on start-up and assumed to not change. This adds a map language to symbols when LOK is active and chooses the correct set of symbols on each call. Change-Id: I821fb3ad4a06d764399e3fdf4a2ec628909312db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167870 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell (cherry picked from commit 421ef056cf5e991ae3072cd1acb5ef23aa7c780a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167825 Tested-by: Jenkins diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index e10e8f6a0f95..001430c370da 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -965,28 +966,58 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::CreateOpCodeMap( static bool lcl_fillNativeSymbols( FormulaCompiler::NonConstOpCodeMapPtr& xMap, FormulaCompiler::InitSymbols eWhat = FormulaCompiler::InitSymbols::INIT ) { static OpCodeMapData aSymbolMap; +static std::map aLocaleSymbolMap; std::unique_lock aGuard(aSymbolMap.maMtx); -if (eWhat == FormulaCompiler::InitSymbols::ASK) +if (comphelper::LibreOfficeKit::isActive()) { -return bool(aSymbolMap.mxSymbolMap); -} -else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) -{ -aSymbolMap.mxSymbolMap.reset(); +OUString langauge = comphelper::LibreOfficeKit::getLanguageTag().getLanguage(); +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return aLocaleSymbolMap.contains(langauge) + && bool(aLocaleSymbolMap[langauge].mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aLocaleSymbolMap[langauge].mxSymbolMap.reset(); +} +else if (!aLocaleSymbolMap[langauge].mxSymbolMap) +{ +// Core +aLocaleSymbolMap[langauge].mxSymbolMap = std::make_shared( +SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aLocaleSymbolMap[langauge].mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, + aLocaleSymbolMap[langauge].mxSymbolMap); +// No AddInMap for native core mapping. +} + +xMap = aLocaleSymbolMap[langauge].mxSymbolMap; } -else if (!aSymbolMap.mxSymbolMap) +else { -// Core -aSymbolMap.mxSymbolMap = -std::make_shared( +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return bool(aSymbolMap.mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aSymbolMap.mxSymbolMap.reset(); +} +else if (!aSymbolMap.mxSymbolMap) +{ +// Core +aSymbolMap.mxSymbolMap = std::make_shared( SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); -OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, aSymbolMap.mxSymbolMap); -OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); -// No AddInMap for native core mapping. -} +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aSymbolMap.mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); +// No AddInMap for native core mapping. +} -xMap = aSymbolMap.mxSymbolMap; +xMap = aSymbolMap.mxSymbolMap; +} return true; }
core.git: Branch 'distro/collabora/co-23.05' - formula/source
formula/source/core/api/FormulaCompiler.cxx | 61 +--- 1 file changed, 46 insertions(+), 15 deletions(-) New commits: commit ffc1f09980a8308e5995c96e5c9b2fd33548c935 Author: Jaume Pujantell AuthorDate: Mon May 20 16:50:34 2024 +0200 Commit: Caolán McNamara CommitDate: Tue May 21 11:20:07 2024 +0200 lok: translate formula bar functions to each locale On calc the native formula symbols were loaded once on start-up and assumed to not change. This adds a map language to symbols when LOK is active and chooses the correct set of symbols on each call. Change-Id: I821fb3ad4a06d764399e3fdf4a2ec628909312db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167870 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167887 diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index f7dcba3f9853..ddf3b09dfe90 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -966,28 +967,58 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::CreateOpCodeMap( static bool lcl_fillNativeSymbols( FormulaCompiler::NonConstOpCodeMapPtr& xMap, FormulaCompiler::InitSymbols eWhat = FormulaCompiler::InitSymbols::INIT ) { static OpCodeMapData aSymbolMap; +static std::map aLocaleSymbolMap; osl::MutexGuard aGuard(&aSymbolMap.maMtx); -if (eWhat == FormulaCompiler::InitSymbols::ASK) +if (comphelper::LibreOfficeKit::isActive()) { -return bool(aSymbolMap.mxSymbolMap); -} -else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) -{ -aSymbolMap.mxSymbolMap.reset(); +OUString langauge = comphelper::LibreOfficeKit::getLanguageTag().getLanguage(); +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return aLocaleSymbolMap.find(langauge) != aLocaleSymbolMap.end() + && bool(aLocaleSymbolMap[langauge].mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aLocaleSymbolMap[langauge].mxSymbolMap.reset(); +} +else if (!aLocaleSymbolMap[langauge].mxSymbolMap) +{ +// Core +aLocaleSymbolMap[langauge].mxSymbolMap = std::make_shared( +SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aLocaleSymbolMap[langauge].mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, + aLocaleSymbolMap[langauge].mxSymbolMap); +// No AddInMap for native core mapping. +} + +xMap = aLocaleSymbolMap[langauge].mxSymbolMap; } -else if (!aSymbolMap.mxSymbolMap) +else { -// Core -aSymbolMap.mxSymbolMap = -std::make_shared( +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return bool(aSymbolMap.mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aSymbolMap.mxSymbolMap.reset(); +} +else if (!aSymbolMap.mxSymbolMap) +{ +// Core +aSymbolMap.mxSymbolMap = std::make_shared( SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); -OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, aSymbolMap.mxSymbolMap); -OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); -// No AddInMap for native core mapping. -} +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aSymbolMap.mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); +// No AddInMap for native core mapping. +} -xMap = aSymbolMap.mxSymbolMap; +xMap = aSymbolMap.mxSymbolMap; +} return true; }
core.git: Branch 'libreoffice-24-2' - writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx |binary writerfilter/qa/cppunittests/ooxml/ooxml.cxx |7 +++ writerfilter/source/ooxml/OOXMLDocumentImpl.cxx|3 ++- writerfilter/source/ooxml/OOXMLDocumentImpl.hxx|2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 594f0cfa7f1b7b87e95f1e07af9bc54e36dbfbdf Author: Jaume Pujantell AuthorDate: Fri May 17 16:44:12 2024 +0200 Commit: Xisco Fauli CommitDate: Tue May 21 11:02:38 2024 +0200 writerfilter: avoid infinit loop when resolving embeddings on docx If a docx file contains a loop on the .rels files for headers and/or footers the code would enter an infinite recursion while looking for embeddings. Change-Id: I2122fd6b1677812f561e96a9511a61b0e938e94a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167784 Reviewed-by: Miklos Vajna Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167827 Reviewed-by: Xisco Fauli diff --git a/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx new file mode 100644 index ..8000760017ed Binary files /dev/null and b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx differ diff --git a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx index 32133df9ba7e..42c8d607 100644 --- a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx +++ b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx @@ -62,6 +62,13 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak) CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph")); CPPUNIT_ASSERT(!xParaEnum->hasMoreElements()); } + +CPPUNIT_TEST_FIXTURE(Test, testRecursiveHeaderRels) +{ +// Given a document with self-referencing rels in a header/footer: +loadFromFile(u"recursive_header_rels.docx"); +// It should not crash/hang on load +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index d9900ea7e4fc..07f2ecb73ef5 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -762,8 +762,9 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS { importSubStreamRelations(pStream, OOXMLStream::CHARTS); } -if(bHeaderFooterFound) +if (bHeaderFooterFound && !maSeenStreams.contains(customTarget)) { +maSeenStreams.insert(customTarget); try { OOXMLStream::Pointer_t Stream = OOXMLDocumentFactory::createStream(pStream, streamType); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index 1983ed2583a5..3cf39ba7663c 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -30,6 +30,7 @@ #include #include +#include namespace writerfilter::ooxml { @@ -55,6 +56,7 @@ class OOXMLDocumentImpl : public OOXMLDocument css::uno::Reference mxEmbeddings; css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList; std::vector m_aEmbeddings; +std::set maSeenStreams; bool mbIsSubstream; bool mbSkipImages; /// How many paragraphs equal to 1 percent?
core.git: Branch 'distro/collabora/co-24.04' - writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx |binary writerfilter/qa/cppunittests/ooxml/ooxml.cxx |7 +++ writerfilter/source/ooxml/OOXMLDocumentImpl.cxx|3 ++- writerfilter/source/ooxml/OOXMLDocumentImpl.hxx|2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 2872e5dc20212695b86085e083fec891f4a997d1 Author: Jaume Pujantell AuthorDate: Fri May 17 16:44:12 2024 +0200 Commit: Miklos Vajna CommitDate: Tue May 21 09:55:31 2024 +0200 writerfilter: avoid infinit loop when resolving embeddings on docx If a docx file contains a loop on the .rels files for headers and/or footers the code would enter an infinite recursion while looking for embeddings. Change-Id: I2122fd6b1677812f561e96a9511a61b0e938e94a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167784 Reviewed-by: Miklos Vajna Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167885 Tested-by: Jenkins CollaboraOffice diff --git a/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx new file mode 100644 index ..8000760017ed Binary files /dev/null and b/writerfilter/qa/cppunittests/ooxml/data/recursive_header_rels.docx differ diff --git a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx index 32133df9ba7e..42c8d607 100644 --- a/writerfilter/qa/cppunittests/ooxml/ooxml.cxx +++ b/writerfilter/qa/cppunittests/ooxml/ooxml.cxx @@ -62,6 +62,13 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak) CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph")); CPPUNIT_ASSERT(!xParaEnum->hasMoreElements()); } + +CPPUNIT_TEST_FIXTURE(Test, testRecursiveHeaderRels) +{ +// Given a document with self-referencing rels in a header/footer: +loadFromFile(u"recursive_header_rels.docx"); +// It should not crash/hang on load +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index c576aa330d46..933812275fda 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -762,8 +762,9 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS { importSubStreamRelations(pStream, OOXMLStream::CHARTS); } -if(bHeaderFooterFound) +if (bHeaderFooterFound && !maSeenStreams.contains(customTarget)) { +maSeenStreams.insert(customTarget); try { OOXMLStream::Pointer_t Stream = OOXMLDocumentFactory::createStream(pStream, streamType); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index 1983ed2583a5..3cf39ba7663c 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -30,6 +30,7 @@ #include #include +#include namespace writerfilter::ooxml { @@ -55,6 +56,7 @@ class OOXMLDocumentImpl : public OOXMLDocument css::uno::Reference mxEmbeddings; css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList; std::vector m_aEmbeddings; +std::set maSeenStreams; bool mbIsSubstream; bool mbSkipImages; /// How many paragraphs equal to 1 percent?
core.git: sw/qa sw/source
sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx |binary sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx |7 +++ sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx|3 ++- sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx|2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) New commits: commit e39c57022afbe84601f58ef5bae0f12e69d33fc5 Author: Jaume Pujantell AuthorDate: Fri May 17 16:44:12 2024 +0200 Commit: Miklos Vajna CommitDate: Tue May 21 08:33:10 2024 +0200 writerfilter: avoid infinit loop when resolving embeddings on docx If a docx file contains a loop on the .rels files for headers and/or footers the code would enter an infinite recursion while looking for embeddings. Change-Id: I2122fd6b1677812f561e96a9511a61b0e938e94a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167784 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx b/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx new file mode 100644 index ..8000760017ed Binary files /dev/null and b/sw/qa/writerfilter/cppunittests/ooxml/data/recursive_header_rels.docx differ diff --git a/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx b/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx index c146560ed352..5cbd9e219449 100644 --- a/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx +++ b/sw/qa/writerfilter/cppunittests/ooxml/ooxml.cxx @@ -62,6 +62,13 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableLeak) CPPUNIT_ASSERT(xParagraph->supportsService("com.sun.star.text.Paragraph")); CPPUNIT_ASSERT(!xParaEnum->hasMoreElements()); } + +CPPUNIT_TEST_FIXTURE(Test, testRecursiveHeaderRels) +{ +// Given a document with self-referencing rels in a header/footer: +loadFromFile(u"recursive_header_rels.docx"); +// It should not crash/hang on load +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx index 0530969fbccc..0fdf1b927956 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx @@ -762,8 +762,9 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS { importSubStreamRelations(pStream, OOXMLStream::CHARTS); } -if(bHeaderFooterFound) +if (bHeaderFooterFound && !maSeenStreams.contains(customTarget)) { +maSeenStreams.insert(customTarget); try { OOXMLStream::Pointer_t Stream = OOXMLDocumentFactory::createStream(pStream, streamType); diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx index 87aae13ab94f..ee8a01972f93 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.hxx @@ -30,6 +30,7 @@ #include #include +#include namespace writerfilter::ooxml { @@ -55,6 +56,7 @@ class OOXMLDocumentImpl : public OOXMLDocument css::uno::Reference mxEmbeddings; css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList; std::vector m_aEmbeddings; +std::set maSeenStreams; bool mbIsSubstream; bool mbSkipImages; /// How many paragraphs equal to 1 percent?
core.git: Branch 'distro/collabora/co-24.04' - formula/source
formula/source/core/api/FormulaCompiler.cxx | 61 +--- 1 file changed, 46 insertions(+), 15 deletions(-) New commits: commit 421ef056cf5e991ae3072cd1acb5ef23aa7c780a Author: Jaume Pujantell AuthorDate: Mon May 20 16:50:34 2024 +0200 Commit: Jaume Pujantell CommitDate: Mon May 20 20:23:53 2024 +0200 lok: translate formula bar functions to each locale On calc the native formula symbols were loaded once on start-up and assumed to not change. This adds a map language to symbols when LOK is active and chooses the correct set of symbols on each call. Change-Id: I821fb3ad4a06d764399e3fdf4a2ec628909312db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167870 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 278628cbd648..3656c65def1e 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -965,28 +966,58 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::CreateOpCodeMap( static bool lcl_fillNativeSymbols( FormulaCompiler::NonConstOpCodeMapPtr& xMap, FormulaCompiler::InitSymbols eWhat = FormulaCompiler::InitSymbols::INIT ) { static OpCodeMapData aSymbolMap; +static std::map aLocaleSymbolMap; std::unique_lock aGuard(aSymbolMap.maMtx); -if (eWhat == FormulaCompiler::InitSymbols::ASK) +if (comphelper::LibreOfficeKit::isActive()) { -return bool(aSymbolMap.mxSymbolMap); -} -else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) -{ -aSymbolMap.mxSymbolMap.reset(); +OUString langauge = comphelper::LibreOfficeKit::getLanguageTag().getLanguage(); +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return aLocaleSymbolMap.contains(langauge) + && bool(aLocaleSymbolMap[langauge].mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aLocaleSymbolMap[langauge].mxSymbolMap.reset(); +} +else if (!aLocaleSymbolMap[langauge].mxSymbolMap) +{ +// Core +aLocaleSymbolMap[langauge].mxSymbolMap = std::make_shared( +SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aLocaleSymbolMap[langauge].mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, + aLocaleSymbolMap[langauge].mxSymbolMap); +// No AddInMap for native core mapping. +} + +xMap = aLocaleSymbolMap[langauge].mxSymbolMap; } -else if (!aSymbolMap.mxSymbolMap) +else { -// Core -aSymbolMap.mxSymbolMap = -std::make_shared( +if (eWhat == FormulaCompiler::InitSymbols::ASK) +{ +return bool(aSymbolMap.mxSymbolMap); +} +else if (eWhat == FormulaCompiler::InitSymbols::DESTROY) +{ +aSymbolMap.mxSymbolMap.reset(); +} +else if (!aSymbolMap.mxSymbolMap) +{ +// Core +aSymbolMap.mxSymbolMap = std::make_shared( SC_OPCODE_LAST_OPCODE_ID + 1, true, FormulaGrammar::GRAM_NATIVE_UI); -OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, aSymbolMap.mxSymbolMap); -OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); -// No AddInMap for native core mapping. -} +OpCodeList aOpCodeListSymbols(RID_STRLIST_FUNCTION_NAMES_SYMBOLS, + aSymbolMap.mxSymbolMap); +OpCodeList aOpCodeListNative(RID_STRLIST_FUNCTION_NAMES, aSymbolMap.mxSymbolMap); +// No AddInMap for native core mapping. +} -xMap = aSymbolMap.mxSymbolMap; +xMap = aSymbolMap.mxSymbolMap; +} return true; }
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/uibase/uiview/viewtab.cxx |8 1 file changed, 8 insertions(+) New commits: commit 16341a2f2dbc44fc21fcfa23399d4827c1422eb7 Author: Jaume Pujantell AuthorDate: Fri May 10 10:04:47 2024 +0200 Commit: Tomaž Vajngerl CommitDate: Tue May 14 12:48:40 2024 +0200 sw: avoid unwanted row height changes When changing a row's height with SID_TABLE_CHANGE_CURRENT_BORDER_POSITION avoid knock-on effects to lower rows. Change-Id: I0af5a6ec2ceb685ec5dd97e4a00237a4c7857589 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167438 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl (cherry picked from commit c6c1c7afc18f32453c06a3af25f389ccb9074a1b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167458 diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 44282cd665db..2fc090258d77 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1153,7 +1153,15 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) auto & rEntry = aTabRows.GetEntry(nIndex); tools::Long nNewPosition = rEntry.nPos + nOffset; nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset); +tools::Long nActualOffset = nNewPosition - rEntry.nPos; rEntry.nPos = nNewPosition; +// Maintain the size of the other rows +for (size_t i = nIndex + 1; i < aTabRows.Count(); ++i) +{ +auto& rNextEntry = aTabRows.GetEntry(i); +rNextEntry.nPos += nActualOffset; +} +aTabRows.SetRight(aTabRows.GetRight() + nActualOffset); } rSh.SetTabRows(aTabRows, false);
core.git: sw/source
sw/source/uibase/uiview/viewtab.cxx |8 1 file changed, 8 insertions(+) New commits: commit 1d83ac544dcd2fbfb0aa19065e16ed82c40d0c86 Author: Jaume Pujantell AuthorDate: Fri May 10 10:04:47 2024 +0200 Commit: Caolán McNamara CommitDate: Tue May 14 09:37:43 2024 +0200 sw: avoid unwanted row height changes When changing a row's height with SID_TABLE_CHANGE_CURRENT_BORDER_POSITION avoid knock-on effects to lower rows. Change-Id: I0af5a6ec2ceb685ec5dd97e4a00237a4c7857589 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167438 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl (cherry picked from commit c6c1c7afc18f32453c06a3af25f389ccb9074a1b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167459 Reviewed-by: Caolán McNamara Tested-by: Jenkins diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 2e5bb65435ec..24d5585137fa 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1169,7 +1169,15 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) auto & rEntry = aTabRows.GetEntry(nIndex); tools::Long nNewPosition = rEntry.nPos + nOffset; nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset); +tools::Long nActualOffset = nNewPosition - rEntry.nPos; rEntry.nPos = nNewPosition; +// Maintain the size of the other rows +for (size_t i = nIndex + 1; i < aTabRows.Count(); ++i) +{ +auto& rNextEntry = aTabRows.GetEntry(i); +rNextEntry.nPos += nActualOffset; +} +aTabRows.SetRight(aTabRows.GetRight() + nActualOffset); } rSh.SetTabRows(aTabRows, false);
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/uibase/uiview/viewtab.cxx |8 1 file changed, 8 insertions(+) New commits: commit c6c1c7afc18f32453c06a3af25f389ccb9074a1b Author: Jaume Pujantell AuthorDate: Fri May 10 10:04:47 2024 +0200 Commit: Tomaž Vajngerl CommitDate: Mon May 13 10:47:31 2024 +0200 sw: avoid unwanted row height changes When changing a row's height with SID_TABLE_CHANGE_CURRENT_BORDER_POSITION avoid knock-on effects to lower rows. Change-Id: I0af5a6ec2ceb685ec5dd97e4a00237a4c7857589 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167438 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 52a26eabb672..35d173a7a6dd 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1169,7 +1169,15 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) auto & rEntry = aTabRows.GetEntry(nIndex); tools::Long nNewPosition = rEntry.nPos + nOffset; nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset); +tools::Long nActualOffset = nNewPosition - rEntry.nPos; rEntry.nPos = nNewPosition; +// Maintain the size of the other rows +for (size_t i = nIndex + 1; i < aTabRows.Count(); ++i) +{ +auto& rNextEntry = aTabRows.GetEntry(i); +rNextEntry.nPos += nActualOffset; +} +aTabRows.SetRight(aTabRows.GetRight() + nActualOffset); } rSh.SetTabRows(aTabRows, false);
core.git: Branch 'distro/collabora/co-23.05' - vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit f0748eae8a4a64c84aa5aca69b10688d330f93eb Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 20 15:41:26 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164997 diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 7884fe3f2ed2..0729b220d46b 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -656,6 +656,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index a55c7b9fbf5b..a535d8b65e8e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1778,6 +1778,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit d94288a6f26a6f0d58901732c562dfad861ec4c5 Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 20 15:41:08 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164998 Tested-by: Jenkins diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 315b8605582f..34fdb7a068d5 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -659,6 +659,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 08a3f53b6059..1f56bda71bba 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1746,6 +1746,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: Branch 'distro/collabora/co-24.04' - vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit c3227d33ef18f090d858e93e9dc516db25995ebe Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 19 13:50:15 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 7ef9c1cfc833..066dcddfcfc8 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -656,6 +656,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 7eda7861fc8d..97675b6267c1 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1751,6 +1751,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit e2708fecb34fb4084f8db5f2c5ffb4d8923002ca Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:34:39 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3ca938a25439d6f23bbd6830a96e5180ff94f757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164619 Tested-by: Jenkins diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 977c5e8a93dd..ef97d253bd88 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 20e05096d6c4..8e88bdc2c656 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); }
core.git: Branch 'distro/collabora/co-23.05' - sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit 149080faa86e660d02c4b35a416b3a7169855897 Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:33:32 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3ca938a25439d6f23bbd6830a96e5180ff94f757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164620 diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 624caf17f8fd..1a0a925611e8 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index a5a341376838..6257c7cfbce8 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); } else
core.git: Branch 'distro/collabora/co-24.04' - sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit 3ca938a25439d6f23bbd6830a96e5180ff94f757 Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:17:21 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index a9b62452591e..7e9faad8dcd3 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 20e05096d6c4..8e88bdc2c656 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); } else { diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 18abfa
core.git: Branch 'libreoffice-24-2' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit ccda2c60affd2c10f4a23046e3a9332265b357af Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Michael Stahl CommitDate: Fri Feb 23 12:08:29 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163544 Tested-by: Jenkins (cherry picked from commit 043e090069b3bd4c660743f6f639d002f403a7b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163546 Reviewed-by: Michael Stahl diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v +
core.git: Branch 'distro/collabora/co-24.04' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit f47a53da20f09d97b0686f2c212264dcae62181e Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 15:53:21 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163547 diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1; ++ int tokenId = XML
core.git: external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit 043e090069b3bd4c660743f6f639d002f403a7b8 Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 13:17:03 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163544 Tested-by: Jenkins diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1
core.git: Branch 'distro/collabora/co-23.05' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 11:23:32 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1; ++ int tokenId = XML_TOKEN_INVALID; ++ int tokenType = -1; ++ do ++ { ++ret = xmlTextReaderRead(reader); ++tokenId = getElementToken(reader); ++
core.git: Branch 'libreoffice-24-2' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 18 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 51 insertions(+), 30 deletions(-) New commits: commit 0655736b20fd84e6948d21c31fe388dc83801ad3 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Xisco Fauli CommitDate: Thu Feb 15 12:32:28 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163342 Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163377 diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 30a47557f9bb..4446fa35cb9b 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -293,6 +293,24 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +save("impress_svg_Export"); + +xmlDocUniquePtr pXmlDoc = parseExportedFile(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast(&rSdrObject)); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast(&rSdrObject)); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); +if (pSdrMediaObj) +{ +const css::uno::Reference& xGraphic +
core.git: Branch 'distro/collabora/co-24.04' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 25 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 58 insertions(+), 30 deletions(-) New commits: commit a85070ec1bd01ed7a3c2149919edc5e4f39da7b6 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 15:20:02 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163343 diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 8e4f5f5130a4..24c5c0fc161f 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -349,6 +349,31 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); +SvMemoryStream aStream; +uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export"); +aMediaDescriptor["OutputStream"] <<= xOut; +xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); +aStream.Seek(STREAM_SEEK_TO_BEGIN); + +xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast(&rSdrObject)); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast(&rSdrObject)); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -
core.git: filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 18 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 51 insertions(+), 30 deletions(-) New commits: commit 6565e46f3e49173c4c37f8b51450f5352ac08341 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 14:51:16 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163342 Tested-by: Jenkins diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 30a47557f9bb..4446fa35cb9b 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -293,6 +293,24 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +save("impress_svg_Export"); + +xmlDocUniquePtr pXmlDoc = parseExportedFile(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast(&rSdrObject)); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast(&rSdrObject)); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); +if (pSdrMediaObj) +{ +const css::uno::Reference& xGraphic += pSdrMediaObj->getSnapshot(); +if (xGraphic.is()) +
core.git: Branch 'distro/collabora/co-23.05' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 25 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 58 insertions(+), 30 deletions(-) New commits: commit d0241915eba35c9dc0cc42f322df798a270db00f Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 09:37:04 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 4c1ddd10b58a..4900c742200e 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -346,6 +346,31 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']", 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromURL(u"text-in-image.odp"); + +// Export to SVG. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); +SvMemoryStream aStream; +uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export"); +aMediaDescriptor["OutputStream"] <<= xOut; +xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); +aStream.Seek(STREAM_SEEK_TO_BEGIN); + +xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image", 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text", 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index f9365136afbd..01a43f86819c 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -604,42 +604,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&rSdrObject)); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&rSdrObject)); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast(&rSdrObject)); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast(&rSdrObject)); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(&rSdrObject); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +
core.git: sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit e6be502d833e0380d225218abf4896a635525301 Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Andras Timar CommitDate: Mon Jan 15 20:00:26 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161596 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian (cherry picked from commit 96d52b9e6879df3ab9697a7c0322cda5e08eb9af) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161942 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5ec368a97b40..a865697d4a89 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7352,10 +7352,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7363,21 +7369,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !m_FontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7396,7 +7402,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7413,7 +7419,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7421,7 +7427,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -
core.git: Branch 'distro/collabora/co-24.04' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 915697a17765db27b88cc84144b497e098975271 Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Andras Timar CommitDate: Mon Jan 15 19:59:11 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161863 Tested-by: Jenkins diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit 49c49d2b1687172216a37dfdbb8f7ed1583e6d75 Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Jaume Pujantell CommitDate: Fri Jan 12 09:01:20 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161566 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a70bee00967a..2d6ed05c3247 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7857,10 +7857,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7868,21 +7874,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !fontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7901,7 +7907,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7918,7 +7924,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7926,7 +7932,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( readSize == 0 ) break; @@ -7946,6 +7952,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit 96d52b9e6879df3ab9697a7c0322cda5e08eb9af Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Jaume Pujantell CommitDate: Fri Jan 12 09:01:01 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161596 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3ae94d3c6e69..394d4a715e1a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7259,10 +7259,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7270,21 +7276,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !m_FontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7303,7 +7309,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7320,7 +7326,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7328,7 +7334,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( readSize == 0 ) break; @@ -7348,6 +7354,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16stri
core.git: Branch 'distro/collabora/co-22.05' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit e8ca2d11cf62d78ba1bc3aa9afb57b010a9002cf Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Jan 11 13:46:48 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161862 diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 6969dace6f58..986769af39e8 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -85,6 +85,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"sfx/ui/linefragment.ui"
core.git: vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 54ef7f9ea9e6d0c62076b4fc296ea1feb506b309 Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Jan 11 13:45:55 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161863 Tested-by: Jenkins diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
core.git: Branch 'distro/collabora/co-23.05' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 545d512a5f7b866696b3a4dfc0e00748029d Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Jan 10 14:54:42 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx |6 ++ writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx |binary writerfilter/source/dmapper/DomainMapper.cxx| 26 +++--- writerfilter/source/dmapper/SdtHelper.cxx |1 4 files changed, 16 insertions(+), 17 deletions(-) New commits: commit a8ee639d256315e730bc4014dcca0d78f2de686f Author: Jaume Pujantell AuthorDate: Wed Nov 22 11:59:09 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 14:09:33 2023 +0100 fix a regression crash from commit 5082d50 The commit generated crashes in the crashtest documents 7711 bugtrackers/docx/fdo78333-1.docx and 695 forums/docx/forum-mso-en-4096.docx. This was due to "m_xFieldStartRange", the start of the text portion of the block SDT, being recorded too early. This led to including characters that shouldn't be there in the generated content control. This patch moves the calls to setFieldStartRange to just before the first appendTextPortion call. Change-Id: I7230346fee9a37ebac70beb9bcafd9d7b612eb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159816 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159761 Tested-by: Jenkins CollaboraOffice diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index 7cafcd19f280..ec771ba0f1b4 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -149,6 +149,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) xContentControlProps->getPropertyValue("Alias") >>= aAlias; CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); } + +CPPUNIT_TEST_FIXTURE(Test, testFdo78333) +{ +// just care that it doesn't crash/assert +loadFromURL(u"fdo78333-1-minimized.docx"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx new file mode 100644 index ..0c4a5bc67288 Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0c5f5d855261..9f279469362f 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1190,9 +1190,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->PushSdt(); break; } -if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText -&& GetCurrentTextRange().is()) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); m_pImpl->SetSdt(true); } break; @@ -4115,7 +4112,6 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { m_pImpl->m_pSdtHelper->createPlainTextControl(); finishParagraph(); - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); return; } } @@ -4369,10 +4365,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->clearDeferredBreaks(); } -bool bSdtBlockUnusedText -= m_pImpl->m_pSdtHelper->GetSdtType() != NS_ooxml::LN_CT_SdtRun_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && m_pImpl->m_pSdtHelper->hasUnusedText(); +bool bInSdtBlockText += m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent + && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText; if (pContext && pContext->GetFootnote().is()) { pContext->GetFootnote()->setLabel( sText ); @@ -4382,32 +4377,29 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); m_pImpl->AppendFieldCommand(sText); -if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { -if (bSd
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source
sw/qa/core/unocore/data/tdf108272-1-minimal.docx |binary sw/qa/core/unocore/unocore.cxx |6 ++ sw/source/core/unocore/unotext.cxx |1 + 3 files changed, 7 insertions(+) New commits: commit 9201a9f0aa239b4a2fce17b7c45175590855f349 Author: Jaume Pujantell AuthorDate: Mon Nov 20 10:24:18 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 14:09:02 2023 +0100 fix a regression crash Fixes a crash introduced by commit 5082d50 in crashtesting file 7693 bugtrackers/docx/tdf108272-1.docx. Change-Id: Id33c49165c4d345d652a546db14df98ee0ff754a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159736 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 43868de0ddabba952b923f6189d1fefeddb70bcf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159760 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/unocore/data/tdf108272-1-minimal.docx b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx new file mode 100644 index ..28efdf65b9af Binary files /dev/null and b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx differ diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index f3b102f096cc..dd4d71eda57c 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -932,6 +932,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testCollectFrameAtNodeWithLayout) assertXPath(pXmlDoc, "//draw:frame", 1); } +// just care that it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash) +{ +createSwDoc("tdf108272-1-minimal.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 98b9cecbf57c..3f8cf8dee72c 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1690,6 +1690,7 @@ SwXText::convertToTextFrame( (pStartStartNode != GetStartNode())) { // if not - remove the additional paragraphs and throw +oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes if (bParaBeforeInserted) { SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
[Libreoffice-commits] core.git: writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx |6 ++ writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx |binary writerfilter/source/dmapper/DomainMapper.cxx| 26 +++--- writerfilter/source/dmapper/SdtHelper.cxx |1 4 files changed, 16 insertions(+), 17 deletions(-) New commits: commit 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba Author: Jaume Pujantell AuthorDate: Wed Nov 22 11:59:09 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 08:27:57 2023 +0100 fix a regression crash from commit 5082d50 The commit generated crashes in the crashtest documents 7711 bugtrackers/docx/fdo78333-1.docx and 695 forums/docx/forum-mso-en-4096.docx. This was due to "m_xFieldStartRange", the start of the text portion of the block SDT, being recorded too early. This led to including characters that shouldn't be there in the generated content control. This patch moves the calls to setFieldStartRange to just before the first appendTextPortion call. Change-Id: I7230346fee9a37ebac70beb9bcafd9d7b612eb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159816 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index 7cafcd19f280..ec771ba0f1b4 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -149,6 +149,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) xContentControlProps->getPropertyValue("Alias") >>= aAlias; CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); } + +CPPUNIT_TEST_FIXTURE(Test, testFdo78333) +{ +// just care that it doesn't crash/assert +loadFromURL(u"fdo78333-1-minimized.docx"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx new file mode 100644 index ..0c4a5bc67288 Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e2ef4ec4a4b2..70fc7820844c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1192,9 +1192,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->PushSdt(); break; } -if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText -&& GetCurrentTextRange().is()) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); m_pImpl->SetSdt(true); } break; @@ -4229,7 +4226,6 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) { m_pImpl->m_pSdtHelper->createPlainTextControl(); finishParagraph(); - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); return; } } @@ -4487,10 +4483,9 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) m_pImpl->clearDeferredBreaks(); } -bool bSdtBlockUnusedText -= m_pImpl->m_pSdtHelper->GetSdtType() != NS_ooxml::LN_CT_SdtRun_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && m_pImpl->m_pSdtHelper->hasUnusedText(); +bool bInSdtBlockText += m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent + && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText; if (pContext && pContext->GetFootnote().is()) { pContext->GetFootnote()->setLabel( sText ); @@ -4500,32 +4495,29 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); m_pImpl->AppendFieldCommand(sText); -if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTex
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/unocore/data/tdf108272-1-minimal.docx |binary sw/qa/core/unocore/unocore.cxx |6 ++ sw/source/core/unocore/unotext.cxx |1 + 3 files changed, 7 insertions(+) New commits: commit 43868de0ddabba952b923f6189d1fefeddb70bcf Author: Jaume Pujantell AuthorDate: Mon Nov 20 10:24:18 2023 +0100 Commit: Jaume Pujantell CommitDate: Mon Nov 20 12:18:23 2023 +0100 fix a regression crash Fixes a crash introduced by commit 5082d50. Change-Id: Id33c49165c4d345d652a546db14df98ee0ff754a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159736 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/qa/core/unocore/data/tdf108272-1-minimal.docx b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx new file mode 100644 index ..28efdf65b9af Binary files /dev/null and b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx differ diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index fd5c139e979a..00c61a042b77 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -1025,6 +1025,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf149555) CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString()); } +// just care that it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash) +{ +createSwDoc("tdf108272-1-minimal.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 5fef89f3ffde..f959d6a6104c 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1579,6 +1579,7 @@ SwXText::convertToTextFrame( (pStartStartNode != GetStartNode())) { // if not - remove the additional paragraphs and throw +oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes if (bParaBeforeInserted) { SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - offapi/com sw/inc sw/qa sw/source writerfilter/qa writerfilter/source
offapi/com/sun/star/text/ContentControl.idl |6 sw/inc/formatcontentcontrol.hxx |9 sw/inc/unoprnms.hxx |1 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx| 33 --- sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|5 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 sw/source/core/txtnode/attrcontentcontrol.cxx |3 sw/source/core/unocore/unocontentcontrol.cxx | 28 ++ sw/source/core/unocore/unomap1.cxx|1 sw/source/filter/ww8/docxattributeoutput.cxx |6 writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx | 30 ++ writerfilter/qa/cppunittests/dmapper/data/sdt-block-text.docx |binary writerfilter/source/dmapper/DomainMapper.cxx | 30 ++ writerfilter/source/dmapper/SdtHelper.cxx | 108 -- writerfilter/source/dmapper/SdtHelper.hxx | 13 - 16 files changed, 220 insertions(+), 58 deletions(-) New commits: commit 2f60fa7ccdefd76b61e1c7b7cc27ae92824111da Author: Jaume Pujantell AuthorDate: Wed Sep 13 08:58:21 2023 +0200 Commit: Miklos Vajna CommitDate: Thu Oct 12 08:21:39 2023 +0200 writerfilter: use content controls for text in block SDTs Text inside block SDTs was shown as Text Fields wich ignored properties such as alias and formatting. Now those texts are imported as content controls like in the case of run SDTs. Added the ability for content controls to remember and export the "multiline" property of block SDT text. Some existing tests have been changed due to some different export results. Change-Id: Ice1eb4ca6dd53c99d5abb239371f8ac896c3b6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156867 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit f974779b18609c35e548c27118827af20e55306a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157787 Tested-by: Jenkins CollaboraOffice diff --git a/offapi/com/sun/star/text/ContentControl.idl b/offapi/com/sun/star/text/ContentControl.idl index c2fe46757656..41f538415af9 100644 --- a/offapi/com/sun/star/text/ContentControl.idl +++ b/offapi/com/sun/star/text/ContentControl.idl @@ -147,6 +147,12 @@ service ContentControl @since LibreOffice 7.6 */ [optional, property] string Lock; + +/** Indicates if the control accepts soft breaks. + +@since LibreOffice 24.2 +*/ +[optional, property] string MultiLine; }; diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx index d0801f671cd3..9bad2bd23ff3 100644 --- a/sw/inc/formatcontentcontrol.hxx +++ b/sw/inc/formatcontentcontrol.hxx @@ -173,7 +173,7 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify /// The appearance: just remembered. OUString m_aAppearance; -/// The alias: just remembered. +/// The alias. OUString m_aAlias; /// The tag: just remembered. @@ -188,6 +188,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify /// The control and content locks: mostly just remembered. OUString m_aLock; +/// The multiline property: just remembered. +OUString m_aMultiLine; + /// Stores a list item index, in case the doc model is not yet updated. // i.e. temporarily store the selected item until the text is inserted by GotoContentControl. std::optional m_oSelectedListItem; @@ -389,6 +392,10 @@ public: // At the implementation level, define whether the user can directly modify the contents. bool GetReadWrite() const { return m_bReadWrite; } +void SetMultiLine(const OUString& rMultiline) { m_aMultiLine = rMultiline; } + +const OUString& GetMultiLine() const { return m_aMultiLine; } + SwContentControlType GetType() const; }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index d72883efdb9f..9d484371ed5f 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -942,6 +942,7 @@ inline constexpr OUStringLiteral UNO_NAME_TAG = u"Tag"; inline constexpr OUStringLiteral UNO_NAME_ID = u"Id"; inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex"; inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock"; +inline constexpr OUStringLiteral UNO_NAME_MULTILINE = u"MultiLine"; inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent"; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 0c3ff64e52f7..c8d37ee0e1c7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexp
[Libreoffice-commits] core.git: offapi/com sw/inc sw/qa sw/source writerfilter/qa writerfilter/source
offapi/com/sun/star/text/ContentControl.idl |6 sw/inc/formatcontentcontrol.hxx |9 sw/inc/unoprnms.hxx |1 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx| 30 -- sw/qa/extras/ooxmlexport/ooxmlexport19.cxx|5 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 sw/source/core/txtnode/attrcontentcontrol.cxx |3 sw/source/core/unocore/unocontentcontrol.cxx | 28 ++ sw/source/core/unocore/unomap1.cxx|1 sw/source/filter/ww8/docxattributeoutput.cxx |6 writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx | 30 ++ writerfilter/qa/cppunittests/dmapper/data/sdt-block-text.docx |binary writerfilter/source/dmapper/DomainMapper.cxx | 30 ++ writerfilter/source/dmapper/SdtHelper.cxx | 109 -- writerfilter/source/dmapper/SdtHelper.hxx | 13 - 16 files changed, 221 insertions(+), 55 deletions(-) New commits: commit 5082d50d24c3fec4487c724a15eb0d54a82ecd0d Author: Jaume Pujantell AuthorDate: Wed Sep 13 08:58:21 2023 +0200 Commit: Jaume Pujantell CommitDate: Wed Oct 11 15:19:58 2023 +0200 writerfilter: use content controls for text in block SDTs Text inside block SDTs was shown as Text Fields wich ignored properties such as alias and formatting. Now those texts are imported as content controls like in the case of run SDTs. Added the ability for content controls to remember and export the "multiline" property of block SDT text. Some existing tests have been changed due to some different export results. Change-Id: Ice1eb4ca6dd53c99d5abb239371f8ac896c3b6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156867 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/offapi/com/sun/star/text/ContentControl.idl b/offapi/com/sun/star/text/ContentControl.idl index 34beff3cb127..6f6aa80ca54d 100644 --- a/offapi/com/sun/star/text/ContentControl.idl +++ b/offapi/com/sun/star/text/ContentControl.idl @@ -147,6 +147,12 @@ service ContentControl @since LibreOffice 7.6 */ [optional, property] string Lock; + +/** Indicates if the control accepts soft breaks. + +@since LibreOffice 24.2 +*/ +[optional, property] string MultiLine; }; diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx index 190d0bd540fe..cffe326d0703 100644 --- a/sw/inc/formatcontentcontrol.hxx +++ b/sw/inc/formatcontentcontrol.hxx @@ -173,7 +173,7 @@ class SW_DLLPUBLIC SwContentControl final : public sw::BroadcastingModify /// The appearance: just remembered. OUString m_aAppearance; -/// The alias: just remembered. +/// The alias. OUString m_aAlias; /// The tag: just remembered. @@ -188,6 +188,9 @@ class SW_DLLPUBLIC SwContentControl final : public sw::BroadcastingModify /// The control and content locks: mostly just remembered. OUString m_aLock; +/// The multiline property: just remembered. +OUString m_aMultiLine; + /// Stores a list item index, in case the doc model is not yet updated. // i.e. temporarily store the selected item until the text is inserted by GotoContentControl. std::optional m_oSelectedListItem; @@ -389,6 +392,10 @@ public: // At the implementation level, define whether the user can directly modify the contents. bool GetReadWrite() const { return m_bReadWrite; } +void SetMultiLine(const OUString& rMultiline) { m_aMultiLine = rMultiline; } + +const OUString& GetMultiLine() const { return m_aMultiLine; } + SwContentControlType GetType() const; }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 6553153b459d..630028f0e7a6 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -941,6 +941,7 @@ inline constexpr OUStringLiteral UNO_NAME_TAG = u"Tag"; inline constexpr OUStringLiteral UNO_NAME_ID = u"Id"; inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex"; inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock"; +inline constexpr OUStringLiteral UNO_NAME_MULTILINE = u"MultiLine"; inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent"; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 90c3c750c53c..6d3d0452740a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -683,28 +683,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, "tdf123642.docx") DECLARE_OOXMLEXPORT_TEST(testTdf148361,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit 39aa1f6424390821579bfb6b6ba14e9ce11040ce Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Aug 3 10:31:14 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154093 Tested-by: Jenkins Reviewed-by: Jaume Pujantell (cherry picked from commit 341029de72cf957b7bc7775e51544070d4a49874) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154126 diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 1ec77ad7ad37..ea5956c2bf81 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1445,6 +1445,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nS
[Libreoffice-commits] core.git: desktop/source sfx2/source
desktop/source/lib/init.cxx | 21 + sfx2/source/doc/sfxbasemodel.cxx | 18 +- 2 files changed, 38 insertions(+), 1 deletion(-) New commits: commit a52ba26e6a3567a1f63aeb8d20c084eb286974b4 Author: Jaume Pujantell AuthorDate: Fri Jul 14 09:11:07 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:04:50 2023 +0200 Added possibility to set password on save through arguments Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154415 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8d830c0cbd00..6e8c0db99223 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3270,6 +3270,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha bool bFullSheetPreview = sFullSheetPreview == u"true"; +OUString filePassword; +if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDEND"); +filePassword = aFilterOptions.subView(aIndex + 10, bIndex - (aIndex + 10)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 11); +} +OUString filePasswordToModify; +if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND"); +filePassword = aFilterOptions.subView(aIndex + 18, bIndex - (aIndex + 18)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 19); +} + // Select a pdf version if specified a valid one. If not specified then ignore. // If invalid then fail. sal_Int32 pdfVer = 0; @@ -3344,6 +3361,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha { aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } +if (!filePassword.isEmpty()) +aSaveMediaDescriptor["Password"] <<= filePassword; +if (!filePasswordToModify.isEmpty()) +aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify; // add interaction handler too if (gImpl) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 2b34d5fd5b46..ac0de0cc89a5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -131,6 +131,7 @@ #include #include "printhelper.hxx" #include +#include #include #include #include @@ -3046,13 +3047,13 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; +::comphelper::SequenceAsHashMap aArgHash(seqArguments); if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -::comphelper::SequenceAsHashMap aArgHash( seqArguments ); static constexpr OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) @@ -3122,11 +3123,26 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); +const OUString aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString())); +OUString aPassword, aPasswordToModify; +if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", Sequence()) + .hasElements()) +aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString()); +if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", Sequence()) + .hasElements() +&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", static_cast(0)) == 0) +aPasswordToModify = aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString()); +aArgHash.erase("PasswordToModify"); + std::optional pItemSet(SfxGetpApp()->GetPool()); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); if ( bSaveTo ) pItemSet->Put(SfxBoolItem(SID_SAVETO, true)); +if (!aFilterName.isEmpty() && (!aPassword.isEmpty() || !aPasswor
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx | 21 + sfx2/source/doc/sfxbasemodel.cxx | 18 +- 2 files changed, 38 insertions(+), 1 deletion(-) New commits: commit b95739d70806c121cdc38e4e3eb86683e1581c57 Author: Jaume Pujantell AuthorDate: Fri Jul 14 09:11:07 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:05:03 2023 +0200 Added possibility to set password on save throug arguments Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154433 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c1ebf5d934ea..112b134b5e84 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3308,6 +3308,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha bool bFullSheetPreview = sFullSheetPreview == u"true"; +OUString filePassword; +if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDEND"); +filePassword = aFilterOptions.subView(aIndex + 10, bIndex - (aIndex + 10)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 11); +} +OUString filePasswordToModify; +if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND"); +filePassword = aFilterOptions.subView(aIndex + 18, bIndex - (aIndex + 18)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 19); +} + // Select a pdf version if specified a valid one. If not specified then ignore. // If invalid then fail. sal_Int32 pdfVer = 0; @@ -3382,6 +3399,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha { aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } +if (!filePassword.isEmpty()) +aSaveMediaDescriptor["Password"] <<= filePassword; +if (!filePasswordToModify.isEmpty()) +aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify; // add interaction handler too if (gImpl) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8a539f660409..f5759950d29b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -129,6 +129,7 @@ #include #include "printhelper.hxx" #include +#include #include #include #include @@ -3023,13 +3024,13 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; +::comphelper::SequenceAsHashMap aArgHash(seqArguments); if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -::comphelper::SequenceAsHashMap aArgHash( seqArguments ); static const OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) @@ -3099,11 +3100,26 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); +const OUString aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString())); +OUString aPassword, aPasswordToModify; +if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", Sequence()) + .hasElements()) +aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString()); +if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", Sequence()) + .hasElements() +&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", static_cast(0)) == 0) +aPasswordToModify = aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString()); +aArgHash.erase("PasswordToModify"); + std::optional pItemSet(SfxGetpApp()->GetPool()); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); if ( bSaveTo ) pItemSet->Put(SfxBoolItem(SID_SAVETO, true)); +if (!aFilterName.isEmpty() && (!aPassword.isEmpty() || !aPass
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit d161b4b1290c42dfe4b7c7951408fa712c185a44 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:49 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154047 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 19aa8a703943..9e1459d7fca6 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -3037,6 +3037,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 29 +++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 247 insertions(+), 157 deletions(-) New commits: commit c5a98bb91b4994b2197a104bf209f0d77596ec16 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 09:00:01 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154048 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 056a34e9b4e8..6f1c490b90f4 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1997,6 +1997,35 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testUnallocatedColumnsAttributes) CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); +ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = ScDocShell::GetViewData()->GetMarkData().GetMarkedRanges(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 226023b2914e..6e5ee8527d54 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipO
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit 341029de72cf957b7bc7775e51544070d4a49874 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:31 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154093 Tested-by: Jenkins Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 3be123de219d..44ebf12935bc 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1419,6 +1419,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +for (SCROW i = rowStart; i <= rowEnd &&
[Libreoffice-commits] core.git: include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h | 10 +- libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |8 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit bbf5f97967fb3cde25829e1c428ace31d7d5b8c7 Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Andras Timar CommitDate: Fri Jun 9 09:50:10 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151651 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index d6e46e96aee1..d2a03c8ce9b6 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -960,7 +960,13 @@ typedef enum /** * Informs the LibreOfficeKit client that the color palettes have changed. */ -LOK_CALLBACK_COLOR_PALETTES = 65 +LOK_CALLBACK_COLOR_PALETTES = 65, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 } LibreOfficeKitCallbackType; @@ -1121,6 +1127,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED"; case LOK_CALLBACK_COLOR_PALETTES: return "LOK_CALLBACK_COLOR_PALETTES"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 305ac5a477d2..7245c8e2096f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1492,6 +1492,7 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 7d97ab8b3ba8..f702c2ec10c1 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include @@ -71,6 +73,7 @@ #include #include #include +#include #include #include @@ -792,6 +795,11 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, payloadJson.finishAndGetAsOString()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h | 10 +- libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |9 + 3 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 5ec8b322107480075e6edae2711e87ca59ed5eef Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:55:25 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152653 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index d6e46e96aee1..d2a03c8ce9b6 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -960,7 +960,13 @@ typedef enum /** * Informs the LibreOfficeKit client that the color palettes have changed. */ -LOK_CALLBACK_COLOR_PALETTES = 65 +LOK_CALLBACK_COLOR_PALETTES = 65, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 } LibreOfficeKitCallbackType; @@ -1121,6 +1127,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED"; case LOK_CALLBACK_COLOR_PALETTES: return "LOK_CALLBACK_COLOR_PALETTES"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 305ac5a477d2..7245c8e2096f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1492,6 +1492,7 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 3067229b96eb..85b9e50fc941 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include @@ -71,6 +73,7 @@ #include #include #include +#include #include #include @@ -792,6 +795,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, +payloadJson.extractAsOString().getStr()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit 53d610786ba8085fcce331174c74294c90c41a20 Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:59 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152606 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 156720fed840..1abd5bf80151 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 850f1a973ff1..432d38f9cb32 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 39c6ada55f4e..35b1bffbcb73 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 7afe26ee54b0..dbadf4cb6fe1 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " + OUString::number(mnIndex));
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit d01c4ebd00a7ec0249f34b26715802036db4 Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:44 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152548 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 4236d2f3ea21..a03cee4dc362 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 991412f063d5..3656c54f241a 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 002c1c5db4e6..b54703c3f0e7 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index cfd632dcc2bd..a44acdf74a6c 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -523,18 +523,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " + OUString::
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit 13c3bc9094c56136d1b7d35ecf6fbfa4655448bc Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:14 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152549 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 6fe273054b4b..5f5ad9a851ec 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 991412f063d5..3656c54f241a 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 39c6ada55f4e..35b1bffbcb73 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 7afe26ee54b0..dbadf4cb6fe1 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " + OUString::
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h |8 libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |9 + 3 files changed, 18 insertions(+) New commits: commit 88db520407ed5786466513c9486ebb633ce140df Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Ashod Nakashian CommitDate: Tue May 23 04:21:52 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151789 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 0094b94de559..7e1110089e52 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -907,6 +907,12 @@ typedef enum * "file:///tmp/hello-world.pdf" */ LOK_CALLBACK_EXPORT_FILE = 59, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 62 } LibreOfficeKitCallbackType; @@ -1055,6 +1061,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_MEDIA_SHAPE"; case LOK_CALLBACK_EXPORT_FILE: return "LOK_CALLBACK_EXPORT_FILE"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index ce5b059a9006..c12067a483e1 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1487,6 +1487,7 @@ callback (gpointer pData) case LOK_CALLBACK_FONTS_MISSING: case LOK_CALLBACK_MEDIA_SHAPE: case LOK_CALLBACK_EXPORT_FILE: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 799d8fbd3168..71eeafc6ff6f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include @@ -70,6 +72,7 @@ #include #include #include +#include #include #include @@ -789,6 +792,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, +payloadJson.extractAsOString().getStr()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 1600181e74692714d844e7e51f411765895ea3de Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Justin Luth CommitDate: Fri May 5 12:56:49 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151281 Tested-by: Jenkins CollaboraOffice Reviewed-by: Justin Luth diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bb8ac11129b3..7086a4329cc9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6539,7 +6539,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) New commits: commit ccc3db142bcc229181f981aa79f7a5c6b022092a Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Xisco Fauli CommitDate: Thu May 4 15:46:08 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151287 Reviewed-by: Xisco Fauli diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ac080656a98a..12c7e57f34a8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5046,15 +5046,6 @@ void DomainMapper_Impl::PushTextBoxContent() if (m_bIsInTextBox) return; -// tdf#154481: check for TOC creation with empty field stack, -// and close TOC, unless pages will lost. FIXME. -if (IsInTOC() && m_aFieldStack.size() == 0) -{ -m_bStartTOC = false; -SAL_WARN("writerfilter.dmapper", - "broken TOC creation in textbox, but field stack is empty, so closing TOC!"); -} - try { uno::Reference xTBoxFrame( @@ -6558,7 +6549,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 08e111b488c7cddfcacbd66560cf40b060ec4b75 Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Andras Timar CommitDate: Thu May 4 09:27:04 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151282 Tested-by: Andras Timar Reviewed-by: Andras Timar diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8b8bff35e40e..e2c2475ecf9f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6030,7 +6030,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) New commits: commit 5431b756d45bebe74beaba2026704552ee6891f0 Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Ashod Nakashian CommitDate: Wed May 3 12:42:31 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8407aaf7c58a..b3942b4654e9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5215,15 +5215,6 @@ void DomainMapper_Impl::PushTextBoxContent() if (m_bIsInTextBox) return; -// tdf#154481: check for TOC creation with empty field stack, -// and close TOC, unless pages will lost. FIXME. -if (IsInTOC() && m_aFieldStack.size() == 0) -{ -m_bStartTOC = false; -SAL_WARN("writerfilter.dmapper", - "broken TOC creation in textbox, but field stack is empty, so closing TOC!"); -} - try { uno::Reference xTBoxFrame( @@ -6720,7 +6711,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: tools/source
tools/source/misc/json_writer.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 2fe581d916b76d613742c983731fb4a10b4ee95f Author: Jaume Pujantell AuthorDate: Tue Apr 18 10:34:47 2023 +0200 Commit: Miklos Vajna CommitDate: Thu Apr 27 12:13:37 2023 +0200 fix bug in json_writer Ruler stores null-terminated strings in fixed length char arrays, so when creating a JSON a string might end earlier that it's size sugsests. Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150542 Reviewed-by: Michael Meeks Tested-by: Jenkins diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index e7a0f55fd6c2..3111cac2f816 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -236,7 +236,8 @@ void JsonWriter::put(std::string_view pPropName, std::string_view rPropVal) ++mPos; // copy and perform escaping -for (size_t i = 0; i < rPropVal.size(); ++i) +bool bReachedEnd = false; +for (size_t i = 0; i < rPropVal.size() && !bReachedEnd; ++i) { char ch = rPropVal[i]; switch (ch) @@ -251,6 +252,9 @@ void JsonWriter::put(std::string_view pPropName, std::string_view rPropVal) case '\\': writeEscapedSequence(ch, mPos); break; +case 0: +bReachedEnd = true; +break; case '\xE2': // Special processing of U+2028 and U+2029 if (i + 2 < rPropVal.size() && rPropVal[i + 1] == '\x80' && (rPropVal[i + 2] == '\xA8' || rPropVal[i + 2] == '\xA9'))
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source
tools/source/misc/json_writer.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 8790a9c408e3d8732993b228012eeb0c941ec2fb Author: Jaume Pujantell AuthorDate: Tue Apr 18 10:34:47 2023 +0200 Commit: Michael Meeks CommitDate: Tue Apr 18 13:33:23 2023 +0200 fix bug in json_writer Ruler stores null-terminated strings in fixed length char arrays, so when creating a JSON a string might end earlier that it's size sugsests. Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150558 Tested-by: Michael Meeks Reviewed-by: Michael Meeks diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index 3d78f82e08e6..aea89a15d421 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -274,7 +274,8 @@ void JsonWriter::put(const char* pPropName, std::string_view rPropVal) mPos += 4; // copy and perform escaping -for (size_t i = 0; i < rPropVal.size(); ++i) +bool bReachedEnd = false; +for (size_t i = 0; i < rPropVal.size() && !bReachedEnd; ++i) { char ch = rPropVal[i]; switch (ch) @@ -289,6 +290,9 @@ void JsonWriter::put(const char* pPropName, std::string_view rPropVal) case '\\': writeEscapedSequence(ch, mPos); break; +case 0: +bReachedEnd = true; +break; case '\xE2': // Special processing of U+2028 and U+2029 if (i + 2 < rPropVal.size() && rPropVal[i + 1] == '\x80' && (rPropVal[i + 2] == '\xA8' || rPropVal[i + 2] == '\xA9'))
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 4300ea07cfa664a1de9509cb9cd83c7ae46afe87 Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Sun Apr 9 22:58:40 2023 +0200 tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 50848b06ea58a147f5b89f057880266518ce79e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149697 Reviewed-by: Xisco Fauli (cherry picked from commit 439d8466c10473d1f3859ffa6c87fef6209e93eb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150141 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 63966fb3c6ab..fafe05d150b4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2318,7 +2318,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 439d8466c10473d1f3859ffa6c87fef6209e93eb Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Xisco Fauli CommitDate: Fri Apr 7 18:44:09 2023 +0200 tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 50848b06ea58a147f5b89f057880266518ce79e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149697 Reviewed-by: Xisco Fauli diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c81b79e8ec4e..c17b7827145d 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2368,7 +2368,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 20132d64bbd448950bcbd2b0d31504d5025ac6c7 Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Andras Timar CommitDate: Wed Mar 29 15:20:45 2023 + tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 6b33abb1c3ee..f43213b67e97 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2367,7 +2367,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 4170ecddacc568922d8182d03d3a23e72c0524ce Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Aron Budea CommitDate: Wed Mar 29 12:21:25 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved after it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149306 Tested-by: Jenkins CollaboraOffice Reviewed-by: Aron Budea diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 8a5c90a972b8..758640d6d765 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 156f73adc58a..3cebc41c06ba 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox(&GetFrameFormat(), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor(&GetFrameFormat(), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidati
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 5bab8fc3b9dd27c0e37cf9a62b1b27c2bf243788 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Xisco Fauli CommitDate: Fri Mar 24 09:09:03 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149438 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 8a5c90a972b8..758640d6d765 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 156f73adc58a..3cebc41c06ba 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox(&GetFrameFormat(), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor(&GetFrameFormat(), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRectWithSpac
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 87c1d93fd2b192f341112a609c741370561879a2 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Andras Timar CommitDate: Thu Mar 23 07:10:06 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149305 Tested-by: Andras Timar diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index abd77b3e217d..3bdeabe9b9f7 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -238,6 +238,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +load(DATA_DIRECTORY, "header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 63011f0171a8..8a6871373ccf 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1965,7 +1965,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 3e37961dffd6..6cc597ef9a64 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -512,6 +513,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox(&GetFrameFormat(), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor(&GetFrameFormat(), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRec
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 826b20b049449c9c335ce00c781cdb52e4ee0512 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Andras Timar CommitDate: Wed Mar 22 16:49:49 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 2669b05fb2a2..f8878ef77bb4 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index a7c57ec0d609..8675f62e72c9 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox(&GetFrameFormat(), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor(&GetFrameFormat(), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRectWithSpaces(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 84d5dcc7365246352a7126ae15c54cd66bf344d9 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 8 10:58:35 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148394 Reviewed-by: Xisco Fauli diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pPa
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit b4c912f680bb195ca17a506ed3037c588144a423 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 22:44:58 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148332 Tested-by: Jenkins CollaboraOffice diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 2de6cd4889d5..9077e6ba5d45 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -201,6 +201,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "array-mixed-numbers-and-elements.pdf"; +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 9ef202ee132b..c8882a6a709b 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3247,6 +3247,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3267,6 +3279,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit da1d2ef7bb9de291941f1048b4012a730e159b2f Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 20:52:23 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148333 Tested-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 93cc22360b56..32bd15643259 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -197,6 +197,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "array-mixed-numbers-and-elements.pdf"; +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 7569deede0f5..8bc66d0c010d 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3221,6 +3221,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3241,6 +3253,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 505abcce16134d30ffb842fa569126198ac31388 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 13:58:34 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148331 Tested-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pPa
[Libreoffice-commits] core.git: vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 574e89ccda1b389faca9f3e44d909a71b5599473 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 08:36:01 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) {