editeng/CppunitTest_editeng_editeng.mk | 3 editeng/inc/editdoc.hxx | 2 editeng/source/editeng/eeobj.hxx | 3 editeng/source/xml/xmltxtexp.cxx | 2 include/xmloff/xmlexp.hxx | 2 sd/qa/unit/tiledrendering/data/tdf166882.odp |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 135 ++++++++++++++------------- xmloff/source/core/xmlexp.cxx | 5 - xmloff/source/core/xmlimp.cxx | 5 - 9 files changed, 84 insertions(+), 73 deletions(-)
New commits: commit 1f86c64fbfd85471ade3cf9b69aa0f8dc4848775 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jul 31 13:39:18 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Aug 19 12:59:46 2025 +0200 CppunitTest_editeng_editeng: avoid gb_CppunitTest_use_library_objects It leads to ODR violation since 006c8f2d7517965657a9caca1fa7afd757f2f4c5 (tdf#166882 - sd odf clipboard: fix missing copy/pasted graphic bullets, 2025-07-30), see <https://gerrit.libreoffice.org/c/core/+/188532/7#message-87c0be80800615710c3411e7adf686c6ac1eb36f>. Change-Id: Ia9ef2fb970d05873d7d40f460c8ed09fb709e4c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188655 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@collabora.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189573 diff --git a/editeng/CppunitTest_editeng_editeng.mk b/editeng/CppunitTest_editeng_editeng.mk index 5e6096adc051..7ebea4c4ef81 100644 --- a/editeng/CppunitTest_editeng_editeng.mk +++ b/editeng/CppunitTest_editeng_editeng.mk @@ -15,8 +15,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,editeng_editeng, \ editeng/qa/editeng/editeng \ )) -$(eval $(call gb_CppunitTest_use_library_objects,editeng_editeng,editeng)) - $(eval $(call gb_CppunitTest_use_libraries,editeng_editeng, \ basegfx \ comphelper \ @@ -25,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,editeng_editeng, \ docmodel \ drawinglayercore \ drawinglayer \ + editeng \ i18nlangtag \ i18nutil \ lng \ diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 13a1d3f1d1a4..8a7ac54f1dcd 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -245,7 +245,7 @@ inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, std::siz void CheckOrderedList(const CharAttribList::AttribsType& rAttribs); #endif -class EditEngineItemPool final : public SfxItemPool +class EDITENG_DLLPUBLIC EditEngineItemPool final : public SfxItemPool { public: EditEngineItemPool(); diff --git a/editeng/source/editeng/eeobj.hxx b/editeng/source/editeng/eeobj.hxx index de06f1b703da..3f5fcc388d7c 100644 --- a/editeng/source/editeng/eeobj.hxx +++ b/editeng/source/editeng/eeobj.hxx @@ -19,12 +19,13 @@ #pragma once +#include <editeng/editengdllapi.h> #include <cppuhelper/implbase.hxx> #include <com/sun/star/datatransfer/XTransferable.hpp> #include <tools/stream.hxx> -class EditDataObject : public ::cppu::WeakImplHelper<css::datatransfer::XTransferable> +class EDITENG_DLLPUBLIC EditDataObject : public ::cppu::WeakImplHelper<css::datatransfer::XTransferable> { private: SvMemoryStream maRTFData; commit c807f6f6ea5a6c8b36eb72c5f856dfdd046a9980 Author: Balazs Varga <balazs.va...@collabora.com> AuthorDate: Tue Jul 29 16:22:25 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Aug 19 12:59:39 2025 +0200 tdf#166882 - sd odf clipboard: fix missing copy/pasted graphic bullets Export/import to/from odf clipboard the bitmap of the graphic bullets numbering rules. This is a follow up commit of: 66ed51712bb323bba7d1a0b0d21b256e5f5f9ccf (Bug 128046 - List hierachy not maintained on copy'n'paste) With this extra patch we can also copy/paste the graphic bullets numbering rules together with their texts. However, this goes against the MS Office and OnlyOffice behaviour, where copying text/paragraphs only copies the text, not the list rules. So if we would just want to follow that way, it would be enough to remove UNO_NAME_NUMBERING_RULES, EE_PARA_NUMBULLET from SvxXMLTextImportComponentPropertyMap and SvxXMLTextExportComponentPropertyMap See more info in: https://bugs.documentfoundation.org/show_bug.cgi?id=166882#c5 Change-Id: I3c0b7389adf0d8efee95cc94f02905c3600342c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188532 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.va...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189572 diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index feab612a9d9d..4b29cd700544 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -265,7 +265,7 @@ SvxXMLTextExportComponent::SvxXMLTextExportComponent( const ESelection& rSel, const css::uno::Reference< css::xml::sax::XDocumentHandler > & xHandler) : SvXMLExport( xContext, u""_ustr, /*rFileName*/u""_ustr, xHandler, static_cast<frame::XModel*>(new SvxSimpleUnoModel()), FieldUnit::CM, - SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT ) + SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::EMBEDDED ) { SvxEditEngineSource aEditSource( pEditEngine ); diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index 7f9e9dbe5d8c..26388812dbdb 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -101,7 +101,7 @@ enum class SvXMLExportFlags { SCRIPTS = 0x0020, SETTINGS = 0x0040, FONTDECLS = 0x0080, - EMBEDDED = 0x0100, + EMBEDDED = 0x0100, // for flat-ODF export PRETTY = 0x0400, OASIS = 0x8000, ALL = 0x05ff diff --git a/sd/qa/unit/tiledrendering/data/tdf166882.odp b/sd/qa/unit/tiledrendering/data/tdf166882.odp new file mode 100644 index 000000000000..f6ca6a5f1a93 Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/tdf166882.odp differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index dedb622cd55a..e92a976ff7db 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1113,73 +1113,80 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPostKeyEventInvalidation) } /** - * tests a cut/paste bug around bullet items in a list + * tests a cut/paste bug around bullet items in a list and + * graphic (bitmap) bullet items in a list (Tdf103083, Tdf166882) */ -CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testTdf103083) +CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testClipNumRules) { - // Load the document. - SdXImpressDocument* pXImpressDocument = createDoc("tdf103083.fodp"); - sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - SdPage* pActualPage = pViewShell->GetActualPage(); - - SdrObject* pObject1 = pActualPage->GetObj(1); - CPPUNIT_ASSERT_EQUAL(SdrObjKind::OutlineText, pObject1->GetObjIdentifier()); - SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1); - - SdrView* pView = pViewShell->GetView(); - - // select contents of bullet item - ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), - 1, MOUSE_LEFT, 0); - pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, - o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), - 1, MOUSE_LEFT, 0); - Scheduler::ProcessEventsToIdle(); - pView->SdrBeginTextEdit(pTextObject); - CPPUNIT_ASSERT(pView->GetTextEditObject()); - EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); - rEditView.SetSelection(ESelection(2, 0, 2, 33)); // start para, start char, end para, end char. - CPPUNIT_ASSERT_EQUAL(u"They have all the same formatting"_ustr, rEditView.GetSelected()); - SdrOutliner* pOutliner = pView->GetTextEditOutliner(); - CPPUNIT_ASSERT_EQUAL(u"No-Logo Content~LT~Gliederung 2"_ustr, - pOutliner->GetStyleSheet(2)->GetName()); - const EditTextObject& aEdit = pTextObject->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET); - SvxNumberFormat aNumFmt(pNumFmt->GetNumRule().GetLevel(2)); - - // cut contents of bullet item - dispatchCommand(mxComponent, u".uno:Cut"_ustr, uno::Sequence<beans::PropertyValue>()); - - CPPUNIT_ASSERT(pView->GetTextEditObject()); - EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView(); - rEditView2.SetSelection(ESelection(2, 0, 2, 10)); // start para, start char, end para, end char. - CPPUNIT_ASSERT_EQUAL(OUString(), rEditView2.GetSelected()); - - // paste contents of bullet item - dispatchCommand(mxComponent, u".uno:Paste"_ustr, uno::Sequence<beans::PropertyValue>()); - - // send an ESC key to trigger the commit of the edit to the main model - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::ESCAPE); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::ESCAPE); - Scheduler::ProcessEventsToIdle(); + std::vector<const char*> aFileNames = { "tdf103083.fodp", "tdf166882.odp" }; + for (const char* pFileName : aFileNames) + { + // Load the document. + SdXImpressDocument* pXImpressDocument = createDoc(pFileName); + CPPUNIT_ASSERT(pXImpressDocument); + + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + + SdrObject* pObject1 = pActualPage->GetObj(1); + CPPUNIT_ASSERT_EQUAL(SdrObjKind::OutlineText, pObject1->GetObjIdentifier()); + SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1); + + SdrView* pView = pViewShell->GetView(); + + // select contents of bullet item + ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); + pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), + 1, MOUSE_LEFT, 0); + pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), + 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); + pView->SdrBeginTextEdit(pTextObject); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + rEditView.SetSelection(ESelection(2, 0, 2, 33)); // start para, start char, end para, end char. + CPPUNIT_ASSERT_EQUAL(u"They have all the same formatting"_ustr, rEditView.GetSelected()); + SdrOutliner* pOutliner = pView->GetTextEditOutliner(); + CPPUNIT_ASSERT_EQUAL(u"No-Logo Content~LT~Gliederung 2"_ustr, + pOutliner->GetStyleSheet(2)->GetName()); + const EditTextObject& aEdit = pTextObject->GetOutlinerParaObject()->GetTextObject(); + const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET); + SvxNumberFormat aNumFmt(pNumFmt->GetNumRule().GetLevel(2)); + + // cut contents of bullet item + dispatchCommand(mxComponent, u".uno:Cut"_ustr, uno::Sequence<beans::PropertyValue>()); + + CPPUNIT_ASSERT(pView->GetTextEditObject()); + EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView(); + rEditView2.SetSelection(ESelection(2, 0, 2, 10)); // start para, start char, end para, end char. + CPPUNIT_ASSERT_EQUAL(OUString(), rEditView2.GetSelected()); + + // paste contents of bullet item + dispatchCommand(mxComponent, u".uno:Paste"_ustr, uno::Sequence<beans::PropertyValue>()); + + // send an ESC key to trigger the commit of the edit to the main model + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::ESCAPE); + pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::ESCAPE); + Scheduler::ProcessEventsToIdle(); - pView->SdrBeginTextEdit(pTextObject); - CPPUNIT_ASSERT(pView->GetTextEditObject()); - pOutliner = pView->GetTextEditOutliner(); - EditView& rEditView3 = pView->GetTextEditOutlinerView()->GetEditView(); - rEditView3.SetSelection(ESelection(2, 0, 2, 33)); // start para, start char, end para, end char. - CPPUNIT_ASSERT_EQUAL(u"They have all the same formatting"_ustr, rEditView3.GetSelected()); - CPPUNIT_ASSERT_EQUAL(u"No-Logo Content~LT~Gliederung 2"_ustr, - pOutliner->GetStyleSheet(2)->GetName()); - - const EditTextObject& aEdit2 = pTextObject->GetOutlinerParaObject()->GetTextObject(); - const SvxNumBulletItem* pNumFmt2 = aEdit2.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET); - SvxNumberFormat aNumFmt2(pNumFmt2->GetNumRule().GetLevel(2)); - - bool bEqual(aNumFmt2 == aNumFmt); - CPPUNIT_ASSERT_MESSAGE("Bullet properties changed after paste", bEqual); + pView->SdrBeginTextEdit(pTextObject); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + pOutliner = pView->GetTextEditOutliner(); + EditView& rEditView3 = pView->GetTextEditOutlinerView()->GetEditView(); + rEditView3.SetSelection(ESelection(2, 0, 2, 33)); // start para, start char, end para, end char. + CPPUNIT_ASSERT_EQUAL(u"They have all the same formatting"_ustr, rEditView3.GetSelected()); + CPPUNIT_ASSERT_EQUAL(u"No-Logo Content~LT~Gliederung 2"_ustr, + pOutliner->GetStyleSheet(2)->GetName()); + + const EditTextObject& aEdit2 = pTextObject->GetOutlinerParaObject()->GetTextObject(); + const SvxNumBulletItem* pNumFmt2 = aEdit2.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET); + SvxNumberFormat aNumFmt2(pNumFmt2->GetNumRule().GetLevel(2)); + + bool bEqual(aNumFmt2 == aNumFmt); + CPPUNIT_ASSERT_MESSAGE("Bullet properties changed after paste", bEqual); + } } /** diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 4d77d6bc26db..a5524b33f416 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1242,7 +1242,10 @@ ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { if (!mxGraphicStorageHandler.is()) { - mxGraphicStorageHandler.set(xFactory->createInstance( u"com.sun.star.document.ExportGraphicStorageHandler"_ustr), UNO_QUERY); + mxGraphicStorageHandler.set( + getComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext( + u"com.sun.star.comp.Svx.GraphicExportHelper"_ustr, uno::Sequence<uno::Any>(), getComponentContext()), + uno::UNO_QUERY ); bOwnGraphicResolver = mxGraphicStorageHandler.is(); } diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 134259fdb0f5..368b54ae792f 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -597,8 +597,9 @@ void SAL_CALL SvXMLImport::startDocument() { // #99870# Import... instead of Export... mxGraphicStorageHandler.set( - xFactory->createInstance(u"com.sun.star.document.ImportGraphicStorageHandler"_ustr), - UNO_QUERY); + GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext( + u"com.sun.star.comp.Svx.GraphicImportHelper"_ustr, uno::Sequence<uno::Any>(), GetComponentContext()), + uno::UNO_QUERY ); mpImpl->mbOwnGraphicResolver = mxGraphicStorageHandler.is(); }