include/svx/svdotext.hxx | 2 +- svx/source/svdraw/svdedxv.cxx | 5 +++++ svx/source/svdraw/svdotext.cxx | 31 +++++++++++++++++-------------- svx/source/svdraw/textchainflow.cxx | 6 ++++++ 4 files changed, 29 insertions(+), 15 deletions(-)
New commits: commit 9ea78c59302bc8b7451aa886e8894610c9c34140 Author: matteocam <matteo.campane...@gmail.com> Date: Fri Jul 10 16:17:58 2015 -0400 Fixed some errors and removed recursive static drawing Change-Id: I8098dbed7a711b4dad31add1e2ec76d163d0d371 diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index ceeb633..4ab6313 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -367,7 +367,7 @@ public: // Chaining bool IsToBeChained() const; SdrTextObj *GetNextLinkInChain() const; - bool IsChainable() const { return GetNextLinkInChain() != NULL; } + bool IsChainable() const; void SetPreventChainable(); bool GetPreventChainable() const; TextChain *GetTextChain() const; diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 80bd5ff..3abebed 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -491,6 +491,11 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl) if( pTextObj && pOLV) { TextChain *pTextChain = pTextObj->GetTextChain(); + + // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm + if (!pTextObj->IsChainable()) { + return 0; + } // This is true during an underflow-caused overflow (with pEdtOutl->SetText()) if (pTextChain->GetNilChainingEvent(pTextObj)) { return 0; diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index afa40df..567afd9 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1566,8 +1566,8 @@ void SdrTextObj::SetToBeChained(bool bToBeChained) TextChain *SdrTextObj::GetTextChain() const { - if (!IsChainable()) - return NULL; + //if (!IsChainable()) + // return NULL; return pModel->GetTextChain(); } @@ -1984,11 +1984,23 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus ) } } -void SdrTextObj::onChainingEvent() +bool SdrTextObj::IsChainable() const { - if (!IsChainable() || GetNextLinkInChain() == NULL) - return; + if (!GetName().startsWith("Chainable")) { + fprintf(stderr, "[CHAINABLE?] %p is _not_ chainable\n", this); + return false; + } + // Check that no overflow is going on + if (!GetTextChain() || GetTextChain()->GetNilChainingEvent(this)) + return false; + + return true; + +} + +void SdrTextObj::onChainingEvent() +{ if (!pEdtOutl) return; @@ -2073,17 +2085,8 @@ 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")) { - fprintf(stderr, "[CHAINABLE?] %p is _not_ chainable\n", this); - return NULL; - } - sal_uInt32 nextIndex = (GetOrdNum()+1); if (nextIndex < pPage->GetObjCount()) diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index c7531f1..8907e3a 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -145,8 +145,14 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl) if (!mpTargetLink->GetPreventChainable()) mpNextLink->NbcSetOutlinerParaObject(pOutl->GetEmptyParaObject()); + // We store the size since NbcSetOutlinerParaObject can change it + Size aOldSize = pOutl->GetMaxAutoPaperSize(); + mpTargetLink->NbcSetOutlinerParaObject(pNewText); + pOutl->SetMaxAutoPaperSize(aOldSize); + pOutl->SetText(*pNewText); + //GetTextChain()->SetNilChainingEvent(mpTargetLink, false); // Check for new overflow commit cbd8c9dcfd45329cc7afa0b5e17f6363e2254d3f Author: matteocam <matteo.campane...@gmail.com> Date: Fri Jul 10 13:36:50 2015 -0400 Revert "Revert "Prevent multiple chaining events for static text"" This reverts commit f2497029a458b6f33e62776c09f23227c7b3407d. 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) commit f2497029a458b6f33e62776c09f23227c7b3407d Author: matteocam <matteo.campane...@gmail.com> Date: Fri Jul 10 13:25:21 2015 -0400 Revert "Prevent multiple chaining events for static text" This reverts commit 942824a9e0c9bb679e0393122eb38fe4d4f212a1. diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx index 6a70c8b..69b197e 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 (const SdrTextObj *); \ - void Set##PropName (const SdrTextObj *, PropType); + PropType Get##PropName (SdrTextObj *); \ + void Set##PropName (SdrTextObj *, PropType); #define IMPL_CHAIN_PROP_INTERFACE(PropName, PropType) \ - PropType TextChain::Get##PropName (const SdrTextObj *pTarget) { \ + PropType TextChain::Get##PropName (SdrTextObj *pTarget) { \ ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \ return pLinkProperties->a##PropName; \ } \ - void TextChain::Set##PropName (const SdrTextObj *pTarget, PropType aPropParam) \ + void TextChain::Set##PropName (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(const SdrTextObj *) const; - ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *); + ChainLinkId GetId(SdrTextObj *) const; + ImpChainLinkProperties *GetLinkProperties(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 80bd5ff..5e00942 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); // XXX + pTextChain->SetNilChainingEvent(pTextObj, true); // 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 afa40df..0a33fa4 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -2073,10 +2073,6 @@ 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 241ec8b..954f261 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -1490,7 +1490,6 @@ 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; @@ -1515,8 +1514,6 @@ 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 36966bb..a7bd1b6 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(const SdrTextObj *pLink) +ImpChainLinkProperties *TextChain::GetLinkProperties(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(const SdrTextObj *pLink) return maLinkPropertiesMap[aLinkId]; } -ChainLinkId TextChain::GetId(const SdrTextObj *pLink) const +ChainLinkId TextChain::GetId(SdrTextObj *pLink) const { return pLink->GetName(); } diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx index c7531f1..ac1a805 100644 --- a/svx/source/svdraw/textchainflow.cxx +++ b/svx/source/svdraw/textchainflow.cxx @@ -137,7 +137,6 @@ 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); @@ -147,15 +146,12 @@ 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); @@ -164,7 +160,6 @@ void TextChainFlow::ExecuteOverflow(SdrOutliner *pNonOverflOutl, SdrOutliner *pO { impMoveChainedTextToNextLink(pOverflOutl); } - //GetTextChain()->SetNilChainingEvent(mpTargetLink, false); } void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits