summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorTobias Lippert <drtl@fastmail.fm>2014-06-01 14:24:51 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-06-06 12:19:12 +0000
commit0a1b1511faaa3302429d93ccdad3eb41dc8f36cb (patch)
treeb10e592c90daae9667568f01d59998e5473904dd /sw/inc
parent1534c3363336003c4f84cfec1bf988fef6663f8a (diff)
Unittest generation of text for chapter entries in the TOC
Conflicts: sw/inc/ToxTextGenerator.hxx sw/qa/cppunit/tox/test_ToxTextGenerator.cxx sw/source/core/tox/ToxTextGenerator.cxx Change-Id: I343958f85fb6718215a0caa456a825d72f168a57 Reviewed-on: https://gerrit.libreoffice.org/9612 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/ToxTextGenerator.hxx26
-rw-r--r--sw/inc/chpfld.hxx4
2 files changed, 28 insertions, 2 deletions
diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx
index ba79177aed54..fa52fba7a1c6 100644
--- a/sw/inc/ToxTextGenerator.hxx
+++ b/sw/inc/ToxTextGenerator.hxx
@@ -30,8 +30,13 @@
class SfxItemSet;
class SwAttrPool;
class SwFmtAutoFmt;
+class SwChapterField;
+class SwChapterFieldType;
+class SwCntntFrm;
+class SwCntntNode;
class SwDoc;
class SwForm;
+class SwFormToken;
class SwPageDesc;
class SwTxtAttr;
class SwTxtNode;
@@ -47,7 +52,7 @@ class SW_DLLPUBLIC ToxTextGenerator
public:
ToxTextGenerator(const SwForm& toxForm);
- ~ToxTextGenerator();
+ virtual ~ToxTextGenerator();
/** Generate the text for an entry of a table of X (X is, e.g., content).
*
@@ -118,6 +123,25 @@ private:
static OUString
GetNumStringOfFirstNode(const SwTOXSortTabBase& rBase, bool bUsePrefix, sal_uInt8 nLevel);
+ /** Handle a chapter token.
+ */
+ OUString
+ HandleChapterToken(const SwTOXSortTabBase& rBase, const SwFormToken& aToken, SwDoc* pDoc) const;
+
+ /** Generate the text for a chapter token.
+ */
+ OUString
+ GenerateTextForChapterToken(const SwFormToken& chapterToken, const SwCntntFrm* contentFrame,
+ const SwCntntNode *contentNode) const;
+
+ /** Obtain a ChapterField to use for the text generation.
+ * @internal
+ * This method is overridden in the unittests. Do not override it yourself.
+ */
+ virtual SwChapterField
+ ObtainChapterField(SwChapterFieldType* chapterFieldType, const SwFormToken* chapterToken,
+ const SwCntntFrm* contentFrame, const SwCntntNode *contentNode) const;
+
friend class ::ToxTextGeneratorTest;
};
diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx
index 452c42cf3249..dc59de1e1e61 100644
--- a/sw/inc/chpfld.hxx
+++ b/sw/inc/chpfld.hxx
@@ -24,6 +24,7 @@
class SwFrm;
class SwCntntNode;
class SwTxtNode;
+class ToxTextGeneratorTest;
enum SwChapterFormat
{
@@ -36,7 +37,7 @@ enum SwChapterFormat
CF_END
};
-class SwChapterFieldType : public SwFieldType
+class SW_DLLPUBLIC SwChapterFieldType : public SwFieldType
{
public:
SwChapterFieldType();
@@ -48,6 +49,7 @@ public:
class SW_DLLPUBLIC SwChapterField : public SwField
{
friend class SwChapterFieldType;
+ friend class ToxTextGeneratorTest; // the unittest needs to mock the chapter fields.
sal_uInt8 nLevel;
OUString sTitle;
OUString sNumber;