From 9088a4c2d18f59c22fceb81829441b704603415d Mon Sep 17 00:00:00 2001 From: Tobias Lippert Date: Fri, 6 Jun 2014 00:04:24 +0200 Subject: fdo#30732 Retain selected character attributes for table of contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The text and selected attributes are copied from the source text node and added to the target node at the corresponding positions. Conflicts: sw/inc/ToxTextGenerator.hxx sw/source/core/tox/ToxTextGenerator.cxx Change-Id: Ifa329bfcb2b9691120513236909bcadaf1127b5e Reviewed-on: https://gerrit.libreoffice.org/9610 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/inc/ToxTextGenerator.hxx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'sw/inc/ToxTextGenerator.hxx') diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx index d83736b3eb31..853611491dfe 100644 --- a/sw/inc/ToxTextGenerator.hxx +++ b/sw/inc/ToxTextGenerator.hxx @@ -20,14 +20,20 @@ #ifndef SW_TOXTEXTGENERATOR_HXX_ #define SW_TOXTEXTGENERATOR_HXX_ +#include "rtl/ustring.hxx" #include "sal/types.h" #include "swdllapi.h" #include #include +class SfxItemSet; +class SwAttrPool; +class SwFmtAutoFmt; class SwDoc; class SwForm; class SwPageDesc; +class SwTxtAttr; +class SwTxtNode; struct SwTOXSortTabBase; namespace sw { @@ -54,6 +60,37 @@ public: private: const SwForm& mToxForm; boost::shared_ptr mLinkProcessor; + + /** A handled text token. + * It contains the information which should be added to the target text node. + */ + struct HandledTextToken { + OUString text; + std::vector autoFormats; + std::vector startPositions; + std::vector endPositions; + }; + /** Append text (and selected attributes) to a target node. + * + * Will take the text of @p source, and return the text and the attributes which should be added to the + * target text node. @see CollectAttributesForTox() for the criteria of the attributes which are taken. + */ + static HandledTextToken + HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& attrPool); + + /** Applies the result of a handled text token to a target node. */ + static void + ApplyHandledTextToken(const HandledTextToken& htt, SwTxtNode& targetNode); + + /** Collect the attributes of a hint that shall be copied over to the TOX. + * + * Some text attributes are used in the TOX entries. This method defines which attributes are used. + * + * @param hint The hint from which the attributes are taken + * @param pool The attribute pool for the new items + */ + static boost::shared_ptr + CollectAttributesForTox(const SwTxtAttr& hint, SwAttrPool& pool); }; } -- cgit