[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - include/svx svx/source
matteocam
matteo.campanelli at gmail.com
Fri Jul 10 09:57:44 PDT 2015
include/svx/textchain.hxx | 12 ++++++------
svx/source/svdraw/svdedxv.cxx | 2 +-
svx/source/svdraw/svdotext.cxx | 4 ++++
svx/source/svdraw/svdotextdecomposition.cxx | 3 +++
svx/source/svdraw/textchain.cxx | 4 ++--
svx/source/svdraw/textchainflow.cxx | 5 +++++
6 files changed, 21 insertions(+), 9 deletions(-)
New commits:
commit 942824a9e0c9bb679e0393122eb38fe4d4f212a1
Author: matteocam <matteo.campanelli at gmail.com>
Date: Fri Jul 10 12:56:24 2015 -0400
Prevent multiple chaining events for static text
Change-Id: I3d42cc161dbb2002df710f0bd424bc89fdbfb224
diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 69b197e..6a70c8b 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -53,15 +53,15 @@
a##PropName = (PropDefault);
#define DECL_CHAIN_PROP_INTERFACE(PropName, PropType) \
- PropType Get##PropName (SdrTextObj *); \
- void Set##PropName (SdrTextObj *, PropType);
+ PropType Get##PropName (const SdrTextObj *); \
+ void Set##PropName (const SdrTextObj *, PropType);
#define IMPL_CHAIN_PROP_INTERFACE(PropName, PropType) \
- PropType TextChain::Get##PropName (SdrTextObj *pTarget) { \
+ PropType TextChain::Get##PropName (const SdrTextObj *pTarget) { \
ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
return pLinkProperties->a##PropName; \
} \
- void TextChain::Set##PropName (SdrTextObj *pTarget, PropType aPropParam) \
+ void TextChain::Set##PropName (const SdrTextObj *pTarget, PropType aPropParam) \
{ \
ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
pLinkProperties->a##PropName = aPropParam; \
@@ -139,8 +139,8 @@ class TextChain {
bool IsLinkInChain(SdrTextObj *) const;
SdrTextObj *GetNextLink(SdrTextObj *) const;
- ChainLinkId GetId(SdrTextObj *) const;
- ImpChainLinkProperties *GetLinkProperties(SdrTextObj *);
+ ChainLinkId GetId(const SdrTextObj *) const;
+ ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *);
// Specific Link Properties
DECL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 5e00942..80bd5ff 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -497,7 +497,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
}
// We prevent to trigger further handling of overflow/underflow for pTextObj
- pTextChain->SetNilChainingEvent(pTextObj, true);
+ pTextChain->SetNilChainingEvent(pTextObj, true); // XXX
// Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput
pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 0a33fa4..afa40df 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2073,6 +2073,10 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const
/* FIXME(matteocam) return mpNextInChain; */
SdrTextObj *pNextTextObj = NULL;
+ // Check that no overflow is going on // XXX: This should be moved in IsChainable
+ if (GetTextChain()->GetNilChainingEvent(this))
+ return NULL;
+
if ( pPage && pPage->GetObjCount() > 1) {
if (!GetName().startsWith("Chainable")) {
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 954f261..241ec8b 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1490,6 +1490,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
// We need the outliner we get the overflow info from as well as
// the outliner for "drawing" (e.g. a drawing or chaining outliner)
// maybe the latter ones can be passed at the time of overflow and such
+ GetTextChain()->SetNilChainingEvent(this, true);
TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
bool bIsOverflow;
@@ -1514,6 +1515,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
aTxtChainFlow.ExecuteOverflow(&rOutliner, &rChainingOutl);
}
+ GetTextChain()->SetNilChainingEvent(this, false);
+
/* End overflow/underflow handling */
// set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index a7bd1b6..36966bb 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -67,7 +67,7 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, SdrT
}
-ImpChainLinkProperties *TextChain::GetLinkProperties(SdrTextObj *pLink)
+ImpChainLinkProperties *TextChain::GetLinkProperties(const SdrTextObj *pLink)
{
// if the guy does not already have properties in the map make them
ChainLinkId aLinkId = GetId(pLink);
@@ -78,7 +78,7 @@ ImpChainLinkProperties *TextChain::GetLinkProperties(SdrTextObj *pLink)
return maLinkPropertiesMap[aLinkId];
}
-ChainLinkId TextChain::GetId(SdrTextObj *pLink) const
+ChainLinkId TextChain::GetId(const SdrTextObj *pLink) const
{
return pLink->GetName();
}
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index ac1a805..c7531f1 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -137,6 +137,7 @@ bool TextChainFlow::IsUnderflow() const
// XXX:Would it be possible to unify undeflow and its possibly following overrflow?
void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
{
+ //GetTextChain()->SetNilChainingEvent(mpTargetLink, true);
// making whole text
OutlinerParaObject *pNewText = impGetMergedUnderflowParaObject(pOutl);
@@ -146,12 +147,15 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
mpTargetLink->NbcSetOutlinerParaObject(pNewText);
+ //GetTextChain()->SetNilChainingEvent(mpTargetLink, false);
+
// Check for new overflow
CheckForFlowEvents(pOutl);
}
void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pOverflOutl)
{
+ //GetTextChain()->SetNilChainingEvent(mpTargetLink, true);
// Leave only non overflowing text
impLeaveOnlyNonOverflowingText(pNonOverflOutl);
@@ -160,6 +164,7 @@ void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pO
{
impMoveChainedTextToNextLink(pOverflOutl);
}
+ //GetTextChain()->SetNilChainingEvent(mpTargetLink, false);
}
void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
More information about the Libreoffice-commits
mailing list