[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - editeng/source include/svx svx/source
matteocam
matteo.campanelli at gmail.com
Thu Jul 31 08:59:02 PDT 2014
editeng/source/outliner/outliner.cxx | 38 +++++++++++++++++++++++++++++++++--
include/svx/svdotext.hxx | 13 -----------
svx/source/svdraw/svdotext.cxx | 17 +++++++++++++++
svx/source/svdraw/svdotxed.cxx | 8 +++----
4 files changed, 58 insertions(+), 18 deletions(-)
New commits:
commit 664055f31a4a1178dd88e2b642d27930bb64568e
Author: matteocam <matteo.campanelli at gmail.com>
Date: Thu Jul 31 18:58:16 2014 +0300
Copy second paragraph when breakup occurs
Change-Id: I937c80f0f07b3bf1d5052d962bfd5d075159014f
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ff9217a..f196875 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2090,11 +2090,45 @@ bool Outliner::HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const
OutlinerParaObject *Outliner::GetNonOverflowingParaObject() const
{
- return NULL;
+ /* XXX:
+ * nCount should be the number of paragraphs of the non overflowing text
+ * nStart should be the starting paragraph of the non overflowing text (XXX: Always 0?)
+ */
+
+ if ( GetParagraphCount() < 1 )
+ return NULL;
+
+ // XXX: returns first paragraph
+ sal_Int32 nStartPara = 0;
+ sal_Int32 nCount = 1;
+
+ // code inspired from Outliner::CreateParaObject
+
+ // we need a paragraph data vector and the actual text
+ ParagraphDataVector aParagraphDataVector(nCount);
+ const sal_Int32 nLastPara(nStartPara + nCount - 1);
+
+ for(sal_Int32 nPara(nStartPara); nPara <= nLastPara; nPara++)
+ {
+ aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
+ }
+
+ EditTextObject* pText = pEditEngine->CreateTextObject( nStartPara, nCount );
+ const bool bIsEditDoc(OUTLINERMODE_TEXTOBJECT == ImplGetOutlinerMode());
+
+ OutlinerParaObject* pPObj = new OutlinerParaObject(*pText, aParagraphDataVector, bIsEditDoc);
+ pPObj->SetOutlinerMode(GetMode());
+
+ delete pText;
+ return pPObj;
}
OutlinerParaObject *Outliner::GetOverflowingParaObject() const
{
- return NULL;
+ // XXX: returns second paragraph if there is one, first otherwise
+ if ( GetParagraphCount() >= 2 )
+ return CreateParaObject(1, 1);
+ else
+ return CreateParaObject(0, 1);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 841bf54..b5fa059 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -349,18 +349,7 @@ public:
// Chaining
bool IsToBeChained() const;
- SdrTextObj *GetNextLinkInChain() const {
- /* FIXME(matteocam) return mpNextInChain; */
- if ( pPage && pPage->GetObjCount() > 1) {
- pNextTextObj = dynamic_cast< SdrTextObj * >( pPage->GetObj(1) );
- if ( pNextTextObj == NULL)
- return NULL;
- return pNextTextObj;
- } else {
- fprintf(stderr, "Make New Object please\n");
- return NULL;
- }
- }
+ SdrTextObj *GetNextLinkInChain() const;
SdrObjKind GetTextKind() const { return eTextKind; }
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 0b5e690..1c6a524 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2004,6 +2004,23 @@ void SdrTextObj::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
static_cast< sdr::properties::TextProperties& >(GetProperties()).SetObjectItemNoBroadcast(rItem);
}
+SdrTextObj* SdrTextObj::GetNextLinkInChain() const
+{
+ /* FIXME(matteocam) return mpNextInChain; */
+ SdrTextObj *pNextTextObj = NULL;
+
+ if ( pPage && pPage->GetObjCount() > 1) {
+ pNextTextObj = dynamic_cast< SdrTextObj * >( pPage->GetObj(1) );
+ if ( pNextTextObj == NULL)
+ return NULL;
+ return pNextTextObj;
+ } else {
+ fprintf(stderr, "Make New Object please\n");
+ return NULL;
+ }
+
+}
+
// The concept of the text object:
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index af34e51..f6d3fba 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -251,11 +251,11 @@ void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* p
void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
{
+ OutlinerParaObject* pNewText = NULL;
+ OutlinerParaObject* pNextText = NULL;
+
if(rOutl.IsModified())
{
- OutlinerParaObject* pNewText = NULL;
- OutlinerParaObject* pOverflownText = NULL;
-
// to make the gray field background vanish again
rOutl.UpdateFields();
@@ -295,7 +295,7 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
// sets text to next box
if (pNextText != NULL) {
SdrTextObj *pNextTextObj = GetNextLinkInChain();
- pNextTextObj->SetOutlinerParaObject( pOverflownText );
+ pNextTextObj->SetOutlinerParaObject( pNextText );
pNextTextObj->BegTextEdit( rOutl );
// XXX: Also, will all those calls currently in impCopyTextInTextObj be necessary too?
}
More information about the Libreoffice-commits
mailing list