editeng/source/outliner/outliner.cxx | 3 - editeng/source/outliner/overflowingtxt.cxx | 82 ++++++++++++++++++----------- include/editeng/outliner.hxx | 2 include/editeng/overflowingtxt.hxx | 25 ++++++-- include/svx/textchainflow.hxx | 8 +- svx/source/svdraw/svdotext.cxx | 4 - svx/source/svdraw/textchainflow.cxx | 14 ++-- 7 files changed, 85 insertions(+), 53 deletions(-)
New commits: commit 416b183144fc54eb3aeaee6b0fc584fa91d46dfb Author: matteocam <matteo.campane...@gmail.com> Date: Fri Aug 14 20:36:48 2015 +0200 [unbuildable] use transferable Change-Id: Id7a44157500b99d475c75e08db32c4942619fd4c diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index e921f1b..30b7633 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -2226,9 +2226,8 @@ OverflowingText *Outliner::GetOverflowingText() const sal_Int32 nLastParaLen = GetText(GetParagraph(nLastPara)).getLength(); aOverflowingTextSel = ESelection(nOverflowingPara, nLen, nLastPara, nLastParaLen); + return new OverflowingText(pEditEngine->CreateTransferable(aOverflowingTextSel)); - EditTextObject *pTObj = pEditEngine->CreateTextObject(aOverflowingTextSel); - return new OverflowingText(pTObj); } void Outliner::ClearOverflowingParaNum() diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index b765550..a443a82 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -24,6 +24,9 @@ #include <editeng/outliner.hxx> #include <editeng/outlobj.hxx> #include <editeng/editobj.hxx> +#include <editeng/editdata.hxx> + +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> /* Helper functions for *OverflowingText classes */ @@ -115,15 +118,18 @@ OutlinerParaObject *impGetDeeplyMergedParaObject(Outliner *pOutl, // class OverflowingText -OverflowingText::OverflowingText(EditTextObject *pTObj) - : mpContentTextObj(pTObj->Clone()) +OverflowingText::OverflowingText(com::sun::star::uno::Reference< + com::sun::star::datatransfer::XTransferable> xOverflowingContent) : + mxOverflowingContent(xOverflowingContent) { - // XXX: may have to delete pTObj + } + ESelection OverflowingText::GetInsertionPointSel() const { - return getLastPositionSel(mpContentTextObj); + assert(0); + return getLastPositionSel(NULL); } // class NonOverflowingText @@ -163,19 +169,26 @@ ESelection NonOverflowingText::GetOverflowPointSel() const // The equivalent of ToParaObject for OverflowingText. Here we are prepending the overflowing text to the old dest box's text // XXX: In a sense a better name for OverflowingText and NonOverflowingText are respectively DestLinkText and SourceLinkText -OutlinerParaObject *OverflowingText::GetJuxtaposedParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj) +OutlinerParaObject *OverflowingText::JuxtaposeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj) { - if (mpContentTextObj == NULL) { - fprintf(stderr, "[Chaining] OverflowingText's mpContentTextObj is NULL!\n"); - return NULL; + if (!pNextPObj) { + pOutl->SetToEmptyText(); + } else { + pOutl->SetText(*pNextPObj); } - OutlinerParaObject *pOverflowingPObj = new OutlinerParaObject(*mpContentTextObj); - // the OutlinerParaObject constr. at the prev line gives no valid outliner mode, so we set it - pOverflowingPObj->SetOutlinerMode(pOutl->GetOutlinerMode()); + // XXX: this code should be moved in Outliner directly + // creating Outliner::InsertText(...transferable...) + EditSelection aStartSel(pOutl->pEditEngine->CreateSelection(ESelection(0,0))); + EditPaM aPaM = pOutl->pEditEngine->InsertText(mxOverflowingContent, + OUString(), + aStartSel.Min(), + true); - // Simply Juxtaposing; no within-para merging - return impGetJuxtaposedParaObject(pOutl, pOverflowingPObj, pNextPObj); + // Separate Paragraphs + pOutl->pEditEngine->InsertParaBreak(EditSelection(aPaM, aPaM)); + + return pOutl->CreateParaObject(); } OutlinerParaObject *OverflowingText::impMakeOverflowingParaObject(Outliner *pOutliner) @@ -194,11 +207,24 @@ OutlinerParaObject *OverflowingText::impMakeOverflowingParaObject(Outliner *pOut } -OutlinerParaObject *OverflowingText::GetDeeplyMergedParaObject(Outliner *pOutliner, OutlinerParaObject *pNextPObj) +OutlinerParaObject *OverflowingText::DeeplyMergeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj) { - OutlinerParaObject *pOverflowingPObj = impMakeOverflowingParaObject(pOutliner); - return impGetDeeplyMergedParaObject(pOutliner, pOverflowingPObj, pNextPObj); + if (!pNextPObj) { + pOutl->SetToEmptyText(); + } else { + pOutl->SetText(*pNextPObj); + } + + // XXX: this code should be moved in Outliner directly + // creating Outliner::InsertText(...transferable...) + EditSelection aStartSel(pOutl->pEditEngine->CreateSelection(ESelection(0,0))); + EditPaM aPaM = pOutl->pEditEngine->InsertText(mxOverflowingContent, + OUString(), + aStartSel.Min(), + true); + + return pOutl->CreateParaObject(); } // class OFlowChainedText @@ -221,18 +247,18 @@ ESelection OFlowChainedText::GetOverflowPointSel() const return mpNonOverflowingTxt->GetOverflowPointSel(); } -OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOutliner, OutlinerParaObject *pTextToBeMerged) +OutlinerParaObject *OFlowChainedText::InsertOverflowingText(Outliner *pOutliner, OutlinerParaObject *pTextToBeMerged) { // Just return the roughly merged paras for now - if (mpOverflowingTxt == NULL || pTextToBeMerged == NULL) + if (mpOverflowingTxt == NULL) return NULL; if (mbIsDeepMerge) { fprintf(stderr, "[TEXTCHAINFLOW - OF] Deep merging paras\n" ); - return mpOverflowingTxt->GetDeeplyMergedParaObject(pOutliner, pTextToBeMerged ); + return mpOverflowingTxt->DeeplyMergeParaObject(pOutliner, pTextToBeMerged ); } else { fprintf(stderr, "[TEXTCHAINFLOW - OF] Juxtaposing paras\n" ); - return mpOverflowingTxt->GetJuxtaposedParaObject(pOutliner, pTextToBeMerged ); + return mpOverflowingTxt->JuxtaposeParaObject(pOutliner, pTextToBeMerged ); } } diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 7374b4f..07d9215 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -585,6 +585,8 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster friend class OutlinerUndoCheckPara; friend class OutlinerUndoChangeParaFlags; + friend class NonOverflowingText; + OutlinerEditEng* pEditEngine; ParagraphList* pParaList; diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index f395b8b..8fb4b97 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -24,6 +24,13 @@ #include <editeng/editengdllapi.h> #include <editeng/editdata.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com { namespace sun { namespace star { + namespace datatransfer { + class XTransferable; +} } } } + class OUString; @@ -41,8 +48,8 @@ class OverflowingText { public: - OutlinerParaObject *GetJuxtaposedParaObject(Outliner *, OutlinerParaObject *); - OutlinerParaObject *GetDeeplyMergedParaObject(Outliner *, OutlinerParaObject *); + OutlinerParaObject *JuxtaposeParaObject(Outliner *, OutlinerParaObject *); + OutlinerParaObject *DeeplyMergeParaObject(Outliner *, OutlinerParaObject *); ESelection GetInsertionPointSel() const; //OUString GetHeadingLines() const; @@ -52,11 +59,15 @@ public: private: friend class Outliner; // Constructor - OverflowingText(EditTextObject *pTObj); + //OverflowingText(EditTextObject *pTObj); + OverflowingText(com::sun::star::uno::Reference< + com::sun::star::datatransfer::XTransferable> xOverflowingContent); OutlinerParaObject *impMakeOverflowingParaObject(Outliner *pOutliner); - const EditTextObject *mpContentTextObj; + //const EditTextObject *mpContentTextObj; + com::sun::star::uno::Reference< + com::sun::star::datatransfer::XTransferable> mxOverflowingContent; }; class NonOverflowingText { @@ -89,7 +100,7 @@ class EDITENG_DLLPUBLIC OFlowChainedText { public: OFlowChainedText(Outliner *, bool ); - OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *); + OutlinerParaObject *InsertOverflowingText(Outliner *, OutlinerParaObject *); OutlinerParaObject *RemoveOverflowingText(Outliner *); ESelection GetInsertionPointSel() const; diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index b569e14..94fac05 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -219,8 +219,11 @@ void TextChainFlow::impMoveChainedTextToNextLink(SdrOutliner *pOverflOutl) return; } - OutlinerParaObject *pNewText = impGetOverflowingParaObject(pOverflOutl); + OutlinerParaObject *pNewText = + mpOverflChText->InsertOverflowingText(pOverflOutl, + mpNextLink->GetOutlinerParaObject()); fprintf(stderr, "[TEXTCHAINFLOW - OF] DEST box set to %d paras \n", pNewText->GetTextObject().GetParagraphCount()); + if (pNewText) mpNextLink->NbcSetOutlinerParaObject(pNewText); commit 544f820347a38dfa7f4abf2393d059ece7f43c11 Author: matteocam <matteo.campane...@gmail.com> Date: Wed Aug 12 23:42:27 2015 +0200 Change name to methods for leaving only non-overfl text Change-Id: Ifa04460fe54f03cc6e74ba4f786fee07a9d85596 diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index b11f6e4..b765550 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -147,13 +147,8 @@ bool NonOverflowingText::IsLastParaInterrupted() const } -OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const +OutlinerParaObject *NonOverflowingText::RemoveOverflowingText(Outliner *pOutliner) const { - // XXX: Old code - //OutlinerParaObject *pPObj = new OutlinerParaObject(*mpContentTextObj); - //pPObj->SetOutlinerMode(pOutliner->GetOutlinerMode()); - //return pPObj; - pOutliner->QuickDelete(maContentSel); return pOutliner->CreateParaObject(); } @@ -242,12 +237,12 @@ OutlinerParaObject *OFlowChainedText::CreateOverflowingParaObject(Outliner *pOut } -OutlinerParaObject *OFlowChainedText::CreateNonOverflowingParaObject(Outliner *pOutliner) +OutlinerParaObject *OFlowChainedText::RemoveOverflowingText(Outliner *pOutliner) { if (mpNonOverflowingTxt == NULL) return NULL; - return mpNonOverflowingTxt->ToParaObject(pOutliner); + return mpNonOverflowingTxt->RemoveOverflowingText(pOutliner); } bool OFlowChainedText::IsLastParaInterrupted() const diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index a2fb6c0..f395b8b 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -61,7 +61,7 @@ private: class NonOverflowingText { public: - OutlinerParaObject *ToParaObject(Outliner *) const; + OutlinerParaObject *RemoveOverflowingText(Outliner *) const; ESelection GetOverflowPointSel() const; bool IsLastParaInterrupted() const; @@ -90,7 +90,7 @@ class EDITENG_DLLPUBLIC OFlowChainedText { OFlowChainedText(Outliner *, bool ); OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *); - OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *); + OutlinerParaObject *RemoveOverflowingText(Outliner *); ESelection GetInsertionPointSel() const; ESelection GetOverflowPointSel() const; diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx index f96ce59..60afe75 100644 --- a/include/svx/textchainflow.hxx +++ b/include/svx/textchainflow.hxx @@ -69,6 +69,10 @@ class TextChainFlow { ESelection maOverflowPosSel; ESelection maPostChainingSel; + OFlowChainedText *mpOverflChText; + UFlowChainedText *mpUnderflChText; + + void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *); @@ -79,7 +83,6 @@ class TextChainFlow { virtual void impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *); - OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner); OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner); // impGetMergedUnderflowingParaObject merges underflowing text with the one in the next box OutlinerParaObject *impGetMergedUnderflowParaObject(SdrOutliner *pOutliner); @@ -101,9 +104,6 @@ class TextChainFlow { bool bUnderflow; bool bOverflow; - OFlowChainedText *mpOverflChText; - UFlowChainedText *mpUnderflChText; - }; diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index 71fd30f..b569e14 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -197,7 +197,7 @@ void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pO void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl) { - OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pNonOverflOutl); + OutlinerParaObject *pNewText = mpOverflChText->RemoveOverflowingText(pNonOverflOutl); fprintf(stderr, "[TEXTCHAINFLOW - OF] SOURCE box set to %d paras \n", pNewText->GetTextObject().GetParagraphCount()); @@ -231,11 +231,6 @@ void TextChainFlow::impMoveChainedTextToNextLink(SdrOutliner *pOverflOutl) mpOverflChText->IsLastParaInterrupted()); } -OutlinerParaObject *TextChainFlow::impGetNonOverflowingParaObject(SdrOutliner *pOutliner) -{ - return mpOverflChText->CreateNonOverflowingParaObject(pOutliner); -} - SdrTextObj *TextChainFlow::GetLinkTarget() const { return mpTargetLink; @@ -295,7 +290,7 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl) void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl) { - OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pNonOverflOutl); + OutlinerParaObject *pNewText = mpOverflChText->RemoveOverflowingText(pNonOverflOutl); //impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject GetLinkTarget()->NbcSetOutlinerParaObject(pNewText); commit 16cf056f2e36d05fe2520f8fc708e994e9a471a5 Author: matteocam <matteo.campane...@gmail.com> Date: Wed Aug 12 23:27:03 2015 +0200 Use Edit Outliner in Editing mode for leaving NonOverflowing txt only Change-Id: I0229b7dfece14e8bb23ea58e6ce10ea6375e0758 diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 1c0769e..d8b773b 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -2060,8 +2060,8 @@ void SdrTextObj::onChainingEvent() if (aTxtChainFlow.IsOverflow()) { fprintf(stderr, "[CHAINING] Overflow going on\n"); // One outliner is for non-overflowing text, the other for overflowing text - // In this case they can both be the drawing outliner - aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner); + // We remove text directly from the editing outliner + aTxtChainFlow.ExecuteOverflow(pEdtOutl, &aDrawOutliner); } else if (aTxtChainFlow.IsUnderflow()) { fprintf(stderr, "[CHAINING] Underflow going on\n"); // underflow-induced overflow commit eb72173773a4c4a450d5f784e7164dae87cdbc54 Author: matteocam <matteo.campane...@gmail.com> Date: Wed Aug 12 23:05:35 2015 +0200 GetOverflowPointSel returns a position instead of a selection Change-Id: I1fd78ecc503cbd01e999513b18fd278f4de56d8c diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx index 92c6ca8..b11f6e4 100644 --- a/editeng/source/outliner/overflowingtxt.cxx +++ b/editeng/source/outliner/overflowingtxt.cxx @@ -161,8 +161,9 @@ OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const ESelection NonOverflowingText::GetOverflowPointSel() const { //return getLastPositionSel(mpContentTextObj); - // XXX: Not sure this can work properly - return maContentSel; + + // return the starting point of the selection we are removing + return ESelection(maContentSel.nStartPara, maContentSel.nStartPos); //XXX } // The equivalent of ToParaObject for OverflowingText. Here we are prepending the overflowing text to the old dest box's text _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits