[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - 18 commits - editeng/source include/editeng include/svx svx/source
matteocam
matteo.campanelli at gmail.com
Thu Aug 20 05:38:43 PDT 2015
editeng/source/editeng/impedit3.cxx | 6
editeng/source/outliner/outliner.cxx | 2
editeng/source/outliner/outlvw.cxx | 13 +
editeng/source/outliner/overflowingtxt.cxx | 193 +++++++++-------------------
include/editeng/editeng.hxx | 2
include/editeng/outliner.hxx | 2
include/editeng/overflowingtxt.hxx | 40 +++--
include/svx/svdedxv.hxx | 4
svx/source/svdraw/svdedxv.cxx | 17 +-
svx/source/svdraw/svdotext.cxx | 3
svx/source/svdraw/svdotextdecomposition.cxx | 11 +
svx/source/svdraw/textchainflow.cxx | 12 +
12 files changed, 143 insertions(+), 162 deletions(-)
New commits:
commit f821b15b200a9d35fbc70b39b79cf4b5832dd2bc
Author: matteocam <matteo.campanelli at gmail.com>
Date: Thu Aug 20 00:25:37 2015 +0200
Add debugging output
Change-Id: I95f62d7ab27fa45a40fa4511a360a3499c39312a
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index ec18975..7965a06 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -570,9 +570,10 @@ void ImpEditEngine::CheckPageOverflow()
? "YES Overflow!\n" : "NO Overflow!\n" ); */
// setting overflow status
+ fprintf(stderr, "[CONTROL_STATUS] AutoPageSize is %s", ( aStatus.GetControlWord() & EEControlBits::AUTOPAGESIZE ) ? "ON\n" : "OFF\n" );
+
sal_uInt32 nBoxHeight = GetMaxAutoPaperSize().Height();
fprintf(stderr, "[OVERFLOW-CHECK] Current MaxAutoPaperHeight is %d\n", nBoxHeight);
- fprintf(stderr, "[CONTROL_STATUS] AutoPageSize is %s", ( aStatus.GetControlWord() & EEControlBits::AUTOPAGESIZE ) ? "ON\n" : "OFF\n" );
sal_uInt32 nTxtHeight = CalcTextHeight(NULL);
fprintf(stderr, "[OVERFLOW-CHECK] Current Text Height is %d\n", nTxtHeight);
commit f146729d0a1465ce7b98ceeb404c29a5e4d6559b
Author: matteocam <matteo.campanelli at gmail.com>
Date: Thu Aug 20 00:23:15 2015 +0200
Add debugging out
Change-Id: I44ee885840eac60bc8ffed86242a3af3e772cce6
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index d49e699..ec18975 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -571,10 +571,11 @@ void ImpEditEngine::CheckPageOverflow()
// setting overflow status
sal_uInt32 nBoxHeight = GetMaxAutoPaperSize().Height();
- fprintf(stderr, "[OVERFLOW-CHECK] Current MaxAutoPaperSize is %d\n", nBoxHeight);
+ fprintf(stderr, "[OVERFLOW-CHECK] Current MaxAutoPaperHeight is %d\n", nBoxHeight);
fprintf(stderr, "[CONTROL_STATUS] AutoPageSize is %s", ( aStatus.GetControlWord() & EEControlBits::AUTOPAGESIZE ) ? "ON\n" : "OFF\n" );
sal_uInt32 nTxtHeight = CalcTextHeight(NULL);
+ fprintf(stderr, "[OVERFLOW-CHECK] Current Text Height is %d\n", nTxtHeight);
sal_uInt32 nParaCount = GetParaPortions().Count();
sal_uInt32 nFirstLineCount = GetLineCount(0);
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 30b7633..11e299b 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2208,8 +2208,6 @@ OverflowingText *Outliner::GetOverflowingText() const
return NULL;
}
-
-
sal_Int32 nHeadPara = pEditEngine->GetOverflowingParaNum();
sal_uInt32 nParaCount = GetParagraphCount();
commit b3fe4c1539fff482558d356c90f30dfaf499f87c
Author: matteocam <matteo.campanelli at gmail.com>
Date: Thu Aug 20 00:14:33 2015 +0200
Add debugging out
Change-Id: Ia50dbcfdef7501c83797986d571058a6bf0c4c2d
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index d50c79c..b46ad22 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -149,6 +149,11 @@ bool NonOverflowingText::IsLastParaInterrupted() const
OutlinerParaObject *NonOverflowingText::RemoveOverflowingText(Outliner *pOutliner) const
{
pOutliner->QuickDelete(maContentSel);
+ fprintf(stderr, "Deleting selection from (Para: %d, Pos: %d) to (Para: %d, Pos: %d)\n",
+ maContentSel.nStartPara,
+ maContentSel.nStartPos,
+ maContentSel.nEndPara,
+ maContentSel.nEndPos);
return pOutliner->CreateParaObject();
}
commit 2c6842cf2df903b73e3c3b1a9fadbdf4d8f85d3e
Author: matteocam <matteo.campanelli at gmail.com>
Date: Thu Aug 20 00:06:40 2015 +0200
Don't set text for editing outl in editing mode
Change-Id: I874a16e1727080d5747161e6f2868152da156385
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 7087aa8..9739eee 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -172,7 +172,9 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
// We store the size since NbcSetOutlinerParaObject can change it
Size aOldSize = pOutl->GetMaxAutoPaperSize();
- mpTargetLink->NbcSetOutlinerParaObject(pNewText);
+ // This should not be done in editing mode!! //XXX
+ if (!mpTargetLink->IsInEditMode())
+ mpTargetLink->NbcSetOutlinerParaObject(pNewText);
// Restore size and set new text
pOutl->SetMaxAutoPaperSize(aOldSize);
commit 0def53aca20c2de4a8121dafaf9ca6b0fc5c650d
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 23:48:24 2015 +0200
Don't chain when editing next link
Change-Id: I3657f458e3968e13e55199eb1f700aa1d8284a6a
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d11e740..3f76a49 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2183,8 +2183,8 @@ void SdrTextObj::SetPreventChainable()
bool SdrTextObj::GetPreventChainable() const
{
- // Prevent changing it 1) during dragging && 2) when we are editing it
- return mbIsUnchainableClone || IsInEditMode();
+ // Prevent chaining it 1) during dragging && 2) when we are editing next link
+ return mbIsUnchainableClone || (GetNextLinkInChain() && GetNextLinkInChain()->IsInEditMode());
}
SdrObject* SdrTextObj::getFullDragClone() const
commit bbb292af490df17a5b7c3f1de89901fd4201d00c
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 23:42:28 2015 +0200
Don't chain when editing next link
Change-Id: I26898d296ce52edee1cf03e692b9427a0b6598f0
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d8b773b..d11e740 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2183,7 +2183,8 @@ void SdrTextObj::SetPreventChainable()
bool SdrTextObj::GetPreventChainable() const
{
- return mbIsUnchainableClone;
+ // Prevent changing it 1) during dragging && 2) when we are editing it
+ return mbIsUnchainableClone || IsInEditMode();
}
SdrObject* SdrTextObj::getFullDragClone() const
commit e9fb2fa539f28206275560439d0564787be5af53
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 23:06:10 2015 +0200
Add debugging output
Change-Id: I9a70674f3c2fa53855bb6c6b4c37d524aa8eb024
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 8bb6603..09c5ff6 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1421,6 +1421,17 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
bool bIsOverflow;
+ // Some debug output
+ size_t nObjCount = pPage->GetObjCount();
+ for (unsigned i = 0; i < nObjCount; i++) {
+ SdrTextObj *pCurObj = (SdrTextObj *) pPage->GetObj(i);
+
+ if (pCurObj == this) {
+ fprintf(stderr, "Working on TextBox %d\n", i);
+ break;
+ }
+ }
+
aTxtChainFlow.CheckForFlowEvents(&rOutliner);
if (aTxtChainFlow.IsUnderflow() && !IsInEditMode())
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 9edf49f..7087aa8 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -310,7 +310,8 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl)
void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
{
- OutlinerParaObject *pNewText = mpOverflChText->RemoveOverflowingText(pNonOverflOutl);
+ //OutlinerParaObject *pNewText =
+ mpOverflChText->RemoveOverflowingText(pNonOverflOutl);
//impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject // XXX: You may need this for Underflow
// XXX: I'm not sure whether we need this (after all operations such as Paste don't change this - as far as I understand)
commit 86a83871e97567d57b359c1ce045b2c4a23161a4
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 22:52:21 2015 +0200
Don't set text during editing mode for OF
Change-Id: Ie0987ac6eed3b30a0c6c6616b59388f954e0c88d
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index e0aaf61..9edf49f 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -313,7 +313,8 @@ void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverf
OutlinerParaObject *pNewText = mpOverflChText->RemoveOverflowingText(pNonOverflOutl);
//impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject // XXX: You may need this for Underflow
- GetLinkTarget()->NbcSetOutlinerParaObject(pNewText);
+ // XXX: I'm not sure whether we need this (after all operations such as Paste don't change this - as far as I understand)
+ //GetLinkTarget()->NbcSetOutlinerParaObject(pNewText);
}
void EditingTextChainFlow::impSetTextForEditingOutliner(OutlinerParaObject *pNewText)
commit 112a628b28ec5525626bd0d3a081045128e83d31
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 22:06:53 2015 +0200
Use appropriate selection for whole text
Change-Id: I43b9e8e5404143d3f3b1e4791ccb3b0d2cf591dc
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index b6b2ab7..d50c79c 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -88,9 +88,11 @@ OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
TranferableText TextChainingUtils::CreateTransferableFromText(Outliner *pOutl)
{
- ESelection aWholeTextSel(0,0, 1000000, 1000000);
+ const EditEngine &rEditEngine = pOutl->GetEditEngine();
+ sal_Int32 nLastPara = rEditEngine.GetParagraphCount()-1;
+ ESelection aWholeTextSel(0, 0, nLastPara, rEditEngine.GetTextLen(nLastPara));
- return pOutl->GetEditEngine().CreateTransferable(aWholeTextSel);
+ return rEditEngine.CreateTransferable(aWholeTextSel);
}
commit 0bcd37fedace6e61577931bf660cd4a594db9e47
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 21:51:51 2015 +0200
Make Underflow use TextChainingUtils
Change-Id: I3dfe64c4b62747b54feb023411a722c20fbdb437
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 1d3ba7c..b6b2ab7 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -108,79 +108,6 @@ ESelection getLastPositionSel(const EditTextObject *pTObj)
return aEndPos;
}
-// Put a para next to each other in the same OutlinerParaObject
-OutlinerParaObject *impGetJuxtaposedParaObject(Outliner *pOutl,
- OutlinerParaObject *pPObj1,
- OutlinerParaObject *pPObj2)
-{
- assert(pOutl && pPObj1 && pPObj2);
-
- pOutl->SetText(*pPObj1);
- pOutl->AddText(*pPObj2);
- OutlinerParaObject *pPObj = pOutl->CreateParaObject();
-
- return pPObj;
-}
-
-// In a deep merge parts of text are not only juxtaposed but the last and first para become the same
-OutlinerParaObject *impGetDeeplyMergedParaObject(Outliner *pOutl,
- OutlinerParaObject *pPObj1,
- OutlinerParaObject *pPObj2)
-{
- assert(pOutl && pPObj1 && pPObj2);
-
- const EditTextObject rTObj1 = pPObj1->GetTextObject();
- const EditTextObject rTObj2 = pPObj2->GetTextObject();
- sal_Int32 nParaCount1 = rTObj1.GetParagraphCount();
-
- // If no paras in the first text, just use second text
- if (nParaCount1 == 0) {
- pOutl->SetText(*pPObj2);
- return pOutl->CreateParaObject();
- }
-
-
- sal_Int32 nLastPara1 = nParaCount1 - 1;
-
- // If last para of first text is empty, discard it and just juxtapose
- if (rTObj1.GetText(nLastPara1) == "" && nParaCount1 >= 2) {
- pOutl->SetText(*pPObj1);
- return impGetJuxtaposedParaObject(
- pOutl,
- pOutl->CreateParaObject(0, nParaCount1 - 1),
- pPObj2);
- }
-
- /* --- Standard procedure: when pPObj1 is 'fine' --- */
-
-
- // Cut first para of second object
- OUString aFirstParaTxt2 = rTObj2.GetText(0);
-
- // Prepare remainder for text 2
- OutlinerParaObject *pRemainderPObj2 = NULL;
- if (rTObj2.GetParagraphCount() > 1) {
- pOutl->SetText(*pPObj2);
- pRemainderPObj2 = pOutl->CreateParaObject(1); // from second para on
- } else { // No text to append
- pRemainderPObj2 = NULL;
- }
-
- // Set first object as text
- pOutl->SetText(*pPObj1);
-
- // Merges LastPara(pPObj1) with FirstPara(pPObj2)
- Paragraph *pLastPara1 = pOutl->GetParagraph(nLastPara1);
- OUString aLastParaTxt1 = pOutl->GetText(pLastPara1);
- pOutl->SetText(aLastParaTxt1 + aFirstParaTxt2, pLastPara1); // XXX: This way it screws up attributes!
-
- // add the remainder of the second text
- if (pRemainderPObj2)
- pOutl->AddText(*pRemainderPObj2);
-
- return pOutl->CreateParaObject();
-}
-
// class OverflowingText
OverflowingText::OverflowingText(TranferableText xOverflowingContent) :
@@ -297,22 +224,21 @@ bool OFlowChainedText::IsLastParaInterrupted() const
UFlowChainedText::UFlowChainedText(Outliner *pOutl, bool bIsDeepMerge)
{
- mpUnderflowPObj = pOutl->CreateParaObject();
+ mxUnderflowingTxt = TextChainingUtils::CreateTransferableFromText(pOutl);
mbIsDeepMerge = bIsDeepMerge;
}
OutlinerParaObject *UFlowChainedText::CreateMergedUnderflowParaObject(Outliner *pOutl, OutlinerParaObject *pNextLinkWholeText)
{
OutlinerParaObject *pNewText = NULL;
- OutlinerParaObject *pCurText = mpUnderflowPObj;
if (mbIsDeepMerge) {
fprintf(stderr, "[TEXTCHAINFLOW - UF] Deep merging paras\n" );
- pNewText = impGetDeeplyMergedParaObject(pOutl, pCurText, pNextLinkWholeText);
+ pNewText = TextChainingUtils::DeeplyMergeParaObject(mxUnderflowingTxt, pOutl, pNextLinkWholeText);
} else {
// NewTextForCurBox = Txt(CurBox) ++ Txt(NextBox)
fprintf(stderr, "[TEXTCHAINFLOW - UF] Juxtaposing paras\n" );
- pNewText = impGetJuxtaposedParaObject(pOutl, pCurText, pNextLinkWholeText);
+ pNewText = TextChainingUtils::JuxtaposeParaObject(mxUnderflowingTxt, pOutl, pNextLinkWholeText);
}
return pNewText;
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index fb08572..9fbdebf 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -143,7 +143,7 @@ class EDITENG_DLLPUBLIC UFlowChainedText {
protected:
private:
- OutlinerParaObject *mpUnderflowPObj;
+ TranferableText mxUnderflowingTxt;
bool mbIsDeepMerge;
};
commit 3bd7833f6f2513208b30c2b17188ad0da5699eb8
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 21:45:43 2015 +0200
Use reference to editengine
Change-Id: I6e13725b418251b7d02a2b9280f9104635e39cfd
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 20cd921..1d3ba7c 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -44,16 +44,18 @@ OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
pOutl->SetText(*pNextPObj);
}
+ EditEngine &rEditEngine = const_cast<EditEngine &>(pOutl->GetEditEngine());
+
// XXX: this code should be moved in Outliner directly
// creating Outliner::InsertText(...transferable...)
- EditSelection aStartSel(pOutl->pEditEngine->CreateSelection(ESelection(0,0)));
- EditSelection aNewSel = pOutl->pEditEngine->InsertText(xOverflowingContent,
- OUString(),
- aStartSel.Min(),
- true);
+ EditSelection aStartSel(rEditEngine.CreateSelection(ESelection(0,0)));
+ EditSelection aNewSel = rEditEngine.InsertText(xOverflowingContent,
+ OUString(),
+ aStartSel.Min(),
+ true);
// Separate Paragraphs
- pOutl->pEditEngine->InsertParaBreak(aNewSel);
+ rEditEngine.InsertParaBreak(aNewSel);
return pOutl->CreateParaObject();
}
@@ -69,15 +71,17 @@ OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
pOutl->SetText(*pNextPObj);
}
+ EditEngine &rEditEngine = const_cast<EditEngine &>(pOutl->GetEditEngine());
+
// XXX: this code should be moved in Outliner directly
// creating Outliner::InsertText(...transferable...)
- EditSelection aStartSel(pOutl->pEditEngine->CreateSelection(ESelection(0,0)));
+ EditSelection aStartSel(rEditEngine.CreateSelection(ESelection(0,0)));
// We don't need to mark the selection
// EditSelection aNewSel =
- pOutl->pEditEngine->InsertText(xOverflowingContent,
- OUString(),
- aStartSel.Min(),
- true);
+ rEditEngine.InsertText(xOverflowingContent,
+ OUString(),
+ aStartSel.Min(),
+ true);
return pOutl->CreateParaObject();
}
@@ -85,7 +89,8 @@ OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
TranferableText TextChainingUtils::CreateTransferableFromText(Outliner *pOutl)
{
ESelection aWholeTextSel(0,0, 1000000, 1000000);
- return pOutl->pEditEngine->CreateTransferable(aWholeTextSel);
+
+ return pOutl->GetEditEngine().CreateTransferable(aWholeTextSel);
}
commit 5ea932dc094f0578144dc95fb20ef5a6c7ae3cea
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 21:37:49 2015 +0200
Added CreateTransferableFromText; Add typedef
Change-Id: I128f9f426948deaf742231b09af667b84a95a6c8
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 126e438..20cd921 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -34,8 +34,7 @@
OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
- com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ TranferableText xOverflowingContent,
Outliner *pOutl,
OutlinerParaObject *pNextPObj)
{
@@ -60,8 +59,7 @@ OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
}
OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
- com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ TranferableText xOverflowingContent,
Outliner *pOutl,
OutlinerParaObject *pNextPObj)
{
@@ -84,6 +82,12 @@ OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
return pOutl->CreateParaObject();
}
+TranferableText TextChainingUtils::CreateTransferableFromText(Outliner *pOutl)
+{
+ ESelection aWholeTextSel(0,0, 1000000, 1000000);
+ return pOutl->pEditEngine->CreateTransferable(aWholeTextSel);
+}
+
/* Helper functions for *OverflowingText classes */
@@ -174,8 +178,7 @@ OutlinerParaObject *impGetDeeplyMergedParaObject(Outliner *pOutl,
// class OverflowingText
-OverflowingText::OverflowingText(com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent) :
+OverflowingText::OverflowingText(TranferableText xOverflowingContent) :
mxOverflowingContent(xOverflowingContent)
{
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 810c7be..fb08572 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -31,6 +31,9 @@ namespace com { namespace sun { namespace star {
class XTransferable;
} } } }
+typedef com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable> TranferableText;
+
class OUString;
@@ -41,19 +44,20 @@ class Outliner;
/*
* A collection of static methods for attaching text.
- * Strongly coupled with some of the classes in this files
+ * Strongly coupled with some of the classes in this file.
*/
class TextChainingUtils
{
public:
+
+ static TranferableText CreateTransferableFromText(Outliner *);
+
static OutlinerParaObject *JuxtaposeParaObject(
- com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ TranferableText xOverflowingContent,
Outliner *,
OutlinerParaObject *);
static OutlinerParaObject *DeeplyMergeParaObject(
- com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ TranferableText xOverflowingContent,
Outliner *,
OutlinerParaObject *);
};
@@ -74,12 +78,10 @@ public:
private:
friend class Outliner;
- OverflowingText(com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> xOverflowingContent);
+ OverflowingText(TranferableText xOverflowingContent);
- com::sun::star::uno::Reference<
- com::sun::star::datatransfer::XTransferable> mxOverflowingContent;
+ TranferableText mxOverflowingContent;
};
class NonOverflowingText {
commit e48cec46b1ce78d0391faef2e84ccfb5c9696393
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 21:24:50 2015 +0200
Minor code cleaning
Change-Id: I53df8cffe04526d1b80d81f14afe5b91f8597e66
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index aa56350..126e438 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -230,22 +230,6 @@ OutlinerParaObject *OverflowingText::JuxtaposeParaObject(Outliner *pOutl, Outlin
return TextChainingUtils::JuxtaposeParaObject(mxOverflowingContent, pOutl, pNextPObj);
}
-// XXX: This method should probably be removed
-OutlinerParaObject *OverflowingText::impMakeOverflowingParaObject(Outliner *)
-{
- /*
- // Simply Juxtaposing; no within-para merging
- OutlinerParaObject *pOverflowingPObj = new OutlinerParaObject(*mpContentTextObj);
- // the OutlinerParaObject constr. at the prev line gives no valid outliner mode, so we set it
- pOverflowingPObj->SetOutlinerMode(pOutliner->GetOutlinerMode());
-
- return pOverflowingPObj;
- */
- assert(0); // Should not be called
- return NULL;
-}
-
-
OutlinerParaObject *OverflowingText::DeeplyMergeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
{
return TextChainingUtils::DeeplyMergeParaObject(mxOverflowingContent, pOutl, pNextPObj);
commit 1f163d68a3f015fbe485012534b7c36f1784654a
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 21:24:41 2015 +0200
Minor code cleaning
Change-Id: I948867ff87a2f331a2765699351e02db53e41539
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 1e5c6e5..810c7be 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -72,20 +72,12 @@ public:
OutlinerParaObject *DeeplyMergeParaObject(Outliner *, OutlinerParaObject *);
ESelection GetInsertionPointSel() const;
- //OUString GetHeadingLines() const;
- //OUString GetEndingLines() const;
- //bool HasOtherParas() const { return !(mTailTxt == "" && mpMidParas == NULL); }
-
private:
friend class Outliner;
- // Constructor
- //OverflowingText(EditTextObject *pTObj);
OverflowingText(com::sun::star::uno::Reference<
com::sun::star::datatransfer::XTransferable> xOverflowingContent);
- OutlinerParaObject *impMakeOverflowingParaObject(Outliner *pOutliner);
- //const EditTextObject *mpContentTextObj;
com::sun::star::uno::Reference<
com::sun::star::datatransfer::XTransferable> mxOverflowingContent;
};
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 194d657..b7c2d26 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -127,7 +127,9 @@ protected:
// handler for AutoGrowing text with active Outliner
DECL_LINK(ImpOutlinerStatusEventHdl,EditStatus*);
- DECL_LINK(ImpChainingEventHdl,void*);
+
+ // Chaining
+ void ImpChainingEventHdl();
DECL_LINK(ImpAfterCutOrPasteChainingEventHdl,void*);
DECL_LINK_TYPED(ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,void);
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 1430e80..b13b860 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -491,7 +491,7 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl,EditStatus*,pEditStat)
return 0;
}
-IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
+void SdrObjEditView::ImpChainingEventHdl()
{
if(pTextEditOutliner )
{
@@ -503,11 +503,11 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
// XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
if (!pTextObj->IsChainable()) {
- return 0;
+ return;
}
// This is true during an underflow-caused overflow (with pEdtOutl->SetText())
if (pTextChain->GetNilChainingEvent(pTextObj)) {
- return 0;
+ return;
}
// We prevent to trigger further handling of overflow/underflow for pTextObj
@@ -549,7 +549,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
fprintf(stderr, "[OnChaining] No Edit Outliner View\n");
}
}
- return 0;
+
}
IMPL_LINK_NOARG(SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl)
@@ -557,7 +557,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl)
SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( GetTextEditObject());
if (!pTextObj)
return 0;
- ImpChainingEventHdl(NULL);
+ ImpChainingEventHdl();
TextChainCursorManager *pCursorManager = new TextChainCursorManager(this, pTextObj);
ImpMoveCursorAfterChainingEvent(pCursorManager);
return 0;
@@ -829,7 +829,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
pTextEditOutlinerView->SetEndCutPasteLinkHdl(LINK(this,SdrObjEditView,ImpAfterCutOrPasteChainingEventHdl) );
/* We should call:
*
- ImpChainingEventHdl(NULL);
+ ImpChainingEventHdl();
TextChainCursorManager *pCursorManager = new TextChainCursorManager(this, pTextObj);
ImpMoveCursorAfterChainingEvent(pCursorManager);
*/
@@ -1346,7 +1346,7 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
}
/* Start chaining processing */
- ImpChainingEventHdl(NULL);
+ ImpChainingEventHdl();
ImpMoveCursorAfterChainingEvent(pCursorManager);
/* End chaining processing */
commit babddd2eb9ff9169d3432d333db2574563e82e6e
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 20:56:09 2015 +0200
Delegate text chaining to TextChainingUtils for OverflowingText
Change-Id: I88cf2eb50486737b4c009ffb5b29dde825b6884e
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index af2c884..aa56350 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -33,14 +33,55 @@
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
+OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
+ com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ Outliner *pOutl,
+ OutlinerParaObject *pNextPObj)
{
- return NULL;
+ 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)));
+ EditSelection aNewSel = pOutl->pEditEngine->InsertText(xOverflowingContent,
+ OUString(),
+ aStartSel.Min(),
+ true);
+
+ // Separate Paragraphs
+ pOutl->pEditEngine->InsertParaBreak(aNewSel);
+
+ return pOutl->CreateParaObject();
}
-OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
+OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
+ com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ Outliner *pOutl,
+ OutlinerParaObject *pNextPObj)
{
- return NULL;
+ 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)));
+ // We don't need to mark the selection
+ // EditSelection aNewSel =
+ pOutl->pEditEngine->InsertText(xOverflowingContent,
+ OUString(),
+ aStartSel.Min(),
+ true);
+
+ return pOutl->CreateParaObject();
}
@@ -186,24 +227,7 @@ ESelection NonOverflowingText::GetOverflowPointSel() const
// XXX: In a sense a better name for OverflowingText and NonOverflowingText are respectively DestLinkText and SourceLinkText
OutlinerParaObject *OverflowingText::JuxtaposeParaObject(Outliner *pOutl, OutlinerParaObject *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)));
- EditSelection aNewSel = pOutl->pEditEngine->InsertText(mxOverflowingContent,
- OUString(),
- aStartSel.Min(),
- true);
-
- // Separate Paragraphs
- pOutl->pEditEngine->InsertParaBreak(aNewSel);
-
- return pOutl->CreateParaObject();
+ return TextChainingUtils::JuxtaposeParaObject(mxOverflowingContent, pOutl, pNextPObj);
}
// XXX: This method should probably be removed
@@ -224,24 +248,7 @@ OutlinerParaObject *OverflowingText::impMakeOverflowingParaObject(Outliner *)
OutlinerParaObject *OverflowingText::DeeplyMergeParaObject(Outliner *pOutl, OutlinerParaObject *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)));
- // We don't need to mark the selection
- // EditSelection aNewSel =
- pOutl->pEditEngine->InsertText(mxOverflowingContent,
- OUString(),
- aStartSel.Min(),
- true);
-
- return pOutl->CreateParaObject();
+ return TextChainingUtils::DeeplyMergeParaObject(mxOverflowingContent, pOutl, pNextPObj);
}
// class OFlowChainedText
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index e5604461..7d8434d 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -145,7 +145,7 @@ class EDITENG_DLLPUBLIC EditEngine
friend class EditDbg;
friend class Outliner;
- friend class OverflowingText;
+ friend class TextChainingUtils;
public:
typedef std::vector<EditView*> ViewsType;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 833a9ad..b4cf0fd 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -585,7 +585,7 @@ class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
friend class OutlinerUndoCheckPara;
friend class OutlinerUndoChangeParaFlags;
- friend class OverflowingText;
+ friend class TextChainingUtils;
OutlinerEditEng* pEditEngine;
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 96f7cac..1e5c6e5 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -46,9 +46,16 @@ class Outliner;
class TextChainingUtils
{
public:
- static OutlinerParaObject *JuxtaposeParaObject(Outliner *, OutlinerParaObject *);
- static OutlinerParaObject *DeeplyMergeParaObject(Outliner *, OutlinerParaObject *);
-
+ static OutlinerParaObject *JuxtaposeParaObject(
+ com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ Outliner *,
+ OutlinerParaObject *);
+ static OutlinerParaObject *DeeplyMergeParaObject(
+ com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable> xOverflowingContent,
+ Outliner *,
+ OutlinerParaObject *);
};
/*
commit b53ef7fcb5948a24a3bdf2cb17e25e28357d4c08
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 20:21:53 2015 +0200
Add class TextChainingUtils
Change-Id: I459b149c6b1a160633326af57aa904c986201747
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 3454aee..af2c884 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -33,6 +33,17 @@
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
+{
+ return NULL;
+}
+
+OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(Outliner *pOutl, OutlinerParaObject *pNextPObj)
+{
+ return NULL;
+}
+
+
/* Helper functions for *OverflowingText classes */
ESelection getLastPositionSel(const EditTextObject *pTObj)
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index 8fb4b97..96f7cac 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -38,6 +38,19 @@ class OutlinerParaObject;
class EditTextObject;
class Outliner;
+
+/*
+ * A collection of static methods for attaching text.
+ * Strongly coupled with some of the classes in this files
+ */
+class TextChainingUtils
+{
+ public:
+ static OutlinerParaObject *JuxtaposeParaObject(Outliner *, OutlinerParaObject *);
+ static OutlinerParaObject *DeeplyMergeParaObject(Outliner *, OutlinerParaObject *);
+
+};
+
/*
* The classes OverflowingText and NonOverflowingText handle the
* actual preparation of the OutlinerParaObjects to be used in destination
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 872b4dc..e0aaf61 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -311,7 +311,7 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl)
void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
{
OutlinerParaObject *pNewText = mpOverflChText->RemoveOverflowingText(pNonOverflOutl);
- //impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject
+ //impSetTextForEditingOutliner(pNewText); //XXX: Don't call it since we do everything with NonOverflowingText::ToParaObject // XXX: You may need this for Underflow
GetLinkTarget()->NbcSetOutlinerParaObject(pNewText);
}
commit 2e8693f0f8f2f2b78e250b08793affce644a9190
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 19:19:22 2015 +0200
Check null pointer before AddUndo in chaining
Change-Id: I90d44cf78bd1ec21fd44596a6b3836933f0fc1bc
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 7ac8413..1430e80 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -536,7 +536,8 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
}
}
- AddUndo(pTxtUndo);
+ if (pTxtUndo)
+ AddUndo(pTxtUndo);
//maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
//SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
commit 9920184dc1e5db9697973e26992ad73c813c1800
Author: matteocam <matteo.campanelli at gmail.com>
Date: Wed Aug 19 18:47:29 2015 +0200
Handle Chaining as last thing in pasting
Change-Id: Id8873c4d02f47704a651dd8677805e2e61969ffd
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 39f6321..3d7b908 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -708,13 +708,18 @@ void OutlinerView::PasteSpecial()
pOwner->ImplSetLevelDependendStyleSheet( nPara );
}
- // XXX: Chaining call
- if (aEndCutPasteLink.IsSet())
- aEndCutPasteLink.Call(NULL);
-
pEditView->SetEditEngineUpdateMode( true );
pOwner->UndoActionEnd( OLUNDO_INSERT );
pEditView->ShowCursor( true, true );
+
+ // Chaining call
+ // NOTE: We need to do this last because it pEditView may be deleted if a switch of box occurs
+ // (If you you have it here you don't need to set updateMode=true everywhere in TextChainFlow)
+ // XXX: I wonder if it has to be within the Undo action for some reason though
+
+ if (aEndCutPasteLink.IsSet())
+ aEndCutPasteLink.Call(NULL);
+
}
}
More information about the Libreoffice-commits
mailing list