summaryrefslogtreecommitdiff
path: root/sw/inc/ToxTextGenerator.hxx
diff options
context:
space:
mode:
authorTobias Lippert <drtl@fastmail.fm>2014-06-06 00:04:24 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-06-06 07:59:21 +0000
commit9088a4c2d18f59c22fceb81829441b704603415d (patch)
treeaa3e24c30336c500f5d726aaeb73492447102cbc /sw/inc/ToxTextGenerator.hxx
parent31d1d684e7d92b45eb896ce974b7b18d435ff955 (diff)
fdo#30732 Retain selected character attributes for table of contents
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/inc/ToxTextGenerator.hxx')
-rw-r--r--sw/inc/ToxTextGenerator.hxx37
1 files changed, 37 insertions, 0 deletions
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 <boost/shared_ptr.hpp>
#include <vector>
+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<ToxLinkProcessor> mLinkProcessor;
+
+ /** A handled text token.
+ * It contains the information which should be added to the target text node.
+ */
+ struct HandledTextToken {
+ OUString text;
+ std::vector<SwFmtAutoFmt*> autoFormats;
+ std::vector<sal_Int32> startPositions;
+ std::vector<sal_Int32> 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<SfxItemSet>
+ CollectAttributesForTox(const SwTxtAttr& hint, SwAttrPool& pool);
};
}