summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatteocam <matteo.campanelli@gmail.com>2015-08-07 17:43:39 +0200
committermatteocam <matteo.campanelli@gmail.com>2015-08-07 17:43:39 +0200
commit30db056d97d95d5d68f938e390e0874f12f40e87 (patch)
treee44ae1e252de02ce76b0da57b093833522d943d5
parentd424de8e12f53a6bc51f491876dcccf6c4b0e6b7 (diff)
Using QuickDelete instead of SetText for changes in Overflow
Change-Id: Ia952113a6cdd0beace331e1f63d08b124d2629b0
-rw-r--r--editeng/source/outliner/outliner.cxx28
-rw-r--r--editeng/source/outliner/outlvw.cxx3
-rw-r--r--editeng/source/outliner/overflowingtxt.cxx16
-rw-r--r--include/editeng/overflowingtxt.hxx2
-rw-r--r--svx/source/svdraw/textchainflow.cxx2
5 files changed, 43 insertions, 8 deletions
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 1404868d72d2..68a17c218c91 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2107,6 +2107,31 @@ NonOverflowingText *Outliner::GetNonOverflowingText() const
return NULL;
}
+ // Same code as GetOverflowingText (we just have to get that selection after all)
+
+ sal_Int32 nHeadPara = pEditEngine->GetOverflowingParaNum();
+ sal_uInt32 nParaCount = GetParagraphCount();
+
+ sal_uInt32 nLen = 0;
+ for ( sal_Int32 nLine = 0;
+ nLine < pEditEngine->GetOverflowingLineNum();
+ nLine++) {
+ nLen += GetLineLen(nHeadPara, nLine);
+ }
+
+ sal_uInt32 nOverflowingPara = pEditEngine->GetOverflowingParaNum();
+ ESelection aOverflowingTextSel;
+ sal_Int32 nLastPara = nParaCount-1;
+ sal_Int32 nLastParaLen = GetText(GetParagraph(nLastPara)).getLength();
+ aOverflowingTextSel = ESelection(nOverflowingPara, nLen,
+ nLastPara, nLastParaLen);
+ bool bLastParaInterrupted =
+ pEditEngine->GetOverflowingLineNum() > 0;
+
+ return new NonOverflowingText(aOverflowingTextSel, bLastParaInterrupted);
+
+ /* Old code
+
// Only overflowing text, i.e. 1st line of 1st paragraph overflowing
bool bItAllOverflew = nCount == 0 && nOverflowLine == 0;
if ( bItAllOverflew )
@@ -2147,8 +2172,9 @@ NonOverflowingText *Outliner::GetNonOverflowingText() const
bool bLastParaInterrupted =
pEditEngine->GetOverflowingLineNum() > 0;
- return new NonOverflowingText(pTObj, bLastParaInterrupted);
+ return new NonOverflowingText(pTObj, bLastParaInterrupted);
}
+ * */
}
OutlinerParaObject *Outliner::GetEmptyParaObject() const
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 8f7be369b6b7..39f63213c71f 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -697,9 +697,6 @@ void OutlinerView::PasteSpecial()
pOwner->UndoActionStart( OLUNDO_INSERT );
pOwner->pEditEngine->SetUpdateMode( false );
- // XXX:Experiment with QuickDelete
- pOwner->QuickDelete(ESelection(0,0,0,1));
-
pOwner->bPasting = true;
pEditView->PasteSpecial();
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index b015c28d9a14..34f1bb46ed6c 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -135,6 +135,12 @@ NonOverflowingText::NonOverflowingText(const EditTextObject *pTObj, bool bLastP
// XXX: may have to delete pTObj
}
+NonOverflowingText::NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted)
+ : maContentSel(aSel),
+ mbLastParaInterrupted(bLastParaInterrupted)
+{
+}
+
bool NonOverflowingText::IsLastParaInterrupted() const
{
return mbLastParaInterrupted;
@@ -143,9 +149,13 @@ bool NonOverflowingText::IsLastParaInterrupted() const
OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const
{
- OutlinerParaObject *pPObj = new OutlinerParaObject(*mpContentTextObj);
- pPObj->SetOutlinerMode(pOutliner->GetOutlinerMode());
- return pPObj;
+ // XXX: Old code
+ //OutlinerParaObject *pPObj = new OutlinerParaObject(*mpContentTextObj);
+ //pPObj->SetOutlinerMode(pOutliner->GetOutlinerMode());
+ //return pPObj;
+
+ pOutliner->QuickDelete(maContentSel);
+ return pOutliner->CreateParaObject();
}
ESelection NonOverflowingText::GetOverflowPointSel() const
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index ae9b39eecb13..76a9623413d2 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -68,10 +68,12 @@ public:
private:
// Constructor
NonOverflowingText(const EditTextObject *pTObj, bool bLastParaInterrupted);
+ NonOverflowingText(const ESelection &aSel, bool bLastParaInterrupted);
friend class Outliner;
const EditTextObject *mpContentTextObj;
const bool mbLastParaInterrupted;
+ const ESelection maContentSel;
};
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 1da308ad11ff..71fd30f687f5 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -296,7 +296,7 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl)
void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
{
OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pNonOverflOutl);
- impSetTextForEditingOutliner(pNewText);
+ //impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject
GetLinkTarget()->NbcSetOutlinerParaObject(pNewText);
}