sw/inc/IDocumentContentOperations.hxx | 25 +- sw/inc/swtypes.hxx | 16 - sw/qa/extras/uiwriter/uiwriter.cxx | 156 ++++++++++++++++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 9 sw/source/core/frmedt/fefly1.cxx | 15 - sw/source/core/inc/DocumentContentOperationsManager.hxx | 6 sw/source/core/txtnode/thints.cxx | 8 sw/source/core/undo/undel.cxx | 6 sw/source/core/undo/undobj1.cxx | 2 sw/source/core/undo/unins.cxx | 6 sw/source/core/unocore/unoframe.cxx | 17 + sw/source/filter/html/htmlgrin.cxx | 6 sw/source/filter/html/htmlplug.cxx | 12 - sw/source/filter/ww8/ww8graf.cxx | 6 sw/source/filter/ww8/ww8graf2.cxx | 12 - sw/source/filter/ww8/ww8par4.cxx | 3 sw/source/filter/ww8/ww8par5.cxx | 3 sw/source/filter/xml/xmltexti.cxx | 38 ++- 18 files changed, 271 insertions(+), 75 deletions(-)
New commits: commit 771d85baf18e5b503eb6248e1f41928b00265d8d Author: Michael Stahl <[email protected]> Date: Wed May 10 17:45:14 2017 +0200 tdf#107512 sw: fix rollback of text attributes in SwUndoDelete The problem is that in SwUndoDelete::UndoImpl(), first the formatting attributes are restored via TmpRollback(), and then all footnote/fly attributes are restored via Rollback(). This means that the SwHistory doesn't actually store the original positions of the formatting hints; ideally there wouldn't be 2 separate steps here, but that appears difficult to change now given the plethora of calls to DelContentIndex() ... So work around the problem by adding a new SetAttrMode::NOHINTEXPAND to prevent expanding the existing hints when the CH_TXTATR_BREAKWORD are inserted from SwUndoDelLayFormat. This fixes 2 problematic cases: at the start of the paragraph, and if the hint ends at the position before the CH_TXTATR_BREAKWORD. Let's hope this won't break anything anybody cares about. Change-Id: I557c4c9136f4225ca502019730fb9f0a9c03d23b diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 76ee8b94243a..2307091b98e4 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -170,11 +170,13 @@ enum class SetAttrMode /// Force hint expand (only matters for hints with CH_TXTATR). FORCEHINTEXPAND = 0x0040, /// The inserted item is a copy -- intended for use in ndtxt.cxx. - IS_COPY = 0x0080 + IS_COPY = 0x0080, + /// for Undo, translated to SwInsertFlags::NOHINTEXPAND + NOHINTEXPAND = 0x0100, }; namespace o3tl { - template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x0ff> {}; + template<> struct typed_flags<SetAttrMode> : is_typed_flags<SetAttrMode, 0x1ff> {}; } #define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c ) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 4d58b7c242aa..6816d9f6c3db 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -186,6 +186,7 @@ public: void testTableBackgroundColor(); void testTdf88899(); void testTdf90362(); + void testUndoDelAsCharTdf107512(); void testUndoCharAttribute(); void testUndoDelAsChar(); void testTdf86639(); @@ -319,6 +320,7 @@ public: CPPUNIT_TEST(testTableBackgroundColor); CPPUNIT_TEST(testTdf88899); CPPUNIT_TEST(testTdf90362); + CPPUNIT_TEST(testUndoDelAsCharTdf107512); CPPUNIT_TEST(testUndoCharAttribute); CPPUNIT_TEST(testUndoDelAsChar); CPPUNIT_TEST(testTdf86639); @@ -3187,6 +3189,125 @@ void SwUiWriterTest::testTdf90362() comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", css::uno::Any(false), comphelper::EConfigurationModes::Standard); } +void SwUiWriterTest::testUndoDelAsCharTdf107512() +{ + SwDoc * pDoc(createDoc()); + sw::UndoManager & rUndoManager(pDoc->GetUndoManager()); + IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations()); + SwCursorShell * pShell(pDoc->GetEditShell()); + SfxItemSet frameSet(pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1); + SfxItemSet grfSet(pDoc->GetAttrPool(), RES_GRFATR_BEGIN, RES_GRFATR_END-1); + rIDCO.InsertString(*pShell->GetCursor(), "foo"); + pShell->ClearMark(); + SwFormatAnchor anchor(RndStdIds::FLY_AS_CHAR); + frameSet.Put(anchor); + GraphicObject grf; + pShell->SttEndDoc(true); + CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, &frameSet, &grfSet, nullptr)); + pShell->SttEndDoc(false); + CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, &frameSet, &grfSet, nullptr)); + CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + SvxCharHiddenItem hidden(true, RES_CHRATR_HIDDEN); + pShell->SelectText(1, 4); + rIDCO.InsertPoolItem(*pShell->GetCursor(), hidden); + // now we have "\1foo\1" with the "foo" hidden + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(4, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(OUString(OUStringLiteral1(CH_TXTATR_BREAKWORD) + u"foo" + OUStringLiteral1(CH_TXTATR_BREAKWORD)), pShell->GetCursor()->GetNode().GetTextNode()->GetText()); + SfxPoolItem const* pItem; + SfxItemSet query(pDoc->GetAttrPool(), RES_CHRATR_HIDDEN, RES_CHRATR_HIDDEN); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 1, 4); + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + CPPUNIT_ASSERT(static_cast<SvxCharHiddenItem const*>(pItem)->GetValue()); + query.ClearItem(RES_CHRATR_HIDDEN); + + // delete from the start + pShell->SelectText(0, 4); + rIDCO.DeleteAndJoin(*pShell->GetCursor()); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 0, 1); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Undo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(4, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(5, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + CPPUNIT_ASSERT_EQUAL(OUString(OUStringLiteral1(CH_TXTATR_BREAKWORD) + u"foo" + OUStringLiteral1(CH_TXTATR_BREAKWORD)), pShell->GetCursor()->GetNode().GetTextNode()->GetText()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 0, 1); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 1, 4); + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + CPPUNIT_ASSERT(static_cast<SvxCharHiddenItem const*>(pItem)->GetValue()); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Redo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 0, 1); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Undo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(4, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(5, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + CPPUNIT_ASSERT_EQUAL(OUString(OUStringLiteral1(CH_TXTATR_BREAKWORD) + u"foo" + OUStringLiteral1(CH_TXTATR_BREAKWORD)), pShell->GetCursor()->GetNode().GetTextNode()->GetText()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 0, 1); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 1, 4); + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + CPPUNIT_ASSERT(static_cast<SvxCharHiddenItem const*>(pItem)->GetValue()); + query.ClearItem(RES_CHRATR_HIDDEN); + + // delete from the end + pShell->SelectText(1, 5); + rIDCO.DeleteAndJoin(*pShell->GetCursor()); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 4, 5); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Undo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(4, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(5, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + CPPUNIT_ASSERT_EQUAL(OUString(OUStringLiteral1(CH_TXTATR_BREAKWORD) + u"foo" + OUStringLiteral1(CH_TXTATR_BREAKWORD)), pShell->GetCursor()->GetNode().GetTextNode()->GetText()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 4, 5); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 1, 4); + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + CPPUNIT_ASSERT(static_cast<SvxCharHiddenItem const*>(pItem)->GetValue()); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Redo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 4, 5); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + rUndoManager.Undo(); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->GetTextAttrForCharAt(4, RES_TXTATR_FLYCNT)); + CPPUNIT_ASSERT_EQUAL(size_t(2), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT_EQUAL(5, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + CPPUNIT_ASSERT_EQUAL(OUString(OUStringLiteral1(CH_TXTATR_BREAKWORD) + u"foo" + OUStringLiteral1(CH_TXTATR_BREAKWORD)), pShell->GetCursor()->GetNode().GetTextNode()->GetText()); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 4, 5); + CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + query.ClearItem(RES_CHRATR_HIDDEN); + pShell->GetCursor()->GetNode().GetTextNode()->GetAttr(query, 1, 4); + CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, query.GetItemState(RES_CHRATR_HIDDEN, false, &pItem)); + CPPUNIT_ASSERT(static_cast<SvxCharHiddenItem const*>(pItem)->GetValue()); + query.ClearItem(RES_CHRATR_HIDDEN); +} + void SwUiWriterTest::testUndoCharAttribute() { // Create a new empty Writer document diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index e5cb1022e812..2737ddad4e8b 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1246,9 +1246,11 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode ) // translate from SetAttrMode to InsertMode (for hints with CH_TXTATR) const SwInsertFlags nInsertFlags = - (nMode & SetAttrMode::FORCEHINTEXPAND) - ? (SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) - : SwInsertFlags::EMPTYEXPAND; + (nMode & SetAttrMode::NOHINTEXPAND) + ? SwInsertFlags::NOHINTEXPAND + : (nMode & SetAttrMode::FORCEHINTEXPAND) + ? (SwInsertFlags::FORCEHINTEXPAND | SwInsertFlags::EMPTYEXPAND) + : SwInsertFlags::EMPTYEXPAND; // need this after TryInsertHint, when pAttr may be deleted const sal_Int32 nStart( pAttr->GetStart() ); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index b5f27ce5b33f..2379b521afa6 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -104,7 +104,7 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame) SwContentNode* pCNd = aAnchor.GetContentAnchor()->nNode.GetNode().GetContentNode(); OSL_ENSURE( pCNd->IsTextNode(), "no Text Node at position." ); SwFormatFlyCnt aFormat( pFrameFormat ); - pCNd->GetTextNode()->InsertItem( aFormat, nCntPos, nCntPos ); + pCNd->GetTextNode()->InsertItem(aFormat, nCntPos, nCntPos, SetAttrMode::NOHINTEXPAND); } pFrameFormat->MakeFrames(); commit ffe239962f195781c6b086c5a284aad333e3e12e Author: Michael Stahl <[email protected]> Date: Wed May 10 13:35:26 2017 +0200 sw: avoid assert in SwUndoDelete::RedoImpl 1. insert as-char fly in paragraph 2. hit DEL to delete it 3. Undo 4. Redo Assertion `aTmp.GetPoint()->nNode != rPam.GetPoint()->nNode && aTmp.GetPoint()->nNode != rPam.GetMark()->nNode' failed This was added in e06131e96629eee4e94eba1da7242380716e8e88 assuming that this branch is only reachable with m_bDelFullPara, but it turns out that you get no start/end text also because DelContentIndex() already deleted everything. Change-Id: If4ce55dd4b63d6db11ed3195f78cd595149c0c1b diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 0d40ae1829a1..4d58b7c242aa 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -187,6 +187,7 @@ public: void testTdf88899(); void testTdf90362(); void testUndoCharAttribute(); + void testUndoDelAsChar(); void testTdf86639(); void testTdf90883TableBoxGetCoordinates(); void testEmbeddedDataSource(); @@ -319,6 +320,7 @@ public: CPPUNIT_TEST(testTdf88899); CPPUNIT_TEST(testTdf90362); CPPUNIT_TEST(testUndoCharAttribute); + CPPUNIT_TEST(testUndoDelAsChar); CPPUNIT_TEST(testTdf86639); CPPUNIT_TEST(testTdf90883TableBoxGetCoordinates); CPPUNIT_TEST(testEmbeddedDataSource); @@ -3220,6 +3222,39 @@ void SwUiWriterTest::testUndoCharAttribute() CPPUNIT_ASSERT_EQUAL((*pPoolItem == aWeightItem), false); } +void SwUiWriterTest::testUndoDelAsChar() +{ + SwDoc * pDoc(createDoc()); + sw::UndoManager & rUndoManager(pDoc->GetUndoManager()); + IDocumentContentOperations & rIDCO(pDoc->getIDocumentContentOperations()); + SwCursorShell * pShell(pDoc->GetEditShell()); + SfxItemSet frameSet(pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1); + SfxItemSet grfSet(pDoc->GetAttrPool(), RES_GRFATR_BEGIN, RES_GRFATR_END-1); + SwFormatAnchor anchor(RndStdIds::FLY_AS_CHAR); + frameSet.Put(anchor); + GraphicObject grf; + CPPUNIT_ASSERT(rIDCO.InsertGraphicObject(*pShell->GetCursor(), grf, &frameSet, &grfSet, nullptr)); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + pShell->SetMark(); + pShell->Left(1, CRSR_SKIP_CHARS); + rIDCO.DeleteAndJoin(*pShell->GetCursor()); + CPPUNIT_ASSERT_EQUAL(size_t(0), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT(!pShell->GetCursor()->GetNode().GetTextNode()->HasHints()); + CPPUNIT_ASSERT_EQUAL(0, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->HasHints()); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + rUndoManager.Redo(); + CPPUNIT_ASSERT_EQUAL(size_t(0), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT(!pShell->GetCursor()->GetNode().GetTextNode()->HasHints()); + CPPUNIT_ASSERT_EQUAL(0, pShell->GetCursor()->GetNode().GetTextNode()->Len()); + rUndoManager.Undo(); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_GRF)); + CPPUNIT_ASSERT(pShell->GetCursor()->GetNode().GetTextNode()->HasHints()); + CPPUNIT_ASSERT_EQUAL(1, pShell->GetCursor()->GetNode().GetTextNode()->Len()); +} + void SwUiWriterTest::testTdf86639() { SwDoc* pDoc = createDoc("tdf86639.rtf"); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 566a268af6e6..565405c1bcab 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -1048,6 +1048,12 @@ void SwUndoDelete::RedoImpl(::sw::UndoRedoContext & rContext) } pTableNd->DelFrames(); } + else if (*rPam.GetMark() == *rPam.GetPoint()) + { // paragraph with only footnote or as-char fly, delete that + // => DelContentIndex has already deleted it! nothing to do here + assert(nEndNode == nSttNode); + return; + } // avoid asserts from ~SwIndexReg for deleted nodes SwPaM aTmp(*rPam.End()); commit 60901e880b215d06ab3a7d79d2041bb2c6c64a78 Author: Michael Stahl <[email protected]> Date: Wed May 10 12:56:34 2017 +0200 sw: remove overloading of IDocumentContentOperations::Insert Change-Id: I29114e7057262f8fd169927abc9d3186a4c74c0c diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index be4c084e78f9..c0becb223b1a 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -154,10 +154,15 @@ public: /** Insert graphic or formula. The XXXX are copied. */ - virtual SwFlyFrameFormat* Insert(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, - const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) = 0; - - virtual SwFlyFrameFormat* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, + virtual SwFlyFrameFormat* InsertGraphic( + const SwPaM &rRg, const OUString& rGrfName, + const OUString& rFltName, const Graphic* pGraphic, + const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, + SwFrameFormat*) = 0; + + virtual SwFlyFrameFormat* InsertGraphicObject( + const SwPaM& rRg, const GraphicObject& rGrfObj, + const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) = 0; /** Transpose graphic (with undo) @@ -167,14 +172,18 @@ public: /** Insert a DrawObject. The object must be already registered in DrawModel. */ - virtual SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) = 0; + virtual SwDrawFrameFormat* InsertDrawObj( + const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet) = 0; /** Insert OLE-objects. */ - virtual SwFlyFrameFormat* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) = 0; + virtual SwFlyFrameFormat* InsertEmbObject( + const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, + const SfxItemSet* pFlyAttrSet) = 0; - virtual SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet, - const SfxItemSet* pGrfAttrSet) = 0; + virtual SwFlyFrameFormat* InsertOLE( + const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, + const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) = 0; /** Split a node at rPos (implemented only for TextNode). */ diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index da2fe6dd85b2..585c8c81afc2 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2620,7 +2620,8 @@ void DocumentContentOperationsManager::TransliterateText( m_rDoc.getIDocumentState().SetModified(); } -SwFlyFrameFormat* DocumentContentOperationsManager::Insert( const SwPaM &rRg, +SwFlyFrameFormat* DocumentContentOperationsManager::InsertGraphic( + const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, @@ -2639,7 +2640,8 @@ SwFlyFrameFormat* DocumentContentOperationsManager::Insert( const SwPaM &rRg, return pSwFlyFrameFormat; } -SwFlyFrameFormat* DocumentContentOperationsManager::Insert( const SwPaM &rRg, const GraphicObject& rGrfObj, +SwFlyFrameFormat* DocumentContentOperationsManager::InsertGraphicObject( + const SwPaM &rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat* pFrameFormat ) @@ -2654,7 +2656,8 @@ SwFlyFrameFormat* DocumentContentOperationsManager::Insert( const SwPaM &rRg, co return pSwFlyFrameFormat; } -SwFlyFrameFormat* DocumentContentOperationsManager::Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, +SwFlyFrameFormat* DocumentContentOperationsManager::InsertEmbObject( + const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) { sal_uInt16 nId = RES_POOLFRM_OLE; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 8bd52f04c3b5..024c895d618b 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -816,11 +816,12 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, } } } - pFormat = GetDoc()->getIDocumentContentOperations().Insert(*pCursor, rGrfName, + pFormat = GetDoc()->getIDocumentContentOperations().InsertGraphic( + *pCursor, rGrfName, rFltName, pGraphic, pFlyAttrSet, nullptr, nullptr ); - OSL_ENSURE( pFormat, "Doc->getIDocumentContentOperations().Insert(notxt) failed." ); + OSL_ENSURE(pFormat, "IDocumentContentOperations::InsertGraphic failed."); pCursor = dynamic_cast<SwShellCursor*>(pCursor->GetNext()); } while( pCursor != pStartCursor ); @@ -855,10 +856,9 @@ SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, StartAllAction(); for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { - pFormat = GetDoc()->getIDocumentContentOperations().Insert(rPaM, xObj, - pFlyAttrSet ); - OSL_ENSURE( pFormat, "Doc->getIDocumentContentOperations().Insert(notxt) failed." ); - + pFormat = GetDoc()->getIDocumentContentOperations().InsertEmbObject( + rPaM, xObj, pFlyAttrSet ); + OSL_ENSURE(pFormat, "IDocumentContentOperations::InsertEmbObject failed."); } EndAllAction(); @@ -1772,7 +1772,8 @@ bool SwFEShell::ReplaceSdrObj( const OUString& rGrfName, const Graphic* pGrf ) // delete "Sdr-Object", insert the graphic instead DelSelectedObj(); - GetDoc()->getIDocumentContentOperations().Insert( *GetCursor(), rGrfName, "", pGrf, &aFrameSet, nullptr, nullptr ); + GetDoc()->getIDocumentContentOperations().InsertGraphic( + *GetCursor(), rGrfName, "", pGrf, &aFrameSet, nullptr, nullptr); EndUndo(); EndAllAction(); diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index c1ac6dffffe3..23615fb0b408 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -63,17 +63,17 @@ public: void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&) override; - SwFlyFrameFormat* Insert(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, + SwFlyFrameFormat* InsertGraphic(const SwPaM &rRg, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) override; - SwFlyFrameFormat* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, + SwFlyFrameFormat* InsertGraphicObject(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrameFormat*) override; void ReRead(SwPaM&, const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) override; SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override; - SwFlyFrameFormat* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) override; + SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) override; SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet) override; diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index abed8436eb4c..b0b7a41b6f0f 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -418,7 +418,8 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) if( pGrfNd->IsGrfLink() ) pGrfNd->GetFileFilterNms( &sFile, &sFilter ); - rDoc.getIDocumentContentOperations().Insert( rContext.GetRepeatPaM(), sFile, sFilter, + rDoc.getIDocumentContentOperations().InsertGraphic( + rContext.GetRepeatPaM(), sFile, sFilter, &pGrfNd->GetGrf(), nullptr/* Graphics collection*/, nullptr, nullptr ); } @@ -438,7 +439,8 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) if (aCnt.StoreEmbeddedObject(rSwOLE.GetOleRef(), aName, true, OUString(), OUString())) { uno::Reference < embed::XEmbeddedObject > aNew = aCnt.GetEmbeddedObject( aName ); - rDoc.getIDocumentContentOperations().Insert( rContext.GetRepeatPaM(), + rDoc.getIDocumentContentOperations().InsertEmbObject( + rContext.GetRepeatPaM(), svt::EmbeddedObjectRef( aNew, static_cast<SwOLENode*>(pCNd)->GetAspect() ), nullptr ); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 850a38942d27..f874b2f32469 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2844,11 +2844,12 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan (*pFilter) >>= sFltName; } - pFormat = - pGrfObj ? pDoc->getIDocumentContentOperations().Insert( aPam, *pGrfObj, &aFrameSet, &aGrSet, - pParentFrameFormat ) - : pDoc->getIDocumentContentOperations().Insert( aPam, sGraphicURL, sFltName, &aGraphic, - &aFrameSet, &aGrSet, pParentFrameFormat ); + pFormat = (pGrfObj) + ? pDoc->getIDocumentContentOperations().InsertGraphicObject( + aPam, *pGrfObj, &aFrameSet, &aGrSet, pParentFrameFormat) + : pDoc->getIDocumentContentOperations().InsertGraphic( + aPam, sGraphicURL, sFltName, &aGraphic, + &aFrameSet, &aGrSet, pParentFrameFormat); delete pGrfObj; if(pFormat) { @@ -2955,7 +2956,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan // TODO/LATER: Is it the only possible aspect here? sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect ); - pFormat2 = pDoc->getIDocumentContentOperations().Insert(aPam, xObjRef, &aFrameSet ); + pFormat2 = pDoc->getIDocumentContentOperations().InsertEmbObject( + aPam, xObjRef, &aFrameSet ); assert(pFormat2 && "Doc->Insert(notxt) failed."); pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); @@ -2997,7 +2999,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan rPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName ); SwFlyFrameFormat* pFrameFormat = nullptr; - pFrameFormat = pDoc->getIDocumentContentOperations().Insert( aPam, xObj, &aFrameSet ); + pFrameFormat = pDoc->getIDocumentContentOperations().InsertEmbObject( + aPam, xObj, &aFrameSet); pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); pFrameFormat->Add(this); if(!m_sName.isEmpty()) diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 8e6ef04b7c65..153d1e31e346 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -709,8 +709,10 @@ IMAGE_SETEVENT: aFrameSet.Put( aFrameSize ); // passing empty sGrfNm here, means we don't want the graphic to be linked - SwFrameFormat *pFlyFormat = m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, sGrfNm, aEmptyOUStr, &aGraphic, - &aFrameSet, nullptr, nullptr ); + SwFrameFormat *const pFlyFormat = + m_xDoc->getIDocumentContentOperations().InsertGraphic( + *m_pPam, sGrfNm, aEmptyOUStr, &aGraphic, + &aFrameSet, nullptr, nullptr); SwGrfNode *pGrfNd = m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx() ->GetIndex()+1 ]->GetGrfNode(); diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index adc048cb3b67..154372347432 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -459,7 +459,9 @@ void SwHTMLParser::InsertEmbed() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); + m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam, + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aFrameSet); // Namen am FrameFormat setzen if( !aName.isEmpty() ) @@ -631,7 +633,7 @@ void SwHTMLParser::EndObject() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, + m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam, ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ), &m_pAppletImpl->GetItemSet() ); @@ -764,7 +766,7 @@ void SwHTMLParser::EndApplet() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, + m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam, ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ), &m_pAppletImpl->GetItemSet()); @@ -937,7 +939,9 @@ void SwHTMLParser::InsertFloatingFrame() // und in das Dok einfuegen SwFrameFormat* pFlyFormat = - m_xDoc->getIDocumentContentOperations().Insert( *m_pPam, ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), &aFrameSet ); + m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam, + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aFrameSet); // den alternativen Namen setzen SwNoTextNode *pNoTextNd = diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 9623dd288355..121f605f34dd 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -3031,7 +3031,8 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObj // as a linked graphic - if (GraphicType::NONE == eType || CanUseRemoteLink(aGrfName)) { - pRetFrameFormat = m_rDoc.getIDocumentContentOperations().Insert(*m_pPaM, aGrfName, OUString(), nullptr, + pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, aGrfName, OUString(), nullptr, &rFlySet, &aGrSet, nullptr); bDone = true; } @@ -3039,7 +3040,8 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObj if (!bDone) { const Graphic& rGraph = pGrf->GetGraphic(); - pRetFrameFormat = m_rDoc.getIDocumentContentOperations().Insert(*m_pPaM, OUString(), OUString(), &rGraph, + pRetFrameFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, OUString(), OUString(), &rGraph, &rFlySet, &aGrSet, nullptr); } } diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 6f41f57aab17..4b42da49d882 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -368,8 +368,10 @@ SwFlyFrameFormat* SwWW8ImplReader::MakeGrafNotInContent(const WW8PicDesc& rPD, aFlySet.Put( SwFormatFrameSize( ATT_FIX_SIZE, nWidth, nHeight ) ); - SwFlyFrameFormat* pFlyFormat = m_rDoc.getIDocumentContentOperations().Insert(*m_pPaM, rFileName, OUString(), pGraph, - &aFlySet, &rGrfSet, nullptr); + SwFlyFrameFormat *const pFlyFormat = + m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, rFileName, OUString(), pGraph, + &aFlySet, &rGrfSet, nullptr); // So the frames are generated when inserted in an existing doc: if (m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() && @@ -395,7 +397,8 @@ SwFrameFormat* SwWW8ImplReader::MakeGrafInContent(const WW8_PIC& rPic, if( !pFlyFormat ) // then just as graphic { - pFlyFormat = m_rDoc.getIDocumentContentOperations().Insert( *m_pPaM, rFileName, OUString(), pGraph, &aFlySet, + pFlyFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, rFileName, OUString(), pGraph, &aFlySet, &rGrfSet, nullptr); } @@ -670,7 +673,8 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj, if (!pRet) { - pRet = m_rDoc.getIDocumentContentOperations().Insert(*m_pPaM, OUString(), OUString(), + pRet = m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, OUString(), OUString(), &rGraph, &aAttrSet, &aGrSet, nullptr ); } } diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 347c398a1b01..ac6d9d4c4525 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -300,7 +300,8 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf, GraphicType::Bitmap == aGraph.GetType() ) { - pFormat = m_rDoc.getIDocumentContentOperations().Insert(*m_pPaM, OUString(), OUString(), &aGraph, pFlySet, + pFormat = m_rDoc.getIDocumentContentOperations().InsertGraphic( + *m_pPaM, OUString(), OUString(), &aGraph, pFlySet, pGrfSet, nullptr); } delete pTempSet; diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index fd6f05de89b3..02b32af08c49 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2406,7 +2406,8 @@ eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, OUString& rStr ) RES_FRMATR_END-1 ); aFlySet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) ); aFlySet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME )); - m_pFlyFormatOfJustInsertedGraphic = m_rDoc.getIDocumentContentOperations().Insert( *m_pPaM, + m_pFlyFormatOfJustInsertedGraphic = + m_rDoc.getIDocumentContentOperations().InsertGraphic(*m_pPaM, aGrfName, OUString(), nullptr, // Graphic* diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 3a67abd2c3f8..4c06084fb6bf 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -287,9 +287,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( if( pTextCursor ) { - pFrameFormat = pDoc->getIDocumentContentOperations().Insert( *pTextCursor->GetPaM(), - ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), - &aItemSet ); + pFrameFormat = pDoc->getIDocumentContentOperations().InsertEmbObject( + *pTextCursor->GetPaM(), + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aItemSet); pOLENd = lcl_GetOLENode( pFrameFormat ); } @@ -590,9 +591,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( uno::UNO_QUERY_THROW ); { - SwFrameFormat *pFrameFormat = pDoc->getIDocumentContentOperations().Insert( *pTextCursor->GetPaM(), - ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), - &aItemSet ); + SwFrameFormat *const pFrameFormat = + pDoc->getIDocumentContentOperations().InsertEmbObject( + *pTextCursor->GetPaM(), + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aItemSet ); // TODO/LATER: in future may need a way to set replacement image url to the link ( may be even to the object ), needs oasis cws??? @@ -650,9 +653,10 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertApplet( Size( nWidth, nHeight ), MapUnit::Map100thMM ); - SwFrameFormat *pFrameFormat = pDoc->getIDocumentContentOperations().Insert( *pTextCursor->GetPaM(), - ::svt::EmbeddedObjectRef( aAppletImpl.GetApplet(), embed::Aspects::MSOLE_CONTENT ), - &aAppletImpl.GetItemSet()); + SwFrameFormat *const pFrameFormat = + pDoc->getIDocumentContentOperations().InsertEmbObject( *pTextCursor->GetPaM(), + ::svt::EmbeddedObjectRef(aAppletImpl.GetApplet(), embed::Aspects::MSOLE_CONTENT), + &aAppletImpl.GetItemSet()); xPropSet.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject( *pDoc, pFrameFormat), uno::UNO_QUERY); if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) @@ -723,9 +727,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin( makeAny( OUString( rMimeType ) ) ); } - SwFrameFormat *pFrameFormat = pDoc->getIDocumentContentOperations().Insert( *pTextCursor->GetPaM(), - ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), - &aItemSet); + SwFrameFormat *const pFrameFormat = + pDoc->getIDocumentContentOperations().InsertEmbObject( + *pTextCursor->GetPaM(), + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aItemSet); xPropSet.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject( *pDoc, pFrameFormat), uno::UNO_QUERY); if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) @@ -874,9 +880,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra makeAny( sal_Int32( aMargin.Height() ) ) ); } - SwFrameFormat *pFrameFormat = pDoc->getIDocumentContentOperations().Insert( *pTextCursor->GetPaM(), - ::svt::EmbeddedObjectRef( xObj, embed::Aspects::MSOLE_CONTENT ), - &aItemSet); + SwFrameFormat *const pFrameFormat = + pDoc->getIDocumentContentOperations().InsertEmbObject( + *pTextCursor->GetPaM(), + ::svt::EmbeddedObjectRef(xObj, embed::Aspects::MSOLE_CONTENT), + &aItemSet); xPropSet.set(SwXTextEmbeddedObject::CreateXTextEmbeddedObject( *pDoc, pFrameFormat), uno::UNO_QUERY); if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) commit 32f40845a5b463cc45292df69f141a0011582272 Author: Michael Stahl <[email protected]> Date: Tue May 9 23:12:23 2017 +0200 sw: remove some unused macros from swtypes.hxx Change-Id: I50fd0d5c19e351675d19546c40009dba479a87a1 diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index ee59e9a0ebdf..76ee8b94243a 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -108,9 +108,6 @@ const sal_uInt8 NO_NUMLEVEL = 0x20; // "or" with the levels. // Some helper functions as macros or inlines. -// One kilobyte is 1024 bytes: -#define KB 1024 - #define SET_CURR_SHELL( shell ) CurrShell aCurr( shell ) // pPathFinder is initialized by the UI. @@ -182,13 +179,6 @@ namespace o3tl #define SW_ISPRINTABLE( c ) ( c >= ' ' && 127 != c ) -#ifndef SW_CONSTASCII_DECL -#define SW_CONSTASCII_DECL( n, s ) n[sizeof(s)] -#endif -#ifndef SW_CONSTASCII_DEF -#define SW_CONSTASCII_DEF( n, s ) n[sizeof(s)] = s -#endif - #define CHAR_HARDBLANK u'\x00A0' #define CHAR_HARDHYPHEN u'\x2011' #define CHAR_SOFTHYPHEN u'\x00AD' _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
