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.hxx72
1 files changed, 61 insertions, 11 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 6ea5612f3164..f20c07c929b3 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -19,6 +19,8 @@
#ifndef INCLUDED_SW_INC_AUTHFLD_HXX
#define INCLUDED_SW_INC_AUTHFLD_HXX
+#include <sal/config.h>
+
#include "swdllapi.h"
#include "fldbas.hxx"
#include "toxe.hxx"
@@ -29,6 +31,10 @@
#include <memory>
#include <vector>
+class SwTOXInternational;
+class SwTextAttr;
+class SwForm;
+
class SwAuthEntry final : public salhelper::SimpleReferenceObject
{
friend class SwAuthorityFieldType;
@@ -41,6 +47,7 @@ public:
inline OUString const & GetAuthorField(ToxAuthorityField ePos) const;
inline void SetAuthorField(ToxAuthorityField ePos,
const OUString& rField);
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
struct SwTOXSortKey
@@ -55,7 +62,7 @@ struct SwTOXSortKey
typedef std::vector<SwTOXSortKey> SortKeyArr;
typedef std::vector<rtl::Reference<SwAuthEntry>> SwAuthDataArr;
-class SW_DLLPUBLIC SwAuthorityFieldType final : public SwFieldType
+class SAL_DLLPUBLIC_RTTI SwAuthorityFieldType final : public SwFieldType
{
SwDoc* m_pDoc;
SwAuthDataArr m_DataArr;
@@ -83,21 +90,22 @@ 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();
m_SequArrRLHidden.clear();
}
- void GetAllEntryIdentifiers( std::vector<OUString>& rToFill ) const;
- SwAuthEntry* GetEntryByIdentifier(std::u16string_view rIdentifier) const;
+ SW_DLLPUBLIC void GetAllEntryIdentifiers( std::vector<OUString>& rToFill ) const;
+ SW_DLLPUBLIC SwAuthEntry* GetEntryByIdentifier(std::u16string_view rIdentifier) const;
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)
@@ -121,23 +129,27 @@ public:
m_bSortByDocument = bSet;
}
- sal_uInt16 GetSortKeyCount() const ;
- const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ;
+ SW_DLLPUBLIC sal_uInt16 GetSortKeyCount() const ;
+ SW_DLLPUBLIC const SwTOXSortKey* GetSortKey(sal_uInt16 nIdx) const ;
void SetSortKeys(sal_uInt16 nKeyCount, SwTOXSortKey const nKeys[]);
//initui.cxx
- static OUString const & GetAuthFieldName(ToxAuthorityField eType);
- static OUString const & GetAuthTypeName(ToxAuthorityType eType);
+ SW_DLLPUBLIC static OUString const & GetAuthFieldName(ToxAuthorityField eType);
+ SW_DLLPUBLIC static OUString const & GetAuthTypeName(ToxAuthorityType eType);
LanguageType GetLanguage() const {return m_eLanguage;}
void SetLanguage(LanguageType nLang) {m_eLanguage = nLang;}
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
@@ -155,13 +167,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;
- SwAuthorityField(SwAuthorityFieldType* pType, const OUString& rFieldContents);
+ SwAuthorityField(SwAuthorityFieldType* pType, std::u16string_view rFieldContents);
SwAuthorityField(SwAuthorityFieldType* pType, SwAuthEntry* pAuthEntry);
virtual ~SwAuthorityField() override;
@@ -176,6 +198,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
+ */
+ SW_DLLPUBLIC 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.
+ */
+ SW_DLLPUBLIC 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