include/svx/textchain.hxx | 24 ++++++++++++++++----- svx/source/svdraw/textchain.cxx | 44 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 9 deletions(-)
New commits: commit d674ed2e472d555a0eb4ec46c7d104ae85907794 Author: matteocam <matteo.campane...@gmail.com> Date: Thu Jun 18 15:24:10 2015 -0400 Prototype of TextChain having support for overwrite on overflow Change-Id: I6ea6e4053663ecdb3e484d857e0a9dd3b7fc1dae diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx index b3eda9b..01798d5 100644 --- a/include/svx/textchain.hxx +++ b/include/svx/textchain.hxx @@ -29,16 +29,19 @@ namespace rtl { class OUString; } -typedef std::map< rtl::OUString, ImpChainLinkProperties > LinkPropertiesMaps; +typedef rtl::OUString ChainLinkId; +typedef std::map< ChainLinkId, ImpChainLinkProperties *> LinkPropertiesMap; class ImpChainLinkProperties { - public: + protected: friend class TextChain; - private: - // all kind of stuff such has MergeableFirstParagraphs or if overflapping should occurr on overflow + ImpChainLinkProperties(); + + bool bOverwriteOnOverflow; + // all kind of stuff such has MergeableFirstParagraphs or if overwrite should occurr on overflow }; @@ -46,13 +49,22 @@ class TextChain { public: TextChain(); + ~TextChain(); + void AppendLink(SdrTextObj *); - SdrTextObj *GetNextLink(SdrTextObj *); + bool IsLinkInChain(SdrTextObj *) const; + SdrTextObj *GetNextLink(SdrTextObj *) const; + + ChainLinkId GetId(SdrTextObj *) const; + ImpChainLinkProperties *GetLinkProperties(SdrTextObj *); // return whether a paragraph is split between the two links in the argument - bool GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj *pNextLink); + bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *); void SetOverwriteOnOverflow(SdrTextObj *, bool ); bool GetOverwriteOnOverflow(SdrTextObj *pTarget); + + protected: + LinkPropertiesMap maLinkPropertiesMap; }; #endif // INCLUDED_SVX_TEXTCHAIN_HXX diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx index 709d562..3637d45 100644 --- a/svx/source/svdraw/textchain.cxx +++ b/svx/source/svdraw/textchain.cxx @@ -20,20 +20,40 @@ #include <svx/textchain.hxx> #include <svx/svdotext.hxx> + +ImpChainLinkProperties::ImpChainLinkProperties() +{ + // give defaults + bOverwriteOnOverflow = false; +} + +// XXX: All getters in the class assume that the guy is in the chain + TextChain::TextChain() { } +TextChain::~TextChain() +{ + // XXX: Should free all LinkProperties +} + +bool TextChain::IsLinkInChain(SdrTextObj *) const +{ + return true; // XXX: Should make an actual check +} + void TextChain::AppendLink(SdrTextObj *) { + // XXX } -SdrTextObj *TextChain::GetNextLink(SdrTextObj *) +SdrTextObj *TextChain::GetNextLink(SdrTextObj *) const { - return NULL; // XXX + return NULL; // XXX: To be changed. It'd be a mess to implement now } -bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj *pNextLink) +bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, SdrTextObj* /* pNextLink */) { // XXX return false; @@ -41,12 +61,30 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite) { + ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); + pLinkProperties->bOverwriteOnOverflow = bOverwrite; +} + +ImpChainLinkProperties *TextChain::GetLinkProperties(SdrTextObj *pLink) +{ + // if the guy does not already have properties in the map make them + ChainLinkId aLinkId = GetId(pLink); + if (maLinkPropertiesMap.find(aLinkId) == maLinkPropertiesMap.end()) { + maLinkPropertiesMap[aLinkId] = new ImpChainLinkProperties; + } + return maLinkPropertiesMap[aLinkId]; } bool TextChain::GetOverwriteOnOverflow(SdrTextObj *pTarget) { + ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); + return pLinkProperties->bOverwriteOnOverflow; +} +ChainLinkId TextChain::GetId(SdrTextObj *pLink) const +{ + return pLink->GetName(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits