[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - editeng/source include/editeng svx/source
matteocam
matteo.campanelli at gmail.com
Tue Jun 30 15:03:31 PDT 2015
editeng/source/outliner/outliner.cxx | 21 ++++++++++++
editeng/source/outliner/overflowingtxt.cxx | 4 ++
include/editeng/overflowingtxt.hxx | 48 +++++++++++++----------------
svx/source/svdraw/textchainflow.cxx | 1
4 files changed, 48 insertions(+), 26 deletions(-)
New commits:
commit 70a2ad32027cb16163e6075a994a4a5ffc47e551
Author: matteocam <matteo.campanelli at gmail.com>
Date: Tue Jun 30 17:59:43 2015 -0400
Using EditTextObject for NonOverflowingText
Change-Id: I148835df1e6f856913e9b6146ccc5431ff4fca97
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index e63c7ff..4fde0ce 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2147,6 +2147,27 @@ NonOverflowingText *Outliner::GetNonOverflowingText() const
nLen += GetLineLen(nOverflowingPara, nLine);
}
+ /* BEGIN Experiment with ESelection and EditTextobject */
+ sal_Int32 nStartPara = 0;
+ sal_Int32 nStartPos = 0;
+ ESelection aNonOverflowingTextSelection;
+ if (nLen == 0) {
+ // XXX: What happens inside this case might be dependent on the joining paragraps or not-thingy
+ // Overflowing paragraph is empty: it's not "Non-Overflowing" text then
+ sal_Int32 nParaLen = GetText(GetParagraph(nOverflowingPara-1)).getLength();
+ aNonOverflowingTextSelection =
+ ESelection(nStartPara, nStartPos, nOverflowingPara-1, nParaLen);
+ } else {
+ // We take until we have to from the overflowing paragraph
+ aNonOverflowingTextSelection =
+ ESelection(nStartPara, nStartPos, nOverflowingPara, nLen);
+ }
+ EditTextObject *pTObj = pEditEngine->CreateTextObject(aNonOverflowingTextSelection);
+ return new NonOverflowingText(pTObj);
+
+
+ /* END Experiment with ESelection and EditTextobject */
+
// XXX: Any separator to be included?
aPreOverflowingTxt = aWholeTxtHeadPara.copy(0, nLen);
}
diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 6565a44..23246fb 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -22,10 +22,14 @@
#include <editeng/overflowingtxt.hxx>
#include <editeng/outliner.hxx>
+#include <editeng/outlobj.hxx>
OutlinerParaObject *NonOverflowingText::ToParaObject(Outliner *pOutliner) const
{
+ if (mpContentTextObj)
+ return new OutlinerParaObject(*mpContentTextObj);
+
// XXX: Possibility: let the NonUnderflowingParaObject just be a TextEditObject created by the Outliner (by means of a selection).
/* The overflow in SdrTextObj can occur:
diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx
index b559921..12e1e7c 100644
--- a/include/editeng/overflowingtxt.hxx
+++ b/include/editeng/overflowingtxt.hxx
@@ -30,9 +30,6 @@ class OutlinerParaObject;
class EditTextObject;
class Outliner;
-typedef EditTextObject FormattedTextPortion;
-
-
class OverflowingText
{
@@ -64,21 +61,26 @@ class NonOverflowingText {
// NOTE: mPreOverflowingTxt might be empty
// Constructor
- NonOverflowingText(
- const OutlinerParaObject *pHeadParas,
- const OUString &preOverflowingTxt)
- : mpHeadParas(pHeadParas),
- mPreOverflowingTxt(preOverflowingTxt)
- {
- if (pHeadParas == NULL) // Redundant line for debugging
- DBG_ASSERT( pHeadParas != NULL, "pHeadParas is null?! All text is overflowing then" );
- }
+ NonOverflowingText(const OutlinerParaObject *pHeadParas,
+ const OUString &preOverflowingTxt)
+ : mpHeadParas(pHeadParas),
+ mPreOverflowingTxt(preOverflowingTxt), mpContentTextObj(NULL)
+ {
+ if (pHeadParas == NULL) // Redundant line for debugging
+ DBG_ASSERT( pHeadParas != NULL, "pHeadParas is null?! All text is overflowing then" );
+ }
+
+ NonOverflowingText(const EditTextObject *pTObj)
+ : mpContentTextObj(pTObj)
+ { }
OutlinerParaObject *ToParaObject(Outliner *) const;
private:
const OutlinerParaObject *mpHeadParas;
OUString mPreOverflowingTxt;
+
+ const EditTextObject *mpContentTextObj;
};
@@ -90,35 +92,31 @@ class NonOverflowingText {
class EDITENG_DLLPUBLIC OFlowChainedText {
public:
- OFlowChainedText(Outliner *);
+ OFlowChainedText(Outliner *);
- OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *);
- OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *);
+ OutlinerParaObject *CreateOverflowingParaObject(Outliner *, OutlinerParaObject *);
+ OutlinerParaObject *CreateNonOverflowingParaObject(Outliner *);
protected:
- void impSetOutlinerToEmptyTxt(Outliner *);
+ void impSetOutlinerToEmptyTxt(Outliner *);
private:
-
- NonOverflowingText *mpNonOverflowingTxt;
- OverflowingText *mpOverflowingTxt;
-
+ NonOverflowingText *mpNonOverflowingTxt;
+ OverflowingText *mpOverflowingTxt;
};
// UFlowChainedText is a simpler class than OFlowChainedText: it almost only joins para-objects
class EDITENG_DLLPUBLIC UFlowChainedText {
public:
- UFlowChainedText(Outliner *);
-
- OutlinerParaObject *CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject *);
+ UFlowChainedText(Outliner *);
+ OutlinerParaObject *CreateMergedUnderflowParaObject(Outliner *, OutlinerParaObject *);
protected:
-
private:
- OutlinerParaObject *mpUnderflowPObj;
+ OutlinerParaObject *mpUnderflowPObj;
};
#endif
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index 2d23aa5..036327c 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -266,7 +266,6 @@ void EditingTextChainFlow::impSetFlowOutlinerParams(SdrOutliner *pFlowOutl, SdrO
*
* Some notes on how to set style sheets:
* - save whole edittexts instead of strings only for (Non)OverflowingText; this can be done by the EditEngine::CreateTextObject method and using a selection - probably from ImpEditEngine)
- * - first, refactor the impGet*ParaObject stuff moving it in some (static?) class in overflowingtxt.hxx. Probably each of these methods should be split in smaller routines.
* - for the refactoring of the previous point we may also add an option for whether we are joining paragraphs or not
* - When making new OutlinerParaObjs and joining paragraphs we need to first add the string (as we already do) and then, with the appropriate selection, use Outliner::QuickSetAttribs(SfxItemSet(txtObj->GetPool()), aSelectionOfTheNewText)
* - having all this in a whole class that contains Overflowing and NonOverflowingText would not be bad. This same class could be used to handle a cursor later on.
More information about the Libreoffice-commits
mailing list