[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - include/svx svx/source
matteocam
matteo.campanelli at gmail.com
Mon Jun 1 09:47:13 PDT 2015
include/svx/svdotext.hxx | 1
svx/source/svdraw/svdotext.cxx | 2
svx/source/svdraw/svdotextdecomposition.cxx | 78 ++++++++++++++++++++++------
3 files changed, 65 insertions(+), 16 deletions(-)
New commits:
commit 10690b5ffeedf8ab441b7057298fce8b1caa4581
Author: matteocam <matteo.campanelli at gmail.com>
Date: Mon Jun 1 12:46:10 2015 -0400
Stub of impCopyTextInTextObj2. Removed copying in EndTextEdit
Change-Id: Iff31d54c4ebcff9f50834105a9e1851179181e47
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a15a24d..1e50a68 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -605,6 +605,7 @@ public:
const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
void impCopyTextInTextObj(SdrTextObj *pNextTextObj) const;
+ void impCopyTextInTextObj2(SdrTextObj *pNextTextObj) const;
// Handler for Chained Text
DECL_LINK(ImpDecomposeChainedText,EditStatus*);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 1695183..c0b59e8 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1966,7 +1966,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
if ( pEditStatus->IsPageOverflow() ) {
mpOverflowingText = pEdtOutl->GetOverflowingParaObject();
SdrTextObj *pNextTextObj = GetNextLinkInChain();
- impCopyTextInTextObj(pNextTextObj);
+ impCopyTextInTextObj2(pNextTextObj);
}
}
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 5705da5..36fa13d 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -732,7 +732,9 @@ void SdrTextObj::embedText() const
}
-void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
+// A new temporary implementation of impCopyTextInTextObj
+// Should implement the whole logic
+void SdrTextObj::impCopyTextInTextObj2(SdrTextObj *pNextTextObj) const
{
// prevent copying text in same box
if ( this == pNextTextObj )
@@ -740,23 +742,33 @@ void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
SdrOutliner &rOutliner = ImpGetDrawOutliner();
- // append a string in front of everything
- // NOTE: Trying with set-text first
+ rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+
+ struct OverflowingText {
+ OUString headTxt;
+ OutlinerParaObject *tailParas;
+ };
if (mpOverflowingText) {
- // Set text first
+ // get first para of destination box
+ // XXX: Check it exists
+
+ // Get other paras of destination box
+ // XXX: Check they exist
- rOutliner.SetText(*mpOverflowingText);
- Paragraph *pFstPara = rOutliner.GetParagraph(0);
- OUString aTxtFstPara = rOutliner.GetText(pFstPara);
- rOutliner.SetText("X" + aTxtFstPara, pFstPara);
- // gets the whole thing
- OutlinerParaObject *pNewText = rOutliner.CreateParaObject();
- // draws everything - result = "X" ++ overflowingText
- pNextTextObj->NbcSetOutlinerParaObject(pNewText);
}
+}
+
+
+void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
+{
+ // prevent copying text in same box
+ if ( this == pNextTextObj )
+ return;
+
+ SdrOutliner &rOutliner = ImpGetDrawOutliner();
/*
// Code inspired by SvxOutlinerForwarder::AppendTextPortion
@@ -772,9 +784,44 @@ void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
}
* */
- rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+ rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+
+ // Push text through the chain if there's any
+
+ // append a string in front of everything
+ // NOTE: Trying with set-text first
+
+ if (mpOverflowingText) {
+
+ /* Desired behavior:
+ * - take first overflowing word and paragraph from there
+ * - Outliner::GetOverflowingPara should return the second overflowing para
+ * - then these two should pasted together (as below?)
+ */
+
+ /*
+ * The goal is to have UpdateOverflowingParaNum be finer grained and
+ * work at level of lines instead of para-s
+ */
+
+ // Set new text first
+ rOutliner.SetText(*mpOverflowingText);
+
+ /*
+ * We merge new text in front of the first paragraph
+ * so we get a pointer to it and its text.
+ */
+ Paragraph *pFstPara = rOutliner.GetParagraph(0);
+ OUString aTxtFstPara = rOutliner.GetText(pFstPara);
+
+ //
+ rOutliner.SetText("X" + aTxtFstPara, pFstPara);
+ // gets the whole thing
+ OutlinerParaObject *pNewText = rOutliner.CreateParaObject();
+ // draws everything - result = "X" ++ overflowingText
+ pNextTextObj->NbcSetOutlinerParaObject(pNewText);
+ }
- // Push text through the chain if there's any
rOutliner.SetStatusEventHdl1(Link());
@@ -1488,7 +1535,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
if (mpOverflowingText != NULL) {
SdrTextObj *pNextTextObj = GetNextLinkInChain();
assert (pNextTextObj);
- impCopyTextInTextObj(pNextTextObj); // XXX: it actually moves the overflowing text currently
+ // NOTE: Commented because we do not need to do this anymore (maybe and for now)
+ //impCopyTextInTextObj(pNextTextObj); // XXX: it actually moves the overflowing text currently
// Chaining occurred. Let's reset the status
const_cast<SdrTextObj*>(this)->SetToBeChained( false );
More information about the Libreoffice-commits
mailing list