summaryrefslogtreecommitdiff
path: root/sw/inc/authfld.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/inc/authfld.hxx')
-rw-r--r--sw/inc/authfld.hxx66
1 files changed, 56 insertions, 10 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 6ea5612f3164..cdb70a5a5a1e 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -16,8 +16,9 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_SW_INC_AUTHFLD_HXX
-#define INCLUDED_SW_INC_AUTHFLD_HXX
+#pragma once
+
+#include <sal/config.h>
#include "swdllapi.h"
#include "fldbas.hxx"
@@ -29,6 +30,9 @@
#include <memory>
#include <vector>
+class SwTOXInternational;
+class SwForm;
+
class SwAuthEntry final : public salhelper::SimpleReferenceObject
{
friend class SwAuthorityFieldType;
@@ -41,6 +45,7 @@ public:
inline OUString const & GetAuthorField(ToxAuthorityField ePos) const;
inline void SetAuthorField(ToxAuthorityField ePos,
const OUString& rField);
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
struct SwTOXSortKey
@@ -83,7 +88,7 @@ public:
void SetDoc(SwDoc* pNewDoc) { m_pDoc = pNewDoc; }
SwDoc* GetDoc(){ return m_pDoc; }
void RemoveField(const SwAuthEntry* nHandle);
- SwAuthEntry* AddField(const OUString& rFieldContents);
+ SwAuthEntry* AddField(std::u16string_view rFieldContents);
void DelSequenceArray()
{
m_SequArr.clear();
@@ -95,9 +100,10 @@ public:
bool ChangeEntryContent(const SwAuthEntry* pNewEntry);
// import interface
- sal_uInt16 AppendField(const SwAuthEntry& rInsert);
+ SwAuthEntry* AppendField(const SwAuthEntry& rInsert);
sal_uInt16 GetSequencePos(const SwAuthEntry* pAuthEntry, SwRootFrame const* pLayout);
+ std::unique_ptr<SwTOXInternational> CreateTOXInternational() const;
bool IsSequence() const {return m_bIsSequence;}
void SetSequence(bool bSet)
@@ -134,10 +140,14 @@ public:
const OUString& GetSortAlgorithm() const {return m_sSortAlgorithm;}
void SetSortAlgorithm(const OUString& rSet) {m_sSortAlgorithm = rSet;}
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
-/** invariant for SwAuthorityField is that it is always registered at its
+/** Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index
+ -> Bibliography Entry.
+
+ invariant for SwAuthorityField is that it is always registered at its
SwAuthorityFieldType via AddField()/RemoveField() & therefore has m_nHandle
set - but it's possible that multiple SwAuthorityField have the same
m_nHandle & so the number of instances is an upper bound on
@@ -145,7 +155,7 @@ public:
one of the instances with the same m_nHandle is actually in the document,
they're all cloned via CopyField()...
*/
-class SAL_DLLPUBLIC_RTTI SwAuthorityField final : public SwField
+class SW_DLLPUBLIC SwAuthorityField final : public SwField
{
rtl::Reference<SwAuthEntry> m_xAuthEntry;
mutable sal_IntPtr m_nTempSequencePos;
@@ -155,13 +165,23 @@ class SAL_DLLPUBLIC_RTTI SwAuthorityField final : public SwField
virtual std::unique_ptr<SwField> Copy() const override;
public:
+ enum TargetType : sal_uInt16
+ {
+ UseDisplayURL = 0,
+ UseTargetURL = 1,
+ None = 2,
+ BibliographyTableRow = 3,
+ // BibliographyTablePage = 4, // TODO: implement
+ };
+
+
/// For internal use only, in general continue using ExpandField() instead.
OUString ConditionalExpandAuthIdentifier(SwRootFrame const* pLayout) const;
//To handle Citation
- SW_DLLPUBLIC OUString ExpandCitation(ToxAuthorityField eField, SwRootFrame const* pLayout) const;
+ OUString ExpandCitation(ToxAuthorityField eField, SwRootFrame const* pLayout) const;
- SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents);
+ SwAuthorityField(SwAuthorityFieldType* pType, std::u16string_view rFieldContents);
SwAuthorityField(SwAuthorityFieldType* pType, SwAuthEntry* pAuthEntry);
virtual ~SwAuthorityField() override;
@@ -176,6 +196,34 @@ public:
SwAuthEntry* GetAuthEntry() const { return m_xAuthEntry.get(); }
virtual OUString GetDescription() const override;
+
+ /**
+ * Returns the line matching the source's default row in the ToX.
+ *
+ * \param pLayout layout to be used
+ * \param pTOX bibliography table to take the format of the string from
+ * \return entry formatted as the appropriate authority type in the table
+ */
+ OUString GetAuthority(const SwRootFrame *pLayout,
+ const SwForm *pTOX = nullptr) const;
+
+ /**
+ * Returns which target should be used when the entry
+ * (the standalone field, such as '[ASDF]', not in the table) is clicked.
+ */
+ TargetType GetTargetType() const;
+ /**
+ * Returns absolute target URL in case there is one (GetTargetType() should be checked).
+ * If there isn't one, the result is undefined.
+ */
+ OUString GetAbsoluteURL() const;
+
+ /**
+ * Returns relative URI for the URL
+ */
+ OUString GetRelativeURI() const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
inline OUString const & SwAuthEntry::GetAuthorField(ToxAuthorityField ePos) const
@@ -190,6 +238,4 @@ inline void SwAuthEntry::SetAuthorField(ToxAuthorityField ePos, const OUString&
m_aAuthFields[ePos] = rField;
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */