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 -
 6 files changed, 80 insertions(+), 69 deletions(-)

New commits:
commit 006c8f2d7517965657a9caca1fa7afd757f2f4c5
Author:     Balazs Varga <balazs.va...@collabora.com>
AuthorDate: Tue Jul 29 16:22:25 2025 +0200
Commit:     Balazs Varga <balazs.va...@collabora.com>
CommitDate: Wed Jul 30 18:18:36 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>

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 3dbc9b672f6f..efca116b2917 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 40ab5dc5010a..b3f21d60e8ef 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();
         }
 

Reply via email to